mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 18:28:15 +00:00
Defect 1: Setup wizard (/setup) now guarded by AdminSetupGuard — CC agents and other non-admin roles are redirected to / instead of seeing the setup wizard they can't complete. Defect 3: Removed all references to Doctor.clinic (relation was replaced by DoctorVisitSlot entity). Updated queries.ts, appointments.tsx, transforms.ts, doctors.tsx, appointment-form.tsx. Defect 6 (frontend side): Dial request now sends agentId and campaignName from localStorage agent config so the sidecar dials with the correct per-agent credentials, not global defaults. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
83 lines
3.2 KiB
TypeScript
83 lines
3.2 KiB
TypeScript
// GraphQL queries for platform entities
|
|
// Platform remaps SDK field names — all LINKS/PHONES fields need subfield selection
|
|
|
|
export const LEADS_QUERY = `{ leads(first: 100, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt updatedAt
|
|
contactName { firstName lastName }
|
|
contactPhone { primaryPhoneNumber primaryPhoneCallingCode }
|
|
contactEmail { primaryEmail }
|
|
source status priority interestedService assignedAgent
|
|
utmSource utmMedium utmCampaign utmContent utmTerm landingPage { primaryLinkUrl } referrerUrl
|
|
leadScore spamScore isSpam isDuplicate
|
|
firstContacted lastContacted contactAttempts convertedAt
|
|
patientId campaignId
|
|
aiSummary aiSuggestedAction
|
|
} } } }`;
|
|
|
|
export const CAMPAIGNS_QUERY = `{ campaigns(first: 50, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt updatedAt
|
|
campaignName typeCustom status platform
|
|
startDate endDate
|
|
budget { amountMicros currencyCode }
|
|
amountSpent { amountMicros currencyCode }
|
|
impressions clicks targetCount contacted converted leadsGenerated
|
|
externalCampaignId platformUrl { primaryLinkUrl }
|
|
} } } }`;
|
|
|
|
export const ADS_QUERY = `{ ads(first: 100, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt updatedAt
|
|
adName externalAdId status format
|
|
headline adDescription destinationUrl { primaryLinkUrl } previewUrl { primaryLinkUrl }
|
|
impressions clicks conversions
|
|
spend { amountMicros currencyCode }
|
|
campaignId
|
|
} } } }`;
|
|
|
|
export const FOLLOW_UPS_QUERY = `{ followUps(first: 50, orderBy: [{ scheduledAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
typeCustom status scheduledAt completedAt
|
|
priority assignedAgent
|
|
patientId
|
|
} } } }`;
|
|
|
|
export const LEAD_ACTIVITIES_QUERY = `{ leadActivities(first: 200, orderBy: [{ occurredAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
activityType summary occurredAt performedBy
|
|
previousValue newValue
|
|
channel durationSec outcome
|
|
leadId
|
|
} } } }`;
|
|
|
|
export const CALLS_QUERY = `{ calls(first: 100, orderBy: [{ startedAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
direction callStatus callerNumber { primaryPhoneNumber } agentName
|
|
startedAt endedAt durationSec
|
|
recording { primaryLinkUrl } disposition sla
|
|
patientId appointmentId leadId
|
|
} } } }`;
|
|
|
|
export const DOCTORS_QUERY = `{ doctors(first: 20) { edges { node {
|
|
id name fullName { firstName lastName }
|
|
department specialty qualifications yearsOfExperience
|
|
visitingHours
|
|
consultationFeeNew { amountMicros currencyCode }
|
|
consultationFeeFollowUp { amountMicros currencyCode }
|
|
active registrationNumber
|
|
clinic { id name clinicName }
|
|
} } } }`;
|
|
|
|
export const APPOINTMENTS_QUERY = `{ appointments(first: 100, orderBy: [{ scheduledAt: DescNullsLast }]) { edges { node {
|
|
id name createdAt
|
|
scheduledAt durationMin appointmentType status
|
|
doctorName department reasonForVisit
|
|
patient { id fullName { firstName lastName } phones { primaryPhoneNumber } }
|
|
doctor { id }
|
|
} } } }`;
|
|
|
|
export const PATIENTS_QUERY = `{ patients(first: 50) { edges { node {
|
|
id name fullName { firstName lastName }
|
|
phones { primaryPhoneNumber }
|
|
emails { primaryEmail }
|
|
dateOfBirth gender patientType
|
|
} } } }`;
|