39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
/**
|
||
* Mock toggle — controls whether hooks return fixture data or call real backend.
|
||
*
|
||
* Usage in hooks:
|
||
* import { USE_MOCKS, MOCK_PARCELS_BBOX } from "@/lib/mock-toggle";
|
||
*
|
||
* // Coarse toggle: all mocks on/off
|
||
* if (USE_MOCKS) return fixtureParcels;
|
||
*
|
||
* // Fine-grained: per-endpoint (disable individually as B1-B6 ship to prod)
|
||
* if (MOCK_PARCELS_BBOX) return fixtureParcels;
|
||
*
|
||
* .env.local (dev):
|
||
* NEXT_PUBLIC_USE_MOCKS=true
|
||
*
|
||
* Production: unset or NEXT_PUBLIC_USE_MOCKS=false
|
||
*
|
||
* TODO: per-hook fine-grained flags below — flip to false as each backend
|
||
* endpoint (B1-B6) is confirmed deployed and smoke-tested in prod.
|
||
*/
|
||
|
||
/** Master switch — set NEXT_PUBLIC_USE_MOCKS=true in .env.local for dev */
|
||
export const USE_MOCKS = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||
|
||
/**
|
||
* Fine-grained feature flags (all derive from USE_MOCKS initially).
|
||
* Flip each to `false` once the corresponding backend endpoint is live.
|
||
*
|
||
* B1 — GET /api/v1/parcels/by-bbox → used by A2 EntryMap
|
||
* B2 — GET /api/v1/users/me/recent-parcels → used by A2 RecentParcels
|
||
* B4 — GET /api/v1/landing/stats → used by A12 Landing
|
||
* B5 — POST /api/v1/parcels/{cad}/analyze → used by A5–A11 sections
|
||
* B6 — GET /api/v1/parcels/{cad}/poi-score → used by A5 PoiList2Gis
|
||
*/
|
||
export const MOCK_PARCELS_BBOX = USE_MOCKS; // B1
|
||
export const MOCK_RECENT_PARCELS = USE_MOCKS; // B2
|
||
export const MOCK_LANDING_STATS = USE_MOCKS; // B4
|
||
export const MOCK_ANALYZE = USE_MOCKS; // B5
|
||
export const MOCK_POI_SCORE = USE_MOCKS; // B6
|