This repository has been archived on 2026-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
Gishen-B2B/docs/features/member-experience.md
kirukib 3778801ef5 Ship Gishen B2B institutional portal with polished layout and mock-backed flows.
Deliver role-aware shell (sidebar, breadcrumbs, quick search, tables, detail/create layouts), locale-ready pages, shared backend/feature docs, and Vercel project config so HR, finance, and members can demo against typed mocks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 21:18:23 +03:00

125 lines
3.4 KiB
Markdown

# Feature: Member experience
Member portal — allowance summary, order history, prescription upload/status, loyalty pointer.
**Workspace:** `/Users/kirukib/Desktop/Yaltopia Project/Gishen-B2B`
## Pages
| Route | Purpose |
|-------|---------|
| `/me` | Home — plan/allowance, refill reminders, shop CTA |
| `/me/orders` | Covered order history |
| `/prescriptions` | Rx list with status |
| `/prescriptions/new` | Multi-page upload wizard |
## Entities
- [`Member`](../backend/entities/member.md)
- [`Package`](../backend/entities/package.md)
- [`Prescription`](../backend/entities/prescription.md)
## Endpoints
| Endpoint | Purpose |
|----------|---------|
| `GET /v1/auth/me` | Session + allowance snippet |
| `GET /v1/me/package` | Package + allowance detail |
| `GET /v1/customers/:id/orders`* | Order history |
| `GET/POST /v1/prescriptions*` | Rx CRUD + submit |
| `GET /v1/prescriptions/refill-reminders` | Upcoming refills |
\* Shared customer orders API — spec owned with Ecom; mocked in B2B phase.
## `/me` home sections
| Section | Content |
|---------|---------|
| Allowance card | Total, used, remaining (mint progress bar) |
| Package summary | Plan name, co-pay %, key perks |
| Refill reminders | Prescriptions due within N days |
| Shop CTA | Deep link to Ecom with coverage |
| Loyalty teaser | Points balance pointer — full UI in Ecom/Mob |
## Order history (`/me/orders`)
Member sees own orders with:
- Date, order ID, total
- Org-covered vs member-paid split
- Status (processing, delivered, etc.)
- Line items with product names (member owns their data)
## Prescriptions
### Upload flow (`/prescriptions/new`)
1. Create draft
2. Upload pages (jpeg/png/pdf) — multi-page
3. Review thumbnails
4. Submit → `prescription.submitted` event
5. Track status on `/prescriptions`
### Status display
| Status | Member UX |
|--------|-----------|
| `submitted` | "Waiting for review" |
| `under_review` | "Pharmacist reviewing" |
| `approved` | "Approved — ready to order" |
| `queried` | Show query message + resubmit |
| `rejected` | Show reason + contact support |
Review happens in Admin — B2B consumes `prescription.review_updated`.
### Refill reminders
When `days_supply` set and `refill_due_at` approaching, show banner on `/me`.
## Clinical access
Members see **full own** prescription data including images and approved medicine lines.
HR/Finance **cannot** access member prescription routes — 403.
SUPER_USER may view any member's Rx for support via `/members/[id]` + prescription endpoints.
## Checkout entitlement
B2B shows remaining allowance. Basket split UI at checkout lives in **Gishen-Ecom**:
```
Allowance remaining: 10,800 ETB
[ Shop with coverage → Ecom ]
```
See [`open-items.md`](../coordination/open-items.md).
## Platform notes
- Web upload mirrors Ecom Rx UX
- Edge-detection camera: Mobile-only (Gishen-Mob)
- No handwritten OCR
## Validation / errors
| Scenario | Code |
|----------|------|
| Submit Rx without pages | `VALIDATION_FAILED` |
| Inactive member | `MEMBER_INACTIVE` |
| Non-member on member routes | `FORBIDDEN` |
## UI components
- Allowance hero card (Gishen mint/forest)
- Order list with split amounts
- Rx upload dropzone + page gallery
- Status timeline component
- Refill reminder alert
## Related
- [packages.md](packages.md) — entitlement rules
- [auth-roles.md](auth-roles.md) — MEMBER role
- [gishen-ecom.md](../coordination/gishen-ecom.md) — checkout split