From edec03e893df469be6261f1a009bf8be455c215e Mon Sep 17 00:00:00 2001 From: Gitead Date: Sun, 17 May 2026 00:12:09 -0400 Subject: [PATCH] feat: auto-trigger eligibility selenium from schedule right-click menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove "Claim Status" from appointment context menu - Rename "Eligibility Status" → "Check Eligibility" - Check Eligibility now navigates to insurance-status page and auto-starts the correct selenium flow based on the patient's stored insurance provider: MassHealth 21+ → MH Eligibility & History MassHealth <21 → CMSP Eligibility & History & Remaining Delta Dental MA → DDMA selenium Delta Dental Ins → Delta Ins selenium (OTP modal if needed) United Healthcare SCO → United SCO selenium DentaQuest/Tufts → Tufts SCO selenium Commonwealth Care Alliance → CCA selenium Unknown → scroll to Other provider checks section - Add autoTrigger/onAutoTriggered props to all five button components Co-Authored-By: Claude Sonnet 4.6 --- .../insurance-status/cca-button-modal.tsx | 15 ++- .../insurance-status/ddma-buton-modal.tsx | 16 ++- .../deltains-button-modal.tsx | 13 ++ .../tufts-sco-button-modal.tsx | 13 ++ .../united-sco-button-modal.tsx | 13 ++ apps/Frontend/src/pages/appointments-page.tsx | 55 +++++--- .../src/pages/insurance-status-page.tsx | 122 ++++++++---------- 7 files changed, 154 insertions(+), 93 deletions(-) diff --git a/apps/Frontend/src/components/insurance-status/cca-button-modal.tsx b/apps/Frontend/src/components/insurance-status/cca-button-modal.tsx index fb27c4d6..f6ab7ce9 100644 --- a/apps/Frontend/src/components/insurance-status/cca-button-modal.tsx +++ b/apps/Frontend/src/components/insurance-status/cca-button-modal.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { Button } from "@/components/ui/button"; import { CheckCircle, LoaderCircleIcon } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; @@ -17,6 +17,8 @@ interface CCAEligibilityButtonProps { firstName?: string; lastName?: string; isFormIncomplete: boolean; + autoTrigger?: boolean; + onAutoTriggered?: () => void; onPdfReady: (pdfId: number, fallbackFilename: string | null) => void; } @@ -26,12 +28,15 @@ export function CCAEligibilityButton({ firstName, lastName, isFormIncomplete, + autoTrigger, + onAutoTriggered, onPdfReady, }: CCAEligibilityButtonProps) { const { toast } = useToast(); const dispatch = useAppDispatch(); const sessionIdRef = useRef(null); + const autoTriggeredRef = useRef(false); const [isStarting, setIsStarting] = useState(false); @@ -181,6 +186,14 @@ export function CCAEligibilityButton({ } }; + useEffect(() => { + if (!autoTrigger || autoTriggeredRef.current || isFormIncomplete) return; + autoTriggeredRef.current = true; + onAutoTriggered?.(); + handleStart(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [autoTrigger, isFormIncomplete]); + return (