From 10f0a07431d493855dfbd16ca0540fd35e1fe035 Mon Sep 17 00:00:00 2001 From: AtilaU19 Date: Tue, 4 Aug 2026 16:13:27 +0000 Subject: [PATCH 1/2] feat(ui-commands): allow plugins to open a core panel or a specific sidekick panel --- README.md | 15 +++++-- src/ui-commands/index.ts | 1 + .../sidekick-area/options/panel/commands.ts | 43 ++++++++++++++++--- .../sidekick-area/options/panel/enums.ts | 15 +++++++ .../sidekick-area/options/panel/types.ts | 13 +++++- .../sidekick-options-container/commands.ts | 15 ++++--- 6 files changed, 85 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index a9b8b36a..7bfc4502 100644 --- a/README.md +++ b/README.md @@ -781,11 +781,12 @@ One other thing is that the type of the return is precisely the same type requir - setMenuBadge: this will set a badge for a specific generic content in the sidekick area; - removeMenuBadge: this will remove any badges that a specific generic content might have; - panel: - - open: this function will open the sidekick options panel automatically; + - open: this function will open the sidekick options panel automatically. It optionally takes the ID of a generic content sidekick area (as returned by `setGenericContentItems`) to open that specific panel; + - openCorePanel: this function will open one of the core panels, such as Polls, described by the `SidekickAreaCorePanelEnum`. Polls, Timer and Breakout are ignored unless the user could already open them from the sidebar navigation; - close: this function will close the sidekick options panel automatically (and also the sidebar content if open, to avoid inconsistencies in ui); - sidekick-options-container: - - open: this function will open the sidekick options panel automatically; - - close: this function will close the sidekick options panel automatically (and also the sidebar content if open, to avoid inconsistencies in ui); + - open: this function will open the sidekick options panel automatically (deprecated, use `sidekickArea.options.panel.open` instead); + - close: this function will close the sidekick options panel automatically (and also the sidebar content if open, to avoid inconsistencies in ui) (deprecated, use `sidekickArea.options.panel.close` instead); - user-status: - setAwayStatus: this function will set the away status of the user to a certain status; - captions: @@ -837,6 +838,14 @@ One other thing is that the type of the return is precisely the same type requir 'New Section Name' ); + // Open a specific sidekick panel + pluginApi.uiCommands.sidekickArea.options.panel.open('my-content-id'); + + // Open a core panel + pluginApi.uiCommands.sidekickArea.options.panel.openCorePanel( + SidekickAreaCorePanelEnum.POLL + ); + // Camera commands pluginApi.uiCommands.camera.setSelfViewDisableAllDevices(true); pluginApi.uiCommands.camera.setSelfViewDisable('camera-stream-id', false); diff --git a/src/ui-commands/index.ts b/src/ui-commands/index.ts index d20ff9ff..cce59445 100644 --- a/src/ui-commands/index.ts +++ b/src/ui-commands/index.ts @@ -3,3 +3,4 @@ export { ChangeEnforcedLayoutTypeEnum, EnforcedLayoutTypeEnum } from './layout/e export { CaptionsLanguageEnum } from './captions/enums'; export { ChatUiCommandsEnum } from './chat/enums'; export { ScreenshareCommandsEnum } from './screenshare/enums'; +export { SidekickAreaCorePanelEnum } from './sidekick-area/options/panel/enums'; diff --git a/src/ui-commands/sidekick-area/options/panel/commands.ts b/src/ui-commands/sidekick-area/options/panel/commands.ts index 21a5507f..eeca738d 100644 --- a/src/ui-commands/sidekick-area/options/panel/commands.ts +++ b/src/ui-commands/sidekick-area/options/panel/commands.ts @@ -1,16 +1,47 @@ -import { SidekickAreaOptionsPanelEnum } from './enums'; -import { UiCommandsSidekickAreaOptionsPanelObject } from './types'; +import { SidekickAreaCorePanelEnum, SidekickAreaOptionsPanelEnum } from './enums'; +import { + OpenSidekickAreaCorePanelCommandArguments, + OpenSidekickAreaOptionsPanelCommandArguments, + UiCommandsSidekickAreaOptionsPanelObject, +} from './types'; export const sidekickAreaOptionsPanel: UiCommandsSidekickAreaOptionsPanelObject = { /** - * Opens the sidekick container automatically. + * Opens the sidekick panel automatically. + * + * @param id Id of the generic content sidekick area, as returned by + * `pluginApi.setGenericContentItems`. When omitted, no panel is selected. */ - open: () => { - window.dispatchEvent(new Event(SidekickAreaOptionsPanelEnum.OPEN)); + open: (id?: string) => { + window.dispatchEvent(new CustomEvent( + SidekickAreaOptionsPanelEnum.OPEN, + { + detail: { + id, + }, + }, + )); }, /** - * Closes the sidekick container (and sidebard content panel) automatically. + * Opens one of the core panels, such as Polls. + * + * @param panel Core panel to be opened. Polls, Timer and Breakout are ignored + * unless the user could already open them from the sidebar navigation. + */ + openCorePanel: (panel: SidekickAreaCorePanelEnum) => { + window.dispatchEvent(new CustomEvent( + SidekickAreaOptionsPanelEnum.OPEN_CORE_PANEL, + { + detail: { + panel, + }, + }, + )); + }, + + /** + * Closes the sidekick container (and sidebar content panel) automatically. */ close: () => { window.dispatchEvent(new Event(SidekickAreaOptionsPanelEnum.CLOSE)); diff --git a/src/ui-commands/sidekick-area/options/panel/enums.ts b/src/ui-commands/sidekick-area/options/panel/enums.ts index 116079cd..3fa6dc2b 100644 --- a/src/ui-commands/sidekick-area/options/panel/enums.ts +++ b/src/ui-commands/sidekick-area/options/panel/enums.ts @@ -1,4 +1,19 @@ export enum SidekickAreaOptionsPanelEnum { OPEN = 'OPEN_SIDEKICK_OPTIONS_CONTAINER_COMMAND', CLOSE = 'CLOSE_SIDEKICK_OPTIONS_CONTAINER_COMMAND', + OPEN_CORE_PANEL = 'OPEN_SIDEKICK_AREA_CORE_PANEL_COMMAND', +} + +/** + * Core panels a plugin is allowed to open. Polls, Timer and Breakout are only + * opened when the user could already open them from the sidebar navigation. + */ +export enum SidekickAreaCorePanelEnum { + CHAT = 'chat', + USER_LIST = 'userlist', + SHARED_NOTES = 'shared-notes', + APPS_GALLERY = 'apps-gallery', + POLL = 'poll', + TIMER = 'timer', + BREAKOUT = 'breakoutroom', } diff --git a/src/ui-commands/sidekick-area/options/panel/types.ts b/src/ui-commands/sidekick-area/options/panel/types.ts index e9e44e8f..41df63f4 100644 --- a/src/ui-commands/sidekick-area/options/panel/types.ts +++ b/src/ui-commands/sidekick-area/options/panel/types.ts @@ -1,4 +1,15 @@ +import { SidekickAreaCorePanelEnum } from './enums'; + export interface UiCommandsSidekickAreaOptionsPanelObject { - open: () => void; + open: (id?: string) => void; + openCorePanel: (panel: SidekickAreaCorePanelEnum) => void; close: () => void; } + +export interface OpenSidekickAreaOptionsPanelCommandArguments { + id?: string; +} + +export interface OpenSidekickAreaCorePanelCommandArguments { + panel: SidekickAreaCorePanelEnum; +} diff --git a/src/ui-commands/sidekick-options-container/commands.ts b/src/ui-commands/sidekick-options-container/commands.ts index dca913e5..12cf76ab 100644 --- a/src/ui-commands/sidekick-options-container/commands.ts +++ b/src/ui-commands/sidekick-options-container/commands.ts @@ -1,21 +1,22 @@ -import { SidekickOptionsContainerEnum } from './enums'; +import { sidekickAreaOptionsPanel } from '../sidekick-area/options/panel/commands'; +import { UiCommandsSidekickOptionsContainerObject } from './types'; -export const sidekickOptionsContainer = { +export const sidekickOptionsContainer: UiCommandsSidekickOptionsContainerObject = { /** * Opens the sidekick container automatically. * - * @deprecated Use the new {@link sidekickArea} object instead. + * @deprecated Use `sidekickArea.options.panel.open` instead. */ open: () => { - window.dispatchEvent(new Event(SidekickOptionsContainerEnum.OPEN)); + sidekickAreaOptionsPanel.open(); }, /** - * Closes the sidekick container (and sidebard content panel) automatically. + * Closes the sidekick container (and sidebar content panel) automatically. * - * @deprecated Use the new {@link sidekickArea} object instead. + * @deprecated Use `sidekickArea.options.panel.close` instead. */ close: () => { - window.dispatchEvent(new Event(SidekickOptionsContainerEnum.CLOSE)); + sidekickAreaOptionsPanel.close(); }, }; From 7c103572f513d6e5f84afb402288821cfe5e083f Mon Sep 17 00:00:00 2001 From: AtilaU19 Date: Fri, 7 Aug 2026 17:15:35 +0000 Subject: [PATCH 2/2] refactor(ui-commands): move the new panel commands to sidekickArea.panel --- README.md | 15 +++--- src/ui-commands/index.ts | 2 +- src/ui-commands/sidekick-area/commands.ts | 2 + .../sidekick-area/options/panel/commands.ts | 43 +++------------- .../sidekick-area/options/panel/enums.ts | 15 ------ .../sidekick-area/options/panel/types.ts | 13 +---- .../sidekick-area/panel/commands.ts | 49 +++++++++++++++++++ src/ui-commands/sidekick-area/panel/enums.ts | 19 +++++++ src/ui-commands/sidekick-area/panel/types.ts | 15 ++++++ src/ui-commands/sidekick-area/types.ts | 2 + .../sidekick-options-container/commands.ts | 15 +++--- 11 files changed, 111 insertions(+), 79 deletions(-) create mode 100644 src/ui-commands/sidekick-area/panel/commands.ts create mode 100644 src/ui-commands/sidekick-area/panel/enums.ts create mode 100644 src/ui-commands/sidekick-area/panel/types.ts diff --git a/README.md b/README.md index 7bfc4502..35fbd581 100644 --- a/README.md +++ b/README.md @@ -781,12 +781,15 @@ One other thing is that the type of the return is precisely the same type requir - setMenuBadge: this will set a badge for a specific generic content in the sidekick area; - removeMenuBadge: this will remove any badges that a specific generic content might have; - panel: - - open: this function will open the sidekick options panel automatically. It optionally takes the ID of a generic content sidekick area (as returned by `setGenericContentItems`) to open that specific panel; - - openCorePanel: this function will open one of the core panels, such as Polls, described by the `SidekickAreaCorePanelEnum`. Polls, Timer and Breakout are ignored unless the user could already open them from the sidebar navigation; + - open: this function will open the sidekick options panel automatically; - close: this function will close the sidekick options panel automatically (and also the sidebar content if open, to avoid inconsistencies in ui); + - panel: + - open: this function will open a generic content sidekick area panel. It optionally takes the ID of that area (as returned by `setGenericContentItems`) to select which one to open; + - openCorePanel: this function will open one of the core panels, such as Polls, described by the `SidekickAreaCorePanelEnum`. Polls, Timer and Breakout are ignored unless the user could already open them from the sidebar navigation; + - close: this function will close the panel currently displayed in the sidekick area; - sidekick-options-container: - - open: this function will open the sidekick options panel automatically (deprecated, use `sidekickArea.options.panel.open` instead); - - close: this function will close the sidekick options panel automatically (and also the sidebar content if open, to avoid inconsistencies in ui) (deprecated, use `sidekickArea.options.panel.close` instead); + - open: this function will open the sidekick options panel automatically; + - close: this function will close the sidekick options panel automatically (and also the sidebar content if open, to avoid inconsistencies in ui); - user-status: - setAwayStatus: this function will set the away status of the user to a certain status; - captions: @@ -839,10 +842,10 @@ One other thing is that the type of the return is precisely the same type requir ); // Open a specific sidekick panel - pluginApi.uiCommands.sidekickArea.options.panel.open('my-content-id'); + pluginApi.uiCommands.sidekickArea.panel.open('my-content-id'); // Open a core panel - pluginApi.uiCommands.sidekickArea.options.panel.openCorePanel( + pluginApi.uiCommands.sidekickArea.panel.openCorePanel( SidekickAreaCorePanelEnum.POLL ); diff --git a/src/ui-commands/index.ts b/src/ui-commands/index.ts index cce59445..8e6ce22d 100644 --- a/src/ui-commands/index.ts +++ b/src/ui-commands/index.ts @@ -3,4 +3,4 @@ export { ChangeEnforcedLayoutTypeEnum, EnforcedLayoutTypeEnum } from './layout/e export { CaptionsLanguageEnum } from './captions/enums'; export { ChatUiCommandsEnum } from './chat/enums'; export { ScreenshareCommandsEnum } from './screenshare/enums'; -export { SidekickAreaCorePanelEnum } from './sidekick-area/options/panel/enums'; +export { SidekickAreaCorePanelEnum } from './sidekick-area/panel/enums'; diff --git a/src/ui-commands/sidekick-area/commands.ts b/src/ui-commands/sidekick-area/commands.ts index f8a69b3d..a8737189 100644 --- a/src/ui-commands/sidekick-area/commands.ts +++ b/src/ui-commands/sidekick-area/commands.ts @@ -1,6 +1,8 @@ import { sidekickAreaOptions } from './options/commands'; +import { sidekickAreaPanel } from './panel/commands'; import { UiCommandsSidekickArea } from './types'; export const sidekickArea: UiCommandsSidekickArea = { options: sidekickAreaOptions, + panel: sidekickAreaPanel, }; diff --git a/src/ui-commands/sidekick-area/options/panel/commands.ts b/src/ui-commands/sidekick-area/options/panel/commands.ts index eeca738d..21a5507f 100644 --- a/src/ui-commands/sidekick-area/options/panel/commands.ts +++ b/src/ui-commands/sidekick-area/options/panel/commands.ts @@ -1,47 +1,16 @@ -import { SidekickAreaCorePanelEnum, SidekickAreaOptionsPanelEnum } from './enums'; -import { - OpenSidekickAreaCorePanelCommandArguments, - OpenSidekickAreaOptionsPanelCommandArguments, - UiCommandsSidekickAreaOptionsPanelObject, -} from './types'; +import { SidekickAreaOptionsPanelEnum } from './enums'; +import { UiCommandsSidekickAreaOptionsPanelObject } from './types'; export const sidekickAreaOptionsPanel: UiCommandsSidekickAreaOptionsPanelObject = { /** - * Opens the sidekick panel automatically. - * - * @param id Id of the generic content sidekick area, as returned by - * `pluginApi.setGenericContentItems`. When omitted, no panel is selected. + * Opens the sidekick container automatically. */ - open: (id?: string) => { - window.dispatchEvent(new CustomEvent( - SidekickAreaOptionsPanelEnum.OPEN, - { - detail: { - id, - }, - }, - )); + open: () => { + window.dispatchEvent(new Event(SidekickAreaOptionsPanelEnum.OPEN)); }, /** - * Opens one of the core panels, such as Polls. - * - * @param panel Core panel to be opened. Polls, Timer and Breakout are ignored - * unless the user could already open them from the sidebar navigation. - */ - openCorePanel: (panel: SidekickAreaCorePanelEnum) => { - window.dispatchEvent(new CustomEvent( - SidekickAreaOptionsPanelEnum.OPEN_CORE_PANEL, - { - detail: { - panel, - }, - }, - )); - }, - - /** - * Closes the sidekick container (and sidebar content panel) automatically. + * Closes the sidekick container (and sidebard content panel) automatically. */ close: () => { window.dispatchEvent(new Event(SidekickAreaOptionsPanelEnum.CLOSE)); diff --git a/src/ui-commands/sidekick-area/options/panel/enums.ts b/src/ui-commands/sidekick-area/options/panel/enums.ts index 3fa6dc2b..116079cd 100644 --- a/src/ui-commands/sidekick-area/options/panel/enums.ts +++ b/src/ui-commands/sidekick-area/options/panel/enums.ts @@ -1,19 +1,4 @@ export enum SidekickAreaOptionsPanelEnum { OPEN = 'OPEN_SIDEKICK_OPTIONS_CONTAINER_COMMAND', CLOSE = 'CLOSE_SIDEKICK_OPTIONS_CONTAINER_COMMAND', - OPEN_CORE_PANEL = 'OPEN_SIDEKICK_AREA_CORE_PANEL_COMMAND', -} - -/** - * Core panels a plugin is allowed to open. Polls, Timer and Breakout are only - * opened when the user could already open them from the sidebar navigation. - */ -export enum SidekickAreaCorePanelEnum { - CHAT = 'chat', - USER_LIST = 'userlist', - SHARED_NOTES = 'shared-notes', - APPS_GALLERY = 'apps-gallery', - POLL = 'poll', - TIMER = 'timer', - BREAKOUT = 'breakoutroom', } diff --git a/src/ui-commands/sidekick-area/options/panel/types.ts b/src/ui-commands/sidekick-area/options/panel/types.ts index 41df63f4..e9e44e8f 100644 --- a/src/ui-commands/sidekick-area/options/panel/types.ts +++ b/src/ui-commands/sidekick-area/options/panel/types.ts @@ -1,15 +1,4 @@ -import { SidekickAreaCorePanelEnum } from './enums'; - export interface UiCommandsSidekickAreaOptionsPanelObject { - open: (id?: string) => void; - openCorePanel: (panel: SidekickAreaCorePanelEnum) => void; + open: () => void; close: () => void; } - -export interface OpenSidekickAreaOptionsPanelCommandArguments { - id?: string; -} - -export interface OpenSidekickAreaCorePanelCommandArguments { - panel: SidekickAreaCorePanelEnum; -} diff --git a/src/ui-commands/sidekick-area/panel/commands.ts b/src/ui-commands/sidekick-area/panel/commands.ts new file mode 100644 index 00000000..00e3ba55 --- /dev/null +++ b/src/ui-commands/sidekick-area/panel/commands.ts @@ -0,0 +1,49 @@ +import { SidekickAreaCorePanelEnum, SidekickAreaPanelEnum } from './enums'; +import { + OpenSidekickAreaCorePanelCommandArguments, + OpenSidekickAreaPanelCommandArguments, + UiCommandsSidekickAreaPanelObject, +} from './types'; + +export const sidekickAreaPanel: UiCommandsSidekickAreaPanelObject = { + /** + * Opens a generic content sidekick area panel. + * + * @param id Id of the generic content sidekick area, as returned by + * `pluginApi.setGenericContentItems`. When omitted, no panel is selected. + */ + open: (id?: string) => { + window.dispatchEvent(new CustomEvent( + SidekickAreaPanelEnum.OPEN, + { + detail: { + id, + }, + }, + )); + }, + + /** + * Opens one of the core panels, such as Polls. + * + * @param panel Core panel to be opened. Polls, Timer and Breakout are ignored + * unless the user could already open them from the sidebar navigation. + */ + openCorePanel: (panel: SidekickAreaCorePanelEnum) => { + window.dispatchEvent(new CustomEvent( + SidekickAreaPanelEnum.OPEN_CORE_PANEL, + { + detail: { + panel, + }, + }, + )); + }, + + /** + * Closes the panel currently displayed in the sidekick area. + */ + close: () => { + window.dispatchEvent(new Event(SidekickAreaPanelEnum.CLOSE)); + }, +}; diff --git a/src/ui-commands/sidekick-area/panel/enums.ts b/src/ui-commands/sidekick-area/panel/enums.ts new file mode 100644 index 00000000..101415b9 --- /dev/null +++ b/src/ui-commands/sidekick-area/panel/enums.ts @@ -0,0 +1,19 @@ +export enum SidekickAreaPanelEnum { + OPEN = 'OPEN_SIDEKICK_AREA_PANEL_COMMAND', + OPEN_CORE_PANEL = 'OPEN_SIDEKICK_AREA_CORE_PANEL_COMMAND', + CLOSE = 'CLOSE_SIDEKICK_AREA_PANEL_COMMAND', +} + +/** + * Core panels a plugin is allowed to open. Polls, Timer and Breakout are only + * opened when the user could already open them from the sidebar navigation. + */ +export enum SidekickAreaCorePanelEnum { + CHAT = 'chat', + USER_LIST = 'userlist', + SHARED_NOTES = 'shared-notes', + APPS_GALLERY = 'apps-gallery', + POLL = 'poll', + TIMER = 'timer', + BREAKOUT = 'breakoutroom', +} diff --git a/src/ui-commands/sidekick-area/panel/types.ts b/src/ui-commands/sidekick-area/panel/types.ts new file mode 100644 index 00000000..20e374e5 --- /dev/null +++ b/src/ui-commands/sidekick-area/panel/types.ts @@ -0,0 +1,15 @@ +import { SidekickAreaCorePanelEnum } from './enums'; + +export interface UiCommandsSidekickAreaPanelObject { + open: (id?: string) => void; + openCorePanel: (panel: SidekickAreaCorePanelEnum) => void; + close: () => void; +} + +export interface OpenSidekickAreaPanelCommandArguments { + id?: string; +} + +export interface OpenSidekickAreaCorePanelCommandArguments { + panel: SidekickAreaCorePanelEnum; +} diff --git a/src/ui-commands/sidekick-area/types.ts b/src/ui-commands/sidekick-area/types.ts index d8748487..186de5e4 100644 --- a/src/ui-commands/sidekick-area/types.ts +++ b/src/ui-commands/sidekick-area/types.ts @@ -1,5 +1,7 @@ import { UiCommandsSidekickAreaOptionsObject } from './options/types'; +import { UiCommandsSidekickAreaPanelObject } from './panel/types'; export interface UiCommandsSidekickArea { options: UiCommandsSidekickAreaOptionsObject; + panel: UiCommandsSidekickAreaPanelObject; } diff --git a/src/ui-commands/sidekick-options-container/commands.ts b/src/ui-commands/sidekick-options-container/commands.ts index 12cf76ab..dca913e5 100644 --- a/src/ui-commands/sidekick-options-container/commands.ts +++ b/src/ui-commands/sidekick-options-container/commands.ts @@ -1,22 +1,21 @@ -import { sidekickAreaOptionsPanel } from '../sidekick-area/options/panel/commands'; -import { UiCommandsSidekickOptionsContainerObject } from './types'; +import { SidekickOptionsContainerEnum } from './enums'; -export const sidekickOptionsContainer: UiCommandsSidekickOptionsContainerObject = { +export const sidekickOptionsContainer = { /** * Opens the sidekick container automatically. * - * @deprecated Use `sidekickArea.options.panel.open` instead. + * @deprecated Use the new {@link sidekickArea} object instead. */ open: () => { - sidekickAreaOptionsPanel.open(); + window.dispatchEvent(new Event(SidekickOptionsContainerEnum.OPEN)); }, /** - * Closes the sidekick container (and sidebar content panel) automatically. + * Closes the sidekick container (and sidebard content panel) automatically. * - * @deprecated Use `sidekickArea.options.panel.close` instead. + * @deprecated Use the new {@link sidekickArea} object instead. */ close: () => { - sidekickAreaOptionsPanel.close(); + window.dispatchEvent(new Event(SidekickOptionsContainerEnum.CLOSE)); }, };