Przeglądaj źródła

ref(TS) Convert some features to TS (#12651)

factor2
Robert Pintilii 2 lat temu
rodzic
commit
aef5328aeb
No account linked to committer's email address

+ 1
- 0
globals.d.ts Wyświetl plik

@@ -24,6 +24,7 @@ declare global {
24 24
         JITSI_MEET_LITE_SDK?: boolean;
25 25
         interfaceConfig?: any;
26 26
         JitsiMeetJS?: any;
27
+        JitsiMeetElectron?: any;
27 28
     }
28 29
 
29 30
     const config: IConfig;

+ 2
- 0
react/features/base/conference/reducer.ts Wyświetl plik

@@ -46,6 +46,7 @@ export interface IJitsiConference {
46 46
     avModerationApprove: Function;
47 47
     avModerationReject: Function;
48 48
     createVideoSIPGWSession: Function;
49
+    dial: Function;
49 50
     disableAVModeration: Function;
50 51
     enableAVModeration: Function;
51 52
     end: Function;
@@ -74,6 +75,7 @@ export interface IJitsiConference {
74 75
     myUserId: Function;
75 76
     off: Function;
76 77
     on: Function;
78
+    options: any;
77 79
     removeTrack: Function;
78 80
     replaceTrack: Function;
79 81
     room: IJitsiConferenceRoom;

+ 3
- 0
react/features/base/config/configType.ts Wyświetl plik

@@ -127,6 +127,7 @@ export interface IConfig {
127 127
         preventExecution: boolean;
128 128
     }>;
129 129
     callDisplayName?: string;
130
+    callFlowsEnabled?: boolean;
130 131
     callStatsConfigParams?: {
131 132
         additionalIDs?: {
132 133
             customerID?: string;
@@ -344,6 +345,8 @@ export interface IConfig {
344 345
     iAmRecorder?: boolean;
345 346
     iAmSipGateway?: boolean;
346 347
     inviteAppName?: string | null;
348
+    inviteServiceCallFlowsUrl?: string;
349
+    inviteServiceUrl?: string;
347 350
     jaasActuatorUrl?: string;
348 351
     jaasFeedbackMetadataURL?: string;
349 352
     jaasTokenUrl?: string;

react/features/chrome-extension-banner/logger.js → react/features/chrome-extension-banner/logger.ts Wyświetl plik

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

react/features/desktop-picker/actions.js → react/features/desktop-picker/actions.ts Wyświetl plik

@@ -1,5 +1,6 @@
1
-import { openDialog } from '../base/dialog';
1
+import { openDialog } from '../base/dialog/actions';
2 2
 
3
+// @ts-ignore
3 4
 import { DesktopPicker } from './components';
4 5
 
5 6
 /**
@@ -10,7 +11,7 @@ import { DesktopPicker } from './components';
10 11
  * a DesktopCapturerSource has been chosen.
11 12
  * @returns {Object}
12 13
  */
13
-export function showDesktopPicker(options = {}, onSourceChoose) {
14
+export function showDesktopPicker(options: { desktopSharingSources?: any; } = {}, onSourceChoose: Function) {
14 15
     const { desktopSharingSources } = options;
15 16
 
16 17
     return openDialog(DesktopPicker, {

react/features/desktop-picker/functions.js → react/features/desktop-picker/functions.ts Wyświetl plik

@@ -1,4 +1,3 @@
1
-
2 1
 import logger from './logger';
3 2
 
4 3
 /**
@@ -11,8 +10,8 @@ import logger from './logger';
11 10
  * return native image object used for the preview image of the source.
12 11
  * @returns {Function}
13 12
  */
14
-export function obtainDesktopSources(types, options = {}) {
15
-    const capturerOptions = {
13
+export function obtainDesktopSources(types: string[], options: { thumbnailSize?: Object; } = {}) {
14
+    const capturerOptions: any = {
16 15
         types
17 16
     };
18 17
 
@@ -23,10 +22,10 @@ export function obtainDesktopSources(types, options = {}) {
23 22
     return new Promise((resolve, reject) => {
24 23
         const { JitsiMeetElectron } = window;
25 24
 
26
-        if (JitsiMeetElectron && JitsiMeetElectron.obtainDesktopStreams) {
25
+        if (JitsiMeetElectron?.obtainDesktopStreams) {
27 26
             JitsiMeetElectron.obtainDesktopStreams(
28
-                sources => resolve(_separateSourcesByType(sources)),
29
-                error => {
27
+                (sources: Array<{ id: string; }>) => resolve(_separateSourcesByType(sources)),
28
+                (error: Error) => {
30 29
                     logger.error(
31 30
                         `Error while obtaining desktop sources: ${error}`);
32 31
                     reject(error);
@@ -54,8 +53,8 @@ export function obtainDesktopSources(types, options = {}) {
54 53
  * @returns {Object} An object with the sources split into separate arrays based
55 54
  * on source type.
56 55
  */
57
-function _separateSourcesByType(sources = []) {
58
-    const sourcesByType = {
56
+function _separateSourcesByType(sources: Array<{ id: string; }> = []) {
57
+    const sourcesByType: any = {
59 58
         screen: [],
60 59
         window: []
61 60
     };

react/features/desktop-picker/logger.js → react/features/desktop-picker/logger.ts Wyświetl plik

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

react/features/invite/_utils.js → react/features/invite/_utils.ts Wyświetl plik

@@ -1,12 +1,10 @@
1
-// @flow
2
-
3 1
 /**
4 2
  * Utility class with no dependencies. Used in components that are stripped in separate bundles
5 3
  * and requires as less dependencies as possible.
6 4
  */
7 5
 
8 6
 import { getURLWithoutParams } from '../base/connection/utils';
9
-import { doGetJSON } from '../base/util';
7
+import { doGetJSON } from '../base/util/httpUtils';
10 8
 
11 9
 /**
12 10
  * Formats the conference pin in readable way for UI to display it.
@@ -49,7 +47,7 @@ export function getDialInConferenceID(
49 47
         roomName: string,
50 48
         mucURL: string,
51 49
         url: URL
52
-): Promise<Object> {
50
+): Promise<any> {
53 51
     const separator = baseUrl.includes('?') ? '&' : '?';
54 52
     const conferenceIDURL
55 53
         = `${baseUrl}${separator}conference=${roomName}@${mucURL}&url=${getURLWithoutParams(url).href}`;
@@ -75,7 +73,7 @@ export function getDialInNumbers(
75 73
         url: string,
76 74
         roomName: string,
77 75
         mucURL: string
78
-): Promise<*> {
76
+): Promise<any> {
79 77
     const separator = url.includes('?') ? '&' : '?';
80 78
 
81 79
     // when roomName and mucURL are available

react/features/invite/actions.any.js → react/features/invite/actions.any.ts Wyświetl plik

@@ -1,10 +1,7 @@
1
-// @flow
2
-
3
-import type { Dispatch } from 'redux';
4
-
5
-import { getInviteURL } from '../base/connection';
6
-import { getLocalParticipant, getParticipantCount } from '../base/participants';
7
-import { inviteVideoRooms } from '../videosipgw';
1
+import { IStore } from '../app/types';
2
+import { getInviteURL } from '../base/connection/functions';
3
+import { getLocalParticipant, getParticipantCount } from '../base/participants/functions';
4
+import { inviteVideoRooms } from '../videosipgw/actions';
8 5
 
9 6
 import { getDialInConferenceID, getDialInNumbers } from './_utils';
10 7
 import {
@@ -22,6 +19,7 @@ import {
22 19
     inviteSipEndpoints
23 20
 } from './functions';
24 21
 import logger from './logger';
22
+import { IInvitee } from './types';
25 23
 
26 24
 /**
27 25
  * Creates a (redux) action to signal that a click/tap has been performed on
@@ -64,11 +62,11 @@ export function hideAddPeopleDialog() {
64 62
  * of invitees who were not invited (i.e. Invites were not sent to them).
65 63
  */
66 64
 export function invite(
67
-        invitees: Array<Object>,
68
-        showCalleeInfo: boolean = false) {
65
+        invitees: IInvitee[],
66
+        showCalleeInfo = false) {
69 67
     return (
70
-            dispatch: Dispatch<any>,
71
-            getState: Function): Promise<Array<Object>> => {
68
+            dispatch: IStore['dispatch'],
69
+            getState: IStore['getState']): Promise<Array<Object>> => {
72 70
         const state = getState();
73 71
         const participantsCount = getParticipantCount(state);
74 72
         const { calleeInfoVisible } = state['features/invite'];
@@ -89,12 +87,12 @@ export function invite(
89 87
             return new Promise(resolve => {
90 88
                 dispatch(addPendingInviteRequest({
91 89
                     invitees,
92
-                    callback: failedInvitees => resolve(failedInvitees)
90
+                    callback: (failedInvitees: any) => resolve(failedInvitees)
93 91
                 }));
94 92
             });
95 93
         }
96 94
 
97
-        let allInvitePromises = [];
95
+        let allInvitePromises: Promise<any>[] = [];
98 96
         let invitesLeftToSend = [ ...invitees ];
99 97
 
100 98
         const {
@@ -105,8 +103,8 @@ export function invite(
105 103
         const inviteUrl = getInviteURL(state);
106 104
         const { sipInviteUrl } = state['features/base/config'];
107 105
         const { locationURL } = state['features/base/connection'];
108
-        const { jwt } = state['features/base/jwt'];
109
-        const { name: displayName } = getLocalParticipant(state);
106
+        const { jwt = '' } = state['features/base/jwt'];
107
+        const { name: displayName } = getLocalParticipant(state) ?? {};
110 108
 
111 109
         // First create all promises for dialing out.
112 110
         const phoneNumbers
@@ -123,7 +121,7 @@ export function invite(
123 121
                         = invitesLeftToSend.filter(
124 122
                             invitee => invitee !== item);
125 123
                 })
126
-                .catch(error =>
124
+                .catch((error: Error) =>
127 125
                     logger.error('Error inviting phone number:', error));
128 126
         });
129 127
 
@@ -138,8 +136,8 @@ export function invite(
138 136
             // filter all rooms and users from {@link invitesLeftToSend}.
139 137
             const peopleInvitePromise
140 138
                 = invitePeopleAndChatRooms(
141
-                    callFlowsEnabled
142
-                        ? inviteServiceCallFlowsUrl : inviteServiceUrl,
139
+                    (callFlowsEnabled
140
+                        ? inviteServiceCallFlowsUrl : inviteServiceUrl) ?? '',
143 141
                     inviteUrl,
144 142
                     jwt,
145 143
                     usersAndRooms)
@@ -173,6 +171,8 @@ export function invite(
173 171
 
174 172
         conference && inviteSipEndpoints(
175 173
             sipEndpoints,
174
+
175
+            // @ts-ignore
176 176
             locationURL,
177 177
             sipInviteUrl,
178 178
             jwt,
@@ -196,12 +196,12 @@ export function invite(
196 196
  * @returns {Function}
197 197
  */
198 198
 export function updateDialInNumbers() {
199
-    return (dispatch: Dispatch<any>, getState: Function) => {
199
+    return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
200 200
         const state = getState();
201 201
         const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
202 202
             = state['features/base/config'];
203 203
         const { numbersFetched } = state['features/invite'];
204
-        const mucURL = hosts && hosts.muc;
204
+        const mucURL = hosts?.muc;
205 205
 
206 206
         if (numbersFetched || !dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
207 207
             // URLs for fetching dial in numbers not defined
@@ -209,10 +209,10 @@ export function updateDialInNumbers() {
209 209
         }
210 210
 
211 211
         const { locationURL = {} } = state['features/base/connection'];
212
-        const { room } = state['features/base/conference'];
212
+        const { room = '' } = state['features/base/conference'];
213 213
 
214 214
         Promise.all([
215
-            getDialInNumbers(dialInNumbersUrl, room, mucURL),
215
+            getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore
216 216
             getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)
217 217
         ])
218 218
             .then(([ dialInNumbers, { conference, id, message, sipUri } ]) => {
@@ -251,7 +251,7 @@ export function updateDialInNumbers() {
251 251
  */
252 252
 export function setCalleeInfoVisible(
253 253
         calleeInfoVisible: boolean,
254
-        initialCalleeInfo: ?Object) {
254
+        initialCalleeInfo?: Object) {
255 255
     return {
256 256
         type: SET_CALLEE_INFO_VISIBLE,
257 257
         calleeInfoVisible,
@@ -269,7 +269,7 @@ export function setCalleeInfoVisible(
269 269
  * }}
270 270
  */
271 271
 export function addPendingInviteRequest(
272
-        request: { invitees: Array<Object>, callback: Function }) {
272
+        request: { callback: Function; invitees: Array<Object>; }) {
273 273
     return {
274 274
         type: ADD_PENDING_INVITE_REQUEST,
275 275
         request

react/features/invite/actions.native.js → react/features/invite/actions.native.ts Wyświetl plik

@@ -1,11 +1,13 @@
1
-// @flow
2
-
3
-import type { Dispatch } from 'redux';
4
-
5
-import { ADD_PEOPLE_ENABLED, getFeatureFlag } from '../base/flags';
1
+/* eslint-disable lines-around-comment */
2
+import { IStore } from '../app/types';
3
+import { ADD_PEOPLE_ENABLED } from '../base/flags/constants';
4
+import { getFeatureFlag } from '../base/flags/functions';
5
+// @ts-ignore
6 6
 import { navigate } from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
7
+// @ts-ignore
7 8
 import { screen } from '../mobile/navigation/routes';
8
-import { beginShareRoom } from '../share-room';
9
+import { beginShareRoom } from '../share-room/actions';
10
+/* eslint-enable lines-around-comment */
9 11
 
10 12
 import { isAddPeopleEnabled, isDialOutEnabled } from './functions';
11 13
 
@@ -18,7 +20,7 @@ export * from './actions.any';
18 20
  * @returns {Function}
19 21
  */
20 22
 export function doInvitePeople() {
21
-    return (dispatch: Dispatch<any>, getState: Function) => {
23
+    return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
22 24
         const state = getState();
23 25
         const addPeopleEnabled = getFeatureFlag(state, ADD_PEOPLE_ENABLED, true)
24 26
             && (isAddPeopleEnabled(state) || isDialOutEnabled(state));

react/features/invite/actions.web.js → react/features/invite/actions.web.ts Wyświetl plik


+ 1
- 1
react/features/invite/components/add-people-dialog/web/AddPeopleDialog.tsx Wyświetl plik

@@ -205,7 +205,7 @@ function mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
205 205
     const addPeopleEnabled = isAddPeopleEnabled(state);
206 206
     const dialOutEnabled = isDialOutEnabled(state);
207 207
     const hideInviteContacts = iAmRecorder || (!addPeopleEnabled && !dialOutEnabled);
208
-    const dialIn = state['features/invite'];
208
+    const dialIn = state['features/invite']; // @ts-ignore
209 209
     const phoneNumber = dialIn?.numbers ? _getDefaultPhoneNumber(dialIn.numbers) : undefined;
210 210
 
211 211
     return {

react/features/invite/functions.js → react/features/invite/functions.ts Wyświetl plik

@@ -1,20 +1,17 @@
1
-// @flow
2
-
3
-import { getActiveSession } from '../../features/recording/functions';
4
-import { getRoomName } from '../base/conference';
5
-import { getInviteURL } from '../base/connection';
1
+import { IReduxState } from '../app/types';
2
+import { IStateful } from '../base/app/types';
3
+import { getRoomName } from '../base/conference/functions';
4
+import { getInviteURL } from '../base/connection/functions';
6 5
 import { isIosMobileBrowser } from '../base/environment/utils';
7
-import { i18next } from '../base/i18n';
6
+import i18next from '../base/i18n/i18next';
8 7
 import { isJwtFeatureEnabled } from '../base/jwt/functions';
9 8
 import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
10
-import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants';
11
-import { toState } from '../base/redux';
12
-import {
13
-    appendURLParam,
14
-    parseURIString,
15
-    parseURLParams
16
-} from '../base/util';
9
+import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants/functions';
10
+import { toState } from '../base/redux/functions';
11
+import { parseURLParams } from '../base/util/parseURLParams';
12
+import { appendURLParam, parseURIString } from '../base/util/uri';
17 13
 import { isVpaasMeeting } from '../jaas/functions';
14
+import { getActiveSession } from '../recording/functions';
18 15
 
19 16
 import { getDialInConferenceID, getDialInNumbers } from './_utils';
20 17
 import {
@@ -24,8 +21,7 @@ import {
24 21
 } from './constants';
25 22
 import logger from './logger';
26 23
 
27
-declare var $: Function;
28
-declare var interfaceConfig: Object;
24
+declare let $: any;
29 25
 
30 26
 export const sharingFeatures = {
31 27
     email: 'email',
@@ -44,7 +40,7 @@ export const sharingFeatures = {
44 40
 export function checkDialNumber(
45 41
         dialNumber: string,
46 42
         dialOutAuthUrl: string
47
-): Promise<Object> {
43
+): Promise<{ allow?: boolean; country?: string; phone?: string; }> {
48 44
     const fullUrl = `${dialOutAuthUrl}?phone=${dialNumber}`;
49 45
 
50 46
     return new Promise((resolve, reject) => {
@@ -61,7 +57,7 @@ export function checkDialNumber(
61 57
  * numbers.
62 58
  * @returns {string} A string with only numbers.
63 59
  */
64
-export function getDigitsOnly(text: string = ''): string {
60
+export function getDigitsOnly(text = ''): string {
65 61
     return text.replace(/\D/g, '');
66 62
 }
67 63
 
@@ -71,40 +67,40 @@ export function getDigitsOnly(text: string = ''): string {
71 67
 export type GetInviteResultsOptions = {
72 68
 
73 69
     /**
74
-     * The endpoint to use for checking phone number validity.
70
+     * Whether or not to search for people.
75 71
      */
76
-    dialOutAuthUrl: string,
72
+    addPeopleEnabled: boolean;
77 73
 
78 74
     /**
79
-     * Whether or not to search for people.
75
+     * The endpoint to use for checking phone number validity.
80 76
      */
81
-    addPeopleEnabled: boolean,
77
+    dialOutAuthUrl: string;
82 78
 
83 79
     /**
84 80
      * Whether or not to check phone numbers.
85 81
      */
86
-    dialOutEnabled: boolean,
82
+    dialOutEnabled: boolean;
83
+
84
+    /**
85
+     * The jwt token to pass to the search service.
86
+     */
87
+    jwt: string;
87 88
 
88 89
     /**
89 90
      * Array with the query types that will be executed -
90 91
      * "conferenceRooms" | "user" | "room".
91 92
      */
92
-    peopleSearchQueryTypes: Array<string>,
93
+    peopleSearchQueryTypes: Array<string>;
93 94
 
94 95
     /**
95 96
      * The url to query for people.
96 97
      */
97
-    peopleSearchUrl: string,
98
+    peopleSearchUrl: string;
98 99
 
99 100
     /**
100 101
      * Whether or not to check sip invites.
101 102
      */
102
-    sipInviteEnabled: boolean,
103
-
104
-    /**
105
-     * The jwt token to pass to the search service.
106
-     */
107
-    jwt: string
103
+    sipInviteEnabled: boolean;
108 104
 };
109 105
 
110 106
 /**
@@ -118,8 +114,7 @@ export type GetInviteResultsOptions = {
118 114
 export function getInviteResultsForQuery(
119 115
         query: string,
120 116
         options: GetInviteResultsOptions
121
-): Promise<*> {
122
-
117
+): Promise<any> {
123 118
     const text = query.trim();
124 119
 
125 120
     const {
@@ -183,12 +178,12 @@ export function getInviteResultsForQuery(
183 178
             phone: text
184 179
         });
185 180
     } else {
186
-        phoneNumberPromise = Promise.resolve({});
181
+        phoneNumberPromise = Promise.resolve<{ allow?: boolean; country?: string; phone?: string; }>({});
187 182
     }
188 183
 
189 184
     return Promise.all([ peopleSearchPromise, phoneNumberPromise ])
190 185
         .then(([ peopleResults, phoneResults ]) => {
191
-            const results = [
186
+            const results: any[] = [
192 187
                 ...peopleResults
193 188
             ];
194 189
 
@@ -233,7 +228,7 @@ export function getInviteTextiOS({
233 228
     state,
234 229
     phoneNumber,
235 230
     t
236
-}: Object) {
231
+}: { phoneNumber?: string | null; state: IReduxState; t?: Function; }) {
237 232
     if (!isIosMobileBrowser()) {
238 233
         return '';
239 234
     }
@@ -246,23 +241,23 @@ export function getInviteTextiOS({
246 241
     const inviteURL = _decodeRoomURI(inviteUrl);
247 242
 
248 243
     let invite = localParticipantName
249
-        ? t('info.inviteTextiOSPersonal', { name: localParticipantName })
250
-        : t('info.inviteURLFirstPartGeneral');
244
+        ? t?.('info.inviteTextiOSPersonal', { name: localParticipantName })
245
+        : t?.('info.inviteURLFirstPartGeneral');
251 246
 
252 247
     invite += ' ';
253 248
 
254
-    invite += t('info.inviteTextiOSInviteUrl', { inviteUrl });
249
+    invite += t?.('info.inviteTextiOSInviteUrl', { inviteUrl });
255 250
     invite += ' ';
256 251
 
257 252
     if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) {
258
-        invite += t('info.inviteTextiOSPhone', {
253
+        invite += t?.('info.inviteTextiOSPhone', {
259 254
             number: phoneNumber,
260 255
             conferenceID: dialIn.conferenceID,
261 256
             didUrl: getDialInfoPageURL(state)
262 257
         });
263 258
     }
264 259
     invite += ' ';
265
-    invite += t('info.inviteTextiOSJoinSilent', { silentUrl: `${inviteURL}#config.startSilent=true` });
260
+    invite += t?.('info.inviteTextiOSJoinSilent', { silentUrl: `${inviteURL}#config.startSilent=true` });
266 261
 
267 262
     return invite;
268 263
 }
@@ -276,27 +271,25 @@ export function getInviteText({
276 271
     state,
277 272
     phoneNumber,
278 273
     t
279
-}: Object) {
274
+}: { phoneNumber?: string | null; state: IReduxState; t?: Function; }) {
280 275
     const dialIn = state['features/invite'];
281 276
     const inviteUrl = getInviteURL(state);
282 277
     const currentLiveStreamingSession = getActiveSession(state, JitsiRecordingConstants.mode.STREAM);
283
-    const liveStreamViewURL
284
-        = currentLiveStreamingSession
285
-            && currentLiveStreamingSession.liveStreamViewURL;
278
+    const liveStreamViewURL = currentLiveStreamingSession?.liveStreamViewURL;
286 279
     const localParticipant = getLocalParticipant(state);
287 280
     const localParticipantName = localParticipant?.name;
288 281
 
289 282
     const inviteURL = _decodeRoomURI(inviteUrl);
290 283
     let invite = localParticipantName
291
-        ? t('info.inviteURLFirstPartPersonal', { name: localParticipantName })
292
-        : t('info.inviteURLFirstPartGeneral');
284
+        ? t?.('info.inviteURLFirstPartPersonal', { name: localParticipantName })
285
+        : t?.('info.inviteURLFirstPartGeneral');
293 286
 
294
-    invite += t('info.inviteURLSecondPart', {
287
+    invite += t?.('info.inviteURLSecondPart', {
295 288
         url: inviteURL
296 289
     });
297 290
 
298 291
     if (liveStreamViewURL) {
299
-        const liveStream = t('info.inviteLiveStream', {
292
+        const liveStream = t?.('info.inviteLiveStream', {
300 293
             url: liveStreamViewURL
301 294
         });
302 295
 
@@ -304,11 +297,11 @@ export function getInviteText({
304 297
     }
305 298
 
306 299
     if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) {
307
-        const dial = t('info.invitePhone', {
300
+        const dial = t?.('info.invitePhone', {
308 301
             number: phoneNumber,
309 302
             conferenceID: dialIn.conferenceID
310 303
         });
311
-        const moreNumbers = t('info.invitePhoneAlternatives', {
304
+        const moreNumbers = t?.('info.invitePhoneAlternatives', {
312 305
             url: getDialInfoPageURL(state),
313 306
             silentUrl: `${inviteURL}#config.startSilent=true`
314 307
         });
@@ -328,8 +321,8 @@ export function getInviteText({
328 321
  * @returns {Object} An object with keys as user types and values as the number
329 322
  * of invites for that type.
330 323
  */
331
-export function getInviteTypeCounts(inviteItems: Array<Object> = []) {
332
-    const inviteTypeCounts = {};
324
+export function getInviteTypeCounts(inviteItems: Array<{ type: string; }> = []) {
325
+    const inviteTypeCounts: any = {};
333 326
 
334 327
     inviteItems.forEach(({ type }) => {
335 328
         if (!inviteTypeCounts[type]) {
@@ -352,51 +345,51 @@ export function getInviteTypeCounts(inviteItems: Array<Object> = []) {
352 345
  * items to invite.
353 346
  * @returns {Promise} - The promise created by the request.
354 347
  */
355
-export function invitePeopleAndChatRooms( // eslint-disable-line max-params
348
+export function invitePeopleAndChatRooms(
356 349
         inviteServiceUrl: string,
357 350
         inviteUrl: string,
358 351
         jwt: string,
359 352
         inviteItems: Array<Object>
360
-): Promise<void> {
353
+): Promise<any> {
361 354
 
362 355
     if (!inviteItems || inviteItems.length === 0) {
363 356
         return Promise.resolve();
364 357
     }
365 358
 
366 359
     return fetch(
367
-           `${inviteServiceUrl}?token=${jwt}`,
368
-           {
369
-               body: JSON.stringify({
370
-                   'invited': inviteItems,
371
-                   'url': inviteUrl
372
-               }),
373
-               method: 'POST',
374
-               headers: {
375
-                   'Content-Type': 'application/json'
376
-               }
377
-           }
360
+        `${inviteServiceUrl}?token=${jwt}`,
361
+        {
362
+            body: JSON.stringify({
363
+                'invited': inviteItems,
364
+                'url': inviteUrl
365
+            }),
366
+            method: 'POST',
367
+            headers: {
368
+                'Content-Type': 'application/json'
369
+            }
370
+        }
378 371
     );
379 372
 }
380 373
 
381 374
 /**
382 375
  * Determines if adding people is currently enabled.
383 376
  *
384
- * @param {boolean} state - Current state.
377
+ * @param {IReduxState} state - Current state.
385 378
  * @returns {boolean} Indication of whether adding people is currently enabled.
386 379
  */
387
-export function isAddPeopleEnabled(state: Object): boolean {
380
+export function isAddPeopleEnabled(state: IReduxState): boolean {
388 381
     const { peopleSearchUrl } = state['features/base/config'];
389 382
 
390
-    return state['features/base/jwt'].jwt && Boolean(peopleSearchUrl) && !isVpaasMeeting(state);
383
+    return Boolean(state['features/base/jwt'].jwt && Boolean(peopleSearchUrl) && !isVpaasMeeting(state));
391 384
 }
392 385
 
393 386
 /**
394 387
  * Determines if dial out is currently enabled or not.
395 388
  *
396
- * @param {boolean} state - Current state.
389
+ * @param {IReduxState} state - Current state.
397 390
  * @returns {boolean} Indication of whether dial out is currently enabled.
398 391
  */
399
-export function isDialOutEnabled(state: Object): boolean {
392
+export function isDialOutEnabled(state: IReduxState): boolean {
400 393
     const { conference } = state['features/base/conference'];
401 394
 
402 395
     return isLocalParticipantModerator(state)
@@ -406,10 +399,10 @@ export function isDialOutEnabled(state: Object): boolean {
406 399
 /**
407 400
  * Determines if inviting sip endpoints is enabled or not.
408 401
  *
409
- * @param {Object} state - Current state.
402
+ * @param {IReduxState} state - Current state.
410 403
  * @returns {boolean} Indication of whether dial out is currently enabled.
411 404
  */
412
-export function isSipInviteEnabled(state: Object): boolean {
405
+export function isSipInviteEnabled(state: IReduxState): boolean {
413 406
     const { sipInviteUrl } = state['features/base/config'];
414 407
 
415 408
     return isJwtFeatureEnabled(state, 'sip-outbound-call') && Boolean(sipInviteUrl);
@@ -473,7 +466,7 @@ export function searchDirectory( // eslint-disable-line max-params
473 466
         jwt: string,
474 467
         text: string,
475 468
         queryTypes: Array<string> = [ 'conferenceRooms', 'user', 'room' ]
476
-): Promise<Array<Object>> {
469
+): Promise<Array<{ type: string; }>> {
477 470
 
478 471
     const query = encodeURIComponent(text);
479 472
     const queryTypesString = encodeURIComponent(JSON.stringify(queryTypes));
@@ -502,14 +495,13 @@ export function searchDirectory( // eslint-disable-line max-params
502 495
  * Returns descriptive text that can be used to invite participants to a meeting
503 496
  * (share via mobile or use it for calendar event description).
504 497
  *
505
- * @param {Object} state - The current state.
498
+ * @param {IReduxState} state - The current state.
506 499
  * @param {string} inviteUrl - The conference/location URL.
507 500
  * @param {boolean} useHtml - Whether to return html text.
508 501
  * @returns {Promise<string>} A {@code Promise} resolving with a
509 502
  * descriptive text that can be used to invite participants to a meeting.
510 503
  */
511
-export function getShareInfoText(
512
-        state: Object, inviteUrl: string, useHtml: ?boolean): Promise<string> {
504
+export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?: boolean): Promise<string> {
513 505
     let roomUrl = _decodeRoomURI(inviteUrl);
514 506
     const includeDialInfo = state['features/base/config'] !== undefined;
515 507
 
@@ -534,7 +526,7 @@ export function getShareInfoText(
534 526
             const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
535 527
                 = state['features/base/config'];
536 528
             const { locationURL = {} } = state['features/base/connection'];
537
-            const mucURL = hosts && hosts.muc;
529
+            const mucURL = hosts?.muc;
538 530
 
539 531
             if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
540 532
                 // URLs for fetching dial in numbers not defined
@@ -542,7 +534,7 @@ export function getShareInfoText(
542 534
             }
543 535
 
544 536
             numbersPromise = Promise.all([
545
-                getDialInNumbers(dialInNumbersUrl, room, mucURL),
537
+                getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore
546 538
                 getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)
547 539
             ]).then(([ numbers, {
548 540
                 conference, id, message } ]) => {
@@ -592,16 +584,16 @@ export function getShareInfoText(
592 584
 /**
593 585
  * Generates the URL for the static dial in info page.
594 586
  *
595
- * @param {Object} state - The state from the Redux store.
587
+ * @param {IReduxState} state - The state from the Redux store.
596 588
  * @param {string?} roomName - The conference name. Optional name, if missing will be extracted from state.
597 589
  * @returns {string}
598 590
  */
599
-export function getDialInfoPageURL(state: Object, roomName: ?string) {
591
+export function getDialInfoPageURL(state: IReduxState, roomName?: string) {
600 592
     const { didPageUrl } = state['features/dynamic-branding'];
601 593
     const conferenceName = roomName ?? getRoomName(state);
602 594
     const { locationURL } = state['features/base/connection'];
603
-    const { href } = locationURL;
604
-    const room = _decodeRoomURI(conferenceName);
595
+    const { href = '' } = locationURL ?? {};
596
+    const room = _decodeRoomURI(conferenceName ?? '');
605 597
 
606 598
     const url = didPageUrl || `${href.substring(0, href.lastIndexOf('/'))}/${DIAL_IN_INFO_PAGE_PATH_NAME}`;
607 599
 
@@ -615,7 +607,7 @@ export function getDialInfoPageURL(state: Object, roomName: ?string) {
615 607
  * @returns {string}
616 608
  */
617 609
 export function getDialInfoPageURLForURIString(
618
-        uri: ?string) {
610
+        uri?: string) {
619 611
     if (!uri) {
620 612
         return undefined;
621 613
     }
@@ -637,7 +629,7 @@ export function getDialInfoPageURLForURIString(
637 629
  * @param {Object} dialIn - Dial in information.
638 630
  * @returns {boolean}
639 631
  */
640
-export function shouldDisplayDialIn(dialIn: Object) {
632
+export function shouldDisplayDialIn(dialIn: any) {
641 633
     const { conferenceID, numbers, numbersEnabled } = dialIn;
642 634
     const phoneNumber = _getDefaultPhoneNumber(numbers);
643 635
 
@@ -656,7 +648,7 @@ export function shouldDisplayDialIn(dialIn: Object) {
656 648
  * @private
657 649
  * @returns {boolean}
658 650
  */
659
-export function hasMultipleNumbers(dialInNumbers: ?Object) {
651
+export function hasMultipleNumbers(dialInNumbers?: { numbers: Object; } | string[]) {
660 652
     if (!dialInNumbers) {
661 653
         return false;
662 654
     }
@@ -682,7 +674,7 @@ export function hasMultipleNumbers(dialInNumbers: ?Object) {
682 674
  * @returns {string|null}
683 675
  */
684 676
 export function _getDefaultPhoneNumber(
685
-        dialInNumbers: ?Object): ?string {
677
+        dialInNumbers?: { numbers: any; } | Array<{ default: string; formattedNumber: string; }>): string | null {
686 678
 
687 679
     if (!dialInNumbers) {
688 680
         return null;
@@ -743,22 +735,23 @@ export function _decodeRoomURI(url: string) {
743 735
 /**
744 736
  * Returns the stored conference id.
745 737
  *
746
- * @param {Object | Function} stateful - The Object or Function that can be
738
+ * @param {IStateful} stateful - The Object or Function that can be
747 739
  * resolved to a Redux state object with the toState function.
748 740
  * @returns {string}
749 741
  */
750
-export function getConferenceId(stateful: Object | Function) {
742
+export function getConferenceId(stateful: IStateful) {
751 743
     return toState(stateful)['features/invite'].conferenceID;
752 744
 }
753 745
 
754 746
 /**
755 747
  * Returns the default dial in number from the store.
756 748
  *
757
- * @param {Object | Function} stateful - The Object or Function that can be
749
+ * @param {IStateful} stateful - The Object or Function that can be
758 750
  * resolved to a Redux state object with the toState function.
759 751
  * @returns {string | null}
760 752
  */
761
-export function getDefaultDialInNumber(stateful: Object | Function) {
753
+export function getDefaultDialInNumber(stateful: IStateful) {
754
+    // @ts-ignore
762 755
     return _getDefaultPhoneNumber(toState(stateful)['features/invite'].numbers);
763 756
 }
764 757
 
@@ -831,14 +824,14 @@ export function isSharingEnabled(sharingFeature: string) {
831 824
  * @returns {Promise} - The promise created by the request.
832 825
  */
833 826
 export function inviteSipEndpoints( // eslint-disable-line max-params
834
-        inviteItems: Array<Object>,
827
+        inviteItems: Array<{ address: string; }>,
835 828
         locationURL: URL,
836 829
         sipInviteUrl: string,
837 830
         jwt: string,
838 831
         roomName: string,
839 832
         roomPassword: String,
840 833
         displayName: string
841
-): Promise<void> {
834
+): Promise<any> {
842 835
     if (inviteItems.length === 0) {
843 836
         return Promise.resolve();
844 837
     }
@@ -851,26 +844,26 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
851 844
     });
852 845
 
853 846
     return fetch(
854
-       sipInviteUrl,
855
-       {
856
-           body: JSON.stringify({
857
-               callParams: {
858
-                   callUrlInfo: {
859
-                       baseUrl,
860
-                       callName: roomName
861
-                   },
862
-                   passcode: roomPassword
863
-               },
864
-               sipClientParams: {
865
-                   displayName,
866
-                   sipAddress: inviteItems.map(item => item.address)
867
-               }
868
-           }),
869
-           method: 'POST',
870
-           headers: {
871
-               'Authorization': `Bearer ${jwt}`,
872
-               'Content-Type': 'application/json'
873
-           }
874
-       }
847
+        sipInviteUrl,
848
+        {
849
+            body: JSON.stringify({
850
+                callParams: {
851
+                    callUrlInfo: {
852
+                        baseUrl,
853
+                        callName: roomName
854
+                    },
855
+                    passcode: roomPassword
856
+                },
857
+                sipClientParams: {
858
+                    displayName,
859
+                    sipAddress: inviteItems.map(item => item.address)
860
+                }
861
+            }),
862
+            method: 'POST',
863
+            headers: {
864
+                'Authorization': `Bearer ${jwt}`,
865
+                'Content-Type': 'application/json'
866
+            }
867
+        }
875 868
     );
876 869
 }

react/features/invite/middleware.any.js → react/features/invite/middleware.any.ts Wyświetl plik

@@ -1,27 +1,28 @@
1
-// @flow
1
+import { AnyAction } from 'redux';
2 2
 
3
-import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
4
-import {
5
-    CONFERENCE_JOINED
6
-} from '../base/conference';
3
+import { IStore } from '../app/types';
4
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app/actionTypes';
5
+import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
7 6
 import {
8 7
     PARTICIPANT_JOINED,
9
-    PARTICIPANT_JOINED_SOUND_ID,
10 8
     PARTICIPANT_LEFT,
11
-    PARTICIPANT_UPDATED,
9
+    PARTICIPANT_UPDATED
10
+} from '../base/participants/actionTypes';
11
+import { pinParticipant } from '../base/participants/actions';
12
+import { PARTICIPANT_JOINED_SOUND_ID } from '../base/participants/constants';
13
+import {
12 14
     getLocalParticipant,
13 15
     getParticipantCount,
14 16
     getParticipantPresenceStatus,
15
-    getRemoteParticipants,
16
-    pinParticipant
17
-} from '../base/participants';
18
-import { MiddlewareRegistry } from '../base/redux';
17
+    getRemoteParticipants
18
+} from '../base/participants/functions';
19
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
19 20
 import {
20 21
     playSound,
21 22
     registerSound,
22 23
     stopSound,
23 24
     unregisterSound
24
-} from '../base/sounds';
25
+} from '../base/sounds/actions';
25 26
 import {
26 27
     CALLING,
27 28
     CONNECTED_USER,
@@ -29,7 +30,7 @@ import {
29 30
     INVITED,
30 31
     REJECTED,
31 32
     RINGING
32
-} from '../presence-status';
33
+} from '../presence-status/constants';
33 34
 
34 35
 import {
35 36
     SET_CALLEE_INFO_VISIBLE,
@@ -49,8 +50,6 @@ import {
49 50
 import logger from './logger';
50 51
 import { sounds } from './sounds';
51 52
 
52
-declare var interfaceConfig: Object;
53
-
54 53
 /**
55 54
  * Maps the presence status with the ID of the sound that will be played when
56 55
  * the status is received.
@@ -84,7 +83,7 @@ MiddlewareRegistry.register(store => next => action => {
84 83
 
85 84
     if (action.type === SET_CALLEE_INFO_VISIBLE) {
86 85
         if (action.calleeInfoVisible) {
87
-            dispatch(pinParticipant(getLocalParticipant(state).id));
86
+            dispatch(pinParticipant(getLocalParticipant(state)?.id));
88 87
         } else {
89 88
             // unpin participant
90 89
             dispatch(pinParticipant());
@@ -124,10 +123,10 @@ MiddlewareRegistry.register(store => next => action => {
124 123
 
125 124
         const oldSoundId
126 125
             = oldParticipantPresence
127
-                && statusToRingtone[oldParticipantPresence];
126
+            && statusToRingtone[oldParticipantPresence as keyof typeof statusToRingtone];
128 127
         const newSoundId
129 128
             = newParticipantPresence
130
-                && statusToRingtone[newParticipantPresence];
129
+            && statusToRingtone[newParticipantPresence as keyof typeof statusToRingtone];
131 130
 
132 131
 
133 132
         if (oldSoundId === newSoundId) {
@@ -159,10 +158,10 @@ MiddlewareRegistry.register(store => next => action => {
159 158
  * (not poltergeist, shared video, etc.) participants in the call.
160 159
  *
161 160
  * @param {Object} action - The redux action.
162
- * @param {ReduxStore} store - The redux store.
161
+ * @param {IStore} store - The redux store.
163 162
  * @returns {void}
164 163
  */
165
-function _maybeHideCalleeInfo(action, store) {
164
+function _maybeHideCalleeInfo(action: AnyAction, store: IStore) {
166 165
     const state = store.getState();
167 166
 
168 167
     if (!state['features/invite'].calleeInfoVisible) {
@@ -188,10 +187,10 @@ function _maybeHideCalleeInfo(action, store) {
188 187
 /**
189 188
  * Executes the pending invitation requests if any.
190 189
  *
191
- * @param {ReduxStore} store - The redux store.
190
+ * @param {IStore} store - The redux store.
192 191
  * @returns {void}
193 192
  */
194
-function _onConferenceJoined(store) {
193
+function _onConferenceJoined(store: IStore) {
195 194
     const { dispatch, getState } = store;
196 195
 
197 196
     const pendingInviteRequests

react/features/invite/middleware.native.js → react/features/invite/middleware.native.ts Wyświetl plik


react/features/invite/middleware.web.js → react/features/invite/middleware.web.ts Wyświetl plik

@@ -1,10 +1,11 @@
1
-// @flow
1
+import { AnyAction } from 'redux';
2 2
 
3
-import { hideDialog, openDialog } from '../base/dialog';
4
-import { MiddlewareRegistry } from '../base/redux';
3
+import { IStore } from '../app/types';
4
+import { hideDialog, openDialog } from '../base/dialog/actions';
5
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
5 6
 
6 7
 import { BEGIN_ADD_PEOPLE, HIDE_ADD_PEOPLE_DIALOG } from './actionTypes';
7
-import { AddPeopleDialog } from './components';
8
+import AddPeopleDialog from './components/add-people-dialog/web/AddPeopleDialog';
8 9
 import './middleware.any';
9 10
 
10 11
 /**
@@ -37,7 +38,7 @@ MiddlewareRegistry.register(store => next => action => {
37 38
  * @private
38 39
  * @returns {*} The value returned by {@code next(action)}.
39 40
  */
40
-function _beginAddPeople({ dispatch }, next, action) {
41
+function _beginAddPeople({ dispatch }: IStore, next: Function, action: AnyAction) {
41 42
     const result = next(action);
42 43
 
43 44
     dispatch(openDialog(AddPeopleDialog));
@@ -58,7 +59,7 @@ function _beginAddPeople({ dispatch }, next, action) {
58 59
  * @private
59 60
  * @returns {*} The value returned by {@code next(action)}.
60 61
  */
61
-function _hideAddPeopleDialog({ dispatch }, next, action) {
62
+function _hideAddPeopleDialog({ dispatch }: IStore, next: Function, action: AnyAction) {
62 63
     dispatch(hideDialog(AddPeopleDialog));
63 64
 
64 65
     return next(action);

+ 3
- 2
react/features/invite/reducer.ts Wyświetl plik

@@ -8,6 +8,7 @@ import {
8 8
     UPDATE_DIAL_IN_NUMBERS_SUCCESS
9 9
 } from './actionTypes';
10 10
 import logger from './logger';
11
+import { IInvitee } from './types';
11 12
 
12 13
 const DEFAULT_STATE = {
13 14
     /**
@@ -27,12 +28,12 @@ export interface IInviteState {
27 28
     conferenceID?: string | number;
28 29
     error?: Error;
29 30
     initialCalleeInfo?: Object;
30
-    numbers?: string;
31
+    numbers?: string[];
31 32
     numbersEnabled: boolean;
32 33
     numbersFetched: boolean;
33 34
     pendingInviteRequests: Array<{
34 35
         callback: Function;
35
-        invitees: Array<Object>;
36
+        invitees: IInvitee[];
36 37
     }>;
37 38
     sipUri?: string;
38 39
 }

react/features/invite/sounds.js → react/features/invite/sounds.ts Wyświetl plik


+ 5
- 0
react/features/invite/types.ts Wyświetl plik

@@ -0,0 +1,5 @@
1
+export interface IInvitee {
2
+    address: string;
3
+    number: string;
4
+    type: string;
5
+}

+ 2
- 2
react/features/prejoin/actions.web.ts Wyświetl plik

@@ -92,7 +92,7 @@ function pollForStatus(
92 92
                 return;
93 93
             }
94 94
 
95
-            const res = await executeDialOutStatusRequest(getDialOutStatusUrl(state), reqId);
95
+            const res = await executeDialOutStatusRequest(getDialOutStatusUrl(state) ?? '', reqId);
96 96
 
97 97
             switch (res) {
98 98
             case DIAL_OUT_STATUS.INITIATED:
@@ -153,7 +153,7 @@ export function dialOut(onSuccess: Function, onFail: Function) {
153 153
     return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) {
154 154
         const state = getState();
155 155
         const reqId = uuidv4();
156
-        const url = getDialOutUrl(state);
156
+        const url = getDialOutUrl(state) ?? '';
157 157
         const conferenceUrl = getDialOutConferenceUrl(state);
158 158
         const phoneNumber = getFullDialOutNumber(state);
159 159
         const countryCode = getDialOutCountry(state).code.toUpperCase();

react/features/recent-list/actions.js → react/features/recent-list/actions.ts Wyświetl plik

@@ -1,5 +1,3 @@
1
-// @flow
2
-
3 1
 import {
4 2
     DELETE_RECENT_LIST_ENTRY,
5 3
     _STORE_CURRENT_CONFERENCE,

react/features/recent-list/functions.native.js → react/features/recent-list/functions.native.ts Wyświetl plik

@@ -1,9 +1,13 @@
1 1
 import {
2 2
     getLocalizedDateFormatter,
3 3
     getLocalizedDurationFormatter
4
-} from '../base/i18n';
4
+} from '../base/i18n/dateUtil';
5
+// eslint-disable-next-line lines-around-comment
6
+// @ts-ignore
5 7
 import { NavigateSectionList } from '../base/react';
6
-import { parseURIString, safeDecodeURIComponent } from '../base/util';
8
+import { parseURIString, safeDecodeURIComponent } from '../base/util/uri';
9
+
10
+import { IRecentItem } from './types';
7 11
 
8 12
 /**
9 13
  * Creates a displayable list item of a recent list entry.
@@ -14,7 +18,8 @@ import { parseURIString, safeDecodeURIComponent } from '../base/util';
14 18
  * @param {Function} t - The translate function.
15 19
  * @returns {Object}
16 20
  */
17
-function toDisplayableItem(item, defaultServerURL, t) {
21
+function toDisplayableItem(item: IRecentItem,
22
+        defaultServerURL: string, t: Function) {
18 23
     const location = parseURIString(item.conference);
19 24
     const baseURL = `${location.protocol}//${location.host}`;
20 25
     const serverName = baseURL === defaultServerURL ? null : location.host;
@@ -43,7 +48,7 @@ function toDisplayableItem(item, defaultServerURL, t) {
43 48
  * @param {number} duration - The item's duration.
44 49
  * @returns {string}
45 50
  */
46
-function _toDurationString(duration) {
51
+function _toDurationString(duration: number) {
47 52
     if (duration) {
48 53
         return getLocalizedDurationFormatter(duration);
49 54
     }
@@ -59,7 +64,7 @@ function _toDurationString(duration) {
59 64
  * @param {Function} t - The translate function.
60 65
  * @returns {string}
61 66
  */
62
-function _toDateString(itemDate, t) {
67
+function _toDateString(itemDate: number, t: Function) {
63 68
     const m = getLocalizedDateFormatter(itemDate);
64 69
     const date = new Date(itemDate);
65 70
     const dateInMs = date.getTime();
@@ -90,7 +95,8 @@ function _toDateString(itemDate, t) {
90 95
  * @param {string} defaultServerURL - The default server URL.
91 96
  * @returns {Array<Object>}
92 97
  */
93
-export function toDisplayableList(recentList, t, defaultServerURL) {
98
+export function toDisplayableList(recentList: IRecentItem[],
99
+        t: Function, defaultServerURL: string) {
94 100
     const { createSection } = NavigateSectionList;
95 101
     const todaySection = createSection(t('dateUtils.today'), 'today');
96 102
     const yesterdaySection

react/features/recent-list/functions.web.js → react/features/recent-list/functions.web.ts Wyświetl plik

@@ -1,6 +1,4 @@
1
-/* global interfaceConfig */
2
-
3
-import { parseURIString, safeDecodeURIComponent } from '../base/util';
1
+import { parseURIString, safeDecodeURIComponent } from '../base/util/uri';
4 2
 
5 3
 
6 4
 /**
@@ -10,7 +8,7 @@ import { parseURIString, safeDecodeURIComponent } from '../base/util';
10 8
  * @param {Array<Object>} recentList - The recent list form the redux store.
11 9
  * @returns {Array<Object>}
12 10
  */
13
-export function toDisplayableList(recentList) {
11
+export function toDisplayableList(recentList: Array<{ conference: string; date: Date; duration: number; }>) {
14 12
     return (
15 13
         [ ...recentList ].reverse()
16 14
             .map(item => {

react/features/recent-list/logger.js → react/features/recent-list/logger.ts Wyświetl plik

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

react/features/recent-list/middleware.js → react/features/recent-list/middleware.ts Wyświetl plik

@@ -1,21 +1,17 @@
1
-// @flow
2
-
3
-import { APP_WILL_MOUNT } from '../base/app';
4
-import {
5
-    CONFERENCE_WILL_LEAVE,
6
-    JITSI_CONFERENCE_URL_KEY,
7
-    SET_ROOM
8
-} from '../base/conference';
9
-import { addKnownDomains } from '../base/known-domains';
10
-import { MiddlewareRegistry } from '../base/redux';
11
-import { parseURIString } from '../base/util';
1
+import { AnyAction } from 'redux';
2
+
3
+import { IStore } from '../app/types';
4
+import { APP_WILL_MOUNT } from '../base/app/actionTypes';
5
+import { CONFERENCE_WILL_LEAVE, SET_ROOM } from '../base/conference/actionTypes';
6
+import { JITSI_CONFERENCE_URL_KEY } from '../base/conference/constants';
7
+import { addKnownDomains } from '../base/known-domains/actions';
8
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
12 9
 import { inIframe } from '../base/util/iframeUtils';
10
+import { parseURIString } from '../base/util/uri';
13 11
 
14 12
 import { _storeCurrentConference, _updateConferenceDuration } from './actions';
15 13
 import { isRecentListEnabled } from './functions';
16 14
 
17
-declare var APP: Object;
18
-
19 15
 /**
20 16
  * Middleware that captures joined rooms so they can be saved into
21 17
  * {@code window.localStorage}.
@@ -53,7 +49,7 @@ MiddlewareRegistry.register(store => next => action => {
53 49
  * @private
54 50
  * @returns {*} The result returned by {@code next(action)}.
55 51
  */
56
-function _appWillMount({ dispatch, getState }, next, action) {
52
+function _appWillMount({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
57 53
     const result = next(action);
58 54
 
59 55
     // It's an opportune time to transfer the feature recent-list's knowledge
@@ -86,7 +82,7 @@ function _appWillMount({ dispatch, getState }, next, action) {
86 82
  * @private
87 83
  * @returns {*} The result returned by {@code next(action)}.
88 84
  */
89
-function _conferenceWillLeave({ dispatch, getState }, next, action) {
85
+function _conferenceWillLeave({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
90 86
     const { doNotStoreRoom } = getState()['features/base/config'];
91 87
 
92 88
     if (!doNotStoreRoom && !inIframe()) {
@@ -126,7 +122,7 @@ function _conferenceWillLeave({ dispatch, getState }, next, action) {
126 122
  * @private
127 123
  * @returns {*} The result returned by {@code next(action)}.
128 124
  */
129
-function _setRoom({ dispatch, getState }, next, action) {
125
+function _setRoom({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
130 126
     const { doNotStoreRoom } = getState()['features/base/config'];
131 127
 
132 128
     if (!doNotStoreRoom && !inIframe() && action.room) {

+ 5
- 0
react/features/recent-list/types.ts Wyświetl plik

@@ -0,0 +1,5 @@
1
+export interface IRecentItem {
2
+    conference: string;
3
+    date: number;
4
+    duration: number;
5
+}

react/features/screenshot-capture/actions.js → react/features/screenshot-capture/actions.ts Wyświetl plik

@@ -1,13 +1,14 @@
1
-// @flow
2
-
3
-import { getLocalJitsiDesktopTrack, getLocalJitsiVideoTrack } from '../../features/base/tracks';
4
-import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config';
1
+import { IStore } from '../app/types';
2
+import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config/functions';
3
+import { getLocalJitsiDesktopTrack, getLocalJitsiVideoTrack } from '../base/tracks/functions';
5 4
 
6 5
 import { SET_SCREENSHOT_CAPTURE } from './actionTypes';
6
+// eslint-disable-next-line lines-around-comment
7
+// @ts-ignore
7 8
 import { createScreenshotCaptureSummary } from './functions';
8 9
 import logger from './logger';
9 10
 
10
-let screenshotSummary;
11
+let screenshotSummary: any;
11 12
 
12 13
 /**
13 14
  * Marks the on-off state of screenshot captures.
@@ -18,7 +19,7 @@ let screenshotSummary;
18 19
     *      payload: enabled
19 20
     * }}
20 21
 */
21
-function setScreenshotCapture(enabled) {
22
+function setScreenshotCapture(enabled: boolean) {
22 23
     return {
23 24
         type: SET_SCREENSHOT_CAPTURE,
24 25
         payload: enabled
@@ -32,7 +33,7 @@ function setScreenshotCapture(enabled) {
32 33
 * @returns {Promise}
33 34
 */
34 35
 export function toggleScreenshotCaptureSummary(enabled: boolean) {
35
-    return async function(dispatch: (Object) => Object, getState: () => any) {
36
+    return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) {
36 37
         const state = getState();
37 38
 
38 39
         if (state['features/screenshot-capture'].capturesEnabled !== enabled) {

react/features/screenshot-capture/logger.js → react/features/screenshot-capture/logger.ts Wyświetl plik

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

react/features/share-room/middleware.js → react/features/share-room/middleware.ts Wyświetl plik

@@ -1,10 +1,9 @@
1
-// @flow
2
-
3 1
 import { Share } from 'react-native';
4 2
 
5
-import { getName } from '../app/functions';
6
-import { MiddlewareRegistry } from '../base/redux';
7
-import { getShareInfoText } from '../invite';
3
+import { getName } from '../app/functions.native';
4
+import { IStore } from '../app/types';
5
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
6
+import { getShareInfoText } from '../invite/functions';
8 7
 
9 8
 import { BEGIN_SHARE_ROOM } from './actionTypes';
10 9
 import { endShareRoom } from './actions';
@@ -35,7 +34,7 @@ MiddlewareRegistry.register(store => next => action => {
35 34
  * @private
36 35
  * @returns {void}
37 36
  */
38
-function _shareRoom(roomURL: string, { dispatch, getState }) {
37
+function _shareRoom(roomURL: string, { dispatch, getState }: IStore) {
39 38
     getShareInfoText(getState(), roomURL)
40 39
         .then(message => {
41 40
             const title = `${getName()} Conference`;

+ 1
- 0
tsconfig.web.json Wyświetl plik

@@ -16,6 +16,7 @@
16 16
     },
17 17
     "exclude": [
18 18
         "node_modules",
19
+        "react/features/share-room",
19 20
         "**/mobile/*",
20 21
         "**/native/*",
21 22
         "**/*.native.ts",

Ładowanie…
Anuluj
Zapisz