Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

Robert Pintilii6dedc7fb1aba
diff --git a/react/features/authentication/actions.web.ts b/react/features/authentication/actions.web.ts
index fcf7d200f8..4d0fd50e93 100644
--- a/react/features/authentication/actions.web.ts
+++ b/react/features/authentication/actions.web.ts
@@ -5,9 +5,8 @@ import { hideDialog, openDialog } from '../base/dialog/actions';
import {
CANCEL_LOGIN
} from './actionTypes';
-// eslint-disable-next-line lines-around-comment
-// @ts-ignore
-import { LoginDialog, WaitForOwnerDialog } from './components';
+import LoginDialog from './components/web/LoginDialog';
+import WaitForOwnerDialog from './components/web/WaitForOwnerDialog';
export * from './actions.any';
diff --git a/react/features/av-moderation/middleware.ts b/react/features/av-moderation/middleware.ts
index 81251f7b3f..c999ae2bb6 100644
--- a/react/features/av-moderation/middleware.ts
+++ b/react/features/av-moderation/middleware.ts
@@ -18,8 +18,6 @@ import StateListenerRegistry from '../base/redux/StateListenerRegistry';
import { playSound, registerSound, unregisterSound } from '../base/sounds/actions';
import { hideNotification, showNotification } from '../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
-// eslint-disable-next-line lines-around-comment
-// @ts-ignore
import { muteLocal } from '../video-menu/actions.any';
import {
@@ -60,8 +58,6 @@ import {
} from './functions';
import { ASKED_TO_UNMUTE_FILE } from './sounds';
-declare const APP: any;
-
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
const { type } = action;
const { conference } = getConferenceState(getState());
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index 5b380f4b9e..a96885c8bf 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -48,6 +48,7 @@ export interface IJitsiConference {
enableAVModeration: Function;
end: Function;
getBreakoutRooms: Function;
+ getLocalParticipantProperty: Function;
getLocalTracks: Function;
grantOwner: Function;
isAVModerationSupported: Function;
diff --git a/react/features/base/dialog/actions.ts b/react/features/base/dialog/actions.ts
index d504342a98..162e548f73 100644
--- a/react/features/base/dialog/actions.ts
+++ b/react/features/base/dialog/actions.ts
@@ -22,7 +22,7 @@ import { isDialogOpen } from './functions';
* component: (React.Component | undefined)
* }}
*/
-export function hideDialog(component?: ComponentType) {
+export function hideDialog(component?: ComponentType<any>) {
return {
type: HIDE_DIALOG,
component
@@ -54,7 +54,7 @@ export function hideSheet() {
* componentProps: (Object | undefined)
* }}
*/
-export function openDialog(component: ComponentType, componentProps?: Object) {
+export function openDialog(component: ComponentType<any>, componentProps?: Object) {
return {
type: OPEN_DIALOG,
component,
@@ -92,7 +92,7 @@ export function openSheet(component: ComponentType, componentProps?: Object) {
* specified {@code component}.
* @returns {Function}
*/
-export function toggleDialog(component: ComponentType, componentProps?: Object) {
+export function toggleDialog(component: ComponentType<any>, componentProps?: Object) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
if (isDialogOpen(getState, component)) {
dispatch(hideDialog(component));
diff --git a/react/features/speaker-stats/actions.native.js b/react/features/speaker-stats/actions.native.js
deleted file mode 100644
index 7e5279fe73..0000000000
--- a/react/features/speaker-stats/actions.native.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// @flow
-
-export * from './actions.any';
diff --git a/react/features/speaker-stats/actions.any.js b/react/features/speaker-stats/actions.ts
similarity index 95%
rename from react/features/speaker-stats/actions.any.js
rename to react/features/speaker-stats/actions.ts
index 807febacdf..af30f8e71e 100644
--- a/react/features/speaker-stats/actions.any.js
+++ b/react/features/speaker-stats/actions.ts
@@ -1,5 +1,3 @@
-// @flow
-
import {
INIT_REORDER_STATS,
INIT_SEARCH,
@@ -55,7 +53,7 @@ export function updateStats(stats: Object) {
* @param {Object} participantIds - Participant ids.
* @returns {Object}
*/
-export function updateSortedSpeakerStatsIds(participantIds: Array<string>) {
+export function updateSortedSpeakerStatsIds(participantIds?: Array<string>) {
return {
type: UPDATE_SORTED_SPEAKER_STATS_IDS,
participantIds
diff --git a/react/features/speaker-stats/actions.web.js b/react/features/speaker-stats/actions.web.js
deleted file mode 100644
index 7e5279fe73..0000000000
--- a/react/features/speaker-stats/actions.web.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// @flow
-
-export * from './actions.any';
diff --git a/react/features/speaker-stats/components/AbstractSpeakerStatsList.js b/react/features/speaker-stats/components/AbstractSpeakerStatsList.js
index 6a0c2d8fb2..31e11e0054 100644
--- a/react/features/speaker-stats/components/AbstractSpeakerStatsList.js
+++ b/react/features/speaker-stats/components/AbstractSpeakerStatsList.js
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { getLocalParticipant } from '../../base/participants';
-import { initUpdateStats } from '../actions.any';
+import { initUpdateStats } from '../actions';
import {
SPEAKER_STATS_RELOAD_INTERVAL
} from '../constants';
diff --git a/react/features/speaker-stats/components/web/SpeakerStats.tsx b/react/features/speaker-stats/components/web/SpeakerStats.tsx
index 3c00526b9c..a40eb0c1d3 100644
--- a/react/features/speaker-stats/components/web/SpeakerStats.tsx
+++ b/react/features/speaker-stats/components/web/SpeakerStats.tsx
@@ -6,8 +6,6 @@ import { makeStyles } from 'tss-react/mui';
import { IReduxState } from '../../../app/types';
import Dialog from '../../../base/ui/components/web/Dialog';
import { escapeRegexp } from '../../../base/util/helpers';
-// eslint-disable-next-line lines-around-comment
-// @ts-ignore
import { initSearch, resetSearchCriteria, toggleFaceExpressions } from '../../actions';
import {
DISPLAY_SWITCH_BREAKPOINT,
@@ -107,7 +105,9 @@ const SpeakerStats = () => {
useEffect(() => {
showFaceExpressions && !displaySwitch && dispatch(toggleFaceExpressions());
}, [ clientWidth ]);
- useEffect(() => () => dispatch(resetSearchCriteria()), []);
+ useEffect(() => () => {
+ dispatch(resetSearchCriteria());
+ }, []);
return (
<Dialog
diff --git a/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx b/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx
index 054e778098..f56eeb8e85 100644
--- a/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx
+++ b/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable lines-around-comment */
import { Theme } from '@mui/material';
import React, { useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -10,7 +9,6 @@ import { IconSearch } from '../../../base/icons/svg';
import { getFieldValue } from '../../../base/react/functions';
import { withPixelLineHeight } from '../../../base/styles/functions.web';
import { MOBILE_BREAKPOINT } from '../../constants';
-// @ts-ignore
import { isSpeakerStatsSearchDisabled } from '../../functions';
const useStyles = makeStyles()((theme: Theme) => {
diff --git a/react/features/speaker-stats/functions.js b/react/features/speaker-stats/functions.ts
similarity index 73%
rename from react/features/speaker-stats/functions.js
rename to react/features/speaker-stats/functions.ts
index 8144738b9f..0a935b47cf 100644
--- a/react/features/speaker-stats/functions.js
+++ b/react/features/speaker-stats/functions.ts
@@ -1,40 +1,37 @@
-// @flow
-
import _ from 'lodash';
-import {
- PARTICIPANT_ROLE,
- getParticipantById
-} from '../base/participants';
+import { IReduxState } from '../app/types';
+import { PARTICIPANT_ROLE } from '../base/participants/constants';
+import { getParticipantById } from '../base/participants/functions';
/**
* Checks if the speaker stats search is disabled.
*
- * @param {*} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @returns {boolean} - True if the speaker stats search is disabled and false otherwise.
*/
-export function isSpeakerStatsSearchDisabled(state: Object) {
- return state['features/base/config']?.speakerStats.disableSearch;
+export function isSpeakerStatsSearchDisabled(state: IReduxState) {
+ return state['features/base/config']?.speakerStats?.disableSearch;
}
/**
* Checks if the speaker stats is disabled.
*
- * @param {*} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @returns {boolean} - True if the speaker stats search is disabled and false otherwise.
*/
-export function isSpeakerStatsDisabled(state: Object) {
+export function isSpeakerStatsDisabled(state: IReduxState) {
return state['features/base/config']?.speakerStats?.disabled;
}
/**
* Gets whether participants in speaker stats should be ordered or not, and with what priority.
*
- * @param {*} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @returns {Array<string>} - The speaker stats order array or an empty array.
*/
-export function getSpeakerStatsOrder(state: Object) {
- return state['features/base/config']?.speakerStats.order ?? [
+export function getSpeakerStatsOrder(state: IReduxState) {
+ return state['features/base/config']?.speakerStats?.order ?? [
'role',
'name',
'hasLeft'
@@ -44,42 +41,42 @@ export function getSpeakerStatsOrder(state: Object) {
/**
* Gets speaker stats.
*
- * @param {*} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @returns {Object} - The speaker stats.
*/
-export function getSpeakerStats(state: Object) {
+export function getSpeakerStats(state: IReduxState) {
return state['features/speaker-stats']?.stats ?? {};
}
/**
* Gets speaker stats search criteria.
*
- * @param {*} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @returns {string | null} - The search criteria.
*/
-export function getSearchCriteria(state: Object) {
+export function getSearchCriteria(state: IReduxState) {
return state['features/speaker-stats']?.criteria;
}
/**
* Gets if speaker stats reorder is pending.
*
- * @param {*} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @returns {boolean} - The pending reorder flag.
*/
-export function getPendingReorder(state: Object) {
+export function getPendingReorder(state: IReduxState) {
return state['features/speaker-stats']?.pendingReorder ?? false;
}
/**
* Get sorted speaker stats ids based on a configuration setting.
*
- * @param {Object} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @param {Object} stats - The current speaker stats.
* @returns {Object} - Ordered speaker stats ids.
* @public
*/
-export function getSortedSpeakerStatsIds(state: Object, stats: Object) {
+export function getSortedSpeakerStatsIds(state: IReduxState, stats: Object) {
const orderConfig = getSpeakerStatsOrder(state);
if (orderConfig) {
@@ -98,7 +95,7 @@ export function getSortedSpeakerStatsIds(state: Object, stats: Object) {
* @param {Object} nextParticipant - The second participant for comparison.
* @returns {number} - The sort order of the two participants.
*/
- function compareFn(currentParticipant, nextParticipant) {
+ function compareFn(currentParticipant: any, nextParticipant: any) {
if (orderConfig.includes('hasLeft')) {
if (nextParticipant.hasLeft() && !currentParticipant.hasLeft()) {
return -1;
@@ -139,13 +136,13 @@ export function getSortedSpeakerStatsIds(state: Object, stats: Object) {
/**
* Enhance speaker stats to include data needed for ordering.
*
- * @param {Object} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @param {Object} stats - Speaker stats.
* @param {Array<string>} orderConfig - Ordering configuration.
* @returns {Object} - Enhanced speaker stats.
* @public
*/
-function getEnhancedStatsForOrdering(state, stats, orderConfig) {
+function getEnhancedStatsForOrdering(state: IReduxState, stats: any, orderConfig?: string[]) {
if (!orderConfig) {
return stats;
}
@@ -166,14 +163,14 @@ function getEnhancedStatsForOrdering(state, stats, orderConfig) {
/**
* Filter stats by search criteria.
*
- * @param {Object} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @param {Object | undefined} stats - The unfiltered stats.
*
* @returns {Object} - Filtered speaker stats.
* @public
*/
-export function filterBySearchCriteria(state: Object, stats: ?Object) {
- const filteredStats = _.cloneDeep(stats ?? getSpeakerStats(state));
+export function filterBySearchCriteria(state: IReduxState, stats?: Object) {
+ const filteredStats: any = _.cloneDeep(stats ?? getSpeakerStats(state));
const criteria = getSearchCriteria(state);
if (criteria !== null) {
@@ -194,14 +191,14 @@ export function filterBySearchCriteria(state: Object, stats: ?Object) {
/**
* Reset the hidden speaker stats.
*
- * @param {Object} state - The redux state.
+ * @param {IReduxState} state - The redux state.
* @param {Object | undefined} stats - The unfiltered stats.
*
* @returns {Object} - Speaker stats.
* @public
*/
-export function resetHiddenStats(state: Object, stats: ?Object) {
- const resetStats = _.cloneDeep(stats ?? getSpeakerStats(state));
+export function resetHiddenStats(state: IReduxState, stats?: Object) {
+ const resetStats: any = _.cloneDeep(stats ?? getSpeakerStats(state));
for (const id in resetStats) {
if (resetStats[id].hidden) {
diff --git a/react/features/speaker-stats/middleware.js b/react/features/speaker-stats/middleware.ts
similarity index 96%
rename from react/features/speaker-stats/middleware.js
rename to react/features/speaker-stats/middleware.ts
index b61d711237..88799de846 100644
--- a/react/features/speaker-stats/middleware.js
+++ b/react/features/speaker-stats/middleware.ts
@@ -1,12 +1,10 @@
-// @flow
-
import {
PARTICIPANT_JOINED,
PARTICIPANT_KICKED,
PARTICIPANT_LEFT,
PARTICIPANT_UPDATED
} from '../base/participants/actionTypes';
-import { MiddlewareRegistry } from '../base/redux';
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import {
INIT_SEARCH,
diff --git a/react/features/subtitles/actions.any.ts b/react/features/subtitles/actions.any.ts
index 9f20e417be..e371ccb6eb 100644
--- a/react/features/subtitles/actions.any.ts
+++ b/react/features/subtitles/actions.any.ts
@@ -95,12 +95,12 @@ export function setRequestingSubtitles(enabled: boolean) {
/**
* Signals that the local user has selected language for the translation.
*
- * @param {boolean} value - The selected language for translation.
+ * @param {string} value - The selected language for translation.
* @returns {{
* type: UPDATE_TRANSLATION_LANGUAGE
* }}
*/
-export function updateTranslationLanguage(value: boolean) {
+export function updateTranslationLanguage(value: string) {
return {
type: UPDATE_TRANSLATION_LANGUAGE,
value
diff --git a/react/features/subtitles/actions.native.js b/react/features/subtitles/actions.native.ts
similarity index 100%
rename from react/features/subtitles/actions.native.js
rename to react/features/subtitles/actions.native.ts
diff --git a/react/features/subtitles/actions.web.js b/react/features/subtitles/actions.web.ts
similarity index 82%
rename from react/features/subtitles/actions.web.js
rename to react/features/subtitles/actions.web.ts
index d9673bf9af..0e6f101854 100644
--- a/react/features/subtitles/actions.web.js
+++ b/react/features/subtitles/actions.web.ts
@@ -1,3 +1,4 @@
+import { IStore } from '../app/types';
import { toggleDialog } from '../base/dialog/actions';
import LanguageSelectorDialogWeb from './components/LanguageSelectorDialog.web';
@@ -12,7 +13,7 @@ export * from './actions.any';
* }}
*/
export function toggleLanguageSelectorDialog() {
- return function(dispatch: (Object) => Object) {
+ return function(dispatch: IStore['dispatch']) {
dispatch(toggleDialog(LanguageSelectorDialogWeb));
};
}
diff --git a/react/features/subtitles/logger.js b/react/features/subtitles/logger.ts
similarity index 91%
rename from react/features/subtitles/logger.js
rename to react/features/subtitles/logger.ts
index 9bf7ce7400..ca6c3cad2b 100644
--- a/react/features/subtitles/logger.js
+++ b/react/features/subtitles/logger.ts
@@ -1,5 +1,3 @@
-// @flow
-
import { getLogger } from '../base/logging/functions';
export default getLogger('features/subtitles');
diff --git a/react/features/subtitles/middleware.js b/react/features/subtitles/middleware.ts
similarity index 89%
rename from react/features/subtitles/middleware.js
rename to react/features/subtitles/middleware.ts
index 53577f2f8a..15ec9f8edf 100644
--- a/react/features/subtitles/middleware.js
+++ b/react/features/subtitles/middleware.ts
@@ -1,7 +1,8 @@
-// @flow
import i18next from 'i18next';
+import { AnyAction } from 'redux';
-import { MiddlewareRegistry } from '../base/redux';
+import { IStore } from '../app/types';
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import {
ENDPOINT_MESSAGE_RECEIVED,
@@ -81,7 +82,7 @@ MiddlewareRegistry.register(store => next => action => {
* @private
* @returns {Object} The value returned by {@code next(action)}.
*/
-function _endpointMessageReceived({ dispatch, getState }, next, action) {
+function _endpointMessageReceived({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
const { json } = action;
if (!(json
@@ -93,7 +94,7 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
const state = getState();
const translationLanguage
= state['features/base/conference'].conference
- .getLocalParticipantProperty(P_NAME_TRANSLATION_LANGUAGE);
+ ?.getLocalParticipantProperty(P_NAME_TRANSLATION_LANGUAGE);
try {
const transcriptMessageID = json.message_id;
@@ -125,7 +126,7 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
// We update the previous transcript message with the same
// message ID or adds a new transcript message if it does not
// exist in the map.
- const newTranscriptMessage = {
+ const newTranscriptMessage: any = {
...state['features/subtitles']._transcriptMessages
.get(transcriptMessageID)
|| { participantName }
@@ -173,19 +174,19 @@ function _endpointMessageReceived({ dispatch, getState }, next, action) {
* @private
* @returns {void}
*/
-function _requestingSubtitlesChange({ getState }) {
+function _requestingSubtitlesChange({ getState }: IStore) {
const state = getState();
const { _language } = state['features/subtitles'];
const { conference } = state['features/base/conference'];
const requestingSubtitles = _language !== 'transcribing.subtitlesOff';
- conference.setLocalParticipantProperty(
+ conference?.setLocalParticipantProperty(
P_NAME_REQUESTING_TRANSCRIPTION,
requestingSubtitles);
if (requestingSubtitles) {
- conference.setLocalParticipantProperty(
+ conference?.setLocalParticipantProperty(
P_NAME_TRANSLATION_LANGUAGE,
_language.replace('translation-languages:', ''));
}
@@ -200,11 +201,11 @@ function _requestingSubtitlesChange({ getState }) {
* @private
* @returns {void}
*/
-function _requestingSubtitlesSet({ getState }, enabled: boolean) {
+function _requestingSubtitlesSet({ getState }: IStore, enabled: boolean) {
const state = getState();
const { conference } = state['features/base/conference'];
- conference.setLocalParticipantProperty(
+ conference?.setLocalParticipantProperty(
P_NAME_REQUESTING_TRANSCRIPTION,
enabled);
}
@@ -219,15 +220,15 @@ function _requestingSubtitlesSet({ getState }, enabled: boolean) {
* @returns {void}
*/
function _setClearerOnTranscriptMessage(
- dispatch,
- transcriptMessageID,
- transcriptMessage) {
+ dispatch: IStore['dispatch'],
+ transcriptMessageID: string,
+ transcriptMessage: { clearTimeOut?: number; }) {
if (transcriptMessage.clearTimeOut) {
clearTimeout(transcriptMessage.clearTimeOut);
}
transcriptMessage.clearTimeOut
- = setTimeout(
+ = window.setTimeout(
() => dispatch(removeTranscriptMessage(transcriptMessageID)),
REMOVE_AFTER_MS);
}
diff --git a/react/features/transcribing/actions.js b/react/features/transcribing/actions.ts
similarity index 89%
rename from react/features/transcribing/actions.js
rename to react/features/transcribing/actions.ts
index 26db2acf9f..db4e8828e6 100644
--- a/react/features/transcribing/actions.js
+++ b/react/features/transcribing/actions.ts
@@ -1,11 +1,6 @@
-// @flow
-
-import {
- NOTIFICATION_TIMEOUT_TYPE,
- hideNotification,
- showErrorNotification,
- showNotification
-} from '../notifications';
+import { IStore } from '../app/types';
+import { hideNotification, showErrorNotification, showNotification } from '../notifications/actions';
+import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
import {
SET_PENDING_TRANSCRIBING_NOTIFICATION_UID,
@@ -69,7 +64,7 @@ export function potentialTranscriberJoined(participantId: string) {
* @returns {Function}
*/
export function showPendingTranscribingNotification() {
- return async (dispatch: Function) => {
+ return async (dispatch: IStore['dispatch']) => {
const notification = await dispatch(showNotification({
descriptionKey: 'transcribing.pending',
titleKey: 'dialog.transcribing'
@@ -92,7 +87,7 @@ export function showPendingTranscribingNotification() {
* uid: number
* }}
*/
-export function setPendingTranscribingNotificationUid(uid: ?number) {
+export function setPendingTranscribingNotificationUid(uid?: string) {
return {
type: SET_PENDING_TRANSCRIBING_NOTIFICATION_UID,
uid
@@ -106,7 +101,7 @@ export function setPendingTranscribingNotificationUid(uid: ?number) {
* @returns {Function}
*/
export function hidePendingTranscribingNotification() {
- return (dispatch: Function, getState: Function) => {
+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const { pendingNotificationUid } = getState()['features/transcribing'];
if (pendingNotificationUid) {
diff --git a/react/features/transcribing/middleware.js b/react/features/transcribing/middleware.ts
similarity index 93%
rename from react/features/transcribing/middleware.js
rename to react/features/transcribing/middleware.ts
index e55b3f3204..43f49d4005 100644
--- a/react/features/transcribing/middleware.js
+++ b/react/features/transcribing/middleware.ts
@@ -1,13 +1,11 @@
-// @flow
-
-import { MiddlewareRegistry } from '../base/redux';
-import { toggleRequestingSubtitles } from '../subtitles';
-
import {
HIDDEN_PARTICIPANT_JOINED,
HIDDEN_PARTICIPANT_LEFT,
PARTICIPANT_UPDATED
-} from './../base/participants';
+} from '../base/participants/actionTypes';
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
+import { toggleRequestingSubtitles } from '../subtitles/actions.any';
+
import {
_TRANSCRIBER_JOINED,
_TRANSCRIBER_LEFT
diff --git a/react/features/transcribing/reducer.ts b/react/features/transcribing/reducer.ts
index 08da1e021b..e619c99464 100644
--- a/react/features/transcribing/reducer.ts
+++ b/react/features/transcribing/reducer.ts
@@ -62,7 +62,7 @@ export interface ITranscribingState {
isDialing: boolean;
isTerminating: boolean;
isTranscribing: boolean;
- pendingNotificationUid?: number;
+ pendingNotificationUid?: string;
potentialTranscriberJIDs: string[];
transcriberJID?: string | null;
}
diff --git a/react/features/video-menu/actions.any.js b/react/features/video-menu/actions.any.ts
similarity index 76%
rename from react/features/video-menu/actions.any.js
rename to react/features/video-menu/actions.any.ts
index ffe7405c4c..98ace58762 100644
--- a/react/features/video-menu/actions.any.js
+++ b/react/features/video-menu/actions.any.ts
@@ -1,32 +1,24 @@
-// @flow
+// @ts-ignore
import { getLogger } from '@jitsi/logger';
-import type { Dispatch } from 'redux';
+// @ts-expect-error
import UIEvents from '../../../service/UI/UIEvents';
import {
AUDIO_MUTE,
VIDEO_MUTE,
createRemoteMuteConfirmedEvent,
- createToolbarEvent,
- sendAnalytics
-} from '../analytics';
+ createToolbarEvent
+} from '../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../analytics/functions';
+import { IStore } from '../app/types';
import { rejectParticipantAudio, rejectParticipantVideo, showModeratedNotification } from '../av-moderation/actions';
import { shouldShowModeratedNotification } from '../av-moderation/functions';
-import {
- MEDIA_TYPE,
- VIDEO_MUTISM_AUTHORITY,
- setAudioMuted,
- setVideoMuted
-} from '../base/media';
-import {
- getLocalParticipant,
- getRemoteParticipants,
- muteRemoteParticipant
-} from '../base/participants';
-import { toggleScreensharing } from '../base/tracks';
-import { isModerationNotificationDisplayed } from '../notifications';
-
-declare var APP: Object;
+import { setAudioMuted, setVideoMuted } from '../base/media/actions';
+import { MEDIA_TYPE, MediaType, VIDEO_MUTISM_AUTHORITY } from '../base/media/constants';
+import { muteRemoteParticipant } from '../base/participants/actions';
+import { getLocalParticipant, getRemoteParticipants } from '../base/participants/functions';
+import { toggleScreensharing } from '../base/tracks/actions';
+import { isModerationNotificationDisplayed } from '../notifications/functions';
const logger = getLogger(__filename);
@@ -38,8 +30,8 @@ const logger = getLogger(__filename);
* @param {boolean} stopScreenSharing - Whether or not to stop the screensharing.
* @returns {Function}
*/
-export function muteLocal(enable: boolean, mediaType: MEDIA_TYPE, stopScreenSharing: boolean = false) {
- return (dispatch: Dispatch<any>, getState: Function) => {
+export function muteLocal(enable: boolean, mediaType: MediaType, stopScreenSharing = false) {
+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const isAudio = mediaType === MEDIA_TYPE.AUDIO;
if (!isAudio && mediaType !== MEDIA_TYPE.VIDEO) {
@@ -78,8 +70,8 @@ export function muteLocal(enable: boolean, mediaType: MEDIA_TYPE, stopScreenShar
* @param {MEDIA_TYPE} mediaType - The type of the media channel to mute.
* @returns {Function}
*/
-export function muteRemote(participantId: string, mediaType: MEDIA_TYPE) {
- return (dispatch: Dispatch<any>) => {
+export function muteRemote(participantId: string, mediaType: MediaType) {
+ return (dispatch: IStore['dispatch']) => {
if (mediaType !== MEDIA_TYPE.AUDIO && mediaType !== MEDIA_TYPE.VIDEO) {
logger.error(`Unsupported media type: ${mediaType}`);
@@ -97,10 +89,10 @@ export function muteRemote(participantId: string, mediaType: MEDIA_TYPE) {
* @param {MEDIA_TYPE} mediaType - The media type to mute.
* @returns {Function}
*/
-export function muteAllParticipants(exclude: Array<string>, mediaType: MEDIA_TYPE) {
- return (dispatch: Dispatch<any>, getState: Function) => {
+export function muteAllParticipants(exclude: Array<string>, mediaType: MediaType) {
+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const state = getState();
- const localId = getLocalParticipant(state).id;
+ const localId = getLocalParticipant(state)?.id ?? '';
if (!exclude.includes(localId)) {
dispatch(muteLocal(true, mediaType, mediaType !== MEDIA_TYPE.AUDIO));
diff --git a/react/features/video-menu/actions.native.js b/react/features/video-menu/actions.native.ts
similarity index 100%
rename from react/features/video-menu/actions.native.js
rename to react/features/video-menu/actions.native.ts
diff --git a/react/features/video-menu/actions.web.js b/react/features/video-menu/actions.web.ts
similarity index 98%
rename from react/features/video-menu/actions.web.js
rename to react/features/video-menu/actions.web.ts
index e173885b02..b534a37e54 100644
--- a/react/features/video-menu/actions.web.js
+++ b/react/features/video-menu/actions.web.ts
@@ -1,4 +1,3 @@
-// @flow
import { SHOW_CONNECTION_INFO } from '../base/connection/actionTypes';
export * from './actions.any';