mirror of
https://github.com/multica-ai/multica.git
synced 2026-06-17 03:38:32 +02:00
* feat(feedback): add in-app feedback flow and Help launcher Replaces the duplicated bottom-sidebar user popover and "What's new" links with a single Help menu (Docs / Feedback / Change log) pinned to the sidebar footer. Feedback opens a rich-text modal that POSTs to a new /api/feedback endpoint; submissions land in a dedicated feedback table with per-user hourly rate limiting (10/hr) to deter spam without adding middleware infrastructure. User identity (avatar + name + email) moves into the workspace dropdown header so the sidebar is no longer visually redundant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(feedback): harden submit path and cap request body - Read editor markdown via ref at submit time instead of debounced state, so ⌘+Enter immediately after typing doesn't drop the last keystrokes. - Block submission while images are still uploading; toast prompts the user to wait instead of silently sending markdown with blob: URLs that get stripped. - Cap /api/feedback request body at 64 KiB via MaxBytesReader so an authenticated client can't bloat the metadata JSONB column with an oversized url field. - Add Go handler tests covering happy path, empty-message rejection, and the hourly rate limit boundary. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(analytics): instrument feedback funnel Adds two events pairing frontend intent with backend conversion so we can compute a completion rate for the in-app Feedback modal: - `feedback_opened` (frontend) — fires once on FeedbackModal mount. Source is currently always "help_menu" but the type is a union so future entry points have to extend it explicitly. Workspace id is attached when present. - `feedback_submitted` (backend) — fires from CreateFeedback after the DB insert succeeds and the hourly rate-limit check has passed. Message content itself is never sent to PostHog; the event carries a coarse length bucket (0-100 / 100-500 / 500-2000 / 2000+), an image-presence flag, and the client platform / version pulled from X-Client-* headers via middleware.ClientMetadataFromContext. Affects no existing funnel; seeds a new Feedback funnel for product triage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
/**
|
|
* Feedback funnel instrumentation.
|
|
*
|
|
* Pairs with the backend's `feedback_submitted` event (emitted from
|
|
* `CreateFeedback` after a successful insert) so we can compute a
|
|
* completion rate: users who open the modal → users who actually send.
|
|
* The message content itself is never sent to PostHog; see
|
|
* docs/analytics.md and the backend `FeedbackSubmitted` helper for the
|
|
* PII contract.
|
|
*/
|
|
|
|
import { captureEvent } from "./index";
|
|
|
|
/**
|
|
* Entry point the user took to reach the Feedback modal. Typed union so
|
|
* future surfaces (keyboard shortcut, error-toast CTA, sidebar menu
|
|
* item) have to extend this list explicitly rather than drift.
|
|
*/
|
|
export type FeedbackOpenedSource = "help_menu";
|
|
|
|
/**
|
|
* Fires once on FeedbackModal mount. Workspace id is attached when the
|
|
* modal opens inside a workspace; pre-workspace surfaces (e.g. inbox,
|
|
* onboarding transitions) omit it rather than sending an empty string.
|
|
*/
|
|
export function captureFeedbackOpened(
|
|
source: FeedbackOpenedSource,
|
|
workspaceId?: string,
|
|
): void {
|
|
captureEvent("feedback_opened", {
|
|
source,
|
|
...(workspaceId ? { workspace_id: workspaceId } : {}),
|
|
});
|
|
}
|