Преглед изворни кода

ref(TS Convert some files to TS (#12191)

factor2
Robert Pintilii пре 2 година
родитељ
комит
6dd04136de
No account linked to committer's email address

+ 2
- 1
.eslintrc.js Прегледај датотеку

1
 module.exports = {
1
 module.exports = {
2
     'extends': [
2
     'extends': [
3
         '@jitsi/eslint-config'
3
         '@jitsi/eslint-config'
4
-    ]
4
+    ],
5
+    'ignorePatterns': [ '*.d.ts' ]
5
 };
6
 };

+ 6
- 0
globals.d.ts Прегледај датотеку

1
+export {};
2
+
3
+declare global {
4
+    const APP: any;
5
+    const interfaceConfig: any;
6
+}

react/features/base/conference/functions.js → react/features/base/conference/functions.ts Прегледај датотеку

1
-// @flow
2
-
3
 import { sha512_256 as sha512 } from 'js-sha512';
1
 import { sha512_256 as sha512 } from 'js-sha512';
4
 import _ from 'lodash';
2
 import _ from 'lodash';
5
 
3
 
4
+// @ts-ignore
6
 import { getName } from '../../app/functions';
5
 import { getName } from '../../app/functions';
6
+import { IState, IStore } from '../../app/types';
7
 import { determineTranscriptionLanguage } from '../../transcribing/functions';
7
 import { determineTranscriptionLanguage } from '../../transcribing/functions';
8
+import { IStateful } from '../app/types';
8
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
9
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
9
 import {
10
 import {
10
-    getLocalParticipant,
11
     hiddenParticipantJoined,
11
     hiddenParticipantJoined,
12
     hiddenParticipantLeft,
12
     hiddenParticipantLeft,
13
     participantJoined,
13
     participantJoined,
14
     participantLeft
14
     participantLeft
15
-} from '../participants';
16
-import { toState } from '../redux';
17
-import {
18
-    getBackendSafePath,
19
-    getJitsiMeetGlobalNS,
20
-    safeDecodeURIComponent
21
-} from '../util';
15
+} from '../participants/actions';
16
+import { getLocalParticipant } from '../participants/functions';
17
+import { toState } from '../redux/functions';
18
+import { getJitsiMeetGlobalNS } from '../util/helpers';
19
+import { getBackendSafePath, safeDecodeURIComponent } from '../util/uri';
22
 
20
 
21
+// @ts-ignore
23
 import { setObfuscatedRoom } from './actions';
22
 import { setObfuscatedRoom } from './actions';
24
 import {
23
 import {
25
     AVATAR_URL_COMMAND,
24
     AVATAR_URL_COMMAND,
27
     JITSI_CONFERENCE_URL_KEY
26
     JITSI_CONFERENCE_URL_KEY
28
 } from './constants';
27
 } from './constants';
29
 import logger from './logger';
28
 import logger from './logger';
29
+import { IJitsiConference } from './reducer';
30
 
30
 
31
 /**
31
 /**
32
  * Returns root conference state.
32
  * Returns root conference state.
33
  *
33
  *
34
- * @param {Object} state - Global state.
34
+ * @param {IState} state - Global state.
35
  * @returns {Object} Conference state.
35
  * @returns {Object} Conference state.
36
  */
36
  */
37
-export const getConferenceState = (state: Object) => state['features/base/conference'];
37
+export const getConferenceState = (state: IState) => state['features/base/conference'];
38
 
38
 
39
 /**
39
 /**
40
  * Is the conference joined or not.
40
  * Is the conference joined or not.
41
  *
41
  *
42
- * @param {Object} state - Global state.
42
+ * @param {IState} state - Global state.
43
  * @returns {boolean}
43
  * @returns {boolean}
44
  */
44
  */
45
-export const getIsConferenceJoined = (state: Object) => Boolean(getConferenceState(state).conference);
45
+export const getIsConferenceJoined = (state: IState) => Boolean(getConferenceState(state).conference);
46
 
46
 
47
 /**
47
 /**
48
  * Attach a set of local tracks to a conference.
48
  * Attach a set of local tracks to a conference.
53
  * @returns {Promise}
53
  * @returns {Promise}
54
  */
54
  */
55
 export function _addLocalTracksToConference(
55
 export function _addLocalTracksToConference(
56
-        conference: { addTrack: Function, getLocalTracks: Function },
56
+        conference: IJitsiConference,
57
         localTracks: Array<Object>) {
57
         localTracks: Array<Object>) {
58
     const conferenceLocalTracks = conference.getLocalTracks();
58
     const conferenceLocalTracks = conference.getLocalTracks();
59
     const promises = [];
59
     const promises = [];
63
         // adding one and the same video track multiple times.
63
         // adding one and the same video track multiple times.
64
         if (conferenceLocalTracks.indexOf(track) === -1) {
64
         if (conferenceLocalTracks.indexOf(track) === -1) {
65
             promises.push(
65
             promises.push(
66
-                conference.addTrack(track).catch(err => {
66
+                conference.addTrack(track).catch((err: Error) => {
67
                     _reportError(
67
                     _reportError(
68
                         'Failed to add local track to conference',
68
                         'Failed to add local track to conference',
69
                         err);
69
                         err);
86
  * @returns {void}
86
  * @returns {void}
87
  */
87
  */
88
 export function commonUserJoinedHandling(
88
 export function commonUserJoinedHandling(
89
-        { dispatch }: Object,
90
-        conference: Object,
91
-        user: Object) {
89
+        { dispatch }: IStore,
90
+        conference: IJitsiConference,
91
+        user: any) {
92
     const id = user.getId();
92
     const id = user.getId();
93
     const displayName = user.getDisplayName();
93
     const displayName = user.getDisplayName();
94
 
94
 
95
     if (user.isHidden()) {
95
     if (user.isHidden()) {
96
         dispatch(hiddenParticipantJoined(id, displayName));
96
         dispatch(hiddenParticipantJoined(id, displayName));
97
     } else {
97
     } else {
98
-        const isReplacing = user.isReplacing && user.isReplacing();
98
+        const isReplacing = user?.isReplacing();
99
 
99
 
100
         dispatch(participantJoined({
100
         dispatch(participantJoined({
101
             botType: user.getBotType(),
101
             botType: user.getBotType(),
122
  * @returns {void}
122
  * @returns {void}
123
  */
123
  */
124
 export function commonUserLeftHandling(
124
 export function commonUserLeftHandling(
125
-        { dispatch }: Object,
126
-        conference: Object,
127
-        user: Object) {
125
+        { dispatch }: IStore,
126
+        conference: IJitsiConference,
127
+        user: any) {
128
     const id = user.getId();
128
     const id = user.getId();
129
 
129
 
130
     if (user.isHidden()) {
130
     if (user.isHidden()) {
131
         dispatch(hiddenParticipantLeft(id));
131
         dispatch(hiddenParticipantLeft(id));
132
     } else {
132
     } else {
133
-        const isReplaced = user.isReplaced && user.isReplaced();
133
+        const isReplaced = user.isReplaced?.();
134
 
134
 
135
         dispatch(participantLeft(id, conference, { isReplaced }));
135
         dispatch(participantLeft(id, conference, { isReplaced }));
136
     }
136
     }
140
  * Evaluates a specific predicate for each {@link JitsiConference} known to the
140
  * Evaluates a specific predicate for each {@link JitsiConference} known to the
141
  * redux state features/base/conference while it returns {@code true}.
141
  * redux state features/base/conference while it returns {@code true}.
142
  *
142
  *
143
- * @param {Function | Object} stateful - The redux store, state, or
143
+ * @param {IStateful} stateful - The redux store, state, or
144
  * {@code getState} function.
144
  * {@code getState} function.
145
  * @param {Function} predicate - The predicate to evaluate for each
145
  * @param {Function} predicate - The predicate to evaluate for each
146
  * {@code JitsiConference} know to the redux state features/base/conference
146
  * {@code JitsiConference} know to the redux state features/base/conference
150
  * features/base/conference.
150
  * features/base/conference.
151
  */
151
  */
152
 export function forEachConference(
152
 export function forEachConference(
153
-        stateful: Function | Object,
154
-        predicate: (Object, URL) => boolean) {
153
+        stateful: IStateful,
154
+        predicate: (a: any, b: URL) => boolean) {
155
     const state = getConferenceState(toState(stateful));
155
     const state = getConferenceState(toState(stateful));
156
 
156
 
157
     for (const v of Object.values(state)) {
157
     for (const v of Object.values(state)) {
178
 /**
178
 /**
179
  * Returns the display name of the conference.
179
  * Returns the display name of the conference.
180
  *
180
  *
181
- * @param {Function | Object} stateful - Reference that can be resolved to Redux
181
+ * @param {IStateful} stateful - Reference that can be resolved to Redux
182
  * state with the {@code toState} function.
182
  * state with the {@code toState} function.
183
  * @returns {string}
183
  * @returns {string}
184
  */
184
  */
185
-export function getConferenceName(stateful: Function | Object): string {
185
+export function getConferenceName(stateful: IStateful): string {
186
     const state = toState(stateful);
186
     const state = toState(stateful);
187
     const { callee } = state['features/base/jwt'];
187
     const { callee } = state['features/base/jwt'];
188
     const { callDisplayName } = state['features/base/config'];
188
     const { callDisplayName } = state['features/base/config'];
189
     const { localSubject, room, subject } = getConferenceState(state);
189
     const { localSubject, room, subject } = getConferenceState(state);
190
 
190
 
191
-    return localSubject
191
+    return (localSubject
192
         || subject
192
         || subject
193
         || callDisplayName
193
         || callDisplayName
194
-        || (callee && callee.name)
195
-        || (room && safeStartCase(safeDecodeURIComponent(room)));
194
+        || callee?.name
195
+        || (room && safeStartCase(safeDecodeURIComponent(room)))) ?? '';
196
 }
196
 }
197
 
197
 
198
 /**
198
 /**
199
  * Returns the name of the conference formatted for the title.
199
  * Returns the name of the conference formatted for the title.
200
  *
200
  *
201
- * @param {Function | Object} stateful - Reference that can be resolved to Redux state with the {@code toState}
201
+ * @param {IStateful} stateful - Reference that can be resolved to Redux state with the {@code toState}
202
  * function.
202
  * function.
203
  * @returns {string} - The name of the conference formatted for the title.
203
  * @returns {string} - The name of the conference formatted for the title.
204
  */
204
  */
205
-export function getConferenceNameForTitle(stateful: Function | Object) {
206
-    return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room));
205
+export function getConferenceNameForTitle(stateful: IStateful) {
206
+    return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room ?? ''));
207
 }
207
 }
208
 
208
 
209
 /**
209
 /**
210
  * Returns an object aggregating the conference options.
210
  * Returns an object aggregating the conference options.
211
  *
211
  *
212
- * @param {Object|Function} stateful - The redux store state.
212
+ * @param {IStateful} stateful - The redux store state.
213
  * @returns {Object} - Options object.
213
  * @returns {Object} - Options object.
214
  */
214
  */
215
-export function getConferenceOptions(stateful: Function | Object) {
215
+export function getConferenceOptions(stateful: IStateful) {
216
     const state = toState(stateful);
216
     const state = toState(stateful);
217
 
217
 
218
     const config = state['features/base/config'];
218
     const config = state['features/base/config'];
219
     const { locationURL } = state['features/base/connection'];
219
     const { locationURL } = state['features/base/connection'];
220
     const { tenant } = state['features/base/jwt'];
220
     const { tenant } = state['features/base/jwt'];
221
-    const { email, name: nick } = getLocalParticipant(state);
222
-    const options = { ...config };
221
+    const { email, name: nick } = getLocalParticipant(state) ?? {};
222
+    const options: any = { ...config };
223
 
223
 
224
     if (tenant) {
224
     if (tenant) {
225
         options.siteID = tenant;
225
         options.siteID = tenant;
257
 /**
257
 /**
258
 * Returns the UTC timestamp when the first participant joined the conference.
258
 * Returns the UTC timestamp when the first participant joined the conference.
259
 *
259
 *
260
-* @param {Function | Object} stateful - Reference that can be resolved to Redux
260
+* @param {IStateful} stateful - Reference that can be resolved to Redux
261
 * state with the {@code toState} function.
261
 * state with the {@code toState} function.
262
 * @returns {number}
262
 * @returns {number}
263
 */
263
 */
264
-export function getConferenceTimestamp(stateful: Function | Object): number {
264
+export function getConferenceTimestamp(stateful: IStateful) {
265
     const state = toState(stateful);
265
     const state = toState(stateful);
266
     const { conferenceTimestamp } = getConferenceState(state);
266
     const { conferenceTimestamp } = getConferenceState(state);
267
 
267
 
274
  * {@code conference} state of the feature base/conference which is not joining
274
  * {@code conference} state of the feature base/conference which is not joining
275
  * but may be leaving already.
275
  * but may be leaving already.
276
  *
276
  *
277
- * @param {Function|Object} stateful - The redux store, state, or
277
+ * @param {IStateful} stateful - The redux store, state, or
278
  * {@code getState} function.
278
  * {@code getState} function.
279
  * @returns {JitsiConference|undefined}
279
  * @returns {JitsiConference|undefined}
280
  */
280
  */
281
-export function getCurrentConference(stateful: Function | Object) {
281
+export function getCurrentConference(stateful: IStateful): any {
282
     const { conference, joining, leaving, membersOnly, passwordRequired }
282
     const { conference, joining, leaving, membersOnly, passwordRequired }
283
         = getConferenceState(toState(stateful));
283
         = getConferenceState(toState(stateful));
284
 
284
 
293
 /**
293
 /**
294
  * Returns the stored room name.
294
  * Returns the stored room name.
295
  *
295
  *
296
- * @param {Object} state - The current state of the app.
296
+ * @param {IState} state - The current state of the app.
297
  * @returns {string}
297
  * @returns {string}
298
  */
298
  */
299
-export function getRoomName(state: Object): string {
299
+export function getRoomName(state: IState) {
300
     return getConferenceState(state).room;
300
     return getConferenceState(state).room;
301
 }
301
 }
302
 
302
 
303
 /**
303
 /**
304
  * Get an obfuscated room name or create and persist it if it doesn't exists.
304
  * Get an obfuscated room name or create and persist it if it doesn't exists.
305
  *
305
  *
306
- * @param {Object} state - The current state of the app.
306
+ * @param {IState} state - The current state of the app.
307
  * @param {Function} dispatch - The Redux dispatch function.
307
  * @param {Function} dispatch - The Redux dispatch function.
308
  * @returns {string} - Obfuscated room name.
308
  * @returns {string} - Obfuscated room name.
309
  */
309
  */
310
-export function getOrCreateObfuscatedRoomName(state: Object, dispatch: Function) {
310
+export function getOrCreateObfuscatedRoomName(state: IState, dispatch: IStore['dispatch']) {
311
     let { obfuscatedRoom } = getConferenceState(state);
311
     let { obfuscatedRoom } = getConferenceState(state);
312
     const { obfuscatedRoomSource } = getConferenceState(state);
312
     const { obfuscatedRoomSource } = getConferenceState(state);
313
     const room = getRoomName(state);
313
     const room = getRoomName(state);
314
 
314
 
315
+    if (!room) {
316
+        return;
317
+    }
318
+
315
     // On native mobile the store doesn't clear when joining a new conference so we might have the obfuscatedRoom
319
     // On native mobile the store doesn't clear when joining a new conference so we might have the obfuscatedRoom
316
     // stored even though a different room was joined.
320
     // stored even though a different room was joined.
317
     // Check if the obfuscatedRoom was already computed for the current room.
321
     // Check if the obfuscatedRoom was already computed for the current room.
327
  * Analytics may require an obfuscated room name, this functions decides based on a config if the normal or
331
  * Analytics may require an obfuscated room name, this functions decides based on a config if the normal or
328
  * obfuscated room name should be returned.
332
  * obfuscated room name should be returned.
329
  *
333
  *
330
- * @param {Object} state - The current state of the app.
334
+ * @param {IState} state - The current state of the app.
331
  * @param {Function} dispatch - The Redux dispatch function.
335
  * @param {Function} dispatch - The Redux dispatch function.
332
  * @returns {string} - Analytics room name.
336
  * @returns {string} - Analytics room name.
333
  */
337
  */
334
-export function getAnalyticsRoomName(state: Object, dispatch: Function) {
338
+export function getAnalyticsRoomName(state: IState, dispatch: IStore['dispatch']) {
335
     const { analysis: { obfuscateRoomName = false } = {} } = state['features/base/config'];
339
     const { analysis: { obfuscateRoomName = false } = {} } = state['features/base/config'];
336
 
340
 
337
     if (obfuscateRoomName) {
341
     if (obfuscateRoomName) {
365
  * @protected
369
  * @protected
366
  * @returns {void}
370
  * @returns {void}
367
  */
371
  */
368
-export function _handleParticipantError(err: { message: ?string }) {
372
+export function _handleParticipantError(err: Error) {
369
     // XXX DataChannels are initialized at some later point when the conference
373
     // XXX DataChannels are initialized at some later point when the conference
370
     // has multiple participants, but code that pins or selects a participant
374
     // has multiple participants, but code that pins or selects a participant
371
     // might be executed before. So here we're swallowing a particular error.
375
     // might be executed before. So here we're swallowing a particular error.
384
  * @returns {boolean} If the specified room name is valid, then true; otherwise,
388
  * @returns {boolean} If the specified room name is valid, then true; otherwise,
385
  * false.
389
  * false.
386
  */
390
  */
387
-export function isRoomValid(room: ?string) {
391
+export function isRoomValid(room?: string) {
388
     return typeof room === 'string' && room !== '';
392
     return typeof room === 'string' && room !== '';
389
 }
393
 }
390
 
394
 
397
  * @returns {Promise}
401
  * @returns {Promise}
398
  */
402
  */
399
 export function _removeLocalTracksFromConference(
403
 export function _removeLocalTracksFromConference(
400
-        conference: { removeTrack: Function },
404
+        conference: IJitsiConference,
401
         localTracks: Array<Object>) {
405
         localTracks: Array<Object>) {
402
     return Promise.all(localTracks.map(track =>
406
     return Promise.all(localTracks.map(track =>
403
         conference.removeTrack(track)
407
         conference.removeTrack(track)
404
-            .catch(err => {
408
+            .catch((err: Error) => {
405
                 // Local track might be already disposed by direct
409
                 // Local track might be already disposed by direct
406
                 // JitsiTrack#dispose() call. So we should ignore this error
410
                 // JitsiTrack#dispose() call. So we should ignore this error
407
                 // here.
411
                 // here.
425
  * @private
429
  * @private
426
  * @returns {void}
430
  * @returns {void}
427
  */
431
  */
428
-function _reportError(msg, err) {
432
+function _reportError(msg: string, err: Error) {
429
     // TODO This is a good point to call some global error handler when we have
433
     // TODO This is a good point to call some global error handler when we have
430
     // one.
434
     // one.
431
     logger.error(msg, err);
435
     logger.error(msg, err);
443
  * @returns {void}
447
  * @returns {void}
444
  */
448
  */
445
 export function sendLocalParticipant(
449
 export function sendLocalParticipant(
446
-        stateful: Function | Object,
447
-        conference: {
448
-            sendCommand: Function,
449
-            setDisplayName: Function,
450
-            setLocalParticipantProperty: Function }) {
450
+        stateful: IStateful,
451
+        conference: IJitsiConference) {
451
     const {
452
     const {
452
         avatarURL,
453
         avatarURL,
453
         email,
454
         email,
454
         features,
455
         features,
455
         name
456
         name
456
-    } = getLocalParticipant(stateful);
457
+    } = getLocalParticipant(stateful) ?? {};
457
 
458
 
458
     avatarURL && conference.sendCommand(AVATAR_URL_COMMAND, {
459
     avatarURL && conference.sendCommand(AVATAR_URL_COMMAND, {
459
         value: avatarURL
460
         value: avatarURL

react/features/base/conference/logger.js → react/features/base/conference/logger.ts Прегледај датотеку

1
-// @flow
2
-
3
 import { getLogger } from '../logging/functions';
1
 import { getLogger } from '../logging/functions';
4
 
2
 
5
 export default getLogger('features/base/conference');
3
 export default getLogger('features/base/conference');

+ 16
- 1
react/features/base/conference/reducer.ts Прегледај датотеку

40
     passwordRequired: undefined
40
     passwordRequired: undefined
41
 };
41
 };
42
 
42
 
43
+export interface IJitsiConference {
44
+    addTrack: Function;
45
+    getBreakoutRooms: Function;
46
+    getLocalTracks: Function;
47
+    isAVModerationSupported: Function;
48
+    isEndConferenceSupported: Function;
49
+    isLobbySupported: Function;
50
+    removeTrack: Function;
51
+    sendCommand: Function;
52
+    sendEndpointMessage: Function;
53
+    sessionId: string;
54
+    setDisplayName: Function;
55
+    setLocalParticipantProperty: Function;
56
+}
57
+
43
 export interface IConferenceState {
58
 export interface IConferenceState {
44
     authEnabled?: boolean;
59
     authEnabled?: boolean;
45
     authLogin?: string;
60
     authLogin?: string;
46
     authRequired?: Object;
61
     authRequired?: Object;
47
-    conference?: any;
62
+    conference?: IJitsiConference;
48
     conferenceTimestamp?: number;
63
     conferenceTimestamp?: number;
49
     e2eeSupported?: boolean;
64
     e2eeSupported?: boolean;
50
     error?: Error;
65
     error?: Error;

+ 1
- 0
react/features/base/config/configType.ts Прегледај датотеку

125
         key: ButtonsWithNotifyClick;
125
         key: ButtonsWithNotifyClick;
126
         preventExecution: boolean;
126
         preventExecution: boolean;
127
     }>;
127
     }>;
128
+    callDisplayName?: string;
128
     callStatsConfigParams?: {
129
     callStatsConfigParams?: {
129
         additionalIDs?: {
130
         additionalIDs?: {
130
             customerID?: string;
131
             customerID?: string;

+ 4
- 0
react/features/base/config/reducer.ts Прегледај датотеку

71
 };
71
 };
72
 
72
 
73
 export interface IConfigState extends IConfig {
73
 export interface IConfigState extends IConfig {
74
+    analysis?: {
75
+        obfuscateRoomName?: boolean;
76
+    };
74
     error?: Error;
77
     error?: Error;
78
+    firefox_fake_device?: string;
75
 }
79
 }
76
 
80
 
77
 ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInitialState(), action): IConfigState => {
81
 ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInitialState(), action): IConfigState => {

+ 4
- 0
react/features/base/jwt/reducer.ts Прегледај датотеку

4
 import { SET_JWT } from './actionTypes';
4
 import { SET_JWT } from './actionTypes';
5
 
5
 
6
 export interface IJwtState {
6
 export interface IJwtState {
7
+    callee?: {
8
+        name: string;
9
+    };
7
     group?: string;
10
     group?: string;
8
     jwt?: string;
11
     jwt?: string;
9
     server?: string;
12
     server?: string;
13
+    tenant?: string;
10
 }
14
 }
11
 
15
 
12
 /**
16
 /**

react/features/base/media/actions.js → react/features/base/media/actions.ts Прегледај датотеку

1
-/* @flow */
2
-
3
-import type { Dispatch } from 'redux';
1
+import { Dispatch } from 'redux';
4
 
2
 
5
 import { showModeratedNotification } from '../../av-moderation/actions';
3
 import { showModeratedNotification } from '../../av-moderation/actions';
6
 import { shouldShowModeratedNotification } from '../../av-moderation/functions';
4
 import { shouldShowModeratedNotification } from '../../av-moderation/functions';
7
-import { isModerationNotificationDisplayed } from '../../notifications';
5
+import { isModerationNotificationDisplayed } from '../../notifications/functions';
8
 
6
 
9
 import {
7
 import {
10
     SET_AUDIO_MUTED,
8
     SET_AUDIO_MUTED,
55
  *     muted: boolean
53
  *     muted: boolean
56
  * }}
54
  * }}
57
  */
55
  */
58
-export function setAudioMuted(muted: boolean, ensureTrack: boolean = false) {
56
+export function setAudioMuted(muted: boolean, ensureTrack = false) {
59
     return {
57
     return {
60
         type: SET_AUDIO_MUTED,
58
         type: SET_AUDIO_MUTED,
61
         ensureTrack,
59
         ensureTrack,
70
  * @param {boolean|undefined} skipNotification - True if we want to skip showing the notification.
68
  * @param {boolean|undefined} skipNotification - True if we want to skip showing the notification.
71
  * @returns {Function}
69
  * @returns {Function}
72
  */
70
  */
73
-export function setAudioUnmutePermissions(blocked: boolean, skipNotification: boolean = false) {
71
+export function setAudioUnmutePermissions(blocked: boolean, skipNotification = false) {
74
     return {
72
     return {
75
         type: SET_AUDIO_UNMUTE_PERMISSIONS,
73
         type: SET_AUDIO_UNMUTE_PERMISSIONS,
76
         blocked,
74
         blocked,
107
         muted: boolean,
105
         muted: boolean,
108
         mediaType: MediaType = MEDIA_TYPE.SCREENSHARE,
106
         mediaType: MediaType = MEDIA_TYPE.SCREENSHARE,
109
         authority: number = SCREENSHARE_MUTISM_AUTHORITY.USER,
107
         authority: number = SCREENSHARE_MUTISM_AUTHORITY.USER,
110
-        ensureTrack: boolean = false) {
108
+        ensureTrack = false) {
111
     return (dispatch: Dispatch<any>, getState: Function) => {
109
     return (dispatch: Dispatch<any>, getState: Function) => {
112
         const state = getState();
110
         const state = getState();
113
 
111
 
168
         muted: boolean,
166
         muted: boolean,
169
         mediaType: string = MEDIA_TYPE.VIDEO,
167
         mediaType: string = MEDIA_TYPE.VIDEO,
170
         authority: number = VIDEO_MUTISM_AUTHORITY.USER,
168
         authority: number = VIDEO_MUTISM_AUTHORITY.USER,
171
-        ensureTrack: boolean = false) {
169
+        ensureTrack = false) {
172
     return (dispatch: Dispatch<any>, getState: Function) => {
170
     return (dispatch: Dispatch<any>, getState: Function) => {
173
         const state = getState();
171
         const state = getState();
174
 
172
 
203
  * @param {boolean|undefined} skipNotification - True if we want to skip showing the notification.
201
  * @param {boolean|undefined} skipNotification - True if we want to skip showing the notification.
204
  * @returns {Function}
202
  * @returns {Function}
205
  */
203
  */
206
-export function setVideoUnmutePermissions(blocked: boolean, skipNotification: boolean = false) {
204
+export function setVideoUnmutePermissions(blocked: boolean, skipNotification = false) {
207
     return {
205
     return {
208
         type: SET_VIDEO_UNMUTE_PERMISSIONS,
206
         type: SET_VIDEO_UNMUTE_PERMISSIONS,
209
         blocked,
207
         blocked,

+ 1
- 1
react/features/base/participants/types.ts Прегледај датотеку

8
     e2eeSupported?: boolean;
8
     e2eeSupported?: boolean;
9
     email?: string;
9
     email?: string;
10
     features?: {
10
     features?: {
11
-        'screen-sharing'?: boolean;
11
+        'screen-sharing'?: boolean | string;
12
     };
12
     };
13
     getId?: Function;
13
     getId?: Function;
14
     id: string;
14
     id: string;

react/features/base/testing/actions.js → react/features/base/testing/actions.ts Прегледај датотеку


react/features/base/testing/functions.js → react/features/base/testing/functions.ts Прегледај датотеку

1
-// @flow
2
-
3
-import { getMultipleVideoSupportFeatureFlag } from '../config';
4
-import { MEDIA_TYPE, VIDEO_TYPE } from '../media';
5
-import { getParticipantById } from '../participants';
1
+import { IState, IStore } from '../../app/types';
2
+import { getMultipleVideoSupportFeatureFlag } from '../config/functions.any';
3
+import { MEDIA_TYPE, VIDEO_TYPE } from '../media/constants';
4
+import { getParticipantById } from '../participants/functions';
5
+// eslint-disable-next-line lines-around-comment
6
+// @ts-ignore
6
 import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../tracks';
7
 import { getTrackByMediaTypeAndParticipant, getVirtualScreenshareParticipantTrack } from '../tracks';
7
 
8
 
8
 /**
9
 /**
10
  * {@link TestHint} and other components from the testing package will be
11
  * {@link TestHint} and other components from the testing package will be
11
  * rendered in various places across the app to help with automatic testing.
12
  * rendered in various places across the app to help with automatic testing.
12
  *
13
  *
13
- * @param {Object} state - The redux store state.
14
+ * @param {IState} state - The redux store state.
14
  * @returns {boolean}
15
  * @returns {boolean}
15
  */
16
  */
16
-export function isTestModeEnabled(state: Object): boolean {
17
+export function isTestModeEnabled(state: IState): boolean {
17
     const testingConfig = state['features/base/config'].testing;
18
     const testingConfig = state['features/base/config'].testing;
18
 
19
 
19
-    return Boolean(testingConfig && testingConfig.testMode);
20
+    return Boolean(testingConfig?.testMode);
20
 }
21
 }
21
 
22
 
22
 /**
23
 /**
23
  * Returns the video type of the remote participant's video.
24
  * Returns the video type of the remote participant's video.
24
  *
25
  *
25
- * @param {Store} store - The redux store.
26
+ * @param {IStore} store - The redux store.
26
  * @param {string} id - The participant ID for the remote video.
27
  * @param {string} id - The participant ID for the remote video.
27
  * @returns {VIDEO_TYPE}
28
  * @returns {VIDEO_TYPE}
28
  */
29
  */
29
-export function getRemoteVideoType({ getState }: Object, id: String): VIDEO_TYPE {
30
+export function getRemoteVideoType({ getState }: IStore, id: string) {
30
     const state = getState();
31
     const state = getState();
31
     const participant = getParticipantById(state, id);
32
     const participant = getParticipantById(state, id);
32
 
33
 
40
 /**
41
 /**
41
  * Returns whether the last media event received for large video indicates that the video is playing, if not muted.
42
  * Returns whether the last media event received for large video indicates that the video is playing, if not muted.
42
  *
43
  *
43
- * @param {Store} store - The redux store.
44
+ * @param {IStore} store - The redux store.
44
  * @returns {boolean}
45
  * @returns {boolean}
45
  */
46
  */
46
-export function isLargeVideoReceived({ getState }: Object): boolean {
47
+export function isLargeVideoReceived({ getState }: IStore): boolean {
47
     const state = getState();
48
     const state = getState();
48
     const largeVideoParticipantId = state['features/large-video'].participantId;
49
     const largeVideoParticipantId = state['features/large-video'].participantId;
49
-    const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId);
50
+    const largeVideoParticipant = getParticipantById(state, largeVideoParticipantId ?? '');
50
     const tracks = state['features/base/tracks'];
51
     const tracks = state['features/base/tracks'];
51
     let videoTrack;
52
     let videoTrack;
52
 
53
 
64
 /**
65
 /**
65
  * Returns whether the last media event received for a remote video indicates that the video is playing, if not muted.
66
  * Returns whether the last media event received for a remote video indicates that the video is playing, if not muted.
66
  *
67
  *
67
- * @param {Store} store - The redux store.
68
+ * @param {IStore} store - The redux store.
68
  * @param {string} id - The participant ID for the remote video.
69
  * @param {string} id - The participant ID for the remote video.
69
  * @returns {boolean}
70
  * @returns {boolean}
70
  */
71
  */
71
-export function isRemoteVideoReceived({ getState }: Object, id: String): boolean {
72
+export function isRemoteVideoReceived({ getState }: IStore, id: string): boolean {
72
     const state = getState();
73
     const state = getState();
73
     const tracks = state['features/base/tracks'];
74
     const tracks = state['features/base/tracks'];
74
     const participant = getParticipantById(state, id);
75
     const participant = getParticipantById(state, id);

+ 1
- 1
react/features/face-landmarks/functions.ts Прегледај датотеку

111
 
111
 
112
     const reqBody = {
112
     const reqBody = {
113
         meetingFqn: extractFqnFromPath(),
113
         meetingFqn: extractFqnFromPath(),
114
-        sessionId: conference.sessionId,
114
+        sessionId: conference?.sessionId,
115
         submitted: Date.now(),
115
         submitted: Date.now(),
116
         emotions: faceExpressionsBuffer,
116
         emotions: faceExpressionsBuffer,
117
         participantId: localParticipant?.jwtId,
117
         participantId: localParticipant?.jwtId,

react/features/notifications/functions.js → react/features/notifications/functions.ts Прегледај датотеку

1
-// @flow
2
-
3
 import { MODERATION_NOTIFICATIONS } from '../av-moderation/constants';
1
 import { MODERATION_NOTIFICATIONS } from '../av-moderation/constants';
4
-import { MEDIA_TYPE } from '../base/media';
5
-import { toState } from '../base/redux';
6
-
7
-declare var interfaceConfig: Object;
2
+import { IStateful } from '../base/app/types';
3
+import { MediaType } from '../base/media/constants';
4
+import { toState } from '../base/redux/functions';
8
 
5
 
9
 /**
6
 /**
10
  * Tells whether or not the notifications are enabled and if there are any
7
  * Tells whether or not the notifications are enabled and if there are any
11
  * notifications to be displayed based on the current Redux state.
8
  * notifications to be displayed based on the current Redux state.
12
  *
9
  *
13
- * @param {Object|Function} stateful - The redux store state.
10
+ * @param {IStateful} stateful - The redux store state.
14
  * @returns {boolean}
11
  * @returns {boolean}
15
  */
12
  */
16
-export function areThereNotifications(stateful: Object | Function) {
13
+export function areThereNotifications(stateful: IStateful) {
17
     const state = toState(stateful);
14
     const state = toState(stateful);
18
     const { enabled, notifications } = state['features/notifications'];
15
     const { enabled, notifications } = state['features/notifications'];
19
 
16
 
33
  * Returns whether or not the moderation notification for the given type is displayed.
30
  * Returns whether or not the moderation notification for the given type is displayed.
34
  *
31
  *
35
  * @param {MEDIA_TYPE} mediaType - The media type to check.
32
  * @param {MEDIA_TYPE} mediaType - The media type to check.
36
- * @param {Object | Function} stateful - The redux store state.
33
+ * @param {IStateful} stateful - The redux store state.
37
  * @returns {boolean}
34
  * @returns {boolean}
38
  */
35
  */
39
-export function isModerationNotificationDisplayed(mediaType: MEDIA_TYPE, stateful: Object | Function) {
36
+export function isModerationNotificationDisplayed(mediaType: MediaType, stateful: IStateful) {
40
     const state = toState(stateful);
37
     const state = toState(stateful);
41
 
38
 
42
     const { notifications } = state['features/notifications'];
39
     const { notifications } = state['features/notifications'];

+ 1
- 1
react/features/prejoin/components/Prejoin.native.tsx Прегледај датотеку

65
     );
65
     );
66
     const localParticipant = useSelector((state: IState) => getLocalParticipant(state));
66
     const localParticipant = useSelector((state: IState) => getLocalParticipant(state));
67
     const isDisplayNameMandatory = useSelector(state => isDisplayNameRequired(state));
67
     const isDisplayNameMandatory = useSelector(state => isDisplayNameRequired(state));
68
-    const roomName = useSelector(state => getConferenceName(state));
68
+    const roomName = useSelector((state: IState) => getConferenceName(state));
69
     const participantName = localParticipant?.name;
69
     const participantName = localParticipant?.name;
70
     const [ displayName, setDisplayName ]
70
     const [ displayName, setDisplayName ]
71
         = useState(participantName || '');
71
         = useState(participantName || '');

+ 1
- 1
react/features/reactions/functions.any.ts Прегледај датотеку

69
 
69
 
70
     const reqBody = {
70
     const reqBody = {
71
         meetingFqn: extractFqnFromPath(),
71
         meetingFqn: extractFqnFromPath(),
72
-        sessionId: conference.sessionId,
72
+        sessionId: conference?.sessionId,
73
         submitted: Date.now(),
73
         submitted: Date.now(),
74
         reactions,
74
         reactions,
75
         participantId: localParticipant?.jwtId,
75
         participantId: localParticipant?.jwtId,

react/features/transcribing/functions.js → react/features/transcribing/functions.ts Прегледај датотеку

1
-// @flow
2
-
3
 import i18next from 'i18next';
1
 import i18next from 'i18next';
4
 
2
 
3
+import { IConfig } from '../base/config/configType';
4
+
5
 import JITSI_TO_BCP47_MAP from './jitsi-bcp47-map.json';
5
 import JITSI_TO_BCP47_MAP from './jitsi-bcp47-map.json';
6
 import logger from './logger';
6
 import logger from './logger';
7
 import TRANSCRIBER_LANGS from './transcriber-langs.json';
7
 import TRANSCRIBER_LANGS from './transcriber-langs.json';
14
  * @param {*} config - Application config.
14
  * @param {*} config - Application config.
15
  * @returns {string}
15
  * @returns {string}
16
  */
16
  */
17
-export function determineTranscriptionLanguage(config: Object) {
17
+export function determineTranscriptionLanguage(config: IConfig) {
18
     const { transcription } = config;
18
     const { transcription } = config;
19
 
19
 
20
     // if transcriptions are not enabled nothing to determine
20
     // if transcriptions are not enabled nothing to determine
27
     // Jitsi language detections uses custom language tags, but the transcriber expects BCP-47 compliant tags,
27
     // Jitsi language detections uses custom language tags, but the transcriber expects BCP-47 compliant tags,
28
     // we use a mapping file to convert them.
28
     // we use a mapping file to convert them.
29
     const bcp47Locale = transcription?.useAppLanguage ?? true
29
     const bcp47Locale = transcription?.useAppLanguage ?? true
30
-        ? JITSI_TO_BCP47_MAP[i18next.language]
30
+        ? JITSI_TO_BCP47_MAP[i18next.language as keyof typeof JITSI_TO_BCP47_MAP]
31
         : transcription?.preferredLanguage;
31
         : transcription?.preferredLanguage;
32
 
32
 
33
     // Check if the obtained language is supported by the transcriber
33
     // Check if the obtained language is supported by the transcriber
34
-    let safeBCP47Locale = TRANSCRIBER_LANGS[bcp47Locale] && bcp47Locale;
34
+    let safeBCP47Locale = TRANSCRIBER_LANGS[bcp47Locale as keyof typeof TRANSCRIBER_LANGS] && bcp47Locale;
35
 
35
 
36
     if (!safeBCP47Locale) {
36
     if (!safeBCP47Locale) {
37
         safeBCP47Locale = DEFAULT_TRANSCRIBER_LANG;
37
         safeBCP47Locale = DEFAULT_TRANSCRIBER_LANG;

react/features/transcribing/logger.js → react/features/transcribing/logger.ts Прегледај датотеку

1
-// @flow
2
-
3
 import { getLogger } from '../base/logging/functions';
1
 import { getLogger } from '../base/logging/functions';
4
 
2
 
5
 export default getLogger('features/transcribing');
3
 export default getLogger('features/transcribing');

+ 1
- 1
tsconfig.json Прегледај датотеку

1
 {
1
 {
2
-    "include": ["react/features/**/*.ts", "react/features/**/*.tsx", "./custom.d.ts"],
2
+    "include": ["react/features/**/*.ts", "react/features/**/*.tsx", "./custom.d.ts", "./globals.d.ts"],
3
     "compilerOptions": {
3
     "compilerOptions": {
4
         "allowSyntheticDefaultImports": true,
4
         "allowSyntheticDefaultImports": true,
5
         "module": "es6",
5
         "module": "es6",

Loading…
Откажи
Сачувај