declare namespace DashboardConfigV2 { type WidgetTypes = 'overview' | 'detailed' | 'table' | 'counter'; interface BaseWidget { id: string; type: WidgetTypes; /** * @description: 1-12 (12 is full width) */ width: number; height?: number; graphType?: 'line' | 'bar' | 'groupedLine' | 'groupedBar' | 'pie' | 'groupedPie' | 'overviewPie' | 'lineBar'; /** * @description: under which tab the widget will be shown */ group: 'Shipments' | 'SLA Breach'; title?: string; } interface Counters { key: string; label: string; redirectURI?: string; color?: string; } interface SubEntity { key: string; label: string; color: string; } interface Entity { /** * @description: key is the used for pie chart, x, y axis for bar and line graph */ key?: string; xAxis: string; yAxis: string; label?: string; color?: string; showOnlyTooltip?: boolean; tooltipLabel?: string; type?: 'line' | 'bar'; subEntities?: SubEntity[]; } interface Counter extends BaseWidget { type: 'counter'; counters: Counters[]; } interface ApiResponseBase { widgetId: string; widgetType: WidgetTypes; } interface Data { key: string; count: number; percentage: number; } interface ResponseCounter extends ApiResponseBase { widgetType: 'counter'; data: Data[]; } interface ResponseOverview extends ApiResponseBase { widgetType: 'overview'; count: number; changePercentage: number; percentage?: number; data?: Data[]; timePeriod?: string; } interface ResponseDetailed extends ApiResponseBase { widgetType: 'detailed'; count?: number; data: any; } interface Action { id: 'sort' | 'export'; label: string; visible?: boolean; active?: boolean; } interface Detailed extends BaseWidget { type: 'detailed'; action?: Action[]; entities?: Entity[]; graphOrientation?: 'vertical' | 'horizontal'; showDropdownFilter?: boolean; maxDataPoints?: number; } interface Overview extends BaseWidget { type: 'overview'; redirectURI: string; /** * @description: normal: +ve value is green, -ve is red; * inverted: +ve value is red, -ve is green * */ indicatorColor: 'normal' | 'inverted'; /** * right side of overview widget */ extraStatsType?: 'counter' | 'pieChart'; /** * bg and header color */ color?: string; bgColor?: string; counters?: Counters[]; entities?: Entity[]; } type ApiResponse = ResponseOverview | ResponseDetailed | ResponseCounter; }