Skip to content

feat: documentation feedback widget (PRDCT-346)#1003

Open
Iamfle4ka wants to merge 2 commits into
mainfrom
feat/PRDCT-346-docs-feedback
Open

feat: documentation feedback widget (PRDCT-346)#1003
Iamfle4ka wants to merge 2 commits into
mainfrom
feat/PRDCT-346-docs-feedback

Conversation

@Iamfle4ka

Copy link
Copy Markdown
Collaborator

Closes PRDCT-346.

Problem

The docs give users no real way to convey useful feedback — the new Astro site renders no feedback widget at all (only orphaned .b-feedback CSS remained; the "Yes/No" in the ticket screenshot was the old Jekyll site).

What this adds

A "Was this page helpful? 👍 / 👎" widget below content on every docs page:

  • A thumb click reveals a short follow-up — reason chips (👎: Inaccurate · Hard to follow · Missing info · Outdated; 👍: Clear · Accurate · Good example) + an optional comment (max 1000 chars, "don't include personal info" hint) + Submit → "Thanks 🙏".
  • One row per interaction: Submit sends the full row; a thumb without submit is captured on pagehide / astro:before-swap via navigator.sendBeacon, so the core signal is never lost.
  • localStorage collapses the widget to the thank-you on revisit (soft anti-nag, not auth).

Files

  • src/components/Feedback.astro — markup + view-transition-safe client script (inits on astro:page-load, matching AskKaiDrawer). Path/title read client-side, so it's override-agnostic.
  • src/components/Footer.astro — renders <Feedback /> once per page.
  • src/styles/custom.css — extends the existing .b-feedback styles (chips, comment, submit, thanks) + honeypot & sr-only helpers. CSS only, per repo rule.
  • api/feedback.ts — mirrors api/chat.ts: JSON POST, permissive CORS, GET {enabled} probe, honeypot + length caps + reason allow-list, no PII/cookies/login. Forwards a flat record to a configurable ingest endpoint (FEEDBACK_INGEST_URL / FEEDBACK_INGEST_TOKEN). Stubs (logs + 204) when env is unset, like chat.ts, so it ships before the backend exists.

Backend / ops (one follow-up)

Point FEEDBACK_INGEST_URL at a Keboola Data Stream (recommended — row-level JSON → Storage table) and set the target bucket/table. The function is mechanism-agnostic, so this is a config change, not a code change. Until then it runs in stub mode (submissions logged in Vercel).

Data captured

submission_id, verdict, reason, comment, path, title, locale, referrer, user_agent, abandoned, ts. Anonymous; no cookies; honeypot + caps for spam.

Verification (local production build)

  • npm run build clean; widget present on all 258 pages, exactly one per page.
  • Handler unit tests (validation branches) + end-to-end harness (GET probe, OPTIONS/CORS, 405 guard, valid→204 stub, honeypot→204, invalid verdict→204, bad JSON→400) all pass.
  • ⏳ Not yet exercised against a live Data Stream (needs the env/bucket) — stub verified.

Open decisions (defaults chosen; easy to change)

  • UX = thumbs + progressive follow-up (vs. always-on chips / stars).
  • Ingestion = Data Stream (vs. async CSV import).

🤖 Generated with Claude Code

Adds a "Was this page helpful? 👍/👎" widget on every docs page. A thumb click
reveals a short follow-up (reason chips + optional comment); submissions POST to
a new api/feedback.ts Vercel function. A thumb without submit is still captured
on pagehide via navigator.sendBeacon so the core signal isn't lost.

- src/components/Feedback.astro — widget markup + view-transition-safe client
  script (inits on astro:page-load); path/title read client-side.
- src/components/Footer.astro — render <Feedback /> once per page.
- src/styles/custom.css — extend the existing (previously orphaned) .b-feedback
  styles with chips/comment/submit/thanks + honeypot & sr-only helpers.
- api/feedback.ts — mirrors api/chat.ts: JSON POST, CORS, GET {enabled} probe,
  honeypot + length caps + reason allow-list; forwards a flat record to a
  configurable ingest endpoint (FEEDBACK_INGEST_URL / _TOKEN, intended to be a
  Keboola Data Stream → Storage table). Stubs (logs + 204) when env is unset,
  like chat.ts, so it ships before the stream exists.

Verified: build clean; widget on all 258 pages; handler unit + end-to-end
harness pass (probe/CORS/method-guard/honeypot/invalid-drop/bad-JSON/stub).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 8, 2026

Copy link
Copy Markdown

PRDCT-346

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
connection-docs Ready Ready Preview, Comment Jul 8, 2026 9:48pm

Request Review

Rework the widget to match Stripe's docs feedback UX:
- 👍/👎 → a heading ("What did you like?" / "What could be better?") + a
  vertical radio list (label + description), Submit disabled until a choice.
- Selecting a reason reveals the optional comment box inline right under that
  option (not a fixed spot).
- Submit replaces the whole widget with a borderless big
  "Thank you for helping improve Keboola's documentation!".
- Borderless card (hairline top divider only), outline Submit, native radios
  tinted with accent-color.

Reason keys updated to the Stripe set; api/feedback.ts allow-list kept in sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant