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