ref(TS) Convert some files to TS (#12307)
This commit is contained in:
parent
b1931de7b0
commit
be25ad855f
|
@ -13,8 +13,10 @@ declare global {
|
||||||
const interfaceConfig: any;
|
const interfaceConfig: any;
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
config?: IConfig;
|
config: IConfig;
|
||||||
JITSI_MEET_LITE_SDK?: boolean;
|
JITSI_MEET_LITE_SDK?: boolean;
|
||||||
interfaceConfig?: any;
|
interfaceConfig?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const config: IConfig;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ export interface IJitsiConference {
|
||||||
getLocalTracks: Function;
|
getLocalTracks: Function;
|
||||||
grantOwner: Function;
|
grantOwner: Function;
|
||||||
isAVModerationSupported: Function;
|
isAVModerationSupported: Function;
|
||||||
|
isCallstatsEnabled: Function;
|
||||||
isEndConferenceSupported: Function;
|
isEndConferenceSupported: Function;
|
||||||
isLobbySupported: Function;
|
isLobbySupported: Function;
|
||||||
kickParticipant: Function;
|
kickParticipant: Function;
|
||||||
|
@ -60,6 +61,7 @@ export interface IJitsiConference {
|
||||||
replaceTrack: Function;
|
replaceTrack: Function;
|
||||||
sendCommand: Function;
|
sendCommand: Function;
|
||||||
sendEndpointMessage: Function;
|
sendEndpointMessage: Function;
|
||||||
|
sendFeedback: Function;
|
||||||
sendLobbyMessage: Function;
|
sendLobbyMessage: Function;
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
setDisplayName: Function;
|
setDisplayName: Function;
|
||||||
|
|
|
@ -115,6 +115,7 @@ export interface IConfig {
|
||||||
autoKnockLobby?: boolean;
|
autoKnockLobby?: boolean;
|
||||||
backgroundAlpha?: number;
|
backgroundAlpha?: number;
|
||||||
bosh?: string;
|
bosh?: string;
|
||||||
|
brandingDataUrl?: string;
|
||||||
brandingRoomAlias?: string;
|
brandingRoomAlias?: string;
|
||||||
breakoutRooms?: {
|
breakoutRooms?: {
|
||||||
hideAddRoomButton?: boolean;
|
hideAddRoomButton?: boolean;
|
||||||
|
@ -342,6 +343,8 @@ export interface IConfig {
|
||||||
iAmRecorder?: boolean;
|
iAmRecorder?: boolean;
|
||||||
iAmSipGateway?: boolean;
|
iAmSipGateway?: boolean;
|
||||||
inviteAppName?: string | null;
|
inviteAppName?: string | null;
|
||||||
|
jaasFeedbackMetadataURL?: string;
|
||||||
|
jaasTokenUrl?: string;
|
||||||
lastNLimits?: {
|
lastNLimits?: {
|
||||||
[key: number]: number;
|
[key: number]: number;
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,6 +12,7 @@ export interface IJwtState {
|
||||||
server?: string;
|
server?: string;
|
||||||
tenant?: string;
|
tenant?: string;
|
||||||
user?: {
|
user?: {
|
||||||
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ export interface ISettingsState {
|
||||||
userSelectedMicDeviceLabel?: string;
|
userSelectedMicDeviceLabel?: string;
|
||||||
userSelectedNotifications?: {
|
userSelectedNotifications?: {
|
||||||
[key: string]: boolean;
|
[key: string]: boolean;
|
||||||
} | boolean;
|
};
|
||||||
userSelectedSkipPrejoin?: boolean;
|
userSelectedSkipPrejoin?: boolean;
|
||||||
videoSettingsVisible?: boolean;
|
videoSettingsVisible?: boolean;
|
||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// @flow
|
/* eslint-disable lines-around-comment */
|
||||||
import { type Dispatch } from 'redux';
|
import { AnyAction } from 'redux';
|
||||||
|
|
||||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
import { IState, IStore } from '../app/types';
|
||||||
import {
|
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app/actionTypes';
|
||||||
CONFERENCE_JOINED,
|
import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
||||||
getCurrentConference
|
import { getCurrentConference } from '../base/conference/functions';
|
||||||
} from '../base/conference';
|
import { IJitsiConference } from '../base/conference/reducer';
|
||||||
import { openDialog } from '../base/dialog';
|
import { openDialog } from '../base/dialog/actions';
|
||||||
import {
|
import {
|
||||||
JitsiConferenceErrors,
|
JitsiConferenceErrors,
|
||||||
JitsiConferenceEvents
|
JitsiConferenceEvents
|
||||||
|
@ -15,27 +15,28 @@ import {
|
||||||
getLocalParticipant,
|
getLocalParticipant,
|
||||||
getParticipantById,
|
getParticipantById,
|
||||||
getParticipantDisplayName
|
getParticipantDisplayName
|
||||||
} from '../base/participants';
|
} from '../base/participants/functions';
|
||||||
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
||||||
import { playSound, registerSound, unregisterSound } from '../base/sounds';
|
import StateListenerRegistry from '../base/redux/StateListenerRegistry';
|
||||||
|
import { playSound, registerSound, unregisterSound } from '../base/sounds/actions';
|
||||||
import { addGif } from '../gifs/actions';
|
import { addGif } from '../gifs/actions';
|
||||||
import { GIF_PREFIX } from '../gifs/constants';
|
import { GIF_PREFIX } from '../gifs/constants';
|
||||||
import { getGifDisplayMode, isGifMessage } from '../gifs/functions';
|
import { getGifDisplayMode, isGifMessage } from '../gifs/functions';
|
||||||
import { NOTIFICATION_TIMEOUT_TYPE, showMessageNotification } from '../notifications';
|
import { showMessageNotification } from '../notifications/actions';
|
||||||
|
import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
|
||||||
import { resetNbUnreadPollsMessages } from '../polls/actions';
|
import { resetNbUnreadPollsMessages } from '../polls/actions';
|
||||||
import { ADD_REACTION_MESSAGE } from '../reactions/actionTypes';
|
import { ADD_REACTION_MESSAGE } from '../reactions/actionTypes';
|
||||||
import { pushReactions } from '../reactions/actions.any';
|
import { pushReactions } from '../reactions/actions.any';
|
||||||
import { ENDPOINT_REACTION_NAME } from '../reactions/constants';
|
import { ENDPOINT_REACTION_NAME } from '../reactions/constants';
|
||||||
import { getReactionMessageFromBuffer, isReactionsEnabled } from '../reactions/functions.any';
|
import { getReactionMessageFromBuffer, isReactionsEnabled } from '../reactions/functions.any';
|
||||||
import { endpointMessageReceived } from '../subtitles';
|
import { endpointMessageReceived } from '../subtitles/actions.any';
|
||||||
import {
|
// @ts-ignore
|
||||||
showToolbox
|
import { showToolbox } from '../toolbox/actions';
|
||||||
} from '../toolbox/actions';
|
|
||||||
|
|
||||||
|
|
||||||
import { ADD_MESSAGE, CLOSE_CHAT, OPEN_CHAT, SEND_MESSAGE, SET_IS_POLL_TAB_FOCUSED } from './actionTypes';
|
import { ADD_MESSAGE, CLOSE_CHAT, OPEN_CHAT, SEND_MESSAGE, SET_IS_POLL_TAB_FOCUSED } from './actionTypes';
|
||||||
import { addMessage, clearMessages } from './actions';
|
import { addMessage, clearMessages, closeChat } from './actions.any';
|
||||||
import { closeChat } from './actions.any';
|
// @ts-ignore
|
||||||
import { ChatPrivacyDialog } from './components';
|
import { ChatPrivacyDialog } from './components';
|
||||||
import {
|
import {
|
||||||
INCOMING_MSG_SOUND_ID,
|
INCOMING_MSG_SOUND_ID,
|
||||||
|
@ -47,9 +48,6 @@ import {
|
||||||
import { getUnreadCount } from './functions';
|
import { getUnreadCount } from './functions';
|
||||||
import { INCOMING_MSG_SOUND_FILE } from './sounds';
|
import { INCOMING_MSG_SOUND_FILE } from './sounds';
|
||||||
|
|
||||||
declare var APP: Object;
|
|
||||||
declare var interfaceConfig : Object;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timeout for when to show the privacy notice after a private message was received.
|
* Timeout for when to show the privacy notice after a private message was received.
|
||||||
*
|
*
|
||||||
|
@ -167,13 +165,15 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
}
|
}
|
||||||
|
|
||||||
case ADD_REACTION_MESSAGE: {
|
case ADD_REACTION_MESSAGE: {
|
||||||
_handleReceivedMessage(store, {
|
if (localParticipant?.id) {
|
||||||
id: localParticipant.id,
|
_handleReceivedMessage(store, {
|
||||||
message: action.message,
|
id: localParticipant.id,
|
||||||
privateMessage: false,
|
message: action.message,
|
||||||
timestamp: Date.now(),
|
privateMessage: false,
|
||||||
lobbyChat: false
|
timestamp: Date.now(),
|
||||||
}, false, true);
|
lobbyChat: false
|
||||||
|
}, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ StateListenerRegistry.register(
|
||||||
* @private
|
* @private
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _addChatMsgListener(conference, store) {
|
function _addChatMsgListener(conference: IJitsiConference, store: IStore) {
|
||||||
if (store.getState()['features/base/config'].iAmRecorder) {
|
if (store.getState()['features/base/config'].iAmRecorder) {
|
||||||
// We don't register anything on web if we are in iAmRecorder mode
|
// We don't register anything on web if we are in iAmRecorder mode
|
||||||
return;
|
return;
|
||||||
|
@ -228,7 +228,7 @@ function _addChatMsgListener(conference, store) {
|
||||||
|
|
||||||
conference.on(
|
conference.on(
|
||||||
JitsiConferenceEvents.MESSAGE_RECEIVED,
|
JitsiConferenceEvents.MESSAGE_RECEIVED,
|
||||||
(id, message, timestamp) => {
|
(id: string, message: string, timestamp: number) => {
|
||||||
_onConferenceMessageReceived(store, { id,
|
_onConferenceMessageReceived(store, { id,
|
||||||
message,
|
message,
|
||||||
timestamp,
|
timestamp,
|
||||||
|
@ -238,7 +238,7 @@ function _addChatMsgListener(conference, store) {
|
||||||
|
|
||||||
conference.on(
|
conference.on(
|
||||||
JitsiConferenceEvents.PRIVATE_MESSAGE_RECEIVED,
|
JitsiConferenceEvents.PRIVATE_MESSAGE_RECEIVED,
|
||||||
(id, message, timestamp) => {
|
(id: string, message: string, timestamp: number) => {
|
||||||
_onConferenceMessageReceived(store, {
|
_onConferenceMessageReceived(store, {
|
||||||
id,
|
id,
|
||||||
message,
|
message,
|
||||||
|
@ -250,13 +250,14 @@ function _addChatMsgListener(conference, store) {
|
||||||
|
|
||||||
conference.on(
|
conference.on(
|
||||||
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
|
JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
|
||||||
(...args) => {
|
(...args: any) => {
|
||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
|
|
||||||
if (!isReactionsEnabled(state)) {
|
if (!isReactionsEnabled(state)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
store.dispatch(endpointMessageReceived(...args));
|
store.dispatch(endpointMessageReceived(...args));
|
||||||
|
|
||||||
if (args && args.length >= 2) {
|
if (args && args.length >= 2) {
|
||||||
|
@ -277,7 +278,7 @@ function _addChatMsgListener(conference, store) {
|
||||||
});
|
});
|
||||||
|
|
||||||
conference.on(
|
conference.on(
|
||||||
JitsiConferenceEvents.CONFERENCE_ERROR, (errorType, error) => {
|
JitsiConferenceEvents.CONFERENCE_ERROR, (errorType: string, error: Error) => {
|
||||||
errorType === JitsiConferenceErrors.CHAT_ERROR && _handleChatError(store, error);
|
errorType === JitsiConferenceErrors.CHAT_ERROR && _handleChatError(store, error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -289,7 +290,8 @@ function _addChatMsgListener(conference, store) {
|
||||||
* @param {Object} message - The message object.
|
* @param {Object} message - The message object.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _onConferenceMessageReceived(store, { id, message, timestamp, privateMessage }) {
|
function _onConferenceMessageReceived(store: IStore, { id, message, timestamp, privateMessage }: {
|
||||||
|
id: string; message: string; privateMessage: boolean; timestamp: number; }) {
|
||||||
const isGif = isGifMessage(message);
|
const isGif = isGifMessage(message);
|
||||||
|
|
||||||
if (isGif) {
|
if (isGif) {
|
||||||
|
@ -315,7 +317,7 @@ function _onConferenceMessageReceived(store, { id, message, timestamp, privateMe
|
||||||
* @param {string} message - The message sent.
|
* @param {string} message - The message sent.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _handleGifMessageReceived(store, id, message) {
|
function _handleGifMessageReceived(store: IStore, id: string, message: string) {
|
||||||
const url = message.substring(GIF_PREFIX.length, message.length - 1);
|
const url = message.substring(GIF_PREFIX.length, message.length - 1);
|
||||||
|
|
||||||
store.dispatch(addGif(id, url));
|
store.dispatch(addGif(id, url));
|
||||||
|
@ -328,7 +330,7 @@ function _handleGifMessageReceived(store, id, message) {
|
||||||
* @param {string} error - The error message.
|
* @param {string} error - The error message.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _handleChatError({ dispatch }, error) {
|
function _handleChatError({ dispatch }: IStore, error: Error) {
|
||||||
dispatch(addMessage({
|
dispatch(addMessage({
|
||||||
hasRead: true,
|
hasRead: true,
|
||||||
messageType: MESSAGE_TYPE_ERROR,
|
messageType: MESSAGE_TYPE_ERROR,
|
||||||
|
@ -346,7 +348,7 @@ function _handleChatError({ dispatch }, error) {
|
||||||
* @returns {Function}
|
* @returns {Function}
|
||||||
*/
|
*/
|
||||||
export function handleLobbyMessageReceived(message: string, participantId: string) {
|
export function handleLobbyMessageReceived(message: string, participantId: string) {
|
||||||
return async (dispatch: Dispatch<any>, getState: Function) => {
|
return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
|
||||||
_handleReceivedMessage({ dispatch,
|
_handleReceivedMessage({ dispatch,
|
||||||
getState }, { id: participantId,
|
getState }, { id: participantId,
|
||||||
message,
|
message,
|
||||||
|
@ -364,11 +366,11 @@ export function handleLobbyMessageReceived(message: string, participantId: strin
|
||||||
* @param {string} id - The knocking participant id.
|
* @param {string} id - The knocking participant id.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function getLobbyChatDisplayName(state, id) {
|
function getLobbyChatDisplayName(state: IState, id: string) {
|
||||||
const { knockingParticipants } = state['features/lobby'];
|
const { knockingParticipants } = state['features/lobby'];
|
||||||
const { lobbyMessageRecipient } = state['features/chat'];
|
const { lobbyMessageRecipient } = state['features/chat'];
|
||||||
|
|
||||||
if (id === lobbyMessageRecipient.id) {
|
if (id === lobbyMessageRecipient?.id) {
|
||||||
return lobbyMessageRecipient.name;
|
return lobbyMessageRecipient.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +392,9 @@ function getLobbyChatDisplayName(state, id) {
|
||||||
* @param {boolean} isReaction - Whether or not the message is a reaction message.
|
* @param {boolean} isReaction - Whether or not the message is a reaction message.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _handleReceivedMessage({ dispatch, getState },
|
function _handleReceivedMessage({ dispatch, getState }: IStore,
|
||||||
{ id, message, privateMessage, timestamp, lobbyChat },
|
{ id, message, privateMessage, timestamp, lobbyChat }: {
|
||||||
|
id: string; lobbyChat: boolean; message: string; privateMessage: boolean; timestamp: number; },
|
||||||
shouldPlaySound = true,
|
shouldPlaySound = true,
|
||||||
isReaction = false
|
isReaction = false
|
||||||
) {
|
) {
|
||||||
|
@ -407,7 +410,7 @@ function _handleReceivedMessage({ dispatch, getState },
|
||||||
|
|
||||||
// Provide a default for for the case when a message is being
|
// Provide a default for for the case when a message is being
|
||||||
// backfilled for a participant that has left the conference.
|
// backfilled for a participant that has left the conference.
|
||||||
const participant = getParticipantById(state, id) || {};
|
const participant = getParticipantById(state, id) || { local: undefined };
|
||||||
|
|
||||||
const localParticipant = getLocalParticipant(getState);
|
const localParticipant = getLocalParticipant(getState);
|
||||||
const displayName = lobbyChat
|
const displayName = lobbyChat
|
||||||
|
@ -418,7 +421,7 @@ function _handleReceivedMessage({ dispatch, getState },
|
||||||
const millisecondsTimestamp = timestampToDate.getTime();
|
const millisecondsTimestamp = timestampToDate.getTime();
|
||||||
|
|
||||||
// skip message notifications on join (the messages having timestamp - coming from the history)
|
// skip message notifications on join (the messages having timestamp - coming from the history)
|
||||||
const shouldShowNotification = userSelectedNotifications['notify.chatMessages']
|
const shouldShowNotification = userSelectedNotifications?.['notify.chatMessages']
|
||||||
&& !hasRead && !isReaction && !timestamp;
|
&& !hasRead && !isReaction && !timestamp;
|
||||||
|
|
||||||
dispatch(addMessage({
|
dispatch(addMessage({
|
||||||
|
@ -429,7 +432,7 @@ function _handleReceivedMessage({ dispatch, getState },
|
||||||
message,
|
message,
|
||||||
privateMessage,
|
privateMessage,
|
||||||
lobbyChat,
|
lobbyChat,
|
||||||
recipient: getParticipantDisplayName(state, localParticipant.id),
|
recipient: getParticipantDisplayName(state, localParticipant?.id ?? ''),
|
||||||
timestamp: millisecondsTimestamp,
|
timestamp: millisecondsTimestamp,
|
||||||
isReaction
|
isReaction
|
||||||
}));
|
}));
|
||||||
|
@ -471,9 +474,14 @@ function _handleReceivedMessage({ dispatch, getState },
|
||||||
* @param {boolean} isLobbyPrivateMessage - Is a lobby message.
|
* @param {boolean} isLobbyPrivateMessage - Is a lobby message.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _persistSentPrivateMessage({ dispatch, getState }, recipientID, message, isLobbyPrivateMessage = false) {
|
function _persistSentPrivateMessage({ dispatch, getState }: IStore, recipientID: string,
|
||||||
|
message: string, isLobbyPrivateMessage = false) {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const localParticipant = getLocalParticipant(state);
|
const localParticipant = getLocalParticipant(state);
|
||||||
|
|
||||||
|
if (!localParticipant?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const displayName = getParticipantDisplayName(state, localParticipant.id);
|
const displayName = getParticipantDisplayName(state, localParticipant.id);
|
||||||
const { lobbyMessageRecipient } = state['features/chat'];
|
const { lobbyMessageRecipient } = state['features/chat'];
|
||||||
|
|
||||||
|
@ -486,7 +494,7 @@ function _persistSentPrivateMessage({ dispatch, getState }, recipientID, message
|
||||||
privateMessage: !isLobbyPrivateMessage,
|
privateMessage: !isLobbyPrivateMessage,
|
||||||
lobbyChat: isLobbyPrivateMessage,
|
lobbyChat: isLobbyPrivateMessage,
|
||||||
recipient: isLobbyPrivateMessage
|
recipient: isLobbyPrivateMessage
|
||||||
? lobbyMessageRecipient && lobbyMessageRecipient.name
|
? lobbyMessageRecipient?.name
|
||||||
: getParticipantDisplayName(getState, recipientID),
|
: getParticipantDisplayName(getState, recipientID),
|
||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
}));
|
}));
|
||||||
|
@ -500,7 +508,7 @@ function _persistSentPrivateMessage({ dispatch, getState }, recipientID, message
|
||||||
* @param {Object} action - The action being dispatched now.
|
* @param {Object} action - The action being dispatched now.
|
||||||
* @returns {string?}
|
* @returns {string?}
|
||||||
*/
|
*/
|
||||||
function _shouldSendPrivateMessageTo(state, action): ?string {
|
function _shouldSendPrivateMessageTo(state: IState, action: AnyAction) {
|
||||||
if (action.ignorePrivacy) {
|
if (action.ignorePrivacy) {
|
||||||
// Shortcut: this is only true, if we already displayed the notice, so no need to show it again.
|
// Shortcut: this is only true, if we already displayed the notice, so no need to show it again.
|
||||||
return undefined;
|
return undefined;
|
|
@ -38,7 +38,7 @@ export interface IMessage {
|
||||||
messageType: string;
|
messageType: string;
|
||||||
privateMessage: boolean;
|
privateMessage: boolean;
|
||||||
recipient: string;
|
recipient: string;
|
||||||
timestamp: string;
|
timestamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IChatState {
|
export interface IChatState {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// @flow
|
import { openDialog } from '../base/dialog/actions';
|
||||||
|
|
||||||
import { openDialog } from '../../features/base/dialog';
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
import { DisplayNamePrompt } from './components';
|
import { DisplayNamePrompt } from './components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +10,7 @@ import { DisplayNamePrompt } from './components';
|
||||||
* submit of the dialog.
|
* submit of the dialog.
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
export function openDisplayNamePrompt(onPostSubmit: ?Function) {
|
export function openDisplayNamePrompt(onPostSubmit?: Function) {
|
||||||
return openDialog(DisplayNamePrompt, {
|
return openDialog(DisplayNamePrompt, {
|
||||||
onPostSubmit
|
onPostSubmit
|
||||||
});
|
});
|
|
@ -1,9 +1,9 @@
|
||||||
// @flow
|
import { hideDialog } from '../base/dialog/actions';
|
||||||
|
import { isDialogOpen } from '../base/dialog/functions';
|
||||||
import { hideDialog, isDialogOpen } from '../base/dialog';
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
||||||
import { MiddlewareRegistry } from '../base/redux';
|
import { SETTINGS_UPDATED } from '../base/settings/actionTypes';
|
||||||
import { SETTINGS_UPDATED } from '../base/settings';
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
import { DisplayNamePrompt } from './components';
|
import { DisplayNamePrompt } from './components';
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
import { IState } from '../app/types';
|
||||||
|
import { IStateful } from '../base/app/types';
|
||||||
import { toState } from '../base/redux';
|
import { toState } from '../base/redux/functions';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,13 +10,13 @@ import { toState } from '../base/redux';
|
||||||
* @param {Object} state - A redux state.
|
* @param {Object} state - A redux state.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function extractFqnFromPath(state?: Object) {
|
export function extractFqnFromPath(state?: IState) {
|
||||||
let pathname;
|
let pathname;
|
||||||
|
|
||||||
if (window.location.pathname) {
|
if (window.location.pathname) {
|
||||||
pathname = window.location.pathname;
|
pathname = window.location.pathname;
|
||||||
} else if (state && state['features/base/connection']) {
|
} else if (state?.['features/base/connection']) {
|
||||||
pathname = state['features/base/connection'].locationURL.pathname;
|
pathname = state['features/base/connection'].locationURL?.pathname ?? '';
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ export function extractFqnFromPath(state?: Object) {
|
||||||
* {@code getState} function.
|
* {@code getState} function.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export async function getDynamicBrandingUrl(stateful: Object | Function) {
|
export async function getDynamicBrandingUrl(stateful: IStateful) {
|
||||||
const state = toState(stateful);
|
const state = toState(stateful);
|
||||||
|
|
||||||
// NB: On web this is dispatched really early, before the config has been stored in the
|
// NB: On web this is dispatched really early, before the config has been stored in the
|
||||||
|
@ -61,6 +61,6 @@ export async function getDynamicBrandingUrl(stateful: Object | Function) {
|
||||||
* @param {Object} state - Global state of the app.
|
* @param {Object} state - Global state of the app.
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isDynamicBrandingDataLoaded(state: Object) {
|
export function isDynamicBrandingDataLoaded(state: IState) {
|
||||||
return state['features/dynamic-branding'].customizationReady;
|
return state['features/dynamic-branding'].customizationReady;
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { IStateful } from '../base/app/types';
|
||||||
import { getParticipantCount } from '../base/participants/functions';
|
import { getParticipantCount } from '../base/participants/functions';
|
||||||
import { toState } from '../base/redux';
|
import { toState } from '../base/redux/functions';
|
||||||
|
|
||||||
import { MAX_MODE_LIMIT, MAX_MODE_THRESHOLD } from './constants';
|
import { MAX_MODE_LIMIT, MAX_MODE_THRESHOLD } from './constants';
|
||||||
|
|
||||||
|
@ -8,14 +8,14 @@ import { MAX_MODE_LIMIT, MAX_MODE_THRESHOLD } from './constants';
|
||||||
* Gets the value of a specific React {@code Component} prop of the currently
|
* Gets the value of a specific React {@code Component} prop of the currently
|
||||||
* mounted {@link App}.
|
* mounted {@link App}.
|
||||||
*
|
*
|
||||||
* @param {Function|Object} stateful - The redux store or {@code getState}
|
* @param {IStateful} stateful - The redux store or {@code getState}
|
||||||
* function.
|
* function.
|
||||||
* @param {string} propName - The name of the React {@code Component} prop of
|
* @param {string} propName - The name of the React {@code Component} prop of
|
||||||
* the currently mounted {@code App} to get.
|
* the currently mounted {@code App} to get.
|
||||||
* @returns {*} The value of the specified React {@code Component} prop of the
|
* @returns {*} The value of the specified React {@code Component} prop of the
|
||||||
* currently mounted {@code App}.
|
* currently mounted {@code App}.
|
||||||
*/
|
*/
|
||||||
export function doesEveryoneSupportE2EE(stateful) {
|
export function doesEveryoneSupportE2EE(stateful: IStateful) {
|
||||||
const state = toState(stateful);
|
const state = toState(stateful);
|
||||||
const { everyoneSupportE2EE } = state['features/e2ee'];
|
const { everyoneSupportE2EE } = state['features/e2ee'];
|
||||||
const { e2eeSupported } = state['features/base/conference'];
|
const { e2eeSupported } = state['features/base/conference'];
|
||||||
|
@ -37,7 +37,7 @@ export function doesEveryoneSupportE2EE(stateful) {
|
||||||
* function.
|
* function.
|
||||||
* @returns {boolean}.
|
* @returns {boolean}.
|
||||||
*/
|
*/
|
||||||
export function isMaxModeReached(stateful) {
|
export function isMaxModeReached(stateful: IStateful) {
|
||||||
const participantCount = getParticipantCount(toState(stateful));
|
const participantCount = getParticipantCount(toState(stateful));
|
||||||
|
|
||||||
return participantCount >= MAX_MODE_LIMIT;
|
return participantCount >= MAX_MODE_LIMIT;
|
||||||
|
@ -50,7 +50,7 @@ export function isMaxModeReached(stateful) {
|
||||||
* function.
|
* function.
|
||||||
* @returns {boolean}.
|
* @returns {boolean}.
|
||||||
*/
|
*/
|
||||||
export function isMaxModeThresholdReached(stateful) {
|
export function isMaxModeThresholdReached(stateful: IStateful) {
|
||||||
const participantCount = getParticipantCount(toState(stateful));
|
const participantCount = getParticipantCount(toState(stateful));
|
||||||
|
|
||||||
return participantCount >= MAX_MODE_LIMIT + MAX_MODE_THRESHOLD;
|
return participantCount >= MAX_MODE_LIMIT + MAX_MODE_THRESHOLD;
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import { getLogger } from '../base/logging/functions';
|
import { getLogger } from '../base/logging/functions';
|
||||||
|
|
||||||
export default getLogger('features/e2ee');
|
export default getLogger('features/e2ee');
|
|
@ -1,22 +1,21 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import { batch } from 'react-redux';
|
import { batch } from 'react-redux';
|
||||||
|
|
||||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
import { IStore } from '../app/types';
|
||||||
import { CONFERENCE_JOINED, getCurrentConference } from '../base/conference';
|
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app/actionTypes';
|
||||||
|
import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
||||||
|
import { getCurrentConference } from '../base/conference/functions';
|
||||||
|
import { PARTICIPANT_JOINED, PARTICIPANT_LEFT, PARTICIPANT_UPDATED } from '../base/participants/actionTypes';
|
||||||
|
import { participantUpdated } from '../base/participants/actions';
|
||||||
import {
|
import {
|
||||||
PARTICIPANT_JOINED,
|
|
||||||
PARTICIPANT_LEFT,
|
|
||||||
PARTICIPANT_UPDATED,
|
|
||||||
getLocalParticipant,
|
getLocalParticipant,
|
||||||
getParticipantById,
|
getParticipantById,
|
||||||
getParticipantCount,
|
getParticipantCount,
|
||||||
getRemoteParticipants,
|
getRemoteParticipants,
|
||||||
isScreenShareParticipant,
|
isScreenShareParticipant
|
||||||
participantUpdated
|
} from '../base/participants/functions';
|
||||||
} from '../base/participants';
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
||||||
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
import StateListenerRegistry from '../base/redux/StateListenerRegistry';
|
||||||
import { playSound, registerSound, unregisterSound } from '../base/sounds';
|
import { playSound, registerSound, unregisterSound } from '../base/sounds/actions';
|
||||||
|
|
||||||
import { SET_MEDIA_ENCRYPTION_KEY, TOGGLE_E2EE } from './actionTypes';
|
import { SET_MEDIA_ENCRYPTION_KEY, TOGGLE_E2EE } from './actionTypes';
|
||||||
import { setE2EEMaxMode, setEveryoneEnabledE2EE, setEveryoneSupportE2EE, toggleE2EE } from './actions';
|
import { setE2EEMaxMode, setEveryoneEnabledE2EE, setEveryoneSupportE2EE, toggleE2EE } from './actions';
|
||||||
|
@ -66,7 +65,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
let newEveryoneSupportE2EE = true;
|
let newEveryoneSupportE2EE = true;
|
||||||
let newEveryoneEnabledE2EE = true;
|
let newEveryoneEnabledE2EE = true;
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
for (const [ key, p ] of getRemoteParticipants(state)) {
|
for (const [ key, p ] of getRemoteParticipants(state)) {
|
||||||
if (!p.e2eeEnabled) {
|
if (!p.e2eeEnabled) {
|
||||||
newEveryoneEnabledE2EE = false;
|
newEveryoneEnabledE2EE = false;
|
||||||
|
@ -136,10 +135,10 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
|
|
||||||
case PARTICIPANT_LEFT: {
|
case PARTICIPANT_LEFT: {
|
||||||
const previosState = getState();
|
const previosState = getState();
|
||||||
const participant = getParticipantById(previosState, action.participant?.id) || {};
|
const participant = getParticipantById(previosState, action.participant?.id);
|
||||||
const result = next(action);
|
const result = next(action);
|
||||||
const newState = getState();
|
const newState = getState();
|
||||||
const { e2eeEnabled = false, e2eeSupported = false } = participant;
|
const { e2eeEnabled = false, e2eeSupported = false } = participant ?? {};
|
||||||
|
|
||||||
if (isScreenShareParticipant(participant)) {
|
if (isScreenShareParticipant(participant)) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -154,7 +153,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
let latestEveryoneEnabledE2EE = true;
|
let latestEveryoneEnabledE2EE = true;
|
||||||
let latestEveryoneSupportE2EE = true;
|
let latestEveryoneSupportE2EE = true;
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
for (const [ key, p ] of getRemoteParticipants(newState)) {
|
for (const [ key, p ] of getRemoteParticipants(newState)) {
|
||||||
if (!p.e2eeEnabled) {
|
if (!p.e2eeEnabled) {
|
||||||
latestEveryoneEnabledE2EE = false;
|
latestEveryoneEnabledE2EE = false;
|
||||||
|
@ -190,7 +189,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
}
|
}
|
||||||
|
|
||||||
case TOGGLE_E2EE: {
|
case TOGGLE_E2EE: {
|
||||||
if (conference && conference.isE2EESupported() && conference.isE2EEEnabled() !== action.enabled) {
|
if (conference?.isE2EESupported() && conference.isE2EEEnabled() !== action.enabled) {
|
||||||
logger.debug(`E2EE will be ${action.enabled ? 'enabled' : 'disabled'}`);
|
logger.debug(`E2EE will be ${action.enabled ? 'enabled' : 'disabled'}`);
|
||||||
conference.toggleE2EE(action.enabled);
|
conference.toggleE2EE(action.enabled);
|
||||||
|
|
||||||
|
@ -199,7 +198,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
|
|
||||||
dispatch(participantUpdated({
|
dispatch(participantUpdated({
|
||||||
e2eeEnabled: action.enabled,
|
e2eeEnabled: action.enabled,
|
||||||
id: participant.id,
|
id: participant?.id ?? '',
|
||||||
local: true
|
local: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -212,7 +211,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
}
|
}
|
||||||
|
|
||||||
case SET_MEDIA_ENCRYPTION_KEY: {
|
case SET_MEDIA_ENCRYPTION_KEY: {
|
||||||
if (conference && conference.isE2EESupported()) {
|
if (conference?.isE2EESupported()) {
|
||||||
const { exportedKey, index } = action.keyInfo;
|
const { exportedKey, index } = action.keyInfo;
|
||||||
|
|
||||||
if (exportedKey) {
|
if (exportedKey) {
|
||||||
|
@ -265,7 +264,7 @@ StateListenerRegistry.register(
|
||||||
* @private
|
* @private
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function _updateMaxMode(dispatch, getState) {
|
function _updateMaxMode(dispatch: IStore['dispatch'], getState: IStore['getState']) {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
||||||
const { e2ee = {} } = state['features/base/config'];
|
const { e2ee = {} } = state['features/base/config'];
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the bundled audio file which will be played when e2ee is disabled.
|
* The name of the bundled audio file which will be played when e2ee is disabled.
|
||||||
*
|
*
|
|
@ -1,9 +1,8 @@
|
||||||
// @flow
|
// @ts-ignore
|
||||||
|
|
||||||
import type { Dispatch } from 'redux';
|
|
||||||
|
|
||||||
import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
|
import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
|
||||||
import { openDialog } from '../base/dialog';
|
import { IStore } from '../app/types';
|
||||||
|
import { IJitsiConference } from '../base/conference/reducer';
|
||||||
|
import { openDialog } from '../base/dialog/actions';
|
||||||
import { extractFqnFromPath } from '../dynamic-branding/functions.any';
|
import { extractFqnFromPath } from '../dynamic-branding/functions.any';
|
||||||
import { isVpaasMeeting } from '../jaas/functions';
|
import { isVpaasMeeting } from '../jaas/functions';
|
||||||
|
|
||||||
|
@ -12,11 +11,11 @@ import {
|
||||||
SUBMIT_FEEDBACK_ERROR,
|
SUBMIT_FEEDBACK_ERROR,
|
||||||
SUBMIT_FEEDBACK_SUCCESS
|
SUBMIT_FEEDBACK_SUCCESS
|
||||||
} from './actionTypes';
|
} from './actionTypes';
|
||||||
|
// eslint-disable-next-line lines-around-comment
|
||||||
|
// @ts-ignore
|
||||||
import { FeedbackDialog } from './components';
|
import { FeedbackDialog } from './components';
|
||||||
import { sendFeedbackToJaaSRequest } from './functions';
|
import { sendFeedbackToJaaSRequest } from './functions';
|
||||||
|
|
||||||
declare var config: Object;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches the passed in feedback in the redux store.
|
* Caches the passed in feedback in the redux store.
|
||||||
*
|
*
|
||||||
|
@ -48,13 +47,13 @@ export function cancelFeedback(score: number, message: string) {
|
||||||
* resolved with true if the dialog is disabled or the feedback was already
|
* resolved with true if the dialog is disabled or the feedback was already
|
||||||
* submitted. Rejected if another dialog is already displayed.
|
* submitted. Rejected if another dialog is already displayed.
|
||||||
*/
|
*/
|
||||||
export function maybeOpenFeedbackDialog(conference: Object) {
|
export function maybeOpenFeedbackDialog(conference: IJitsiConference) {
|
||||||
type R = {
|
type R = {
|
||||||
feedbackSubmitted: boolean,
|
feedbackSubmitted: boolean;
|
||||||
showThankYou: boolean
|
showThankYou: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (dispatch: Dispatch<any>, getState: Function): Promise<R> => {
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']): Promise<R> => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const { feedbackPercentage = 100 } = state['features/base/config'];
|
const { feedbackPercentage = 100 } = state['features/base/config'];
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ export function maybeOpenFeedbackDialog(conference: Object) {
|
||||||
* is closed.
|
* is closed.
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
export function openFeedbackDialog(conference: Object, onClose: ?Function) {
|
export function openFeedbackDialog(conference: Object, onClose?: Function) {
|
||||||
return openDialog(FeedbackDialog, {
|
return openDialog(FeedbackDialog, {
|
||||||
conference,
|
conference,
|
||||||
onClose
|
onClose
|
||||||
|
@ -120,8 +119,8 @@ export function openFeedbackDialog(conference: Object, onClose: ?Function) {
|
||||||
*
|
*
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
export function sendJaasFeedbackMetadata(conference: Object, feedback: Object) {
|
export function sendJaasFeedbackMetadata(conference: IJitsiConference, feedback: Object) {
|
||||||
return (dispatch: Dispatch<any>, getState: Function): Promise<any> => {
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']): Promise<any> => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const { jaasFeedbackMetadataURL } = state['features/base/config'];
|
const { jaasFeedbackMetadataURL } = state['features/base/config'];
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ export function sendJaasFeedbackMetadata(conference: Object, feedback: Object) {
|
||||||
const feedbackData = {
|
const feedbackData = {
|
||||||
...feedback,
|
...feedback,
|
||||||
sessionId: conference.sessionId,
|
sessionId: conference.sessionId,
|
||||||
userId: user.id,
|
userId: user?.id,
|
||||||
meetingFqn,
|
meetingFqn,
|
||||||
jwt,
|
jwt,
|
||||||
tenant
|
tenant
|
||||||
|
@ -159,8 +158,8 @@ export function sendJaasFeedbackMetadata(conference: Object, feedback: Object) {
|
||||||
export function submitFeedback(
|
export function submitFeedback(
|
||||||
score: number,
|
score: number,
|
||||||
message: string,
|
message: string,
|
||||||
conference: Object) {
|
conference: IJitsiConference) {
|
||||||
return (dispatch: Dispatch<any>) =>
|
return (dispatch: IStore['dispatch']) =>
|
||||||
conference.sendFeedback(score, message)
|
conference.sendFeedback(score, message)
|
||||||
.then(() => dispatch({ type: SUBMIT_FEEDBACK_SUCCESS }))
|
.then(() => dispatch({ type: SUBMIT_FEEDBACK_SUCCESS }))
|
||||||
.then(() => dispatch(sendJaasFeedbackMetadata(conference, { score,
|
.then(() => dispatch(sendJaasFeedbackMetadata(conference, { score,
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +7,10 @@ import logger from './logger';
|
||||||
* @param {Object} feedbackData - The feedback data object.
|
* @param {Object} feedbackData - The feedback data object.
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
export async function sendFeedbackToJaaSRequest(url: string, feedbackData: Object) {
|
export async function sendFeedbackToJaaSRequest(url: string, feedbackData: {
|
||||||
|
jwt?: string; meetingFqn: string; message?: string; score?: number;
|
||||||
|
sessionId: string; tenant?: string; userId?: string;
|
||||||
|
}) {
|
||||||
const {
|
const {
|
||||||
jwt,
|
jwt,
|
||||||
sessionId,
|
sessionId,
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import { getLogger } from '../base/logging/functions';
|
import { getLogger } from '../base/logging/functions';
|
||||||
|
|
||||||
export default getLogger('features/feedback');
|
export default getLogger('features/feedback');
|
|
@ -1,5 +1,4 @@
|
||||||
// @flow
|
import { IState } from '../app/types';
|
||||||
|
|
||||||
|
|
||||||
import { VPAAS_TENANT_PREFIX } from './constants';
|
import { VPAAS_TENANT_PREFIX } from './constants';
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
@ -23,20 +22,20 @@ function extractVpaasTenantFromPath(path: string) {
|
||||||
/**
|
/**
|
||||||
* Returns the vpaas tenant.
|
* Returns the vpaas tenant.
|
||||||
*
|
*
|
||||||
* @param {Object} state - The global state.
|
* @param {IState} state - The global state.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function getVpaasTenant(state: Object) {
|
export function getVpaasTenant(state: IState) {
|
||||||
return extractVpaasTenantFromPath(state['features/base/connection'].locationURL.pathname);
|
return extractVpaasTenantFromPath(state['features/base/connection'].locationURL?.pathname ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the current meeting is a vpaas one.
|
* Returns true if the current meeting is a vpaas one.
|
||||||
*
|
*
|
||||||
* @param {Object} state - The state of the app.
|
* @param {IState} state - The state of the app.
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isVpaasMeeting(state: Object) {
|
export function isVpaasMeeting(state: IState) {
|
||||||
const connection = state['features/base/connection'];
|
const connection = state['features/base/connection'];
|
||||||
|
|
||||||
if (connection?.locationURL?.pathname) {
|
if (connection?.locationURL?.pathname) {
|
||||||
|
@ -57,8 +56,8 @@ export function isVpaasMeeting(state: Object) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export async function sendGetDetailsRequest({ appId, baseUrl }: {
|
export async function sendGetDetailsRequest({ appId, baseUrl }: {
|
||||||
appId: string,
|
appId: string;
|
||||||
baseUrl: string,
|
baseUrl: string;
|
||||||
}) {
|
}) {
|
||||||
const fullUrl = `${baseUrl}/v1/public/tenants/${encodeURIComponent(appId)}`;
|
const fullUrl = `${baseUrl}/v1/public/tenants/${encodeURIComponent(appId)}`;
|
||||||
|
|
||||||
|
@ -70,7 +69,7 @@ export async function sendGetDetailsRequest({ appId, baseUrl }: {
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('Request not successful');
|
throw new Error('Request not successful');
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,11 +78,11 @@ export async function sendGetDetailsRequest({ appId, baseUrl }: {
|
||||||
/**
|
/**
|
||||||
* Returns the billing id for vpaas meetings.
|
* Returns the billing id for vpaas meetings.
|
||||||
*
|
*
|
||||||
* @param {Object} state - The state of the app.
|
* @param {IState} state - The state of the app.
|
||||||
* @param {string} feature - Feature to be looked up for disable state.
|
* @param {string} feature - Feature to be looked up for disable state.
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isFeatureDisabled(state: Object, feature: string) {
|
export function isFeatureDisabled(state: IState, feature: string) {
|
||||||
return state['features/jaas'].disabledFeatures.includes(feature);
|
return state['features/jaas'].disabledFeatures.includes(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +95,8 @@ export function isFeatureDisabled(state: Object, feature: string) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export async function sendGetJWTRequest({ appId, baseUrl }: {
|
export async function sendGetJWTRequest({ appId, baseUrl }: {
|
||||||
appId: string,
|
appId: string;
|
||||||
baseUrl: string
|
baseUrl: string;
|
||||||
}) {
|
}) {
|
||||||
const fullUrl = `${baseUrl}/v1/public/token/${encodeURIComponent(appId)}`;
|
const fullUrl = `${baseUrl}/v1/public/token/${encodeURIComponent(appId)}`;
|
||||||
|
|
||||||
|
@ -111,7 +110,7 @@ export async function sendGetJWTRequest({ appId, baseUrl }: {
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('Request not successful');
|
throw new Error('Request not successful');
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,10 +119,10 @@ export async function sendGetJWTRequest({ appId, baseUrl }: {
|
||||||
/**
|
/**
|
||||||
* Gets a jaas JWT.
|
* Gets a jaas JWT.
|
||||||
*
|
*
|
||||||
* @param {Object} state - Redux state.
|
* @param {IState} state - Redux state.
|
||||||
* @returns {string} The JWT.
|
* @returns {string} The JWT.
|
||||||
*/
|
*/
|
||||||
export async function getJaasJWT(state: Object) {
|
export async function getJaasJWT(state: IState) {
|
||||||
const baseUrl = state['features/base/config'].jaasTokenUrl;
|
const baseUrl = state['features/base/config'].jaasTokenUrl;
|
||||||
const appId = getVpaasTenant(state);
|
const appId = getVpaasTenant(state);
|
||||||
|
|
||||||
|
@ -133,7 +132,7 @@ export async function getJaasJWT(state: Object) {
|
||||||
try {
|
try {
|
||||||
const jwt = await sendGetJWTRequest({
|
const jwt = await sendGetJWTRequest({
|
||||||
appId,
|
appId,
|
||||||
baseUrl
|
baseUrl: baseUrl ?? ''
|
||||||
});
|
});
|
||||||
|
|
||||||
return jwt.token;
|
return jwt.token;
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import { getLogger } from '../base/logging/functions';
|
import { getLogger } from '../base/logging/functions';
|
||||||
|
|
||||||
export default getLogger('features/jaas');
|
export default getLogger('features/jaas');
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ENDPOINT_MESSAGE_RECEIVED,
|
ENDPOINT_MESSAGE_RECEIVED,
|
||||||
REMOVE_TRANSCRIPT_MESSAGE,
|
REMOVE_TRANSCRIPT_MESSAGE,
|
||||||
|
@ -102,7 +100,7 @@ export function setRequestingSubtitles(enabled: boolean) {
|
||||||
* type: UPDATE_TRANSLATION_LANGUAGE
|
* type: UPDATE_TRANSLATION_LANGUAGE
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
export function updateTranslationLanguage(value) {
|
export function updateTranslationLanguage(value: boolean) {
|
||||||
return {
|
return {
|
||||||
type: UPDATE_TRANSLATION_LANGUAGE,
|
type: UPDATE_TRANSLATION_LANGUAGE,
|
||||||
value
|
value
|
Loading…
Reference in New Issue