Built merchant management, activity history, and the pipeline
This commit is contained in:
@@ -39,10 +39,39 @@ A pre-upgrade development backup was saved locally at `/tmp/merchantflow-before-
|
||||
|
||||
Development smoke checks passed through both `localhost:5173` and `127.0.0.1:5173`: healthy database, successful login for all four accounts, 45 merchants for Head/Compliance, 20 for each manager, and 401 when reusing every revoked session. The API health check also passed directly on port 3001.
|
||||
|
||||
Visual inspection covered the completed approval-to-Live detail screen and the mobile Russian editor. Audit records are collapsed in merchant detail, with translated system labels; the complete history remains available.
|
||||
Visual inspection covered the completed approval-to-Live detail screen and the mobile Russian editor. The later daily-sales milestone brings these records together in the Activity tab, with translated system labels and complete history.
|
||||
|
||||
Existing dependency warnings are non-fatal: Zod/Rollup annotation placement and the Prisma PostgreSQL adapter's pg concurrent-query deprecation. All checks above passed despite these warnings.
|
||||
|
||||
## Public landing and lead intake · 24 September 2026
|
||||
|
||||
- [x] Original MerchantFlow consultation page with bold typography, lime accents, three benefits, onboarding steps, inline form and mobile staff login
|
||||
- [x] All seven required fields, localized countries, Other industry, shared validation and complete EN/RU feedback
|
||||
- [x] Public lead endpoint with trusted-Origin checks, bounded IP/email throttles and Retry-After
|
||||
- [x] Atomic unassigned New Lead creation, LANDING_PAGE source, four missing KYB items and system-attributed creation history
|
||||
- [x] Database-backed idempotency across concurrent requests and API restarts; changed-payload conflicts
|
||||
- [x] Keyboard/accessibility-excluded honeypot with indistinguishable acceptance and no database writes
|
||||
- [x] Preserved form values, stable retry keys, pending/success/validation/network/server/rate-limit states and accessible announcements
|
||||
|
||||
Verification: build, lint, typecheck and 13 unit tests passed. All 24 integration tests passed, including public creation, permission checks, parallel retries across two API instances, restart replay, honeypot rejection, throttling and injected transaction rollback. The six public API tests were rerun successfully after the final quota-reservation adjustment.
|
||||
|
||||
All 14 browser tests passed. Consultation coverage exercises EN/RU at 375px and 1440px, every submission state, keyboard focus, hidden honeypot, locale/value preservation, real persistence and a committed request with a deliberately lost response. Existing CRM journeys continue to pass at 390px and 1440px. Screenshots were visually inspected in both languages and sizes. Test-created leads are cleaned up only in the disposable test database; the reference website received no submissions.
|
||||
|
||||
The additive migration was applied to development. Before/after checksums confirmed all 45 existing merchants, 135 activities and 206 stage events remained unchanged. Prisma reports no schema difference, and the running web/API database health check passes. No development reseed or reset was performed.
|
||||
|
||||
## Boundaries
|
||||
|
||||
No staff registration, merchant creation/deletion UI, merchant portal, uploads, payment processing, external KYB service, external reminders or deployment. Login rate-limit buckets are intentionally in-process for this single-process local prototype. Seed dates are anchored once and naturally age; reruns do not refresh deadlines or rewrite existing edits.
|
||||
No staff registration, merchant deletion UI, merchant portal, uploads, payment processing, external KYB service, external reminders or deployment. Login rate-limit buckets are intentionally in-process for this single-process local prototype. Seed dates are anchored once and naturally age; reruns do not refresh deadlines or rewrite existing edits.
|
||||
|
||||
## Daily sales workspace
|
||||
|
||||
- [x] Staff lead creation with required company/contact/email, Head assignment and server-enforced Manager self-assignment
|
||||
- [x] Additive nullable-field migration with safe incomplete-lead rendering
|
||||
- [x] Scoped combined directory filters, URL persistence, pagination recovery and responsive contact information
|
||||
- [x] Shared workflow policy, Call/Email evidence, qualification completeness and explicit rejection permissions
|
||||
- [x] Typed actions/blockers on detail and pipeline; strict general edits and atomic version-checked mutations
|
||||
- [x] Unified chronological history with ownership identities, rejection reasons and preserved attribution
|
||||
- [x] URL-addressable detail tabs and single-stage mobile pipeline with explicit card actions
|
||||
- [x] Retained form values on failure, accessible controls and bilingual feedback
|
||||
|
||||
Verification: all 32 integration tests passed against the isolated PostgreSQL service, including role/stage rejection cases, filters, creation, races and injected transaction rollback. All 19 browser tests passed, covering EN/RU at mobile and desktop sizes, real API creation/filtering/history, pipeline progression and rejection, ownership isolation, stale-editor preservation and the existing compliance journeys. Build, lint, typecheck, 17 unit tests, formatting and whitespace checks passed. The additive sales migration was applied to development without a reset or reseed.
|
||||
|
||||
+13
-5
@@ -4,7 +4,7 @@ A local merchant-onboarding CRM for a fictional crypto-payment provider, with pe
|
||||
|
||||
## People and access
|
||||
|
||||
Four seeded staff accounts: Head of Sales, Compliance Officer, Alex Morgan and Sam Taylor. Head sees the portfolio and team activity, assigns/reassigns managers and manages commercial onboarding. Managers see and edit only assigned merchants and related commercial activities/tasks; they cannot change ownership. Compliance sees merchant context and KYB across the portfolio, records reviews and KYB notes, and manages personal compliance tasks. Compliance cannot edit commercial details, change ownership or activate merchants. Sales cannot issue or override compliance decisions. The Review Queue is Compliance-only.
|
||||
Four seeded staff accounts: Head of Sales, Compliance Officer, Alex Morgan and Sam Taylor. Head sees the portfolio and team activity, creates merchants, assigns/reassigns managers and manages commercial onboarding. Managers may create merchants assigned to themselves; Compliance cannot create merchants. Managers see and edit only assigned merchants and related commercial activities/tasks; they cannot change ownership. Compliance sees merchant context and KYB across the portfolio, records reviews and KYB notes, and manages personal compliance tasks. Compliance cannot edit commercial details, change ownership or activate merchants. Sales cannot issue or override compliance decisions. The Review Queue is Compliance-only.
|
||||
|
||||
NestJS authorization and database predicates apply to all reads, searches, counts, detail children, dashboards and mutations. A hidden resource returns 404; a forbidden action on a visible resource returns 403. The UI reflects server capabilities.
|
||||
|
||||
@@ -12,15 +12,23 @@ NestJS authorization and database predicates apply to all reads, searches, count
|
||||
|
||||
New Lead → Contacted → Qualified → KYB → Compliance Review → Integration → Testing → Live. Rejected is an alternate terminal outcome; neither Live nor Rejected has outgoing stage actions. The same merchant ID persists throughout.
|
||||
|
||||
Assignment is required before leaving New Lead. Sales collects the four KYB documents. All must have received-history evidence before submission creates a pending review. Reviewed company/KYB fields freeze during review. Compliance approval advances to Integration; rejection requires a reason; corrections require a reason and item-specific notes and return the merchant to KYB. Resubmission creates another review cycle. Decisions are immutable.
|
||||
Assignment is required before leaving New Lead and before entering KYB. Contacted requires a persisted call or email; a note or meeting does not qualify. Qualified requires company name, website, primary contact name/email, country, industry and estimated monthly volume (zero is valid). Head or the assigned Manager may reject New Lead, Contacted or Qualified with a reason. Only Head may close KYB, Integration or Testing for a recorded business reason; this preserves any compliance decision. Only Compliance can decide rejection during Compliance Review. Sales collects the four KYB documents. All must have received-history evidence before submission creates a pending review. Reviewed company/KYB fields freeze during review. Compliance approval advances to Integration; rejection requires a reason; corrections require a reason and item-specific notes and return the merchant to KYB. Resubmission creates another review cycle. Decisions are immutable.
|
||||
|
||||
Reviewed company identity, website, country, industry and KYB items remain locked after approval. Contact details, volume estimates, source and authorized ownership can change. Head or the assigned manager may advance Integration → Testing → Live only with matching approval/checklist evidence. Reassignment transfers open commercial tasks, preserving completed attribution and personal Compliance tasks.
|
||||
|
||||
## Journeys and records
|
||||
|
||||
Landing → email/password login → role-scoped dashboard → merchant search/filter → detail, editing, assignment, checklist, reviews, interactions, history and tasks. Pipeline, Tasks and Compliance Review Queue provide dedicated views. Tasks can be created, edited and completed from merchant details; reminders stay in the app.
|
||||
Landing → email/password login → role-scoped dashboard → merchant search/filter → detail, editing, assignment, checklist, reviews, interactions, history and tasks. The directory searches company, contact, email and website and combines stage, country, industry and authorized owner filters with eight-record pagination. Search/filter/page state is stored in the URL. Head and Compliance may filter by manager or Unassigned; Managers remain scoped to their own merchants. Desktop uses tables and pipeline columns; mobile uses directory cards and exactly one selected pipeline stage. Detail has URL-addressable Overview, Activity, Onboarding and Tasks tabs; Activity merges notes, interactions, ownership, stage events and compliance outcomes into one newest-first history. Explicit stage controls display server-derived blocking reasons. Pipeline, Tasks and Compliance Review Queue provide dedicated views. Tasks can be created, edited and completed from merchant details; reminders stay in the app.
|
||||
|
||||
Merchants include company and primary-contact details, website, country, industry, decimal USD volume estimates, source, nullable manager, stage, timestamps and a concurrency version. Related models retain activities, stage events, checklist changes, review snapshots and task attribution. Mutations and audit history commit atomically and reject stale versions.
|
||||
Staff creation requires company name, primary-contact name and email; website, country, industry and volume may be completed later. Merchants include company and primary-contact details, website, country, industry, decimal USD volume estimates, source, nullable manager, stage, timestamps and a concurrency version. Related models retain activities, stage events, checklist changes, review snapshots and task attribution. Mutations and audit history commit atomically and reject stale versions.
|
||||
|
||||
## Public lead intake
|
||||
|
||||
The public landing page introduces merchant crypto-payment onboarding in EN/RU with an inline consultation form. Company name, contact name, work email, website, country, industry and estimated monthly USD volume are required. Industries include Other; zero is a valid volume estimate. The staff-login link remains available on mobile.
|
||||
|
||||
`POST /api/public/leads` requires a trusted Origin and a UUID `Idempotency-Key`. Accepted submissions atomically create an unassigned New Lead with source `LANDING_PAGE`, four missing KYB items, an initial stage event and a system-attributed creation activity. Database uniqueness prevents duplicate records on retries, including concurrent requests and API restarts. A changed payload under the same key returns a conflict. Filled honeypots receive the same generic acceptance without creating records.
|
||||
|
||||
The endpoint validates on the server and uses bounded process-local IP/email limits. The form preserves inputs after errors, translates field feedback, announces submission states and respects Retry-After. Lead details remain in component memory; only language is stored in the browser. No external notifications are sent.
|
||||
|
||||
## Authentication and demo data
|
||||
|
||||
@@ -34,4 +42,4 @@ Seeding uses stable IDs, a stored date anchor and a version marker. It preserves
|
||||
|
||||
English is the default; EN/RU selection persists in browser storage. Dates use the selected locale and viewer's time zone. Names and notes remain verbatim; canonical status/role labels are translated. Retain the light neutral UI, lime accents, visible focus, touch-sized controls and reduced-motion support.
|
||||
|
||||
No merchant creation/deletion UI, staff registration, merchant self-service, real payments, external KYB integration, uploads, external notifications or deployment.
|
||||
No merchant deletion UI, staff registration, merchant self-service, real payments, external KYB integration, uploads, external notifications or deployment.
|
||||
|
||||
Reference in New Issue
Block a user