feat(partner): partner portal foundation (#49) #152

Merged
amiryahaya merged 14 commits from feat/partner-portal-49 into main 2026-11-03 15:45:14 +01:00
Owner

Closes part of #49: the partner (tour operator) portal foundation in web/apps/partner, on top of the existing orgs API, plus a small API addition.

What is in it

  • Sign-in and entry routing (OIDC PKCE via @kws/auth, dev client kws-partner-web, port 5175). / sends a user to their organization (last used), their open registration, a "suspended" or "verify your email" message, or the registration form.
  • Company registration (Kenya only: county and city picker, phone to E.164, required documents block submit) and the application status page (history, documents, upload of missing ones, rejection remarks).
  • Portal shell: KWS colours, menu by permission in the organization, organization switcher with 2+ organizations, account menu, responsive for phone, tablet and desktop. An empty wallet slot is left for later.
  • Users and invitations: list, invite, change roles, remove; pending invitations; the last-administrator 409; the accept invitation page (/invitations#<token>, the token only in the POST body).
  • Organization page: read view for every member; an administrator edits contact person, designation, email, phone and address, which applies at once. The name and type cannot change.
  • API: GET|PUT /v1/orgs/{id} (orgs.Editor, details_updated log row, Kenya-only city check), OpenAPI and contract test.
  • E2E: a partner Playwright suite in scripts/web-e2e.sh and CI artifacts.

Payment is left out, as agreed. The wallet comes later.

Checks

  • make cover: 91.5 % total (minimum 80 %).
  • make lint 0 issues; make contract ok.
  • Web: pnpm typecheck && pnpm test: ui 52, auth 45, partner 91, ticket 304, admin 436, all pass.
  • scripts/web-e2e.sh: ticket 207, admin 140, partner 25, all pass.
  • Dual review: Ponytail (0 Must fix; the one Should fix is fixed) and an Opus correctness review (0 Critical; Important 1-3 fixed with tests, 4-5 below).

Questions for the owner

  1. Invited member of a disabled organization. Such a member has no grants and is not the registrant, so the portal sends them to the registration form, not to "suspended". Fixing this needs a small /v1/me signal. Should I add it?
  2. Documents on the Organization page. The design says "documents listed read-only", but GET /v1/orgs/{id} returns no documents. The registrant still sees them on /registration/:id. Should I add the documents (an API and spec change) in a follow-up?

Known limits (accepted for now)

  • Over HTTP, an administrator of a disabled organization gets 403, because grants of non-active organizations resolve to none. 409 organization_not_active happens only inside the 30 s grant-cache window.
  • Right after approval, other nodes can show "suspended" for up to 30 s, and so can a registrant removed from the members.
  • The accept page shows "verify your email" on a 403 from a deactivated user. The account menu does not close on Escape. An inactive city shows as "—". A PUT with an unknown city_id is not tested.
  • Invitations list only the first 50 (a shortcut: comment marks this).

🤖 Generated with Claude Code

Closes part of #49: the partner (tour operator) portal foundation in `web/apps/partner`, on top of the existing orgs API, plus a small API addition. ## What is in it - **Sign-in and entry routing** (OIDC PKCE via `@kws/auth`, dev client `kws-partner-web`, port 5175). `/` sends a user to their organization (last used), their open registration, a "suspended" or "verify your email" message, or the registration form. - **Company registration** (Kenya only: county and city picker, phone to E.164, required documents block submit) and the **application status page** (history, documents, upload of missing ones, rejection remarks). - **Portal shell**: KWS colours, menu by permission in the organization, organization switcher with 2+ organizations, account menu, responsive for phone, tablet and desktop. An empty wallet slot is left for later. - **Users and invitations**: list, invite, change roles, remove; pending invitations; the last-administrator 409; the **accept invitation** page (`/invitations#<token>`, the token only in the POST body). - **Organization page**: read view for every member; an administrator edits contact person, designation, email, phone and address, which applies at once. The name and type cannot change. - **API**: `GET|PUT /v1/orgs/{id}` (`orgs.Editor`, `details_updated` log row, Kenya-only city check), OpenAPI and contract test. - **E2E**: a partner Playwright suite in `scripts/web-e2e.sh` and CI artifacts. Payment is left out, as agreed. The wallet comes later. ## Checks - `make cover`: **91.5 %** total (minimum 80 %). - `make lint` 0 issues; `make contract` ok. - Web: `pnpm typecheck && pnpm test`: ui 52, auth 45, partner 91, ticket 304, admin 436, all pass. - `scripts/web-e2e.sh`: ticket 207, admin 140, partner 25, all pass. - Dual review: Ponytail (0 Must fix; the one Should fix is fixed) and an Opus correctness review (0 Critical; Important 1-3 fixed with tests, 4-5 below). ## Questions for the owner 1. **Invited member of a disabled organization.** Such a member has no grants and is not the registrant, so the portal sends them to the registration form, not to "suspended". Fixing this needs a small `/v1/me` signal. Should I add it? 2. **Documents on the Organization page.** The design says "documents listed read-only", but `GET /v1/orgs/{id}` returns no documents. The registrant still sees them on `/registration/:id`. Should I add the documents (an API and spec change) in a follow-up? ## Known limits (accepted for now) - Over HTTP, an administrator of a **disabled** organization gets 403, because grants of non-active organizations resolve to none. `409 organization_not_active` happens only inside the 30 s grant-cache window. - Right after approval, other nodes can show "suspended" for up to 30 s, and so can a registrant removed from the members. - The accept page shows "verify your email" on a 403 from a deactivated user. The account menu does not close on Escape. An inactive city shows as "—". A PUT with an unknown `city_id` is not tested. - Invitations list only the first 50 (a `shortcut:` comment marks this). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clerks hold no users.view, so the entry, the switcher and the bare
organization path now land on the first visible menu entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(partner): retry failed uploads, honest cancel, reload after a stale save, latest remark (#49)
All checks were successful
ci / changes (pull_request) Successful in 16s
ci / clients (pull_request) Successful in 1m55s
ci / web (pull_request) Successful in 8m50s
ci / api (pull_request) Successful in 11m29s
ci / ci-gate (pull_request) Successful in 2s
8fb0da2d7d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws!152
No description provided.