diff --git a/src/ui-commands/commands.ts b/src/ui-commands/commands.ts index 0522c36b..7cc831c4 100644 --- a/src/ui-commands/commands.ts +++ b/src/ui-commands/commands.ts @@ -10,6 +10,7 @@ import { actionsBar } from './actions-bar/commands'; import { layout } from './layout/commands'; import { navBar } from './nav-bar/commands'; import { sidekickArea } from './sidekick-area/commands'; +import { dialogs } from './dialogs/commands'; import { UiCommands } from './types'; export const uiCommands: UiCommands = { @@ -25,4 +26,5 @@ export const uiCommands: UiCommands = { conference, notification, layout, + dialogs, }; diff --git a/src/ui-commands/dialogs/commands.ts b/src/ui-commands/dialogs/commands.ts new file mode 100644 index 00000000..9e9e5acd --- /dev/null +++ b/src/ui-commands/dialogs/commands.ts @@ -0,0 +1,25 @@ +import { DialogsEnum } from './enums'; +import { SetHideDialogsCommandArguments } from './types'; + +export const dialogs = { + /** + * Sets whether to hide dialogs or not (Both audio and video preview dialogs). + * + * @param setHideDialogsCommandArguments whether to hide dialogs or not. + * Refer to {@link SetHideDialogsCommandArguments} to understand the argument structure. + */ + setHideDialogs: ( + setHideDialogsCommandArguments: SetHideDialogsCommandArguments, + ) => { + const { hidden } = setHideDialogsCommandArguments; + window.dispatchEvent( + new CustomEvent< + SetHideDialogsCommandArguments + >(DialogsEnum.SET_HIDE_DIALOGS, { + detail: { + hidden, + }, + }), + ); + }, +}; diff --git a/src/ui-commands/dialogs/enums.ts b/src/ui-commands/dialogs/enums.ts new file mode 100644 index 00000000..7ff633b7 --- /dev/null +++ b/src/ui-commands/dialogs/enums.ts @@ -0,0 +1,3 @@ +export enum DialogsEnum { + SET_HIDE_DIALOGS = 'SET_HIDE_DIALOGS_COMMAND', +} diff --git a/src/ui-commands/dialogs/types.ts b/src/ui-commands/dialogs/types.ts new file mode 100644 index 00000000..b0e18073 --- /dev/null +++ b/src/ui-commands/dialogs/types.ts @@ -0,0 +1,9 @@ +export interface SetHideDialogsCommandArguments { + hidden: boolean; +} + +export interface UiCommandsDialogsObject { + setHideDialogs: ( + setHideDialogsCommandArguments: SetHideDialogsCommandArguments + ) => void; +} diff --git a/src/ui-commands/types.ts b/src/ui-commands/types.ts index 0dc2aee9..e608dc90 100644 --- a/src/ui-commands/types.ts +++ b/src/ui-commands/types.ts @@ -10,6 +10,7 @@ import { UiCommandsLayoutObject } from './layout/types'; import { UiCommandsNavBarObject } from './nav-bar/types'; import { UiCommandsCameraObject } from './camera/types'; import { UiCommandsSidekickArea } from './sidekick-area/types'; +import { UiCommandsDialogsObject } from './dialogs/types'; export interface UiCommands { layout: UiCommandsLayoutObject; @@ -24,4 +25,5 @@ export interface UiCommands { userStatus: UiCommandsUserStatusObject; conference: UiCommandsConferenceObject; notification: UiCommandsNotificationObject; + dialogs: UiCommandsDialogsObject; }