TorbatYar/docs/phase-handover/phase-14-7.md
Mortezakoohjani d579d0b142 feat(loyalty): add Loyalty Platform Frontend module
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>
2026-07-27 10:50:55 +03:30

107 lines
4.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Phase Handover — 14.7 Beauty Business Marketing & Loyalty Integration
## Metadata
| Field | Value |
| --- | --- |
| Phase ID | `beauty-business-14-7` |
| Title | Marketing & Loyalty Integration |
| Status | Complete |
| Service(s) | `beauty_business` |
| Version | 0.14.7.0 |
| Date | 2026-07-26 |
| Commercial product | Torbat Beauty |
## Module completion summary
Phases **14.014.7** are complete. Beauty Business is an independent platform (not merged with Healthcare).
| Phase | Delivered |
| --- | --- |
| 14.0 | Foundation: orgs, branches, roles, config, audit, outbox |
| 14.1 | Booking: schedules, appointments lifecycle, waiting list |
| 14.2 | Salon: treatment rooms, stations, branch policies |
| 14.3 | Catalog: service categories, beauty services |
| 14.4 | Customers: profiles with CRM refs, preferences, visit history shells |
| 14.5 | Packages: package definitions, membership plans |
| 14.6 | Staff: staff profiles, commission rules |
| 14.7 | Marketing: campaign refs, Loyalty/Communication integration configs, dispatch |
## Reusable components
| Component | Location | Reuse notes |
| --- | --- | --- |
| TenantBaseRepository | `app/repositories/base.py` | All beauty repos |
| TransactionalEventPublisher | `app/events/publisher.py` | Outbox events |
| Provider Protocols | `app/providers/contracts.py` | CRM, Loyalty, Communication, Accounting, Delivery, Experience |
| Provider mocks | `app/providers/mocks.py` | Local integration dispatch |
| BusinessFormat enum | `app/models/types.py` | salon, barbershop, clinic, laser, skin_care, hair_treatment, spa |
## Public APIs (14.7 additions)
| Method | Path | Permission | Notes |
| --- | --- | --- | --- |
| * | `/api/v1/marketing-campaigns` | `beauty_business.marketing.*` | Campaign ref shells |
| * | `/api/v1/loyalty-integrations` | `beauty_business.integrations.*` | Earn mapping config |
| * | `/api/v1/communication-integrations` | `beauty_business.integrations.*` | Template mapping |
| POST | `/api/v1/integration-dispatches` | `beauty_business.integrations.*` | Mock dispatch to providers |
## Frontend
| Route | Purpose |
| --- | --- |
| `/beauty` | Dashboard + health/capabilities |
| `/beauty/organizations`, `/beauty/branches` | Foundation |
| `/beauty/appointments` | Booking |
| `/beauty/catalog/*` | Service catalog |
| `/beauty/customers` | Customer management |
| `/beauty/staff/*` | Staff & commissions |
| `/beauty/marketing/*` | Campaigns & integrations |
BFF: `/api/beauty-business/*` → port **8011**.
## Events
| Event type | When |
| --- | --- |
| `beauty_business.marketing.campaign_ref.created` | Campaign ref registered |
| `beauty_business.integration.loyalty_config.updated` | Loyalty mapping changed |
| `beauty_business.integration.communication_config.updated` | Communication mapping changed |
| `beauty_business.integration.dispatched` | Integration dispatch executed |
## Known limitations
- Mock-only provider calls for Loyalty/Communication/Accounting/CRM/Delivery/Experience
- Secondary catalog/package entities without dedicated list APIs
- No dedicated mobile stylist / customer apps
- Healthcare module remains separate (`healthcare_db`, port 8010, `/healthcare`)
## Migration notes
| Item | Detail |
| --- | --- |
| Alembic revisions | `0001_initial``0008_phase_147_marketing` |
| Database | `beauty_business_db` |
| Compose | `beauty-business-service` port **8011** |
| Tests | 30 passing (`pytest -q`) |
## Validation
- Backend: 30/30 tests green
- Frontend: `npm run build` exit 0
- Tenant isolation: enforced via `X-Tenant-ID`
- Permissions: `beauty_business.*` tree
## Next steps (post-14.7 — not registered phases)
- Retail POS-lite for beauty products
- Advanced analytics dashboards
- Live provider SDK wiring
- Dedicated CRUD for secondary entities
## Related documents
- [Beauty Business Roadmap](../beauty-business-roadmap.md)
- [Service Snapshot](../service-snapshots/beauty-business.yaml)
- [Phase area README](../phases/BeautyBusiness/README.md)