feat(admin): implement analytics and monitoring center
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> - Business Dashboard: revenue/orders/customers/AOV/top products/low stock/recent activity/warnings/completion% (Overview tab) - Marketplace Health: real completion checks (images, SEO, categories, reviews, orders, translations, homepage, backend, performance) with clickable recommendations - Product Analytics: top selling/most reviewed/worst rated/hidden/archived counts; top-viewed honestly marked Unknown (no view tracking exists) - Customer Analytics: new/returning customers, average spend, retention - derived from real order data - Search & Traffic tabs: honest 'Unknown - available after backend integration' placeholders, no fabricated numbers - Recommendations engine: actionable cards (missing images/SEO/category, empty categories, incomplete homepage, unpublished static pages) linking to the relevant admin page - System Monitoring: added real draft/publish/sync/backend-connectivity state from AdminDashboardFacade - CSV export extended to top products and health checks; added print action - New adminAnalytics.* and adminMarketplaceHealth.* i18n namespaces (en/ru/hy), no raw i18n keys - Reused existing shared UI (app-table/app-badge/app-skeleton/app-empty-state) and content-health-widget completion-meter pattern - no new backend APIs, no storage changes
This commit is contained in:
@@ -7,6 +7,9 @@ export interface AdminAnalyticsSummary {
|
||||
avgOrderValue: number;
|
||||
productsCount: number;
|
||||
categoriesCount: number;
|
||||
customersCount: number;
|
||||
/** null = unknown - no visitor/traffic tracking exists yet. Never fabricated. */
|
||||
conversionRate: number | null;
|
||||
}
|
||||
|
||||
export interface AdminAnalyticsSeriesPoint {
|
||||
@@ -20,3 +23,59 @@ export interface AdminAnalyticsTopProduct {
|
||||
quantity: number;
|
||||
revenue: number;
|
||||
}
|
||||
|
||||
export interface AdminLowStockProduct {
|
||||
productId: string;
|
||||
name: string;
|
||||
quantity: number;
|
||||
stockStatus: 'low_stock' | 'out_of_stock';
|
||||
}
|
||||
|
||||
export interface AdminRecentActivityEntry {
|
||||
id: string;
|
||||
labelKey: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export type AdminMarketplaceHealthStatus = 'healthy' | 'attention' | 'unhealthy' | 'unknown';
|
||||
|
||||
export interface AdminMarketplaceHealthCheck {
|
||||
code: string;
|
||||
labelKey: string;
|
||||
status: AdminMarketplaceHealthStatus;
|
||||
displayValue?: string | null;
|
||||
actionRoute?: string[];
|
||||
}
|
||||
|
||||
export interface AdminProductAnalyticsRow {
|
||||
productId: string;
|
||||
name: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface AdminProductAnalytics {
|
||||
topSelling: AdminAnalyticsTopProduct[];
|
||||
mostReviewed: AdminProductAnalyticsRow[];
|
||||
worstRated: AdminProductAnalyticsRow[];
|
||||
hiddenCount: number;
|
||||
archivedCount: number;
|
||||
}
|
||||
|
||||
export interface AdminCustomerAnalytics {
|
||||
newCustomers: number;
|
||||
returningCustomers: number;
|
||||
averageSpend: number;
|
||||
currency: string;
|
||||
/** null = unknown when there are no customers in range to compute a rate from. */
|
||||
retentionPercent: number | null;
|
||||
}
|
||||
|
||||
export type AdminRecommendationSeverity = 'info' | 'warning' | 'critical';
|
||||
|
||||
export interface AdminRecommendationCard {
|
||||
id: string;
|
||||
labelKey: string;
|
||||
descriptionKey?: string;
|
||||
severity: AdminRecommendationSeverity;
|
||||
route: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user