2022-10-20 12:11:27 +03:00
|
|
|
import { IReduxState } from '../app/types';
|
2022-09-29 14:45:34 +03:00
|
|
|
import { hasAvailableDevices } from '../base/devices/functions';
|
2022-10-17 18:32:18 +03:00
|
|
|
import { MEET_FEATURES } from '../base/jwt/constants';
|
|
|
|
|
import { isJwtFeatureEnabled } from '../base/jwt/functions';
|
2023-05-18 14:16:37 -05:00
|
|
|
import { IGUMPendingState } from '../base/media/types';
|
2023-06-29 14:59:12 +03:00
|
|
|
import ChatButton from '../chat/components/web/ChatButton';
|
|
|
|
|
import EmbedMeetingButton from '../embed-meeting/components/EmbedMeetingButton';
|
|
|
|
|
import SharedDocumentButton from '../etherpad/components/SharedDocumentButton.web';
|
|
|
|
|
import FeedbackButton from '../feedback/components/FeedbackButton.web';
|
|
|
|
|
import InviteButton from '../invite/components/add-people-dialog/web/InviteButton';
|
|
|
|
|
import KeyboardShortcutsButton from '../keyboard-shortcuts/components/web/KeyboardShortcutsButton';
|
|
|
|
|
import NoiseSuppressionButton from '../noise-suppression/components/NoiseSuppressionButton';
|
|
|
|
|
import ParticipantsPaneButton from '../participants-pane/components/web/ParticipantsPaneButton';
|
|
|
|
|
import RaiseHandContainerButton from '../reactions/components/web/RaiseHandContainerButtons';
|
|
|
|
|
import ReactionsMenuButton from '../reactions/components/web/ReactionsMenuButton';
|
|
|
|
|
import LiveStreamButton from '../recording/components/LiveStream/web/LiveStreamButton';
|
|
|
|
|
import RecordButton from '../recording/components/Recording/web/RecordButton';
|
|
|
|
|
import ShareAudioButton from '../screen-share/components/web/ShareAudioButton';
|
2022-01-05 15:27:42 -05:00
|
|
|
import { isScreenMediaShared } from '../screen-share/functions';
|
2023-06-29 14:59:12 +03:00
|
|
|
import SecurityDialogButton from '../security/components/security-dialog/web/SecurityDialogButton';
|
|
|
|
|
import SettingsButton from '../settings/components/web/SettingsButton';
|
|
|
|
|
import SharedVideoButton from '../shared-video/components/web/SharedVideoButton';
|
|
|
|
|
import SpeakerStatsButton from '../speaker-stats/components/web/SpeakerStatsButton';
|
|
|
|
|
import ClosedCaptionButton from '../subtitles/components/web/ClosedCaptionButton';
|
|
|
|
|
import TileViewButton from '../video-layout/components/TileViewButton';
|
|
|
|
|
import VideoQualityButton from '../video-quality/components/VideoQualityButton.web';
|
|
|
|
|
import VideoBackgroundButton from '../virtual-background/components/VideoBackgroundButton';
|
|
|
|
|
import WhiteboardButton from '../whiteboard/components/web/WhiteboardButton';
|
2022-09-30 17:50:45 +03:00
|
|
|
import { isWhiteboardVisible } from '../whiteboard/functions';
|
2020-04-16 13:47:10 +03:00
|
|
|
|
2023-06-29 14:59:12 +03:00
|
|
|
import DownloadButton from './components/DownloadButton';
|
|
|
|
|
import HelpButton from './components/HelpButton';
|
|
|
|
|
import AudioSettingsButton from './components/web/AudioSettingsButton';
|
|
|
|
|
import CustomOptionButton from './components/web/CustomOptionButton';
|
|
|
|
|
import FullscreenButton from './components/web/FullscreenButton';
|
|
|
|
|
import LinkToSalesforceButton from './components/web/LinkToSalesforceButton';
|
|
|
|
|
import ProfileButton from './components/web/ProfileButton';
|
|
|
|
|
import ShareDesktopButton from './components/web/ShareDesktopButton';
|
|
|
|
|
import ToggleCameraButton from './components/web/ToggleCameraButton';
|
|
|
|
|
import VideoSettingsButton from './components/web/VideoSettingsButton';
|
2024-05-22 13:01:17 -05:00
|
|
|
import { MAIN_TOOLBAR_BUTTONS_PRIORITY, TOOLBAR_TIMEOUT } from './constants';
|
|
|
|
|
import { IMainToolbarButtonThresholds, IToolboxButton, NOTIFY_CLICK_MODE } from './types';
|
2021-09-23 17:39:05 +03:00
|
|
|
|
2021-11-30 15:08:25 -05:00
|
|
|
export * from './functions.any';
|
|
|
|
|
|
2018-03-06 16:28:19 -08:00
|
|
|
/**
|
|
|
|
|
* Helper for getting the height of the toolbox.
|
|
|
|
|
*
|
|
|
|
|
* @returns {number} The height of the toolbox.
|
|
|
|
|
*/
|
|
|
|
|
export function getToolboxHeight() {
|
|
|
|
|
const toolbox = document.getElementById('new-toolbox');
|
|
|
|
|
|
2022-09-29 14:45:34 +03:00
|
|
|
return toolbox?.clientHeight || 0;
|
2018-03-06 16:28:19 -08:00
|
|
|
}
|
|
|
|
|
|
2017-07-26 15:52:41 -05:00
|
|
|
/**
|
2024-02-29 17:39:13 -06:00
|
|
|
* Checks if the specified button is enabled.
|
2017-07-26 15:52:41 -05:00
|
|
|
*
|
2024-02-29 17:39:13 -06:00
|
|
|
* @param {string} buttonName - The name of the button. See {@link interfaceConfig}.
|
|
|
|
|
* @param {Object|Array<string>} state - The redux state or the array with the enabled buttons.
|
|
|
|
|
* @returns {boolean} - True if the button is enabled and false otherwise.
|
2017-07-26 15:52:41 -05:00
|
|
|
*/
|
2024-02-29 17:39:13 -06:00
|
|
|
export function isButtonEnabled(buttonName: string, state: IReduxState | Array<string>) {
|
|
|
|
|
const buttons = Array.isArray(state) ? state : state['features/toolbox'].toolbarButtons || [];
|
2020-08-04 17:25:16 -05:00
|
|
|
|
2024-02-29 17:39:13 -06:00
|
|
|
return buttons.includes(buttonName);
|
2017-07-26 15:52:41 -05:00
|
|
|
}
|
2019-03-12 17:45:53 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates if the toolbox is visible or not.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2019-03-12 17:45:53 +00:00
|
|
|
* @returns {boolean} - True to indicate that the toolbox is visible, false -
|
|
|
|
|
* otherwise.
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function isToolboxVisible(state: IReduxState) {
|
2022-02-04 10:55:34 +01:00
|
|
|
const { iAmRecorder, iAmSipGateway, toolbarConfig } = state['features/base/config'];
|
2021-09-28 14:52:31 +03:00
|
|
|
const { alwaysVisible } = toolbarConfig || {};
|
2019-03-12 17:45:53 +00:00
|
|
|
const {
|
|
|
|
|
timeoutID,
|
|
|
|
|
visible
|
|
|
|
|
} = state['features/toolbox'];
|
2020-03-30 17:17:18 +03:00
|
|
|
const { audioSettingsVisible, videoSettingsVisible } = state['features/settings'];
|
2022-09-30 17:50:45 +03:00
|
|
|
const whiteboardVisible = isWhiteboardVisible(state);
|
2019-03-12 17:45:53 +00:00
|
|
|
|
2022-02-04 10:55:34 +01:00
|
|
|
return Boolean(!iAmRecorder && !iAmSipGateway
|
2022-09-30 17:50:45 +03:00
|
|
|
&& (
|
|
|
|
|
timeoutID
|
|
|
|
|
|| visible
|
|
|
|
|
|| alwaysVisible
|
|
|
|
|
|| audioSettingsVisible
|
|
|
|
|
|| videoSettingsVisible
|
|
|
|
|
|| whiteboardVisible
|
|
|
|
|
));
|
2019-03-12 17:45:53 +00:00
|
|
|
}
|
2020-04-16 13:47:10 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates if the audio settings button is disabled or not.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2020-04-16 13:47:10 +03:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function isAudioSettingsButtonDisabled(state: IReduxState) {
|
2021-11-30 15:08:25 -05:00
|
|
|
|
|
|
|
|
return !(hasAvailableDevices(state, 'audioInput')
|
2022-09-29 14:45:34 +03:00
|
|
|
|| hasAvailableDevices(state, 'audioOutput'))
|
|
|
|
|
|| state['features/base/config'].startSilent;
|
2020-04-16 13:47:10 +03:00
|
|
|
}
|
|
|
|
|
|
2022-01-05 15:27:42 -05:00
|
|
|
/**
|
|
|
|
|
* Indicates if the desktop share button is disabled or not.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2022-01-05 15:27:42 -05:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function isDesktopShareButtonDisabled(state: IReduxState) {
|
2022-01-05 15:27:42 -05:00
|
|
|
const { muted, unmuteBlocked } = state['features/base/media'].video;
|
|
|
|
|
const videoOrShareInProgress = !muted || isScreenMediaShared(state);
|
2022-10-17 18:32:18 +03:00
|
|
|
const enabledInJwt = isJwtFeatureEnabled(state, MEET_FEATURES.SCREEN_SHARING, true, true);
|
2022-01-05 15:27:42 -05:00
|
|
|
|
2022-10-17 18:32:18 +03:00
|
|
|
return !enabledInJwt || (unmuteBlocked && !videoOrShareInProgress);
|
2022-01-05 15:27:42 -05:00
|
|
|
}
|
|
|
|
|
|
2020-04-16 13:47:10 +03:00
|
|
|
/**
|
|
|
|
|
* Indicates if the video settings button is disabled or not.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2020-04-16 13:47:10 +03:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function isVideoSettingsButtonDisabled(state: IReduxState) {
|
2020-06-19 10:03:26 +03:00
|
|
|
return !hasAvailableDevices(state, 'videoInput');
|
2020-04-16 13:47:10 +03:00
|
|
|
}
|
2020-11-04 09:32:06 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates if the video mute button is disabled or not.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2020-11-04 09:32:06 +01:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function isVideoMuteButtonDisabled(state: IReduxState) {
|
2023-05-18 14:16:37 -05:00
|
|
|
const { muted, unmuteBlocked, gumPending } = state['features/base/media'].video;
|
2021-11-30 15:08:25 -05:00
|
|
|
|
2023-05-18 14:16:37 -05:00
|
|
|
return !hasAvailableDevices(state, 'videoInput')
|
|
|
|
|
|| (unmuteBlocked && Boolean(muted))
|
|
|
|
|
|| gumPending !== IGUMPendingState.NONE;
|
2020-11-04 09:32:06 +01:00
|
|
|
}
|
2021-09-10 14:05:16 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If an overflow drawer should be displayed or not.
|
|
|
|
|
* This is usually done for mobile devices or on narrow screens.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2021-09-10 14:05:16 +03:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function showOverflowDrawer(state: IReduxState) {
|
2021-09-10 14:05:16 +03:00
|
|
|
return state['features/toolbox'].overflowDrawer;
|
|
|
|
|
}
|
2021-09-10 15:17:57 +03:00
|
|
|
|
2023-04-27 19:19:53 -05:00
|
|
|
/**
|
|
|
|
|
* Returns true if the overflow menu button is displayed and false otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
|
|
|
|
* @returns {boolean} - True if the overflow menu button is displayed and false otherwise.
|
|
|
|
|
*/
|
|
|
|
|
export function showOverflowMenu(state: IReduxState) {
|
|
|
|
|
return state['features/toolbox'].overflowMenuVisible;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-10 15:17:57 +03:00
|
|
|
/**
|
|
|
|
|
* Indicates whether the toolbox is enabled or not.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2021-09-10 15:17:57 +03:00
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function isToolboxEnabled(state: IReduxState) {
|
2021-09-10 15:17:57 +03:00
|
|
|
return state['features/toolbox'].enabled;
|
|
|
|
|
}
|
2021-09-23 17:39:05 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the toolbar timeout from config or the default value.
|
|
|
|
|
*
|
2022-10-20 12:11:27 +03:00
|
|
|
* @param {IReduxState} state - The state from the Redux store.
|
2022-08-30 16:21:58 +02:00
|
|
|
* @returns {number} - Toolbar timeout in milliseconds.
|
2021-09-23 17:39:05 +03:00
|
|
|
*/
|
2022-10-20 12:11:27 +03:00
|
|
|
export function getToolbarTimeout(state: IReduxState) {
|
2022-09-29 14:45:34 +03:00
|
|
|
const { toolbarConfig } = state['features/base/config'];
|
2021-09-23 17:39:05 +03:00
|
|
|
|
2022-09-29 14:45:34 +03:00
|
|
|
return toolbarConfig?.timeout || TOOLBAR_TIMEOUT;
|
2021-09-23 17:39:05 +03:00
|
|
|
}
|
2023-06-29 14:59:12 +03:00
|
|
|
|
2024-05-22 13:01:17 -05:00
|
|
|
interface ICustomToolbarButton {
|
|
|
|
|
backgroundColor?: string;
|
|
|
|
|
icon: string;
|
|
|
|
|
id: string;
|
|
|
|
|
text: string;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-29 14:59:12 +03:00
|
|
|
/**
|
|
|
|
|
* Returns all buttons that could be rendered.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} _customToolbarButtons - An array containing custom buttons objects.
|
|
|
|
|
* @returns {Object} The button maps mainMenuButtons and overflowMenuButtons.
|
|
|
|
|
*/
|
2024-05-22 13:01:17 -05:00
|
|
|
export function getAllToolboxButtons(
|
|
|
|
|
_customToolbarButtons?: ICustomToolbarButton[]): { [key: string]: IToolboxButton; } {
|
2023-06-29 14:59:12 +03:00
|
|
|
const microphone = {
|
|
|
|
|
key: 'microphone',
|
|
|
|
|
Content: AudioSettingsButton,
|
|
|
|
|
group: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const camera = {
|
|
|
|
|
key: 'camera',
|
|
|
|
|
Content: VideoSettingsButton,
|
|
|
|
|
group: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const profile = {
|
|
|
|
|
key: 'profile',
|
|
|
|
|
Content: ProfileButton,
|
|
|
|
|
group: 1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const chat = {
|
|
|
|
|
key: 'chat',
|
|
|
|
|
Content: ChatButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const desktop = {
|
|
|
|
|
key: 'desktop',
|
|
|
|
|
Content: ShareDesktopButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// In Narrow layout and mobile web we are using drawer for popups and that is why it is better to include
|
|
|
|
|
// all forms of reactions in the overflow menu. Otherwise the toolbox will be hidden and the reactions popup
|
|
|
|
|
// misaligned.
|
|
|
|
|
const raisehand = {
|
|
|
|
|
key: 'raisehand',
|
|
|
|
|
Content: RaiseHandContainerButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const reactions = {
|
|
|
|
|
key: 'reactions',
|
|
|
|
|
Content: ReactionsMenuButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const participants = {
|
|
|
|
|
key: 'participants-pane',
|
|
|
|
|
Content: ParticipantsPaneButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const invite = {
|
|
|
|
|
key: 'invite',
|
|
|
|
|
Content: InviteButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const tileview = {
|
|
|
|
|
key: 'tileview',
|
|
|
|
|
Content: TileViewButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const toggleCamera = {
|
|
|
|
|
key: 'toggle-camera',
|
|
|
|
|
Content: ToggleCameraButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const videoquality = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'videoquality',
|
|
|
|
|
Content: VideoQualityButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const fullscreen = {
|
|
|
|
|
key: 'fullscreen',
|
|
|
|
|
Content: FullscreenButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const security = {
|
|
|
|
|
key: 'security',
|
|
|
|
|
Content: SecurityDialogButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const closedcaptions = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'closedcaptions',
|
|
|
|
|
Content: ClosedCaptionButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const recording = {
|
|
|
|
|
key: 'recording',
|
|
|
|
|
Content: RecordButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const livestreaming = {
|
|
|
|
|
key: 'livestreaming',
|
|
|
|
|
Content: LiveStreamButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const linktosalesforce = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'linktosalesforce',
|
|
|
|
|
Content: LinkToSalesforceButton,
|
|
|
|
|
group: 2
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const sharedvideo = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'sharedvideo',
|
|
|
|
|
Content: SharedVideoButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const shareaudio = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'shareaudio',
|
|
|
|
|
Content: ShareAudioButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const noisesuppression = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'noisesuppression',
|
|
|
|
|
Content: NoiseSuppressionButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const whiteboard = {
|
|
|
|
|
key: 'whiteboard',
|
|
|
|
|
Content: WhiteboardButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const etherpad = {
|
|
|
|
|
key: 'etherpad',
|
|
|
|
|
Content: SharedDocumentButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const virtualBackground = {
|
|
|
|
|
key: 'select-background',
|
|
|
|
|
Content: VideoBackgroundButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const stats = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'stats',
|
|
|
|
|
Content: SpeakerStatsButton,
|
|
|
|
|
group: 3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const settings = {
|
|
|
|
|
key: 'settings',
|
|
|
|
|
Content: SettingsButton,
|
|
|
|
|
group: 4
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const shortcuts = {
|
|
|
|
|
key: 'shortcuts',
|
|
|
|
|
Content: KeyboardShortcutsButton,
|
|
|
|
|
group: 4
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-17 09:53:08 -05:00
|
|
|
const embedmeeting = {
|
2023-06-29 14:59:12 +03:00
|
|
|
key: 'embedmeeting',
|
|
|
|
|
Content: EmbedMeetingButton,
|
|
|
|
|
group: 4
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const feedback = {
|
|
|
|
|
key: 'feedback',
|
|
|
|
|
Content: FeedbackButton,
|
|
|
|
|
group: 4
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const download = {
|
|
|
|
|
key: 'download',
|
|
|
|
|
Content: DownloadButton,
|
|
|
|
|
group: 4
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const help = {
|
|
|
|
|
key: 'help',
|
|
|
|
|
Content: HelpButton,
|
|
|
|
|
group: 4
|
|
|
|
|
};
|
|
|
|
|
|
2023-08-10 16:30:14 +03:00
|
|
|
const customButtons = _customToolbarButtons?.reduce((prev, { backgroundColor, icon, id, text }) => {
|
2023-06-29 14:59:12 +03:00
|
|
|
return {
|
|
|
|
|
...prev,
|
|
|
|
|
[id]: {
|
2023-08-10 16:30:14 +03:00
|
|
|
backgroundColor,
|
2023-06-29 14:59:12 +03:00
|
|
|
key: id,
|
|
|
|
|
Content: CustomOptionButton,
|
|
|
|
|
group: 4,
|
|
|
|
|
icon,
|
|
|
|
|
text
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
microphone,
|
|
|
|
|
camera,
|
|
|
|
|
profile,
|
|
|
|
|
desktop,
|
|
|
|
|
chat,
|
|
|
|
|
raisehand,
|
|
|
|
|
reactions,
|
2024-05-17 09:53:08 -05:00
|
|
|
'participants-pane': participants,
|
2023-06-29 14:59:12 +03:00
|
|
|
invite,
|
|
|
|
|
tileview,
|
2024-05-17 09:53:08 -05:00
|
|
|
'toggle-camera': toggleCamera,
|
|
|
|
|
videoquality,
|
2023-06-29 14:59:12 +03:00
|
|
|
fullscreen,
|
|
|
|
|
security,
|
2024-05-17 09:53:08 -05:00
|
|
|
closedcaptions,
|
2023-06-29 14:59:12 +03:00
|
|
|
recording,
|
|
|
|
|
livestreaming,
|
2024-05-17 09:53:08 -05:00
|
|
|
linktosalesforce,
|
|
|
|
|
sharedvideo,
|
|
|
|
|
shareaudio,
|
|
|
|
|
noisesuppression,
|
2023-06-29 14:59:12 +03:00
|
|
|
whiteboard,
|
|
|
|
|
etherpad,
|
2024-05-17 09:53:08 -05:00
|
|
|
'select-background': virtualBackground,
|
|
|
|
|
stats,
|
2023-06-29 14:59:12 +03:00
|
|
|
settings,
|
|
|
|
|
shortcuts,
|
2024-05-17 09:53:08 -05:00
|
|
|
embedmeeting,
|
2023-06-29 14:59:12 +03:00
|
|
|
feedback,
|
|
|
|
|
download,
|
|
|
|
|
help,
|
|
|
|
|
...customButtons
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-03-08 09:59:02 -06:00
|
|
|
|
2024-05-22 13:01:17 -05:00
|
|
|
/**
|
|
|
|
|
* Sets the notify click mode for the buttons.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} buttons - The list of toolbar buttons.
|
|
|
|
|
* @param {Map} buttonsWithNotifyClick - The buttons notify click configuration.
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
|
|
|
|
function setButtonsNotifyClickMode(buttons: Object, buttonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>) {
|
|
|
|
|
if (typeof APP === 'undefined' || (buttonsWithNotifyClick?.size ?? 0) <= 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.values(buttons).forEach((button: any) => {
|
|
|
|
|
if (typeof button === 'object') {
|
|
|
|
|
button.notifyMode = buttonsWithNotifyClick.get(button.key);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface IGetVisibleButtonsParams {
|
|
|
|
|
buttonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>;
|
|
|
|
|
clientWidth: number;
|
|
|
|
|
customToolbarButtons?: ICustomToolbarButton[];
|
|
|
|
|
jwtDisabledButtons: string[];
|
|
|
|
|
mainToolbarButtonsThresholds: IMainToolbarButtonThresholds;
|
|
|
|
|
toolbarButtons: string[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns all buttons that need to be rendered.
|
|
|
|
|
*
|
|
|
|
|
* @param {IGetVisibleButtonsParams} params - The parameters needed to extract the visible buttons.
|
|
|
|
|
* @returns {Object} - The visible buttons arrays .
|
|
|
|
|
*/
|
|
|
|
|
export function getVisibleButtons({
|
|
|
|
|
customToolbarButtons,
|
|
|
|
|
buttonsWithNotifyClick,
|
|
|
|
|
toolbarButtons,
|
|
|
|
|
clientWidth,
|
|
|
|
|
jwtDisabledButtons,
|
|
|
|
|
mainToolbarButtonsThresholds
|
|
|
|
|
}: IGetVisibleButtonsParams) {
|
|
|
|
|
const buttons = getAllToolboxButtons(customToolbarButtons);
|
|
|
|
|
|
|
|
|
|
const filteredButtons = Object.keys(buttons).filter(key =>
|
|
|
|
|
typeof key !== 'undefined' // filter invalid buttons that may be comming from config.mainToolbarButtons
|
|
|
|
|
// override
|
|
|
|
|
&& !jwtDisabledButtons.includes(key)
|
|
|
|
|
&& isButtonEnabled(key, toolbarButtons));
|
|
|
|
|
|
|
|
|
|
setButtonsNotifyClickMode(buttons, buttonsWithNotifyClick);
|
|
|
|
|
const { order } = mainToolbarButtonsThresholds.find(({ width }) => clientWidth > width)
|
|
|
|
|
|| mainToolbarButtonsThresholds[mainToolbarButtonsThresholds.length - 1];
|
|
|
|
|
|
|
|
|
|
const mainToolbarButtonKeysOrder = [
|
|
|
|
|
...order.filter(key => filteredButtons.includes(key)),
|
|
|
|
|
...MAIN_TOOLBAR_BUTTONS_PRIORITY.filter(key => !order.includes(key) && filteredButtons.includes(key)),
|
|
|
|
|
...filteredButtons.filter(key => !order.includes(key) && !MAIN_TOOLBAR_BUTTONS_PRIORITY.includes(key))
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const mainButtonsKeys = mainToolbarButtonKeysOrder.slice(0, order.length);
|
|
|
|
|
const overflowMenuButtons = filteredButtons.reduce((acc, key) => {
|
|
|
|
|
if (!mainButtonsKeys.includes(key)) {
|
|
|
|
|
acc.push(buttons[key]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return acc;
|
|
|
|
|
}, [] as IToolboxButton[]);
|
|
|
|
|
|
|
|
|
|
// if we have 1 button in the overflow menu it is better to directly display it in the main toolbar by replacing
|
|
|
|
|
// the "More" menu button with it.
|
|
|
|
|
if (overflowMenuButtons.length === 1) {
|
|
|
|
|
const button = overflowMenuButtons.shift()?.key;
|
|
|
|
|
|
|
|
|
|
button && mainButtonsKeys.push(button);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
mainMenuButtons: mainButtonsKeys.map(key => buttons[key]),
|
|
|
|
|
overflowMenuButtons
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-08 09:59:02 -06:00
|
|
|
/**
|
|
|
|
|
* Returns the list of participant menu buttons that have that notify the api when clicked.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
|
* @returns {Map<string, NOTIFY_CLICK_MODE>} - The list of participant menu buttons.
|
|
|
|
|
*/
|
|
|
|
|
export function getParticipantMenuButtonsWithNotifyClick(state: IReduxState): Map<string, NOTIFY_CLICK_MODE> {
|
|
|
|
|
return state['features/toolbox'].participantMenuButtonsWithNotifyClick;
|
|
|
|
|
}
|