22 lines
654 B
TypeScript
Raw Normal View History

/**
* Realtime Events - Shared Contracts
*
* Shared SSE payload shapes for portal + BFF.
*/
export interface RealtimeEventEnvelope<TEvent extends string = string, TData = unknown> {
event: TEvent;
data: TData;
}
export interface CatalogEligibilityChangedPayload {
accountId: string;
eligibility: string | null;
timestamp: string;
}
export type AccountStreamEvent =
| RealtimeEventEnvelope<"account.stream.ready", { topic: string; timestamp: string }>
| RealtimeEventEnvelope<"account.stream.heartbeat", { topic: string; timestamp: string }>
| RealtimeEventEnvelope<"catalog.eligibility.changed", CatalogEligibilityChangedPayload>;