Add frontend/modules/loyalty with types, API client, design system, feature pages and thin App Router routes under app/loyalty/. BFF proxy at app/api/loyalty/. Include loyalty frontend docs. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
1.2 KiB
Markdown
30 lines
1.2 KiB
Markdown
# Loyalty Frontend Architecture
|
||
|
||
**Status:** Production scaffold — connected to Loyalty service 7.0–7.6
|
||
**Package:** `frontend/modules/loyalty/`
|
||
**Routes:** `frontend/app/loyalty/` (thin App Router only)
|
||
**BFF:** `frontend/app/api/loyalty/[...path]` → `:8004`
|
||
|
||
## Layers
|
||
|
||
1. **App Router** — `page.tsx` / `layout.tsx` / `loading.tsx` / `error.tsx` / `not-found.tsx` only
|
||
2. **Module package** — features, components, services, design-system, constants
|
||
3. **Shared DS** — `@/components/ds` + module tokens `--loyalty-*`
|
||
4. **BFF** — same-origin proxy with `Authorization` + `X-Tenant-ID`
|
||
|
||
## Portal
|
||
|
||
Single portal `engage` under `/loyalty/engage/*` with shell navigation. Hub at `/loyalty/hub`.
|
||
|
||
## API client
|
||
|
||
`loyaltyApi` in `modules/loyalty/services/loyalty-api.ts` covers programs, tiers, members (+lifecycle), point accounts (+ledger ops), rewards/redemptions, campaigns (+lifecycle), referrals, wallets, audit, health.
|
||
|
||
## Query keys
|
||
|
||
`["loyalty", tenantId, resource, ...]`
|
||
|
||
## Out-of-scope honesty
|
||
|
||
Screens without backend APIs (gift cards 7.7, gamification entities, segments, partners, branches, API keys) use `LoyaltyScopeNotice` — no fake CRUD.
|