52 行
2.0 KiB
TypeScript
52 行
2.0 KiB
TypeScript
import { apiRequestData } from "./http";
|
|
|
|
export type PortalHomePayload = {
|
|
workspace: {
|
|
id: string | null;
|
|
persisted: boolean;
|
|
profile: "small_team_internal";
|
|
};
|
|
greeting: { name: string };
|
|
cards: Array<{ key: string; title: string; value: string | number; href: string; severity?: "normal" | "warning" | "high" }>;
|
|
pendingTasks: { count: number; href: string };
|
|
myApplications: Array<{ domain: string; count: number; href: string }>;
|
|
riskSummary: { openCount: number; href: string } | null;
|
|
announcements: Array<{ id: string; title: string; summary: string; href: string | null }>;
|
|
quickLinks: Array<{ key: string; title: string; href: string }>;
|
|
todayPresence: { date: string; status: string | null; label: string; note: string | null; href: string } | null;
|
|
teamPresence:
|
|
| ({ date: string; href: string } & {
|
|
office: number;
|
|
remote: number;
|
|
out: number;
|
|
travel: number;
|
|
leave: number;
|
|
unspecified: number;
|
|
total: number;
|
|
})
|
|
| null;
|
|
weeklyReport: { weekStart: string; status: "draft" | "submitted"; needsHelp: boolean; href: string } | null;
|
|
weeklySummary: { weekStart: string; submittedCount: number; missingCount: number; needsHelpCount: number; href: string } | null;
|
|
todoSummary: { openCount: number; highPriorityCount: number; href: string } | null;
|
|
peopleLifecycle: { onboardingCount: number; offboardingCount: number; assetReturnPendingCount: number; href: string } | null;
|
|
adoptionSummary:
|
|
| {
|
|
activeEmployeeCount: number;
|
|
login7dCount: number;
|
|
weeklySubmittedCount: number;
|
|
weeklyMissingCount: number;
|
|
presenceUpdatedCount: number;
|
|
presenceMissingCount: number;
|
|
announcementCount: number;
|
|
login7dRate: number;
|
|
weeklySubmissionRate: number;
|
|
presenceCoverageRate: number;
|
|
hints: string[];
|
|
}
|
|
| null;
|
|
};
|
|
|
|
export async function fetchPortalHome() {
|
|
return apiRequestData<PortalHomePayload>("/api/portal/home");
|
|
}
|