@webex/plugin-meetings 3.8.1-web-workers-keepalive.1 → 3.9.0-webinar5k.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/constants.js +8 -2
  4. package/dist/constants.js.map +1 -1
  5. package/dist/hashTree/constants.js +23 -0
  6. package/dist/hashTree/constants.js.map +1 -0
  7. package/dist/hashTree/hashTree.js +516 -0
  8. package/dist/hashTree/hashTree.js.map +1 -0
  9. package/dist/hashTree/hashTreeParser.js +521 -0
  10. package/dist/hashTree/hashTreeParser.js.map +1 -0
  11. package/dist/interpretation/index.js +1 -1
  12. package/dist/interpretation/siLanguage.js +1 -1
  13. package/dist/locus-info/index.js +301 -59
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/meeting/brbState.js +14 -12
  16. package/dist/meeting/brbState.js.map +1 -1
  17. package/dist/meeting/index.js +110 -12
  18. package/dist/meeting/index.js.map +1 -1
  19. package/dist/meeting/muteState.js +2 -5
  20. package/dist/meeting/muteState.js.map +1 -1
  21. package/dist/meeting/request.js +19 -0
  22. package/dist/meeting/request.js.map +1 -1
  23. package/dist/meeting/request.type.js.map +1 -1
  24. package/dist/meeting/util.js +8 -11
  25. package/dist/meeting/util.js.map +1 -1
  26. package/dist/meetings/index.js +6 -2
  27. package/dist/meetings/index.js.map +1 -1
  28. package/dist/member/index.js.map +1 -1
  29. package/dist/member/types.js.map +1 -1
  30. package/dist/members/collection.js +13 -0
  31. package/dist/members/collection.js.map +1 -1
  32. package/dist/members/index.js +44 -23
  33. package/dist/members/index.js.map +1 -1
  34. package/dist/members/request.js +3 -3
  35. package/dist/members/request.js.map +1 -1
  36. package/dist/members/util.js +18 -6
  37. package/dist/members/util.js.map +1 -1
  38. package/dist/multistream/sendSlotManager.js +32 -2
  39. package/dist/multistream/sendSlotManager.js.map +1 -1
  40. package/dist/types/constants.d.ts +6 -0
  41. package/dist/types/hashTree/constants.d.ts +8 -0
  42. package/dist/types/hashTree/hashTree.d.ts +128 -0
  43. package/dist/types/hashTree/hashTreeParser.d.ts +152 -0
  44. package/dist/types/locus-info/index.d.ts +93 -3
  45. package/dist/types/meeting/brbState.d.ts +0 -1
  46. package/dist/types/meeting/index.d.ts +29 -3
  47. package/dist/types/meeting/request.d.ts +9 -1
  48. package/dist/types/meeting/request.type.d.ts +74 -0
  49. package/dist/types/meeting/util.d.ts +3 -3
  50. package/dist/types/member/types.d.ts +1 -0
  51. package/dist/types/members/collection.d.ts +6 -0
  52. package/dist/types/members/index.d.ts +15 -3
  53. package/dist/types/members/request.d.ts +1 -1
  54. package/dist/types/members/util.d.ts +5 -2
  55. package/dist/types/multistream/sendSlotManager.d.ts +16 -0
  56. package/dist/webinar/index.js +1 -1
  57. package/package.json +24 -23
  58. package/src/constants.ts +7 -0
  59. package/src/hashTree/constants.ts +12 -0
  60. package/src/hashTree/hashTree.ts +460 -0
  61. package/src/hashTree/hashTreeParser.ts +556 -0
  62. package/src/locus-info/index.ts +393 -58
  63. package/src/meeting/brbState.ts +9 -7
  64. package/src/meeting/index.ts +104 -6
  65. package/src/meeting/muteState.ts +2 -6
  66. package/src/meeting/request.ts +16 -0
  67. package/src/meeting/request.type.ts +64 -0
  68. package/src/meeting/util.ts +17 -20
  69. package/src/meetings/index.ts +17 -3
  70. package/src/member/index.ts +1 -0
  71. package/src/member/types.ts +1 -0
  72. package/src/members/collection.ts +11 -0
  73. package/src/members/index.ts +33 -7
  74. package/src/members/request.ts +2 -2
  75. package/src/members/util.ts +14 -3
  76. package/src/multistream/sendSlotManager.ts +34 -2
  77. package/test/unit/spec/hashTree/hashTree.ts +394 -0
  78. package/test/unit/spec/hashTree/hashTreeParser.ts +156 -0
  79. package/test/unit/spec/locus-info/index.js +506 -55
  80. package/test/unit/spec/meeting/brbState.ts +9 -9
  81. package/test/unit/spec/meeting/index.js +475 -42
  82. package/test/unit/spec/meeting/request.js +71 -0
  83. package/test/unit/spec/members/index.js +33 -10
  84. package/test/unit/spec/members/request.js +2 -2
  85. package/test/unit/spec/members/utils.js +27 -7
  86. package/test/unit/spec/multistream/sendSlotManager.ts +59 -0
  87. package/test/unit/spec/reachability/index.ts +3 -1
@@ -1,3 +1,4 @@
1
+ /* eslint-disable class-methods-use-this */
1
2
  import {isEqual, assignWith, cloneDeep, isEmpty, forEach} from 'lodash';
2
3
 
3
4
  import LoggerProxy from '../common/logs/logger-proxy';
@@ -30,6 +31,87 @@ import MediaSharesUtils from './mediaSharesUtils';
30
31
  import LocusDeltaParser from './parser';
31
32
  import Metrics from '../metrics';
32
33
  import BEHAVIORAL_METRICS from '../metrics/constants';
34
+ import HashTreeParser, {
35
+ DataSet,
36
+ HashTreeMessage,
37
+ HashTreeObject,
38
+ HtMeta,
39
+ LocusInfoUpdateType,
40
+ ObjectType,
41
+ } from '../hashTree/hashTreeParser';
42
+
43
+ export type LocusLLMEvent = {
44
+ data: {
45
+ eventType: 'locus.state_message';
46
+ stateElementsMessage: HashTreeMessage;
47
+ };
48
+ };
49
+
50
+ export type LocusDTO = {
51
+ controls?: any;
52
+ fullState?: {
53
+ active: boolean;
54
+ count: number;
55
+ lastActive: string;
56
+ locked: boolean;
57
+ sessionId: string;
58
+ seessionIds: string[];
59
+ startTime: number;
60
+ state: string;
61
+ type: string;
62
+ };
63
+ host?: {
64
+ id: string;
65
+ incomingCallProtocols: any[];
66
+ isExternal: boolean;
67
+ name: string;
68
+ orgId: string;
69
+ };
70
+ htMeta?: HtMeta;
71
+ info?: any;
72
+ jsSdkMeta?: {
73
+ removedParticipantIds: string[]; // list of ids of participants that are removed in the last update
74
+ };
75
+ links?: any;
76
+ mediaShares?: any[];
77
+ meetings?: any[];
78
+ participants: any[];
79
+ replaces?: any[];
80
+ self?: any;
81
+ sequence?: {
82
+ dirtyParticipants: number;
83
+ entries: number[];
84
+ rangeEnd: number;
85
+ rangeStart: number;
86
+ sequenceHash: number;
87
+ sessionToken: string;
88
+ since: string;
89
+ totalParticipants: number;
90
+ };
91
+ syncUrl?: string;
92
+ url?: string;
93
+ };
94
+
95
+ export type LocusApiResponseBody = {
96
+ dataSets?: DataSet[];
97
+ locus: LocusDTO; // this LocusDTO here might not be the full one (for example it won't have all the participants, but it should have self)
98
+ };
99
+
100
+ const LocusDtoTopLevelKeys = [
101
+ 'controls',
102
+ 'fullState',
103
+ 'host',
104
+ 'info',
105
+ 'links',
106
+ 'mediaShares',
107
+ 'meetings',
108
+ 'participants',
109
+ 'replaces',
110
+ 'self',
111
+ 'sequence',
112
+ 'syncUrl',
113
+ 'url',
114
+ ];
33
115
 
34
116
  /**
35
117
  * @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
@@ -70,6 +152,9 @@ export default class LocusInfo extends EventsScope {
70
152
  resources: any;
71
153
  mainSessionLocusCache: any;
72
154
  self: any;
155
+ hashTreeParser?: HashTreeParser;
156
+ hashTreeObjectId2ParticipantId: Map<number, string>; // mapping of hash tree object ids to participant ids
157
+
73
158
  /**
74
159
  * Constructor
75
160
  * @param {function} updateMeeting callback to update the meeting object from an object
@@ -88,6 +173,7 @@ export default class LocusInfo extends EventsScope {
88
173
  this.meetingId = meetingId;
89
174
  this.updateMeeting = updateMeeting;
90
175
  this.locusParser = new LocusDeltaParser();
176
+ this.hashTreeObjectId2ParticipantId = new Map();
91
177
  }
92
178
 
93
179
  /**
@@ -99,6 +185,7 @@ export default class LocusInfo extends EventsScope {
99
185
  private doLocusSync(meeting: any) {
100
186
  let isDelta;
101
187
  let url;
188
+ let meetingDestroyed = false;
102
189
 
103
190
  if (this.locusParser.workingCopy.syncUrl) {
104
191
  url = this.locusParser.workingCopy.syncUrl;
@@ -134,32 +221,56 @@ export default class LocusInfo extends EventsScope {
134
221
 
135
222
  isDelta = false;
136
223
 
137
- return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) => {
138
- LoggerProxy.logger.info(
139
- 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
140
- );
141
- this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
142
- throw err;
143
- });
224
+ // Locus sometimes returns 403, for example if meeting has ended, no point trying the fallback to full sync in that case
225
+ if (e.statusCode !== 403) {
226
+ return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) => {
227
+ LoggerProxy.logger.info(
228
+ 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
229
+ );
230
+ this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
231
+ meetingDestroyed = true;
232
+ throw err;
233
+ });
234
+ }
235
+ LoggerProxy.logger.info(
236
+ 'Locus-info:index#doLocusSync --> got 403 from Locus, skipping fallback to full sync, destroying the meeting'
237
+ );
238
+ } else {
239
+ LoggerProxy.logger.info(
240
+ 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
241
+ );
144
242
  }
145
- LoggerProxy.logger.info(
146
- 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
147
- );
148
243
  this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
244
+ meetingDestroyed = true;
149
245
  throw e;
150
246
  })
151
247
  .then((res) => {
152
- if (isDelta) {
153
- if (!isEmpty(res.body)) {
154
- meeting.locusInfo.handleLocusDelta(res.body, meeting);
155
- } else {
248
+ if (isEmpty(res.body)) {
249
+ if (isDelta) {
156
250
  LoggerProxy.logger.info(
157
251
  'Locus-info:index#doLocusSync --> received empty body from syncUrl, so we already have latest Locus DTO'
158
252
  );
253
+ } else {
254
+ LoggerProxy.logger.info(
255
+ 'Locus-info:index#doLocusSync --> received empty body from full DTO sync request'
256
+ );
159
257
  }
160
- } else {
161
- meeting.locusInfo.onFullLocus(res.body);
258
+
259
+ return;
162
260
  }
261
+
262
+ if (isDelta) {
263
+ if (res.body.baseSequence) {
264
+ meeting.locusInfo.handleLocusDelta(res.body, meeting); // todo: check if this is safe, is isDelta=true always only for non-hash tree locus
265
+
266
+ return;
267
+ }
268
+ // in some cases Locus might return us full DTO even when we asked for a delta
269
+ LoggerProxy.logger.info(
270
+ 'Locus-info:index#doLocusSync --> got full DTO when we asked for delta'
271
+ );
272
+ }
273
+ meeting.locusInfo.onFullLocus(res.body);
163
274
  })
164
275
  .catch((e) => {
165
276
  LoggerProxy.logger.info(
@@ -176,9 +287,11 @@ export default class LocusInfo extends EventsScope {
176
287
  });
177
288
  })
178
289
  .finally(() => {
179
- // Notify parser to resume processing delta events.
180
- // Any deltas in the queue that have now been superseded by this sync will simply be ignored
181
- this.locusParser.resume();
290
+ if (!meetingDestroyed) {
291
+ // Notify parser to resume processing delta events.
292
+ // Any deltas in the queue that have now been superseded by this sync will simply be ignored
293
+ this.locusParser.resume();
294
+ }
182
295
  });
183
296
  }
184
297
 
@@ -271,7 +384,7 @@ export default class LocusInfo extends EventsScope {
271
384
  this.updateLocusCache(locus);
272
385
  // above section only updates the locusInfo object
273
386
  // The below section makes sure it updates the locusInfo as well as updates the meeting object
274
- this.updateParticipants(locus.participants);
387
+ this.updateParticipants(locus.participants, []);
275
388
  // For 1:1 space meeting the conversation Url does not exist in locus.conversation
276
389
  this.updateConversationUrl(locus.conversationUrl, locus.info);
277
390
  this.updateControls(locus.controls, locus.self);
@@ -289,17 +402,190 @@ export default class LocusInfo extends EventsScope {
289
402
 
290
403
  /**
291
404
  * @param {Object} locus
405
+ * @param {DataSet[]} [dataSets=[]] - Array of data sets
292
406
  * @returns {undefined}
293
407
  * @memberof LocusInfo
294
408
  */
295
- initialSetup(locus: object) {
409
+ initialSetup(locus: object, dataSets: DataSet[] = []) {
296
410
  this.updateLocusCache(locus);
297
- this.onFullLocus(locus);
411
+ this.onFullLocus(locus, undefined, dataSets);
298
412
 
299
413
  // Change it to true after it receives it first locus object
300
414
  this.emitChange = true;
301
415
  }
302
416
 
417
+ /**
418
+ *
419
+ * @param {HashTreeObject} object data set object
420
+ * @param {any} locus
421
+ * @returns {void}
422
+ */
423
+ updateHashTreeObjectInLocus(object: HashTreeObject, locus: LocusDTO): LocusDTO {
424
+ const type = object.htMeta.elementId.type.toLowerCase();
425
+
426
+ switch (type) {
427
+ case ObjectType.locus: {
428
+ if (!object.data) {
429
+ LoggerProxy.logger.warn(
430
+ `Locus-info:index#updateHashTreeObjectInLocus --> received LOCUS object without data, this is not supported!`
431
+ );
432
+
433
+ return locus;
434
+ }
435
+ // replace the main locus
436
+
437
+ // The Locus object from MAIN dataset has empty participants, so removing them to avoid it overriding the ones in our current locus object
438
+ // Also, it doesn't have "self". That's OK as it won't override existing locus.self and also existing SDK code can handle that missing self in Locus updates
439
+ const locusObjectFromData = object.data;
440
+ delete locusObjectFromData.participants;
441
+
442
+ locus = {...locus, ...locusObjectFromData};
443
+ locus.htMeta = object.htMeta;
444
+ break;
445
+ }
446
+ case ObjectType.participant:
447
+ LoggerProxy.logger.info(
448
+ `Locus-info:index#updateHashTreeObjectInLocus --> participant id=${
449
+ object.htMeta.elementId.id
450
+ } ${object.data ? 'updated' : 'removed'}`
451
+ );
452
+ console.log(
453
+ 'marcin: hashTreeObjectId2ParticipantId=',
454
+ cloneDeep(this.hashTreeObjectId2ParticipantId)
455
+ );
456
+ if (object.data) {
457
+ if (!locus.participants) {
458
+ locus.participants = [];
459
+ }
460
+ const participantObject = object.data;
461
+ participantObject.htMeta = object.htMeta;
462
+ locus.participants.push(participantObject);
463
+ this.hashTreeObjectId2ParticipantId.set(object.htMeta.elementId.id, participantObject.id);
464
+ } else {
465
+ const participantId = this.hashTreeObjectId2ParticipantId.get(object.htMeta.elementId.id);
466
+
467
+ if (!locus.jsSdkMeta) {
468
+ locus.jsSdkMeta = {removedParticipantIds: []};
469
+ }
470
+ locus.jsSdkMeta.removedParticipantIds.push(participantId);
471
+ this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
472
+ }
473
+ break;
474
+ case ObjectType.self:
475
+ if (!object.data) {
476
+ LoggerProxy.logger.warn(
477
+ `Locus-info:index#updateHashTreeObjectInLocus --> received SELF object without data, this is not supported!`
478
+ );
479
+
480
+ return locus;
481
+ }
482
+ locus.self = object.data;
483
+ break;
484
+ }
485
+
486
+ return locus;
487
+ }
488
+
489
+ /**
490
+ * Handles HTTP response from Locus API call when hash tree update.
491
+ * @param {Meeting} meeting meeting object
492
+ * @param {LocusApiResponseBody} responseBody body of the http reponse from Locus API call
493
+ * @returns {void}
494
+ */
495
+ handleLocusAPIResponse(meeting, responseBody: LocusApiResponseBody): void {
496
+ console.log('marcin: locus response from API call:', responseBody);
497
+ if (responseBody.dataSets) {
498
+ if (!this.hashTreeParser) {
499
+ LoggerProxy.logger.warn(
500
+ `Locus-info:index#handleLocusAPIResponse --> received response with hash tree info from Locus API, but we don't have the hashTreeParser created`
501
+ );
502
+
503
+ return;
504
+ }
505
+ // Locus is using the new hash tree mechanism
506
+ // so update our data in the hash tree parser
507
+ this.hashTreeParser.handleLocusUpdate(responseBody);
508
+
509
+ // but the Locus object we receive in this case looks same like classic delta, so we can use existing delta method to process it
510
+ this.onDeltaLocus(responseBody.locus);
511
+ } else {
512
+ // classic Locus delta
513
+ this.handleLocusDelta(responseBody.locus, meeting);
514
+ }
515
+ }
516
+
517
+ /**
518
+ * Handles a hash tree message received from Locus.
519
+ *
520
+ * @param {Meeting} meeting - The meeting object
521
+ * @param {HashTreeMessage} message incoming hash tree message
522
+ * @returns {void}
523
+ */
524
+ private handleHashTreeMessage(meeting: any, message: HashTreeMessage) {
525
+ if (!this.hashTreeParser) {
526
+ LoggerProxy.logger.warn(
527
+ `Locus-info:index#handleHashTreeMessage --> received hash tree message, but we don't have the hashTreeParser`
528
+ );
529
+
530
+ return;
531
+ }
532
+ if (message.locusStateElements === undefined) {
533
+ // todo: need to see in practice how exactly the heartbeat messages look like
534
+ this.hashTreeParser.handleRootHashHeartBeatMessage(message);
535
+ } else {
536
+ this.hashTreeParser.handleMessage(message);
537
+ }
538
+ }
539
+
540
+ /**
541
+ * Updates our locus info based on the data parsed by the hash tree parser.
542
+ *
543
+ * @param {LocusInfoUpdateType} updateType - The type of update received.
544
+ * @param {Object} [data] - Additional data for the update, if applicable.
545
+ * @returns {void}
546
+ */
547
+ private updateFromHashTree(
548
+ updateType: LocusInfoUpdateType,
549
+ data?: {updatedObjects: HashTreeObject[]}
550
+ ) {
551
+ switch (updateType) {
552
+ case LocusInfoUpdateType.OBJECTS_UPDATED: {
553
+ // initialize the main locus with what we currently have
554
+ // but with empty participants array
555
+ let locus: LocusDTO = {
556
+ participants: [],
557
+ jsSdkMeta: {removedParticipantIds: []},
558
+ };
559
+
560
+ LocusDtoTopLevelKeys.forEach((key) => {
561
+ if (key === 'participants') {
562
+ locus[key] = [];
563
+ } else {
564
+ locus[key] = cloneDeep(this[key]);
565
+ }
566
+ });
567
+
568
+ // apply the updates from the hash tree onto the locus
569
+ data.updatedObjects.forEach((object) => {
570
+ locus = this.updateHashTreeObjectInLocus(object, locus);
571
+ });
572
+
573
+ // update our locus info with the new locus
574
+ this.onDeltaLocus(locus);
575
+
576
+ break;
577
+ }
578
+
579
+ case LocusInfoUpdateType.MEETING_ENDED: {
580
+ LoggerProxy.logger.info(
581
+ `Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ${this.meetingId}`
582
+ );
583
+ const meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
584
+ this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
585
+ }
586
+ }
587
+ }
588
+
303
589
  /**
304
590
  * @param {Meeting} meeting
305
591
  * @param {Object} data
@@ -307,36 +593,43 @@ export default class LocusInfo extends EventsScope {
307
593
  * @memberof LocusInfo
308
594
  */
309
595
  parse(meeting: any, data: any) {
310
- // eslint-disable-next-line @typescript-eslint/no-shadow
311
- const {eventType} = data;
312
- const locus = this.getTheLocusToUpdate(data.locus);
313
- LoggerProxy.logger.info(`Locus-info:index#parse --> received locus data: ${eventType}`);
314
-
315
- switch (eventType) {
316
- case LOCUSEVENT.PARTICIPANT_JOIN:
317
- case LOCUSEVENT.PARTICIPANT_LEFT:
318
- case LOCUSEVENT.CONTROLS_UPDATED:
319
- case LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
320
- case LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
321
- case LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
322
- case LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
323
- case LOCUSEVENT.SELF_CHANGED:
324
- case LOCUSEVENT.PARTICIPANT_UPDATED:
325
- case LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
326
- case LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
327
- case LOCUSEVENT.PARTICIPANT_DECLINED:
328
- case LOCUSEVENT.FLOOR_GRANTED:
329
- case LOCUSEVENT.FLOOR_RELEASED:
330
- this.onFullLocus(locus, eventType);
331
- break;
332
- case LOCUSEVENT.DIFFERENCE:
333
- this.handleLocusDelta(locus, meeting);
334
- break;
335
-
336
- default:
337
- // Why will there be a event with no eventType ????
338
- // we may not need this, we can get full locus
339
- this.handleLocusDelta(locus, meeting);
596
+ if (data.eventType === 'locus.state_message') {
597
+ // this is the new hashmap Locus message format (only applicable to webinars for now)
598
+ this.handleHashTreeMessage(meeting, data.stateElementsMessage as HashTreeMessage);
599
+ } else {
600
+ // eslint-disable-next-line @typescript-eslint/no-shadow
601
+ const {eventType} = data;
602
+ const locus = this.getTheLocusToUpdate(data.locus);
603
+ LoggerProxy.logger.info(`Locus-info:index#parse --> received locus data: ${eventType}`);
604
+
605
+ locus.jsSdkMeta = {removedParticipantIds: []};
606
+
607
+ switch (eventType) {
608
+ case LOCUSEVENT.PARTICIPANT_JOIN:
609
+ case LOCUSEVENT.PARTICIPANT_LEFT:
610
+ case LOCUSEVENT.CONTROLS_UPDATED:
611
+ case LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
612
+ case LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
613
+ case LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
614
+ case LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
615
+ case LOCUSEVENT.SELF_CHANGED:
616
+ case LOCUSEVENT.PARTICIPANT_UPDATED:
617
+ case LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
618
+ case LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
619
+ case LOCUSEVENT.PARTICIPANT_DECLINED:
620
+ case LOCUSEVENT.FLOOR_GRANTED:
621
+ case LOCUSEVENT.FLOOR_RELEASED:
622
+ this.onFullLocus(locus, eventType);
623
+ break;
624
+ case LOCUSEVENT.DIFFERENCE:
625
+ this.handleLocusDelta(locus, meeting);
626
+ break;
627
+
628
+ default:
629
+ // Why will there be a event with no eventType ????
630
+ // we may not need this, we can get full locus
631
+ this.handleLocusDelta(locus, meeting);
632
+ }
340
633
  }
341
634
  }
342
635
 
@@ -355,17 +648,46 @@ export default class LocusInfo extends EventsScope {
355
648
  * updates the locus with full locus object
356
649
  * @param {object} locus locus object
357
650
  * @param {string} eventType particulat locus event
651
+ * @param {DataSet[]} dataSets
358
652
  * @returns {object} null
359
653
  * @memberof LocusInfo
360
654
  */
361
- onFullLocus(locus: any, eventType?: string) {
655
+ onFullLocus(locus: any, eventType?: string, dataSets?: Array<DataSet>) {
362
656
  if (!locus) {
363
657
  LoggerProxy.logger.error(
364
658
  'Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.'
365
659
  );
366
660
  }
367
661
 
368
- if (!this.locusParser.isNewFullLocus(locus)) {
662
+ if (dataSets) {
663
+ // this is the new hashmap Locus DTO format (only applicable to webinars for now)
664
+ if (!this.hashTreeParser) {
665
+ LoggerProxy.logger.info(`Locus-info:index#onFullLocus --> creating hash tree parser`);
666
+ LoggerProxy.logger.info(
667
+ 'Locus-info:index#onFullLocus --> dataSets:',
668
+ dataSets,
669
+ ' and locus:',
670
+ locus
671
+ );
672
+ this.hashTreeParser = new HashTreeParser({
673
+ initialLocus: {locus, dataSets},
674
+ webexRequest: this.webex.request.bind(this.webex),
675
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
676
+ debugId: `HT-${this.meetingId.substring(0, 4)}`,
677
+ });
678
+ } else {
679
+ // in this case the Locus we're getting is not necessarily the full one
680
+ // so treat it like if we just got it in a message
681
+ console.log('marcin: !!!!!!!! full DTO - this is not fully implemented/tested yet');
682
+
683
+ LoggerProxy.logger.warn(
684
+ 'Locus-info:index#onFullLocus --> full DTO - this is not fully implemented/tested yet!!!!!!!!'
685
+ );
686
+ this.handleLocusAPIResponse(undefined, {dataSets, locus});
687
+
688
+ return;
689
+ }
690
+ } else if (!this.locusParser.isNewFullLocus(locus)) {
369
691
  LoggerProxy.logger.info(
370
692
  `Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=${eventType}`
371
693
  );
@@ -376,9 +698,16 @@ export default class LocusInfo extends EventsScope {
376
698
  this.updateParticipantDeltas(locus.participants);
377
699
  this.scheduledMeeting = locus.meeting || null;
378
700
  this.participants = locus.participants;
701
+ this.participants?.forEach((participant) => {
702
+ this.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
703
+ });
379
704
  const isReplaceMembers = ControlsUtils.isNeedReplaceMembers(this.controls, locus.controls);
380
705
  this.updateLocusInfo(locus);
381
- this.updateParticipants(locus.participants, isReplaceMembers);
706
+ this.updateParticipants(
707
+ locus.participants,
708
+ locus.jsSdkMeta?.removedParticipantIds,
709
+ isReplaceMembers
710
+ );
382
711
  this.isMeetingActive();
383
712
  this.handleOneOnOneEvent(eventType);
384
713
  this.updateEmbeddedApps(locus.embeddedApps);
@@ -440,7 +769,11 @@ export default class LocusInfo extends EventsScope {
440
769
  const isReplaceMembers = ControlsUtils.isNeedReplaceMembers(this.controls, locus.controls);
441
770
  this.mergeParticipants(this.participants, locus.participants);
442
771
  this.updateLocusInfo(locus);
443
- this.updateParticipants(locus.participants, isReplaceMembers);
772
+ this.updateParticipants(
773
+ locus.participants,
774
+ locus.jsSdkMeta?.removedParticipantIds,
775
+ isReplaceMembers
776
+ );
444
777
  this.isMeetingActive();
445
778
  }
446
779
 
@@ -462,12 +795,12 @@ export default class LocusInfo extends EventsScope {
462
795
  this.updateCreated(locus.created);
463
796
  this.updateFullState(locus.fullState);
464
797
  this.updateHostInfo(locus.host);
798
+ this.updateLocusUrl(locus.url);
465
799
  this.updateMeetingInfo(locus.info, locus.self);
466
800
  this.updateMediaShares(locus.mediaShares);
467
801
  this.updateParticipantsUrl(locus.participantsUrl);
468
802
  this.updateReplace(locus.replace);
469
803
  this.updateSelf(locus.self);
470
- this.updateLocusUrl(locus.url);
471
804
  this.updateAclUrl(locus.aclUrl);
472
805
  this.updateBasequence(locus.baseSequence);
473
806
  this.updateSequence(locus.sequence);
@@ -780,11 +1113,12 @@ export default class LocusInfo extends EventsScope {
780
1113
  /**
781
1114
  * update meeting's members
782
1115
  * @param {Object} participants new participants object
1116
+ * @param {Array} removedParticipantIds list of removed participants
783
1117
  * @param {Boolean} isReplace is replace the whole members
784
1118
  * @returns {Array} updatedParticipants
785
1119
  * @memberof LocusInfo
786
1120
  */
787
- updateParticipants(participants: object, isReplace?: boolean) {
1121
+ updateParticipants(participants: object, removedParticipantIds: string[], isReplace?: boolean) {
788
1122
  this.emitScoped(
789
1123
  {
790
1124
  file: 'locus-info',
@@ -793,6 +1127,7 @@ export default class LocusInfo extends EventsScope {
793
1127
  EVENTS.LOCUS_INFO_UPDATE_PARTICIPANTS,
794
1128
  {
795
1129
  participants,
1130
+ removedParticipantIds,
796
1131
  recordingId: this.parsedLocus.controls && this.parsedLocus.controls.record?.modifiedBy,
797
1132
  selfIdentity: this.parsedLocus.self && this.parsedLocus.self.selfIdentity,
798
1133
  selfId: this.parsedLocus.self && this.parsedLocus.self.selfId,
@@ -58,7 +58,13 @@ export class BrbState {
58
58
  public enable(enabled: boolean, sendSlotManager: SendSlotManager) {
59
59
  this.state.client.enabled = enabled;
60
60
 
61
- return this.applyClientStateToServer(sendSlotManager);
61
+ // Don't set the source state override if enabling brb fails
62
+ return this.applyClientStateToServer(sendSlotManager).then(() => {
63
+ sendSlotManager.setSourceStateOverride(
64
+ MediaType.VideoMain,
65
+ this.state.client.enabled ? 'away' : null
66
+ );
67
+ });
62
68
  }
63
69
 
64
70
  /**
@@ -92,7 +98,7 @@ export class BrbState {
92
98
 
93
99
  this.state.syncToServerInProgress = true;
94
100
 
95
- return this.sendLocalBrbStateToServer(sendSlotManager)
101
+ return this.sendLocalBrbStateToServer()
96
102
  .then(() => {
97
103
  this.state.syncToServerInProgress = false;
98
104
 
@@ -120,10 +126,9 @@ export class BrbState {
120
126
  /**
121
127
  * Send the local brb state to the server
122
128
  *
123
- * @param {SendSlotManager} sendSlotManager
124
129
  * @returns {Promise}
125
130
  */
126
- private async sendLocalBrbStateToServer(sendSlotManager: SendSlotManager) {
131
+ private async sendLocalBrbStateToServer() {
127
132
  const {enabled} = this.state.client;
128
133
 
129
134
  if (!this.meeting.isMultistream) {
@@ -153,9 +158,6 @@ export class BrbState {
153
158
  deviceUrl: this.meeting.deviceUrl,
154
159
  selfId: this.meeting.selfId,
155
160
  })
156
- .then(() => {
157
- sendSlotManager.setSourceStateOverride(MediaType.VideoMain, enabled ? 'away' : null);
158
- })
159
161
  .catch((error) => {
160
162
  LoggerProxy.logger.error('Meeting:brbState#sendLocalBrbStateToServer: Error ', error);
161
163