import { WRITE_THROUGH_HOLD_MS } from './writeThroughHold'; // Appointments this tab checked in, so another screen can read their Encounter by id while the search // still reports them booked. Module-level so it outlives a route change within the tab. const checkedIn = new Map(); export const noteCheckIn = (appointmentId: string | undefined, now: number = Date.now()): void => { if (appointmentId) checkedIn.set(appointmentId, now); }; export const recentCheckInIds = (now: number = Date.now()): Set => { checkedIn.forEach((at, id) => { if (now - at > WRITE_THROUGH_HOLD_MS) checkedIn.delete(id); }); return new Set(checkedIn.keys()); };