import { OrgSection } from "./OrgSection.tsx"; import { ORG_AGREEMENT_ORDER } from "../../../../components/OrgAgreements/orgAgreements"; import { ProviderRecordingConsent } from "./ProviderRecordingConsent.tsx"; import { ProviderAccessSection } from "./ProviderAccessSection.tsx"; import type { OrgCollabTeam } from "../../../../utils/orgCollabTeams"; import { formatCutoff, useRecordAccessStanding, type RecordAccessStanding } from "../../../../hooks/useRecordAccessStanding"; /** * WHAT THIS PRACTICE MAY DO WITH YOUR RECORD - one section, three rows. * * IT WAS THREE CARDS, ONE PER DOCUMENT, AND THE DECK REJECTS THAT SHAPE. Three shielded cards stacked * inside an opened practice read as three separate subjects, and on a phone they pushed the care team * and the appointments off the screen entirely. They are not three subjects: they are three answers to * the one question a patient opens a practice to ask. * * THE SENTENCE ABOVE THE ROWS IS THE ANSWER IN PLAIN WORDS, and the rows are the detail under it. It is * written in the present tense about what the practice CAN do, because that is what a patient is * checking - not what they signed. * * IT FOLLOWS THE HIPAA AUTHORIZATION'S STANDING, read for this practice: the present-tense sentence only while it is * current, the record as it was available to them once withdrawn (forward-only, per Spencer's ruling), and no claim * at all while the standing is still being read or could not be read. The rows beneath keep each document's detail. * * THE ORDER IS THE SHARED ONE, so the patient meets the three documents in the same sequence here as in * the outstanding-agreements notice and at the front desk. */ export const ProviderAccessBlock = ({ orgId, organizationName, collabTeams, }: { orgId: string; organizationName?: string; /** This practice's people in the patient's collaboration teams; null while unknown. */ collabTeams?: OrgCollabTeam[] | null; }) => { const practice = organizationName || "This practice"; const { standing, retry } = useRecordAccessStanding({ organizationId: orgId }); return (
{/* THIS IS THE ONLY DOOR TO A DECLINED DOCUMENT. A declined document is reachable from nowhere else: the outstanding-agreements notice renders only while something is OUTSTANDING, and a refusal is answered. So a patient who declined Consent to Treat watched the notice disappear, taking the only route to that document with it, having just been promised "you can agree later if you change your mind". The booking gate then refuses them, and there was no later. ⛔ The fix is not to re-show the notice. A decline is never re-prompted; that rule is settled. Volunteering is not the same as being asked - a nag arrives, an affordance waits. */}
{ORG_AGREEMENT_ORDER.map((instrument) => ( ))}
); }; // The summary sentence for each standing. It describes the record the practice was entitled to see, never that it // holds every item that existed then, and says nothing while the standing is not known. const AccessSummary = ({ practice, standing, retry }: { practice: string; standing: RecordAccessStanding; retry: () => void }) => { const say = (text: string) =>

{text}

; switch (standing.kind) { case "current": return say(`${practice} can see your record and add to it, and can include you in messages and collaboration teams.`); case "withdrawn": return say(standing.at ? `${practice} can still see your record only as it was available to them through ${formatCutoff(standing.at)}. Nothing newer is shared with them.` : `${practice} can still see your record only as it was available to them when you withdrew. Nothing newer is shared with them.`); case "declined": return say(`You declined ${practice}'s access to your record.`); case "not-given": return say(`${practice} has not been given access to your record.`); case "unknown": return (

What {practice} can see could not be checked.{" "}

); case "loading": return null; } }; export default ProviderAccessBlock;