62416baabc
- Updated all relevant API functions in agent.ts, company.ts, customer-contact.ts, customer.ts, dashboard.ts, ticket-config.ts, and ticket.ts to point to the new /api/dashboard paths. - Ensured that all request methods and payload structures remain unchanged to maintain existing functionality.
82 lines
1.8 KiB
TypeScript
82 lines
1.8 KiB
TypeScript
import { request } from "@/lib/api/client"
|
|
|
|
export type DashboardRange = "today" | "7d" | "30d"
|
|
|
|
export type DashboardStatusDistributionItem = {
|
|
status: number
|
|
label: string
|
|
count: number
|
|
}
|
|
|
|
export type DashboardTrendItem = {
|
|
date: string
|
|
newCount: number
|
|
closedCount: number
|
|
}
|
|
|
|
export type DashboardTeamLoad = {
|
|
teamId: number
|
|
teamName: string
|
|
totalAgents: number
|
|
onlineAgents: number
|
|
busyAgents: number
|
|
offlineAgents: number
|
|
waitingConversations: number
|
|
processingConversations: number
|
|
maxConcurrentCapacity: number
|
|
loadRate: number
|
|
hasScheduleNow: boolean
|
|
}
|
|
|
|
export type DashboardAlert = {
|
|
id: string
|
|
level: "info" | "warning" | "error"
|
|
title: string
|
|
description: string
|
|
count: number
|
|
link: string
|
|
}
|
|
|
|
export type DashboardQuickLink = {
|
|
title: string
|
|
description: string
|
|
link: string
|
|
}
|
|
|
|
export type DashboardOverview = {
|
|
range: DashboardRange
|
|
generatedAt: string
|
|
summary: {
|
|
todayNewConversations: number
|
|
processingConversations: number
|
|
pendingDispatchConversations: number
|
|
onlineAgents: number
|
|
aiServiceRate: number
|
|
}
|
|
conversationStats: {
|
|
statusDistribution: DashboardStatusDistributionItem[]
|
|
trend: DashboardTrendItem[]
|
|
}
|
|
agentStats: {
|
|
onlineAgents: number
|
|
busyAgents: number
|
|
offlineAgents: number
|
|
teamLoads: DashboardTeamLoad[]
|
|
}
|
|
aiStats: {
|
|
enabledAiAgents: number
|
|
enabledChannels: number
|
|
todayKnowledgeRetrieves: number
|
|
todayKnowledgeRetrieveFailCount: number
|
|
todayKnowledgeRetrieveFailRate: number
|
|
todaySkillRunFailCount: number
|
|
todayAiHandoffCount: number
|
|
}
|
|
alerts: DashboardAlert[]
|
|
quickLinks: DashboardQuickLink[]
|
|
}
|
|
|
|
export function fetchDashboardOverview(range: DashboardRange) {
|
|
return request<DashboardOverview>(`/api/dashboard/dashboard/overview?range=${range}`)
|
|
}
|