feat: add Call, LeadIngestionSource types and mock data, AI fields on leads

- Add CallDirection, CallStatus, CallDisposition, Call types to entities.ts
- Add IntegrationStatus, AuthStatus, IngestionPlatform, LeadIngestionSource types
- Add aiSummary and aiSuggestedAction fields to Lead type
- Create src/mocks/calls.ts with 15 INBOUND COMPLETED calls across 3 agents
- Create src/mocks/ingestion-sources.ts with 6 integration sources (ACTIVE/WARNING/ERROR)
- Update mockLeads with AI summaries on ~20 leads (new, contacted, spam cohorts)
- Expose calls, ingestionSources, and addCall() in DataContext

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 18:20:41 +05:30
parent 50388dcad5
commit 530dfa1aa4
7 changed files with 660 additions and 3 deletions

View File

@@ -121,6 +121,8 @@ export type Lead = {
lastContactedAt: string | null;
contactAttempts: number | null;
convertedAt: string | null;
aiSummary: string | null;
aiSuggestedAction: string | null;
patientId: string | null;
campaignId: string | null;
adId: string | null;
@@ -242,3 +244,62 @@ export type Agent = {
avgResponseHours: number | null;
activeLeadCount: number | null;
};
// Call domain
export type CallDirection = 'INBOUND' | 'OUTBOUND';
export type CallStatus = 'RINGING' | 'IN_PROGRESS' | 'COMPLETED' | 'MISSED' | 'VOICEMAIL';
export type CallDisposition =
| 'APPOINTMENT_BOOKED'
| 'FOLLOW_UP_SCHEDULED'
| 'INFO_PROVIDED'
| 'WRONG_NUMBER'
| 'NO_ANSWER'
| 'CALLBACK_REQUESTED';
export type Call = {
id: string;
createdAt: string;
callDirection: CallDirection | null;
callStatus: CallStatus | null;
callerNumber: { number: string; callingCode: string }[] | null;
agentName: string | null;
startedAt: string | null;
endedAt: string | null;
durationSeconds: number | null;
recordingUrl: string | null;
disposition: CallDisposition | null;
callNotes: string | null;
patientId: string | null;
appointmentId: string | null;
leadId: string | null;
// Denormalized for display
leadName?: string;
leadPhone?: string;
leadService?: string;
};
// Lead Ingestion Source domain
export type IntegrationStatus = 'ACTIVE' | 'WARNING' | 'ERROR' | 'DISABLED';
export type AuthStatus = 'VALID' | 'EXPIRING_SOON' | 'EXPIRED' | 'NOT_CONFIGURED';
export type IngestionPlatform =
| 'FACEBOOK'
| 'INSTAGRAM'
| 'GOOGLE_ADS'
| 'GOOGLE_MY_BUSINESS'
| 'WEBSITE'
| 'WHATSAPP';
export type LeadIngestionSource = {
id: string;
createdAt: string;
sourceName: string | null;
platform: IngestionPlatform | null;
integrationStatus: IntegrationStatus | null;
lastSuccessfulSyncAt: string | null;
lastFailureAt: string | null;
leadsReceivedLast24h: number | null;
consecutiveFailures: number | null;
authStatus: AuthStatus | null;
webhookUrl: string | null;
lastErrorMessage: string | null;
};