Add Phase 5 types (CoverageResponse, FlowQualityResponse, EnhancedPsaMetrics) and API methods. Refactor FlowPilotAnalyticsPage with tab bar (Overview, Coverage, Flow Quality, PSA) with lazy data loading. Create CoverageHeatmap component with color-coded resolution/escalation/guided rate cells. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import apiClient from './client'
|
|
import type { FlowPilotDashboard, KnowledgeGapReport, CoverageResponse, FlowQualityResponse, EnhancedPsaMetrics } from '@/types/flowpilot-analytics'
|
|
|
|
export const flowpilotAnalyticsApi = {
|
|
async getDashboard(period: string = '30d'): Promise<FlowPilotDashboard> {
|
|
const response = await apiClient.get<FlowPilotDashboard>('/analytics/flowpilot', {
|
|
params: { period },
|
|
})
|
|
return response.data
|
|
},
|
|
|
|
async getKnowledgeGaps(period: string = '30d'): Promise<KnowledgeGapReport> {
|
|
const response = await apiClient.get<KnowledgeGapReport>('/analytics/flowpilot/knowledge-gaps', {
|
|
params: { period },
|
|
})
|
|
return response.data
|
|
},
|
|
|
|
async getCoverage(period: string = '30d'): Promise<CoverageResponse> {
|
|
const response = await apiClient.get<CoverageResponse>('/analytics/flowpilot/coverage', {
|
|
params: { period },
|
|
})
|
|
return response.data
|
|
},
|
|
|
|
async getFlowQuality(period: string = '30d', sort: string = 'quality'): Promise<FlowQualityResponse> {
|
|
const response = await apiClient.get<FlowQualityResponse>('/analytics/flowpilot/flow-quality', {
|
|
params: { period, sort },
|
|
})
|
|
return response.data
|
|
},
|
|
|
|
async getPsaMetrics(period: string = '30d'): Promise<EnhancedPsaMetrics> {
|
|
const response = await apiClient.get<EnhancedPsaMetrics>('/analytics/flowpilot/psa-metrics', {
|
|
params: { period },
|
|
})
|
|
return response.data
|
|
},
|
|
}
|
|
|
|
export default flowpilotAnalyticsApi
|