UNPKG

@twilio/flex-ui

Version:

Twilio Flex UI

143 lines (142 loc) 5.62 kB
import { Dispatch } from "redux"; import { ITask } from "../../models"; import { Conference } from "../Conferences"; import { SupervisorWorkerState } from "../State.definition"; import { AppliedFilter, CallMonitoring, Teams } from "./SupervisorState.definitions"; import { metricDataType as AgentMetrics } from "../../components/supervisor/TeamFiltersPanel/AgentMetricsTab/AgentMetricsTab.definitions"; /** * State of the supervisor view * @interface SupervisorState * @property {CallMonitoring} callMonitoring state of call monitoring * @property {SupervisorWorkerState} [stickyWorker] currently selected worker state * @property {Array<SupervisorWorkerState>} workers currently showing worker states * @property {boolean} isLoadingWorkers if workers are being loaded * @property {LiveQueryError} errorLoadingWorkers instance of the error when loading workers * @property {Array<AppliedFilter>} appliedFilters array of applied filters * @property {string} extraFilterQuery query for custom filters * @property {string} search search string * @category State */ export interface SupervisorState { readonly callMonitoring: CallMonitoring; readonly stickyWorker?: SupervisorWorkerState; readonly workers: Array<SupervisorWorkerState>; readonly isLoadingWorkers: boolean; readonly errorLoadingWorkers: LiveQueryError; readonly appliedFilters: AppliedFilter[]; readonly extraFilterQuery: string; readonly search: string; readonly teams?: Array<Teams> | null; readonly isNewTeamsViewEnabled?: boolean; readonly terminatedTasksList: Array<string>; readonly teamsHierarchy?: { [key: string]: string; } | null; readonly selectedTeams: string[]; readonly agentMetricsColumnsPreference: AgentMetrics[]; } export declare enum LiveQueryError { None = 0, Other = 1, LongQuery = 2 } interface SyncError extends Error { code?: SyncErrorCodes | number; } declare enum SyncErrorCodes { TooManyOperators = 54509, TooManyItems = 54510 } export type SupervisorStateAction = { type: typeof UPDATE_STATE; payload: Partial<SupervisorState>; } | { type: typeof MONITORING_UPDATED; payload: { conference: Conference; }; } | { type: typeof LOAD_WORKERS_START; } | { type: typeof LOAD_WORKERS_FAILED; payload?: Error | SyncError; } | { type: typeof SET_APPLIED_FILTERS; payload: { filters: AppliedFilter[]; extraFilterQuery?: string; }; } | { type: typeof SET_SEARCH; payload: string; } | { type: typeof UPDATE_TEAMS; payload: Teams[]; } | { type: typeof UPDATE_TEAMS_HIERARCHY; payload: { [key: string]: string; }; } | { type: typeof SELECT_TEAM; payload: Teams; } | { type: typeof UPDATE_TEAMS_VIEW_CONTEXT; payload: boolean; } | { type: typeof UPDATE_TERMINATED_TASKS; payload: string; } | { type: typeof UPDATE_SELECTED_TEAMS; payload: string[]; } | { type: typeof UPDATE_AGENT_METRICS_COLUMN_PREFERENCE; payload: AgentMetrics[]; }; export declare const UPDATE_STATE = "SUPERVISOR_UPDATE"; export declare const MONITORING_UPDATED = "SUPERVISOR_INCOMING_CALL_UPDATE"; export declare const LOAD_WORKERS_START = "SUPERVISOR_LOAD_WORKERS_START"; export declare const LOAD_WORKERS_FAILED = "SUPERVISOR_LOAD_WORKERS_FAILED"; export declare const SET_APPLIED_FILTERS = "SUPERVISOR_SET_APPLIED_FILTERS"; export declare const SET_SEARCH = "SUPERVISOR_SET_SEARCH"; export declare const UPDATE_TEAMS = "UPDATE_TEAMS"; export declare const UPDATE_TEAMS_HIERARCHY = "UPDATE_TEAMS_HIERARCHY"; export declare const SELECT_TEAM = "SELECT_TEAM"; export declare const UPDATE_TEAMS_VIEW_CONTEXT = "UPDATE_TEAMS_VIEW_CONTEXT"; export declare const UPDATE_TERMINATED_TASKS = "UPDATE_TERMINATED_TASKS"; export declare const UPDATE_SELECTED_TEAMS = "UPDATE_SELECTED_TEAMS"; export declare const UPDATE_AGENT_METRICS_COLUMN_PREFERENCE = "UPDATE_AGENT_METRICS_COLUMN_PREFERENCE"; export declare function reduce(state?: SupervisorState, action?: SupervisorStateAction): SupervisorState; export declare class Actions { private static _dispatcher; private static listenedConferences?; private static callMonitoringStart?; private static stateUpdateThrottler?; private static pendingStateUpdate?; static dispatchStateUpdate(payload: Partial<SupervisorState>, immediately?: boolean): void; static flush(): void; static get dispatcher(): Dispatch<any>; static set dispatcher(dispatcher: Dispatch<any>); static monitorCall(task: ITask): Promise<void>; private static findCurrentWorkerParticipantInstances; private static getMonitoringData; private static isMonitoredWorkerStillInTheCall; private static onConferenceUpdate; private static manageConferenceListening; static updateStateWorkers(workers: Array<SupervisorWorkerState>): void; static startLoadingWorkers(): void; static failLoadingWorkers(e?: Error): void; static updateStateStickyWorker(stickyWorker?: SupervisorWorkerState): void; static setAppliedFilters(filters: AppliedFilter[], extraFilterQuery?: string): void; static setSearch(search: string): void; static updateTeams(teams: Teams[]): void; static updateTeamsHierarchy(hierarchy: { [key: string]: string; }): void; static updateSelectedTeams(teamSid: string[]): void; static updateAgentMetricsColumnPreference(colPreference: AgentMetrics[]): void; static updateTeamsContext(isEnabled: boolean): void; static updateTerminatedList(key: string): void; static shutdown(): void; } export {};