UNPKG

@twilio/flex-ui

Version:

Twilio Flex UI

381 lines (380 loc) 11.4 kB
import { Dispatch, SetStateAction } from "react"; import { Granularity, MetricType, ColumnSortDirection, MetricRatingType, ScoreStatusType, Participant, FilterType } from "./utils"; import { PopoverStateReturn } from "@twilio-paste/core/popover"; export type Tier = { tier_id: MetricRatingType; record_count: number; }; export type DataGridTableProps = { TableHeaderData: TableColumnHeaderType[]; TableBodyData: DataGridCellValue[][]; TableTitle: string; SortRequest: Function; sortedColumns: ColumnSortDirection[]; setSortedColumns: Dispatch<SetStateAction<ColumnSortDirection[]>>; }; export type ElementObjType = { [key: string]: React.ReactElement; }; export type DataGridCellValue = string | number | ElementObjType | { deletedRowText: string; }; export type SummaryRow = { row_id: string; insightDetail: string; baseline: number; value: number; updated: string; }; export type SummaryData = { report_id: string; granularity: string; rows: SummaryRow[]; }; export type FetchError = { code?: number; }; export type PageInfo = { pageSize: number; nextPageToken: string | null; }; export type FetchMetricsResponse = { rows: MetricsRow[]; meta: PageInfo; }; export type FetchConversationResponse = { messages: Message[]; sid: string; instance_sid: string; tags: Tag[]; }; export type FetchTopicsResponse = { data: { instance_sid: string; name: string; url: string; enabled: boolean; time_zone: string; first_day_of_week: number; first_day_of_quarter: { day: number; month: number; }; topics: { pre_defined: string[] | null; ai_generated: string[] | null; }; }; }; export type User = { worker_sid: string; friendly_name: string; }; export type Team = { team_sid: string; friendly_name: string; }; export type TeamMember = { worker_sid: string; friendly_name: string; }; export type Message = { date_created: string; participant_type: Participant; message: string; message_id: string; participant_sid: string; }; export type Tag = { tag: string; tag_group: string; message_ids: string[]; }; export interface PickedObjectType { [index: string]: string; } export type MetricsRow = { conversation_timestamp: string; message_count: number; row_id: string; record_count: number; scores: MetricsScore[]; modules: Module[] | null; significance: number; updated: string; }; export type MetricsScore = { score_id: string; title: string; subtitle: string; period_start: string; period_end: string; source_score?: string; score: string; trend: string; score_status: ScoreStatusType; conversation_preview: string; trend_direction: string; record_count: number; tiers: Tier[]; }; export type Module = { baseline: string; score: MetricType; score_column: string; significance: string; summary: string; title: string; type: string; value: string; }; export type Excerpt = { text: string; timestamp: string; }; export type Factor = { impact: number; factor_id: string; excerpts: Excerpt[]; }; export type DateRangeCombobox = { label: string; value: Granularity.DAYS | Granularity.WEEKS | Granularity.MONTHS | Granularity.QUARTERS; }; export type TaskRouterResource = { sid: string; friendly_name?: string; friendlyName?: string; }; export interface ListItemsObj { [key: string]: string; } export type FilterParamsObj = { [key in FilterType]: ListItemsObj; }; export type SeriesData = { y: number; custom: number; }; export type TableColumnHeaderType = { name: string; isSortable: boolean; }; export type DrilldownConfig = { resourceType: string; filterParam: string; resourceName: string; conversationRating: string; suffix: string; selectedMetric?: string; }; export type TrendOptionsType = { yAxisLegend: string; yAxisMaxValue: number | null; yAxisTickInterval: number | undefined; tickAmount: number | undefined; }; export type FilterObjectType = { INITIAL_SELECTED: ListItemsObj; LABEL: string; ITEMS: ListItemsObj; ON_CHANGE: React.Dispatch<React.SetStateAction<ListItemsObj>>; IS_DISABLED: boolean; }; export type SelectedDateStateProps = { selectedDate: string; setSelectedDate: Dispatch<SetStateAction<string>>; }; export interface DateStateProps extends SelectedDateStateProps { dateRangeOption: DateRangeCombobox; setDateRangeOption: Dispatch<SetStateAction<DateRangeCombobox>>; } export interface SelectDateProps extends SelectedDateStateProps { dateRange: DateRangeCombobox; } export type AgentMetricsDataGridProps = { isLoading: boolean; isError: boolean; agentsList: TaskRouterResource[]; fetchAgentMetrics: Function; selectedMetric: string; currentPage: number; agentMetrics: FetchMetricsResponse; hasNextPage: boolean; isSupervisorOwnsNoTeams: boolean; hasPreviousPage: boolean; fetchPreviousPage: (sortColumn: string, sortDirection: ColumnSortDirection, tierId?: string, scoreId?: MetricType) => void; fetchNextPage: (sortColumn: string, sortDirection: ColumnSortDirection, tierId?: string, scoreId?: MetricType) => void; setDrilldownConfig: Dispatch<SetStateAction<DrilldownConfig>>; }; export type ConversationsDataGridProps = { isLoading: boolean; conversationRating: string; isError: boolean; fetchConversationMetrics: Function; conversationMetrics: FetchMetricsResponse; selectedMetric: string; currentPage: number; hasNextPage: boolean; hasPreviousPage: boolean; fetchPreviousPage: (sortColumn: string, sortDirection: ColumnSortDirection, scoreId?: MetricType) => void; fetchNextPage: (sortColumn: string, sortDirection: ColumnSortDirection, scoreId?: MetricType) => void; }; export type MetricsByChannelChartProps = { isError: boolean; channelMetrics: FetchMetricsResponse; chartsDynamicHeight: number; isSupervisorOwnsNoTeams: boolean; selectedMetric: string; setDrilldownConfig: Dispatch<SetStateAction<DrilldownConfig>>; }; export type DisclosureWrapperProps = { children: React.ReactElement; disclosureTitle: string; disclosureState: boolean; setDisclosureState: Dispatch<SetStateAction<boolean>>; }; export type DrillDownPanelProps = { isLoading: boolean; isError: boolean; selectedMetric: string; fetchConversationMetrics: Function; conversationMetrics: FetchMetricsResponse; conversationPanel: PopoverStateReturn; drilldownConfig: DrilldownConfig; currentPage: number; hasNextPage: boolean; hasPreviousPage: boolean; fetchPreviousPage: (sortColumn: string, sortDirection: ColumnSortDirection, scoreId?: MetricType) => void; fetchNextPage: (sortColumn: string, sortDirection: ColumnSortDirection, scoreId?: MetricType) => void; }; export interface FilterGroupProps extends SelectedDateStateProps { dateRangeOption: DateRangeCombobox; handleApplyFilter: (currentFilters: FilterParamsObj) => void; isGivenFilterDisabled: (filterType: string) => boolean; filterObject: { [key: string]: FilterObjectType; }; setDateRangeOption: Dispatch<SetStateAction<DateRangeCombobox>>; } export type InsightsCardProps = { row_id: string; updated: string; outlierModule: Module; queuesList: TaskRouterResource[]; agentsList: TaskRouterResource[]; }; export type InsightsWrapperProps = { insightRowData: MetricsRow; queuesList: TaskRouterResource[]; agentsList: TaskRouterResource[]; }; export type TrendChartProps = { isError: boolean; trendMetrics: FetchMetricsResponse; chartsDynamicHeight: number; isSupervisorOwnsNoTeams: boolean; selectedMetric: string; granularity: Granularity; metricScores: MetricsScore[]; }; export type ChartObjectType = { selectedMetric: string; initialStateCheck: boolean; tooltipHeader: string; granularity: Granularity; }; export type TooltipProps = { hoveredPointData: MetricsScore; tooltipHeader: string; granularity: Granularity; }; export type MetricsCardProps = { metric: MetricsScore; isError: boolean; selectedMetric: string; conversationPanel: PopoverStateReturn; setSelectedMetric: Dispatch<SetStateAction<string>>; fetchTrendMetrics: Function; }; export type MetricsWrapperProps = { metricScores: MetricsScore[]; isError: boolean; selectedMetric: string; conversationPanel: PopoverStateReturn; setSelectedMetric: Dispatch<SetStateAction<string>>; fetchTrendMetrics: Function; }; export type PaginationProps = { label: string; hasPreviousPage: boolean; hasNextPage: boolean; currentPage: number; onFetchNextPage: () => void; onFetchPreviousPage: () => void; }; export type AgentSummaryChartProps = { isError: boolean; isSupervisorOwnsNoTeams: boolean; agentMetrics: FetchMetricsResponse; chartsDynamicHeight: number; selectedMetric: string; }; export type QueueMetricsDataGridProps = { isLoading: boolean; isError: boolean; queuesList: TaskRouterResource[]; fetchQueueMetrics: Function; queueMetrics: FetchMetricsResponse; currentPage: number; selectedMetric: string; hasNextPage: boolean; isSupervisorOwnsNoTeams: boolean; hasPreviousPage: boolean; fetchPreviousPage: (sortColumn: string, sortDirection: ColumnSortDirection, tierId?: string, scoreId?: MetricType) => void; fetchNextPage: (sortColumn: string, sortDirection: ColumnSortDirection, tierId?: string, scoreId?: MetricType) => void; setDrilldownConfig: Dispatch<SetStateAction<DrilldownConfig>>; }; export type TopicsMetricsDataGridProps = { isLoading: boolean; isError: boolean; topicsList: TaskRouterResource[]; fetchTopicsMetrics: Function; topicsMetrics: FetchMetricsResponse; selectedMetric: string; currentPage: number; hasNextPage: boolean; isSupervisorOwnsNoTeams: boolean; hasPreviousPage: boolean; fetchPreviousPage: (sortColumn: string, sortDirection: ColumnSortDirection, tierId?: string, scoreId?: MetricType) => void; fetchNextPage: (sortColumn: string, sortDirection: ColumnSortDirection, tierId?: string, scoreId?: MetricType) => void; setDrilldownConfig: Dispatch<SetStateAction<DrilldownConfig>>; }; export type TranscriptPageProps = { teamMembers: TaskRouterResource[]; workersList: TaskRouterResource[]; }; export type ConversationRefType = React.MutableRefObject<HTMLDivElement | null>; export type ConversationRefsCollection = { [key: string]: ConversationRefType; }; export type TagComponentProps = { tag: Tag; agentsList: TaskRouterResource[]; messagesList?: Message[]; handleClick: (messageId: string) => void; }; export type TagsPanelProps = { tagsList?: Tag[]; messagesList?: Message[]; agentsList: TaskRouterResource[]; handleClick: (messageId: string) => void; }; export type ConversationListProps = { conversationRefs?: ConversationRefsCollection; messagesList?: Message[]; conversationHighlighted?: { [key: string]: boolean; }; agentsList: TaskRouterResource[]; };