va-tracker/types.d.ts

151 lines
3.2 KiB
TypeScript

type Statistics = {
cpuUsage: number;
ramUsage: number;
storageUsage: number;
};
type StaticData = {
totalStorage: number;
cpuModel: string;
totalMemoryGB: number;
};
type View = 'CPU' | 'RAM' | 'STORAGE';
type FrameWindowAction = 'CLOSE' | 'MAXIMIZE' | 'MINIMIZE';
type EventPayloadMapping = {
statistics: Statistics;
getStaticData: StaticData;
changeView: View;
sendFrameAction: FrameWindowAction;
};
type UnsubscribeFunction = () => void;
interface ProjectListResponse {
success: boolean;
vaId?: string;
vaName?: string;
totalProjects?: number;
activeProjects?: number;
awayProjects?: number;
totalWorkTime?: string;
totalWorkMs?: number;
data?: any[]; // you can replace `any[]` with a typed array later
}
interface TabActivity {
title: string;
appName: string;
from: string;
to: string;
durationMs: number;
durationFormatted: string;
}
// Each session includes tabs and time span
interface ProjectSession {
from: string;
to: string;
totalSessionTime: string;
tabs: TabActivity[];
}
// Complete response for project logs
interface ProjectLogResponse {
vaId: string;
vaName: string;
vaEmail: string;
totalWorkTime: string;
totalWorkMs: number;
sessions: ProjectSession[];
}
interface ProfileData {
firstName: string;
lastName: string;
email: string;
dob: string;
age: string;
address: string;
bankName: string;
accountHolderName: string;
accountNumber: string;
routingNumber: string;
phone:string;
skype:string;
city:string;
state:string;
country:string;
paymentMethod:string;
payoneerAccount:string;
veemAccount:string;
_id: string;
}
interface Window {
electron: {
login: (credentials: { email: string; password: string }) => Promise<any>;
logout: () => Promise<any>;
forgotPassword: (email: string) => Promise<{
success: boolean;
message: string;
}>;
getToken: (tokenKey: "ACCESS_TOKEN" | "REFRESH_TOKEN") => Promise<string | null>;
uploadScreenshot: () => {};
getActiveAppDetails: () => {};
toggleCloseBtn: (shouldEnable: boolean) => {},
resizeWindow: (width: number, height: number) => {},
onWindowUpdate: (callback: (data: any) => void) => void;
getProjectList: () => Promise<ProjectListResponse>;
startProjectTracking: (data: {
vaId: string;
projectId: string;
type: string;
}) => Promise<any>;
stopProjectTracking: (data: {
vaId: string;
projectId: string;
type: string;
}) => Promise<any>;
trackingTabsOpeningClosing: (data: {
id?: string; // optional, only present if updating
logId: string;
projectId: string;
title: string;
appName: string;
}) => Promise<any>;
getProjectLogs: (
projectId: string,
fromDate?: string,
toDate?: string
) => Promise<{
success: boolean;
data: any;
message?: string;
}
>;
getProfile: () => Promise<{
success: boolean;
data?: ProfileData;
}>;
changePassword: (data: {
oldPassword: string;
password: string;
cPassword: string;
}) => Promise<{ success: boolean; message?: string; data?: any }>;
};
}