@webex/plugin-meetings 3.0.0-beta.183 → 3.0.0-beta.184

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.
@@ -209,7 +209,7 @@ var Breakout = _webexCore.WebexPlugin.extend({
209
209
  sessionId: this.sessionId
210
210
  });
211
211
  },
212
- version: "3.0.0-beta.183"
212
+ version: "3.0.0-beta.184"
213
213
  });
214
214
  var _default = Breakout;
215
215
  exports.default = _default;
@@ -1041,7 +1041,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
1041
1041
  this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
1042
1042
  }
1043
1043
  },
1044
- version: "3.0.0-beta.183"
1044
+ version: "3.0.0-beta.184"
1045
1045
  });
1046
1046
  var _default = Breakouts;
1047
1047
  exports.default = _default;
@@ -359,7 +359,7 @@ var SimultaneousInterpretation = _webexCore.WebexPlugin.extend({
359
359
  throw error;
360
360
  });
361
361
  },
362
- version: "3.0.0-beta.183"
362
+ version: "3.0.0-beta.184"
363
363
  });
364
364
  var _default = SimultaneousInterpretation;
365
365
  exports.default = _default;
@@ -18,7 +18,7 @@ var SILanguage = _webexCore.WebexPlugin.extend({
18
18
  languageCode: 'number',
19
19
  languageName: 'string'
20
20
  },
21
- version: "3.0.0-beta.183"
21
+ version: "3.0.0-beta.184"
22
22
  });
23
23
  var _default = SILanguage;
24
24
  exports.default = _default;
@@ -145,16 +145,7 @@ MemberUtil.isAudioMuted = function (participant) {
145
145
  if (!participant) {
146
146
  throw new _parameter.default('Audio could not be processed, participant is undefined.');
147
147
  }
148
- var mutedStatus = MemberUtil.isMuted(participant.status, _constants.AUDIO_STATUS);
149
- if (participant.controls && participant.controls.audio) {
150
- if (participant.controls.audio.muted) {
151
- return true;
152
- }
153
- if (mutedStatus) {
154
- return true;
155
- }
156
- }
157
- return false;
148
+ return MemberUtil.isMuted(participant, _constants.AUDIO_STATUS, _constants.AUDIO);
158
149
  };
159
150
 
160
151
  /**
@@ -165,7 +156,7 @@ MemberUtil.isVideoMuted = function (participant) {
165
156
  if (!participant) {
166
157
  throw new _parameter.default('Video could not be processed, participant is undefined.');
167
158
  }
168
- return MemberUtil.isMuted(participant.status, _constants.VIDEO_STATUS);
159
+ return MemberUtil.isMuted(participant, _constants.VIDEO_STATUS, _constants.VIDEO);
169
160
  };
170
161
 
171
162
  /**
@@ -215,20 +206,28 @@ MemberUtil.isLiveAnnotationSupported = function (participant) {
215
206
 
216
207
  /**
217
208
  * utility method for audio/video muted status
218
- * @param {String} status
219
- * @param {String} accessor
220
- * @returns {Boolean}
209
+ * @param {any} participant
210
+ * @param {String} statusAccessor
211
+ * @param {String} controlsAccessor
212
+ * @returns {Boolean | undefined}
221
213
  */
222
- MemberUtil.isMuted = function (status, accessor) {
223
- if (status) {
224
- if (status[accessor] === _constants._RECEIVE_ONLY_) {
225
- return true;
226
- }
227
- if (status[accessor] === _constants._SEND_RECEIVE_) {
228
- return false;
229
- }
214
+ MemberUtil.isMuted = function (participant, statusAccessor, controlsAccessor) {
215
+ var _participant$controls5, _participant$controls6, _participant$status;
216
+ // check remote mute
217
+ var remoteMute = participant === null || participant === void 0 ? void 0 : (_participant$controls5 = participant.controls) === null || _participant$controls5 === void 0 ? void 0 : (_participant$controls6 = _participant$controls5[controlsAccessor]) === null || _participant$controls6 === void 0 ? void 0 : _participant$controls6.muted;
218
+ if (remoteMute === true) {
219
+ return true;
230
220
  }
231
- return null;
221
+
222
+ // check local mute
223
+ var localStatus = participant === null || participant === void 0 ? void 0 : (_participant$status = participant.status) === null || _participant$status === void 0 ? void 0 : _participant$status[statusAccessor];
224
+ if (localStatus === _constants._RECEIVE_ONLY_) {
225
+ return true;
226
+ }
227
+ if (localStatus === _constants._SEND_RECEIVE_) {
228
+ return false;
229
+ }
230
+ return remoteMute;
232
231
  };
233
232
 
234
233
  /**
@@ -330,13 +329,13 @@ MemberUtil.extractId = function (participant) {
330
329
  * @returns {Object}
331
330
  */
332
331
  MemberUtil.extractMediaStatus = function (participant) {
333
- var _participant$status, _participant$status2;
332
+ var _participant$status2, _participant$status3;
334
333
  if (!participant) {
335
334
  throw new _parameter.default('Media status could not be extracted, participant is undefined.');
336
335
  }
337
336
  return {
338
- audio: (_participant$status = participant.status) === null || _participant$status === void 0 ? void 0 : _participant$status.audioStatus,
339
- video: (_participant$status2 = participant.status) === null || _participant$status2 === void 0 ? void 0 : _participant$status2.videoStatus
337
+ audio: (_participant$status2 = participant.status) === null || _participant$status2 === void 0 ? void 0 : _participant$status2.audioStatus,
338
+ video: (_participant$status3 = participant.status) === null || _participant$status3 === void 0 ? void 0 : _participant$status3.videoStatus
340
339
  };
341
340
  };
342
341
 
@@ -1 +1 @@
1
- {"version":3,"names":["MemberUtil","getControlsRoles","participant","controls","role","roles","hasRole","controlRole","some","type","hasCohost","ServerRoles","Cohost","hasModerator","Moderator","hasPresenter","Presenter","extractControlRoles","cohost","moderator","presenter","isUser","_USER_","isModerator","isGuest","guest","isDevice","_RESOURCE_ROOM_","isModeratorAssignmentProhibited","moderatorAssignmentNotAllowed","isSame","id","person","isAssociatedSame","associatedUsers","user","isNotAdmitted","status","devices","intent","_WAIT_","_IN_LOBBY_","_IN_MEETING_","isAudioMuted","ParameterError","mutedStatus","isMuted","AUDIO_STATUS","audio","muted","isVideoMuted","VIDEO_STATUS","isHandRaised","hand","raised","isBreakoutsSupported","doesNotSupportBreakouts","isInterpretationSupported","doesNotSupportSiInterpreter","isLiveAnnotationSupported","annotatorAssignmentNotAllowed","accessor","_RECEIVE_ONLY_","_SEND_RECEIVE_","getRecordingMember","record","recording","meta","modifiedBy","isRecording","localRecord","isRemovable","isSelf","isInMeeting","_CALL_","isMutable","extractStatus","length","_NOT_IN_MEETING_","state","_JOINED_","_IDLE_","foundDevice","find","device","_OBSERVE_","_LEFT_","extractId","extractMediaStatus","audioStatus","video","videoStatus","extractName","name"],"sources":["util.ts"],"sourcesContent":["import {\n IExternalRoles,\n ParticipantWithRoles,\n ServerRoles,\n ServerRoleShape,\n IMediaStatus,\n} from './types';\nimport {\n _USER_,\n _RESOURCE_ROOM_,\n _OBSERVE_,\n _WAIT_,\n _LEFT_,\n _JOINED_,\n _IDLE_,\n _IN_LOBBY_,\n _NOT_IN_MEETING_,\n _IN_MEETING_,\n AUDIO_STATUS,\n VIDEO_STATUS,\n _SEND_RECEIVE_,\n _RECEIVE_ONLY_,\n _CALL_,\n} from '../constants';\nimport ParameterError from '../common/errors/parameter';\n\nconst MemberUtil: any = {};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {[ServerRoleShape]}\n */\nMemberUtil.getControlsRoles = (participant: ParticipantWithRoles): Array<ServerRoleShape> =>\n participant?.controls?.role?.roles;\n\n/**\n * @param {Object} participant the locus participant\n * @param {ServerRoles} controlRole the search role\n * @returns {Boolean}\n */\nMemberUtil.hasRole = (participant: any, controlRole: ServerRoles): boolean =>\n MemberUtil.getControlsRoles(participant)?.some(\n (role) => role.type === controlRole && role.hasRole\n );\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.hasCohost = (participant: ParticipantWithRoles): boolean =>\n MemberUtil.hasRole(participant, ServerRoles.Cohost) || false;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.hasModerator = (participant: ParticipantWithRoles): boolean =>\n MemberUtil.hasRole(participant, ServerRoles.Moderator) || false;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.hasPresenter = (participant: ParticipantWithRoles): boolean =>\n MemberUtil.hasRole(participant, ServerRoles.Presenter) || false;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {IExternalRoles}\n */\nMemberUtil.extractControlRoles = (participant: ParticipantWithRoles): IExternalRoles => {\n const roles = {\n cohost: MemberUtil.hasCohost(participant),\n moderator: MemberUtil.hasModerator(participant),\n presenter: MemberUtil.hasPresenter(participant),\n };\n\n return roles;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isUser = (participant: any) => participant && participant.type === _USER_;\n\nMemberUtil.isModerator = (participant) => participant && participant.moderator;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isGuest = (participant: any) => participant && participant.guest;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isDevice = (participant: any) => participant && participant.type === _RESOURCE_ROOM_;\n\nMemberUtil.isModeratorAssignmentProhibited = (participant) =>\n participant && participant.moderatorAssignmentNotAllowed;\n\n/**\n * checks to see if the participant id is the same as the passed id\n * there are multiple ids that can be used\n * @param {Object} participant the locus participant\n * @param {String} id\n * @returns {Boolean}\n */\nMemberUtil.isSame = (participant: any, id: string) =>\n participant && (participant.id === id || (participant.person && participant.person.id === id));\n\n/**\n * checks to see if the participant id is the same as the passed id for associated devices\n * there are multiple ids that can be used\n * @param {Object} participant the locus participant\n * @param {String} id\n * @returns {Boolean}\n */\nMemberUtil.isAssociatedSame = (participant: any, id: string) =>\n participant &&\n participant.associatedUsers &&\n participant.associatedUsers.some(\n (user) => user.id === id || (user.person && user.person.id === id)\n );\n\n/**\n * @param {Object} participant the locus participant\n * @param {Boolean} isGuest\n * @param {String} status\n * @returns {Boolean}\n */\nMemberUtil.isNotAdmitted = (participant: any, isGuest: boolean, status: string): boolean =>\n participant &&\n participant.guest &&\n ((participant.devices &&\n participant.devices[0] &&\n participant.devices[0].intent &&\n participant.devices[0].intent.type === _WAIT_ &&\n // @ts-ignore\n isGuest &&\n status === _IN_LOBBY_) ||\n // @ts-ignore\n !status === _IN_MEETING_);\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isAudioMuted = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Audio could not be processed, participant is undefined.');\n }\n const mutedStatus = MemberUtil.isMuted(participant.status, AUDIO_STATUS);\n\n if (participant.controls && participant.controls.audio) {\n if (participant.controls.audio.muted) {\n return true;\n }\n if (mutedStatus) {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isVideoMuted = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Video could not be processed, participant is undefined.');\n }\n\n return MemberUtil.isMuted(participant.status, VIDEO_STATUS);\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isHandRaised = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Raise hand could not be processed, participant is undefined.');\n }\n\n return participant.controls?.hand?.raised || false;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isBreakoutsSupported = (participant) => {\n if (!participant) {\n throw new ParameterError('Breakout support could not be processed, participant is undefined.');\n }\n\n return !participant.doesNotSupportBreakouts;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isInterpretationSupported = (participant) => {\n if (!participant) {\n throw new ParameterError(\n 'Interpretation support could not be processed, participant is undefined.'\n );\n }\n\n return !participant.doesNotSupportSiInterpreter;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isLiveAnnotationSupported = (participant) => {\n if (!participant) {\n throw new ParameterError(\n 'LiveAnnotation support could not be processed, participant is undefined.'\n );\n }\n\n return !participant.annotatorAssignmentNotAllowed;\n};\n\n/**\n * utility method for audio/video muted status\n * @param {String} status\n * @param {String} accessor\n * @returns {Boolean}\n */\nMemberUtil.isMuted = (status: string, accessor: string) => {\n if (status) {\n if (status[accessor] === _RECEIVE_ONLY_) {\n return true;\n }\n if (status[accessor] === _SEND_RECEIVE_) {\n return false;\n }\n }\n\n return null;\n};\n\n/**\n * utility method for getting the recording member for later comparison\n * @param {Object} controls\n * @returns {String|null}\n */\nMemberUtil.getRecordingMember = (controls: any) => {\n if (!controls) {\n return null;\n }\n if (controls.record && controls.record.recording && controls.record.meta) {\n return controls.record.meta.modifiedBy;\n }\n\n return null;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isRecording = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Recording could not be processed, participant is undefined.');\n }\n if (participant.controls && participant.controls.localRecord) {\n return participant.controls.localRecord.recording;\n }\n\n return false;\n};\n\nMemberUtil.isRemovable = (isSelf, isGuest, isInMeeting, type) => {\n if (isGuest || isSelf) {\n return false;\n }\n if (type === _CALL_) {\n return false;\n }\n if (isInMeeting) {\n return true;\n }\n\n return false;\n};\n\nMemberUtil.isMutable = (isSelf, isDevice, isInMeeting, isMuted, type) => {\n if (!isInMeeting) {\n return false;\n }\n if (isMuted) {\n return false;\n }\n if (type === _CALL_) {\n return false;\n }\n if (isSelf || isDevice) {\n return true;\n }\n\n return false;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {String}\n */\nMemberUtil.extractStatus = (participant: any) => {\n if (!(participant && participant.devices && participant.devices.length)) {\n return _NOT_IN_MEETING_;\n }\n if (participant.state === _JOINED_) {\n return _IN_MEETING_;\n }\n if (participant.state === _IDLE_) {\n if (participant.devices && participant.devices.length > 0) {\n const foundDevice = participant.devices.find(\n (device) =>\n device.intent && (device.intent.type === _WAIT_ || device.intent.type === _OBSERVE_)\n );\n\n return foundDevice ? _IN_LOBBY_ : _NOT_IN_MEETING_;\n }\n\n return _NOT_IN_MEETING_;\n }\n if (participant.state === _LEFT_) {\n return _NOT_IN_MEETING_;\n }\n\n return _NOT_IN_MEETING_;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {String}\n */\nMemberUtil.extractId = (participant: any) => {\n if (participant) {\n return participant.id;\n }\n\n return null;\n};\n\n/**\n * extracts the media status from nested participant object\n * @param {Object} participant the locus participant\n * @returns {Object}\n */\nMemberUtil.extractMediaStatus = (participant: any): IMediaStatus => {\n if (!participant) {\n throw new ParameterError('Media status could not be extracted, participant is undefined.');\n }\n\n return {\n audio: participant.status?.audioStatus,\n video: participant.status?.videoStatus,\n };\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {String}\n */\nMemberUtil.extractName = (participant: any) => {\n if (participant && participant.person) {\n return participant.person.name;\n }\n\n return null;\n};\n\nexport default MemberUtil;\n"],"mappings":";;;;;;;;AAAA;AAOA;AAiBA;AAEA,IAAMA,UAAe,GAAG,CAAC,CAAC;;AAE1B;AACA;AACA;AACA;AACAA,UAAU,CAACC,gBAAgB,GAAG,UAACC,WAAiC;EAAA;EAAA,OAC9DA,WAAW,aAAXA,WAAW,gDAAXA,WAAW,CAAEC,QAAQ,oFAArB,sBAAuBC,IAAI,2DAA3B,uBAA6BC,KAAK;AAAA;;AAEpC;AACA;AACA;AACA;AACA;AACAL,UAAU,CAACM,OAAO,GAAG,UAACJ,WAAgB,EAAEK,WAAwB;EAAA;EAAA,gCAC9DP,UAAU,CAACC,gBAAgB,CAACC,WAAW,CAAC,0DAAxC,sBAA0CM,IAAI,CAC5C,UAACJ,IAAI;IAAA,OAAKA,IAAI,CAACK,IAAI,KAAKF,WAAW,IAAIH,IAAI,CAACE,OAAO;EAAA,EACpD;AAAA;;AAEH;AACA;AACA;AACA;AACAN,UAAU,CAACU,SAAS,GAAG,UAACR,WAAiC;EAAA,OACvDF,UAAU,CAACM,OAAO,CAACJ,WAAW,EAAES,kBAAW,CAACC,MAAM,CAAC,IAAI,KAAK;AAAA;;AAE9D;AACA;AACA;AACA;AACAZ,UAAU,CAACa,YAAY,GAAG,UAACX,WAAiC;EAAA,OAC1DF,UAAU,CAACM,OAAO,CAACJ,WAAW,EAAES,kBAAW,CAACG,SAAS,CAAC,IAAI,KAAK;AAAA;;AAEjE;AACA;AACA;AACA;AACAd,UAAU,CAACe,YAAY,GAAG,UAACb,WAAiC;EAAA,OAC1DF,UAAU,CAACM,OAAO,CAACJ,WAAW,EAAES,kBAAW,CAACK,SAAS,CAAC,IAAI,KAAK;AAAA;;AAEjE;AACA;AACA;AACA;AACAhB,UAAU,CAACiB,mBAAmB,GAAG,UAACf,WAAiC,EAAqB;EACtF,IAAMG,KAAK,GAAG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AAU,CAACuF,SAAS,GAAG,UAACrF,WAAgB,EAAK;EAC3C,IAAIA,WAAW,EAAE;IACf,OAAOA,WAAW,CAAC6B,EAAE;EACvB;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA/B,UAAU,CAACwF,kBAAkB,GAAG,UAACtF,WAAgB,EAAmB;EAAA;EAClE,IAAI,CAACA,WAAW,EAAE;IAChB,MAAM,IAAI0C,kBAAc,CAAC,gEAAgE,CAAC;EAC5F;EAEA,OAAO;IACLI,KAAK,yBAAE9C,WAAW,CAACmC,MAAM,wDAAlB,oBAAoBoD,WAAW;IACtCC,KAAK,0BAAExF,WAAW,CAACmC,MAAM,yDAAlB,qBAAoBsD;EAC7B,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA3F,UAAU,CAAC4F,WAAW,GAAG,UAAC1F,WAAgB,EAAK;EAC7C,IAAIA,WAAW,IAAIA,WAAW,CAAC8B,MAAM,EAAE;IACrC,OAAO9B,WAAW,CAAC8B,MAAM,CAAC6D,IAAI;EAChC;EAEA,OAAO,IAAI;AACb,CAAC;AAAC,eAEa7F,UAAU;AAAA"}
1
+ {"version":3,"names":["MemberUtil","getControlsRoles","participant","controls","role","roles","hasRole","controlRole","some","type","hasCohost","ServerRoles","Cohost","hasModerator","Moderator","hasPresenter","Presenter","extractControlRoles","cohost","moderator","presenter","isUser","_USER_","isModerator","isGuest","guest","isDevice","_RESOURCE_ROOM_","isModeratorAssignmentProhibited","moderatorAssignmentNotAllowed","isSame","id","person","isAssociatedSame","associatedUsers","user","isNotAdmitted","status","devices","intent","_WAIT_","_IN_LOBBY_","_IN_MEETING_","isAudioMuted","ParameterError","isMuted","AUDIO_STATUS","AUDIO","isVideoMuted","VIDEO_STATUS","VIDEO","isHandRaised","hand","raised","isBreakoutsSupported","doesNotSupportBreakouts","isInterpretationSupported","doesNotSupportSiInterpreter","isLiveAnnotationSupported","annotatorAssignmentNotAllowed","statusAccessor","controlsAccessor","remoteMute","muted","localStatus","_RECEIVE_ONLY_","_SEND_RECEIVE_","getRecordingMember","record","recording","meta","modifiedBy","isRecording","localRecord","isRemovable","isSelf","isInMeeting","_CALL_","isMutable","extractStatus","length","_NOT_IN_MEETING_","state","_JOINED_","_IDLE_","foundDevice","find","device","_OBSERVE_","_LEFT_","extractId","extractMediaStatus","audio","audioStatus","video","videoStatus","extractName","name"],"sources":["util.ts"],"sourcesContent":["import {\n IExternalRoles,\n ParticipantWithRoles,\n ServerRoles,\n ServerRoleShape,\n IMediaStatus,\n} from './types';\nimport {\n _USER_,\n _RESOURCE_ROOM_,\n _OBSERVE_,\n _WAIT_,\n _LEFT_,\n _JOINED_,\n _IDLE_,\n _IN_LOBBY_,\n _NOT_IN_MEETING_,\n _IN_MEETING_,\n AUDIO_STATUS,\n VIDEO_STATUS,\n _SEND_RECEIVE_,\n _RECEIVE_ONLY_,\n _CALL_,\n VIDEO,\n AUDIO,\n} from '../constants';\nimport ParameterError from '../common/errors/parameter';\n\nconst MemberUtil: any = {};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {[ServerRoleShape]}\n */\nMemberUtil.getControlsRoles = (participant: ParticipantWithRoles): Array<ServerRoleShape> =>\n participant?.controls?.role?.roles;\n\n/**\n * @param {Object} participant the locus participant\n * @param {ServerRoles} controlRole the search role\n * @returns {Boolean}\n */\nMemberUtil.hasRole = (participant: any, controlRole: ServerRoles): boolean =>\n MemberUtil.getControlsRoles(participant)?.some(\n (role) => role.type === controlRole && role.hasRole\n );\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.hasCohost = (participant: ParticipantWithRoles): boolean =>\n MemberUtil.hasRole(participant, ServerRoles.Cohost) || false;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.hasModerator = (participant: ParticipantWithRoles): boolean =>\n MemberUtil.hasRole(participant, ServerRoles.Moderator) || false;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.hasPresenter = (participant: ParticipantWithRoles): boolean =>\n MemberUtil.hasRole(participant, ServerRoles.Presenter) || false;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {IExternalRoles}\n */\nMemberUtil.extractControlRoles = (participant: ParticipantWithRoles): IExternalRoles => {\n const roles = {\n cohost: MemberUtil.hasCohost(participant),\n moderator: MemberUtil.hasModerator(participant),\n presenter: MemberUtil.hasPresenter(participant),\n };\n\n return roles;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isUser = (participant: any) => participant && participant.type === _USER_;\n\nMemberUtil.isModerator = (participant) => participant && participant.moderator;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isGuest = (participant: any) => participant && participant.guest;\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isDevice = (participant: any) => participant && participant.type === _RESOURCE_ROOM_;\n\nMemberUtil.isModeratorAssignmentProhibited = (participant) =>\n participant && participant.moderatorAssignmentNotAllowed;\n\n/**\n * checks to see if the participant id is the same as the passed id\n * there are multiple ids that can be used\n * @param {Object} participant the locus participant\n * @param {String} id\n * @returns {Boolean}\n */\nMemberUtil.isSame = (participant: any, id: string) =>\n participant && (participant.id === id || (participant.person && participant.person.id === id));\n\n/**\n * checks to see if the participant id is the same as the passed id for associated devices\n * there are multiple ids that can be used\n * @param {Object} participant the locus participant\n * @param {String} id\n * @returns {Boolean}\n */\nMemberUtil.isAssociatedSame = (participant: any, id: string) =>\n participant &&\n participant.associatedUsers &&\n participant.associatedUsers.some(\n (user) => user.id === id || (user.person && user.person.id === id)\n );\n\n/**\n * @param {Object} participant the locus participant\n * @param {Boolean} isGuest\n * @param {String} status\n * @returns {Boolean}\n */\nMemberUtil.isNotAdmitted = (participant: any, isGuest: boolean, status: string): boolean =>\n participant &&\n participant.guest &&\n ((participant.devices &&\n participant.devices[0] &&\n participant.devices[0].intent &&\n participant.devices[0].intent.type === _WAIT_ &&\n // @ts-ignore\n isGuest &&\n status === _IN_LOBBY_) ||\n // @ts-ignore\n !status === _IN_MEETING_);\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isAudioMuted = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Audio could not be processed, participant is undefined.');\n }\n\n return MemberUtil.isMuted(participant, AUDIO_STATUS, AUDIO);\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isVideoMuted = (participant: any): boolean => {\n if (!participant) {\n throw new ParameterError('Video could not be processed, participant is undefined.');\n }\n\n return MemberUtil.isMuted(participant, VIDEO_STATUS, VIDEO);\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isHandRaised = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Raise hand could not be processed, participant is undefined.');\n }\n\n return participant.controls?.hand?.raised || false;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isBreakoutsSupported = (participant) => {\n if (!participant) {\n throw new ParameterError('Breakout support could not be processed, participant is undefined.');\n }\n\n return !participant.doesNotSupportBreakouts;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isInterpretationSupported = (participant) => {\n if (!participant) {\n throw new ParameterError(\n 'Interpretation support could not be processed, participant is undefined.'\n );\n }\n\n return !participant.doesNotSupportSiInterpreter;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isLiveAnnotationSupported = (participant) => {\n if (!participant) {\n throw new ParameterError(\n 'LiveAnnotation support could not be processed, participant is undefined.'\n );\n }\n\n return !participant.annotatorAssignmentNotAllowed;\n};\n\n/**\n * utility method for audio/video muted status\n * @param {any} participant\n * @param {String} statusAccessor\n * @param {String} controlsAccessor\n * @returns {Boolean | undefined}\n */\nMemberUtil.isMuted = (participant: any, statusAccessor: string, controlsAccessor: string) => {\n // check remote mute\n const remoteMute = participant?.controls?.[controlsAccessor]?.muted;\n if (remoteMute === true) {\n return true;\n }\n\n // check local mute\n const localStatus = participant?.status?.[statusAccessor];\n if (localStatus === _RECEIVE_ONLY_) {\n return true;\n }\n if (localStatus === _SEND_RECEIVE_) {\n return false;\n }\n\n return remoteMute;\n};\n\n/**\n * utility method for getting the recording member for later comparison\n * @param {Object} controls\n * @returns {String|null}\n */\nMemberUtil.getRecordingMember = (controls: any) => {\n if (!controls) {\n return null;\n }\n if (controls.record && controls.record.recording && controls.record.meta) {\n return controls.record.meta.modifiedBy;\n }\n\n return null;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {Boolean}\n */\nMemberUtil.isRecording = (participant: any) => {\n if (!participant) {\n throw new ParameterError('Recording could not be processed, participant is undefined.');\n }\n if (participant.controls && participant.controls.localRecord) {\n return participant.controls.localRecord.recording;\n }\n\n return false;\n};\n\nMemberUtil.isRemovable = (isSelf, isGuest, isInMeeting, type) => {\n if (isGuest || isSelf) {\n return false;\n }\n if (type === _CALL_) {\n return false;\n }\n if (isInMeeting) {\n return true;\n }\n\n return false;\n};\n\nMemberUtil.isMutable = (isSelf, isDevice, isInMeeting, isMuted, type) => {\n if (!isInMeeting) {\n return false;\n }\n if (isMuted) {\n return false;\n }\n if (type === _CALL_) {\n return false;\n }\n if (isSelf || isDevice) {\n return true;\n }\n\n return false;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {String}\n */\nMemberUtil.extractStatus = (participant: any) => {\n if (!(participant && participant.devices && participant.devices.length)) {\n return _NOT_IN_MEETING_;\n }\n if (participant.state === _JOINED_) {\n return _IN_MEETING_;\n }\n if (participant.state === _IDLE_) {\n if (participant.devices && participant.devices.length > 0) {\n const foundDevice = participant.devices.find(\n (device) =>\n device.intent && (device.intent.type === _WAIT_ || device.intent.type === _OBSERVE_)\n );\n\n return foundDevice ? _IN_LOBBY_ : _NOT_IN_MEETING_;\n }\n\n return _NOT_IN_MEETING_;\n }\n if (participant.state === _LEFT_) {\n return _NOT_IN_MEETING_;\n }\n\n return _NOT_IN_MEETING_;\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {String}\n */\nMemberUtil.extractId = (participant: any) => {\n if (participant) {\n return participant.id;\n }\n\n return null;\n};\n\n/**\n * extracts the media status from nested participant object\n * @param {Object} participant the locus participant\n * @returns {Object}\n */\nMemberUtil.extractMediaStatus = (participant: any): IMediaStatus => {\n if (!participant) {\n throw new ParameterError('Media status could not be extracted, participant is undefined.');\n }\n\n return {\n audio: participant.status?.audioStatus,\n video: participant.status?.videoStatus,\n };\n};\n\n/**\n * @param {Object} participant the locus participant\n * @returns {String}\n */\nMemberUtil.extractName = (participant: any) => {\n if (participant && participant.person) {\n return participant.person.name;\n }\n\n return null;\n};\n\nexport default MemberUtil;\n"],"mappings":";;;;;;;;AAAA;AAOA;AAmBA;AAEA,IAAMA,UAAe,GAAG,CAAC,CAAC;;AAE1B;AACA;AACA;AACA;AACAA,UAAU,CAACC,gBAAgB,GAAG,UAACC,WAAiC;EAAA;EAAA,OAC9DA,WAAW,aAAXA,WAAW,gDAAXA,WAAW,CAAEC,QAAQ,oFAArB,sBAAuBC,IAAI,2DAA3B,uBAA6BC,KAAK;AAAA;;AAEpC;AACA;AACA;AACA;AACA;AACAL,UAAU,CAACM,OAAO,GAAG,UAACJ,WAAgB,EAAEK,WAAwB;EAAA;EAAA,gCAC9DP,UAAU,CAACC,gBAAgB,CAACC,WAAW,CAAC,0DAAxC,sBAA0CM,IAAI,CAC5C,UAACJ,IAAI;IAAA,OAAKA,IAAI,CAACK,IAAI,KAAKF,WAAW,IAAIH,IAAI,CAACE,OAAO;EAAA,EACpD;AAAA;;AAEH;AACA;AACA;AACA;AACAN,UAAU,CAACU,SAAS,GAAG,UAACR,WAAiC;EAAA,OACvDF,UAAU,CAACM,OAAO,CAACJ,WAAW,EAAES,kBAAW,CAACC,MAAM,CAAC,IAAI,KAAK;AAAA;;AAE9D;AACA;AACA;AACA;AACAZ,UAAU,CAACa,YAAY,GA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,OACLA,MAAM,CAAChD,MAAM,KAAKgD,MAAM,CAAChD,MAAM,CAAC9B,IAAI,KAAK+B,iBAAM,IAAI+C,MAAM,CAAChD,MAAM,CAAC9B,IAAI,KAAK+E,oBAAS,CAAC;MAAA,EACvF;MAED,OAAOH,WAAW,GAAG5C,qBAAU,GAAGwC,2BAAgB;IACpD;IAEA,OAAOA,2BAAgB;EACzB;EACA,IAAI/E,WAAW,CAACgF,KAAK,KAAKO,iBAAM,EAAE;IAChC,OAAOR,2BAAgB;EACzB;EAEA,OAAOA,2BAAgB;AACzB,CAAC;;AAED;AACA;AACA;AACA;AACAjF,UAAU,CAAC0F,SAAS,GAAG,UAACxF,WAAgB,EAAK;EAC3C,IAAIA,WAAW,EAAE;IACf,OAAOA,WAAW,CAAC6B,EAAE;EACvB;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA/B,UAAU,CAAC2F,kBAAkB,GAAG,UAACzF,WAAgB,EAAmB;EAAA;EAClE,IAAI,CAACA,WAAW,EAAE;IAChB,MAAM,IAAI0C,kBAAc,CAAC,gEAAgE,CAAC;EAC5F;EAEA,OAAO;IACLgD,KAAK,0BAAE1F,WAAW,CAACmC,MAAM,yDAAlB,qBAAoBwD,WAAW;IACtCC,KAAK,0BAAE5F,WAAW,CAACmC,MAAM,yDAAlB,qBAAoB0D;EAC7B,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA/F,UAAU,CAACgG,WAAW,GAAG,UAAC9F,WAAgB,EAAK;EAC7C,IAAIA,WAAW,IAAIA,WAAW,CAAC8B,MAAM,EAAE;IACrC,OAAO9B,WAAW,CAAC8B,MAAM,CAACiE,IAAI;EAChC;EAEA,OAAO,IAAI;AACb,CAAC;AAAC,eAEajG,UAAU;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-beta.183",
3
+ "version": "3.0.0-beta.184",
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.183",
36
- "@webex/test-helper-chai": "3.0.0-beta.183",
37
- "@webex/test-helper-mocha": "3.0.0-beta.183",
38
- "@webex/test-helper-mock-webex": "3.0.0-beta.183",
39
- "@webex/test-helper-retry": "3.0.0-beta.183",
40
- "@webex/test-helper-test-users": "3.0.0-beta.183",
35
+ "@webex/plugin-meetings": "3.0.0-beta.184",
36
+ "@webex/test-helper-chai": "3.0.0-beta.184",
37
+ "@webex/test-helper-mocha": "3.0.0-beta.184",
38
+ "@webex/test-helper-mock-webex": "3.0.0-beta.184",
39
+ "@webex/test-helper-retry": "3.0.0-beta.184",
40
+ "@webex/test-helper-test-users": "3.0.0-beta.184",
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.183",
49
+ "@webex/common": "3.0.0-beta.184",
50
50
  "@webex/internal-media-core": "1.39.1",
51
- "@webex/internal-plugin-conversation": "3.0.0-beta.183",
52
- "@webex/internal-plugin-device": "3.0.0-beta.183",
53
- "@webex/internal-plugin-llm": "3.0.0-beta.183",
54
- "@webex/internal-plugin-mercury": "3.0.0-beta.183",
55
- "@webex/internal-plugin-metrics": "3.0.0-beta.183",
56
- "@webex/internal-plugin-support": "3.0.0-beta.183",
57
- "@webex/internal-plugin-user": "3.0.0-beta.183",
58
- "@webex/media-helpers": "3.0.0-beta.183",
59
- "@webex/plugin-people": "3.0.0-beta.183",
60
- "@webex/plugin-rooms": "3.0.0-beta.183",
61
- "@webex/webex-core": "3.0.0-beta.183",
51
+ "@webex/internal-plugin-conversation": "3.0.0-beta.184",
52
+ "@webex/internal-plugin-device": "3.0.0-beta.184",
53
+ "@webex/internal-plugin-llm": "3.0.0-beta.184",
54
+ "@webex/internal-plugin-mercury": "3.0.0-beta.184",
55
+ "@webex/internal-plugin-metrics": "3.0.0-beta.184",
56
+ "@webex/internal-plugin-support": "3.0.0-beta.184",
57
+ "@webex/internal-plugin-user": "3.0.0-beta.184",
58
+ "@webex/media-helpers": "3.0.0-beta.184",
59
+ "@webex/plugin-people": "3.0.0-beta.184",
60
+ "@webex/plugin-rooms": "3.0.0-beta.184",
61
+ "@webex/webex-core": "3.0.0-beta.184",
62
62
  "ampersand-collection": "^2.0.2",
63
63
  "bowser": "^2.11.0",
64
64
  "btoa": "^1.2.1",
@@ -21,6 +21,8 @@ import {
21
21
  _SEND_RECEIVE_,
22
22
  _RECEIVE_ONLY_,
23
23
  _CALL_,
24
+ VIDEO,
25
+ AUDIO,
24
26
  } from '../constants';
25
27
  import ParameterError from '../common/errors/parameter';
26
28
 
@@ -152,30 +154,20 @@ MemberUtil.isAudioMuted = (participant: any) => {
152
154
  if (!participant) {
153
155
  throw new ParameterError('Audio could not be processed, participant is undefined.');
154
156
  }
155
- const mutedStatus = MemberUtil.isMuted(participant.status, AUDIO_STATUS);
156
157
 
157
- if (participant.controls && participant.controls.audio) {
158
- if (participant.controls.audio.muted) {
159
- return true;
160
- }
161
- if (mutedStatus) {
162
- return true;
163
- }
164
- }
165
-
166
- return false;
158
+ return MemberUtil.isMuted(participant, AUDIO_STATUS, AUDIO);
167
159
  };
168
160
 
169
161
  /**
170
162
  * @param {Object} participant the locus participant
171
163
  * @returns {Boolean}
172
164
  */
173
- MemberUtil.isVideoMuted = (participant: any) => {
165
+ MemberUtil.isVideoMuted = (participant: any): boolean => {
174
166
  if (!participant) {
175
167
  throw new ParameterError('Video could not be processed, participant is undefined.');
176
168
  }
177
169
 
178
- return MemberUtil.isMuted(participant.status, VIDEO_STATUS);
170
+ return MemberUtil.isMuted(participant, VIDEO_STATUS, VIDEO);
179
171
  };
180
172
 
181
173
  /**
@@ -232,21 +224,28 @@ MemberUtil.isLiveAnnotationSupported = (participant) => {
232
224
 
233
225
  /**
234
226
  * utility method for audio/video muted status
235
- * @param {String} status
236
- * @param {String} accessor
237
- * @returns {Boolean}
227
+ * @param {any} participant
228
+ * @param {String} statusAccessor
229
+ * @param {String} controlsAccessor
230
+ * @returns {Boolean | undefined}
238
231
  */
239
- MemberUtil.isMuted = (status: string, accessor: string) => {
240
- if (status) {
241
- if (status[accessor] === _RECEIVE_ONLY_) {
242
- return true;
243
- }
244
- if (status[accessor] === _SEND_RECEIVE_) {
245
- return false;
246
- }
232
+ MemberUtil.isMuted = (participant: any, statusAccessor: string, controlsAccessor: string) => {
233
+ // check remote mute
234
+ const remoteMute = participant?.controls?.[controlsAccessor]?.muted;
235
+ if (remoteMute === true) {
236
+ return true;
247
237
  }
248
238
 
249
- return null;
239
+ // check local mute
240
+ const localStatus = participant?.status?.[statusAccessor];
241
+ if (localStatus === _RECEIVE_ONLY_) {
242
+ return true;
243
+ }
244
+ if (localStatus === _SEND_RECEIVE_) {
245
+ return false;
246
+ }
247
+
248
+ return remoteMute;
250
249
  };
251
250
 
252
251
  /**
@@ -1,6 +1,7 @@
1
1
  import {assert} from '@webex/test-helper-chai';
2
2
  import MemberUtil from '@webex/plugin-meetings/src/member/util';
3
- import { ServerRoles } from '../../../../src/member/types';
3
+ import {ServerRoles} from '../../../../src/member/types';
4
+ import {_SEND_RECEIVE_, _RECEIVE_ONLY_} from '../../../../src/constants';
4
5
 
5
6
  describe('plugin-meetings', () => {
6
7
  describe('isHandRaised', () => {
@@ -58,12 +59,16 @@ describe('plugin-meetings', () => {
58
59
  {type: 'PRESENTER', hasRole: true},
59
60
  {type: 'COHOST', hasRole: true},
60
61
  {type: 'MODERATOR', hasRole: true},
61
- ]
62
- }
63
- }
64
- }
62
+ ],
63
+ },
64
+ },
65
+ };
65
66
 
66
- assert.deepEqual(MemberUtil.extractControlRoles(participant), {cohost: true, moderator: true, presenter: true});
67
+ assert.deepEqual(MemberUtil.extractControlRoles(participant), {
68
+ cohost: true,
69
+ moderator: true,
70
+ presenter: true,
71
+ });
67
72
  });
68
73
  });
69
74
 
@@ -72,14 +77,14 @@ describe('plugin-meetings', () => {
72
77
  const participant = {
73
78
  controls: {
74
79
  role: {
75
- roles: [
76
- {type: 'PRESENTER', hasRole: true},
77
- ]
78
- }
79
- }
80
- }
80
+ roles: [{type: 'PRESENTER', hasRole: true}],
81
+ },
82
+ },
83
+ };
81
84
 
82
- assert.deepEqual(MemberUtil.getControlsRoles(participant), [{type: 'PRESENTER', hasRole: true}]);
85
+ assert.deepEqual(MemberUtil.getControlsRoles(participant), [
86
+ {type: 'PRESENTER', hasRole: true},
87
+ ]);
83
88
  });
84
89
  });
85
90
 
@@ -89,12 +94,10 @@ describe('plugin-meetings', () => {
89
94
  const participant = {
90
95
  controls: {
91
96
  role: {
92
- roles: [
93
- {type: 'PRESENTER', hasRole: true},
94
- ]
95
- }
96
- }
97
- }
97
+ roles: [{type: 'PRESENTER', hasRole: true}],
98
+ },
99
+ },
100
+ };
98
101
 
99
102
  assert.isTrue(MemberUtil.hasRole(participant, ServerRoles.Presenter));
100
103
  });
@@ -103,12 +106,10 @@ describe('plugin-meetings', () => {
103
106
  const participant = {
104
107
  controls: {
105
108
  role: {
106
- roles: [
107
- {type: 'PRESENTER', hasRole: false},
108
- ]
109
- }
110
- }
111
- }
109
+ roles: [{type: 'PRESENTER', hasRole: false}],
110
+ },
111
+ },
112
+ };
112
113
 
113
114
  assert.isFalse(MemberUtil.hasRole(participant, ServerRoles.Presenter));
114
115
  });
@@ -117,28 +118,24 @@ describe('plugin-meetings', () => {
117
118
  const participant = {
118
119
  controls: {
119
120
  role: {
120
- roles: [
121
- {},
122
- ]
123
- }
124
- }
125
- }
121
+ roles: [{}],
122
+ },
123
+ },
124
+ };
126
125
 
127
126
  assert.isFalse(MemberUtil.hasRole(participant, ServerRoles.Presenter));
128
127
  });
129
- })
128
+ });
130
129
 
131
130
  describe('MODERATOR', () => {
132
131
  it('getControlsRoles MODERATOR true', () => {
133
132
  const participant = {
134
133
  controls: {
135
134
  role: {
136
- roles: [
137
- {type: 'MODERATOR', hasRole: true},
138
- ]
139
- }
140
- }
141
- }
135
+ roles: [{type: 'MODERATOR', hasRole: true}],
136
+ },
137
+ },
138
+ };
142
139
 
143
140
  assert.isTrue(MemberUtil.hasRole(participant, ServerRoles.Moderator));
144
141
  });
@@ -147,12 +144,10 @@ describe('plugin-meetings', () => {
147
144
  const participant = {
148
145
  controls: {
149
146
  role: {
150
- roles: [
151
- {type: 'MODERATOR', hasRole: false},
152
- ]
153
- }
154
- }
155
- }
147
+ roles: [{type: 'MODERATOR', hasRole: false}],
148
+ },
149
+ },
150
+ };
156
151
 
157
152
  assert.isFalse(MemberUtil.hasRole(participant, ServerRoles.Moderator));
158
153
  });
@@ -161,28 +156,24 @@ describe('plugin-meetings', () => {
161
156
  const participant = {
162
157
  controls: {
163
158
  role: {
164
- roles: [
165
- {},
166
- ]
167
- }
168
- }
169
- }
159
+ roles: [{}],
160
+ },
161
+ },
162
+ };
170
163
 
171
164
  assert.isFalse(MemberUtil.hasRole(participant, ServerRoles.Moderator));
172
165
  });
173
- })
166
+ });
174
167
 
175
168
  describe('COHOST', () => {
176
169
  it('getControlsRoles COHOST true', () => {
177
170
  const participant = {
178
171
  controls: {
179
172
  role: {
180
- roles: [
181
- {type: 'COHOST', hasRole: true},
182
- ]
183
- }
184
- }
185
- }
173
+ roles: [{type: 'COHOST', hasRole: true}],
174
+ },
175
+ },
176
+ };
186
177
 
187
178
  assert.isTrue(MemberUtil.hasRole(participant, ServerRoles.Cohost));
188
179
  });
@@ -191,12 +182,10 @@ describe('plugin-meetings', () => {
191
182
  const participant = {
192
183
  controls: {
193
184
  role: {
194
- roles: [
195
- {type: 'COHOST', hasRole: false},
196
- ]
197
- }
198
- }
199
- }
185
+ roles: [{type: 'COHOST', hasRole: false}],
186
+ },
187
+ },
188
+ };
200
189
 
201
190
  assert.isFalse(MemberUtil.hasRole(participant, ServerRoles.Cohost));
202
191
  });
@@ -205,16 +194,14 @@ describe('plugin-meetings', () => {
205
194
  const participant = {
206
195
  controls: {
207
196
  role: {
208
- roles: [
209
- {},
210
- ]
211
- }
212
- }
213
- }
197
+ roles: [{}],
198
+ },
199
+ },
200
+ };
214
201
 
215
202
  assert.isFalse(MemberUtil.hasRole(participant, ServerRoles.Cohost));
216
203
  });
217
- })
204
+ });
218
205
  });
219
206
 
220
207
  describe('MemberUtil.is<Role>', () => {
@@ -223,12 +210,10 @@ describe('plugin-meetings', () => {
223
210
  const participant = {
224
211
  controls: {
225
212
  role: {
226
- roles: [
227
- {type: 'PRESENTER', hasRole: true},
228
- ]
229
- }
230
- }
231
- }
213
+ roles: [{type: 'PRESENTER', hasRole: true}],
214
+ },
215
+ },
216
+ };
232
217
 
233
218
  assert.isTrue(MemberUtil.hasPresenter(participant, ServerRoles.Presenter));
234
219
  });
@@ -237,12 +222,10 @@ describe('plugin-meetings', () => {
237
222
  const participant = {
238
223
  controls: {
239
224
  role: {
240
- roles: [
241
- {type: 'PRESENTER', hasRole: false},
242
- ]
243
- }
244
- }
245
- }
225
+ roles: [{type: 'PRESENTER', hasRole: false}],
226
+ },
227
+ },
228
+ };
246
229
 
247
230
  assert.isFalse(MemberUtil.hasPresenter(participant));
248
231
  });
@@ -251,28 +234,24 @@ describe('plugin-meetings', () => {
251
234
  const participant = {
252
235
  controls: {
253
236
  role: {
254
- roles: [
255
- {},
256
- ]
257
- }
258
- }
259
- }
237
+ roles: [{}],
238
+ },
239
+ },
240
+ };
260
241
 
261
242
  assert.isFalse(MemberUtil.hasPresenter(participant));
262
243
  });
263
- })
244
+ });
264
245
 
265
246
  describe('MODERATOR', () => {
266
247
  it('getControlsRoles MODERATOR true', () => {
267
248
  const participant = {
268
249
  controls: {
269
250
  role: {
270
- roles: [
271
- {type: 'MODERATOR', hasRole: true},
272
- ]
273
- }
274
- }
275
- }
251
+ roles: [{type: 'MODERATOR', hasRole: true}],
252
+ },
253
+ },
254
+ };
276
255
 
277
256
  assert.isTrue(MemberUtil.hasModerator(participant));
278
257
  });
@@ -281,12 +260,10 @@ describe('plugin-meetings', () => {
281
260
  const participant = {
282
261
  controls: {
283
262
  role: {
284
- roles: [
285
- {type: 'MODERATOR', hasRole: false},
286
- ]
287
- }
288
- }
289
- }
263
+ roles: [{type: 'MODERATOR', hasRole: false}],
264
+ },
265
+ },
266
+ };
290
267
 
291
268
  assert.isFalse(MemberUtil.hasModerator(participant));
292
269
  });
@@ -295,28 +272,24 @@ describe('plugin-meetings', () => {
295
272
  const participant = {
296
273
  controls: {
297
274
  role: {
298
- roles: [
299
- {},
300
- ]
301
- }
302
- }
303
- }
275
+ roles: [{}],
276
+ },
277
+ },
278
+ };
304
279
 
305
280
  assert.isFalse(MemberUtil.hasModerator(participant));
306
281
  });
307
- })
282
+ });
308
283
 
309
284
  describe('COHOST', () => {
310
285
  it('getControlsRoles COHOST true', () => {
311
286
  const participant = {
312
287
  controls: {
313
288
  role: {
314
- roles: [
315
- {type: 'COHOST', hasRole: true},
316
- ]
317
- }
318
- }
319
- }
289
+ roles: [{type: 'COHOST', hasRole: true}],
290
+ },
291
+ },
292
+ };
320
293
 
321
294
  assert.isTrue(MemberUtil.hasCohost(participant));
322
295
  });
@@ -325,12 +298,10 @@ describe('plugin-meetings', () => {
325
298
  const participant = {
326
299
  controls: {
327
300
  role: {
328
- roles: [
329
- {type: 'COHOST', hasRole: false},
330
- ]
331
- }
332
- }
333
- }
301
+ roles: [{type: 'COHOST', hasRole: false}],
302
+ },
303
+ },
304
+ };
334
305
 
335
306
  assert.isFalse(MemberUtil.hasCohost(participant));
336
307
  });
@@ -339,16 +310,14 @@ describe('plugin-meetings', () => {
339
310
  const participant = {
340
311
  controls: {
341
312
  role: {
342
- roles: [
343
- {},
344
- ]
345
- }
346
- }
347
- }
313
+ roles: [{}],
314
+ },
315
+ },
316
+ };
348
317
 
349
318
  assert.isFalse(MemberUtil.hasCohost(participant));
350
319
  });
351
- })
320
+ });
352
321
  });
353
322
 
354
323
  describe('MemberUtil.isBreakoutsSupported', () => {
@@ -360,7 +329,7 @@ describe('plugin-meetings', () => {
360
329
 
361
330
  it('returns true when hand breakouts are supported', () => {
362
331
  const participant = {
363
- doesNotSupportBreakouts: false
332
+ doesNotSupportBreakouts: false,
364
333
  };
365
334
 
366
335
  assert.isTrue(MemberUtil.isBreakoutsSupported(participant));
@@ -368,7 +337,7 @@ describe('plugin-meetings', () => {
368
337
 
369
338
  it('returns false when hand breakouts are not supported', () => {
370
339
  const participant = {
371
- doesNotSupportBreakouts: true
340
+ doesNotSupportBreakouts: true,
372
341
  };
373
342
 
374
343
  assert.isFalse(MemberUtil.isBreakoutsSupported(participant));
@@ -384,7 +353,7 @@ describe('plugin-meetings', () => {
384
353
 
385
354
  it('returns true when hand live annotation are supported', () => {
386
355
  const participant = {
387
- annotatorAssignmentNotAllowed: false
356
+ annotatorAssignmentNotAllowed: false,
388
357
  };
389
358
 
390
359
  assert.isTrue(MemberUtil.isLiveAnnotationSupported(participant));
@@ -392,7 +361,7 @@ describe('plugin-meetings', () => {
392
361
 
393
362
  it('returns false when hand live annotation are not supported', () => {
394
363
  const participant = {
395
- annotatorAssignmentNotAllowed: true
364
+ annotatorAssignmentNotAllowed: true,
396
365
  };
397
366
 
398
367
  assert.isFalse(MemberUtil.isLiveAnnotationSupported(participant));
@@ -408,7 +377,7 @@ describe('plugin-meetings', () => {
408
377
 
409
378
  it('returns true when hand SiInterpreter are supported', () => {
410
379
  const participant = {
411
- doesNotSupportSiInterpreter: false
380
+ doesNotSupportSiInterpreter: false,
412
381
  };
413
382
 
414
383
  assert.isTrue(MemberUtil.isInterpretationSupported(participant));
@@ -416,12 +385,105 @@ describe('plugin-meetings', () => {
416
385
 
417
386
  it('returns false when hand SiInterpreter are not supported', () => {
418
387
  const participant = {
419
- doesNotSupportSiInterpreter: true
388
+ doesNotSupportSiInterpreter: true,
420
389
  };
421
390
 
422
391
  assert.isFalse(MemberUtil.isInterpretationSupported(participant));
423
392
  });
424
393
  });
394
+
395
+ const getMuteStatus = (muted) => {
396
+ if (muted === undefined) {
397
+ return undefined;
398
+ }
399
+ return muted ? _RECEIVE_ONLY_ : _SEND_RECEIVE_;
400
+ };
401
+
402
+ describe('MemberUtil.isAudioMuted', () => {
403
+ it('throws error when there is no participant', () => {
404
+ assert.throws(() => {
405
+ MemberUtil.isAudioMuted();
406
+ }, 'Audio could not be processed, participant is undefined.');
407
+ });
408
+
409
+ // NOTE: participant.controls.audio.muted represents remote video mute
410
+ // participant.status.audioStatus represents local video mute
411
+
412
+ const testResult = (remoteMuted, localMuted, expected) => {
413
+ const participant = {
414
+ controls: {audio: {muted: remoteMuted}},
415
+ status: {audioStatus: getMuteStatus(localMuted)},
416
+ };
417
+
418
+ assert.equal(MemberUtil.isAudioMuted(participant), expected);
419
+ };
420
+
421
+ it('returns true when remote is muted and local is not', () => {
422
+ testResult(true, false, true);
423
+ });
424
+
425
+ it('returns true when remote is not muted and local is muted', () => {
426
+ testResult(false, true, true);
427
+ });
428
+
429
+ it('returns false when both are not muted', () => {
430
+ testResult(false, false, false);
431
+ });
432
+
433
+ it('returns undefined when both are undefined', () => {
434
+ testResult(undefined, undefined, undefined);
435
+ });
436
+
437
+ it('returns defined status when the other is undefined', () => {
438
+ testResult(undefined, true, true);
439
+ testResult(undefined, false, false);
440
+ testResult(true, undefined, true);
441
+ testResult(false, undefined, false);
442
+ });
443
+ });
444
+
445
+ describe('MemberUtil.isVideoMuted', () => {
446
+ it('throws error when there is no participant', () => {
447
+ assert.throws(() => {
448
+ MemberUtil.isVideoMuted();
449
+ }, 'Video could not be processed, participant is undefined.');
450
+ });
451
+
452
+ // NOTE: participant.controls.video.muted represents remote video mute
453
+ // participant.status.videoStatus represents local video mute
454
+
455
+ const testResult = (remoteMuted, localMuted, expected) => {
456
+ const participant = {
457
+ controls: {video: {muted: remoteMuted}},
458
+ status: {videoStatus: getMuteStatus(localMuted)},
459
+ };
460
+
461
+ assert.equal(MemberUtil.isVideoMuted(participant), expected);
462
+ };
463
+
464
+ it('returns true when remote is muted and local is not', () => {
465
+ testResult(true, false, true);
466
+ });
467
+
468
+ it('returns true when remote is not muted and local is muted', () => {
469
+ testResult(false, true, true);
470
+ });
471
+
472
+ it('returns false when both are not muted', () => {
473
+ testResult(false, false, false);
474
+ });
475
+
476
+ it('returns undefined when both are undefined', () => {
477
+ testResult(undefined, undefined, undefined);
478
+ });
479
+
480
+ it('returns defined status when the other is undefined', () => {
481
+ testResult(undefined, true, true);
482
+ testResult(undefined, false, false);
483
+ testResult(true, undefined, true);
484
+ testResult(false, undefined, false);
485
+ });
486
+ });
425
487
  });
426
488
 
427
489
  describe('extractMediaStatus', () => {