@webex/plugin-meetings 3.8.0-web-workers-keepalive.1 → 3.8.1-next.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.
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +70 -6
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +12 -2
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.js +22 -123
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/enums.js +2 -0
- package/dist/controls-options-manager/enums.js.map +1 -1
- package/dist/controls-options-manager/types.js.map +1 -1
- package/dist/controls-options-manager/util.js +52 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +30 -10
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +83 -12
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/selfUtils.js +432 -418
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/media/index.js +17 -17
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +94 -6
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/brbState.js +9 -2
- package/dist/meeting/brbState.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +17 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +568 -328
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +0 -17
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +4 -4
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +30 -0
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/meeting/util.js +9 -1
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +19 -13
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meeting-info/utilv2.js +5 -1
- package/dist/meeting-info/utilv2.js.map +1 -1
- package/dist/meetings/index.js +76 -0
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/util.js +14 -0
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +45 -9
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js +3 -0
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +335 -356
- package/dist/member/util.js.map +1 -1
- package/dist/members/collection.js.map +1 -1
- package/dist/members/index.js +137 -29
- package/dist/members/index.js.map +1 -1
- package/dist/members/request.js +38 -0
- package/dist/members/request.js.map +1 -1
- package/dist/members/util.js +36 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +1 -0
- package/dist/metrics/constants.js.map +1 -1
- package/dist/reachability/clusterReachability.js +23 -31
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +42 -2
- package/dist/reachability/index.js.map +1 -1
- package/dist/reconnection-manager/index.js +2 -2
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/roap/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +45 -27
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/roap/types.js +17 -0
- package/dist/roap/types.js.map +1 -0
- package/dist/types/common/errors/webex-errors.d.ts +7 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/constants.d.ts +15 -85
- package/dist/types/controls-options-manager/enums.d.ts +3 -1
- package/dist/types/controls-options-manager/types.d.ts +7 -1
- package/dist/types/locus-info/index.d.ts +3 -3
- package/dist/types/locus-info/selfUtils.d.ts +216 -1
- package/dist/types/media/properties.d.ts +15 -0
- package/dist/types/meeting/in-meeting-actions.d.ts +16 -0
- package/dist/types/meeting/index.d.ts +35 -1
- package/dist/types/meeting/muteState.d.ts +0 -1
- package/dist/types/meeting/request.d.ts +12 -1
- package/dist/types/meeting/request.type.d.ts +6 -0
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +2 -1
- package/dist/types/meetings/index.d.ts +28 -0
- package/dist/types/member/index.d.ts +20 -6
- package/dist/types/member/types.d.ts +73 -14
- package/dist/types/member/util.d.ts +156 -1
- package/dist/types/members/collection.d.ts +6 -5
- package/dist/types/members/index.d.ts +32 -43
- package/dist/types/members/request.d.ts +26 -0
- package/dist/types/members/util.d.ts +27 -0
- package/dist/types/metrics/constants.d.ts +1 -0
- package/dist/types/reachability/clusterReachability.d.ts +2 -6
- package/dist/types/reachability/index.d.ts +8 -0
- package/dist/types/roap/index.d.ts +3 -2
- package/dist/types/roap/turnDiscovery.d.ts +5 -17
- package/dist/types/roap/types.d.ts +16 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +24 -23
- package/src/breakouts/index.ts +69 -0
- package/src/common/errors/webex-errors.ts +8 -1
- package/src/config.ts +2 -0
- package/src/constants.ts +23 -90
- package/src/controls-options-manager/enums.ts +2 -0
- package/src/controls-options-manager/types.ts +11 -1
- package/src/controls-options-manager/util.ts +62 -0
- package/src/locus-info/controlsUtils.ts +48 -12
- package/src/locus-info/index.ts +88 -13
- package/src/locus-info/selfUtils.ts +496 -442
- package/src/media/index.ts +23 -21
- package/src/media/properties.ts +96 -0
- package/src/meeting/brbState.ts +11 -2
- package/src/meeting/in-meeting-actions.ts +32 -0
- package/src/meeting/index.ts +356 -87
- package/src/meeting/locusMediaRequest.ts +0 -18
- package/src/meeting/muteState.ts +4 -4
- package/src/meeting/request.ts +36 -1
- package/src/meeting/request.type.ts +7 -0
- package/src/meeting/util.ts +9 -1
- package/src/meeting-info/meeting-info-v2.ts +7 -2
- package/src/meeting-info/utilv2.ts +5 -0
- package/src/meetings/index.ts +76 -0
- package/src/meetings/util.ts +18 -0
- package/src/member/index.ts +57 -22
- package/src/member/types.ts +82 -16
- package/src/member/util.ts +357 -353
- package/src/members/collection.ts +4 -3
- package/src/members/index.ts +137 -18
- package/src/members/request.ts +44 -0
- package/src/members/util.ts +43 -1
- package/src/metrics/constants.ts +1 -0
- package/src/reachability/clusterReachability.ts +26 -25
- package/src/reachability/index.ts +55 -1
- package/src/reconnection-manager/index.ts +2 -2
- package/src/roap/index.ts +3 -7
- package/src/roap/turnDiscovery.ts +34 -39
- package/src/roap/types.ts +23 -0
- package/test/unit/spec/breakouts/index.ts +167 -95
- package/test/unit/spec/controls-options-manager/util.js +120 -0
- package/test/unit/spec/locus-info/controlsUtils.js +131 -9
- package/test/unit/spec/locus-info/index.js +195 -73
- package/test/unit/spec/locus-info/selfUtils.js +98 -24
- package/test/unit/spec/media/index.ts +150 -18
- package/test/unit/spec/media/properties.ts +130 -0
- package/test/unit/spec/meeting/brbState.ts +40 -2
- package/test/unit/spec/meeting/in-meeting-actions.ts +19 -4
- package/test/unit/spec/meeting/index.js +553 -36
- package/test/unit/spec/meeting/locusMediaRequest.ts +0 -30
- package/test/unit/spec/meeting/muteState.js +73 -2
- package/test/unit/spec/meeting/request.js +32 -1
- package/test/unit/spec/meeting/utils.js +79 -33
- package/test/unit/spec/meeting-info/meetinginfov2.js +41 -0
- package/test/unit/spec/meeting-info/utilv2.js +19 -0
- package/test/unit/spec/meetings/index.js +68 -1
- package/test/unit/spec/members/index.js +304 -78
- package/test/unit/spec/members/request.js +68 -22
- package/test/unit/spec/members/utils.js +75 -0
- package/test/unit/spec/reachability/clusterReachability.ts +41 -55
- package/test/unit/spec/reachability/index.ts +89 -0
- package/test/unit/spec/reconnection-manager/index.js +4 -4
- package/test/unit/spec/roap/turnDiscovery.ts +110 -28
@@ -12,443 +12,457 @@ var _constants = require("../constants");
|
|
12
12
|
var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
|
13
13
|
/* eslint-disable default-param-last */
|
14
14
|
|
15
|
-
var SelfUtils = {};
|
16
15
|
var PSTN_DEVICE_TYPE = 'PROVISIONAL';
|
17
|
-
|
18
|
-
/**
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
16
|
+
var SelfUtils = {
|
17
|
+
/**
|
18
|
+
* parses the relevant values for self: muted, guest, moderator, mediaStatus, state, joinedWith, pstnDevices, creator, id
|
19
|
+
* @param {Object} self
|
20
|
+
* @param {String} deviceId
|
21
|
+
* @param {Array} participants
|
22
|
+
* @returns {undefined}
|
23
|
+
*/
|
24
|
+
parse: function parse(self, deviceId, participants) {
|
25
|
+
if (self) {
|
26
|
+
var _joinedWith$intent, _participants$find;
|
27
|
+
var joinedWith = self.devices.find(function (device) {
|
28
|
+
return deviceId === device.url;
|
29
|
+
});
|
30
|
+
var pairedWith = (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent = joinedWith.intent) === null || _joinedWith$intent === void 0 ? void 0 : _joinedWith$intent.type) === _constants._OBSERVE_ && (participants === null || participants === void 0 ? void 0 : (_participants$find = participants.find(function (participant) {
|
31
|
+
var _joinedWith$intent2;
|
32
|
+
return participant.url === (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent2 = joinedWith.intent) === null || _joinedWith$intent2 === void 0 ? void 0 : _joinedWith$intent2.associatedWith);
|
33
|
+
})) === null || _participants$find === void 0 ? void 0 : _participants$find.devices[0]);
|
34
|
+
var pstnDevices = self.devices.filter(function (device) {
|
35
|
+
return PSTN_DEVICE_TYPE === device.deviceType;
|
36
|
+
});
|
37
|
+
return {
|
38
|
+
remoteVideoMuted: SelfUtils.getRemoteVideoMuted(self),
|
39
|
+
remoteMuted: SelfUtils.getRemoteMuted(self),
|
40
|
+
unmuteAllowed: SelfUtils.getUnmuteAllowed(self),
|
41
|
+
localAudioUnmuteRequested: SelfUtils.getLocalAudioUnmuteRequested(self),
|
42
|
+
localAudioUnmuteRequestedTimeStamp: SelfUtils.getLocalAudioUnmuteRequestedTimeStamp(self),
|
43
|
+
localAudioUnmuteRequired: SelfUtils.getLocalAudioUnmuteRequired(self),
|
44
|
+
lastModified: SelfUtils.getLastModified(self),
|
45
|
+
modifiedBy: SelfUtils.getModifiedBy(self),
|
46
|
+
guest: self.guest,
|
47
|
+
moderator: self.moderator,
|
48
|
+
// cumulative media stats
|
49
|
+
mediaStatus: SelfUtils.getStatus(self.status),
|
50
|
+
// TODO: what should be the status if user has refreshed the page,
|
51
|
+
// check the joinedWith parameter and communicate to the user
|
52
|
+
state: self.state,
|
53
|
+
// TODO: give a proper name . With same device as login or different login`
|
54
|
+
// Some times we might have joined with both mobile and web
|
55
|
+
joinedWith: joinedWith,
|
56
|
+
pairedWith: pairedWith,
|
57
|
+
pstnDevices: pstnDevices,
|
58
|
+
// current media stats is for the current device who has joined
|
59
|
+
currentMediaStatus: SelfUtils.getMediaStatus(joinedWith === null || joinedWith === void 0 ? void 0 : joinedWith.mediaSessions),
|
60
|
+
creator: self.isCreator,
|
61
|
+
// check if its used,
|
62
|
+
selfId: self.id,
|
63
|
+
selfIdentity: SelfUtils.getSelfIdentity(self),
|
64
|
+
selfUrl: self.url,
|
65
|
+
removed: self.removed,
|
66
|
+
roles: SelfUtils.getRoles(self),
|
67
|
+
isUserUnadmitted: SelfUtils.isLocusUserUnadmitted(self === null || self === void 0 ? void 0 : self.state, joinedWith, pairedWith),
|
68
|
+
layout: SelfUtils.getLayout(self),
|
69
|
+
canNotViewTheParticipantList: SelfUtils.canNotViewTheParticipantList(self),
|
70
|
+
isSharingBlocked: SelfUtils.isSharingBlocked(self),
|
71
|
+
breakoutSessions: SelfUtils.getBreakoutSessions(self),
|
72
|
+
breakout: SelfUtils.getBreakout(self),
|
73
|
+
interpretation: SelfUtils.getInterpretation(self),
|
74
|
+
brb: SelfUtils.getBrb(self)
|
75
|
+
};
|
76
|
+
}
|
77
|
+
return null;
|
78
|
+
},
|
79
|
+
getBreakoutSessions: function getBreakoutSessions(self) {
|
80
|
+
var _self$controls, _self$controls$breako;
|
81
|
+
return self === null || self === void 0 ? void 0 : (_self$controls = self.controls) === null || _self$controls === void 0 ? void 0 : (_self$controls$breako = _self$controls.breakout) === null || _self$controls$breako === void 0 ? void 0 : _self$controls$breako.sessions;
|
82
|
+
},
|
83
|
+
getBreakout: function getBreakout(self) {
|
84
|
+
var _self$controls2;
|
85
|
+
return self === null || self === void 0 ? void 0 : (_self$controls2 = self.controls) === null || _self$controls2 === void 0 ? void 0 : _self$controls2.breakout;
|
86
|
+
},
|
87
|
+
getInterpretation: function getInterpretation(self) {
|
88
|
+
var _self$controls3;
|
89
|
+
return self === null || self === void 0 ? void 0 : (_self$controls3 = self.controls) === null || _self$controls3 === void 0 ? void 0 : _self$controls3.interpretation;
|
90
|
+
},
|
91
|
+
getBrb: function getBrb(self) {
|
92
|
+
var _self$controls4;
|
93
|
+
return self === null || self === void 0 ? void 0 : (_self$controls4 = self.controls) === null || _self$controls4 === void 0 ? void 0 : _self$controls4.brb;
|
94
|
+
},
|
95
|
+
getLayout: function getLayout(self) {
|
96
|
+
var _self$controls5;
|
97
|
+
return (0, _isArray.default)(self === null || self === void 0 ? void 0 : (_self$controls5 = self.controls) === null || _self$controls5 === void 0 ? void 0 : _self$controls5.layouts) ? self.controls.layouts[0].type : undefined;
|
98
|
+
},
|
99
|
+
getRoles: function getRoles(self) {
|
100
|
+
var _self$controls6, _self$controls6$role;
|
101
|
+
return ((self === null || self === void 0 ? void 0 : (_self$controls6 = self.controls) === null || _self$controls6 === void 0 ? void 0 : (_self$controls6$role = _self$controls6.role) === null || _self$controls6$role === void 0 ? void 0 : _self$controls6$role.roles) || []).reduce(function (roles, role) {
|
102
|
+
if (role.hasRole) {
|
103
|
+
roles.push(role.type);
|
104
|
+
}
|
105
|
+
return roles;
|
106
|
+
}, []);
|
107
|
+
},
|
108
|
+
canNotViewTheParticipantList: function canNotViewTheParticipantList(self) {
|
109
|
+
return !!(self !== null && self !== void 0 && self.canNotViewTheParticipantList);
|
110
|
+
},
|
111
|
+
isSharingBlocked: function isSharingBlocked(self) {
|
112
|
+
return !!(self !== null && self !== void 0 && self.isSharingBlocked);
|
113
|
+
},
|
114
|
+
getSelves: function getSelves(oldParsedSelf, newSelf, deviceId, participants) {
|
115
|
+
var previous = oldParsedSelf;
|
116
|
+
var current = newSelf && SelfUtils.parse(newSelf, deviceId, participants);
|
117
|
+
var updates = {};
|
118
|
+
updates.hasUserEnteredLobby = SelfUtils.hasUserEnteredLobby(previous, current);
|
119
|
+
updates.hasUserBeenAdmitted = SelfUtils.hasUserBeenAdmitted(previous, current);
|
120
|
+
updates.isVideoMutedByOthersChanged = SelfUtils.videoMutedByOthersChanged(previous, current);
|
121
|
+
updates.isMutedByOthersChanged = SelfUtils.mutedByOthersChanged(previous, current);
|
122
|
+
updates.localAudioUnmuteRequestedByServer = SelfUtils.localAudioUnmuteRequestedByServer(previous, current);
|
123
|
+
updates.localAudioUnmuteRequiredByServer = SelfUtils.localAudioUnmuteRequiredByServer(previous, current);
|
124
|
+
updates.moderatorChanged = SelfUtils.moderatorChanged(previous, current);
|
125
|
+
updates.isRolesChanged = SelfUtils.isRolesChanged(previous, current);
|
126
|
+
updates.isMediaInactiveOrReleased = SelfUtils.wasMediaInactiveOrReleased(previous, current);
|
127
|
+
updates.isUserObserving = SelfUtils.isDeviceObserving(previous, current);
|
128
|
+
updates.layoutChanged = SelfUtils.layoutChanged(previous, current);
|
129
|
+
updates.isMediaInactive = SelfUtils.isMediaInactive(previous, current);
|
130
|
+
updates.audioStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.audio) !== current.currentMediaStatus.audio;
|
131
|
+
updates.videoStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.video) !== current.currentMediaStatus.video;
|
132
|
+
updates.shareStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.share) !== current.currentMediaStatus.share;
|
133
|
+
updates.canNotViewTheParticipantListChanged = (previous === null || previous === void 0 ? void 0 : previous.canNotViewTheParticipantList) !== current.canNotViewTheParticipantList;
|
134
|
+
updates.isSharingBlockedChanged = (previous === null || previous === void 0 ? void 0 : previous.isSharingBlocked) !== current.isSharingBlocked;
|
135
|
+
updates.breakoutsChanged = SelfUtils.breakoutsChanged(previous, current);
|
136
|
+
updates.interpretationChanged = SelfUtils.interpretationChanged(previous, current);
|
137
|
+
updates.brbChanged = SelfUtils.brbChanged(previous, current);
|
33
138
|
return {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
localAudioUnmuteRequested: SelfUtils.getLocalAudioUnmuteRequested(self),
|
38
|
-
localAudioUnmuteRequestedTimeStamp: SelfUtils.getLocalAudioUnmuteRequestedTimeStamp(self),
|
39
|
-
localAudioUnmuteRequired: SelfUtils.getLocalAudioUnmuteRequired(self),
|
40
|
-
lastModified: SelfUtils.getLastModified(self),
|
41
|
-
modifiedBy: SelfUtils.getModifiedBy(self),
|
42
|
-
guest: self.guest,
|
43
|
-
moderator: self.moderator,
|
44
|
-
// cumulative media stats
|
45
|
-
mediaStatus: SelfUtils.getStatus(self.status),
|
46
|
-
// TODO: what should be the status if user has refreshed the page,
|
47
|
-
// check the joinedWith parameter and communicate to the user
|
48
|
-
state: self.state,
|
49
|
-
// TODO: give a proper name . With same device as login or different login`
|
50
|
-
// Some times we might have joined with both mobile and web
|
51
|
-
joinedWith: joinedWith,
|
52
|
-
pstnDevices: pstnDevices,
|
53
|
-
// current media stats is for the current device who has joined
|
54
|
-
currentMediaStatus: SelfUtils.getMediaStatus(joinedWith === null || joinedWith === void 0 ? void 0 : joinedWith.mediaSessions),
|
55
|
-
creator: self.isCreator,
|
56
|
-
// check if its used,
|
57
|
-
selfId: self.id,
|
58
|
-
selfIdentity: SelfUtils.getSelfIdentity(self),
|
59
|
-
selfUrl: self.url,
|
60
|
-
removed: self.removed,
|
61
|
-
roles: SelfUtils.getRoles(self),
|
62
|
-
isUserUnadmitted: self.state === _constants._IDLE_ && (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent = joinedWith.intent) === null || _joinedWith$intent === void 0 ? void 0 : _joinedWith$intent.type) === _constants._WAIT_,
|
63
|
-
layout: SelfUtils.getLayout(self),
|
64
|
-
canNotViewTheParticipantList: SelfUtils.canNotViewTheParticipantList(self),
|
65
|
-
isSharingBlocked: SelfUtils.isSharingBlocked(self),
|
66
|
-
breakoutSessions: SelfUtils.getBreakoutSessions(self),
|
67
|
-
breakout: SelfUtils.getBreakout(self),
|
68
|
-
interpretation: SelfUtils.getInterpretation(self),
|
69
|
-
brb: SelfUtils.getBrb(self)
|
139
|
+
previous: previous,
|
140
|
+
current: current,
|
141
|
+
updates: updates
|
70
142
|
};
|
71
|
-
}
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
}
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
143
|
+
},
|
144
|
+
/**
|
145
|
+
* Checks if user has joined the meeting
|
146
|
+
* @param {Object} self
|
147
|
+
* @returns {boolean} isJoined
|
148
|
+
*/
|
149
|
+
isJoined: function isJoined(self) {
|
150
|
+
return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
|
151
|
+
},
|
152
|
+
/**
|
153
|
+
* Validate if the Meeting Layout Controls Layout has changed.
|
154
|
+
*
|
155
|
+
* @param {Self} previous - Previous self state
|
156
|
+
* @param {Self} current - Current self state [per event]
|
157
|
+
* @returns {boolean} - If the Meeting Layout Controls Layout has changed.
|
158
|
+
*/
|
159
|
+
layoutChanged: function layoutChanged(previous, current) {
|
160
|
+
return (current === null || current === void 0 ? void 0 : current.layout) && (previous === null || previous === void 0 ? void 0 : previous.layout) !== (current === null || current === void 0 ? void 0 : current.layout);
|
161
|
+
},
|
162
|
+
breakoutsChanged: function breakoutsChanged(previous, current) {
|
163
|
+
return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.breakoutSessions, current === null || current === void 0 ? void 0 : current.breakoutSessions) && !!(current !== null && current !== void 0 && current.breakout);
|
164
|
+
},
|
165
|
+
interpretationChanged: function interpretationChanged(previous, current) {
|
166
|
+
return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.interpretation, current === null || current === void 0 ? void 0 : current.interpretation) && !!(current !== null && current !== void 0 && current.interpretation);
|
167
|
+
},
|
168
|
+
brbChanged: function brbChanged(previous, current) {
|
169
|
+
return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.brb, current === null || current === void 0 ? void 0 : current.brb) && (current === null || current === void 0 ? void 0 : current.brb) !== undefined;
|
170
|
+
},
|
171
|
+
isMediaInactive: function isMediaInactive(previous, current) {
|
172
|
+
if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
|
173
|
+
var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
|
174
|
+
var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
|
175
|
+
if (previousMediaStatus.audio && currentMediaStatus.audio && previousMediaStatus.audio.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.direction !== _constants.MEDIA_STATE.inactive) {
|
176
|
+
return true;
|
177
|
+
}
|
178
|
+
if (previousMediaStatus.video && currentMediaStatus.video && previousMediaStatus.video.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.video.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.video.direction !== _constants.MEDIA_STATE.inactive) {
|
179
|
+
return true;
|
180
|
+
}
|
181
|
+
if (previousMediaStatus.share && currentMediaStatus.share && previousMediaStatus.share.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.share.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.share.direction !== _constants.MEDIA_STATE.inactive) {
|
182
|
+
return true;
|
183
|
+
}
|
184
|
+
return false;
|
99
185
|
}
|
100
|
-
return
|
101
|
-
},
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
};
|
106
|
-
SelfUtils.isSharingBlocked = function (self) {
|
107
|
-
return !!(self !== null && self !== void 0 && self.isSharingBlocked);
|
108
|
-
};
|
109
|
-
SelfUtils.getSelves = function (oldSelf, newSelf, deviceId) {
|
110
|
-
var previous = oldSelf && SelfUtils.parse(oldSelf, deviceId);
|
111
|
-
var current = newSelf && SelfUtils.parse(newSelf, deviceId);
|
112
|
-
var updates = {};
|
113
|
-
updates.isUserUnadmitted = SelfUtils.isUserUnadmitted(previous, current);
|
114
|
-
updates.isUserAdmitted = SelfUtils.isUserAdmitted(previous, current);
|
115
|
-
updates.isVideoMutedByOthersChanged = SelfUtils.videoMutedByOthersChanged(previous, current);
|
116
|
-
updates.isMutedByOthersChanged = SelfUtils.mutedByOthersChanged(previous, current);
|
117
|
-
updates.localAudioUnmuteRequestedByServer = SelfUtils.localAudioUnmuteRequestedByServer(previous, current);
|
118
|
-
updates.localAudioUnmuteRequiredByServer = SelfUtils.localAudioUnmuteRequiredByServer(previous, current);
|
119
|
-
updates.moderatorChanged = SelfUtils.moderatorChanged(previous, current);
|
120
|
-
updates.isRolesChanged = SelfUtils.isRolesChanged(previous, current);
|
121
|
-
updates.isMediaInactiveOrReleased = SelfUtils.wasMediaInactiveOrReleased(previous, current);
|
122
|
-
updates.isUserObserving = SelfUtils.isDeviceObserving(previous, current);
|
123
|
-
updates.layoutChanged = SelfUtils.layoutChanged(previous, current);
|
124
|
-
updates.isMediaInactive = SelfUtils.isMediaInactive(previous, current);
|
125
|
-
updates.audioStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.audio) !== current.currentMediaStatus.audio;
|
126
|
-
updates.videoStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.video) !== current.currentMediaStatus.video;
|
127
|
-
updates.shareStateChange = (previous === null || previous === void 0 ? void 0 : previous.currentMediaStatus.share) !== current.currentMediaStatus.share;
|
128
|
-
updates.canNotViewTheParticipantListChanged = (previous === null || previous === void 0 ? void 0 : previous.canNotViewTheParticipantList) !== current.canNotViewTheParticipantList;
|
129
|
-
updates.isSharingBlockedChanged = (previous === null || previous === void 0 ? void 0 : previous.isSharingBlocked) !== current.isSharingBlocked;
|
130
|
-
updates.breakoutsChanged = SelfUtils.breakoutsChanged(previous, current);
|
131
|
-
updates.interpretationChanged = SelfUtils.interpretationChanged(previous, current);
|
132
|
-
updates.brbChanged = SelfUtils.brbChanged(previous, current);
|
133
|
-
return {
|
134
|
-
previous: previous,
|
135
|
-
current: current,
|
136
|
-
updates: updates
|
137
|
-
};
|
138
|
-
};
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Checks if user has joined the meeting
|
142
|
-
* @param {Object} self
|
143
|
-
* @returns {boolean} isJoined
|
144
|
-
*/
|
145
|
-
SelfUtils.isJoined = function (self) {
|
146
|
-
return (self === null || self === void 0 ? void 0 : self.state) === _constants._JOINED_;
|
147
|
-
};
|
148
|
-
|
149
|
-
/**
|
150
|
-
* Validate if the Meeting Layout Controls Layout has changed.
|
151
|
-
*
|
152
|
-
* @param {Self} previous - Previous self state
|
153
|
-
* @param {Self} current - Current self state [per event]
|
154
|
-
* @returns {boolean} - If the Meeting Layout Controls Layout has changed.
|
155
|
-
*/
|
156
|
-
SelfUtils.layoutChanged = function (previous, current) {
|
157
|
-
return (current === null || current === void 0 ? void 0 : current.layout) && (previous === null || previous === void 0 ? void 0 : previous.layout) !== (current === null || current === void 0 ? void 0 : current.layout);
|
158
|
-
};
|
159
|
-
SelfUtils.breakoutsChanged = function (previous, current) {
|
160
|
-
return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.breakoutSessions, current === null || current === void 0 ? void 0 : current.breakoutSessions) && !!(current !== null && current !== void 0 && current.breakout);
|
161
|
-
};
|
162
|
-
SelfUtils.interpretationChanged = function (previous, current) {
|
163
|
-
return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.interpretation, current === null || current === void 0 ? void 0 : current.interpretation) && !!(current !== null && current !== void 0 && current.interpretation);
|
164
|
-
};
|
165
|
-
SelfUtils.brbChanged = function (previous, current) {
|
166
|
-
return !(0, _lodash.isEqual)(previous === null || previous === void 0 ? void 0 : previous.brb, current === null || current === void 0 ? void 0 : current.brb) && (current === null || current === void 0 ? void 0 : current.brb) !== undefined;
|
167
|
-
};
|
168
|
-
SelfUtils.isMediaInactive = function (previous, current) {
|
169
|
-
if (previous && previous.joinedWith && previous.joinedWith.mediaSessions && current && current.joinedWith && current.joinedWith.mediaSessions) {
|
170
|
-
var previousMediaStatus = SelfUtils.getMediaStatus(previous.joinedWith.mediaSessions);
|
171
|
-
var currentMediaStatus = SelfUtils.getMediaStatus(current.joinedWith.mediaSessions);
|
172
|
-
if (previousMediaStatus.audio && currentMediaStatus.audio && previousMediaStatus.audio.state !== _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.state === _constants.MEDIA_STATE.inactive && currentMediaStatus.audio.direction !== _constants.MEDIA_STATE.inactive) {
|
173
|
-
return true;
|
186
|
+
return false;
|
187
|
+
},
|
188
|
+
getLastModified: function getLastModified(self) {
|
189
|
+
if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
|
190
|
+
return null;
|
174
191
|
}
|
175
|
-
|
176
|
-
|
192
|
+
return self.controls.audio.meta.lastModified;
|
193
|
+
},
|
194
|
+
getModifiedBy: function getModifiedBy(self) {
|
195
|
+
if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
|
196
|
+
return null;
|
197
|
+
}
|
198
|
+
return self.controls.audio.meta.modifiedBy;
|
199
|
+
},
|
200
|
+
/**
|
201
|
+
* get the id from the self object
|
202
|
+
* @param {Object} self
|
203
|
+
* @returns {String}
|
204
|
+
*/
|
205
|
+
getSelfIdentity: function getSelfIdentity(self) {
|
206
|
+
if (!self || !self.person) {
|
207
|
+
return null;
|
208
|
+
}
|
209
|
+
return self.person.id;
|
210
|
+
},
|
211
|
+
/**
|
212
|
+
* get the "remote video mute" property from the self object
|
213
|
+
* @param {Object} self
|
214
|
+
* @returns {Boolean}
|
215
|
+
*/
|
216
|
+
getRemoteVideoMuted: function getRemoteVideoMuted(self) {
|
217
|
+
if (!self || !self.controls || !self.controls.video) {
|
218
|
+
return null;
|
177
219
|
}
|
178
|
-
|
220
|
+
return self.controls.video.muted;
|
221
|
+
},
|
222
|
+
/**
|
223
|
+
* get the "remote mute" property from the self object
|
224
|
+
* @param {Object} self
|
225
|
+
* @returns {Boolean}
|
226
|
+
*/
|
227
|
+
getRemoteMuted: function getRemoteMuted(self) {
|
228
|
+
if (!self || !self.controls || !self.controls.audio) {
|
229
|
+
return null;
|
230
|
+
}
|
231
|
+
return self.controls.audio.muted;
|
232
|
+
},
|
233
|
+
getLocalAudioUnmuteRequested: function getLocalAudioUnmuteRequested(self) {
|
234
|
+
var _self$controls7, _self$controls7$audio;
|
235
|
+
return !!(self !== null && self !== void 0 && (_self$controls7 = self.controls) !== null && _self$controls7 !== void 0 && (_self$controls7$audio = _self$controls7.audio) !== null && _self$controls7$audio !== void 0 && _self$controls7$audio.requestedToUnmute);
|
236
|
+
},
|
237
|
+
// requestedToUnmute timestamp
|
238
|
+
getLocalAudioUnmuteRequestedTimeStamp: function getLocalAudioUnmuteRequestedTimeStamp(self) {
|
239
|
+
var _self$controls8, _self$controls8$audio;
|
240
|
+
return Date.parse(self === null || self === void 0 ? void 0 : (_self$controls8 = self.controls) === null || _self$controls8 === void 0 ? void 0 : (_self$controls8$audio = _self$controls8.audio) === null || _self$controls8$audio === void 0 ? void 0 : _self$controls8$audio.lastModifiedRequestedToUnmute) || 0;
|
241
|
+
},
|
242
|
+
getUnmuteAllowed: function getUnmuteAllowed(self) {
|
243
|
+
if (!self || !self.controls || !self.controls.audio) {
|
244
|
+
return null;
|
245
|
+
}
|
246
|
+
return !self.controls.audio.disallowUnmute;
|
247
|
+
},
|
248
|
+
getLocalAudioUnmuteRequired: function getLocalAudioUnmuteRequired(self) {
|
249
|
+
var _self$controls9, _self$controls9$audio;
|
250
|
+
return !!(self !== null && self !== void 0 && (_self$controls9 = self.controls) !== null && _self$controls9 !== void 0 && (_self$controls9$audio = _self$controls9.audio) !== null && _self$controls9$audio !== void 0 && _self$controls9$audio.localAudioUnmuteRequired);
|
251
|
+
},
|
252
|
+
getStatus: function getStatus(status) {
|
253
|
+
return {
|
254
|
+
audio: status.audioStatus,
|
255
|
+
video: status.videoStatus,
|
256
|
+
slides: status.videoSlidesStatus
|
257
|
+
};
|
258
|
+
},
|
259
|
+
/**
|
260
|
+
* @param {Object} oldSelf
|
261
|
+
* @param {Object} changedSelf
|
262
|
+
* @returns {Boolean}
|
263
|
+
*/
|
264
|
+
wasMediaInactiveOrReleased: function wasMediaInactiveOrReleased() {
|
265
|
+
var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
266
|
+
var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
|
267
|
+
return oldSelf.joinedWith && oldSelf.joinedWith.state === _constants._JOINED_ && changedSelf.joinedWith && changedSelf.joinedWith.state === _constants._LEFT_ && (changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.INACTIVE || changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.MEDIA_RELEASED);
|
268
|
+
},
|
269
|
+
/**
|
270
|
+
* @param {String | undefined} state meeting state
|
271
|
+
* @param {any} joinedWith device that user has joined with
|
272
|
+
* @param {any} pairedWith device that user is paired with
|
273
|
+
* @returns {Boolean | undefined} true if user is in lobby, false if not, undefined if it cannot be determined
|
274
|
+
*/
|
275
|
+
isLocusUserUnadmitted: function isLocusUserUnadmitted(state, joinedWith, pairedWith) {
|
276
|
+
var _joinedWith$intent3, _joinedWith$intent4;
|
277
|
+
if (state === undefined) {
|
278
|
+
return undefined;
|
279
|
+
}
|
280
|
+
if ((joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent3 = joinedWith.intent) === null || _joinedWith$intent3 === void 0 ? void 0 : _joinedWith$intent3.type) === _constants._OBSERVE_ && pairedWith) {
|
281
|
+
var _pairedWith$intent;
|
282
|
+
// we are paired with a device, so need to check the lobby state for that device
|
283
|
+
return ((_pairedWith$intent = pairedWith.intent) === null || _pairedWith$intent === void 0 ? void 0 : _pairedWith$intent.type) === _constants._WAIT_ && state === _constants._IDLE_;
|
284
|
+
}
|
285
|
+
return (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent4 = joinedWith.intent) === null || _joinedWith$intent4 === void 0 ? void 0 : _joinedWith$intent4.type) === _constants._WAIT_ && state === _constants._IDLE_;
|
286
|
+
},
|
287
|
+
/**
|
288
|
+
* @param {String | undefined} state meeting state
|
289
|
+
* @param {any} joinedWith device that user has joined with
|
290
|
+
* @param {any} pairedWith device that user is paired with
|
291
|
+
* @returns {Boolean}
|
292
|
+
*/
|
293
|
+
isLocusUserAdmitted: function isLocusUserAdmitted(state, joinedWith, pairedWith) {
|
294
|
+
var _joinedWith$intent5, _joinedWith$intent6;
|
295
|
+
if (state === undefined) {
|
296
|
+
return undefined;
|
297
|
+
}
|
298
|
+
if ((joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent5 = joinedWith.intent) === null || _joinedWith$intent5 === void 0 ? void 0 : _joinedWith$intent5.type) === _constants._OBSERVE_ && pairedWith) {
|
299
|
+
var _pairedWith$intent2;
|
300
|
+
// we are paired with a device, so need to check the lobby state for that device
|
301
|
+
return ((_pairedWith$intent2 = pairedWith.intent) === null || _pairedWith$intent2 === void 0 ? void 0 : _pairedWith$intent2.type) !== _constants._WAIT_ && state === _constants._JOINED_;
|
302
|
+
}
|
303
|
+
return (joinedWith === null || joinedWith === void 0 ? void 0 : (_joinedWith$intent6 = joinedWith.intent) === null || _joinedWith$intent6 === void 0 ? void 0 : _joinedWith$intent6.type) !== _constants._WAIT_ && state === _constants._JOINED_;
|
304
|
+
},
|
305
|
+
/**
|
306
|
+
* @param {Object} oldSelf
|
307
|
+
* @param {Object} changedSelf
|
308
|
+
* @returns {Boolean} true if user has just been placed in the lobby
|
309
|
+
* @throws {Error} when self is undefined
|
310
|
+
*/
|
311
|
+
hasUserEnteredLobby: function hasUserEnteredLobby(oldSelf, changedSelf) {
|
312
|
+
if (!changedSelf) {
|
313
|
+
throw new _parameter.default('changedSelf must be defined to determine if self is unadmitted as guest.');
|
314
|
+
}
|
315
|
+
var wasInLobby = SelfUtils.isLocusUserUnadmitted(oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.state, oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.joinedWith, oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.pairedWith);
|
316
|
+
var isInLobby = SelfUtils.isLocusUserUnadmitted(changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.state, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.joinedWith, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.pairedWith);
|
317
|
+
return !wasInLobby && isInLobby;
|
318
|
+
},
|
319
|
+
moderatorChanged: function moderatorChanged(oldSelf, changedSelf) {
|
320
|
+
if (!oldSelf) {
|
179
321
|
return true;
|
180
322
|
}
|
181
|
-
|
182
|
-
|
183
|
-
return false;
|
184
|
-
};
|
185
|
-
SelfUtils.getLastModified = function (self) {
|
186
|
-
if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.lastModified) {
|
187
|
-
return null;
|
188
|
-
}
|
189
|
-
return self.controls.audio.meta.lastModified;
|
190
|
-
};
|
191
|
-
SelfUtils.getModifiedBy = function (self) {
|
192
|
-
if (!self || !self.controls || !self.controls.audio || !self.controls.audio.meta || !self.controls.audio.meta.modifiedBy) {
|
193
|
-
return null;
|
194
|
-
}
|
195
|
-
return self.controls.audio.meta.modifiedBy;
|
196
|
-
};
|
197
|
-
|
198
|
-
/**
|
199
|
-
* get the id from the self object
|
200
|
-
* @param {Object} self
|
201
|
-
* @returns {String}
|
202
|
-
*/
|
203
|
-
SelfUtils.getSelfIdentity = function (self) {
|
204
|
-
if (!self && !self.person) {
|
205
|
-
return null;
|
206
|
-
}
|
207
|
-
return self.person.id;
|
208
|
-
};
|
209
|
-
|
210
|
-
/**
|
211
|
-
* get the "remote video mute" property from the self object
|
212
|
-
* @param {Object} self
|
213
|
-
* @returns {Boolean}
|
214
|
-
*/
|
215
|
-
SelfUtils.getRemoteVideoMuted = function (self) {
|
216
|
-
if (!self || !self.controls || !self.controls.video) {
|
217
|
-
return null;
|
218
|
-
}
|
219
|
-
return self.controls.video.muted;
|
220
|
-
};
|
221
|
-
|
222
|
-
/**
|
223
|
-
* get the "remote mute" property from the self object
|
224
|
-
* @param {Object} self
|
225
|
-
* @returns {Boolean}
|
226
|
-
*/
|
227
|
-
SelfUtils.getRemoteMuted = function (self) {
|
228
|
-
if (!self || !self.controls || !self.controls.audio) {
|
229
|
-
return null;
|
230
|
-
}
|
231
|
-
return self.controls.audio.muted;
|
232
|
-
};
|
233
|
-
SelfUtils.getLocalAudioUnmuteRequested = function (self) {
|
234
|
-
var _self$controls7, _self$controls7$audio;
|
235
|
-
return !!(self !== null && self !== void 0 && (_self$controls7 = self.controls) !== null && _self$controls7 !== void 0 && (_self$controls7$audio = _self$controls7.audio) !== null && _self$controls7$audio !== void 0 && _self$controls7$audio.requestedToUnmute);
|
236
|
-
};
|
237
|
-
|
238
|
-
// requestedToUnmute timestamp
|
239
|
-
SelfUtils.getLocalAudioUnmuteRequestedTimeStamp = function (self) {
|
240
|
-
var _self$controls8, _self$controls8$audio;
|
241
|
-
return Date.parse(self === null || self === void 0 ? void 0 : (_self$controls8 = self.controls) === null || _self$controls8 === void 0 ? void 0 : (_self$controls8$audio = _self$controls8.audio) === null || _self$controls8$audio === void 0 ? void 0 : _self$controls8$audio.lastModifiedRequestedToUnmute) || 0;
|
242
|
-
};
|
243
|
-
SelfUtils.getUnmuteAllowed = function (self) {
|
244
|
-
if (!self || !self.controls || !self.controls.audio) {
|
245
|
-
return null;
|
246
|
-
}
|
247
|
-
return !self.controls.audio.disallowUnmute;
|
248
|
-
};
|
249
|
-
SelfUtils.getLocalAudioUnmuteRequired = function (self) {
|
250
|
-
var _self$controls9, _self$controls9$audio;
|
251
|
-
return !!(self !== null && self !== void 0 && (_self$controls9 = self.controls) !== null && _self$controls9 !== void 0 && (_self$controls9$audio = _self$controls9.audio) !== null && _self$controls9$audio !== void 0 && _self$controls9$audio.localAudioUnmuteRequired);
|
252
|
-
};
|
253
|
-
SelfUtils.getStatus = function (status) {
|
254
|
-
return {
|
255
|
-
audio: status.audioStatus,
|
256
|
-
video: status.videoStatus,
|
257
|
-
slides: status.videoSlidesStatus
|
258
|
-
};
|
259
|
-
};
|
260
|
-
|
261
|
-
/**
|
262
|
-
* @param {Object} oldSelf
|
263
|
-
* @param {Object} changedSelf
|
264
|
-
* @returns {Boolean}
|
265
|
-
*/
|
266
|
-
SelfUtils.wasMediaInactiveOrReleased = function () {
|
267
|
-
var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
268
|
-
var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
|
269
|
-
return oldSelf.joinedWith && oldSelf.joinedWith.state === _constants._JOINED_ && changedSelf.joinedWith && changedSelf.joinedWith.state === _constants._LEFT_ && (changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.INACTIVE || changedSelf.joinedWith.reason === _constants.MEETING_END_REASON.MEDIA_RELEASED);
|
270
|
-
};
|
271
|
-
|
272
|
-
/**
|
273
|
-
* @param {Object} check
|
274
|
-
* @returns {Boolean}
|
275
|
-
*/
|
276
|
-
SelfUtils.isLocusUserUnadmitted = function (check) {
|
277
|
-
var _check$joinedWith, _check$joinedWith$int;
|
278
|
-
return check && ((_check$joinedWith = check.joinedWith) === null || _check$joinedWith === void 0 ? void 0 : (_check$joinedWith$int = _check$joinedWith.intent) === null || _check$joinedWith$int === void 0 ? void 0 : _check$joinedWith$int.type) === _constants._WAIT_ && check.state === _constants._IDLE_;
|
279
|
-
};
|
280
|
-
|
281
|
-
/**
|
282
|
-
* @param {Object} check
|
283
|
-
* @returns {Boolean}
|
284
|
-
*/
|
285
|
-
SelfUtils.isLocusUserAdmitted = function (check) {
|
286
|
-
var _check$joinedWith2, _check$joinedWith2$in;
|
287
|
-
return check && ((_check$joinedWith2 = check.joinedWith) === null || _check$joinedWith2 === void 0 ? void 0 : (_check$joinedWith2$in = _check$joinedWith2.intent) === null || _check$joinedWith2$in === void 0 ? void 0 : _check$joinedWith2$in.type) !== _constants._WAIT_ && check.state === _constants._JOINED_;
|
288
|
-
};
|
289
|
-
|
290
|
-
/**
|
291
|
-
* @param {Object} oldSelf
|
292
|
-
* @param {Object} changedSelf
|
293
|
-
* @returns {Boolean}
|
294
|
-
* @throws {Error} when self is undefined
|
295
|
-
*/
|
296
|
-
SelfUtils.isUserUnadmitted = function (oldSelf, changedSelf) {
|
297
|
-
if (!changedSelf) {
|
298
|
-
throw new _parameter.default('changedSelf must be defined to determine if self is unadmitted as guest.');
|
299
|
-
}
|
300
|
-
if (SelfUtils.isLocusUserUnadmitted(oldSelf)) {
|
301
|
-
return false;
|
302
|
-
}
|
303
|
-
return SelfUtils.isLocusUserUnadmitted(changedSelf);
|
304
|
-
};
|
305
|
-
SelfUtils.moderatorChanged = function (oldSelf, changedSelf) {
|
306
|
-
if (!oldSelf) {
|
307
|
-
return true;
|
308
|
-
}
|
309
|
-
if (!changedSelf) {
|
310
|
-
throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
|
311
|
-
}
|
312
|
-
return oldSelf.moderator !== changedSelf.moderator;
|
313
|
-
};
|
314
|
-
|
315
|
-
/**
|
316
|
-
* determine whether the roles of self is changed or not
|
317
|
-
* @param {Object} oldSelf
|
318
|
-
* @param {Object} changedSelf
|
319
|
-
* @returns {Boolean}
|
320
|
-
*/
|
321
|
-
SelfUtils.isRolesChanged = function (oldSelf, changedSelf) {
|
322
|
-
if (!changedSelf) {
|
323
|
-
// no new self means no change
|
324
|
-
return false;
|
325
|
-
}
|
326
|
-
return !(0, _lodash.isEqual)(oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.roles, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.roles);
|
327
|
-
};
|
328
|
-
/**
|
329
|
-
* @param {Object} oldSelf
|
330
|
-
* @param {Object} changedSelf
|
331
|
-
* @returns {Boolean}
|
332
|
-
* @throws {Error} if changed self was undefined
|
333
|
-
*/
|
334
|
-
SelfUtils.isDeviceObserving = function (oldSelf, changedSelf) {
|
335
|
-
var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
|
336
|
-
return oldSelf && ((_oldSelf$joinedWith = oldSelf.joinedWith) === null || _oldSelf$joinedWith === void 0 ? void 0 : (_oldSelf$joinedWith$i = _oldSelf$joinedWith.intent) === null || _oldSelf$joinedWith$i === void 0 ? void 0 : _oldSelf$joinedWith$i.type) === _constants._MOVE_MEDIA_ && changedSelf && ((_changedSelf$joinedWi = changedSelf.joinedWith) === null || _changedSelf$joinedWi === void 0 ? void 0 : (_changedSelf$joinedWi2 = _changedSelf$joinedWi.intent) === null || _changedSelf$joinedWi2 === void 0 ? void 0 : _changedSelf$joinedWi2.type) === _constants._OBSERVE_;
|
337
|
-
};
|
338
|
-
|
339
|
-
/**
|
340
|
-
* @param {Object} oldSelf
|
341
|
-
* @param {Object} changedSelf
|
342
|
-
* @returns {Boolean}
|
343
|
-
* @throws {Error} if changed self was undefined
|
344
|
-
*/
|
345
|
-
SelfUtils.isUserAdmitted = function (oldSelf, changedSelf) {
|
346
|
-
if (!oldSelf) {
|
347
|
-
// if there was no previous locus, it couldn't have been admitted yet
|
348
|
-
return false;
|
349
|
-
}
|
350
|
-
if (!changedSelf) {
|
351
|
-
throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
|
352
|
-
}
|
353
|
-
return SelfUtils.isLocusUserUnadmitted(oldSelf) && SelfUtils.isLocusUserAdmitted(changedSelf);
|
354
|
-
};
|
355
|
-
SelfUtils.videoMutedByOthersChanged = function (oldSelf, changedSelf) {
|
356
|
-
if (!changedSelf) {
|
357
|
-
throw new _parameter.default('New self must be defined to determine if self was video muted by others.');
|
358
|
-
}
|
359
|
-
if (!oldSelf || oldSelf.remoteVideoMuted === null) {
|
360
|
-
if (changedSelf.remoteVideoMuted) {
|
361
|
-
return true; // this happens when host disables "Allow start video"
|
323
|
+
if (!changedSelf) {
|
324
|
+
throw new _parameter.default('New self must be defined to determine if self transitioned moderator status.');
|
362
325
|
}
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
}
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
return true; // this happens when mute on-entry is enabled
|
326
|
+
return oldSelf.moderator !== changedSelf.moderator;
|
327
|
+
},
|
328
|
+
/**
|
329
|
+
* determine whether the roles of self is changed or not
|
330
|
+
* @param {Object} oldSelf
|
331
|
+
* @param {Object} changedSelf
|
332
|
+
* @returns {Boolean}
|
333
|
+
*/
|
334
|
+
isRolesChanged: function isRolesChanged(oldSelf, changedSelf) {
|
335
|
+
if (!changedSelf) {
|
336
|
+
// no new self means no change
|
337
|
+
return false;
|
376
338
|
}
|
339
|
+
return !(0, _lodash.isEqual)(oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.roles, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.roles);
|
340
|
+
},
|
341
|
+
/**
|
342
|
+
* @param {Object} oldSelf
|
343
|
+
* @param {Object} changedSelf
|
344
|
+
* @returns {Boolean}
|
345
|
+
* @throws {Error} if changed self was undefined
|
346
|
+
*/
|
347
|
+
isDeviceObserving: function isDeviceObserving(oldSelf, changedSelf) {
|
348
|
+
var _oldSelf$joinedWith, _oldSelf$joinedWith$i, _changedSelf$joinedWi, _changedSelf$joinedWi2;
|
349
|
+
return oldSelf && ((_oldSelf$joinedWith = oldSelf.joinedWith) === null || _oldSelf$joinedWith === void 0 ? void 0 : (_oldSelf$joinedWith$i = _oldSelf$joinedWith.intent) === null || _oldSelf$joinedWith$i === void 0 ? void 0 : _oldSelf$joinedWith$i.type) === _constants._MOVE_MEDIA_ && changedSelf && ((_changedSelf$joinedWi = changedSelf.joinedWith) === null || _changedSelf$joinedWi === void 0 ? void 0 : (_changedSelf$joinedWi2 = _changedSelf$joinedWi.intent) === null || _changedSelf$joinedWi2 === void 0 ? void 0 : _changedSelf$joinedWi2.type) === _constants._OBSERVE_;
|
350
|
+
},
|
351
|
+
/**
|
352
|
+
* @param {Object} oldSelf
|
353
|
+
* @param {Object} changedSelf
|
354
|
+
* @returns {Boolean} true if the user has just been admitted from lobby into the meeting
|
355
|
+
* @throws {Error} if changed self was undefined
|
356
|
+
*/
|
357
|
+
hasUserBeenAdmitted: function hasUserBeenAdmitted(oldSelf, changedSelf) {
|
358
|
+
if (!oldSelf) {
|
359
|
+
// if there was no previous locus, it couldn't have been admitted yet
|
360
|
+
return false;
|
361
|
+
}
|
362
|
+
if (!changedSelf) {
|
363
|
+
throw new _parameter.default('New self must be defined to determine if self transitioned to admitted as guest.');
|
364
|
+
}
|
365
|
+
var wasInLobby = SelfUtils.isLocusUserUnadmitted(oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.state, oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.joinedWith, oldSelf === null || oldSelf === void 0 ? void 0 : oldSelf.pairedWith);
|
366
|
+
var isAdmitted = SelfUtils.isLocusUserAdmitted(changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.state, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.joinedWith, changedSelf === null || changedSelf === void 0 ? void 0 : changedSelf.pairedWith);
|
367
|
+
return wasInLobby && isAdmitted && isAdmitted !== undefined;
|
368
|
+
},
|
369
|
+
videoMutedByOthersChanged: function videoMutedByOthersChanged(oldSelf, changedSelf) {
|
370
|
+
if (!changedSelf) {
|
371
|
+
throw new _parameter.default('New self must be defined to determine if self was video muted by others.');
|
372
|
+
}
|
373
|
+
if (!oldSelf || oldSelf.remoteVideoMuted === null) {
|
374
|
+
if (changedSelf.remoteVideoMuted) {
|
375
|
+
return true; // this happens when host disables "Allow start video"
|
376
|
+
}
|
377
377
|
|
378
|
-
|
379
|
-
|
380
|
-
|
378
|
+
// we don't want to be sending the 'meeting:self:videoUnmutedByOthers' notification on meeting join
|
379
|
+
return false;
|
380
|
+
}
|
381
|
+
return oldSelf.remoteVideoMuted !== changedSelf.remoteVideoMuted;
|
382
|
+
},
|
383
|
+
mutedByOthersChanged: function mutedByOthersChanged(oldSelf, changedSelf) {
|
384
|
+
if (!changedSelf) {
|
385
|
+
throw new _parameter.default('New self must be defined to determine if self was muted by others.');
|
386
|
+
}
|
387
|
+
if (!oldSelf || oldSelf.remoteMuted === null) {
|
388
|
+
if (changedSelf.remoteMuted) {
|
389
|
+
return true; // this happens when mute on-entry is enabled
|
390
|
+
}
|
381
391
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
}
|
386
|
-
return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
|
387
|
-
};
|
388
|
-
SelfUtils.localAudioUnmuteRequestedByServer = function () {
|
389
|
-
var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
390
|
-
var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
|
391
|
-
if (!changedSelf) {
|
392
|
-
throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
|
393
|
-
}
|
394
|
-
return changedSelf.localAudioUnmuteRequested && changedSelf.localAudioUnmuteRequestedTimeStamp > oldSelf.localAudioUnmuteRequestedTimeStamp;
|
395
|
-
};
|
396
|
-
SelfUtils.localAudioUnmuteRequiredByServer = function () {
|
397
|
-
var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
398
|
-
var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
|
399
|
-
if (!changedSelf) {
|
400
|
-
throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
|
401
|
-
}
|
402
|
-
return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
|
403
|
-
};
|
392
|
+
// we don't want to be sending the 'meeting:self:unmutedByOthers' notification on meeting join
|
393
|
+
return false;
|
394
|
+
}
|
404
395
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
396
|
+
// there is no need to trigger user update if no one muted user
|
397
|
+
if (changedSelf.selfIdentity === changedSelf.modifiedBy) {
|
398
|
+
return false;
|
399
|
+
}
|
400
|
+
return changedSelf.remoteMuted !== null && (oldSelf.remoteMuted !== changedSelf.remoteMuted || changedSelf.remoteMuted && oldSelf.unmuteAllowed !== changedSelf.unmuteAllowed);
|
401
|
+
},
|
402
|
+
localAudioUnmuteRequestedByServer: function localAudioUnmuteRequestedByServer() {
|
403
|
+
var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
404
|
+
var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
|
405
|
+
if (!changedSelf) {
|
406
|
+
throw new _parameter.default('New self must be defined to determine if self received request to unmute.');
|
407
|
+
}
|
408
|
+
return changedSelf.localAudioUnmuteRequested && changedSelf.localAudioUnmuteRequestedTimeStamp > oldSelf.localAudioUnmuteRequestedTimeStamp;
|
409
|
+
},
|
410
|
+
localAudioUnmuteRequiredByServer: function localAudioUnmuteRequiredByServer() {
|
411
|
+
var oldSelf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
412
|
+
var changedSelf = arguments.length > 1 ? arguments[1] : undefined;
|
413
|
+
if (!changedSelf) {
|
414
|
+
throw new _parameter.default('New self must be defined to determine if localAudioUnmuteRequired changed.');
|
415
|
+
}
|
416
|
+
return !changedSelf.remoteMuted && changedSelf.localAudioUnmuteRequired && oldSelf.localAudioUnmuteRequired !== changedSelf.localAudioUnmuteRequired;
|
417
|
+
},
|
418
|
+
/**
|
419
|
+
* extract the sipUrl from the partner
|
420
|
+
* @param {Object} partner
|
421
|
+
* @param {Object} info
|
422
|
+
* @returns {Object}
|
423
|
+
*/
|
411
424
|
|
412
|
-
|
413
|
-
|
414
|
-
|
425
|
+
getSipUrl: function getSipUrl(partner, type, sipUri) {
|
426
|
+
// For webex meeting the sipUrl gets updated in info parser
|
427
|
+
if (partner && type === _constants._CALL_) {
|
428
|
+
return {
|
429
|
+
sipUri: partner.person.sipUrl || partner.person.id
|
430
|
+
};
|
431
|
+
}
|
415
432
|
return {
|
416
|
-
sipUri:
|
433
|
+
sipUri: sipUri
|
417
434
|
};
|
418
|
-
}
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
}
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
audio
|
427
|
-
|
428
|
-
share: {}
|
429
|
-
};
|
430
|
-
mediaStatus.audio = mediaSessions.find(function (media) {
|
431
|
-
return media.mediaType === _constants.AUDIO && media.mediaContent === _constants.MediaContent.main;
|
432
|
-
});
|
433
|
-
mediaStatus.video = mediaSessions.find(function (media) {
|
434
|
-
return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.main;
|
435
|
-
});
|
436
|
-
mediaStatus.share = mediaSessions.find(function (media) {
|
437
|
-
return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.slides;
|
438
|
-
});
|
439
|
-
return mediaStatus;
|
440
|
-
};
|
441
|
-
SelfUtils.getReplacedBreakoutMoveId = function (self, deviceId) {
|
442
|
-
if (self && (0, _isArray.default)(self.devices)) {
|
443
|
-
var joinedDevice = self.devices.find(function (device) {
|
444
|
-
return deviceId === device.url;
|
435
|
+
},
|
436
|
+
getMediaStatus: function getMediaStatus() {
|
437
|
+
var mediaSessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
438
|
+
var mediaStatus = {
|
439
|
+
audio: {},
|
440
|
+
video: {},
|
441
|
+
share: {}
|
442
|
+
};
|
443
|
+
mediaStatus.audio = mediaSessions.find(function (media) {
|
444
|
+
return media.mediaType === _constants.AUDIO && media.mediaContent === _constants.MediaContent.main;
|
445
445
|
});
|
446
|
-
|
447
|
-
|
448
|
-
|
446
|
+
mediaStatus.video = mediaSessions.find(function (media) {
|
447
|
+
return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.main;
|
448
|
+
});
|
449
|
+
mediaStatus.share = mediaSessions.find(function (media) {
|
450
|
+
return media.mediaType === _constants.VIDEO && media.mediaContent === _constants.MediaContent.slides;
|
451
|
+
});
|
452
|
+
return mediaStatus;
|
453
|
+
},
|
454
|
+
getReplacedBreakoutMoveId: function getReplacedBreakoutMoveId(self, deviceId) {
|
455
|
+
if (self && (0, _isArray.default)(self.devices)) {
|
456
|
+
var joinedDevice = self.devices.find(function (device) {
|
457
|
+
return deviceId === device.url;
|
458
|
+
});
|
459
|
+
if ((0, _isArray.default)(joinedDevice === null || joinedDevice === void 0 ? void 0 : joinedDevice.replaces)) {
|
460
|
+
var _joinedDevice$replace;
|
461
|
+
return (_joinedDevice$replace = joinedDevice.replaces[0]) === null || _joinedDevice$replace === void 0 ? void 0 : _joinedDevice$replace.breakoutMoveId;
|
462
|
+
}
|
449
463
|
}
|
464
|
+
return null;
|
450
465
|
}
|
451
|
-
return null;
|
452
466
|
};
|
453
467
|
var _default = exports.default = SelfUtils;
|
454
468
|
//# sourceMappingURL=selfUtils.js.map
|