Commit c323db4
feat(PWA-S8): tracking page /c/[orderId] realtime + incidents (#479)
* test(#459): scaffold tracking decision + getOrderTracking tests
PWA-S8 tracking page (/c/[orderId]) — RED tests :
- decideTrackingSteps : 6 etapes delivery + 3 etapes C&C, mapping order workflow + delivery status.
- decideEtaLabel : pickupEta avant pickup_complete, dropoffEta apres, rounding minute.
- decideIncident : refused_post_payment + incident_after_pickup => card refund (customer_absent silent).
- getOrderTracking : publicTenantQuery, null cross-tenant (no oracle), projection minimale (jamais customerId).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(#459): /c/[orderId] tracking page realtime + incidents
PWA-S8 (PRD 10 §11 Page Tracking, US 50-55) :
Backend (packages/backend/convex/lib/orders/tracking.ts) :
- getOrderTracking publicTenantQuery (URL non-protégée, partageable — l'orderId non-devinable IS le token).
- Projection minimale : status, mode, items, address, total, delivery {status, etas, incidentType}. Jamais customerId / customerPhone / restaurantNote (ADR 0010 MOAT).
- Cross-tenant : null indistinctement d'un orderId manquant (pas d'oracle).
- 9 tests dont fuzz cross-tenant + foreign customer même tenant (URL share-by-design).
Frontend (apps/web/src/lib/tracking/ + components/tracking/ + app/c/[orderId]/) :
- decideTrackingSteps : 6 étapes delivery + 3 étapes C&C, mapping order workflow + delivery status, terminal failure laisse seul 'received' done.
- decideEtaLabel : pickupEta avant pickup_complete, dropoffEta après ; round-up minute ; 'Bientôt' si passé ; null sur C&C / incident terminal.
- decideIncident : refused_post_payment + incident_after_pickup → card refund ; customer_absent SILENT côté client (PRD 40 §5 Cas D).
- TrackingView : useQuery Convex sub realtime (re-render <500ms au webhook), placeholders SVG (HITL-3 Lottie pending, swap PR cosmétique), <details> natif pour items collapsible, setInterval 30s pour ETA countdown.
- Page RSC : cookie tenant du middleware, dégradé propre si absent, jamais convexAuthNextjsToken (URL doit marcher sans cookie auth).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 154085a commit c323db4
13 files changed
Lines changed: 1813 additions & 0 deletions
File tree
- apps/web/src
- app/c/[orderId]
- components/tracking
- lib/tracking
- packages/backend/convex
- _generated
- lib/orders
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
0 commit comments