Repository navigation
Closed
Description
Summary
#79 ships the report-issue modal with its submit stubbed to an alert();
sydevs/SahajCloud#602 adds the shared POST /api/contact-admin. This connects
them: send the real request, parse the response, and give the viewer honest
success and failure states.
Blocked by #79 and sydevs/SahajCloud#602 — start once the endpoint is
deployed.
Proposed changes
- Add
contactAdmintosrc/config/api/mutate.ts, posting to/contact-admin
via the sharedrequestJsonhelper (a custom, non-CRUD endpoint — same shape
ascreateRegistration) withsubject: 'Issue report', parsing the response
through aContactResponseSchemaper.claude/rules/data-layer.md. - Replace the
TODOalert inReportIssueFormwith a TanStackuseMutation,
mirroringRegistrationForm's pending / error / thank-you states. - On failure show an inline
Alertand keep the typed message so nothing is
lost; on a captcha rejection (403) reset the Turnstile widget so the viewer can
retry without reopening the modal. - Point
VITE_TURNSTILE_SITE_KEYat the real production site key (Cloudflare
dashboard) and document it in.claude/docs/environment.md; keep the test key
for dev / Ladle / CI. - Refresh the CMS contract (
pnpm types:cms,pnpm types:openapi) so the
endpoint's response type is in sync.
Acceptance criteria
- Submitting the form posts to
/api/contact-adminwith the client API key
attached by the shared request context — no ad-hoc auth handling - A successful report shows the thank-you state, and an email actually
arrives at[email protected](verified once against the deployed
backend) - A server error shows an inline error, keeps the typed message, and allows a
retry; a 403 (captcha) resets the Turnstile widget in place - The temporary
alert()and its TODO are gone - Error / success strings exist in every locale
- Lint + typecheck +
pnpm test:runpass; the mutation is covered by a unit
test with the request layer mocked
Files affected
src/config/api/mutate.ts,src/types/report.tssrc/components/organisms/ReportIssueForm/ReportIssueForm.tsx.env,.claude/docs/environment.md,public/locales/*/common.json
References
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Hold Until
None yet
Activity
feat(widget): add a report-issue modal with turnstile captcha (#81)
fix(security): close the href and cache gaps /security-review found
fix(security): close the href and cache gaps /security-review found
feat(widget): classify errors, and make every empty screen recoverable (