@prismshadow/penguin-library-session · library/session/src/web/chat/iface.ts:24

ChatDrafts

interface

No JSDoc comment in source yet.

API

@Interface()
export abstract class ChatDrafts {
  abstract readonly newChatId: string;
  abstract useParked(userId: string | null, projectId: string | null): readonly ParkedDraft[];
  abstract removeParked(userId: string, projectId: string, id: string): void;
  abstract forgetSession(userId: string, sessionId: string): void;
  abstract prepareNewChat(userId: string, projectId: string): void;
  abstract useNewChat(): () => void;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use
@Provideprovided by

Members (6)

newChatId

readonly newChatId: string

The new-chat draft page's route id: the page is /chat/<newChatId>.

useParked

useParked(userId: string | null, projectId: string | null): readonly ParkedDraft[]

A user × Project's parked drafts, newest first — a React hook, re-rendering when they change.

@paramuserIdstring | null
@paramprojectIdstring | null
@returnsreadonly ParkedDraft[]

removeParked

removeParked(userId: string, projectId: string, id: string): void

Drops a parked draft (sent or deleted). Idempotent.

@paramuserIdstring
@paramprojectIdstring
@paramidstring
@returnsvoid

forgetSession

forgetSession(userId: string, sessionId: string): void

Drops a deleted conversation's unsent composer text, so no orphaned key is left behind.

@paramuserIdstring
@paramsessionIdstring
@returnsvoid

prepareNewChat

prepareNewChat(userId: string, projectId: string): void

Clears the active new-chat slot for an entry point about to open it: typed text is parked first.

@paramuserIdstring
@paramprojectIdstring
@returnsvoid

useNewChat

useNewChat(): () => void

The generic New chat as a hook: prepares the slot, then opens the draft page on the Project's defaults.

@returns() => void