Files
baya-monorepo/client/src/services/reviews/constants.ts
T
2026-07-13 12:29:00 +03:30

41 lines
2.2 KiB
TypeScript

/**
* When true, the reviews domain is served by the in-memory mock (`apis/mockApi.ts`) behind the `ReviewsApi`
* seam.
*
* **Mock is primary this phase.** b14 serves the review **submit**, the public **nurse reviews** page, and
* the tag rollup — but there is **no** review-eligibility read and **no** my-review-for-booking read
* (**REQ-026**), and the whole moderation transition (`pending_moderation → published`) is admin-only (f15).
* The mock reads the shared **f8 bookings store** to gate eligibility on a completed booking, tracks the
* customer's submission so the "under review" state persists, seeds a small published-review list per nurse
* for the profile tab, and exposes a dev-only `__mockPublishSubmittedReview` so a human can watch a submitted
* review appear on the profile (the f15 moderation UI is deferred). Flip to `false` once REQ-026 lands — no
* hook/component change (only `clientApi.ts`'s two gap methods start returning real data).
*/
export const USE_REVIEWS_MOCK = false;
/** Page size for the public nurse-reviews list (api-conventions `pageSize`). */
export const REVIEWS_PAGE_SIZE = 5;
/**
* The published-review list moves slowly (a moderation transition is a rare admin action) — a generous
* `staleTime` means revisiting a profile never needlessly refetches. Eligibility/my-review are per-booking
* and are **invalidated on submit**, so their staleness is short (a submit must flip the CTA immediately).
*/
export const NURSE_REVIEWS_STALE_TIME = 2 * 60 * 1000;
export const REVIEW_ELIGIBILITY_STALE_TIME = 30 * 1000;
export const REVIEWS_GC_TIME = 10 * 60 * 1000;
/**
* The admin moderation worklist is an actively-worked queue — a short `staleTime` keeps it fresh as items are
* moderated by this (or another) admin, while still serving from cache during quick filter/page switches. A
* moderation mutation invalidates it immediately, so this only governs background freshness.
*/
export const MODERATION_QUEUE_STALE_TIME = 20 * 1000;
/**
* The low-rating support-alert threshold (server config, default ≤ 2). The mock echoes it on
* `SubmitReviewResult.lowRatingAlertRaised`; the **UI never surfaces it** — it exists only so the mock's
* result shape matches the wire.
*/
export const MIN_RATING_FOR_SUPPORT_ALERT = 2;