UNPKG

@twilio/flex-ui

Version:

Twilio Flex UI

158 lines (157 loc) 4.24 kB
import { ActionPayload } from "./flex-ui-core/src"; import { UserInfo } from "./core/Manager"; export declare enum SystemState { degraded = "degraded", active = "active", down = "down", loading = "loading" } export interface StatusSummary { page: Page; components: Component[]; incidents: Incident[]; scheduled_maintenances: ScheduledMaintenance[]; status: Status; } export interface Page { id: string; name: string; url: string; time_zone: string; updated_at: Date; } export declare enum ComponenetIncidentStatus { investigating = "investigating", identified = "identified", monitoring = "monitoring", resolved = "resolved", scheduled = "scheduled", inProgress = "in_progress", verifying = "verifying", completed = "completed" } export interface Component { id: string; name: string; status: ComponentStatus; created_at: Date; updated_at: Date; position: number; description?: string; showcase: boolean; start_date?: string; group_id: string; page_id: string; group: boolean; only_show_if_degraded: boolean; components?: string[]; } export interface AffectedComponent { code: string; name: string; old_status: string; new_status: string; } export interface IncidentUpdate { id: string; status: string; body: string; incident_id: string; created_at: Date; updated_at: Date; display_at: Date; affected_components: AffectedComponent[]; deliver_notifications: boolean; custom_tweet?: any; tweet_id?: any; } export interface Incident { id: string; name: string; status: string; created_at: Date; updated_at: Date; monitoring_at?: Date; resolved_at?: any; impact: string; shortlink: string; started_at: Date; page_id: string; incident_updates: IncidentUpdate[]; components: Component[]; } export interface ScheduledMaintenance { id: string; name: string; status: string; created_at: Date; updated_at: Date; monitoring_at?: any; resolved_at?: any; impact: string; shortlink: string; started_at: Date; page_id: string; incident_updates: IncidentUpdate[]; components: Component[]; scheduled_for?: Date; scheduled_until?: Date; } export interface Status { indicator: string; description: string; } export interface UnresolvedIncident { page: Page; incidents: Incident[]; } export declare enum ComponentStatus { Operational = "operational", DegradedPerformance = "degraded_performance", PartialOutage = "partial_outage", MajorOutage = "major_outage", UnderMaintenance = "under_maintenance" } /** * @private */ export declare function tryInvokeAction(name: string, payload?: ActionPayload): Promise<void>; /** * @private */ export declare function isAdmin(user: UserInfo): boolean; /** * @private */ export declare function isSupervisor(user: UserInfo): boolean; /** * @private */ export declare function getUserRole(user: UserInfo): "agent" | "supervisor" | "admin"; /** * Fetches Flex status string from the twilio status api * @private * @returns status string, which could be: operational, degraded_performance, partial_outage, or major_outage. */ export declare function getFlexStatus(): Promise<string | undefined>; /** * Fetches Twilio status from the twilio status api * @private * @returns Status Summary. */ export declare function getTwilioStatus(): Promise<StatusSummary>; /** * @private */ export declare function templateStr(template: string, params: any): string; /** * @private */ export declare function fetchTaskRouterResource<R>(url: string): Promise<R[]>; export declare function isAgentDesktopView(user: UserInfo): boolean; export declare function isTeamsView(user: Pick<UserInfo, "permissions">): boolean; export declare function isQueueStatsView(user: Pick<UserInfo, "permissions">): boolean; export declare function isSelfEditStatus(user: UserInfo): boolean; export declare function isReadAdmin(user: UserInfo): boolean; export declare function isWriteAdmin(user: UserInfo): boolean; export declare function isReadOnlyAdmin(user: UserInfo): boolean;