/** * What the signed-in gate draws while the session's identity resolves. * * A member in the join wait (utils/justJoinedHandoff) is shown that, whatever the stall timers say: the wait * is bounded and ends by opening the session or by failing the read, so no stall screen may claim the account * could not be opened while it runs. */ export type SessionGate = "setting-up" | "could-not-resolve" | "stalled" | "loading" | "ready"; export const sessionGateFor = (state: { settingUp: boolean; resolving: boolean; awaitingIdentity: boolean; identityStalled: boolean; sessionStalled: boolean; }): SessionGate => { if (state.settingUp && (state.resolving || state.awaitingIdentity)) return "setting-up"; if (state.awaitingIdentity && state.identityStalled) return "could-not-resolve"; if (state.resolving) return state.sessionStalled ? "stalled" : "loading"; return "ready"; };