UNPKG

@twilio/flex-ui

Version:

Twilio Flex UI

70 lines (69 loc) 3.34 kB
import { Location } from "history"; import { Action, Dispatch } from "redux"; /** * State of the view * @interface ViewState * @property {boolean} isSideNavOpen - whether the navigation sidebar is open * @property {boolean} isOutboundDialerOpen - whether the navigation sidebar is open * @property {string} [activeView] name of the currently active view * @property {string} [selectedTaskSid] - ID of the selected task in Agent Desktop view * @property {string} [selectedTaskInSupervisorSid] - ID of the selected task in Teams view * @property {string} [selectedWorkerInSupervisorSid] - ID of the selected worker in Teams view * @property {boolean} [isDirectoryOpen] - whether the call transfer panel is open in Agent Desktop view * @property {object} componentViewStates - object containing persistent components states. Use {@link Actions.SetComponentState} to update. * @category State */ export interface ViewState { readonly isSideNavOpen: boolean; readonly isOutboundDialerOpen: boolean; readonly activeView?: string; readonly selectedTaskSid?: string; readonly selectedTaskInSupervisorSid?: string; readonly selectedWorkerInSupervisorSid?: string; readonly isDirectoryOpen?: boolean; readonly isContentTemplateBrowserOpen?: boolean; readonly componentViewStates: { [k: string]: any; }; readonly selectedConversationSid?: string; } export interface ViewStateAction extends Action { readonly payload?: any; } export declare const ACTION_TOGGLE_SIDEBAR = "VIEW_TOGGLE_SIDEBAR"; export declare const ACTION_TOGGLE_OUTBOUND_DIALER = "VIEW_TOGGLE_OUTBOUND_DIALER"; export declare const ACTION_HIDE_OUTBOUND_DIALER = "VIEW_HIDE_OUTBOUND_DIALER"; export declare const ACTION_UPDATE_VIEW = "VIEW_UPDATE"; export declare const ACTION_SET_COMPONENT_STATE = "VIEW_SET_COMPONENT_STATE"; export declare const ACTION_DELETE_COMPONENT_STATE = "VIEW_DELETE_COMPONENT_STATE"; export declare function reduce(state: ViewState, action: ViewStateAction): ViewState; export type HistoryLocation = string | Location; export type PushPayload = HistoryLocation; export type ReplacePayload = HistoryLocation; export type GoPayload = number; export declare class Actions { private static _dispatcher; static get dispatcher(): Dispatch<any>; static set dispatcher(dispatcher: Dispatch<any>); static setComponentState(name: string, state: any): void; static deleteComponentState(name: string): void; static hideOutboundDialer(): void; static toggleOutboundDialer(): void; static toggleSidebar(): void; static hideSidebar(): void; static showSidebar(): void; static setActiveView(name: string): void; static showDirectory(): void; static showContentTemplateBrowser(): void; static hideContentTemplateBrowser(): void; static hideDirectory(): void; static selectTask(taskSid: string): void; static selectPausedConversation(selectedConversationSid: string): void; static selectTaskInSupervisor(taskSid?: string): void; static selectWorkerInSupervisor(workerSid?: string): void; static push(location: PushPayload): Promise<void>; static replace(location: ReplacePayload): Promise<void>; static go(steps: GoPayload): Promise<void>; static goForward(): Promise<void>; static goBack(): Promise<void>; }