Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(custom-panel): implement web and native
Calinteodora17b19fab6dc
diff --git a/config.js b/config.jsindex 63ecb01052..28503f02e5 100644--- a/config.js+++ b/config.js@@ -1103,6 +1103,21 @@ var config = {// type: Array<{ icon: string; id: string; text: string; backgroundColor?: string; }>// customToolbarButtons: [],+ // The custom panel (AI Assist), rendered in a side panel on web and on its own screen+ // on mobile. It needs `enabled`, `url`, `advisorAvailabilityUrl` and a JWT.+ // `url` has no default: without one the panel stays hidden on both platforms.+ // `advisorAvailabilityUrl` is called after joining with the JWT and the meeting id; the+ // button shows only if it confirms an advisor is deployed for the meeting.+ // Both can also come from `customPanelUrl: { url, advisorAvailabilityUrl }` in the+ // dynamic branding data, which takes precedence over the values set here.+ // NOTE: `url` and `advisorAvailabilityUrl` cannot be overwritten through+ // `configOverwrite`, because both receive the meeting JWT. Only `enabled` is whitelisted.+ // customPanel: {+ // enabled: false,+ // url: 'https://example.com/ai-assist',+ // advisorAvailabilityUrl: 'https://example.com/advisor-resolve',+ // },+// Stats//@@ -1469,6 +1484,9 @@ var config = {logoClickUrl: 'https://example-company.org',// The url used for the image used as logologoImageUrl: 'https://example.com/logo-img.png',+ // The url loaded in the custom panel (AI Assist). It overwrites `customPanel.url`+ // from this file. The panel also needs `customPanel.enabled` set to true.+ customPanelUrl: 'https://example.com/ai-assist',// Endpoint that enables support for salesforce integration with in-meeting resource linking// This is required for:// listing the most recent records - salesforceUrl/records/recentsdiff --git a/lang/main-ca.json b/lang/main-ca.jsonindex 31e877f116..c304398b88 100644--- a/lang/main-ca.json+++ b/lang/main-ca.json@@ -1526,6 +1526,7 @@"label": "Estèreo"}},+ "aiAssist": "Assistent d'IA","audioRoute": "Seleccioneu l'aparell de so","audioSettings": "Paràmetres d'àudio","audioTranslation": "Tradueix l'àudio",@@ -1540,7 +1541,6 @@"closeParticipantsPane": "Tanca la subfinestra de participants","closeReactionsMenu": "Tanca el menú de reaccions","closedCaptions": "Subtítols",- "copilot": "Copilot","disableNoiseSuppression": "Desactiva la supressió de soroll","disableReactionSounds": "Podeu desactivar els sons de reacció per a aquesta reunió","documentClose": "Tanca el document compartit",diff --git a/lang/main-de.json b/lang/main-de.jsonindex 3400a8b977..a1ca25a82c 100644--- a/lang/main-de.json+++ b/lang/main-de.json@@ -1466,6 +1466,7 @@"label": "Stereo"}},+ "aiAssist": "KI-Assistent","audioRoute": "Audiogerät auswählen","audioSettings": "Ton-Einstellungen","audioTranslation": "Audio-Übersetzung",@@ -1480,7 +1481,6 @@"closeParticipantsPane": "Anwesenheitsliste schließen","closeReactionsMenu": "Interaktionsmenü schließen","closedCaptions": "Untertitel",- "copilot": "Copilot","disableNoiseSuppression": "Rauschunterdrückung deaktivieren","disableReactionSounds": "Sie können die Interaktionstöne für diese Konferenz deaktivieren","documentClose": "Geteiltes Dokument schließen",diff --git a/lang/main-es.json b/lang/main-es.jsonindex 5ad68e229d..d0ac1ae612 100644--- a/lang/main-es.json+++ b/lang/main-es.json@@ -1518,6 +1518,7 @@"label": "Estéreo"}},+ "aiAssist": "Asistente de IA","audioRoute": "Seleccione el dispositivo de sonido","audioSettings": "Ajustes de audio","audioTranslation": "Traducir audio",@@ -1532,7 +1533,6 @@"closeParticipantsPane": "Cerrar panel de participantes","closeReactionsMenu": "Cerrar el menú de reacciones","closedCaptions": "Subtítulos",- "copilot": "Copiloto","disableNoiseSuppression": "Desactivar supresión de ruido","disableReactionSounds": "Puede desactivar los sonidos de reacción para esta reunión","documentClose": "Cerrar documento compartido",diff --git a/lang/main-fi.json b/lang/main-fi.jsonindex 6880c331e9..0cc8f4ce95 100644--- a/lang/main-fi.json+++ b/lang/main-fi.json@@ -1405,6 +1405,7 @@"label": "Stereo"}},+ "aiAssist": "Tekoälyavustaja","audioRoute": "Valitse äänilaite","audioSettings": "Ääniasetukset","authenticate": "Todenna",@@ -1417,7 +1418,6 @@"closeParticipantsPane": "Sulje osallistujapaneeli","closeReactionsMenu": "Sulje reaktiot-valikko","closedCaptions": "Tekstitys",- "copilot": "Copilot","disableNoiseSuppression": "Poista ylimääräinen kohinanpoisto käytöstä","disableReactionSounds": "Voit poistaa reaktioäänet käytöstä tässä kokouksessa","documentClose": "Sulje jaettu asiakirja",diff --git a/lang/main-fr.json b/lang/main-fr.jsonindex 566729a9f1..71b8ecce40 100644--- a/lang/main-fr.json+++ b/lang/main-fr.json@@ -1407,6 +1407,7 @@"label": "Stéréo"}},+ "aiAssist": "Assistant IA","audioRoute": "Sélectionner la source audio","audioSettings": "Paramètres audio","authenticate": "Authentifiez-vous",@@ -1419,7 +1420,6 @@"closeParticipantsPane": "Fermer le panneau des participants","closeReactionsMenu": "Fermer le menu réactions","closedCaptions": "Sous-titres",- "copilot": "Copilot","disableNoiseSuppression": "Arrêter la suppression du bruit","disableReactionSounds": "Vous pouvez interdire les réactions sonores à cette réunion","documentClose": "Fermer le document partagé",diff --git a/lang/main-hi.json b/lang/main-hi.jsonindex 2fd8c83f45..beaea7302f 100644--- a/lang/main-hi.json+++ b/lang/main-hi.json@@ -1468,6 +1468,7 @@"label": "स्टीरियो"}},+ "aiAssist": "एआई सहायक","audioRoute": "साउंड डिवाइस का चयन करें","audioSettings": "ऑडियो सेटिंग्स","audioTranslation": "ऑडियो का अनुवाद करें",@@ -1482,7 +1483,6 @@"closeParticipantsPane": "प्रतिभागी पैनल बंद करें","closeReactionsMenu": "प्रतिक्रियाएं मेनू बंद करें","closedCaptions": "क्लोज्ड कैप्शन",- "copilot": "कोपायलट","disableNoiseSuppression": "अतिरिक्त शोर दमन अक्षम करें","disableReactionSounds": "आप इस मीटिंग के लिए प्रतिक्रिया ध्वनियाँ अक्षम कर सकते हैं","documentClose": "साझा किए गए दस्तावेज़ को बंद करें",diff --git a/lang/main-it.json b/lang/main-it.jsonindex 87b40ebf40..dcff6c2a43 100644--- a/lang/main-it.json+++ b/lang/main-it.json@@ -1417,6 +1417,7 @@"label": "Stereo"}},+ "aiAssist": "Assistente IA","audioRoute": "Scegli il dispositivo audio","audioSettings": "Impostazioni audio","authenticate": "Autenticazione",@@ -1429,7 +1430,6 @@"closeParticipantsPane": "Chiudi pannello partecipanti","closeReactionsMenu": "Chiudi menu reazioni","closedCaptions": "Sottotitoli",- "copilot": "Copilot","disableNoiseSuppression": "Disattiva cancellazione del rumore","disableReactionSounds": "Puoi disattivare i suoni delle reazioni in questa riunione","documentClose": "Chiudi documento condiviso",diff --git a/lang/main-lv.json b/lang/main-lv.jsonindex ca40b77f14..f758293989 100644--- a/lang/main-lv.json+++ b/lang/main-lv.json@@ -1516,6 +1516,7 @@"label": "Stereo"}},+ "aiAssist": "MI asistents","audioRoute": "Izvēlēties audioierīci","audioSettings": "Audio iestatījumi","audioTranslation": "Tulkot audio",@@ -1530,7 +1531,6 @@"closeParticipantsPane": "Aizvērt dalībnieku paneli","closeReactionsMenu": "Aizvērt reakciju izvēlni","closedCaptions": "Slēgtie subtitri",- "copilot": "Copilot","disableNoiseSuppression": "Atspējot trokšņu slāpēšanu","disableReactionSounds": "Šai sapulcei varat atspējot reakcijas skaņas","documentClose": "Aizvērt kopīgoto dokumentu",diff --git a/lang/main-mn.json b/lang/main-mn.jsonindex 6e47202339..86c579616d 100644--- a/lang/main-mn.json+++ b/lang/main-mn.json@@ -1417,6 +1417,7 @@"label": "Стерео"}},+ "aiAssist": "AI туслах","audioRoute": "Дууны төхөөрөмж сонгох","audioSettings": "Дууны тохиргоо","authenticate": "Баталгаажуулах",@@ -1429,7 +1430,6 @@"closeParticipantsPane": "Оролцогчийн цонх хаах","closeReactionsMenu": "Реакци цэс хаах","closedCaptions": "Хаалттай тайлбар",- "copilot": "Copilot","disableNoiseSuppression": "Шуугиан дарахыг болиулах","disableReactionSounds": "Уулзалтын үеэр реакцийн чимээг хаах болно","documentClose": "Хуваалцсан бичиг баримт хаах",diff --git a/lang/main-nl.json b/lang/main-nl.jsonindex c2c50228fb..b7c148c099 100644--- a/lang/main-nl.json+++ b/lang/main-nl.json@@ -1526,6 +1526,7 @@"label": "Stereo"}},+ "aiAssist": "AI-assistent","audioRoute": "Het afspeelapparaat selecteren","audioSettings": "Audio-instellingen","audioTranslation": "Audiovertaling",@@ -1540,7 +1541,6 @@"closeParticipantsPane": "Deelnemersvenster sluiten","closeReactionsMenu": "Reactiemenu sluiten","closedCaptions": "Ondertiteling",- "copilot": "Copilot","disableNoiseSuppression": "Ruisonderdrukking uitschakelen","disableReactionSounds": "U kunt reactiegeluiden uitschakelen voor deze vergadering","documentClose": "Gedeeld document sluiten",diff --git a/lang/main-pt.json b/lang/main-pt.jsonindex 1915870bcd..86622ed046 100644--- a/lang/main-pt.json+++ b/lang/main-pt.json@@ -1464,6 +1464,7 @@"label": "Estéreo"}},+ "aiAssist": "Assistente de IA","audioRoute": "Selecionar o dispositivo de som","audioSettings": "Definições de áudio","audioTranslation": "Traduzir áudio",@@ -1478,7 +1479,6 @@"closeParticipantsPane": "Fechar painel de participantes","closeReactionsMenu": "Fechar menu de reações","closedCaptions": "Legendas ocultas",- "copilot": "Copilot","disableNoiseSuppression": "Desativar supressão de ruído extra","disableReactionSounds": "Pode desactivar os sons de reacção para esta reunião","documentClose": "Fechar documento partilhado",diff --git a/lang/main-sq.json b/lang/main-sq.jsonindex 0872431f62..a0560010a1 100644--- a/lang/main-sq.json+++ b/lang/main-sq.json@@ -1407,6 +1407,7 @@"label": "Stereo"}},+ "aiAssist": "Asistent AI","audioRoute": "Përzgjidhni pajisje zëri","audioSettings": "Rregullime audio","authenticate": "Bëni mirëfilltësimiin",@@ -1419,7 +1420,6 @@"closeParticipantsPane": "Mbyllni kuadrat pjesëmarrësish","closeReactionsMenu": "Mbyllni menu reagimesh","closedCaptions": "Titra të mbyllur",- "copilot": "Copilot","disableNoiseSuppression": "Çaktivizoni asgjësim ekstra zhurmash","disableReactionSounds": "Mund të çaktivizoni tinguj reagimesh për këtë takim","documentClose": "Mbyll dokument të ndarë",diff --git a/lang/main-sv.json b/lang/main-sv.jsonindex fdb9c9ced9..6badd96a5e 100644--- a/lang/main-sv.json+++ b/lang/main-sv.json@@ -1412,6 +1412,7 @@"label": "Stereo"}},+ "aiAssist": "AI-assistent","audioRoute": "Välj ljudenhet","audioSettings": "Ljud inställningar","authenticate": "Autentisera",@@ -1424,7 +1425,6 @@"closeParticipantsPane": "Stäng deltagarrutan","closeReactionsMenu": "Stäng meny för reaktioner","closedCaptions": "Undertexter",- "copilot": "Copilot","disableNoiseSuppression": "Inaktivera brusreducering","disableReactionSounds": "Du kan inaktivera reaktionsljud för det här mötet","documentClose": "Stäng delat dokument",diff --git a/lang/main.json b/lang/main.jsonindex 7b92f36e7d..b45988c600 100644--- a/lang/main.json+++ b/lang/main.json@@ -262,7 +262,8 @@"yes": "yes"},"customPanel": {- "close": "Close"+ "close": "Close",+ "title": "AI Assist"},"dateUtils": {"earlier": "Earlier",@@ -1526,6 +1527,7 @@"label": "Stereo"}},+ "aiAssist": "AI Assist","audioRoute": "Select the sound device","audioSettings": "Audio settings","audioTranslation": "Translate audio",@@ -1540,7 +1542,6 @@"closeParticipantsPane": "Close participants pane","closeReactionsMenu": "Close reactions menu","closedCaptions": "Closed captions",- "copilot": "Copilot","disableNoiseSuppression": "Disable extra noise suppression","disableReactionSounds": "You can disable reaction sounds for this meeting","documentClose": "Close shared document",diff --git a/react/features/app/middlewares.native.ts b/react/features/app/middlewares.native.tsindex ceeaaf89d1..cc9f8175a7 100644--- a/react/features/app/middlewares.native.ts+++ b/react/features/app/middlewares.native.ts@@ -1,4 +1,5 @@import '../base/config/middleware';+import '../custom-panel/middleware.native';import '../dynamic-branding/middleware';import '../gifs/middleware';import '../mobile/audio-mode/middleware';diff --git a/react/features/app/reducers.any.ts b/react/features/app/reducers.any.tsindex b002e8ca6d..ea3efbf1ab 100644--- a/react/features/app/reducers.any.ts+++ b/react/features/app/reducers.any.ts@@ -26,6 +26,7 @@ import '../base/user-interaction/reducer';import '../breakout-rooms/reducer';import '../calendar-sync/reducer';import '../chat/reducer';+import '../custom-panel/reducer';import '../deep-linking/reducer';import '../dropbox/reducer';import '../dynamic-branding/reducer';diff --git a/react/features/app/reducers.web.ts b/react/features/app/reducers.web.tsindex 9e5e48ef35..a9003f9b6c 100644--- a/react/features/app/reducers.web.ts+++ b/react/features/app/reducers.web.ts@@ -1,6 +1,5 @@import '../base/devices/reducer';import '../base/premeeting/reducer';-import '../custom-panel/reducer';import '../base/tooltip/reducer';import '../e2ee/reducer';import '../face-landmarks/reducer';diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.tsindex 2a2c788b59..dd89297db9 100644--- a/react/features/base/config/configType.ts+++ b/react/features/base/config/configType.ts@@ -87,6 +87,12 @@ export type Sounds = 'ASKED_TO_UNMUTE_SOUND' |'RECORDING_ON_SOUND' |'TALK_WHILE_MUTED_SOUND';+export interface ICustomPanelConfig {+ advisorAvailabilityUrl?: string;+ enabled?: boolean;+ url?: string;+}+export interface IDeeplinkingPlatformConfig {appName: string;appScheme: string;@@ -286,6 +292,7 @@ export interface IConfig {};};corsAvatarURLs?: Array<string>;+ customPanel?: ICustomPanelConfig;customParticipantMenuButtons?: Array<{ icon: string; id: string; text: string; }>;customToolbarButtons?: Array<{ backgroundColor?: string; icon: string; id: string; text: string; }>;deeplinking?: IDeeplinkingConfig;diff --git a/react/features/base/config/configWhitelist.ts b/react/features/base/config/configWhitelist.tsindex a03d61189d..a806760cd5 100644--- a/react/features/base/config/configWhitelist.ts+++ b/react/features/base/config/configWhitelist.ts@@ -81,6 +81,7 @@ export default ['channelLastN','connectionIndicators','constraints',+ 'customPanel.enabled','deeplinking.disabled','deeplinking.desktop.enabled','defaultLocalDisplayName',diff --git a/react/features/base/config/middleware.any.ts b/react/features/base/config/middleware.any.tsindex df7f900c84..83a437a64a 100644--- a/react/features/base/config/middleware.any.ts+++ b/react/features/base/config/middleware.any.ts@@ -99,6 +99,7 @@ function _setConfig({ dispatch, getState }: IStore, next: Function, action: AnyAfunction _setDynamicBrandingData({ dispatch }: IStore, next: Function, action: AnyAction) {const config: IConfig = {};const {+ customPanelUrl,customParticipantMenuButtons,customToolbarButtons,downloadAppsUrl,@@ -147,6 +148,20 @@ function _setDynamicBrandingData({ dispatch }: IStore, next: Function, action: Aconfig.peopleSearchUrl = peopleSearchUrl;}+ const { url: panelUrl, advisorAvailabilityUrl } = customPanelUrl ?? {};++ if (panelUrl || advisorAvailabilityUrl) {+ config.customPanel = {};++ if (panelUrl) {+ config.customPanel.url = panelUrl;+ }++ if (advisorAvailabilityUrl) {+ config.customPanel.advisorAvailabilityUrl = advisorAvailabilityUrl;+ }+ }+const { enabled, iceUrl } = preCallTest;if (typeof enabled === 'boolean') {diff --git a/react/features/base/ui/hooks/usePanelResize.web.ts b/react/features/base/ui/hooks/usePanelResize.web.tsnew file mode 100644index 0000000000..bca5da4e2b--- /dev/null+++ b/react/features/base/ui/hooks/usePanelResize.web.ts@@ -0,0 +1,160 @@+import { throttle } from 'lodash-es';+import React, { useCallback, useEffect, useState } from 'react';+import { useDispatch } from 'react-redux';+import { AnyAction } from 'redux';++/**+ * The interval, in milliseconds, at which pointer moves are handled while dragging.+ */+const RESIZE_THROTTLE_MS = 50;++interface IPanelResizeOptions {++ /**+ * The edge of the panel the drag handle is attached to. A handle on the right edge+ * widens the panel when dragged right, one on the left edge when dragged left.+ */+ edge: 'left' | 'right';++ /**+ * The maximum width the panel may be resized to.+ */+ maxWidth: number;++ /**+ * The minimum width the panel may be resized to.+ */+ minWidth: number;++ /**+ * Action creator for flagging that a resize is in progress.+ */+ setIsResizing: (isResizing: boolean) => AnyAction;++ /**+ * Action creator for storing the width picked by the user.+ */+ setWidth: (width: number) => AnyAction;++ /**+ * The current width of the panel.+ */+ width: number;+}++interface IPanelResize {++ /**+ * Whether the drag handle is currently held down.+ */+ isMouseDown: boolean;++ /**+ * Pointer down handler to attach to the drag handle.+ */+ onDragHandlePointerDown: (e: React.PointerEvent) => void;+}++/**+ * Hook providing drag-to-resize behavior for a side panel. It tracks the pointer on+ * the document so the drag survives the pointer leaving the handle, and clamps the+ * resulting width between {@code minWidth} and {@code maxWidth}.+ *+ * @param {IPanelResizeOptions} options - The panel specific resize options.+ * @returns {IPanelResize}+ */+export default function usePanelResize({+ edge,+ maxWidth,+ minWidth,+ setIsResizing,+ setWidth,+ width+}: IPanelResizeOptions): IPanelResize {+ const dispatch = useDispatch();+ const [ isMouseDown, setIsMouseDown ] = useState(false);+ const [ mousePosition, setMousePosition ] = useState<number | null>(null);+ const [ dragWidth, setDragWidth ] = useState<number | null>(null);++ /**+ * Handles pointer down on the drag handle.+ * Supports both mouse and touch events via Pointer Events API.+ *+ * @param {React.PointerEvent} e - The pointer down event.+ * @returns {void}+ */+ const onDragHandlePointerDown = useCallback((e: React.PointerEvent) => {+ e.preventDefault();+ e.stopPropagation();++ // Capture the pointer to ensure we receive all pointer events+ // even if the pointer moves outside the element.+ (e.target as HTMLElement).setPointerCapture(e.pointerId);++ // Store the initial pointer position and panel width.+ setIsMouseDown(true);+ setMousePosition(e.clientX);+ setDragWidth(width);++ dispatch(setIsResizing(true));++ // Add visual feedback that we're dragging (cursor for mouse, not visible on touch)+ // and disable text selection during resize.+ document.body.style.cursor = 'col-resize';+ document.body.style.userSelect = 'none';+ }, [ width, setIsResizing, dispatch ]);++ /**+ * Handles pointer up to end drag resize.+ *+ * @returns {void}+ */+ const onDragPointerUp = useCallback(() => {+ if (isMouseDown) {+ setIsMouseDown(false);+ dispatch(setIsResizing(false));++ // Restore cursor and text selection.+ document.body.style.cursor = '';+ document.body.style.userSelect = '';+ }+ }, [ isMouseDown, setIsResizing, dispatch ]);++ /**+ * Handles pointer move during drag resize.+ *+ * @param {PointerEvent} e - The pointermove event.+ * @returns {void}+ */+ const onPointerMove = useCallback(throttle((e: PointerEvent) => {+ if (isMouseDown && mousePosition !== null && dragWidth !== null) {+ const diff = e.clientX - mousePosition;+ const draggedWidth = edge === 'right' ? dragWidth + diff : dragWidth - diff;+ const newWidth = Math.max(Math.min(draggedWidth, maxWidth), minWidth);++ // Update the width only if it has changed.+ if (newWidth !== width) {+ dispatch(setWidth(newWidth));+ }+ }+ }, RESIZE_THROTTLE_MS, {+ leading: true,+ trailing: false+ }), [ isMouseDown, mousePosition, dragWidth, width, maxWidth, minWidth, edge, setWidth, dispatch ]);++ // Set up global event listeners for drag tracking.+ useEffect(() => {+ document.addEventListener('pointerup', onDragPointerUp);+ document.addEventListener('pointermove', onPointerMove);++ return () => {+ document.removeEventListener('pointerup', onDragPointerUp);+ document.removeEventListener('pointermove', onPointerMove);+ };+ }, [ onDragPointerUp, onPointerMove ]);++ return {+ isMouseDown,+ onDragHandlePointerDown+ };+}diff --git a/react/features/chat/components/web/Chat.tsx b/react/features/chat/components/web/Chat.tsxindex 1715eab59a..29beb5f972 100644--- a/react/features/chat/components/web/Chat.tsx+++ b/react/features/chat/components/web/Chat.tsx@@ -1,15 +1,15 @@-import { throttle } from 'lodash-es';-import React, { useCallback, useEffect, useMemo, useState } from 'react';+import React, { useCallback, useMemo, useState } from 'react';import { connect, useSelector } from 'react-redux';import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';-import { isTouchDevice, shouldEnableResize } from '../../../base/environment/utils';-import { translate } from '../../../base/i18n/functions';+import { isTouchDevice, shouldEnableResize } from '../../../base/environment/utils.web';+import { translate } from '../../../base/i18n/functions.web';import { IconInfo, IconMessage, IconShareDoc, IconSubtitles } from '../../../base/icons/svg';import { getLocalParticipant, getRemoteParticipants, isPrivateChatEnabledSelf } from '../../../base/participants/functions';import Select from '../../../base/ui/components/web/Select';import Tabs from '../../../base/ui/components/web/Tabs';+import usePanelResize from '../../../base/ui/hooks/usePanelResize.web';import { arePollsDisabled } from '../../../conference/functions.any';import FileSharing from '../../../file-sharing/components/web/FileSharing';import { isFileSharingEnabled } from '../../../file-sharing/functions.any';@@ -286,9 +286,6 @@ const Chat = ({const isTouch = isTouchDevice();const resizeEnabled = shouldEnableResize();const { classes, cx } = useStyles({ _isResizing, width: _width, isTouch, resizeEnabled });- const [ isMouseDown, setIsMouseDown ] = useState(false);- const [ mousePosition, setMousePosition ] = useState<number | null>(null);- const [ dragChatWidth, setDragChatWidth ] = useState<number | null>(null);const [ editingMessage, setEditingMessage ] = useState<IMessage | undefined>();const maxChatWidth = useSelector(getChatMaxSize);const notifyTimestamp = useSelector((state: IReduxState) =>@@ -321,96 +318,18 @@ const Chat = ({return o;}, [ participants, defaultRemoteDisplayName, t, notifyTimestamp ]);- /**- * Handles pointer down on the drag handle.- * Supports both mouse and touch events via Pointer Events API.- *- * @param {React.PointerEvent} e - The pointer down event.- * @returns {void}- */- const onDragHandlePointerDown = useCallback((e: React.PointerEvent) => {- e.preventDefault();- e.stopPropagation();-- // Capture the pointer to ensure we receive all pointer events- // even if the pointer moves outside the element- (e.target as HTMLElement).setPointerCapture(e.pointerId);-- // Store the initial pointer position and chat width- setIsMouseDown(true);- setMousePosition(e.clientX);- setDragChatWidth(_width);-- // Indicate that resizing is in progress- dispatch(setChatIsResizing(true));-- // Add visual feedback that we're dragging (cursor for mouse, not visible on touch)- document.body.style.cursor = 'col-resize';-- // Disable text selection during resize- document.body.style.userSelect = 'none';- }, [ _width, dispatch ]);-- /**- * Drag handle pointer up handler.- * Supports both mouse and touch events via Pointer Events API.- *- * @returns {void}- */- const onDragPointerUp = useCallback(() => {- if (isMouseDown) {- setIsMouseDown(false);- dispatch(setChatIsResizing(false));-- // Restore cursor and text selection- document.body.style.cursor = '';- document.body.style.userSelect = '';- }- }, [ isMouseDown, dispatch ]);-const onCancelEdit = useCallback(() => {setEditingMessage(undefined);}, []);- /**- * Handles drag handle pointer move.- * Supports both mouse and touch events via Pointer Events API.- *- * @param {PointerEvent} e - The pointermove event.- * @returns {void}- */- const onChatResize = useCallback(throttle((e: PointerEvent) => {- if (isMouseDown && mousePosition !== null && dragChatWidth !== null) {- // For chat panel resizing on the left edge:- // - Dragging left (decreasing X coordinate) should make the panel wider- // - Dragging right (increasing X coordinate) should make the panel narrower- const diff = e.clientX - mousePosition;-- const newWidth = Math.max(- Math.min(dragChatWidth + diff, maxChatWidth),- CHAT_SIZE- );-- // Update the width only if it has changed- if (newWidth !== _width) {- dispatch(setUserChatWidth(newWidth));- }- }- }, 50, {- leading: true,- trailing: false- }), [ isMouseDown, mousePosition, dragChatWidth, _width, maxChatWidth, dispatch ]);-- // Set up event listeners when component mounts- useEffect(() => {- document.addEventListener('pointerup', onDragPointerUp);- document.addEventListener('pointermove', onChatResize);-- return () => {- document.removeEventListener('pointerup', onDragPointerUp);- document.removeEventListener('pointermove', onChatResize);- };- }, [ onDragPointerUp, onChatResize ]);+ const { isMouseDown, onDragHandlePointerDown } = usePanelResize({+ edge: 'right',+ maxWidth: maxChatWidth,+ minWidth: CHAT_SIZE,+ setIsResizing: setChatIsResizing,+ setWidth: setUserChatWidth,+ width: _width+ });/*** Sends a text message.diff --git a/react/features/custom-panel/ReactNativeWebViewTransportBackend.native.ts b/react/features/custom-panel/ReactNativeWebViewTransportBackend.native.tsnew file mode 100644index 0000000000..f2914eb56c--- /dev/null+++ b/react/features/custom-panel/ReactNativeWebViewTransportBackend.native.ts@@ -0,0 +1,129 @@+import { WebViewMessageEvent } from 'react-native-webview';++import logger from './logger';++type MessageListener = (data: string) => void;++interface IMessageSource {+ onMessage: (event: WebViewMessageEvent) => void;+ subscribe: (listener: MessageListener) => () => void;+}++interface IOptions {++ /**+ * Messages with a different scope are dropped.+ */+ scope: string;++ /**+ * Posts a serialized message to the WebView.+ */+ send: (data: string) => void;++ /**+ * Subscribes to raw WebView messages. Returns the unsubscribe function.+ */+ subscribe: IMessageSource['subscribe'];+}++/**+ * Fans the WebView `onMessage` out to subscribers, so the prop keeps one identity across transport rebuilds.+ *+ * @returns {IMessageSource}+ */+export function createMessageSource(): IMessageSource {+ const listeners = new Set<MessageListener>();++ return {+ onMessage: event => {+ listeners.forEach(listener => listener(event.nativeEvent.data));+ },+ subscribe: listener => {+ listeners.add(listener);++ return () => {+ listeners.delete(listener);+ };+ }+ };+}++/**+ * Transport backend for the advisor WebView, which cannot receive a `MessagePort`.+ * Every message carries the scope instead, as a namespace check, not an origin check.+ */+export default class ReactNativeWebViewTransportBackend {+ private _receiveCallback?: (message: any) => void;+ private readonly _scope: string;+ private readonly _send: (data: string) => void;+ private readonly _unsubscribe: () => void;++ /**+ * Creates a new instance and subscribes to WebView messages.+ *+ * @param {IOptions} options - The backend configuration.+ */+ constructor({ scope, send, subscribe }: IOptions) {+ this._scope = scope;+ this._send = send;+ this._unsubscribe = subscribe(data => this._onMessage(data));+ }++ /**+ * Passes a message from the WebView to the transport.+ *+ * @param {string} data - The raw message.+ * @returns {void}+ */+ private _onMessage(data: string) {+ let payload: any;++ try {+ payload = JSON.parse(data);+ } catch (error) {+ logger.error('Failed to parse a message from the advisor', error);++ return;+ }++ if (payload?.scope !== this._scope) {+ return;+ }++ // `Transport` ignores the extra `scope` field.+ this._receiveCallback?.(payload);+ }++ /**+ * Sends a message to the advisor. The page gets it on `window` (iOS) or `document` (Android).+ *+ * @param {any} message - The message.+ * @returns {void}+ */+ send(message: any) {+ this._send(JSON.stringify({+ scope: this._scope,+ ...message+ }));+ }++ /**+ * Sets the callback for incoming messages.+ *+ * @param {Function} callback - The callback.+ * @returns {void}+ */+ setReceiveCallback(callback: (message: any) => void) {+ this._receiveCallback = callback;+ }++ /**+ * Unsubscribes, so a message the WebView sends while unmounting never reaches the transport.+ *+ * @returns {void}+ */+ dispose() {+ this._unsubscribe();+ }+}diff --git a/react/features/custom-panel/actionTypes.ts b/react/features/custom-panel/actionTypes.tsindex 5a5298e107..0c85ea48b4 100644--- a/react/features/custom-panel/actionTypes.ts+++ b/react/features/custom-panel/actionTypes.ts@@ -8,11 +8,6 @@ export const CUSTOM_PANEL_CLOSE = 'CUSTOM_PANEL_CLOSE';*/export const CUSTOM_PANEL_OPEN = 'CUSTOM_PANEL_OPEN';-/**- * Action type to enable or disable the custom panel dynamically.- */-export const SET_CUSTOM_PANEL_ENABLED = 'SET_CUSTOM_PANEL_ENABLED';-/*** Action type to set the custom panel width (responsive adjustments).*/@@ -27,3 +22,8 @@ export const SET_USER_CUSTOM_PANEL_WIDTH = 'SET_USER_CUSTOM_PANEL_WIDTH';* Action type to indicate whether the custom panel is being resized.*/export const SET_CUSTOM_PANEL_IS_RESIZING = 'SET_CUSTOM_PANEL_IS_RESIZING';++/**+ * Action type to set whether an advisor is deployed for the current meeting.+ */+export const SET_CUSTOM_PANEL_ADVISOR_AVAILABLE = 'SET_CUSTOM_PANEL_ADVISOR_AVAILABLE';diff --git a/react/features/custom-panel/actions.any.ts b/react/features/custom-panel/actions.any.tsnew file mode 100644index 0000000000..b628c83a54--- /dev/null+++ b/react/features/custom-panel/actions.any.ts@@ -0,0 +1,66 @@+import { IStore } from '../app/types';+import { getCurrentConference } from '../base/conference/functions';+import { doGetJSON } from '../base/util/httpUtils';++import { SET_CUSTOM_PANEL_ADVISOR_AVAILABLE } from './actionTypes';+import logger from './logger';++/**+ * Sets whether an advisor is deployed for the current meeting.+ *+ * @param {boolean} available - Whether an advisor is available.+ * @returns {Object} The action object.+ */+export function setCustomPanelAdvisorAvailable(available: boolean) {+ return {+ type: SET_CUSTOM_PANEL_ADVISOR_AVAILABLE,+ available+ };+}++/**+ * Asks the advisor backend whether an advisor is deployed for the current meeting. The+ * button stays hidden unless a match is confirmed, so failures are only logged.+ *+ * @returns {Function}+ */+export function resolveCustomPanelAdvisor() {+ return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => {+ const state = getState();+ const { advisorAvailabilityUrl, enabled, url: panelUrl } = state['features/base/config'].customPanel ?? {};+ const { jwt } = state['features/base/jwt'];+ const meetingId = getCurrentConference(state)?.getMeetingUniqueId();++ // Not isCustomPanelEnabled(): that depends on the result of this check.+ if (!enabled || !panelUrl || !advisorAvailabilityUrl || !jwt || !meetingId) {+ return;+ }++ let url;++ try {+ url = new URL(advisorAvailabilityUrl);+ } catch {+ logger.warn(`Invalid customPanel.advisorAvailabilityUrl: ${advisorAvailabilityUrl}`);++ return;+ }++ url.searchParams.set('token', jwt);+ url.searchParams.set('sessionId', meetingId);++ try {+ const { candidates, resolved } = await doGetJSON(url.toString());++ // The user may have left or switched rooms while the request was in flight.+ if (getCurrentConference(getState())?.getMeetingUniqueId() !== meetingId) {+ return;+ }++ // No `resolved` with several candidates means the advisor shows a picker.+ dispatch(setCustomPanelAdvisorAvailable(Boolean(resolved ?? candidates?.length)));+ } catch (err) {+ logger.warn('Failed to resolve the advisor for this meeting', err);+ }+ };+}diff --git a/react/features/custom-panel/actions.web.ts b/react/features/custom-panel/actions.web.tsindex 686c9cfe51..74d494e6f3 100644--- a/react/features/custom-panel/actions.web.ts+++ b/react/features/custom-panel/actions.web.ts@@ -1,17 +1,17 @@import {CUSTOM_PANEL_CLOSE,CUSTOM_PANEL_OPEN,- SET_CUSTOM_PANEL_ENABLED,SET_CUSTOM_PANEL_IS_RESIZING,SET_CUSTOM_PANEL_WIDTH,SET_USER_CUSTOM_PANEL_WIDTH} from './actionTypes';+export * from './actions.any';+/*** Action to close the custom panel.** @returns {Object} The action object.- * NOTE: this action is used in the branding files.*/export function close() {return {@@ -30,19 +30,6 @@ export function open() {};}-/**- * Action to enable or disable the custom panel dynamically.- *- * @param {boolean} enabled - Whether the custom panel should be enabled.- * @returns {Object} The action object.- */-export function setCustomPanelEnabled(enabled: boolean) {- return {- type: SET_CUSTOM_PANEL_ENABLED,- enabled- };-}-/*** Sets the custom panel width (used for responsive adjustments).*diff --git a/react/features/custom-panel/api.native.ts b/react/features/custom-panel/api.native.tsnew file mode 100644index 0000000000..fbfb28f532--- /dev/null+++ b/react/features/custom-panel/api.native.ts@@ -0,0 +1,77 @@+import { Transport } from '@jitsi/js-utils/transport';+import { useEffect, useRef, useState } from 'react';+import WebView from 'react-native-webview';++import { goBack } from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';++import ReactNativeWebViewTransportBackend, { createMessageSource } from './ReactNativeWebViewTransportBackend.native';+import { API_SCOPE, EVENT_CLOSE_PANEL } from './constants';+import logger from './logger';+import { EventHandler, ICustomPanelEvent } from './types';++interface INavigation {+ isFocused: () => boolean;+}++/**+ * Owns the Transport for the advisor WebView. Mirrors `api.web.ts`, with a different+ * backend because a `MessageChannel` cannot cross the react-native-webview bridge.+ *+ * @param {string} fullUrl - The advisor URL. The transport is recreated when it changes.+ * @param {INavigation} navigation - The screen's navigation object.+ * @returns {Object}+ */+export function useCustomPanelApi(fullUrl: string, navigation: INavigation) {+ const webViewRef = useRef<WebView>(null);+ const [ messageSource ] = useState(createMessageSource);++ // Initialized once, so handlers must not close over live state. `navigation.isFocused()`+ // reads through a live getState(), so capturing it here is fine.+ const eventHandlersRef = useRef<Record<string, EventHandler>>({+ [EVENT_CLOSE_PANEL]: () => {+ // A late close-panel after a manual back press must not pop a second screen.+ if (navigation.isFocused()) {+ goBack();+ }+ }+ });++ useEffect(() => {+ if (!fullUrl) {+ return;+ }++ const transport = new Transport({+ backend: new ReactNativeWebViewTransportBackend({+ scope: API_SCOPE,+ send: data => webViewRef.current?.postMessage(data),+ subscribe: messageSource.subscribe+ })+ });++ transport.on('event', (event: ICustomPanelEvent) => {+ const handler = eventHandlersRef.current[event?.name];++ if (handler) {+ handler(event);++ return true;+ }++ logger.debug(`Unknown event received from ${fullUrl}: ${event?.name}`);++ // Unprocessed events are stored and replayed to the next listener.+ return false;+ });++ return () => {+ // Disposes the backend too.+ transport.dispose();+ };+ }, [ fullUrl ]);++ return {+ onMessage: messageSource.onMessage,+ webViewRef+ };+}diff --git a/react/features/custom-panel/api.web.ts b/react/features/custom-panel/api.web.tsnew file mode 100644index 0000000000..810c4f0add--- /dev/null+++ b/react/features/custom-panel/api.web.ts@@ -0,0 +1,72 @@+/**+ * Transport between the meeting and the custom panel iframe.+ *+ * The iframe creates the `MessageChannel` and posts `init_channel`; the meeting+ * receives it and validates the sender's origin. The backend keeps listening, so a+ * self-reloading iframe is re-adopted on its next handshake.+ */+import { MessageChannelTransportBackend, Transport } from '@jitsi/js-utils/transport';+import { useEffect, useRef } from 'react';+import { useDispatch } from 'react-redux';++import { close } from './actions.web';+import { API_SCOPE, EVENT_CLOSE_PANEL } from './constants';+import { EventHandler, ICustomPanelEvent } from './types';++/**+ * Owns the Transport for the custom panel iframe. The transport is recreated on every+ * URL change and disposed on unmount.+ *+ * @param {string} fullUrl - The current iframe URL. Its origin is the only one the+ * backend accepts a port from.+ * @returns {void}+ */+export function useCustomPanelApi(fullUrl: string): void {+ const dispatch = useDispatch();++ // Initialized once, so handlers must not close over live state. `dispatch` is stable.+ const eventHandlersRef = useRef<Record<string, EventHandler>>({+ [EVENT_CLOSE_PANEL]: () => {+ dispatch(close());+ }+ });++ useEffect(() => {+ if (!fullUrl) {+ return;+ }++ let origin: string;++ try {+ origin = new URL(fullUrl).origin;+ } catch {+ return;+ }++ const transport = new Transport({+ backend: new MessageChannelTransportBackend({+ origin,+ scope: API_SCOPE,+ shouldCreateChannel: false+ })+ });++ transport.on('event', (event: ICustomPanelEvent) => {+ const handler = eventHandlersRef.current[event?.name];++ if (handler) {+ handler(event);++ return true;+ }++ // Unprocessed events are stored and replayed to the next listener.+ return false;+ });++ return () => {+ transport.dispose();+ };+ }, [ fullUrl ]);+}diff --git a/react/features/custom-panel/components/native/CustomPanel.tsx b/react/features/custom-panel/components/native/CustomPanel.tsxnew file mode 100644index 0000000000..3829a94cc8--- /dev/null+++ b/react/features/custom-panel/components/native/CustomPanel.tsx@@ -0,0 +1,82 @@+import React, { useCallback } from 'react';+import { View } from 'react-native';+import { WebView } from 'react-native-webview';+import { useSelector } from 'react-redux';++import { IReduxState } from '../../../app/types';+import { getCurrentConference } from '../../../base/conference/functions';+import JitsiScreen from '../../../base/modal/components/JitsiScreen';+import LoadingIndicator from '../../../base/react/components/native/LoadingIndicator';+import { useCustomPanelApi } from '../../api.native';+import { buildCustomPanelUrl, getCustomPanelOrigin, getCustomPanelUrl } from '../../functions.native';+import logger from '../../logger';++import styles from './styles';++/**+ * Renders the spinner shown while the WebView is loading.+ *+ * @returns {JSX.Element}+ */+const renderLoading = () => (+ <View style = { styles.loadingWrapper }>+ <LoadingIndicator size = 'large' />+ </View>+);++/**+ * Logs WebView load failures.+ *+ * @param {Object} event - The WebView error event.+ * @returns {void}+ */+const onError = (event: any) => {+ logger.error('Failed to load the advisor', event.nativeEvent);+};++/**+ * Renders the advisor web app in a WebView, loaded only with a JWT.+ *+ * @param {Object} props - Component's props.+ * @param {Object} props.navigation - Default prop for navigating between screen components (React Navigation).+ * @returns {JSX.Element | null}+ */+const CustomPanel = ({ navigation }: { navigation: { isFocused: () => boolean; }; }): JSX.Element | null => {+ const baseUrl = useSelector(getCustomPanelUrl);+ const jwt = useSelector((state: IReduxState) => state['features/base/jwt'].jwt);+ const meetingId = useSelector((state: IReduxState) => getCurrentConference(state)?.getMeetingUniqueId());+ const fullUrl = buildCustomPanelUrl(baseUrl, jwt, meetingId);+ const origin = getCustomPanelOrigin(baseUrl);+ const { onMessage, webViewRef } = useCustomPanelApi(fullUrl, navigation);++ const onShouldStartLoadWithRequest = useCallback((request: { url: string; }) =>+ getCustomPanelOrigin(request.url) === origin+ , [ origin ]);++ if (!fullUrl) {+ return null;+ }++ return (+ <JitsiScreen style = { styles.backDrop }>+ <WebView+ // Deliberately not incognito, so the advisor restores its session+ // from storage on reopen. The token-bearing URL and its cookies/storage persist too.+ incognito = { false }+ nestedScrollEnabled = { true }+ onError = { onError }+ onMessage = { onMessage }+ onShouldStartLoadWithRequest = { onShouldStartLoadWithRequest }+ originWhitelist = { [ origin ] }+ ref = { webViewRef }+ renderLoading = { renderLoading }+ setSupportMultipleWindows = { false }+ source = {{ uri: fullUrl }}+ startInLoadingState = { true }+ style = { styles.webView }+ webviewDebuggingEnabled = { __DEV__ } />+ </JitsiScreen>+ );+};++export default CustomPanel;diff --git a/react/features/custom-panel/components/native/CustomPanelButton.tsx b/react/features/custom-panel/components/native/CustomPanelButton.tsxnew file mode 100644index 0000000000..33137cefe4--- /dev/null+++ b/react/features/custom-panel/components/native/CustomPanelButton.tsx@@ -0,0 +1,45 @@+import { connect } from 'react-redux';++import { IReduxState } from '../../../app/types';+import { translate } from '../../../base/i18n/functions.native';+import { IconAI } from '../../../base/icons/svg';+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';+import { isInBreakoutRoom } from '../../../breakout-rooms/functions';+import { navigate }+ from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';+import { screen } from '../../../mobile/navigation/routes';+import { isCustomPanelEnabled } from '../../functions.native';++/**+ * Implements an {@link AbstractButton} to open the AI Assist screen on mobile.+ */+class CustomPanelButton extends AbstractButton<AbstractButtonProps> {+ override accessibilityLabel = 'toolbar.aiAssist';+ override icon = IconAI;+ override label = 'toolbar.aiAssist';++ /**+ * Handles clicking / pressing the button — opens the AI Assist screen.+ *+ * @private+ * @returns {void}+ */+ override _handleClick() {+ navigate(screen.conference.customPanel);+ }+}++/**+ * Maps part of the Redux state to the component's props.+ *+ * @param {IReduxState} state - The Redux state.+ * @private+ * @returns {Object}+ */+function _mapStateToProps(state: IReduxState) {+ return {+ visible: isCustomPanelEnabled(state) && !isInBreakoutRoom(state)+ };+}++export default translate(connect(_mapStateToProps)(CustomPanelButton));diff --git a/react/features/custom-panel/components/native/styles.ts b/react/features/custom-panel/components/native/styles.tsnew file mode 100644index 0000000000..9178c48bc7--- /dev/null+++ b/react/features/custom-panel/components/native/styles.ts@@ -0,0 +1,22 @@+import { StyleSheet } from 'react-native';++import BaseTheme from '../../../base/ui/components/BaseTheme.native';++export default StyleSheet.create({+ backDrop: {+ backgroundColor: BaseTheme.palette.uiBackground,+ flex: 1+ },++ loadingWrapper: {+ alignItems: 'center',+ backgroundColor: BaseTheme.palette.uiBackground,+ flex: 1,+ justifyContent: 'center'+ },++ webView: {+ backgroundColor: BaseTheme.palette.uiBackground,+ flex: 1+ }+});diff --git a/react/features/custom-panel/components/web/CustomPanel.tsx b/react/features/custom-panel/components/web/CustomPanel.tsxindex ef2791a982..697443baa9 100644--- a/react/features/custom-panel/components/web/CustomPanel.tsx+++ b/react/features/custom-panel/components/web/CustomPanel.tsx@@ -1,11 +1,14 @@-import { throttle } from 'lodash-es';-import React, { useCallback, useEffect, useState } from 'react';+import React, { useCallback } from 'react';+import { useTranslation } from 'react-i18next';import { useDispatch, useSelector } from 'react-redux';import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';-import { isTouchDevice, shouldEnableResize } from '../../../base/environment/utils';-import { setCustomPanelIsResizing, setUserCustomPanelWidth } from '../../actions.web';+import { isTouchDevice, shouldEnableResize } from '../../../base/environment/utils.web';+import { IconCloseLarge } from '../../../base/icons/svg';+import ClickableIcon from '../../../base/ui/components/web/ClickableIcon';+import usePanelResize from '../../../base/ui/hooks/usePanelResize.web';+import { close, setCustomPanelIsResizing, setUserCustomPanelWidth } from '../../actions.web';import {CUSTOM_PANEL_DRAG_HANDLE_HEIGHT,CUSTOM_PANEL_DRAG_HANDLE_OFFSET,@@ -13,7 +16,7 @@ import {CUSTOM_PANEL_TOUCH_HANDLE_SIZE,DEFAULT_CUSTOM_PANEL_WIDTH} from '../../constants';-import { getCustomPanelMaxSize, getCustomPanelOpen, isCustomPanelEnabled } from '../../functions';+import { getCustomPanelMaxSize, getCustomPanelOpen, isCustomPanelEnabled } from '../../functions.web';import CustomPanelContent from './CustomPanelContent';@@ -75,6 +78,16 @@ const useStyles = makeStyles<IStylesProps>()((theme, { isResizing, isTouch, resi}},+ header: {+ alignItems: 'center',+ boxSizing: 'border-box',+ display: 'flex',+ flexShrink: 0,+ height: '60px',+ justifyContent: 'flex-end',+ padding: `0 ${theme.spacing(3)}`+ },+contentContainer: {flex: 1,overflow: 'hidden',@@ -141,7 +154,6 @@ const useStyles = makeStyles<IStylesProps>()((theme, { isResizing, isTouch, resi* @returns {JSX.Element | null} The custom panel or null if not open.*/export default function CustomPanel(): JSX.Element | null {- const dispatch = useDispatch();const enabled = useSelector(isCustomPanelEnabled);const paneOpen = useSelector(getCustomPanelOpen);const panelWidth = useSelector((state: IReduxState) =>@@ -149,91 +161,25 @@ export default function CustomPanel(): JSX.Element | null {const isResizing = useSelector((state: IReduxState) =>state['features/custom-panel']?.isResizing ?? false);const maxPanelWidth = useSelector(getCustomPanelMaxSize);+ const dispatch = useDispatch();+ const { t } = useTranslation();const isTouch = isTouchDevice();const resizeEnabled = shouldEnableResize();const { classes, cx } = useStyles({ isResizing, width: panelWidth, isTouch, resizeEnabled });- const [ isMouseDown, setIsMouseDown ] = useState(false);- const [ mousePosition, setMousePosition ] = useState<number | null>(null);- const [ dragPanelWidth, setDragPanelWidth ] = useState<number | null>(null);-- /**- * Handles pointer down on the drag handle.- * Supports both mouse and touch events via Pointer Events API.- *- * @param {React.PointerEvent} e - The pointer down event.- * @returns {void}- */- const onDragHandlePointerDown = useCallback((e: React.PointerEvent) => {- e.preventDefault();- e.stopPropagation();-- // Capture the pointer to ensure we receive all pointer events- // even if the pointer moves outside the element.- (e.target as HTMLElement).setPointerCapture(e.pointerId);-- setIsMouseDown(true);- setMousePosition(e.clientX);- setDragPanelWidth(panelWidth);-- dispatch(setCustomPanelIsResizing(true));-- document.body.style.cursor = 'col-resize';- document.body.style.userSelect = 'none';- }, [ panelWidth, dispatch ]);+ const { isMouseDown, onDragHandlePointerDown } = usePanelResize({+ edge: 'left',+ maxWidth: maxPanelWidth,+ minWidth: DEFAULT_CUSTOM_PANEL_WIDTH,+ setIsResizing: setCustomPanelIsResizing,+ setWidth: setUserCustomPanelWidth,+ width: panelWidth+ });- /**- * Handles pointer up to end drag resize.- *- * @returns {void}- */- const onDragPointerUp = useCallback(() => {- if (isMouseDown) {- setIsMouseDown(false);- dispatch(setCustomPanelIsResizing(false));-- document.body.style.cursor = '';- document.body.style.userSelect = '';- }- }, [ isMouseDown, dispatch ]);-- /**- * Handles pointer move during drag resize.- * Handle is on the LEFT edge, so dragging left (negative diff) widens the panel.- *- * @param {PointerEvent} e - The pointermove event.- * @returns {void}- */- const onPanelResize = useCallback(throttle((e: PointerEvent) => {- if (isMouseDown && mousePosition !== null && dragPanelWidth !== null) {- const diff = e.clientX - mousePosition;-- // Handle is on LEFT edge: dragging left (negative diff) increases width.- const newWidth = Math.max(- Math.min(dragPanelWidth - diff, maxPanelWidth),- DEFAULT_CUSTOM_PANEL_WIDTH- );-- if (newWidth !== panelWidth) {- dispatch(setUserCustomPanelWidth(newWidth));- }- }- }, 50, {- leading: true,- trailing: false- }), [ isMouseDown, mousePosition, dragPanelWidth, panelWidth, maxPanelWidth, dispatch ]);-- // Set up global event listeners for drag tracking.- useEffect(() => {- document.addEventListener('pointerup', onDragPointerUp);- document.addEventListener('pointermove', onPanelResize);-- return () => {- document.removeEventListener('pointerup', onDragPointerUp);- document.removeEventListener('pointermove', onPanelResize);- };- }, [ onDragPointerUp, onPanelResize ]);+ const onClick = useCallback(() => {+ dispatch(close());+ }, [ dispatch ]);if (!enabled || !paneOpen) {return null;@@ -252,6 +198,12 @@ export default function CustomPanel(): JSX.Element | null {onPointerDown = { onDragHandlePointerDown }><div className = { cx(classes.dragHandle, 'customPanelDragHandle') } /></div>+ <div className = { classes.header }>+ <ClickableIcon+ accessibilityLabel = { t('customPanel.close') }+ icon = { IconCloseLarge }+ onClick = { onClick } />+ </div><div className = { classes.contentContainer }><CustomPanelContent /></div>diff --git a/react/features/custom-panel/components/web/CustomPanelButton.tsx b/react/features/custom-panel/components/web/CustomPanelButton.tsxindex ef7b733414..2b37efeda9 100644--- a/react/features/custom-panel/components/web/CustomPanelButton.tsx+++ b/react/features/custom-panel/components/web/CustomPanelButton.tsx@@ -1,10 +1,77 @@+import { connect } from 'react-redux';++import { IReduxState } from '../../../app/types';+import { translate } from '../../../base/i18n/functions.web';+import { IconAI } from '../../../base/icons/svg';+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';+import { closeOverflowMenuIfOpen } from '../../../toolbox/actions.web';+import {+ close as closeCustomPanel,+ open as openCustomPanel+} from '../../actions.web';+import { getCustomPanelOpen } from '../../functions.web';++/**+ * The type of the React {@code Component} props of {@link CustomPanelButton}.+ */+interface IProps extends AbstractButtonProps {++ /**+ * Whether the custom panel is currently open.+ */+ _isOpen: boolean;+}++/**+ * Implementation of a button for toggling the custom panel.+ */+class CustomPanelButton extends AbstractButton<IProps> {+ override accessibilityLabel = 'toolbar.aiAssist';+ override icon = IconAI;+ override label = 'toolbar.aiAssist';+ override toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeCustomPanel';+ override toggledTooltip = 'toolbar.closeCustomPanel';+ override tooltip = 'toolbar.aiAssist';++ /**+ * Indicates whether this button is in toggled state or not.+ *+ * @override+ * @protected+ * @returns {boolean} True if the button is toggled, false otherwise.+ */+ override _isToggled() {+ return this.props._isOpen;+ }++ /**+ * Handles clicking the button and toggles the custom panel.+ *+ * @private+ * @returns {void}+ */+ override _handleClick() {+ const { dispatch, _isOpen } = this.props;++ dispatch(closeOverflowMenuIfOpen());+ if (_isOpen) {+ dispatch(closeCustomPanel());+ } else {+ dispatch(openCustomPanel());+ }+ }+}+/**- * Custom panel button placeholder component.- * This file is overridden by jitsi-meet-branding at build time- * to provide the actual button implementation with custom icon.+ * Maps part of the Redux state to the props of this component.*- * @returns {null} This placeholder renders nothing.+ * @param {IReduxState} state - The Redux state.+ * @returns {Object} The props derived from state.*/-const CustomPanelButton = (): null => null;+function mapStateToProps(state: IReduxState) {+ return {+ _isOpen: getCustomPanelOpen(state)+ };+}-export default CustomPanelButton;+export default translate(connect(mapStateToProps)(CustomPanelButton));diff --git a/react/features/custom-panel/components/web/CustomPanelContent.tsx b/react/features/custom-panel/components/web/CustomPanelContent.tsxindex 4da8cc705b..4ab8c96b75 100644--- a/react/features/custom-panel/components/web/CustomPanelContent.tsx+++ b/react/features/custom-panel/components/web/CustomPanelContent.tsx@@ -1,11 +1,63 @@+import React from 'react';+import { useTranslation } from 'react-i18next';+import { useSelector } from 'react-redux';+import { makeStyles } from 'tss-react/mui';++import { IReduxState } from '../../../app/types';+import { useCustomPanelApi } from '../../api.web';+import { buildCustomPanelUrl, getCustomPanelUrl } from '../../functions.web';++const useStyles = makeStyles()(() => {+ return {+ iframeContainer: {+ boxSizing: 'border-box',+ flex: 1,+ overflow: 'hidden',+ position: 'relative',+ width: '100%',+ height: '100%'+ },++ iframe: {+ border: 'none',+ height: '100%',+ width: '100%'+ }+ };+});+/**- * Custom panel content placeholder component.- * This file is overridden by jitsi-meet-branding at build time- * to provide the actual panel content (e.g. iframe).+ * Renders the advisor web app in an iframe, loaded with the meeting JWT and id.+ * The {@link CustomPanel} container owns the resize, the close button and the positioning.*- * @returns {null} This placeholder renders nothing.+ * @returns {JSX.Element | null} The custom panel content or null.*/-export default function CustomPanelContent(): null {- return null;-}+const CustomPanelContent = (): JSX.Element | null => {+ const baseUrl = useSelector(getCustomPanelUrl);+ const jwt = useSelector((state: IReduxState) => state['features/base/jwt'].jwt);+ const conference = useSelector((state: IReduxState) => state['features/base/conference'].conference);+ const meetingId = conference?.getMeetingUniqueId();+ const { classes } = useStyles();+ const { t } = useTranslation();+ const fullUrl = buildCustomPanelUrl(baseUrl, jwt, meetingId);++ // Owns the postMessage Transport lifecycle. In the current ownership+ // model the iframe creates the MessageChannel and the meeting listens+ // on `window` for the handshake, so no iframe `load` or ref wiring is+ // required here. No outgoing events are sent from the meeting yet;+ // when the first one is added, this hook can return a typed sender.+ useCustomPanelApi(fullUrl);++ return (+ <div className = { classes.iframeContainer }>+ {fullUrl && (+ <iframe+ className = { classes.iframe }+ src = { fullUrl }+ title = { t('customPanel.title') } />+ )}+ </div>+ );+};+export default CustomPanelContent;diff --git a/react/features/custom-panel/constants.ts b/react/features/custom-panel/constants.tsindex 220bd2bad4..e095db0cc9 100644--- a/react/features/custom-panel/constants.ts+++ b/react/features/custom-panel/constants.ts@@ -1,3 +1,8 @@+/**+ * Default theme for the custom panel.+ */+export const DEFAULT_CUSTOM_PANEL_THEME = 'dark';+/*** Default width for the custom panel in pixels.*/@@ -23,3 +28,24 @@ export const CUSTOM_PANEL_TOUCH_HANDLE_SIZE = 44;* Offset from the panel edge for positioning the drag handle.*/export const CUSTOM_PANEL_DRAG_HANDLE_OFFSET = 4;++/*+ * Advisor protocol (only written copy). `Transport` envelope on all platforms:+ * { type: 'event', data: { name: EVENT_CLOSE_PANEL } }+ *+ * Web: advisor posts `init_channel` to `window.parent` (origin + scope checked once), then uses the `MessagePort`.+ * Native: no handshake; every message is JSON with `scope: API_SCOPE`. Advisor sends via+ * `window.ReactNativeWebView.postMessage`.+ * - iOS: advisor receives on `window`.+ * - Android: advisor receives on `document`.+ */++/**+ * Namespaces the advisor protocol.+ */+export const API_SCOPE = 'jitsi_custom_panel';++/**+ * Event the advisor sends to close the panel.+ */+export const EVENT_CLOSE_PANEL = 'close-panel';diff --git a/react/features/custom-panel/functions.any.ts b/react/features/custom-panel/functions.any.tsnew file mode 100644index 0000000000..ff823239a5--- /dev/null+++ b/react/features/custom-panel/functions.any.ts@@ -0,0 +1,85 @@+import { IReduxState } from '../app/types';++import { DEFAULT_CUSTOM_PANEL_THEME, DEFAULT_CUSTOM_PANEL_WIDTH } from './constants';++/**+ * Returns the configured custom panel URL, or undefined when none is configured.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {string | undefined} The URL to load in the custom panel iframe.+ */+export function getCustomPanelUrl(state: IReduxState): string | undefined {+ return state['features/base/config'].customPanel?.url;+}++/**+ * Returns whether AI Assist (custom panel) is enabled. It needs the config flag, a URL+ * (from `config.js` or dynamic branding), a JWT and an advisor deployed for this meeting.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {boolean}+ */+export function isCustomPanelEnabled(state: IReduxState): boolean {+ return Boolean(state['features/base/config'].customPanel?.enabled+ && getCustomPanelUrl(state)+ && state['features/base/jwt'].jwt+ && state['features/custom-panel']?.isAdvisorAvailable);+}++/**+ * Builds the advisor URL. Returns '' without a base URL or JWT (no token, no access).+ *+ * @param {string} [baseUrl] - The configured advisor URL.+ * @param {string} [jwt] - The meeting JWT.+ * @param {string} [meetingId] - The meeting unique id.+ * @returns {string} The full URL, or '' when no base URL or JWT is provided.+ */+export function buildCustomPanelUrl(baseUrl?: string, jwt?: string, meetingId?: string): string {+ if (!baseUrl || !jwt) {+ return '';+ }++ let fullUrl;++ try {+ fullUrl = new URL(baseUrl);+ } catch (_) {+ return '';+ }++ fullUrl.searchParams.set('token', jwt);++ if (meetingId) {+ fullUrl.searchParams.set('meeting', meetingId);+ }+ fullUrl.searchParams.set('theme', DEFAULT_CUSTOM_PANEL_THEME);++ return fullUrl.toString();+}++/**+ * Returns whether the custom panel is currently open.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {boolean} Whether the custom panel is open.+ */+export function getCustomPanelOpen(state: IReduxState): boolean {+ return Boolean(state['features/custom-panel']?.isOpen);+}++/**+ * Returns the width the custom panel takes from the video space. 0 when closed, disabled,+ * or on native, where the panel is a navigation route and never sets `isOpen`.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {number}+ */+export function getCustomPanelWidth(state: IReduxState): number {+ const panel = state['features/custom-panel'];++ if (!isCustomPanelEnabled(state) || !getCustomPanelOpen(state)) {+ return 0;+ }++ return panel.width?.current ?? DEFAULT_CUSTOM_PANEL_WIDTH;+}diff --git a/react/features/custom-panel/functions.custom.ts b/react/features/custom-panel/functions.custom.tsdeleted file mode 100644index 611301a387..0000000000--- a/react/features/custom-panel/functions.custom.ts+++ /dev/null@@ -1,5 +0,0 @@-/**- * Custom panel functions placeholder.- * Override to add custom panel functionality.- */-export {}; // we need this just to make TS happy!diff --git a/react/features/custom-panel/functions.native.ts b/react/features/custom-panel/functions.native.tsnew file mode 100644index 0000000000..1d2ebf6637--- /dev/null+++ b/react/features/custom-panel/functions.native.ts@@ -0,0 +1,19 @@+export * from './functions.any';++/**+ * Returns the origin of the given URL, or '' on a parse error.+ *+ * @param {string} [url] - The URL to parse.+ * @returns {string}+ */+export function getCustomPanelOrigin(url?: string): string {+ if (!url) {+ return '';+ }++ try {+ return new URL(url).origin;+ } catch (_) {+ return '';+ }+}diff --git a/react/features/custom-panel/functions.ts b/react/features/custom-panel/functions.tsdeleted file mode 100644index 20ff3ed385..0000000000--- a/react/features/custom-panel/functions.ts+++ /dev/null@@ -1,69 +0,0 @@-import { IReduxState } from '../app/types';-import { CHAT_SIZE } from '../chat/constants';-import { getParticipantsPaneWidth } from '../participants-pane/functions';-import { VIDEO_SPACE_MIN_SIZE } from '../video-layout/constants';--import { DEFAULT_CUSTOM_PANEL_WIDTH } from './constants';--export * from './functions.custom';--/**- * Returns whether the custom panel is enabled based on Redux state.- * The feature is disabled by default and can be enabled dynamically via console.- *- * @param {IReduxState} state - The Redux state.- * @returns {boolean} Whether the custom panel is enabled.- */-export function isCustomPanelEnabled(state: IReduxState): boolean {- return Boolean(state['features/custom-panel']?.enabled);-}--/**- * Returns whether the custom panel is currently open.- *- * @param {IReduxState} state - The Redux state.- * @returns {boolean} Whether the custom panel is open.- */-export function getCustomPanelOpen(state: IReduxState): boolean {- return Boolean(state['features/custom-panel']?.isOpen);-}--/**- * Returns the current configured width of the custom panel from Redux state.- * Falls back to the default width if no dynamic width is set.- *- * @param {IReduxState} state - The Redux state.- * @returns {number} The panel width in pixels.- */-export function getCustomPanelConfiguredWidth(state: IReduxState): number {- return state['features/custom-panel']?.width?.current ?? DEFAULT_CUSTOM_PANEL_WIDTH;-}--/**- * Returns the current panel width (0 if closed or disabled).- *- * @param {IReduxState} state - The Redux state.- * @returns {number} The panel width in pixels.- */-export function getCustomPanelWidth(state: IReduxState): number {- if (!isCustomPanelEnabled(state)) {- return 0;- }-- return getCustomPanelOpen(state) ? getCustomPanelConfiguredWidth(state) : 0;-}--/**- * Calculates the maximum width available for the custom panel based on the- * current window size and other open UI panels.- *- * @param {IReduxState} state - The Redux state.- * @returns {number} The maximum width in pixels. Returns 0 if no space is available.- */-export function getCustomPanelMaxSize(state: IReduxState): number {- const { clientWidth } = state['features/base/responsive-ui'];- const { isOpen: isChatOpen, width: chatWidth } = state['features/chat'];- const chatPanelWidth = isChatOpen ? (chatWidth?.current ?? CHAT_SIZE) : 0;-- return Math.max(clientWidth - chatPanelWidth - getParticipantsPaneWidth(state) - VIDEO_SPACE_MIN_SIZE, 0);-}diff --git a/react/features/custom-panel/functions.web.ts b/react/features/custom-panel/functions.web.tsnew file mode 100644index 0000000000..ad71790abf--- /dev/null+++ b/react/features/custom-panel/functions.web.ts@@ -0,0 +1,21 @@+import { IReduxState } from '../app/types';+import { CHAT_SIZE } from '../chat/constants';+import { getParticipantsPaneWidth } from '../participants-pane/functions';+import { VIDEO_SPACE_MIN_SIZE } from '../video-layout/constants';++export * from './functions.any';++/**+ * Calculates the maximum width available for the custom panel based on the+ * current window size and other open UI panels.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {number} The maximum width in pixels. Returns 0 if no space is available.+ */+export function getCustomPanelMaxSize(state: IReduxState): number {+ const { clientWidth } = state['features/base/responsive-ui'];+ const { isOpen: isChatOpen, width: chatWidth } = state['features/chat'];+ const chatPanelWidth = isChatOpen ? (chatWidth?.current ?? CHAT_SIZE) : 0;++ return Math.max(clientWidth - chatPanelWidth - getParticipantsPaneWidth(state) - VIDEO_SPACE_MIN_SIZE, 0);+}diff --git a/react/features/custom-panel/hooks.web.ts b/react/features/custom-panel/hooks.web.tsindex a45c9ba7c7..ad9c542998 100644--- a/react/features/custom-panel/hooks.web.ts+++ b/react/features/custom-panel/hooks.web.ts@@ -1,7 +1,9 @@import { useSelector } from 'react-redux';+import { isInBreakoutRoom } from '../breakout-rooms/functions';+import CustomPanelButton from './components/web/CustomPanelButton';-import { isCustomPanelEnabled } from './functions';+import { isCustomPanelEnabled } from './functions.web';/*** Configuration for the custom panel toolbar button.@@ -13,15 +15,15 @@ const customPanel = {};/**- * A hook that returns the custom panel button if the feature is enabled.- * Uses useSelector for reactive updates when the feature is toggled dynamically.+ * A hook that returns the custom panel button.** @returns {Object | undefined} The button configuration or undefined if disabled.*/export function useCustomPanelButton() {const enabled = useSelector(isCustomPanelEnabled);+ const inBreakoutRoom = useSelector(isInBreakoutRoom);- if (enabled) {+ if (enabled && !inBreakoutRoom) {return customPanel;}diff --git a/react/features/custom-panel/logger.ts b/react/features/custom-panel/logger.tsnew file mode 100644index 0000000000..872af2a93f--- /dev/null+++ b/react/features/custom-panel/logger.ts@@ -0,0 +1,3 @@+import { getLogger } from '../base/logging/functions';++export default getLogger('app:custom-panel');diff --git a/react/features/custom-panel/middleware.any.ts b/react/features/custom-panel/middleware.any.tsnew file mode 100644index 0000000000..976626ca6a--- /dev/null+++ b/react/features/custom-panel/middleware.any.ts@@ -0,0 +1,23 @@+import { CONFERENCE_UNIQUE_ID_SET } from '../base/conference/actionTypes';+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';+import { SET_DYNAMIC_BRANDING_DATA } from '../dynamic-branding/actionTypes';++import { resolveCustomPanelAdvisor } from './actions.any';++/**+ * Checks whether an advisor is deployed for the meeting. The check needs the meeting id and+ * the branding URL, which can arrive in any order, so it runs after each.+ */+MiddlewareRegistry.register(store => next => action => {+ const result = next(action);++ switch (action.type) {+ // The meeting id is required by the check. It arrives after joining, when the deployment provides one.+ case CONFERENCE_UNIQUE_ID_SET:+ case SET_DYNAMIC_BRANDING_DATA:+ store.dispatch(resolveCustomPanelAdvisor());+ break;+ }++ return result;+});diff --git a/react/features/custom-panel/middleware.custom.web.ts b/react/features/custom-panel/middleware.custom.web.tsdeleted file mode 100644index ff248efda5..0000000000--- a/react/features/custom-panel/middleware.custom.web.ts+++ /dev/null@@ -1,4 +0,0 @@-/**- * Custom panel middleware placeholder.- * Override to add custom panel functionality.- */diff --git a/react/features/custom-panel/middleware.native.ts b/react/features/custom-panel/middleware.native.tsnew file mode 100644index 0000000000..26f469cbe5--- /dev/null+++ b/react/features/custom-panel/middleware.native.ts@@ -0,0 +1,24 @@+import './middleware.any';+import StateListenerRegistry from '../base/redux/StateListenerRegistry';+import { isInBreakoutRoom } from '../breakout-rooms/functions';+import {+ conferenceNavigationRef,+ popTo+} from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';+import { screen } from '../mobile/navigation/routes';++/**+ * Closes the AI Assist screen on entering a breakout room, where there are no transcriptions.+ */+StateListenerRegistry.register(+ state => Boolean(isInBreakoutRoom(state)),+ (inBreakoutRoom: boolean) => {+ if (!inBreakoutRoom) {+ return;+ }++ if (conferenceNavigationRef.current?.getCurrentRoute()?.name === screen.conference.customPanel) {+ popTo(screen.conference.main);+ }+ }+);diff --git a/react/features/custom-panel/middleware.web.ts b/react/features/custom-panel/middleware.web.tsindex 016f088443..2b1011f77c 100644--- a/react/features/custom-panel/middleware.web.ts+++ b/react/features/custom-panel/middleware.web.ts@@ -1,2 +1,2 @@-import './middleware.custom.web';+import './middleware.any';import './subscriber.web';diff --git a/react/features/custom-panel/reducer.ts b/react/features/custom-panel/reducer.tsindex 5fa204f24d..7dc3030449 100644--- a/react/features/custom-panel/reducer.ts+++ b/react/features/custom-panel/reducer.ts@@ -1,10 +1,11 @@+import { CONFERENCE_LEFT } from '../base/conference/actionTypes';import PersistenceRegistry from '../base/redux/PersistenceRegistry';import ReducerRegistry from '../base/redux/ReducerRegistry';import {CUSTOM_PANEL_CLOSE,CUSTOM_PANEL_OPEN,- SET_CUSTOM_PANEL_ENABLED,+ SET_CUSTOM_PANEL_ADVISOR_AVAILABLE,SET_CUSTOM_PANEL_IS_RESIZING,SET_CUSTOM_PANEL_WIDTH,SET_USER_CUSTOM_PANEL_WIDTH@@ -17,10 +18,9 @@ import { DEFAULT_CUSTOM_PANEL_WIDTH } from './constants';export interface ICustomPanelState {/**- * Whether the custom panel feature is enabled.- * This can be toggled dynamically via console.+ * Whether advisor-resolve confirmed an advisor for the current meeting.*/- enabled: boolean;+ isAdvisorAvailable: boolean;/*** Whether the custom panel is currently open.@@ -50,7 +50,7 @@ export interface ICustomPanelState {}const DEFAULT_STATE: ICustomPanelState = {- enabled: false,+ isAdvisorAvailable: false,isOpen: false,isResizing: false,width: {@@ -60,11 +60,9 @@ const DEFAULT_STATE: ICustomPanelState = {};/**- * Persist only the width subtree so the user's preferred panel width- * survives page reloads.+ * Persist the width subtree, so the user's preferred panel width survives page reloads.*/PersistenceRegistry.register('features/custom-panel', {- enabled: true,width: true});@@ -74,6 +72,12 @@ PersistenceRegistry.register('features/custom-panel', {ReducerRegistry.register('features/custom-panel', (state: ICustomPanelState = DEFAULT_STATE, action): ICustomPanelState => {switch (action.type) {+ case CONFERENCE_LEFT:+ return {+ ...state,+ isAdvisorAvailable: false+ };+case CUSTOM_PANEL_CLOSE:return {...state,@@ -86,10 +90,10 @@ ReducerRegistry.register(isOpen: true};- case SET_CUSTOM_PANEL_ENABLED:+ case SET_CUSTOM_PANEL_ADVISOR_AVAILABLE:return {...state,- enabled: action.enabled+ isAdvisorAvailable: action.available};case SET_CUSTOM_PANEL_WIDTH:diff --git a/react/features/custom-panel/subscriber.web.ts b/react/features/custom-panel/subscriber.web.tsindex 60bcd584de..5abe84e481 100644--- a/react/features/custom-panel/subscriber.web.ts+++ b/react/features/custom-panel/subscriber.web.ts@@ -2,10 +2,11 @@import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';import StateListenerRegistry from '../base/redux/StateListenerRegistry';import { clientResized } from '../base/responsive-ui/actions';+import { isInBreakoutRoom } from '../breakout-rooms/functions';-import { setCustomPanelWidth } from './actions.web';+import { close, setCustomPanelWidth } from './actions.web';import { DEFAULT_CUSTOM_PANEL_WIDTH } from './constants';-import { getCustomPanelMaxSize } from './functions';+import { getCustomPanelMaxSize } from './functions.web';/*** Listens for changes in the custom panel open state to recompute available@@ -87,3 +88,15 @@ StateListenerRegistry.register(}}});++/**+ * The advisor works from meeting transcriptions, which are not available in a breakout+ * room. Close the panel when the local participant switches into one.+ */+StateListenerRegistry.register(+ /* selector */ state => Boolean(isInBreakoutRoom(state)),+ /* listener */ (inBreakoutRoom: boolean, { dispatch }) => {+ if (inBreakoutRoom) {+ dispatch(close());+ }+ });diff --git a/react/features/custom-panel/types.ts b/react/features/custom-panel/types.tsnew file mode 100644index 0000000000..85ff7f81dd--- /dev/null+++ b/react/features/custom-panel/types.ts@@ -0,0 +1,23 @@+/**+ * Shape of the event envelope exchanged with the advisor app.+ *+ * Mirrors the style used by `modules/API`: a `name` field identifies the event+ * and any additional fields are event-specific payload.+ */+export interface ICustomPanelEvent {++ /**+ * Additional event-specific fields are allowed.+ */+ [key: string]: unknown;++ /**+ * Discriminator for the event, matched against the handler table.+ */+ name: string;+}++/**+ * Signature of an event handler registered in the table-driven dispatch map.+ */+export type EventHandler = (event: ICustomPanelEvent) => void;diff --git a/react/features/mobile/navigation/components/conference/components/ConferenceNavigationContainer.tsx b/react/features/mobile/navigation/components/conference/components/ConferenceNavigationContainer.tsxindex 9386582648..874da8054f 100644--- a/react/features/mobile/navigation/components/conference/components/ConferenceNavigationContainer.tsx+++ b/react/features/mobile/navigation/components/conference/components/ConferenceNavigationContainer.tsx@@ -19,6 +19,7 @@ import Conference from '../../../../../conference/components/native/Conference';import CarMode from '../../../../../conference/components/native/carmode/CarMode';// @ts-ignoreimport { arePollsDisabled } from '../../../../../conference/functions';+import CustomPanel from '../../../../../custom-panel/components/native/CustomPanel';// @ts-ignoreimport SharedDocument from '../../../../../etherpad/components/native/SharedDocument';// @ts-ignore@@ -55,6 +56,7 @@ import {carmodeScreenOptions,chatScreenOptions,conferenceScreenOptions,+ customPanelScreenOptions,gifsMenuOptions,inviteScreenOptions,liveStreamScreenOptions,@@ -247,6 +249,13 @@ const ConferenceNavigationContainer = () => {...whiteboardScreenOptions,title: t('whiteboard.screenTitle')}} />+ <ConferenceStack.Screen+ component = { CustomPanel }+ name = { screen.conference.customPanel }+ options = {{+ ...customPanelScreenOptions,+ title: t('customPanel.title')+ }} /></ConferenceStack.Navigator></NavigationContainer></NavigationIndependentTree>diff --git a/react/features/mobile/navigation/routes.ts b/react/features/mobile/navigation/routes.tsindex 5ea0e8bd80..5dc21bed77 100644--- a/react/features/mobile/navigation/routes.ts+++ b/react/features/mobile/navigation/routes.ts@@ -13,6 +13,7 @@ export const screen = {}},container: 'Conference container',+ customPanel: 'AI Assist',gifsMenu: 'GIPHY',invite: 'Invite',liveStream: 'Live stream',diff --git a/react/features/mobile/navigation/screenOptions.ts b/react/features/mobile/navigation/screenOptions.tsindex cb40d34398..729a2f4886 100644--- a/react/features/mobile/navigation/screenOptions.ts+++ b/react/features/mobile/navigation/screenOptions.ts@@ -132,6 +132,11 @@ export const liveStreamScreenOptions = presentationScreenOptions;*/export const participantsScreenOptions = presentationScreenOptions;+/**+ * Screen options for custom panel modal.+ */+export const customPanelScreenOptions = presentationScreenOptions;+/*** Screen options for speaker stats modal.*/diff --git a/react/features/toolbox/components/native/OverflowMenu.tsx b/react/features/toolbox/components/native/OverflowMenu.tsxindex c150b37338..8c91154b26 100644--- a/react/features/toolbox/components/native/OverflowMenu.tsx+++ b/react/features/toolbox/components/native/OverflowMenu.tsx@@ -11,6 +11,7 @@ import { bottomSheetStyles } from '../../../base/dialog/components/native/stylesimport SettingsButton from '../../../base/settings/components/native/SettingsButton';import BreakoutRoomsButtonfrom '../../../breakout-rooms/components/native/BreakoutRoomsButton';+import CustomPanelButton from '../../../custom-panel/components/native/CustomPanelButton';import SharedDocumentButton from '../../../etherpad/components/SharedDocumentButton.native';import ReactionMenu from '../../../reactions/components/native/ReactionMenu';import { shouldDisplayReactionsButtons } from '../../../reactions/functions.any';@@ -165,6 +166,7 @@ class OverflowMenu extends PureComponent<IProps, IState> {<LiveStreamButton { ...buttonProps } /><LinkToSalesforceButton { ...buttonProps } /><WhiteboardButton { ...buttonProps } />+ <CustomPanelButton { ...buttonProps } />{/* @ts-ignore */}<Divider style = { styles.divider as ViewStyle } />{_isSharedVideoEnabled && <SharedVideoButton { ...buttonProps } />}