28 lines
1.6 KiB
TypeScript
28 lines
1.6 KiB
TypeScript
/**
|
|
* When true, the notifications domain is served by the in-memory mock (`apis/mockApi.ts`) behind the
|
|
* `NotificationsApi` seam.
|
|
*
|
|
* **Mock is primary this phase.** The b1 endpoints are live and the real `clientApi.ts` maps them 1:1, but a
|
|
* notification is only produced by other backend domains dispatching one (`INotificationDispatcher`) — none
|
|
* of which run client-side while the upstream flows are mock-primary — so there'd be nothing to show. The
|
|
* mock seeds a realistic **unread-first** feed spanning every deep-link class (booking / payment / ticket /
|
|
* payout / review / refund) so `notificationDeepLink` is exercisable, and exposes a dev-only
|
|
* `__mockPushNotification` to simulate a fresh notification arriving (the bell increments within the poll
|
|
* interval — phase §7 step 4). Flip to `false` once the upstreams are real — no hook/component change.
|
|
*/
|
|
export const USE_NOTIFICATIONS_MOCK = false;
|
|
|
|
/** Notification-center page size (api-conventions `pageSize`). */
|
|
export const NOTIFICATIONS_PAGE_SIZE = 20;
|
|
|
|
/**
|
|
* **Poll politely.** Only the unread **count** revalidates on an interval (stale-while-revalidate): the
|
|
* cached count is served instantly, refetched every `UNREAD_COUNT_REFETCH_INTERVAL` and on window focus, and
|
|
* treated fresh for `UNREAD_COUNT_STALE_TIME` so we never hammer the endpoint. The **list is not polled** —
|
|
* only its own reads/mutations refetch it.
|
|
*/
|
|
export const UNREAD_COUNT_STALE_TIME = 45 * 1000;
|
|
export const UNREAD_COUNT_REFETCH_INTERVAL = 60 * 1000;
|
|
export const NOTIFICATIONS_LIST_STALE_TIME = 30 * 1000;
|
|
export const NOTIFICATIONS_GC_TIME = 5 * 60 * 1000;
|