metricsa dn backedn fixes
This commit is contained in:
@@ -1042,3 +1042,90 @@ export async function getPublicPlans(): Promise<Plan[]> {
|
||||
export async function getUsageSummary(): Promise<UsageSummary> {
|
||||
return fetchAPI('/v1/billing/usage-summary/');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// DASHBOARD STATS (Real data for home page)
|
||||
// ============================================================================
|
||||
|
||||
export interface DashboardAIOperation {
|
||||
type: string;
|
||||
count: number;
|
||||
credits: number;
|
||||
}
|
||||
|
||||
export interface DashboardAIOperations {
|
||||
period: string;
|
||||
operations: DashboardAIOperation[];
|
||||
totals: {
|
||||
count: number;
|
||||
credits: number;
|
||||
successRate: number;
|
||||
avgCreditsPerOp: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DashboardActivityItem {
|
||||
id: string;
|
||||
type: string;
|
||||
title: string;
|
||||
description: string;
|
||||
timestamp: string;
|
||||
href: string;
|
||||
}
|
||||
|
||||
export interface DashboardContentVelocity {
|
||||
thisWeek: {
|
||||
articles: number;
|
||||
words: number;
|
||||
images: number;
|
||||
};
|
||||
thisMonth: {
|
||||
articles: number;
|
||||
words: number;
|
||||
images: number;
|
||||
};
|
||||
total: {
|
||||
articles: number;
|
||||
words: number;
|
||||
images: number;
|
||||
};
|
||||
trend: number;
|
||||
}
|
||||
|
||||
export interface DashboardPipeline {
|
||||
sites: number;
|
||||
keywords: number;
|
||||
clusters: number;
|
||||
ideas: number;
|
||||
tasks: number;
|
||||
drafts: number;
|
||||
published: number;
|
||||
}
|
||||
|
||||
export interface DashboardStats {
|
||||
ai_operations: DashboardAIOperations;
|
||||
recent_activity: DashboardActivityItem[];
|
||||
content_velocity: DashboardContentVelocity;
|
||||
pipeline: DashboardPipeline;
|
||||
counts: {
|
||||
content: {
|
||||
total: number;
|
||||
draft: number;
|
||||
review: number;
|
||||
published: number;
|
||||
};
|
||||
images: {
|
||||
total: number;
|
||||
generated: number;
|
||||
pending: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export async function getDashboardStats(params?: { site_id?: number; days?: number }): Promise<DashboardStats> {
|
||||
const searchParams = new URLSearchParams();
|
||||
if (params?.site_id) searchParams.append('site_id', params.site_id.toString());
|
||||
if (params?.days) searchParams.append('days', params.days.toString());
|
||||
const query = searchParams.toString();
|
||||
return fetchAPI(`/v1/account/dashboard/stats/${query ? `?${query}` : ''}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user