frontend phase 12

This commit is contained in:
hamid
2026-07-10 14:48:15 +03:30
parent 67c028562e
commit 6186f54294
34 changed files with 2363 additions and 1 deletions
+38
View File
@@ -0,0 +1,38 @@
/**
* When true, the payouts domain is served by the in-memory mock (`apis/mockApi.ts`) behind the
* `PayoutsApi` seam.
*
* **Mock is primary this phase.** b13 shipped the nurse read as a **single** endpoint
* (`GET api/v1/nurse_payouts/history` → `NursePayoutHistoryDto`). The **four-bucket earnings summary**,
* the **per-booking earnings list + money-state**, and a **nurse-readable payout detail** (batch context +
* booking links + `failureReason`) are contract gaps filed as **REQ-025**. So the whole earnings surface is
* mocked behind this seam with real-shaped fixtures covering **all four earnings states + a negative net
* balance (clawback > earnings) + a `failed` payout** (every UI state exercisable). Flip to `false` once
* REQ-025 lands — no hook/component change (only `clientApi.ts`'s three gap methods start returning real data).
*/
export const USE_PAYOUTS_MOCK = true;
/**
* Which mock ledger picture to serve. `standard` = a healthy positive net balance with one of each earnings
* state; `clawback_heavy` = outstanding clawbacks exceed accrued-unpaid earnings so the **net balance goes
* negative** ("owed back") — the explicit owed-back UI state (phase §7 step 3). The four earnings rows are
* identical across scenarios; only the ledger-derived summary differs (the summary spans the whole ledger,
* not just the visible page). Flip to demo the negative-balance treatment.
*/
export type PayoutsMockScenario = 'standard' | 'clawback_heavy';
export const MOCK_SCENARIO: PayoutsMockScenario = 'standard';
/**
* Earnings move on a **weekly cadence**, not per second — a generous `staleTime` means revisiting the
* screen or switching a tab never needlessly refetches. There are no mutations this phase, so nothing
* invalidates these; the natural staleness is the only refresh trigger.
*/
export const EARNINGS_SUMMARY_STALE_TIME = 5 * 60 * 1000;
export const EARNINGS_LIST_STALE_TIME = 5 * 60 * 1000;
export const PAYOUT_HISTORY_STALE_TIME = 5 * 60 * 1000;
/** A settled payout is immutable — its detail is effectively permanent; keep it warm longer. */
export const PAYOUT_DETAIL_STALE_TIME = 10 * 60 * 1000;
export const PAYOUTS_GC_TIME = 15 * 60 * 1000;
/** Page size for the earnings + payout-history lists (api-conventions `pageSize`). */
export const PAYOUTS_PAGE_SIZE = 10;