# Phase 5: Unified Chat-Native UX & Complete Homepage Experience
## Status (29 July 2026): **In Progress — ≥19.0.1.3.12 web access + a11y + growth**
Shipped toward complete chat UX:
- **Web photo login (1.3.11):** homepage **Photo login (web)** → `/businessite/login` (phone, industry, occupation, mother tongue, selfie). Support **Access** tasks grant/block/fraud. Timed `bs_web_access` session; cron expire. Logged-in/linked `/` and `/businessite` → chat (`?public=1` escape). **Logout → `/businessite?logged_out=1`** (public homepage, not login form).
- **Accessibility bar (1.3.12):** fixed bottom bar on website routes — **language switcher** (localStorage + cookies), **Read page** TTS, **Stop**, **Voice nav** (go home, photo login, register, open chat, apps, roadmap, mall, read page, stop, logout, language …). Aim: usable for all human abilities.
- Preferred AI connect + sponsorship in chat (web + mobile), **validated keys**, auto-fallback to platform **Groq**
- Inclusive registration (Education plan, dial codes, full country/industry/occupation/language catalogs) + **mother tongue**
- Rich media / document / shopping
- **Chat payments**: default **PayFast**, preferred gateway on client, `pay_now` direct to gateway (**no delivery address form**)
- Banking / **virtual private banker** roadmap scaffold (chat strings; rails later)
- **`businessite_messaging`**: Odoo Discuss DMs, groups, public channels
- **Chat-first** commands (`help messaging`, `dm +27…`, `find a doctor near me`, `emergency …`, `start mesh`, …)
- Mesh protocol (BLE UUID + WiFi `BSITE-`) store-and-forward envelopes
- **Email from chat (1.6.19 → 1.2.75)**:
- `email to` name **or** phone **or** `a@b.com` (subject/body multi-step; **not** wallet)
- Registered BusinesSite users → Human+AI **Mailing Support Queue** (platform mailbox `name_uuid@…`)
- Unregistered external addresses → **direct send** + BusinesSite Emailing **advert** (native-language voice mail)
- Admin: full **subject/body preview**, **attachments** included on send, pick recipient by profile
- `reply email #ID`, `my mailbox`, `check my email`, `listen to email #ID`, `my mother tongue is …`
- Mailcow IMAP inbound; **IPv4-only** outbound (Gmail 550-5.7.1 fixed)
- **User guides in chat**: `guides` / `guide isp-domains` / `guide eshop` / `guide email` / `guide mobile` / `guide media` / `guide notifications` (+ PDF)
- **Push/share (1.6.12 → 1.6.32)**: WorkManager poll chain + battery unrestricted + high-importance channel when app closed; hub publish queues `app_update` (product-line TA5 vs RC1). FCM when `businessite.fcm_server_key` set.
- **Web login QR (1.6.13 → 1.2.85)**: in-app `login to web` / `scan qr` → browser QR (`businessite://web-chat-sync`).
- Poll + **localStorage/cookie** `bs_web_session` so homepage and chat share one token.
- On link: open **full** `businessite_chatbot_dashboard` (not yellow Demo Mode shell) with phone name in header, chips, voice, **📎 Photo**.
- **Unlink phone** header control + `/businessite/unlink_web_chat_session?redirect=1` delinks browser only.
- **Bidirectional history**: `/businessite/chat/history` + web poll ~3s + mobile sync; turns persisted on all intents.
- Support: `/businessite/support/profile` QR for mobile desk. Guides updated.
- **Web product media (1.2.85)**: `add product NAME photo` opens **PC file chooser** synchronously; **📎 Photo** button + Attach photo chip; upload via `/businessite/chat/upload_document` (public ACL fixed for `ir.sequence`); applies gallery to shelf **without** auto support ticket. Mobile multi-select unchanged.
- Mobile hubs: **TA5 1.6.32+41** + **RC1 1.7.10+11** / **TA8 1.8.0+1** (32/64 only).
- **bi_payfast_payment_acquirer** + shelf Buy me now / cart checkout direct to PayFast
- **Profile via chat (19.0.1.3.x)**: `my profile`, name/surname, multi phone/email, visibility; **primary email cannot be removed**; **≥1 phone always** (primary required)
- **Groups**: `create group NAME with +27…`, invite, post, `my groups`
- **Member vs guest price**: `set member discount 10%`; checkout phone gate for registered discount
- **Growth / path to profit (19.0.1.3.1)**: `wish` / `requirement list`; **cost product …** margins + break-even; industry/role **request queues**; **TA9** `preorder offer` scaffold
- Same growth commands on **web chat and mobile** (shared `/businessite/chat/message` API)
- **Mother-tongue OS (19.0.1.3.2):** `response_language_mode` = english (default) / mother_tongue / both; chat replies localized; first-time language notice; voice STT uses **registration languages**; if uncertain → no invented text, `lang_und` queue; support queues **`lang_en` / `lang_zu` / …**; agent gets translation+instructions in their tongue; user receives reply in preferred mode (French↔Zulu style bridge)
### TA track note (24 July 2026)
- **TA5 is Done** as the general voice-first hub foundation for this phase.
- Product sequence: **TA5 → TA8 (next, Colourcraft Auto)** → **TA9 PreBooking/Pre-Order** (scaffold live) before **TA6 Sensi** / **TA7 NATIVEnvoy**.
- TA6/TA7 reuse TA5 chat; TA8 hardens TA5 into full commercial Chat OS. See [TA_TRACK_DEPENDENCIES.md](TA_TRACK_DEPENDENCIES.md).
Still open for full Phase 5 “complete homepage product”: full wallet ledger, seller storefronts depth, live banking providers, optional **FCM/APNs** true kill-state push, TA9 prepaid PayFast deposits, optional native email contact-picker polish.
### Maintenance rule
**Every new feature or APK build must update this phase doc (status bullets), `/businessite/roadmap` phase text in `controllers/main.py`, and UAT steps in `data/uat_launch_releases.xml`.** See [ROADMAP_UAT_MAINTENANCE.md](ROADMAP_UAT_MAINTENANCE.md).
## Objectives
- Make the intelligent chat the primary, unified entry point for all 4 user layers (Core Team, Client/Human, Support Provider, Business).
- Deliver fully layer-aware experiences: core team tools, client dashboards, support queues, business operations — all driven from chat + voice.
- Integrate rich media (photos, videos, rich cards), apps hub, payments, Odoo Discuss, and voice-first AI into one seamless UX.
- Transform the homepage into the complete, living product (real-time stats, stories, CTAs, chat as hero).
- Support rich HTML/markdown rendering in chat bubbles for app descriptions, product posts, and adverts.
- Enable in-chat media capture (take picture/selfie, record video) for shop registration, product posting, video adverts.
- Enable document upload (any format incl photos/PDFs) in chat for seller catalogs, POs, invoices.
- Full shopping: sellers (artists/designers/beauty/health resellers/retailers) register (as businessite.client + res.company shop), users search products/suppliers, view catalogs+prices, buy+pay (Payfast) in chat.
- Payfast integrated to Odoo website_sale (ecommerce) + point_of_sale for all registered shop companies.
- Shops created as res.company; seller online shops via website module (core team task to flesh storefronts per seller).
- Phases + layer/role tasks modeled as Odoo project.project + project.task (with tags for Data/System/User/Security/App teams and Architect/Analyst/Admin/Developer roles) for recruitment/onboarding.
- Cover the 5 layers (Data, System, User, Security, App) with concrete tasks per role.
## Key Technical Deliverables
- **Chat router** (chat.py + Dart _processCommand / _get_chatbot_response):
- Layer detection from profile (core_team, is_support_provider, business_id, etc.).
- Route messages, commands ("show apps", "join X", "take picture", "send money"), and AI fallback.
- **Preferred AI Engines + Sponsorship**: Helpers allow users to say/voice "connect my ai to [engine] key ...", "sponsor +phone with my ai". Stores per-client preferred (provider, key, model, base_url). Sponsors share subs (ai_sponsor_id). Any engine supported. Fallbacks. Integrated into all AI uses (chat, training, support tasks, translate/instruct).
- Full Odoo module-specific AI training/assessments/qualification in chat (web+mobile parity) for support providers. Language routing + AI assists.
- Rich message types: text, voice, image, video, app_card, rich_html, payment_link, wallet_transfer.
- Media capture in chat UI (reuse/extend PhotoCaptureWidget + camera plugin for photo/video).
- Upload media to Odoo (voice.message or new attachment model) + display in bubbles.
- Homepage: chat as central hero, layer-specific sections, live stats from clients/apps/UAT.
- App descriptions and product posts use t-raw / rich rendering (no escaped HTML tags in chat).
- Payment/wallet commands: "share payment link for SchoolLMS", "transfer 50 to @user", "pay invoice".
- Integration with existing UAT, mobile publish, subscription fees, hybrid networking (direct for media/downloads).
## Homepage / Roadmap UX Impact
- Chat becomes the hero and main navigation.
- "Apps Hub", "Earn as Support", "Business Tools", "Core Team" all accessible via natural language + buttons.
- Rich cards for apps/products render beautifully (bold, bullets, emojis).
- Media capture flows for shop owners to post products/adverts directly in chat.
## 5-Layer Implementation Breakdown
### Data Layer
- **Architect**: Design unified message/attachment models (extend voice.message or new chat.message with binary fields for photo/video, links for payments).
- **Analyst**: Define data flows for rich content (HTML → rendered), media metadata (type, url, caption), wallet transactions (from/to, amount, status).
- **Admin**: Seed sample rich app data, media examples, test wallet users; configure access.
- **Developer**: Implement media upload endpoints, rich content storage, transaction logging in Odoo (businessite.voice.message or dedicated model).
### System Layer
- **Architect**: Central chat service with layer routing, media handling, payment/wallet integration points.
- **Analyst**: Workflow for "take photo" → capture → upload → attach to message/product/shop; payment link generation.
- **Admin**: Set up crons for media processing, payment reminders; monitor hybrid networking for media transfers.
- **Developer**: Dart camera integration in chat (commands trigger CameraController), upload via OdooService, render in bubbles; backend _get_chatbot_response + new endpoints for media/payment.
### User Layer
- **Architect**: Chat-first UX: natural commands ("take selfie for my shop", "record video advert", "send 100 to supplier"), rich bubbles, media preview.
- **Analyst**: User stories per layer (shop owner posts product with photo/video, support shares invoice link, business transfers funds).
- **Admin**: Onboard users to media features; create sample shops/products for testing; train on wallet commands.
- **Developer**: UI for capture (selfie mode, video recording with preview), send as chat message; display rich HTML (b>
• etc.) using RichText or html widget; wallet UI scaffold (amount, recipient, send button → backend stub).
### Security Layer
- **Architect**: Media privacy (only to intended recipients/layers), payment auth (wallet balance, KYC for transfers), consent for capture.
- **Analyst**: Risks: media abuse, payment fraud, profile data in rich posts; compliance for financials.
- **Admin**: Groups/ACL for who can send/receive media/payments; audit logs; review grants for paid apps.
- **Developer**: Permission checks before capture/upload; secure upload (auth required); sign/validate payment links; integrate with existing subscription fee checks.
### App Layer
- **Architect**: Chat as app hub + financial layer: rich app cards, in-chat product posting, wallet transfers as first-class messages.
- **Analyst**: App-specific data (shop products with media, advert videos), integration with mobile publish + fees.
- **Admin**: Publish apps with fees; manage wallet feature flags; seed demo shops/adverts.
- **Developer**: Commands in chat_screen: if (lower.contains('take picture') || lower.contains('take selfie')) _captureAndSend(isVideo: false, selfie: ...); similar for video. Extend _showAvailableApps to support rich rendering. Add _handleWalletCommand for "share payment", "transfer". Backend support for attachments in chat_message.
## Dependencies
- Camera plugin (already in pubspec).
- Existing Odoo chat (chat.py, voice.message), mobile.app (fees), client models.
- Hybrid networking for media when offline.
- Payment subsystem (Payfast, SCode, platform billing) + future wallet model.
## Success Criteria
- "show apps" renders rich HTML descriptions (bold, bullets, no raw tags) in nice bubbles/cards.
- User can say "take picture for my shop", capture, post as product/advert.
- "record video advert" works similarly.
- "send 50 to @supplier" or "share payment link for SchoolLMS" creates link/transfer (scaffolded now, full in financial phase).
- Homepage feels complete with chat at center.
- All 4 layers experience unified chat UX.
- UAT steps cover media capture, rich rendering, wallet commands.
## Further Reading
- UAT for Chat & Mobile features
- Phase 1 (Core/SLUG), Phase 6 (UAT)
- Mobile publish + fee support
- Existing chat and voice_message models
- Roadmap teaser on homepage
## Detailed Tasks by Layer and Role (for full implementation)
### Data Layer
- **Architect**: Extend or design `voice.message` / new `businessite.chat.message` + attachment models: add Binary fields (or ir.attachment links) for photo/video, mime_type, thumbnail, caption, linked_resource (shop_id/product_id/advert_id), sender_layer. Support storing original rich HTML + rendered version for descriptions and posts.
- **Analyst**: Define schemas, validation (size limits on media <10MB for chat, sanitize rich HTML to allowed tags only), audit fields for wallet tx (from_user, to_user, amount, status, ref). Map how app.description (Html) flows to mobile catalog JSON without escaping loss.
- **Admin**: Seed demo data: 2-3 rich app descriptions with ,
, - ; sample business clients with shops; test users for wallet (balances stubbed); UAT steps for "take picture for shop", "record video advert".
- **Developer**: Implement storage logic in Odoo (binary upload endpoints or reuse attachment for chat media); ensure to_catalog_dict and /api send full HTML description; add fields for price_note rich if needed; create/attach media messages to user business profile.
### System Layer
- **Architect**: Central chat router in chat.py + Dart _sendTextMessage: command detection for media ("take picture|selfie", "record video"), wallet ("send|transfer|share payment|pay .* to"), rich content types. Media service + upload queue + hybrid sync for large binaries. Hooks for future wallet model.
- **Analyst**: Detail end-to-end workflows: voice/text -> parse -> capture (client camera) -> upload (auth'd POST) -> store -> render in bubbles (cross layer). Error paths (no cam perm, no net, large video), progress for uploads, offline queue. Payment link generation stub.
- **Admin**: Configure storage paths / filestore limits for chat media; set feature flags for wallet (off until financial phase); cron for cleanup temp captures; monitor direct vs mesh for media transfers; add UAT feature records for chat-media + wallet-scaffold.
- **Developer**: Backend: add routes e.g. /businessite/chat/upload_media (auth), /businessite/wallet/link (stub). Dart: AppInstallService + new MediaCaptureService or inline; update OdooService for media posts; progress single-bubble for media too; integrate layer from profile.
### User Layer
- **Architect**: Chat-first UX spec: input bar + commands trigger modal capture (front/back cam toggle, photo vs video record with timer/preview); bubbles show rich formatted text (bold, bullets, linebreaks) + embedded media thumbnails with caption + "use for my shop" quick reply. Wallet flow: form in chat or quick replies for amount/recipient.
- **Analyst**: Write user stories: "As shop owner, I say 'take selfie for my shop logo' in chat during register flow, capture, bot confirms 'Photo attached to pending shop'. As business, 'share payment link for SchoolLMS to @supplier' creates shareable link in chat. All layers see rich app cards without raw tags."
- **Admin**: Create demo scripts / UAT steps + sample shops/products; train core team on using capture for video adverts; publish sample rich descriptions via mobile app manager; enable wallet commands for test users (scaffold only).
- **Developer**: In chat_screen.dart: detect commands early in _sendTextMessage; implement _triggerMediaCapture({isVideo:false, selfie:false}) using camera + dialog with live preview + capture/record btns; on done _addMediaMessage(type, path, caption); extend VoiceMessageWidget for image (Image.file + caption), video (placeholder + info), rich text (via _buildRichText). Add quick actions after media: "Post as product photo", "Share video advert".
### Security Layer
- **Architect**: Media access model: only visible to intended chat participants or same business/layer as configured. Capture requires explicit user gesture + consent text. Wallet: balance checks, daily limits stub, signed links (HMAC or Odoo token), KYC flag before real transfers.
- **Analyst**: Threat model: photo/video abuse/spam, deepfake risks in future, payment fraud in wallet, HTML injection via rich descs (mitigate with allowlist sanitize on ingest). Privacy: media not public, GDPR-like for business users.
- **Admin**: Assign ACLs/groups: e.g. business users can capture for own shop; support can't send wallet tx on behalf. Review/audit logs for capture & proposed transfers. Toggle wallet in prod until financial services phase. Seed test cases for abuse flows in UAT.
- **Developer**: Permission checks before camera init (already using permission_handler); auth token on any media upload; sanitize HTML on backend before storage/display; wallet stubs verify "recipient exists in businessite users"; never allow unsigned payment links; gate commands behind logged profile.
### App Layer
- **Architect**: Position chat as the hub for all layers' business ops: app discovery with rich cards, in-chat media for shop registration + product posting + video adverts, wallet as precursor to full financial services (payment links, p2p transfers between users).
- **Analyst**: Specify app integration: when media captured in chat for business user, optional auto-create draft product/post or link to business_client; payment_link message type carries app_id + amount for "join"; track usage metrics (media per shop, wallet tx count).
- **Admin**: In mobile app manager, ensure all published apps have rich descriptions (features
etc) via the Html field; set requires_subscription + price fields for relevant apps; create demo video advert examples as attachments; flag "wallet beta" for early businesses.
- **Developer**: In chat: _handleMediaCommand and _handleWalletCommand; update _showAvailableApps to optionally send rich version of desc (beyond plain listText); for "take picture for my shop" capture + suggest next step text. Backend support in mobile_api + chat for attaching received media ids to products/shops when command extended. Scaffold message types: 'image','video','payment_link','wallet_tx'. Ensure "open X" and install flows remain unaffected.
All progress public. Every phase ships visible value. Ready for SLUG testing of chat + media + wallet flows. Capture commands enable shop owners to register/post without leaving chat. Rich renders correctly. Wallet scaffold ready for financial phase.