66 lines
1.3 KiB
TypeScript
66 lines
1.3 KiB
TypeScript
|
|
/**
|
||
|
|
* Dashboard Domain - Contract
|
||
|
|
*
|
||
|
|
* Shared types for dashboard summaries, activity feeds, and related data.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import type { IsoDateTimeString } from "../common/types";
|
||
|
|
import type { Invoice } from "../billing/contract";
|
||
|
|
|
||
|
|
export type ActivityType =
|
||
|
|
| "invoice_created"
|
||
|
|
| "invoice_paid"
|
||
|
|
| "service_activated"
|
||
|
|
| "case_created"
|
||
|
|
| "case_closed";
|
||
|
|
|
||
|
|
export interface Activity {
|
||
|
|
id: string;
|
||
|
|
type: ActivityType;
|
||
|
|
title: string;
|
||
|
|
description?: string;
|
||
|
|
date: IsoDateTimeString;
|
||
|
|
relatedId?: number;
|
||
|
|
metadata?: Record<string, unknown>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface DashboardStats {
|
||
|
|
activeSubscriptions: number;
|
||
|
|
unpaidInvoices: number;
|
||
|
|
openCases: number;
|
||
|
|
recentOrders?: number;
|
||
|
|
totalSpent?: number;
|
||
|
|
currency: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface NextInvoice {
|
||
|
|
id: number;
|
||
|
|
dueDate: IsoDateTimeString;
|
||
|
|
amount: number;
|
||
|
|
currency: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface DashboardSummary {
|
||
|
|
stats: DashboardStats;
|
||
|
|
nextInvoice: NextInvoice | null;
|
||
|
|
recentActivity: Activity[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface DashboardError {
|
||
|
|
code: string;
|
||
|
|
message: string;
|
||
|
|
details?: Record<string, unknown>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export type ActivityFilter = "all" | "billing" | "orders" | "support";
|
||
|
|
|
||
|
|
export interface ActivityFilterConfig {
|
||
|
|
key: ActivityFilter;
|
||
|
|
label: string;
|
||
|
|
types?: ActivityType[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface DashboardSummaryResponse extends DashboardSummary {
|
||
|
|
invoices?: Invoice[];
|
||
|
|
}
|