fix: claim confirm card was storing autoSubmit=false, blocking Selenium auto-start

The green claim confirmation card in the chatbot was saving autoSubmit:false
to sessionStorage, so claims-page.tsx never set chatbotAutoSubmitSiteKey and
ClaimForm received autoSubmit=false, leaving Selenium unstarted after form fill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-06-06 23:14:46 -04:00
parent 86cf55aa4d
commit 905e236166

View File

@@ -101,6 +101,19 @@ function parseEligibilityInput(
}
const CHAT_STORAGE_KEY = "chatbot_messages";
const CHATBOT_JOB_TS_KEY = "chatbot_job_started_at";
function markJobStarted() {
try { sessionStorage.setItem(CHATBOT_JOB_TS_KEY, String(Date.now())); } catch {}
}
function shouldAutoReset(): boolean {
try {
const ts = sessionStorage.getItem(CHATBOT_JOB_TS_KEY);
if (!ts) return false;
return Date.now() - Number(ts) > 60_000;
} catch { return false; }
}
function loadSavedMessages(): Message[] {
try {
@@ -269,6 +282,7 @@ export function ChatbotButton() {
const prefillAndNavigate = (memberId: string, dobISO: string, autoCheck: string) => {
sessionStorage.setItem("chatbot_eligibility", JSON.stringify({ memberId, dob: dobISO, autoCheck }));
window.dispatchEvent(new CustomEvent("chatbot:eligibility-prefill"));
markJobStarted();
setTimeout(() => { setLocation("/insurance-status"); setOpen(false); resetStep(); }, 600);
};
@@ -436,7 +450,7 @@ export function ChatbotButton() {
size="sm"
className="relative h-8 w-8 rounded-full p-0"
title="Open Assistant"
onClick={() => setOpen(true)}
onClick={() => { if (shouldAutoReset()) resetStep(); setOpen(true); }}
>
<Bot className="h-5 w-5 text-primary" />
</Button>
@@ -758,6 +772,7 @@ export function ChatbotButton() {
autoSubmit: true,
})
);
markJobStarted();
setTimeout(() => {
setLocation(`/claims?appointmentId=${opt.appointmentId}`);
setOpen(false);
@@ -811,6 +826,7 @@ export function ChatbotButton() {
JSON.stringify({ codes: matchedCodes, siteKey, serviceDate, autoSubmit: true })
);
}
markJobStarted();
const url = appointmentId
? `/claims?appointmentId=${appointmentId}`
: `/claims?newPatient=${patient?.id}`;