Files
daily_merchant_web/docs/02_MOCK_DATA_GAP_ANALYSIS.md

12 KiB
Raw Blame History

Mock-Data → Live-API Gap Analysis

Goal: remove every hardcoded / mock value in src/ and back it with a live API before staging.

Each row is classified:

  • WIRE — a live endpoint already exists ( or 🟡 in 01_ENDPOINT_CATALOG.md); just connect it / remove the mock fallback.
  • DERIVE — no dedicated endpoint, but the value is computable client-side from data we already fetch (e.g. period-over-period deltas by querying two date ranges). No backend work needed.
  • NEW API — no endpoint exists and the value cannot be derived; backend must build it. Spec'd in 03_REQUIRED_BACKEND_APIS.md under the referenced [Rxx] id.

Central mock source file to delete once empty: src/data.ts.


1. DashboardView.tsx (mostly live already)

UI element Current source Class Target
Active Outlets / Total / % live useTenantLocations + useOrderSummary OK
Region fulfilment %, delivered/total live useOrderSummary OK
Monthly Revenue, Monthly Profit live useInvoiceInsight OK
Per-location orders / dispatched / fulfilled % live useFiestaLocationSummary OK
KPI card icons / gradients / static subtext labels hardcoded keep cosmetic, not data
Banner title "Executive Command Center", "Live Core" hardcoded keep cosmetic

Dashboard is ~clean. Only cosmetic strings remain.


2. ReportsView.tsx (heaviest mock load)

UI element Current source Class Target
Orders KPI value / delivered / cancelled live useFiestaOrderSummary OK
KPI trend deltas +12.5%, +14.8%, -1.2%, +8.4% hardcoded DERIVE query current + previous period summary, compute % change
Revenue value = delivered × 355 hardcoded multiplier NEW API [R1] revenue summary (real money, not a guess)
Active SKU count live stock length OK
CHART_DATA_YTD (12-mo orders/revenue/cancelled/skus) hardcoded NEW API [R2] order+revenue time-series (orders partly via getOrderInsight; revenue & skus need [R1]/[R2])
getDynamicChartData month/12M/all-time series hardcoded NEW API [R2] with `granularity=day
Region scaling multipliers (0.42 / 0.60 / 0.75…) hardcoded fudge NEW API [R2] filtered by region/location — remove multipliers
Monthly order heatmap — Coimbatore rows live useFiestaOrderInsight OK
Monthly order heatmap — Chennai/Bangalore stub rows hardcoded WIRE getOrderInsight returns all tenant locations; remove stubs
MONTH_LABELS, MONTH_KEYS hardcoded keep static axis labels
Top-nodes leaderboard names / order counts live (location summary) OK
Leaderboard revenue column derived from order count NEW API [R1] revenue-per-location
Product matrix rows live useFiestaStockStatementstockRowToProduct OK
unitsSold/revenue per product (mapper uses debit×retailprice) approximated NEW API [R3] product sales analytics (true units sold + revenue)
Expanded-row stock units (142/42/6), bar widths, hub split 60/40 hardcoded WIRE/NEW per-outlet via productlocations 🟡; hub split = real productstocks
Warehouse Bin BIN-C…, "Last Audited" date, barcode bars hardcoded NEW API [R3] product meta (bin, last-audit) — or drop if not tracked
Export progress modal simulated keep client UX only

3. InventoryView.tsx

UI element Current source Class Target
Banner active-outlets count live useFiestaTenantLocations OK
Banner total on-hand volume live useFiestaStoresStock OK
Global catalog grid live stock → stockRowToProduct OK
Optimal/Low/Critical hub counts derived from live stock + thresholds OK thresholds are business rules, keep
Per-store SKU lists, capacity bars live useFiestaStoresStock OK — but prefer real capacity ([R3])
initialImportLogs (Live Sync Audit Stream) mock data.ts NEW API [R4] import/sync audit log
CSV import default template string hardcoded keep UX template
Nilgiris Dairy / Coimbatore Heritage presets hardcoded WIRE catalog presets → getAllTenants/master catalog 🟡, or NEW [R5]
Brand Design Studio (theme, colors, bag label, eco-seal) hardcoded local state NEW API [R6] merchant branding config (GET+PUT)
Add-Product modal category list hardcoded WIRE getProductCategories / getProductSubcategories
Add-Product modal default price/stock hardcoded keep form defaults

4. OperationsView.tsx

UI element Current source Class Target
Inventory value, low-stock count, SKU count live useFiestaStockStatement OK
Fulfillment Health 98.4% hardcoded DERIVE from order/delivery summary
Forecast Efficiency 92%, Cost savings ₹1.9L/week hardcoded NEW API [R7] forecasting/insights (or remove until modelled)
Catalogue table rows live stockRowToProduct OK
"Global Inventory Count 4,200 nodes" hardcoded WIRE getProductsCount
Catalogue verification toggle local state only NEW API product update PUT 🔴 (REVIEW_REQUIRED)
Import logs table mock data.ts NEW API [R4] (same as Inventory)
Schema-validator messages ("14 duplicate SKUs") hardcoded NEW API [R4] import validation result
Add-SKU / Transfer-Stock modals local state mutation NEW API stock entry POST 🔴 + [R8] stock transfer

5. OrdersDeliveriesView.tsx

UI element Current source Class Target
KPI tiles (deliveries in range, pending, completed, fleet) live useFiestaDeliveries OK
Date presets / range client state OK
Order list rows live deliveryRowToOrder OK
Order line items (items: [] always empty) empty / itemCount only WIRE orderdetails?orderheaderid= 🟡 (exists!)
"Create Simulated Order" + MOCK_NAMES/STREETS/ITEMS hardcoded generator NEW API replace with real Create-Order POST 🔴, or remove button
Rider cards live useFiestaRiders OK
Rider rating 4.7 hardcoded in mapper NEW API [R9] rider telemetry/rating
Rider avatars rotated stock photos WIRE user photo field if present, else keep placeholder
GPS route SVG, "9 MINS", "1.2 km left", "GPS ACTIVE" hardcoded NEW API [R9] live rider GPS/ETA
Status-progression buttons (pack/dispatch/deliver) local state NEW API order/delivery status PUT 🔴 (REVIEW_REQUIRED)
Assign-rider action local state NEW API assign-rider POST 🔴 (REVIEW_REQUIRED)

6. StoreDetailView.tsx

UI element Current source Class Target
Inventory tab list live useFiestaStockStatement + mock fallback WIRE remove hardcoded fallback array
Customers tab list live useFiestaTenantCustomers + mock fallback WIRE remove hardcoded fallback array
intervalSlots dispatch pipeline (morning rush %, etc.) computed from store.deliveries×% NEW API [R10] intraday dispatch buckets
pastDaysLog 7-day ledger computed ×multipliers NEW API [R2] daily series per location
KPI cards (OTIF 98.2%, est revenue, dispatches, active fleet) hardcoded/derived WIRE/NEW OTIF & revenue need [R1]; fleet via getRiders
activeRiders (battery, lastPing) hardcoded NEW API [R9] rider telemetry
Customer CRM order history (3 orders) hardcoded WIRE orders?customerid= 🟡
Customer CRM metrics (CSAT 5.0) hardcoded NEW API [R11] customer analytics (CSAT/AOV/retention)
Customer search metrics (retention 88.4%, AOV ₹1,580, CSAT 4.9) hardcoded NEW API [R11]
GLOBAL_CATALOGUE_ITEMS modal hardcoded WIRE master catalog listings 🟡
resolveMetadata price/image keyword map hardcoded NEW API [R3] product image/price from catalog
Store cover images hardcoded array keep cosmetic asset set
operationalAlerts (filtered by store) mock data.ts NEW API [R12] operational alerts
CSV import simulation, Global-catalogue add local mutation NEW API stock entry POST 🔴

7. SettingsView.tsx

UI element Current source Class Target
Merchant ID card / registration info live useFiestaAllTenants OK
Outlets tab cards live useFiestaTenantLocations OK
LOCAL_OUTLETS_DATA fallback hardcoded WIRE remove fallback once locations confirmed live
DEFAULTS settings (min order, delivery charge, prep mins, tax, COD…) hardcoded + localStorage NEW API [R6] merchant settings GET+PUT (some fields exist on tenant: minorder, paymenttype)
Role dropdown options hardcoded [1,2,3,4,6] WIRE getAppRoles

8. UsersPanel.tsx

UI element Current source Class Target
User directory live useFiestaUsers OK
Create user live useFiestaCreateUser OK
USER_AVATARS rotation hardcoded keep/WIRE use user photo field if API has one
ROLE_THEMES styling hardcoded keep cosmetic
Add-user modal role list hardcoded WIRE getAppRoles

9. App.tsx / Header / Sidebar / UserPage

UI element Current source Class Target
Store registry cards live useFiestaTenantLocations + useFiestaLocationSummary OK
STORE_COVERS images hardcoded (hash-picked) keep cosmetic
Add-store modal local; needs onboard POST NEW API tenant/location onboard 🔴 (REVIEW_REQUIRED)
Scheduled-reports calendar (3 events) hardcoded NEW API [R13] scheduled reports (or drop feature)
Header/UserPage profile live authUser OK
Sidebar nav items hardcoded keep static nav config

Summary of backend work required

Id New API Blocks
[R1] Revenue summary (tenant + per-location, period) Reports revenue KPI, leaderboard revenue, OTIF revenue, Dashboard cross-check
[R2] Orders/revenue time-series (day/month/year, by region) Reports main chart, 7-day ledger
[R3] Product sales analytics + product meta (units sold, revenue, bin, image) Product matrix, catalogue metadata
[R4] Import / sync audit log + validation Inventory & Operations import tabs
[R5] Catalog presets (optional) Inventory presets
[R6] Merchant settings + branding config (GET/PUT) Settings, Brand Studio
[R7] Forecast / efficiency insights (optional) Operations forecast panel
[R8] Stock transfer (POST) Operations transfer modal
[R9] Rider telemetry (rating, battery, GPS, ETA) Orders fleet, GPS tracker, StoreDetail riders
[R10] Intraday dispatch buckets StoreDetail dispatch pipeline
[R11] Customer analytics (CSAT/AOV/retention) StoreDetail CRM metrics
[R12] Operational alerts feed StoreDetail / dashboard alerts
[R13] Scheduled reports (optional) Reports calendar

Plus mutation routes already in the sheet but marked 🔴 REVIEW_REQUIRED (order create/status, delivery assign/status, product create/update, tenant onboard, stock entry) — backend must confirm request/response before wiring.