field-service-agent
Version:
Field Service AI Agent - NPM package for integrating AI-powered field service management into mobile apps
129 lines • 3.25 kB
TypeScript
type FieldServiceSDK = any;
export type NavigationEventType = 'JOB_DETAILS' | 'CLIENT_DETAILS' | 'RELOAD_JOB_DETAILS' | 'PAYWALL_LIMIT_REACHED' | 'CLOSE_AGENT_MODAL' | 'RELOAD_INVOICE_DETAILS' | 'RELOAD_ESTIMATE_DETAILS' | 'RELOAD_CLIENT_DETAILS';
export interface NavigationEvent {
type: NavigationEventType;
recordId: string;
timestamp?: string;
}
export type NavigationEventListener = (event: NavigationEvent) => void;
type PropertySchema = {
type: string;
description: string;
enum?: string[];
items?: PropertySchema;
properties?: Record<string, PropertySchema>;
required?: string[];
};
export interface ChatGPTFunction {
name: string;
description: string;
parameters: {
type: string;
properties: Record<string, PropertySchema>;
required: string[];
};
}
export interface Client {
id: string;
name: string;
email: string;
phone?: string;
address1?: string;
address2?: string;
city?: string;
state?: string;
zipCode?: string;
notes?: string;
locationLatitude?: number;
locationLongitude?: number;
}
export interface Job {
id: string;
title: string;
clientId: string;
status: string;
description?: string;
scheduledDate?: string;
dueDate?: string;
}
export interface AgentResponse {
success: boolean;
message: string;
audioContent?: string;
data?: any;
transcript?: string;
status?: 'success' | 'error';
followUpQuestion?: boolean;
transcribedText?: string;
navigationActions?: any[];
}
export interface Invoice {
id: string;
jobId: string;
job: {
id: string;
title: string;
};
status: 'DRAFT' | 'SENT' | 'PAID' | 'OVERDUE' | 'CANCELLED';
items: {
id: string;
title: string;
description: string;
price: number;
taxRate?: number;
}[];
dueDate?: string;
}
export interface Estimate {
id: string;
jobId: string;
job: {
id: string;
title: string;
};
status: 'DRAFT' | 'SENT' | 'ACCEPTED' | 'REJECTED';
items: {
id: string;
title: string;
description: string;
price: number;
taxRate?: number;
}[];
dueDate?: string;
}
export interface AgentContext {
currentScreenType?: 'Job' | 'Client' | 'Invoice' | 'Estimate';
currentRecordId?: string;
timeZone: string;
}
export interface User {
id: string;
name?: string;
email?: string;
}
export interface WebNavigation {
navigateToJob: (jobId: string) => void;
navigateToClient: (clientId: string) => void;
navigateToInvoice: (invoiceId: string) => void;
navigateToEstimate: (estimateId: string) => void;
}
export interface AgentConfig {
sdk: FieldServiceSDK;
navigation: WebNavigation;
apiKey?: string;
googlePlacesApiKey?: string;
currentScreenType?: 'Job' | 'Client' | 'Invoice' | 'Estimate';
currentRecordId?: string;
currentRecordDetails?: any;
debugMode?: boolean;
user: User;
chatHistory?: Array<{
id: string;
text: string;
isUser: boolean;
}>;
language?: string;
voiceName?: string;
}
export {};
//# sourceMappingURL=types.d.ts.map