/** * Whether the setup card is folded away, and whose choice that is. * * PER PERSON AND PER PRACTICE, and neither half is optional. Two administrators at one practice are * two people with two screens, and a group with two practices has two setups to be part-way through. * One global flag would let somebody folding this away on their own dashboard fold it away on their * colleague's, and would hide a half-finished second site because the first one is done. * * Pure and separate from the component for the reason `owedWork` and `scheduleTelehealth` are: the * rule is worth pinning on its own, and the default below is the part that decides whether a practice * finishes setting itself up. */ /** Storage key for one person's choice at one practice. */ export const onboardingCollapseKey = ( practitionerRoleId: string | undefined, organizationId: string | undefined, ): string => `ahr-onboarding-collapsed:${practitionerRoleId ?? 'unknown'}:${organizationId ?? 'unknown'}`; /** * What a stored value means, and what an ABSENT one means. * * IT FAILS OPEN, DELIBERATELY. A first visit, a private window, a browser with site data blocked and a * storage read that threw all arrive here as nothing, and all of them read as EXPANDED. Showing a * finished practice a card they had already hidden costs one click; hiding an unfinished practice's * next step is how setup quietly stops, and nobody would know it had. * * Only the exact value this writes counts as collapsed - anything else is somebody else's key or a * half-written one, and neither is a preference this ever recorded. */ export const collapsedFromStored = (stored: string | null | undefined): boolean => stored === 'true'; /** What `collapsedFromStored` reads back, kept beside it so the two cannot drift. */ export const COLLAPSED_VALUE = 'true';