@webex/plugin-meetings 3.12.0-next.72 → 3.12.0-next.73

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.
@@ -43,6 +43,8 @@ export default class ControlsOptionsManager {
43
43
  * @memberof ControlsOptionsManager
44
44
  */
45
45
  private mainLocusUrl;
46
+ private getControls;
47
+ private isWebinar;
46
48
  /**
47
49
  * @param {MeetingRequest} request
48
50
  * @param {Object} options
@@ -52,6 +54,8 @@ export default class ControlsOptionsManager {
52
54
  constructor(request: MeetingRequest, options?: {
53
55
  locusUrl: string;
54
56
  displayHints?: Array<string>;
57
+ getControls?: () => Record<string, any>;
58
+ isWebinar?: () => boolean;
55
59
  });
56
60
  /**
57
61
  * @param {MeetingRequest} request
@@ -69,6 +73,8 @@ export default class ControlsOptionsManager {
69
73
  set(options?: {
70
74
  locusUrl: string;
71
75
  displayHints?: Array<string>;
76
+ getControls?: () => Record<string, any>;
77
+ isWebinar?: () => boolean;
72
78
  }): void;
73
79
  /**
74
80
  * @param {string} url
@@ -869,7 +869,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
869
869
  }, _callee1);
870
870
  }))();
871
871
  },
872
- version: "3.12.0-next.72"
872
+ version: "3.12.0-next.73"
873
873
  });
874
874
  var _default = exports.default = Webinar;
875
875
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -94,5 +94,5 @@
94
94
  "//": [
95
95
  "TODO: upgrade jwt-decode when moving to node 18"
96
96
  ],
97
- "version": "3.12.0-next.72"
97
+ "version": "3.12.0-next.73"
98
98
  }
@@ -4,7 +4,7 @@ import PermissionError from '../common/errors/permission';
4
4
  import MeetingRequest from '../meeting/request';
5
5
  import LoggerProxy from '../common/logs/logger-proxy';
6
6
  import {Control, Setting} from './enums';
7
- import {ControlConfig} from './types';
7
+ import {ControlConfig, ViewTheParticipantListProperties} from './types';
8
8
  import Util from './util';
9
9
  import {CAN_SET, CAN_UNSET, ENABLED} from './constants';
10
10
 
@@ -56,6 +56,10 @@ export default class ControlsOptionsManager {
56
56
  */
57
57
  private mainLocusUrl: string;
58
58
 
59
+ private getControls: () => Record<string, any> = () => ({});
60
+
61
+ private isWebinar: () => boolean = () => false;
62
+
59
63
  /**
60
64
  * @param {MeetingRequest} request
61
65
  * @param {Object} options
@@ -67,6 +71,8 @@ export default class ControlsOptionsManager {
67
71
  options?: {
68
72
  locusUrl: string;
69
73
  displayHints?: Array<string>;
74
+ getControls?: () => Record<string, any>;
75
+ isWebinar?: () => boolean;
70
76
  }
71
77
  ) {
72
78
  this.initialize(request);
@@ -89,7 +95,12 @@ export default class ControlsOptionsManager {
89
95
  * @public
90
96
  * @memberof ControlsOptionsManager
91
97
  */
92
- public set(options?: {locusUrl: string; displayHints?: Array<string>}) {
98
+ public set(options?: {
99
+ locusUrl: string;
100
+ displayHints?: Array<string>;
101
+ getControls?: () => Record<string, any>;
102
+ isWebinar?: () => boolean;
103
+ }) {
93
104
  this.extract(options);
94
105
  }
95
106
 
@@ -141,9 +152,20 @@ export default class ControlsOptionsManager {
141
152
  * @private
142
153
  * @memberof ControlsOptionsManager
143
154
  */
144
- private extract(options?: {locusUrl: string; displayHints?: Array<string>}) {
155
+ private extract(options?: {
156
+ locusUrl: string;
157
+ displayHints?: Array<string>;
158
+ getControls?: () => Record<string, any>;
159
+ isWebinar?: () => boolean;
160
+ }) {
145
161
  this.setDisplayHints(options?.displayHints);
146
162
  this.setLocusUrl(options?.locusUrl);
163
+ if (options?.getControls) {
164
+ this.getControls = options.getControls;
165
+ }
166
+ if (options?.isWebinar) {
167
+ this.isWebinar = options.isWebinar;
168
+ }
147
169
  }
148
170
 
149
171
  /**
@@ -172,8 +194,22 @@ export default class ControlsOptionsManager {
172
194
  );
173
195
  }
174
196
 
197
+ let {properties} = control;
198
+
199
+ if (control.scope === Control.viewTheParticipantList) {
200
+ const props = properties as ViewTheParticipantListProperties;
201
+ const current = this.getControls()?.viewTheParticipantList;
202
+ properties = {
203
+ enabled: props.enabled ?? current?.enabled ?? false,
204
+ ...(this.isWebinar() && {
205
+ panelistEnabled: props.panelistEnabled ?? current?.panelistEnabled ?? false,
206
+ attendeeCount: props.attendeeCount ?? Boolean(current?.attendeeCount) ?? false,
207
+ }),
208
+ };
209
+ }
210
+
175
211
  return {
176
- [control.scope]: control.properties,
212
+ [control.scope]: properties,
177
213
  };
178
214
  });
179
215
 
@@ -1567,6 +1567,8 @@ export default class Meeting extends StatelessWebexPlugin {
1567
1567
  this.controlsOptionsManager = new ControlsOptionsManager(this.meetingRequest, {
1568
1568
  locusUrl: this.locusInfo?.url,
1569
1569
  displayHints: [],
1570
+ getControls: () => this.locusInfo?.controls,
1571
+ isWebinar: () => this.locusInfo?.info?.isWebinar,
1570
1572
  });
1571
1573
 
1572
1574
  this.setUpLocusInfoListeners();
@@ -319,6 +319,110 @@ describe('plugin-meetings', () => {
319
319
  Util.canUpdate = restorable;
320
320
  });
321
321
  });
322
+
323
+ describe('viewTheParticipantList fill-in', () => {
324
+ let restorable;
325
+
326
+ afterEach(() => {
327
+ Util.canUpdate = restorable;
328
+ });
329
+
330
+ describe('when meeting is a webinar', () => {
331
+ beforeEach(() => {
332
+ restorable = Util.canUpdate;
333
+ Util.canUpdate = sinon.stub().returns(true);
334
+ manager.set({
335
+ locusUrl: 'test/id',
336
+ displayHints: [],
337
+ getControls: () => ({viewTheParticipantList: {enabled: true, panelistEnabled: true, attendeeCount: true}}),
338
+ isWebinar: () => true,
339
+ });
340
+ });
341
+
342
+ it('should fill in all undefined properties from current state', () => {
343
+ const control = {scope: 'viewTheParticipantList', properties: {}};
344
+
345
+ return manager.update(control).then(() => {
346
+ assert.calledOnceWithExactly(request.locusDeltaRequest, {
347
+ uri: 'test/id/controls',
348
+ body: {
349
+ viewTheParticipantList: {enabled: true, panelistEnabled: true, attendeeCount: true},
350
+ },
351
+ method: HTTP_VERBS.PATCH,
352
+ });
353
+ });
354
+ });
355
+
356
+ it('should keep explicitly provided properties and fill in the rest', () => {
357
+ const control = {scope: 'viewTheParticipantList', properties: {enabled: false}};
358
+
359
+ return manager.update(control).then(() => {
360
+ assert.calledOnceWithExactly(request.locusDeltaRequest, {
361
+ uri: 'test/id/controls',
362
+ body: {
363
+ viewTheParticipantList: {enabled: false, panelistEnabled: true, attendeeCount: true},
364
+ },
365
+ method: HTTP_VERBS.PATCH,
366
+ });
367
+ });
368
+ });
369
+
370
+ it('should not fill in properties when all are explicitly provided', () => {
371
+ const control = {scope: 'viewTheParticipantList', properties: {enabled: false, panelistEnabled: false, attendeeCount: false}};
372
+
373
+ return manager.update(control).then(() => {
374
+ assert.calledOnceWithExactly(request.locusDeltaRequest, {
375
+ uri: 'test/id/controls',
376
+ body: {
377
+ viewTheParticipantList: {enabled: false, panelistEnabled: false, attendeeCount: false},
378
+ },
379
+ method: HTTP_VERBS.PATCH,
380
+ });
381
+ });
382
+ });
383
+ });
384
+
385
+ describe('when meeting is not a webinar', () => {
386
+ beforeEach(() => {
387
+ restorable = Util.canUpdate;
388
+ Util.canUpdate = sinon.stub().returns(true);
389
+ manager.set({
390
+ locusUrl: 'test/id',
391
+ displayHints: [],
392
+ getControls: () => ({viewTheParticipantList: {enabled: true, panelistEnabled: true, attendeeCount: true}}),
393
+ isWebinar: () => false,
394
+ });
395
+ });
396
+
397
+ it('should only send enabled property', () => {
398
+ const control = {scope: 'viewTheParticipantList', properties: {}};
399
+
400
+ return manager.update(control).then(() => {
401
+ assert.calledOnceWithExactly(request.locusDeltaRequest, {
402
+ uri: 'test/id/controls',
403
+ body: {
404
+ viewTheParticipantList: {enabled: true},
405
+ },
406
+ method: HTTP_VERBS.PATCH,
407
+ });
408
+ });
409
+ });
410
+
411
+ it('should not include panelistEnabled or attendeeCount even if explicitly provided', () => {
412
+ const control = {scope: 'viewTheParticipantList', properties: {enabled: false, panelistEnabled: true, attendeeCount: true}};
413
+
414
+ return manager.update(control).then(() => {
415
+ assert.calledOnceWithExactly(request.locusDeltaRequest, {
416
+ uri: 'test/id/controls',
417
+ body: {
418
+ viewTheParticipantList: {enabled: false},
419
+ },
420
+ method: HTTP_VERBS.PATCH,
421
+ });
422
+ });
423
+ });
424
+ });
425
+ });
322
426
  });
323
427
 
324
428
  describe('Mute/Unmute All', () => {