@webex/plugin-meetings 3.0.0-beta.130 → 3.0.0-beta.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.
@@ -208,6 +208,7 @@ export declare const EVENT_TRIGGERS: {
208
208
  MEETING_SELF_PHONE_AUDIO_UPDATE: string;
209
209
  MEETING_SELF_CANNOT_VIEW_PARTICIPANT_LIST: string;
210
210
  MEETING_SELF_IS_SHARING_BLOCKED: string;
211
+ MEETING_SELF_ROLES_CHANGED: string;
211
212
  MEETING_CONTROLS_LAYOUT_UPDATE: string;
212
213
  MEETING_ENTRY_EXIT_TONE_UPDATE: string;
213
214
  MEETING_BREAKOUTS_UPDATE: string;
@@ -481,6 +482,7 @@ export declare const LOCUSINFO: {
481
482
  LOCAL_UNMUTE_REQUESTED: string;
482
483
  LOCAL_UNMUTE_REQUIRED: string;
483
484
  SELF_MODERATOR_CHANGED: string;
485
+ SELF_ROLES_CHANGED: string;
484
486
  MEETING_UPDATE: string;
485
487
  MEDIA_STATUS_CHANGE: string;
486
488
  FULL_STATE_TYPE_UPDATE: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-beta.130",
3
+ "version": "3.0.0-beta.131",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "contributors": [
@@ -32,12 +32,12 @@
32
32
  "build": "yarn run -T tsc --declaration true --declarationDir ./dist/types"
33
33
  },
34
34
  "devDependencies": {
35
- "@webex/plugin-meetings": "3.0.0-beta.130",
36
- "@webex/test-helper-chai": "3.0.0-beta.130",
37
- "@webex/test-helper-mocha": "3.0.0-beta.130",
38
- "@webex/test-helper-mock-webex": "3.0.0-beta.130",
39
- "@webex/test-helper-retry": "3.0.0-beta.130",
40
- "@webex/test-helper-test-users": "3.0.0-beta.130",
35
+ "@webex/plugin-meetings": "3.0.0-beta.131",
36
+ "@webex/test-helper-chai": "3.0.0-beta.131",
37
+ "@webex/test-helper-mocha": "3.0.0-beta.131",
38
+ "@webex/test-helper-mock-webex": "3.0.0-beta.131",
39
+ "@webex/test-helper-retry": "3.0.0-beta.131",
40
+ "@webex/test-helper-test-users": "3.0.0-beta.131",
41
41
  "chai": "^4.3.4",
42
42
  "chai-as-promised": "^7.1.1",
43
43
  "jsdom-global": "3.0.2",
@@ -46,19 +46,19 @@
46
46
  "typescript": "^4.7.4"
47
47
  },
48
48
  "dependencies": {
49
- "@webex/common": "3.0.0-beta.130",
49
+ "@webex/common": "3.0.0-beta.131",
50
50
  "@webex/internal-media-core": "1.38.2",
51
- "@webex/internal-plugin-conversation": "3.0.0-beta.130",
52
- "@webex/internal-plugin-device": "3.0.0-beta.130",
53
- "@webex/internal-plugin-llm": "3.0.0-beta.130",
54
- "@webex/internal-plugin-mercury": "3.0.0-beta.130",
55
- "@webex/internal-plugin-metrics": "3.0.0-beta.130",
56
- "@webex/internal-plugin-support": "3.0.0-beta.130",
57
- "@webex/internal-plugin-user": "3.0.0-beta.130",
58
- "@webex/media-helpers": "3.0.0-beta.130",
59
- "@webex/plugin-people": "3.0.0-beta.130",
60
- "@webex/plugin-rooms": "3.0.0-beta.130",
61
- "@webex/webex-core": "3.0.0-beta.130",
51
+ "@webex/internal-plugin-conversation": "3.0.0-beta.131",
52
+ "@webex/internal-plugin-device": "3.0.0-beta.131",
53
+ "@webex/internal-plugin-llm": "3.0.0-beta.131",
54
+ "@webex/internal-plugin-mercury": "3.0.0-beta.131",
55
+ "@webex/internal-plugin-metrics": "3.0.0-beta.131",
56
+ "@webex/internal-plugin-support": "3.0.0-beta.131",
57
+ "@webex/internal-plugin-user": "3.0.0-beta.131",
58
+ "@webex/media-helpers": "3.0.0-beta.131",
59
+ "@webex/plugin-people": "3.0.0-beta.131",
60
+ "@webex/plugin-rooms": "3.0.0-beta.131",
61
+ "@webex/webex-core": "3.0.0-beta.131",
62
62
  "ampersand-collection": "^2.0.2",
63
63
  "bowser": "^2.11.0",
64
64
  "btoa": "^1.2.1",
package/src/constants.ts CHANGED
@@ -309,6 +309,7 @@ export const EVENT_TRIGGERS = {
309
309
  MEETING_SELF_PHONE_AUDIO_UPDATE: 'meeting:self:phoneAudioUpdate',
310
310
  MEETING_SELF_CANNOT_VIEW_PARTICIPANT_LIST: 'meeting:self:cannotViewParticipantList',
311
311
  MEETING_SELF_IS_SHARING_BLOCKED: 'meeting:self:isSharingBlocked',
312
+ MEETING_SELF_ROLES_CHANGED: 'meeting:self:rolesChanged',
312
313
  MEETING_CONTROLS_LAYOUT_UPDATE: 'meeting:layout:update',
313
314
  MEETING_ENTRY_EXIT_TONE_UPDATE: 'meeting:entryExitTone:update',
314
315
  MEETING_BREAKOUTS_UPDATE: 'meeting:breakouts:update',
@@ -615,6 +616,7 @@ export const LOCUSINFO = {
615
616
  LOCAL_UNMUTE_REQUESTED: 'LOCAL_UNMUTE_REQUESTED',
616
617
  LOCAL_UNMUTE_REQUIRED: 'LOCAL_UNMUTE_REQUIRED',
617
618
  SELF_MODERATOR_CHANGED: 'SELF_MODERATOR_CHANGED',
619
+ SELF_ROLES_CHANGED: 'SELF_ROLES_CHANGED',
618
620
  MEETING_UPDATE: 'MEETING_UPDATE',
619
621
  MEDIA_STATUS_CHANGE: 'MEDIA_STATUS_CHANGE',
620
622
  FULL_STATE_TYPE_UPDATE: 'FULL_STATE_TYPE_UPDATE',
@@ -1226,6 +1226,17 @@ export default class LocusInfo extends EventsScope {
1226
1226
  self
1227
1227
  );
1228
1228
  }
1229
+
1230
+ if (parsedSelves.updates.isRolesChanged) {
1231
+ this.emitScoped(
1232
+ {
1233
+ file: 'locus-info',
1234
+ function: 'updateSelf',
1235
+ },
1236
+ LOCUSINFO.EVENTS.SELF_ROLES_CHANGED,
1237
+ {oldRoles: parsedSelves.previous?.roles, newRoles: parsedSelves.current?.roles}
1238
+ );
1239
+ }
1229
1240
  // When the user upgrades to moderator or cohost
1230
1241
  if (parsedSelves.updates.isUpgradeToModeratorOrCohost) {
1231
1242
  this.emitScoped(
@@ -108,6 +108,7 @@ SelfUtils.getSelves = (oldSelf, newSelf, deviceId) => {
108
108
  current
109
109
  );
110
110
  updates.moderatorChanged = SelfUtils.moderatorChanged(previous, current);
111
+ updates.isRolesChanged = SelfUtils.isRolesChanged(previous, current);
111
112
  updates.isUpgradeToModeratorOrCohost = SelfUtils.isUpgradeToModeratorOrCohost(previous, current);
112
113
  updates.isMediaInactiveOrReleased = SelfUtils.wasMediaInactiveOrReleased(previous, current);
113
114
  updates.isUserObserving = SelfUtils.isDeviceObserving(previous, current);
@@ -339,6 +340,13 @@ SelfUtils.moderatorChanged = (oldSelf, changedSelf) => {
339
340
  return oldSelf.moderator !== changedSelf.moderator;
340
341
  };
341
342
 
343
+ SelfUtils.isRolesChanged = (oldSelf, changedSelf) => {
344
+ if (!oldSelf || !changedSelf) {
345
+ return false;
346
+ }
347
+
348
+ return !isEqual(oldSelf.roles, changedSelf.roles);
349
+ };
342
350
  /**
343
351
  * @param {Object} oldSelf
344
352
  * @param {Object} changedSelf
@@ -2922,6 +2922,20 @@ export default class Meeting extends StatelessWebexPlugin {
2922
2922
  );
2923
2923
  });
2924
2924
 
2925
+ this.locusInfo.on(LOCUSINFO.EVENTS.SELF_ROLES_CHANGED, (payload) => {
2926
+ Trigger.trigger(
2927
+ this,
2928
+ {
2929
+ file: 'meeting/index',
2930
+ function: 'setUpLocusInfoSelfListener',
2931
+ },
2932
+ EVENT_TRIGGERS.MEETING_SELF_ROLES_CHANGED,
2933
+ {
2934
+ payload,
2935
+ }
2936
+ );
2937
+ });
2938
+
2925
2939
  // We need to reinitialize when user upgrades to host or cohost
2926
2940
  this.locusInfo.on(LOCUSINFO.EVENTS.SELF_MODERATOR_OR_COHOST_UPGRADE, (payload) => {
2927
2941
  this.breakouts.queryPreAssignments(payload);
@@ -1217,6 +1217,44 @@ describe('plugin-meetings', () => {
1217
1217
  {isSharingBlocked: true}
1218
1218
  );
1219
1219
  });
1220
+
1221
+ it('should trigger SELF_ROLES_CHANGED if self roles changed', () => {
1222
+ locusInfo.self = self;
1223
+ locusInfo.emitScoped = sinon.stub();
1224
+ const sampleNewSelf = cloneDeep(self);
1225
+ sampleNewSelf.controls.role.roles = [{type: 'COHOST', hasRole: true}];
1226
+
1227
+ locusInfo.updateSelf(sampleNewSelf, []);
1228
+
1229
+ assert.calledWith(
1230
+ locusInfo.emitScoped,
1231
+ {
1232
+ file: 'locus-info',
1233
+ function: 'updateSelf',
1234
+ },
1235
+ LOCUSINFO.EVENTS.SELF_ROLES_CHANGED,
1236
+ {oldRoles: ['PRESENTER'], newRoles: ['COHOST']}
1237
+ );
1238
+ });
1239
+
1240
+ it('should not trigger SELF_ROLES_CHANGED if self roles not changed', () => {
1241
+ locusInfo.self = self;
1242
+ locusInfo.emitScoped = sinon.stub();
1243
+ const sampleNewSelf = cloneDeep(self);
1244
+ sampleNewSelf.controls.role.roles = [{type: 'PRESENTER', hasRole: true}];
1245
+
1246
+ locusInfo.updateSelf(sampleNewSelf, []);
1247
+
1248
+ assert.neverCalledWith(
1249
+ locusInfo.emitScoped,
1250
+ {
1251
+ file: 'locus-info',
1252
+ function: 'updateSelf',
1253
+ },
1254
+ LOCUSINFO.EVENTS.SELF_ROLES_CHANGED,
1255
+ {oldRoles: ['PRESENTER'], newRoles: ['PRESENTER']}
1256
+ );
1257
+ });
1220
1258
  });
1221
1259
 
1222
1260
  describe('#updateMeetingInfo', () => {
@@ -391,10 +391,26 @@ describe('plugin-meetings', () => {
391
391
  state: 'JOINED',
392
392
  };
393
393
  assert.deepEqual(SelfUtils.getReplacedBreakoutMoveId(clonedSelf, deviceId), null);
394
+ });
395
+ });
396
+
397
+ describe('isRolesChanged', () => {
398
+ it('should return true if self roles has changed', () => {
399
+ const parsedSelf = SelfUtils.parse(self);
400
+ const clonedSelf = cloneDeep(parsedSelf);
401
+
402
+ clonedSelf.roles = ['COHOST'];
394
403
 
404
+ assert.deepEqual(SelfUtils.isRolesChanged(parsedSelf, clonedSelf), true);
395
405
  });
396
406
 
407
+ it('should return false if self roles has not changed', () => {
408
+ const parsedSelf = SelfUtils.parse(self);
409
+ const clonedSelf = cloneDeep(parsedSelf);
397
410
 
398
- });
411
+ clonedSelf.roles = ['PRESENTER'];
399
412
 
413
+ assert.deepEqual(SelfUtils.isRolesChanged(parsedSelf, clonedSelf), false);
414
+ });
415
+ });
400
416
  });
@@ -4873,6 +4873,24 @@ describe('plugin-meetings', () => {
4873
4873
  EVENT_TRIGGERS.MEETING_BREAKOUTS_UPDATE
4874
4874
  );
4875
4875
  });
4876
+
4877
+ it('listens to the self roles changed event', () => {
4878
+ const payload = {oldRoles: [], newRoles: ['COHOST']};
4879
+
4880
+ meeting.locusInfo.emit(
4881
+ {function: 'test', file: 'test'},
4882
+ 'SELF_ROLES_CHANGED',
4883
+ payload
4884
+ );
4885
+
4886
+ assert.calledWith(
4887
+ TriggerProxy.trigger,
4888
+ meeting,
4889
+ {file: 'meeting/index', function: 'setUpLocusInfoSelfListener'},
4890
+ EVENT_TRIGGERS.MEETING_SELF_ROLES_CHANGED,
4891
+ {payload}
4892
+ );
4893
+ });
4876
4894
  });
4877
4895
 
4878
4896
  describe('#setUpBreakoutsPreAssignmentsListener', () => {