@webex/plugin-meetings 3.9.0-next.23 → 3.9.0-next.24

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.
@@ -36,6 +36,13 @@ export default class ControlsOptionsManager {
36
36
  * @memberof ControlsOptionsManager
37
37
  */
38
38
  private locusUrl;
39
+ /**
40
+ * @instance
41
+ * @type {string}
42
+ * @private
43
+ * @memberof ControlsOptionsManager
44
+ */
45
+ private mainLocusUrl;
39
46
  /**
40
47
  * @param {MeetingRequest} request
41
48
  * @param {Object} options
@@ -65,11 +72,12 @@ export default class ControlsOptionsManager {
65
72
  }): void;
66
73
  /**
67
74
  * @param {string} url
75
+ * @param {boolean} isMainLocus
68
76
  * @returns {void}
69
77
  * @public
70
78
  * @memberof ControlsOptionsManager
71
79
  */
72
- setLocusUrl(url: string): void;
80
+ setLocusUrl(url: string, isMainLocus?: boolean): void;
73
81
  /**
74
82
  * @param {Array} hints
75
83
  * @returns {void}
@@ -303,10 +303,11 @@ export default class LocusInfo extends EventsScope {
303
303
  /**
304
304
  * handles when the locus.url is updated
305
305
  * @param {String} url
306
+ * @param {Boolean} isMainLocus
306
307
  * @returns {undefined}
307
308
  * emits internal event locus_info_update_url
308
309
  */
309
- updateLocusUrl(url: string): void;
310
+ updateLocusUrl(url: string, isMainLocus?: boolean): void;
310
311
  /**
311
312
  * @param {String} aclUrl
312
313
  * @returns {undefined}
@@ -458,7 +458,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
458
458
  }, _callee7);
459
459
  }))();
460
460
  },
461
- version: "3.9.0-next.23"
461
+ version: "3.9.0-next.24"
462
462
  });
463
463
  var _default = exports.default = Webinar;
464
464
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -92,5 +92,5 @@
92
92
  "//": [
93
93
  "TODO: upgrade jwt-decode when moving to node 18"
94
94
  ],
95
- "version": "3.9.0-next.23"
95
+ "version": "3.9.0-next.24"
96
96
  }
@@ -48,6 +48,14 @@ export default class ControlsOptionsManager {
48
48
  */
49
49
  private locusUrl: string;
50
50
 
51
+ /**
52
+ * @instance
53
+ * @type {string}
54
+ * @private
55
+ * @memberof ControlsOptionsManager
56
+ */
57
+ private mainLocusUrl: string;
58
+
51
59
  /**
52
60
  * @param {MeetingRequest} request
53
61
  * @param {Object} options
@@ -87,12 +95,16 @@ export default class ControlsOptionsManager {
87
95
 
88
96
  /**
89
97
  * @param {string} url
98
+ * @param {boolean} isMainLocus
90
99
  * @returns {void}
91
100
  * @public
92
101
  * @memberof ControlsOptionsManager
93
102
  */
94
- public setLocusUrl(url: string) {
103
+ public setLocusUrl(url: string, isMainLocus?: boolean) {
95
104
  this.locusUrl = url;
105
+ if (isMainLocus) {
106
+ this.mainLocusUrl = url;
107
+ }
96
108
  }
97
109
 
98
110
  /**
@@ -160,11 +172,16 @@ export default class ControlsOptionsManager {
160
172
  });
161
173
 
162
174
  return payloads.reduce((previous, payload) => {
175
+ const extraBody =
176
+ this.mainLocusUrl && this.mainLocusUrl !== this.locusUrl
177
+ ? {authorizingLocusUrl: this.locusUrl}
178
+ : {};
179
+
163
180
  return previous.then(() =>
164
181
  // @ts-ignore
165
182
  this.request.request({
166
- uri: `${this.locusUrl}/${CONTROLS}`,
167
- body: payload,
183
+ uri: `${this.mainLocusUrl || this.locusUrl}/${CONTROLS}`,
184
+ body: {...payload, ...extraBody},
168
185
  method: HTTP_VERBS.PATCH,
169
186
  })
170
187
  );
@@ -241,11 +258,15 @@ export default class ControlsOptionsManager {
241
258
  if (error) {
242
259
  return Promise.reject(error);
243
260
  }
261
+ const extraBody =
262
+ this.mainLocusUrl && this.mainLocusUrl !== this.locusUrl
263
+ ? {authorizingLocusUrl: this.locusUrl}
264
+ : {};
244
265
 
245
266
  // @ts-ignore
246
267
  return this.request.request({
247
- uri: `${this.locusUrl}/${CONTROLS}`,
248
- body,
268
+ uri: `${this.mainLocusUrl || this.locusUrl}/${CONTROLS}`,
269
+ body: {...body, ...extraBody},
249
270
  method: HTTP_VERBS.PATCH,
250
271
  });
251
272
  }
@@ -343,7 +343,7 @@ export default class LocusInfo extends EventsScope {
343
343
  // For 1:1 space meeting the conversation Url does not exist in locus.conversation
344
344
  this.updateConversationUrl(locus.conversationUrl, locus.info);
345
345
  this.updateControls(locus.controls, locus.self);
346
- this.updateLocusUrl(locus.url);
346
+ this.updateLocusUrl(locus.url, ControlsUtils.isMainSessionDTO(locus));
347
347
  this.updateFullState(locus.fullState);
348
348
  this.updateMeetingInfo(locus.info);
349
349
  this.updateEmbeddedApps(locus.embeddedApps);
@@ -549,7 +549,7 @@ export default class LocusInfo extends EventsScope {
549
549
  this.updateCreated(locus.created);
550
550
  this.updateFullState(locus.fullState);
551
551
  this.updateHostInfo(locus.host);
552
- this.updateLocusUrl(locus.url);
552
+ this.updateLocusUrl(locus.url, ControlsUtils.isMainSessionDTO(locus));
553
553
  this.updateMeetingInfo(locus.info, locus.self);
554
554
  this.updateMediaShares(locus.mediaShares);
555
555
  this.updateParticipantsUrl(locus.participantsUrl);
@@ -1732,10 +1732,11 @@ export default class LocusInfo extends EventsScope {
1732
1732
  /**
1733
1733
  * handles when the locus.url is updated
1734
1734
  * @param {String} url
1735
+ * @param {Boolean} isMainLocus
1735
1736
  * @returns {undefined}
1736
1737
  * emits internal event locus_info_update_url
1737
1738
  */
1738
- updateLocusUrl(url: string) {
1739
+ updateLocusUrl(url: string, isMainLocus = true) {
1739
1740
  if (url && this.url !== url) {
1740
1741
  this.url = url;
1741
1742
  this.updateMeeting({locusUrl: url});
@@ -1745,7 +1746,7 @@ export default class LocusInfo extends EventsScope {
1745
1746
  function: 'updateLocusUrl',
1746
1747
  },
1747
1748
  EVENTS.LOCUS_INFO_UPDATE_URL,
1748
- url
1749
+ {url, isMainLocus}
1749
1750
  );
1750
1751
  }
1751
1752
  }
@@ -3356,27 +3356,31 @@ export default class Meeting extends StatelessWebexPlugin {
3356
3356
  * @memberof Meeting
3357
3357
  */
3358
3358
  private setUpLocusUrlListener() {
3359
- this.locusInfo.on(EVENTS.LOCUS_INFO_UPDATE_URL, (payload) => {
3360
- this.members.locusUrlUpdate(payload);
3361
- this.breakouts.locusUrlUpdate(payload);
3362
- this.simultaneousInterpretation.locusUrlUpdate(payload);
3363
- this.annotation.locusUrlUpdate(payload);
3364
- this.locusUrl = payload;
3365
- this.locusId = this.locusUrl?.split('/').pop();
3366
- this.recordingController.setLocusUrl(this.locusUrl);
3367
- this.controlsOptionsManager.setLocusUrl(this.locusUrl);
3368
- this.webinar.locusUrlUpdate(payload);
3359
+ this.locusInfo.on(
3360
+ EVENTS.LOCUS_INFO_UPDATE_URL,
3361
+ (payload: {url: string; isMainLocus?: boolean}) => {
3362
+ const {url, isMainLocus} = payload;
3363
+ this.members.locusUrlUpdate(url);
3364
+ this.breakouts.locusUrlUpdate(url);
3365
+ this.simultaneousInterpretation.locusUrlUpdate(url);
3366
+ this.annotation.locusUrlUpdate(url);
3367
+ this.locusUrl = url;
3368
+ this.locusId = this.locusUrl?.split('/').pop();
3369
+ this.recordingController.setLocusUrl(this.locusUrl);
3370
+ this.controlsOptionsManager.setLocusUrl(this.locusUrl, !!isMainLocus);
3371
+ this.webinar.locusUrlUpdate(url);
3369
3372
 
3370
- Trigger.trigger(
3371
- this,
3372
- {
3373
- file: 'meeting/index',
3374
- function: 'setUpLocusSelfListener',
3375
- },
3376
- EVENT_TRIGGERS.MEETING_LOCUS_URL_UPDATE,
3377
- {locusUrl: payload}
3378
- );
3379
- });
3373
+ Trigger.trigger(
3374
+ this,
3375
+ {
3376
+ file: 'meeting/index',
3377
+ function: 'setUpLocusSelfListener',
3378
+ },
3379
+ EVENT_TRIGGERS.MEETING_LOCUS_URL_UPDATE,
3380
+ {locusUrl: url}
3381
+ );
3382
+ }
3383
+ );
3380
3384
  }
3381
3385
 
3382
3386
  /**
@@ -133,6 +133,7 @@ describe('plugin-meetings', () => {
133
133
 
134
134
  manager.set({
135
135
  locusUrl: 'test/id',
136
+ mainLocusUrl: '',
136
137
  displayHints: [],
137
138
  });
138
139
  });
@@ -201,6 +202,38 @@ describe('plugin-meetings', () => {
201
202
  Util.canUpdate = restorable;
202
203
  });
203
204
  });
205
+
206
+ it('should call request with mainLocusUrl and locusUrl as authorizingLocusUrl if mainLocusUrl is exist and not same with locusUrl', () => {
207
+ const restorable = Util.canUpdate;
208
+ Util.canUpdate = sinon.stub().returns(true);
209
+ manager.mainLocusUrl = 'test/main';
210
+
211
+ const audio = {scope: 'audio', properties: {a: 1, b: 2}};
212
+ const reactions = {scope: 'reactions', properties: {c: 3, d: 4}};
213
+
214
+ return manager.update(audio, reactions)
215
+ .then(() => {
216
+ assert.calledWith(request.request, {
217
+ uri: 'test/main/controls',
218
+ body: {
219
+ audio: audio.properties,
220
+ authorizingLocusUrl: 'test/id'
221
+ },
222
+ method: HTTP_VERBS.PATCH,
223
+ });
224
+
225
+ assert.calledWith(request.request, {
226
+ uri: 'test/main/controls',
227
+ body: {
228
+ reactions: reactions.properties,
229
+ authorizingLocusUrl: 'test/id'
230
+ },
231
+ method: HTTP_VERBS.PATCH,
232
+ });
233
+
234
+ Util.canUpdate = restorable;
235
+ });
236
+ });
204
237
  });
205
238
 
206
239
  describe('Mute/Unmute All', () => {
@@ -214,6 +247,7 @@ describe('plugin-meetings', () => {
214
247
 
215
248
  manager.set({
216
249
  locusUrl: 'test/id',
250
+ mainLocusUrl: '',
217
251
  displayHints: [],
218
252
  })
219
253
  });
@@ -305,6 +339,19 @@ describe('plugin-meetings', () => {
305
339
 
306
340
  assert.deepEqual(result, request.request.firstCall.returnValue);
307
341
  });
342
+
343
+ it('request with mainLocusUrl and make locusUrl as authorizingLocusUrl if mainLocusUrl is exist and not same with locusUrl', () => {
344
+ manager.setDisplayHints(['MUTE_ALL', 'DISABLE_HARD_MUTE', 'DISABLE_MUTE_ON_ENTRY']);
345
+ manager.mainLocusUrl = `test/main`;
346
+
347
+ const result = manager.setMuteAll(true, true, true, ['attendee']);
348
+
349
+ assert.calledWith(request.request, { uri: 'test/main/controls',
350
+ body: { audio: { muted: true, disallowUnmute: true, muteOnEntry: true, roles: ['attendee'] }, authorizingLocusUrl: 'test/id' },
351
+ method: HTTP_VERBS.PATCH});
352
+
353
+ assert.deepEqual(result, request.request.firstCall.returnValue);
354
+ });
308
355
  });
309
356
  });
310
357
  });
@@ -3020,6 +3020,45 @@ describe('plugin-meetings', () => {
3020
3020
  });
3021
3021
  });
3022
3022
 
3023
+ describe('#updateLocusUrl', () => {
3024
+ it('trigger LOCUS_INFO_UPDATE_URL event with isMainLocus is true as default', () => {
3025
+ const fakeUrl = "https://fake.com/locus";
3026
+ locusInfo.emitScoped = sinon.stub();
3027
+ locusInfo.updateLocusUrl(fakeUrl);
3028
+
3029
+ assert.calledWith(
3030
+ locusInfo.emitScoped,
3031
+ {
3032
+ file: 'locus-info',
3033
+ function: 'updateLocusUrl',
3034
+ },
3035
+ EVENTS.LOCUS_INFO_UPDATE_URL,
3036
+ {
3037
+ url: fakeUrl,
3038
+ isMainLocus: true
3039
+ },
3040
+ );
3041
+ });
3042
+ it('trigger LOCUS_INFO_UPDATE_URL event with isMainLocus is false', () => {
3043
+ const fakeUrl = "https://fake.com/locus";
3044
+ locusInfo.emitScoped = sinon.stub();
3045
+ locusInfo.updateLocusUrl(fakeUrl, false);
3046
+
3047
+ assert.calledWith(
3048
+ locusInfo.emitScoped,
3049
+ {
3050
+ file: 'locus-info',
3051
+ function: 'updateLocusUrl',
3052
+ },
3053
+ EVENTS.LOCUS_INFO_UPDATE_URL,
3054
+ {
3055
+ url: fakeUrl,
3056
+ isMainLocus: false
3057
+ },
3058
+ );
3059
+ });
3060
+ });
3061
+
3023
3062
  // semi-integration tests that use real LocusInfo with real Parser
3024
3063
  // and test various scenarios related to handling out-of-order Locus delta events
3025
3064
  describe('handling of out-of-order Locus delta events', () => {
@@ -10550,6 +10550,7 @@ describe('plugin-meetings', () => {
10550
10550
  describe('#setUpLocusUrlListener', () => {
10551
10551
  it('listens to the locus url update event', (done) => {
10552
10552
  const newLocusUrl = 'newLocusUrl/12345';
10553
+ const payload = {url: newLocusUrl}
10553
10554
 
10554
10555
  meeting.members = {locusUrlUpdate: sinon.stub().returns(Promise.resolve(test1))};
10555
10556
  meeting.recordingController = {setLocusUrl: sinon.stub().returns(undefined)};
@@ -10563,14 +10564,14 @@ describe('plugin-meetings', () => {
10563
10564
  meeting.locusInfo.emit(
10564
10565
  {function: 'test', file: 'test'},
10565
10566
  'LOCUS_INFO_UPDATE_URL',
10566
- newLocusUrl
10567
+ payload
10567
10568
  );
10568
10569
  assert.calledWith(meeting.members.locusUrlUpdate, newLocusUrl);
10569
10570
  assert.calledOnceWithExactly(meeting.breakouts.locusUrlUpdate, newLocusUrl);
10570
10571
  assert.calledOnceWithExactly(meeting.annotation.locusUrlUpdate, newLocusUrl);
10571
10572
  assert.calledWith(meeting.members.locusUrlUpdate, newLocusUrl);
10572
10573
  assert.calledWith(meeting.recordingController.setLocusUrl, newLocusUrl);
10573
- assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl);
10574
+ assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
10574
10575
  assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
10575
10576
  assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
10576
10577
  assert.equal(meeting.locusUrl, newLocusUrl);
@@ -10588,6 +10589,22 @@ describe('plugin-meetings', () => {
10588
10589
  {locusUrl: 'newLocusUrl/12345'}
10589
10590
  );
10590
10591
 
10592
+ done();
10593
+ });
10594
+ it('update mainLocusUrl for controlsOptionManager if payload.isMainLocus as true', (done) => {
10595
+ const newLocusUrl = 'newLocusUrl/12345';
10596
+ const payload = {url: newLocusUrl, isMainLocus: true}
10597
+
10598
+ meeting.controlsOptionsManager = {setLocusUrl: sinon.stub().returns(undefined)};
10599
+
10600
+ meeting.locusInfo.emit(
10601
+ {function: 'test', file: 'test'},
10602
+ 'LOCUS_INFO_UPDATE_URL',
10603
+ payload
10604
+ );
10605
+
10606
+ assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, true);
10607
+
10591
10608
  done();
10592
10609
  });
10593
10610
  });