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