mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-12 02:38:15 +00:00
Indian names, ₹ currency, healthcare campaign context for Helix Engage. Includes factories.ts with nextId/randomFrom/daysAgo/createMockLead helpers, 50 leads across all statuses, 5 campaigns (3 active/1 paused/1 completed), 12 ads on active campaigns, 15 lead activities, 8 follow-ups, 5 WhatsApp templates, and 3 agents. All cross-references are internally consistent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
150 lines
4.8 KiB
TypeScript
150 lines
4.8 KiB
TypeScript
import type { Lead, Campaign, Ad, LeadSource, Priority } from '@/types/entities';
|
|
|
|
// Sequential ID generator
|
|
let _idCounter = 1000;
|
|
export function nextId(): string {
|
|
return `mock-${_idCounter++}`;
|
|
}
|
|
|
|
// Random element picker
|
|
export function randomFrom<T>(arr: T[]): T {
|
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
}
|
|
|
|
// ISO date string for N days ago
|
|
export function daysAgo(n: number): string {
|
|
const d = new Date();
|
|
d.setDate(d.getDate() - n);
|
|
return d.toISOString();
|
|
}
|
|
|
|
// INR currency helper
|
|
export function inr(amount: number): { amountMicros: number; currencyCode: string } {
|
|
return { amountMicros: amount * 1_000_000, currencyCode: 'INR' };
|
|
}
|
|
|
|
// Indian name pools
|
|
export const indianFirstNames = [
|
|
'Aarav', 'Aditya', 'Akash', 'Amit', 'Ananya', 'Anjali', 'Ankit', 'Anushka',
|
|
'Arjun', 'Aryan', 'Deepa', 'Deepika', 'Divya', 'Geeta', 'Girish', 'Harsha',
|
|
'Ishaan', 'Kavitha', 'Kiran', 'Lakshmi', 'Madhuri', 'Meena', 'Mohan', 'Nandini',
|
|
'Nikhil', 'Pooja', 'Priya', 'Rahul', 'Raj', 'Rajesh', 'Ramesh', 'Rekha',
|
|
'Rohit', 'Sarita', 'Seema', 'Shilpa', 'Shyam', 'Sneha', 'Sunita', 'Suresh',
|
|
'Usha', 'Varun', 'Vijay', 'Vikram', 'Vipin', 'Vishal', 'Yamini', 'Yogesh',
|
|
'Zara', 'Preethi',
|
|
];
|
|
|
|
export const indianLastNames = [
|
|
'Agarwal', 'Bhat', 'Chandra', 'Desai', 'Ghosh', 'Gupta', 'Iyer', 'Jain',
|
|
'Kamath', 'Kumar', 'Mehta', 'Murthy', 'Nair', 'Patel', 'Rao', 'Reddy',
|
|
'Sharma', 'Singh', 'Srinivas', 'Verma',
|
|
];
|
|
|
|
const leadSources: LeadSource[] = [
|
|
'FACEBOOK_AD', 'FACEBOOK_AD', 'FACEBOOK_AD',
|
|
'GOOGLE_AD', 'GOOGLE_AD', 'GOOGLE_AD',
|
|
'INSTAGRAM', 'INSTAGRAM',
|
|
'WHATSAPP', 'WHATSAPP',
|
|
'GOOGLE_MY_BUSINESS',
|
|
'WEBSITE',
|
|
];
|
|
|
|
const services = [
|
|
'IVF Consultation', 'Fertility Assessment', 'Egg Freezing', 'Embryo Transfer',
|
|
'Prenatal Care', 'Gynecology Checkup', 'Cervical Screening', 'Mammography',
|
|
'General Health Checkup', 'Diabetes Consultation', 'Cardiology Checkup',
|
|
'Orthopaedic Consultation', 'Senior Health Package', 'Nutrition Counselling',
|
|
];
|
|
|
|
const priorities: Priority[] = ['LOW', 'NORMAL', 'NORMAL', 'NORMAL', 'HIGH', 'URGENT'];
|
|
|
|
export function createMockLead(overrides?: Partial<Lead>): Lead {
|
|
const firstName = randomFrom(indianFirstNames);
|
|
const lastName = randomFrom(indianLastNames);
|
|
const emailLocal = `${firstName.toLowerCase()}.${lastName.charAt(0).toLowerCase()}`;
|
|
const phoneNumber = `+91${Math.floor(7000000000 + Math.random() * 2999999999)}`;
|
|
const spamScore = Math.floor(Math.random() * 100);
|
|
const source = randomFrom(leadSources);
|
|
|
|
return {
|
|
id: nextId(),
|
|
createdAt: daysAgo(Math.floor(Math.random() * 14)),
|
|
updatedAt: daysAgo(Math.floor(Math.random() * 2)),
|
|
leadSource: source,
|
|
leadStatus: 'NEW',
|
|
priority: randomFrom(priorities),
|
|
contactName: { firstName, lastName },
|
|
contactPhone: [{ number: phoneNumber, callingCode: '+91' }],
|
|
contactEmail: [{ address: `${emailLocal}@gmail.com` }],
|
|
interestedService: randomFrom(services),
|
|
assignedAgent: null,
|
|
utmSource: null,
|
|
utmMedium: null,
|
|
utmCampaign: null,
|
|
utmContent: null,
|
|
utmTerm: null,
|
|
landingPageUrl: null,
|
|
referrerUrl: null,
|
|
leadScore: Math.floor(Math.random() * 100),
|
|
spamScore,
|
|
isSpam: spamScore >= 60,
|
|
isDuplicate: false,
|
|
duplicateOfLeadId: null,
|
|
firstContactedAt: null,
|
|
lastContactedAt: null,
|
|
contactAttempts: 0,
|
|
convertedAt: null,
|
|
patientId: null,
|
|
campaignId: null,
|
|
adId: null,
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
export function createMockCampaign(overrides?: Partial<Campaign>): Campaign {
|
|
return {
|
|
id: nextId(),
|
|
createdAt: daysAgo(30),
|
|
updatedAt: daysAgo(1),
|
|
campaignName: null,
|
|
campaignType: 'FACEBOOK_AD',
|
|
campaignStatus: 'ACTIVE',
|
|
platform: 'FACEBOOK',
|
|
startDate: daysAgo(30),
|
|
endDate: null,
|
|
budget: inr(100000),
|
|
amountSpent: inr(50000),
|
|
impressionCount: 50000,
|
|
clickCount: 1200,
|
|
targetCount: 10000,
|
|
contactedCount: 80,
|
|
convertedCount: 10,
|
|
leadCount: 100,
|
|
externalCampaignId: null,
|
|
platformUrl: null,
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
export function createMockAd(campaignId: string, overrides?: Partial<Ad>): Ad {
|
|
return {
|
|
id: nextId(),
|
|
createdAt: daysAgo(28),
|
|
updatedAt: daysAgo(2),
|
|
adName: null,
|
|
externalAdId: null,
|
|
adStatus: 'ACTIVE',
|
|
adFormat: 'IMAGE',
|
|
headline: null,
|
|
adDescription: null,
|
|
destinationUrl: 'https://www.ramaiah.hospital',
|
|
previewUrl: null,
|
|
impressions: 10000,
|
|
clicks: 250,
|
|
conversions: 15,
|
|
spend: inr(15000),
|
|
campaignId,
|
|
...overrides,
|
|
};
|
|
}
|