소스 검색

ref(TS) Convert some Abstract classes to TS (#13095)

factor2
Robert Pintilii 2 년 전
부모
커밋
bc1827fb4a
No account linked to committer's email address

+ 1
- 1
react/features/analytics/AnalyticsEvents.ts 파일 보기

887
  * @returns {Object} The event in a format suitable for sending via
887
  * @returns {Object} The event in a format suitable for sending via
888
  * sendAnalytics.
888
  * sendAnalytics.
889
  */
889
  */
890
-export function createWelcomePageEvent(action: string, actionSubject: string, attributes = {}) {
890
+export function createWelcomePageEvent(action: string, actionSubject?: string, attributes = {}) {
891
     return {
891
     return {
892
         action,
892
         action,
893
         actionSubject,
893
         actionSubject,

+ 2
- 0
react/features/base/conference/reducer.ts 파일 보기

93
     setReceiverConstraints: Function;
93
     setReceiverConstraints: Function;
94
     setSenderVideoConstraint: Function;
94
     setSenderVideoConstraint: Function;
95
     setSubject: Function;
95
     setSubject: Function;
96
+    startRecording: Function;
96
     startVerification: Function;
97
     startVerification: Function;
98
+    stopRecording: Function;
97
 }
99
 }
98
 
100
 
99
 export interface IConferenceState {
101
 export interface IConferenceState {

react/features/chat/components/AbstractChat.js → react/features/chat/components/AbstractChat.ts 파일 보기

1
-// @flow
2
-
3
 import { Component } from 'react';
1
 import { Component } from 'react';
4
-import type { Dispatch } from 'redux';
2
+import { WithTranslation } from 'react-i18next';
5
 
3
 
6
-import { getLocalParticipant } from '../../base/participants';
4
+import { IReduxState, IStore } from '../../app/types';
5
+import { getLocalParticipant } from '../../base/participants/functions';
7
 import { sendMessage, setIsPollsTabFocused } from '../actions';
6
 import { sendMessage, setIsPollsTabFocused } from '../actions';
8
 import { SMALL_WIDTH_THRESHOLD } from '../constants';
7
 import { SMALL_WIDTH_THRESHOLD } from '../constants';
9
 
8
 
10
 /**
9
 /**
11
  * The type of the React {@code Component} props of {@code AbstractChat}.
10
  * The type of the React {@code Component} props of {@code AbstractChat}.
12
  */
11
  */
13
-export type Props = {
12
+export interface IProps extends WithTranslation {
14
 
13
 
15
     /**
14
     /**
16
      * Whether the chat is opened in a modal or not (computed based on window width).
15
      * Whether the chat is opened in a modal or not (computed based on window width).
17
      */
16
      */
18
-    _isModal: boolean,
17
+    _isModal: boolean;
19
 
18
 
20
     /**
19
     /**
21
      * True if the chat window should be rendered.
20
      * True if the chat window should be rendered.
22
      */
21
      */
23
-    _isOpen: boolean,
22
+    _isOpen: boolean;
24
 
23
 
25
     /**
24
     /**
26
      * True if the polls feature is enabled.
25
      * True if the polls feature is enabled.
27
      */
26
      */
28
-    _isPollsEnabled: boolean,
27
+    _isPollsEnabled: boolean;
29
 
28
 
30
     /**
29
     /**
31
      * Whether the poll tab is focused or not.
30
      * Whether the poll tab is focused or not.
32
      */
31
      */
33
-    _isPollsTabFocused: boolean,
32
+    _isPollsTabFocused: boolean;
34
 
33
 
35
     /**
34
     /**
36
      * All the chat messages in the conference.
35
      * All the chat messages in the conference.
37
      */
36
      */
38
-    _messages: Array<Object>,
37
+    _messages: Array<Object>;
39
 
38
 
40
     /**
39
     /**
41
      * Number of unread chat messages.
40
      * Number of unread chat messages.
42
      */
41
      */
43
-    _nbUnreadMessages: number,
42
+    _nbUnreadMessages: number;
44
 
43
 
45
     /**
44
     /**
46
      * Number of unread poll messages.
45
      * Number of unread poll messages.
47
      */
46
      */
48
-    _nbUnreadPolls: number,
47
+    _nbUnreadPolls: number;
49
 
48
 
50
     /**
49
     /**
51
      * Function to send a text message.
50
      * Function to send a text message.
52
      *
51
      *
53
      * @protected
52
      * @protected
54
      */
53
      */
55
-    _onSendMessage: Function,
54
+    _onSendMessage: Function;
55
+
56
+    /**
57
+     * Function to toggle the chat window.
58
+     */
59
+    _onToggleChat: Function;
56
 
60
 
57
     /**
61
     /**
58
      * Function to display the chat tab.
62
      * Function to display the chat tab.
59
      *
63
      *
60
      * @protected
64
      * @protected
61
      */
65
      */
62
-    _onToggleChatTab: Function,
66
+    _onToggleChatTab: Function;
63
 
67
 
64
     /**
68
     /**
65
      * Function to display the polls tab.
69
      * Function to display the polls tab.
66
      *
70
      *
67
      * @protected
71
      * @protected
68
      */
72
      */
69
-    _onTogglePollsTab: Function,
70
-
71
-    /**
72
-     * Function to toggle the chat window.
73
-     */
74
-    _onToggleChat: Function,
73
+    _onTogglePollsTab: Function;
75
 
74
 
76
     /**
75
     /**
77
      * Whether or not to block chat access with a nickname input form.
76
      * Whether or not to block chat access with a nickname input form.
78
      */
77
      */
79
-    _showNamePrompt: boolean,
78
+    _showNamePrompt: boolean;
80
 
79
 
81
     /**
80
     /**
82
      * The Redux dispatch function.
81
      * The Redux dispatch function.
83
      */
82
      */
84
-    dispatch: Dispatch<any>,
85
-
86
-    /**
87
-     * Function to be used to translate i18n labels.
88
-     */
89
-    t: Function,
90
-};
83
+    dispatch: IStore['dispatch'];
84
+}
91
 
85
 
92
 /**
86
 /**
93
  * Implements an abstract chat panel.
87
  * Implements an abstract chat panel.
94
  */
88
  */
95
-export default class AbstractChat<P: Props> extends Component<P> {
89
+export default class AbstractChat<P extends IProps> extends Component<P> {
96
 
90
 
97
     /**
91
     /**
98
      * Initializes a new {@code AbstractChat} instance.
92
      * Initializes a new {@code AbstractChat} instance.
109
         this._onTogglePollsTab = this._onTogglePollsTab.bind(this);
103
         this._onTogglePollsTab = this._onTogglePollsTab.bind(this);
110
     }
104
     }
111
 
105
 
112
-    _onSendMessage: (string) => void;
113
-
114
     /**
106
     /**
115
     * Sends a text message.
107
     * Sends a text message.
116
     *
108
     *
123
         this.props.dispatch(sendMessage(text));
115
         this.props.dispatch(sendMessage(text));
124
     }
116
     }
125
 
117
 
126
-    _onToggleChatTab: () => void;
127
-
128
     /**
118
     /**
129
      * Display the Chat tab.
119
      * Display the Chat tab.
130
      *
120
      *
135
         this.props.dispatch(setIsPollsTabFocused(false));
125
         this.props.dispatch(setIsPollsTabFocused(false));
136
     }
126
     }
137
 
127
 
138
-    _onTogglePollsTab: () => void;
139
-
140
     /**
128
     /**
141
      * Display the Polls tab.
129
      * Display the Polls tab.
142
      *
130
      *
160
  *     _showNamePrompt: boolean
148
  *     _showNamePrompt: boolean
161
  * }}
149
  * }}
162
  */
150
  */
163
-export function _mapStateToProps(state: Object) {
151
+export function _mapStateToProps(state: IReduxState) {
164
     const { isOpen, isPollsTabFocused, messages, nbUnreadMessages } = state['features/chat'];
152
     const { isOpen, isPollsTabFocused, messages, nbUnreadMessages } = state['features/chat'];
165
     const { nbUnreadPolls } = state['features/polls'];
153
     const { nbUnreadPolls } = state['features/polls'];
166
     const _localParticipant = getLocalParticipant(state);
154
     const _localParticipant = getLocalParticipant(state);

react/features/recording/components/AbstractRecordingLabel.js → react/features/recording/components/AbstractRecordingLabel.ts 파일 보기

1
-// @flow
2
-
3
-import { Component } from 'react';
1
+import React, { Component } from 'react';
2
+import { WithTranslation } from 'react-i18next';
4
 
3
 
4
+import { IReduxState } from '../../app/types';
5
 import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
5
 import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
6
 import { getSessionStatusToShow } from '../functions';
6
 import { getSessionStatusToShow } from '../functions';
7
 
7
 
13
  * running. These boolean are shared across the two components to make it
13
  * running. These boolean are shared across the two components to make it
14
  * easier to align web's behaviour to mobile's later if necessary.
14
  * easier to align web's behaviour to mobile's later if necessary.
15
  */
15
  */
16
-type Props = {
16
+interface IProps extends WithTranslation {
17
 
17
 
18
     /**
18
     /**
19
      * Whether this is the Jibri recorder participant.
19
      * Whether this is the Jibri recorder participant.
20
      */
20
      */
21
-    _iAmRecorder: boolean,
21
+    _iAmRecorder: boolean;
22
 
22
 
23
     /**
23
     /**
24
      * The status of the highermost priority session.
24
      * The status of the highermost priority session.
25
      */
25
      */
26
-    _status: ?string,
26
+    _status?: string;
27
 
27
 
28
     /**
28
     /**
29
      * An object containing the CSS classes.
29
      * An object containing the CSS classes.
30
      */
30
      */
31
-    classes: ?{[ key: string]: string},
31
+    classes?: { [ key: string]: string; };
32
 
32
 
33
     /**
33
     /**
34
      * The recording mode this indicator should display.
34
      * The recording mode this indicator should display.
35
      */
35
      */
36
-    mode: string,
37
-
38
-    /**
39
-     * Invoked to obtain translated strings.
40
-     */
41
-    t: Function
42
-};
36
+    mode: string;
37
+}
43
 
38
 
44
 /**
39
 /**
45
  * State of the component.
40
  * State of the component.
46
  */
41
  */
47
-type State = {
42
+interface IState {
48
 
43
 
49
     /**
44
     /**
50
      * True if the label status is stale, so it needs to be removed.
45
      * True if the label status is stale, so it needs to be removed.
51
      */
46
      */
52
-    staleLabel: boolean
53
-};
47
+    staleLabel: boolean;
48
+}
54
 
49
 
55
 /**
50
 /**
56
  * The timeout after a label is considered stale. See {@code _updateStaleStatus}
51
  * The timeout after a label is considered stale. See {@code _updateStaleStatus}
62
  * Abstract class for the {@code RecordingLabel} component.
57
  * Abstract class for the {@code RecordingLabel} component.
63
  */
58
  */
64
 export default class AbstractRecordingLabel
59
 export default class AbstractRecordingLabel
65
-    extends Component<Props, State> {
60
+    extends Component<IProps, IState> {
61
+    _mounted: boolean;
62
+
66
     /**
63
     /**
67
      * Implements {@code Component#getDerivedStateFromProps}.
64
      * Implements {@code Component#getDerivedStateFromProps}.
68
      *
65
      *
69
      * @inheritdoc
66
      * @inheritdoc
70
      */
67
      */
71
-    static getDerivedStateFromProps(props: Props, prevState: State) {
68
+    static getDerivedStateFromProps(props: IProps, prevState: IState) {
72
         return {
69
         return {
73
             staleLabel: props._status !== JitsiRecordingConstants.status.OFF
70
             staleLabel: props._status !== JitsiRecordingConstants.status.OFF
74
                 && prevState.staleLabel ? false : prevState.staleLabel
71
                 && prevState.staleLabel ? false : prevState.staleLabel
80
      *
77
      *
81
      * @inheritdoc
78
      * @inheritdoc
82
      */
79
      */
83
-    constructor(props: Props) {
80
+    constructor(props: IProps) {
84
         super(props);
81
         super(props);
85
 
82
 
86
         this.state = {
83
         this.state = {
87
             staleLabel: true
84
             staleLabel: true
88
         };
85
         };
89
 
86
 
90
-        this._updateStaleStatus({}, props);
87
+        this._updateStaleStatus(undefined, props);
91
     }
88
     }
92
 
89
 
93
     /**
90
     /**
113
      *
110
      *
114
      * @inheritdoc
111
      * @inheritdoc
115
      */
112
      */
116
-    componentDidUpdate(prevProps: Props) {
113
+    componentDidUpdate(prevProps: IProps) {
117
         this._updateStaleStatus(prevProps, this.props);
114
         this._updateStaleStatus(prevProps, this.props);
118
     }
115
     }
119
 
116
 
127
             ? this._renderLabel() : null;
124
             ? this._renderLabel() : null;
128
     }
125
     }
129
 
126
 
130
-    _getLabelKey: () => ?string;
131
-
132
     /**
127
     /**
133
      * Returns the label key that this indicator should render.
128
      * Returns the label key that this indicator should render.
134
      *
129
      *
153
      * @protected
148
      * @protected
154
      * @returns {React$Element}
149
      * @returns {React$Element}
155
      */
150
      */
156
-    _renderLabel: () => React$Element<*>;
151
+    _renderLabel(): React.ReactNode | null {
152
+        return null;
153
+    }
157
 
154
 
158
     /**
155
     /**
159
      * Updates the stale status of the label on a prop change. A label is stale
156
      * Updates the stale status of the label on a prop change. A label is stale
160
      * if it's in a {@code _status} that doesn't need to be rendered anymore.
157
      * if it's in a {@code _status} that doesn't need to be rendered anymore.
161
      *
158
      *
162
-     * @param {Props} oldProps - The previous props of the component.
163
-     * @param {Props} newProps - The new props of the component.
159
+     * @param {IProps} oldProps - The previous props of the component.
160
+     * @param {IProps} newProps - The new props of the component.
164
      * @returns {void}
161
      * @returns {void}
165
      */
162
      */
166
-    _updateStaleStatus(oldProps, newProps) {
163
+    _updateStaleStatus(oldProps: IProps | undefined, newProps: IProps) {
167
         if (newProps._status === JitsiRecordingConstants.status.OFF) {
164
         if (newProps._status === JitsiRecordingConstants.status.OFF) {
168
-            if (oldProps._status !== JitsiRecordingConstants.status.OFF) {
165
+            if (oldProps?._status !== JitsiRecordingConstants.status.OFF) {
169
                 setTimeout(() => {
166
                 setTimeout(() => {
170
                     if (!this._mounted) {
167
                     if (!this._mounted) {
171
                         return;
168
                         return;
189
  * {@code AbstractRecordingLabel}'s props.
186
  * {@code AbstractRecordingLabel}'s props.
190
  *
187
  *
191
  * @param {Object} state - The Redux state.
188
  * @param {Object} state - The Redux state.
192
- * @param {Props} ownProps - The component's own props.
189
+ * @param {IProps} ownProps - The component's own props.
193
  * @private
190
  * @private
194
  * @returns {{
191
  * @returns {{
195
  *     _status: ?string
192
  *     _status: ?string
196
  * }}
193
  * }}
197
  */
194
  */
198
-export function _mapStateToProps(state: Object, ownProps: Props) {
195
+export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
199
     const { mode } = ownProps;
196
     const { mode } = ownProps;
200
 
197
 
201
     return {
198
     return {

react/features/recording/components/LiveStream/AbstractStartLiveStreamDialog.js → react/features/recording/components/LiveStream/AbstractStartLiveStreamDialog.ts 파일 보기

1
-// @flow
2
-
3
 import { Component } from 'react';
1
 import { Component } from 'react';
4
 
2
 
5
-import {
6
-    createLiveStreamingDialogEvent,
7
-    sendAnalytics
8
-} from '../../../analytics';
3
+import { createLiveStreamingDialogEvent } from '../../../analytics/AnalyticsEvents';
4
+import { sendAnalytics } from '../../../analytics/functions';
5
+import { IReduxState } from '../../../app/types';
6
+import { IJitsiConference } from '../../../base/conference/reducer';
9
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
7
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
10
 
8
 
11
 /**
9
 /**
12
  * The type of the React {@code Component} props of
10
  * The type of the React {@code Component} props of
13
  * {@link AbstractStartLiveStreamDialog}.
11
  * {@link AbstractStartLiveStreamDialog}.
14
  */
12
  */
15
-export type Props = {
13
+export interface IProps {
16
 
14
 
17
     /**
15
     /**
18
      * The {@code JitsiConference} for the current conference.
16
      * The {@code JitsiConference} for the current conference.
19
      */
17
      */
20
-    _conference: Object,
18
+    _conference: IJitsiConference;
21
 
19
 
22
     /**
20
     /**
23
      * The current state of interactions with the Google API. Determines what
21
      * The current state of interactions with the Google API. Determines what
24
      * Google related UI should display.
22
      * Google related UI should display.
25
      */
23
      */
26
-    _googleAPIState: number,
24
+    _googleAPIState: number;
27
 
25
 
28
     /**
26
     /**
29
      * The email of the user currently logged in to the Google web client
27
      * The email of the user currently logged in to the Google web client
30
      * application.
28
      * application.
31
      */
29
      */
32
-    _googleProfileEmail: string,
30
+    _googleProfileEmail: string;
33
 
31
 
34
     /**
32
     /**
35
      * The live stream key that was used before.
33
      * The live stream key that was used before.
36
      */
34
      */
37
-    _streamKey: string,
35
+    _streamKey: string;
38
 
36
 
39
     /**
37
     /**
40
      * The Redux dispatch function.
38
      * The Redux dispatch function.
41
      */
39
      */
42
-    dispatch: Function,
40
+    dispatch: Function;
43
 
41
 
44
     /**
42
     /**
45
      * Invoked to obtain translated strings.
43
      * Invoked to obtain translated strings.
46
      */
44
      */
47
-    t: Function
45
+    t: Function;
48
 }
46
 }
49
 
47
 
50
 /**
48
 /**
51
  * The type of the React {@code Component} state of
49
  * The type of the React {@code Component} state of
52
  * {@link AbstractStartLiveStreamDialog}.
50
  * {@link AbstractStartLiveStreamDialog}.
53
  */
51
  */
54
-export type State = {
52
+export interface IState {
55
 
53
 
56
     /**
54
     /**
57
      * Details about the broadcasts available for use for the logged in Google
55
      * Details about the broadcasts available for use for the logged in Google
58
      * user's YouTube account.
56
      * user's YouTube account.
59
      */
57
      */
60
-    broadcasts: ?Array<Object>,
58
+    broadcasts?: Array<any>;
61
 
59
 
62
     /**
60
     /**
63
      * The error type, as provided by Google, for the most recent error
61
      * The error type, as provided by Google, for the most recent error
64
      * encountered by the Google API.
62
      * encountered by the Google API.
65
      */
63
      */
66
-    errorType: ?string,
64
+    errorType?: string;
67
 
65
 
68
     /**
66
     /**
69
      * The boundStreamID of the broadcast currently selected in the broadcast
67
      * The boundStreamID of the broadcast currently selected in the broadcast
70
      * dropdown.
68
      * dropdown.
71
      */
69
      */
72
-    selectedBoundStreamID: ?string,
70
+    selectedBoundStreamID?: string;
73
 
71
 
74
     /**
72
     /**
75
      * The selected or entered stream key to use for YouTube live streaming.
73
      * The selected or entered stream key to use for YouTube live streaming.
76
      */
74
      */
77
-    streamKey: string
78
-};
75
+    streamKey: string;
76
+}
79
 
77
 
80
 /**
78
 /**
81
  * Implements an abstract class for the StartLiveStreamDialog on both platforms.
79
  * Implements an abstract class for the StartLiveStreamDialog on both platforms.
84
  * but the abstraction of its properties are already present in this abstract
82
  * but the abstraction of its properties are already present in this abstract
85
  * class.
83
  * class.
86
  */
84
  */
87
-export default class AbstractStartLiveStreamDialog<P: Props>
88
-    extends Component<P, State> {
85
+export default class AbstractStartLiveStreamDialog<P extends IProps>
86
+    extends Component<P, IState> {
89
     _isMounted: boolean;
87
     _isMounted: boolean;
90
 
88
 
91
     /**
89
     /**
139
         this._isMounted = false;
137
         this._isMounted = false;
140
     }
138
     }
141
 
139
 
142
-    _onCancel: () => boolean;
143
-
144
     /**
140
     /**
145
      * Invokes the passed in {@link onCancel} callback and closes
141
      * Invokes the passed in {@link onCancel} callback and closes
146
      * {@code StartLiveStreamDialog}.
142
      * {@code StartLiveStreamDialog}.
163
      * @private
159
      * @private
164
      * @returns {Promise}
160
      * @returns {Promise}
165
      */
161
      */
166
-    _onGetYouTubeBroadcasts: () => Promise<*>;
167
-
168
-    _onStreamKeyChange: string => void;
162
+    _onGetYouTubeBroadcasts: () => Promise<any>;
169
 
163
 
170
     /**
164
     /**
171
      * Callback invoked to update the {@code StartLiveStreamDialog} component's
165
      * Callback invoked to update the {@code StartLiveStreamDialog} component's
175
      * @private
169
      * @private
176
      * @returns {void}
170
      * @returns {void}
177
      */
171
      */
178
-    _onStreamKeyChange(streamKey) {
172
+    _onStreamKeyChange(streamKey: string) {
179
         this._setStateIfMounted({
173
         this._setStateIfMounted({
180
             streamKey,
174
             streamKey,
181
             selectedBoundStreamID: undefined
175
             selectedBoundStreamID: undefined
182
         });
176
         });
183
     }
177
     }
184
 
178
 
185
-    _onSubmit: () => boolean;
186
-
187
     /**
179
     /**
188
      * Invokes the passed in {@link onSubmit} callback with the entered stream
180
      * Invokes the passed in {@link onSubmit} callback with the entered stream
189
      * key, and then closes {@code StartLiveStreamDialog}.
181
      * key, and then closes {@code StartLiveStreamDialog}.
204
         let selectedBroadcastID = null;
196
         let selectedBroadcastID = null;
205
 
197
 
206
         if (selectedBoundStreamID) {
198
         if (selectedBoundStreamID) {
207
-            const selectedBroadcast = broadcasts && broadcasts.find(
199
+            const selectedBroadcast = broadcasts?.find(
208
                 broadcast => broadcast.boundStreamID === selectedBoundStreamID);
200
                 broadcast => broadcast.boundStreamID === selectedBoundStreamID);
209
 
201
 
210
-            selectedBroadcastID = selectedBroadcast && selectedBroadcast.id;
202
+            selectedBroadcastID = selectedBroadcast?.id;
211
         }
203
         }
212
 
204
 
213
         sendAnalytics(
205
         sendAnalytics(
231
      * @private
223
      * @private
232
      * @returns {void}
224
      * @returns {void}
233
      */
225
      */
234
-    _setStateIfMounted(newState) {
226
+    _setStateIfMounted(newState: IState) {
235
         if (this._isMounted) {
227
         if (this._isMounted) {
236
             this.setState(newState);
228
             this.setState(newState);
237
         }
229
         }
249
  *     _streamKey: string
241
  *     _streamKey: string
250
  * }}
242
  * }}
251
  */
243
  */
252
-export function _mapStateToProps(state: Object) {
244
+export function _mapStateToProps(state: IReduxState) {
253
     return {
245
     return {
254
         _conference: state['features/base/conference'].conference,
246
         _conference: state['features/base/conference'].conference,
255
         _googleAPIState: state['features/google-api'].googleAPIState,
247
         _googleAPIState: state['features/google-api'].googleAPIState,

react/features/recording/components/LiveStream/AbstractStopLiveStreamDialog.js → react/features/recording/components/LiveStream/AbstractStopLiveStreamDialog.ts 파일 보기

1
-// @flow
2
-
3
 import { Component } from 'react';
1
 import { Component } from 'react';
2
+import { WithTranslation } from 'react-i18next';
4
 
3
 
5
-import {
6
-    createLiveStreamingDialogEvent,
7
-    sendAnalytics
8
-} from '../../../analytics';
4
+import { createLiveStreamingDialogEvent } from '../../../analytics/AnalyticsEvents';
5
+import { sendAnalytics } from '../../../analytics/functions';
6
+import { IReduxState } from '../../../app/types';
7
+import { IJitsiConference } from '../../../base/conference/reducer';
9
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
8
 import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
10
 import { getActiveSession } from '../../functions';
9
 import { getActiveSession } from '../../functions';
11
 
10
 
13
  * The type of the React {@code Component} props of
12
  * The type of the React {@code Component} props of
14
  * {@link StopLiveStreamDialog}.
13
  * {@link StopLiveStreamDialog}.
15
  */
14
  */
16
-type Props = {
15
+interface IProps extends WithTranslation {
17
 
16
 
18
     /**
17
     /**
19
      * The {@code JitsiConference} for the current conference.
18
      * The {@code JitsiConference} for the current conference.
20
      */
19
      */
21
-    _conference: Object,
22
-
23
-    /**
24
-     * The redux representation of the live stremaing to be stopped.
25
-     */
26
-    _session: Object,
20
+    _conference: IJitsiConference;
27
 
21
 
28
     /**
22
     /**
29
-     * Invoked to obtain translated strings.
23
+     * The redux representation of the live streaming to be stopped.
30
      */
24
      */
31
-    t: Function
32
-};
25
+    _session: { id: string; };
26
+}
33
 
27
 
34
 /**
28
 /**
35
  * A React Component for confirming the participant wishes to stop the currently
29
  * A React Component for confirming the participant wishes to stop the currently
37
  *
31
  *
38
  * @augments Component
32
  * @augments Component
39
  */
33
  */
40
-export default class AbstractStopLiveStreamDialog extends Component<Props> {
34
+export default class AbstractStopLiveStreamDialog extends Component<IProps> {
41
     /**
35
     /**
42
      * Initializes a new {@code StopLiveStreamDialog} instance.
36
      * Initializes a new {@code StopLiveStreamDialog} instance.
43
      *
37
      *
44
      * @param {Object} props - The read-only properties with which the new
38
      * @param {Object} props - The read-only properties with which the new
45
      * instance is to be initialized.
39
      * instance is to be initialized.
46
      */
40
      */
47
-    constructor(props: Props) {
41
+    constructor(props: IProps) {
48
         super(props);
42
         super(props);
49
 
43
 
50
         // Bind event handler so it is only bound once for every instance.
44
         // Bind event handler so it is only bound once for every instance.
51
         this._onSubmit = this._onSubmit.bind(this);
45
         this._onSubmit = this._onSubmit.bind(this);
52
     }
46
     }
53
 
47
 
54
-    _onSubmit: () => boolean;
55
-
56
     /**
48
     /**
57
      * Callback invoked when stopping of live streaming is confirmed.
49
      * Callback invoked when stopping of live streaming is confirmed.
58
      *
50
      *
83
  *     _session: Object
75
  *     _session: Object
84
  * }}
76
  * }}
85
  */
77
  */
86
-export function _mapStateToProps(state: Object) {
78
+export function _mapStateToProps(state: IReduxState) {
87
     return {
79
     return {
88
         _conference: state['features/base/conference'].conference,
80
         _conference: state['features/base/conference'].conference,
89
         _session: getActiveSession(state, JitsiRecordingConstants.mode.STREAM)
81
         _session: getActiveSession(state, JitsiRecordingConstants.mode.STREAM)

react/features/recording/components/LiveStream/AbstractStreamKeyForm.js → react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts 파일 보기

1
-// @flow
2
-
1
+import { DebouncedFunc } from 'lodash';
3
 import debounce from 'lodash/debounce';
2
 import debounce from 'lodash/debounce';
4
 import { Component } from 'react';
3
 import { Component } from 'react';
4
+import { WithTranslation } from 'react-i18next';
5
+
6
+import { IReduxState } from '../../../app/types';
5
 
7
 
6
 import { getLiveStreaming } from './functions';
8
 import { getLiveStreaming } from './functions';
7
 
9
 
8
 
10
 
9
 export type LiveStreaming = {
11
 export type LiveStreaming = {
10
-    enabled: boolean,
11
-    helpLink: string, // Documentation reference for the live streaming feature.
12
-    termsLink: string, // Terms link
13
-    dataPrivacyLink: string, // Data privacy link
14
-    validatorRegExpString: string // RegExp string that validates the stream key input field
15
-}
12
+
13
+    // Terms link
14
+    dataPrivacyLink: string;
15
+    enabled: boolean;
16
+    helpLink: string;
17
+
18
+    // Documentation reference for the live streaming feature.
19
+    termsLink: string; // Data privacy link
20
+    validatorRegExpString: string; // RegExp string that validates the stream key input field
21
+};
16
 
22
 
17
 export type LiveStreamingProps = {
23
 export type LiveStreamingProps = {
18
-    enabled: boolean,
19
-    helpURL: string,
20
-    termsURL: string,
21
-    dataPrivacyURL: string,
22
-    streamLinkRegexp: RegExp
23
-}
24
+    dataPrivacyURL: string;
25
+    enabled: boolean;
26
+    helpURL: string;
27
+    streamLinkRegexp: RegExp;
28
+    termsURL: string;
29
+};
24
 
30
 
25
 /**
31
 /**
26
  * The props of the component.
32
  * The props of the component.
27
  */
33
  */
28
-export type Props = {
34
+export interface IProps extends WithTranslation {
29
 
35
 
30
     /**
36
     /**
31
      * The live streaming dialog properties.
37
      * The live streaming dialog properties.
32
      */
38
      */
33
-    _liveStreaming: LiveStreamingProps,
39
+    _liveStreaming: LiveStreamingProps;
34
 
40
 
35
     /**
41
     /**
36
      * Callback invoked when the entered stream key has changed.
42
      * Callback invoked when the entered stream key has changed.
37
      */
43
      */
38
-    onChange: Function,
39
-
40
-    /**
41
-     * Invoked to obtain translated strings.
42
-     */
43
-    t: Function,
44
+    onChange: Function;
44
 
45
 
45
     /**
46
     /**
46
      * The stream key value to display as having been entered so far.
47
      * The stream key value to display as having been entered so far.
47
      */
48
      */
48
-    value: string
49
-};
49
+    value: string;
50
+}
50
 
51
 
51
 /**
52
 /**
52
  * The state of the component.
53
  * The state of the component.
53
  */
54
  */
54
-type State = {
55
+interface IState {
55
 
56
 
56
     /**
57
     /**
57
      * Whether or not to show the warnings that the passed in value seems like
58
      * Whether or not to show the warnings that the passed in value seems like
58
      * an improperly formatted stream key.
59
      * an improperly formatted stream key.
59
      */
60
      */
60
-    showValidationError: boolean
61
-};
61
+    showValidationError: boolean;
62
+}
62
 
63
 
63
 /**
64
 /**
64
  * An abstract React Component for entering a key for starting a YouTube live
65
  * An abstract React Component for entering a key for starting a YouTube live
66
  *
67
  *
67
  * @augments Component
68
  * @augments Component
68
  */
69
  */
69
-export default class AbstractStreamKeyForm<P: Props>
70
-    extends Component<P, State> {
70
+export default class AbstractStreamKeyForm<P extends IProps>
71
+    extends Component<P, IState> {
71
 
72
 
72
-    _debouncedUpdateValidationErrorVisibility: Function;
73
+    _debouncedUpdateValidationErrorVisibility: DebouncedFunc<() => void>;
73
 
74
 
74
     /**
75
     /**
75
      * Constructor for the component.
76
      * Constructor for the component.
114
         this._debouncedUpdateValidationErrorVisibility.cancel();
115
         this._debouncedUpdateValidationErrorVisibility.cancel();
115
     }
116
     }
116
 
117
 
117
-    _onInputChange: Object => void;
118
-
119
     /**
118
     /**
120
      * Callback invoked when the value of the input field has updated through
119
      * Callback invoked when the value of the input field has updated through
121
      * user input. This forwards the value (string only, even if it was a dom
120
      * user input. This forwards the value (string only, even if it was a dom
126
      * @private
125
      * @private
127
      * @returns {void}
126
      * @returns {void}
128
      */
127
      */
129
-    _onInputChange(change) {
128
+    _onInputChange(change: any) {
130
         const value = typeof change === 'object' ? change.target.value : change;
129
         const value = typeof change === 'object' ? change.target.value : change;
131
 
130
 
132
         this.props.onChange(value);
131
         this.props.onChange(value);
174
  *     _liveStreaming: LiveStreamingProps
173
  *     _liveStreaming: LiveStreamingProps
175
  * }}
174
  * }}
176
  */
175
  */
177
-export function _mapStateToProps(state: Object) {
176
+export function _mapStateToProps(state: IReduxState) {
178
     return {
177
     return {
179
         _liveStreaming: getLiveStreaming(state)
178
         _liveStreaming: getLiveStreaming(state)
180
     };
179
     };

react/features/recording/components/LiveStream/functions.js → react/features/recording/components/LiveStream/functions.ts 파일 보기

1
+import { IReduxState } from '../../../app/types';
2
+
1
 import {
3
 import {
2
     FOUR_GROUPS_DASH_SEPARATED,
4
     FOUR_GROUPS_DASH_SEPARATED,
3
     GOOGLE_PRIVACY_POLICY,
5
     GOOGLE_PRIVACY_POLICY,
11
  * @param {Object} state - The global state.
13
  * @param {Object} state - The global state.
12
  * @returns {LiveStreaming}
14
  * @returns {LiveStreaming}
13
  */
15
  */
14
-export function getLiveStreaming(state: Object) {
16
+export function getLiveStreaming(state: IReduxState) {
15
     const { liveStreaming = {} } = state['features/base/config'];
17
     const { liveStreaming = {} } = state['features/base/config'];
16
 
18
 
17
     const regexp = liveStreaming.validatorRegExpString
19
     const regexp = liveStreaming.validatorRegExpString

react/features/shared-video/components/web/AbstractVideoManager.js → react/features/shared-video/components/web/AbstractVideoManager.ts 파일 보기

1
-/* @flow */
2
 /* eslint-disable no-invalid-this */
1
 /* eslint-disable no-invalid-this */
2
+// @ts-ignore
3
 import Logger from '@jitsi/logger';
3
 import Logger from '@jitsi/logger';
4
 import throttle from 'lodash/throttle';
4
 import throttle from 'lodash/throttle';
5
 import { PureComponent } from 'react';
5
 import { PureComponent } from 'react';
6
 
6
 
7
-import { createSharedVideoEvent as createEvent, sendAnalytics } from '../../../analytics';
8
-import { getCurrentConference } from '../../../base/conference';
9
-import { MEDIA_TYPE } from '../../../base/media';
10
-import { getLocalParticipant } from '../../../base/participants';
11
-import { isLocalTrackMuted } from '../../../base/tracks';
12
-import { NOTIFICATION_TIMEOUT_TYPE } from '../../../notifications';
7
+import { createSharedVideoEvent as createEvent } from '../../../analytics/AnalyticsEvents';
8
+import { sendAnalytics } from '../../../analytics/functions';
9
+import { IReduxState } from '../../../app/types';
10
+import { getCurrentConference } from '../../../base/conference/functions';
11
+import { MEDIA_TYPE } from '../../../base/media/constants';
12
+import { getLocalParticipant } from '../../../base/participants/functions';
13
+import { isLocalTrackMuted } from '../../../base/tracks/functions';
13
 import { showWarningNotification } from '../../../notifications/actions';
14
 import { showWarningNotification } from '../../../notifications/actions';
14
-import { dockToolbox } from '../../../toolbox/actions.web';
15
+import { NOTIFICATION_TIMEOUT_TYPE } from '../../../notifications/constants';
16
+import { dockToolbox } from '../../../toolbox/actions';
15
 import { muteLocal } from '../../../video-menu/actions.any';
17
 import { muteLocal } from '../../../video-menu/actions.any';
16
 import { setSharedVideoStatus, stopSharedVideo } from '../../actions.any';
18
 import { setSharedVideoStatus, stopSharedVideo } from '../../actions.any';
17
 import { PLAYBACK_STATUSES } from '../../constants';
19
 import { PLAYBACK_STATUSES } from '../../constants';
19
 const logger = Logger.getLogger(__filename);
21
 const logger = Logger.getLogger(__filename);
20
 
22
 
21
 /**
23
 /**
22
- * Return true if the diffenrece between the two timees is larger than 5.
24
+ * Return true if the difference between the two times is larger than 5.
23
  *
25
  *
24
  * @param {number} newTime - The current time.
26
  * @param {number} newTime - The current time.
25
  * @param {number} previousTime - The previous time.
27
  * @param {number} previousTime - The previous time.
26
  * @private
28
  * @private
27
  * @returns {boolean}
29
  * @returns {boolean}
28
 */
30
 */
29
-function shouldSeekToPosition(newTime, previousTime) {
31
+function shouldSeekToPosition(newTime: number, previousTime: number) {
30
     return Math.abs(newTime - previousTime) > 5;
32
     return Math.abs(newTime - previousTime) > 5;
31
 }
33
 }
32
 
34
 
33
 /**
35
 /**
34
  * The type of the React {@link PureComponent} props of {@link AbstractVideoManager}.
36
  * The type of the React {@link PureComponent} props of {@link AbstractVideoManager}.
35
  */
37
  */
36
-export type Props = {
38
+export interface IProps {
37
 
39
 
38
     /**
40
     /**
39
-     * The current coference.
41
+     * The current conference.
40
      */
42
      */
41
-    _conference: Object,
43
+    _conference: Object;
42
 
44
 
43
     /**
45
     /**
44
      * Warning that indicates an incorrect video url.
46
      * Warning that indicates an incorrect video url.
45
      */
47
      */
46
-    _displayWarning: Function,
48
+    _displayWarning: Function;
47
 
49
 
48
     /**
50
     /**
49
      * Docks the toolbox.
51
      * Docks the toolbox.
50
      */
52
      */
51
-    _dockToolbox: Function,
52
-
53
-    /**
54
-     * Action to stop video sharing.
55
-    */
56
-    _stopSharedVideo: Function,
53
+    _dockToolbox: Function;
57
 
54
 
58
     /**
55
     /**
59
      * Indicates whether the local audio is muted.
56
      * Indicates whether the local audio is muted.
60
     */
57
     */
61
-    _isLocalAudioMuted: boolean,
58
+    _isLocalAudioMuted: boolean;
62
 
59
 
63
     /**
60
     /**
64
      * Is the video shared by the local user.
61
      * Is the video shared by the local user.
65
      *
62
      *
66
      * @private
63
      * @private
67
      */
64
      */
68
-    _isOwner: boolean,
65
+    _isOwner: boolean;
69
 
66
 
70
     /**
67
     /**
71
-     * Store flag for muted state.
68
+     * Mutes local audio track.
72
      */
69
      */
73
-    _muted: boolean,
70
+    _muteLocal: Function;
74
 
71
 
75
     /**
72
     /**
76
-     * Mutes local audio track.
73
+     * Store flag for muted state.
77
      */
74
      */
78
-    _muteLocal: Function,
75
+    _muted: boolean;
79
 
76
 
80
     /**
77
     /**
81
      * The shared video owner id.
78
      * The shared video owner id.
82
      */
79
      */
83
-    _ownerId: string,
80
+    _ownerId: string;
84
 
81
 
85
     /**
82
     /**
86
      * Updates the shared video status.
83
      * Updates the shared video status.
87
      */
84
      */
88
-    _setSharedVideoStatus: Function,
85
+    _setSharedVideoStatus: Function;
89
 
86
 
90
     /**
87
     /**
91
      * The shared video status.
88
      * The shared video status.
92
      */
89
      */
93
-     _status: string,
90
+    _status: string;
91
+
92
+    /**
93
+     * Action to stop video sharing.
94
+    */
95
+    _stopSharedVideo: Function;
94
 
96
 
95
     /**
97
     /**
96
      * Seek time in seconds.
98
      * Seek time in seconds.
97
      *
99
      *
98
      */
100
      */
99
-    _time: number,
101
+    _time: number;
100
 
102
 
101
     /**
103
     /**
102
      * The video url.
104
      * The video url.
103
      */
105
      */
104
-     _videoUrl: string,
106
+    _videoUrl: string;
105
 
107
 
106
-     /**
108
+    /**
107
       * The video id.
109
       * The video id.
108
       */
110
       */
109
-     videoId: string
111
+    videoId: string;
110
 }
112
 }
111
 
113
 
112
 /**
114
 /**
113
  * Manager of shared video.
115
  * Manager of shared video.
114
  */
116
  */
115
-class AbstractVideoManager extends PureComponent<Props> {
117
+class AbstractVideoManager extends PureComponent<IProps> {
116
     throttledFireUpdateSharedVideoEvent: Function;
118
     throttledFireUpdateSharedVideoEvent: Function;
117
 
119
 
118
     /**
120
     /**
119
      * Initializes a new instance of AbstractVideoManager.
121
      * Initializes a new instance of AbstractVideoManager.
120
      *
122
      *
123
+     * @param {IProps} props - Component props.
121
      * @returns {void}
124
      * @returns {void}
122
      */
125
      */
123
-    constructor() {
124
-        super();
126
+    constructor(props: IProps) {
127
+        super(props);
125
 
128
 
126
         this.throttledFireUpdateSharedVideoEvent = throttle(this.fireUpdateSharedVideoEvent.bind(this), 5000);
129
         this.throttledFireUpdateSharedVideoEvent = throttle(this.fireUpdateSharedVideoEvent.bind(this), 5000);
127
 
130
 
128
         // selenium tests handler
131
         // selenium tests handler
132
+        // @ts-ignore
129
         window._sharedVideoPlayer = this;
133
         window._sharedVideoPlayer = this;
130
     }
134
     }
131
 
135
 
144
      *
148
      *
145
      * @inheritdoc
149
      * @inheritdoc
146
      */
150
      */
147
-    componentDidUpdate(prevProps: Props) {
151
+    componentDidUpdate(prevProps: IProps) {
148
         const { _videoUrl } = this.props;
152
         const { _videoUrl } = this.props;
149
 
153
 
150
         if (prevProps._videoUrl !== _videoUrl) {
154
         if (prevProps._videoUrl !== _videoUrl) {
212
      * @param {Object|undefined} e - The error returned by the API or none.
216
      * @param {Object|undefined} e - The error returned by the API or none.
213
      * @returns {void}
217
      * @returns {void}
214
      */
218
      */
215
-    onError(e) {
219
+    onError(e: any) {
216
         logger.error('Error in the video player', e?.data,
220
         logger.error('Error in the video player', e?.data,
217
             e?.data ? 'Check error code at https://developers.google.com/youtube/iframe_api_reference#onError' : '');
221
             e?.data ? 'Check error code at https://developers.google.com/youtube/iframe_api_reference#onError' : '');
218
         this.props._stopSharedVideo();
222
         this.props._stopSharedVideo();
347
     /**
351
     /**
348
      * Indicates the playback state of the video.
352
      * Indicates the playback state of the video.
349
      */
353
      */
350
-    getPlaybackStatus: () => boolean;
354
+    getPlaybackStatus: () => string;
351
 
355
 
352
     /**
356
     /**
353
      * Indicates whether the video is muted.
357
      * Indicates whether the video is muted.
397
  * Maps part of the Redux store to the props of this component.
401
  * Maps part of the Redux store to the props of this component.
398
  *
402
  *
399
  * @param {Object} state - The Redux state.
403
  * @param {Object} state - The Redux state.
400
- * @returns {Props}
404
+ * @returns {IProps}
401
  */
405
  */
402
-export function _mapStateToProps(state: Object) {
406
+export function _mapStateToProps(state: IReduxState) {
403
     const { ownerId, status, time, videoUrl, muted } = state['features/shared-video'];
407
     const { ownerId, status, time, videoUrl, muted } = state['features/shared-video'];
404
     const localParticipant = getLocalParticipant(state);
408
     const localParticipant = getLocalParticipant(state);
405
     const _isLocalAudioMuted = isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.AUDIO);
409
     const _isLocalAudioMuted = isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.AUDIO);
407
     return {
411
     return {
408
         _conference: getCurrentConference(state),
412
         _conference: getCurrentConference(state),
409
         _isLocalAudioMuted,
413
         _isLocalAudioMuted,
410
-        _isOwner: ownerId === localParticipant.id,
414
+        _isOwner: ownerId === localParticipant?.id,
411
         _muted: muted,
415
         _muted: muted,
412
         _ownerId: ownerId,
416
         _ownerId: ownerId,
413
         _status: status,
417
         _status: status,
420
  * Maps part of the props of this component to Redux actions.
424
  * Maps part of the props of this component to Redux actions.
421
  *
425
  *
422
  * @param {Function} dispatch - The Redux dispatch function.
426
  * @param {Function} dispatch - The Redux dispatch function.
423
- * @returns {Props}
427
+ * @returns {IProps}
424
  */
428
  */
425
-export function _mapDispatchToProps(dispatch: Function): $Shape<Props> {
429
+export function _mapDispatchToProps(dispatch: Function) {
426
     return {
430
     return {
427
         _displayWarning: () => {
431
         _displayWarning: () => {
428
             dispatch(showWarningNotification({
432
             dispatch(showWarningNotification({
429
                 titleKey: 'dialog.shareVideoLinkError'
433
                 titleKey: 'dialog.shareVideoLinkError'
430
             }, NOTIFICATION_TIMEOUT_TYPE.LONG));
434
             }, NOTIFICATION_TIMEOUT_TYPE.LONG));
431
         },
435
         },
432
-        _dockToolbox: value => {
436
+        _dockToolbox: (value: boolean) => {
433
             dispatch(dockToolbox(value));
437
             dispatch(dockToolbox(value));
434
         },
438
         },
435
         _stopSharedVideo: () => {
439
         _stopSharedVideo: () => {
436
             dispatch(stopSharedVideo());
440
             dispatch(stopSharedVideo());
437
         },
441
         },
438
-        _muteLocal: value => {
442
+        _muteLocal: (value: boolean) => {
439
             dispatch(muteLocal(value, MEDIA_TYPE.AUDIO));
443
             dispatch(muteLocal(value, MEDIA_TYPE.AUDIO));
440
         },
444
         },
441
-        _setSharedVideoStatus: ({ videoUrl, status, time, ownerId, muted }) => {
445
+        _setSharedVideoStatus: ({ videoUrl, status, time, ownerId, muted }: any) => {
442
             dispatch(setSharedVideoStatus({
446
             dispatch(setSharedVideoStatus({
443
                 videoUrl,
447
                 videoUrl,
444
                 status,
448
                 status,

react/features/welcome/components/AbstractWelcomePage.js → react/features/welcome/components/AbstractWelcomePage.ts 파일 보기

1
-// @flow
2
-
1
+// @ts-expect-error
3
 import { generateRoomWithoutSeparator } from '@jitsi/js-utils/random';
2
 import { generateRoomWithoutSeparator } from '@jitsi/js-utils/random';
4
 import { Component } from 'react';
3
 import { Component } from 'react';
5
-import type { Dispatch } from 'redux';
6
 
4
 
7
-import { createWelcomePageEvent, sendAnalytics } from '../../analytics';
5
+import { createWelcomePageEvent } from '../../analytics/AnalyticsEvents';
6
+import { sendAnalytics } from '../../analytics/functions';
8
 import { appNavigate } from '../../app/actions';
7
 import { appNavigate } from '../../app/actions';
8
+import { IReduxState, IStore } from '../../app/types';
9
 import { IDeeplinkingConfig } from '../../base/config/configType';
9
 import { IDeeplinkingConfig } from '../../base/config/configType';
10
 import isInsecureRoomName from '../../base/util/isInsecureRoomName';
10
 import isInsecureRoomName from '../../base/util/isInsecureRoomName';
11
-import { isCalendarEnabled } from '../../calendar-sync';
11
+import { isCalendarEnabled } from '../../calendar-sync/functions';
12
 import { isRecentListEnabled } from '../../recent-list/functions';
12
 import { isRecentListEnabled } from '../../recent-list/functions';
13
 
13
 
14
 /**
14
 /**
15
  * {@code AbstractWelcomePage}'s React {@code Component} prop types.
15
  * {@code AbstractWelcomePage}'s React {@code Component} prop types.
16
  */
16
  */
17
-export type Props = {
17
+export interface IProps {
18
 
18
 
19
     /**
19
     /**
20
      * Whether the calendar functionality is enabled or not.
20
      * Whether the calendar functionality is enabled or not.
21
      */
21
      */
22
-    _calendarEnabled: boolean,
22
+    _calendarEnabled: boolean;
23
 
23
 
24
     /**
24
     /**
25
      * The deeplinking config.
25
      * The deeplinking config.
26
      */
26
      */
27
-    _deeplinkingCfg: IDeeplinkingConfig,
27
+    _deeplinkingCfg: IDeeplinkingConfig;
28
 
28
 
29
     /**
29
     /**
30
      * Whether the insecure room name functionality is enabled or not.
30
      * Whether the insecure room name functionality is enabled or not.
31
      */
31
      */
32
-    _enableInsecureRoomNameWarning: boolean,
32
+    _enableInsecureRoomNameWarning: boolean;
33
 
33
 
34
     /**
34
     /**
35
      * URL for the moderated rooms microservice, if available.
35
      * URL for the moderated rooms microservice, if available.
36
      */
36
      */
37
-    _moderatedRoomServiceUrl: ?string,
37
+    _moderatedRoomServiceUrl?: string;
38
 
38
 
39
     /**
39
     /**
40
      * Whether the recent list is enabled.
40
      * Whether the recent list is enabled.
41
      */
41
      */
42
-    _recentListEnabled: Boolean,
42
+    _recentListEnabled: Boolean;
43
 
43
 
44
     /**
44
     /**
45
      * Room name to join to.
45
      * Room name to join to.
46
      */
46
      */
47
-    _room: string,
47
+    _room: string;
48
 
48
 
49
     /**
49
     /**
50
      * The current settings.
50
      * The current settings.
51
      */
51
      */
52
-    _settings: Object,
52
+    _settings: Object;
53
 
53
 
54
     /**
54
     /**
55
      * The Redux dispatch Function.
55
      * The Redux dispatch Function.
56
      */
56
      */
57
-    dispatch: Dispatch<any>
58
-};
57
+    dispatch: IStore['dispatch'];
58
+}
59
 
59
 
60
 /**
60
 /**
61
  * Base (abstract) class for container component rendering the welcome page.
61
  * Base (abstract) class for container component rendering the welcome page.
62
  *
62
  *
63
  * @abstract
63
  * @abstract
64
  */
64
  */
65
-export class AbstractWelcomePage<P: Props> extends Component<P, *> {
66
-    _mounted: ?boolean;
65
+export class AbstractWelcomePage<P extends IProps> extends Component<P> {
66
+    _mounted: boolean | undefined;
67
 
67
 
68
     /**
68
     /**
69
      * Save room name into component's local state.
69
      * Save room name into component's local state.
71
      * @type {Object}
71
      * @type {Object}
72
      * @property {number|null} animateTimeoutId - Identifier of the letter
72
      * @property {number|null} animateTimeoutId - Identifier of the letter
73
      * animation timeout.
73
      * animation timeout.
74
-     * @property {string} generatedRoomname - Automatically generated room name.
74
+     * @property {string} generatedRoomName - Automatically generated room name.
75
      * @property {string} room - Room name.
75
      * @property {string} room - Room name.
76
      * @property {string} roomPlaceholder - Room placeholder that's used as a
76
      * @property {string} roomPlaceholder - Room placeholder that's used as a
77
      * placeholder for input.
77
      * placeholder for input.
80
      */
80
      */
81
     state = {
81
     state = {
82
         animateTimeoutId: undefined,
82
         animateTimeoutId: undefined,
83
-        generatedRoomname: '',
83
+        generatedRoomName: '',
84
         insecureRoomName: false,
84
         insecureRoomName: false,
85
         joining: false,
85
         joining: false,
86
         room: '',
86
         room: '',
98
         super(props);
98
         super(props);
99
 
99
 
100
         // Bind event handlers so they are only bound once per instance.
100
         // Bind event handlers so they are only bound once per instance.
101
-        this._animateRoomnameChanging
102
-            = this._animateRoomnameChanging.bind(this);
101
+        this._animateRoomNameChanging
102
+            = this._animateRoomNameChanging.bind(this);
103
         this._onJoin = this._onJoin.bind(this);
103
         this._onJoin = this._onJoin.bind(this);
104
         this._onRoomChange = this._onRoomChange.bind(this);
104
         this._onRoomChange = this._onRoomChange.bind(this);
105
         this._renderInsecureRoomNameWarning = this._renderInsecureRoomNameWarning.bind(this);
105
         this._renderInsecureRoomNameWarning = this._renderInsecureRoomNameWarning.bind(this);
106
-        this._updateRoomname = this._updateRoomname.bind(this);
106
+        this._updateRoomName = this._updateRoomName.bind(this);
107
     }
107
     }
108
 
108
 
109
     /**
109
     /**
128
         this._mounted = false;
128
         this._mounted = false;
129
     }
129
     }
130
 
130
 
131
-    _animateRoomnameChanging: (string) => void;
132
-
133
     /**
131
     /**
134
      * Animates the changing of the room name.
132
      * Animates the changing of the room name.
135
      *
133
      *
138
      * @private
136
      * @private
139
      * @returns {void}
137
      * @returns {void}
140
      */
138
      */
141
-    _animateRoomnameChanging(word: string) {
139
+    _animateRoomNameChanging(word: string) {
142
         let animateTimeoutId;
140
         let animateTimeoutId;
143
         const roomPlaceholder = this.state.roomPlaceholder + word.substr(0, 1);
141
         const roomPlaceholder = this.state.roomPlaceholder + word.substr(0, 1);
144
 
142
 
146
             animateTimeoutId
144
             animateTimeoutId
147
                 = setTimeout(
145
                 = setTimeout(
148
                     () => {
146
                     () => {
149
-                        this._animateRoomnameChanging(
147
+                        this._animateRoomNameChanging(
150
                             word.substring(1, word.length));
148
                             word.substring(1, word.length));
151
                     },
149
                     },
152
                     70);
150
                     70);
164
      * @returns {void}
162
      * @returns {void}
165
      */
163
      */
166
     _clearTimeouts() {
164
     _clearTimeouts() {
167
-        clearTimeout(this.state.animateTimeoutId);
168
-        clearTimeout(this.state.updateTimeoutId);
165
+        this.state.animateTimeoutId && clearTimeout(this.state.animateTimeoutId);
166
+        this.state.updateTimeoutId && clearTimeout(this.state.updateTimeoutId);
169
     }
167
     }
170
 
168
 
171
     /**
169
     /**
173
      *
171
      *
174
      * @returns {ReactElement}
172
      * @returns {ReactElement}
175
      */
173
      */
176
-    _doRenderInsecureRoomNameWarning: () => React$Component<any>;
177
-
178
-    _onJoin: () => void;
174
+    _doRenderInsecureRoomNameWarning: () => React.Component<any>;
179
 
175
 
180
     /**
176
     /**
181
      * Handles joining. Either by clicking on 'Join' button
177
      * Handles joining. Either by clicking on 'Join' button
185
      * @returns {void}
181
      * @returns {void}
186
      */
182
      */
187
     _onJoin() {
183
     _onJoin() {
188
-        const room = this.state.room || this.state.generatedRoomname;
184
+        const room = this.state.room || this.state.generatedRoomName;
189
 
185
 
190
         sendAnalytics(
186
         sendAnalytics(
191
             createWelcomePageEvent('clicked', 'joinButton', {
187
             createWelcomePageEvent('clicked', 'joinButton', {
206
         }
202
         }
207
     }
203
     }
208
 
204
 
209
-    _onRoomChange: (string) => void;
210
-
211
     /**
205
     /**
212
      * Handles 'change' event for the room name text input field.
206
      * Handles 'change' event for the room name text input field.
213
      *
207
      *
223
         });
217
         });
224
     }
218
     }
225
 
219
 
226
-    _renderInsecureRoomNameWarning: () => React$Component<any>;
227
-
228
     /**
220
     /**
229
      * Renders the insecure room name warning if needed.
221
      * Renders the insecure room name warning if needed.
230
      *
222
      *
238
         return null;
230
         return null;
239
     }
231
     }
240
 
232
 
241
-    _updateRoomname: () => void;
242
-
243
     /**
233
     /**
244
      * Triggers the generation of a new room name and initiates an animation of
234
      * Triggers the generation of a new room name and initiates an animation of
245
      * its changing.
235
      * its changing.
247
      * @protected
237
      * @protected
248
      * @returns {void}
238
      * @returns {void}
249
      */
239
      */
250
-    _updateRoomname() {
251
-        const generatedRoomname = generateRoomWithoutSeparator();
240
+    _updateRoomName() {
241
+        const generatedRoomName = generateRoomWithoutSeparator();
252
         const roomPlaceholder = '';
242
         const roomPlaceholder = '';
253
-        const updateTimeoutId = setTimeout(this._updateRoomname, 10000);
243
+        const updateTimeoutId = setTimeout(this._updateRoomName, 10000);
254
 
244
 
255
         this._clearTimeouts();
245
         this._clearTimeouts();
256
         this.setState(
246
         this.setState(
257
             {
247
             {
258
-                generatedRoomname,
248
+                generatedRoomName,
259
                 roomPlaceholder,
249
                 roomPlaceholder,
260
                 updateTimeoutId
250
                 updateTimeoutId
261
             },
251
             },
262
-            () => this._animateRoomnameChanging(generatedRoomname));
252
+            () => this._animateRoomNameChanging(generatedRoomName));
263
     }
253
     }
264
 }
254
 }
265
 
255
 
269
  *
259
  *
270
  * @param {Object} state - The redux state.
260
  * @param {Object} state - The redux state.
271
  * @protected
261
  * @protected
272
- * @returns {Props}
262
+ * @returns {IProps}
273
  */
263
  */
274
-export function _mapStateToProps(state: Object) {
264
+export function _mapStateToProps(state: IReduxState) {
275
     return {
265
     return {
276
         _calendarEnabled: isCalendarEnabled(state),
266
         _calendarEnabled: isCalendarEnabled(state),
277
         _deeplinkingCfg: state['features/base/config'].deeplinking || {},
267
         _deeplinkingCfg: state['features/base/config'].deeplinking || {},

Loading…
취소
저장