- Added `RealtimeModule` and `RealtimeApiModule` to the BFF application for improved real-time capabilities. - Updated `CatalogCdcSubscriber` and `OrderCdcSubscriber` to utilize `RealtimeService` for publishing catalog and order updates, ensuring instant notifications across connected clients. - Enhanced `OrderEventsService` to leverage `RealtimeService` for order event subscriptions, improving reliability across multiple BFF instances. - Introduced `AccountEventsListener` in the portal layout to handle real-time account updates. - Removed stale time and garbage collection settings from several hooks to streamline data fetching processes.
22 lines
654 B
TypeScript
22 lines
654 B
TypeScript
/**
|
|
* 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>;
|