va-tracker/types.d.ts

280 lines
5.7 KiB
TypeScript

declare module "quill";
declare module "quill-image-resize-module";
declare module "quill-image-drop-module";
declare module "quill-image-resize-module-react" {
const ImageResize: any;
export default ImageResize;
}
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
status: number
}
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;
wiseEmail: string
_id: string;
}
type LeaveRequestResponse = {
success: boolean;
data?: any;
message?: string;
};
interface ScheduleItem {
id: string;
isActive: boolean;
status: string | null;
ScheduleDate: string;
cutOffTime: string | null;
periodEnd: string | null;
periodStart: string | null;
}
interface PayslipItem {
totalHoursFormatted: string;
payrollSchedule: string;
totalPayAmount: number;
status: string;
date: string | null;
createdDate: string;
name: string;
id: string;
}
interface PayslipResponse {
payrolls: PayslipItem[];
vaPortalId: string;
vaName: string;
id: string;
}
interface RegionResponse {
success: boolean;
status: number;
data?: any;
retry?: boolean;
message?: string;
}
interface TrackingLog {
title: string;
appName: string;
url: string;
from: string;
to: string;
totalTime: number;
}
interface TrackingPayload {
vaId: string;
projectId: string;
logId: string;
logs: TrackingLog[];
}
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) => {},
getRunningApps: () => {},
captureAppScreenShot: (appTitle: string) => Promise<string>,
onWindowUpdate: (callback: (data: any) => void) => void;
getProjectList: () => Promise<ProjectListResponse>;
startProjectTracking: (data: {
vaId: string;
projectId: string;
type: string;
time: string
}) => Promise<any>;
stopProjectTracking: (data: {
vaId: string;
logId: string,
projectId: string;
type: string;
time: string
}) => Promise<any>;
trackingTabsOpeningClosing: (data: TrackingPayload) => 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 }>;
// In your electron API handler
updatePayment: (data: {
paymentMethod: string;
wiseEmail?: string;
veemAccount?: string;
}) => Promise<{ success: boolean; message?: string; data?: any }>;
onTokenExpired: (callback: () => void) => void;
getProjectSummary: (projectId: string, date: string) => Promise<any>;
createTimesheet: (
payload: {
projectId: string;
date: string;
loginTime: string;
logoutTime: string;
comment?: string;
}
) => Promise<{
success: boolean;
data?: any;
message?: string;
}>;
createPTOAndSickLeaveRequest: (
payload: LeaveRequestPayload
) => Promise<LeaveRequestResponse>;
getSchedules: () => Promise<any>;
getPayslips: (vaId: string) => Promise<{
success: boolean;
data?: PayslipResponse[];
message?: string;
}>;
getLeaveList: () => Promise<{
success: boolean;
data?: any;
}>;
getAdjustmentsList: (vaId: string) => Promise<{
success: boolean;
data?: any;
}>;
checkRegion: () => Promise<RegionResponse>;
connectVPN: () => Promise<string>;
disconnectVPN: () => Promise<void>;
getBaseURL: () => Promise<string>;
updateBaseURL: (url: string) => Promise<{
updated: boolean;
baseURL: string;
}>;
};
}