/** * @convex-dev/feedback * * Bug reports and feedback collection component for Convex applications. * * ## Installation * * ```bash * npm install @convex-dev/feedback * ``` * * ## Setup * * 1. Add the component to your `convex/convex.config.ts`: * * ```typescript * import { defineApp } from "convex/server"; * import feedback from "@convex-dev/feedback/convex.config"; * * const app = defineApp(); * app.use(feedback); * export default app; * ``` * * 2. Register HTTP routes in your `convex/http.ts` (optional, for ticket API): * * ```typescript * import { httpRouter } from "convex/server"; * import { registerFeedbackRoutes } from "@convex-dev/feedback"; * * const http = httpRouter(); * * // Register feedback API routes * registerFeedbackRoutes(http, { pathPrefix: "/feedback" }); * * // Your other routes... * export default http; * ``` * * This registers these endpoints: * - GET /feedback/api/prompt/{ticketNumber} - Fetch AI prompt * - GET /feedback/api/items - List items * - GET /feedback/api/items/{ticketNumber} - Get single item * - PATCH /feedback/api/items/{ticketNumber}/status - Update status * - PATCH /feedback/api/items/{ticketNumber}/archive - Archive/unarchive * * 3. Pass API keys when creating bug reports/feedback: * * **Important:** Convex components don't inherit environment variables from the * parent app. You must pass the API keys when calling the component's create * mutations: * * ```typescript * // In your parent app wrapper function: * await ctx.runMutation(components.feedback.bugReports.create, { * ...args, * openRouterApiKey: process.env.OPENROUTER_API_KEY, * resendApiKey: process.env.RESEND_API_KEY, * resendFromEmail: process.env.RESEND_FROM_EMAIL, * }); * ``` * * The following environment variables should be set in your Convex dashboard: * - `OPENROUTER_API_KEY` - For AI analysis (optional) * - `RESEND_API_KEY` - For email notifications (optional) * - `RESEND_FROM_EMAIL` - From address for emails (optional) * * ## Usage * * ### Convex Functions * * The component exposes these functions through `api.feedback`: * * - `api.feedback.bugReports.create` - Create a bug report * - `api.feedback.bugReports.list` - List bug reports * - `api.feedback.bugReports.get` - Get a bug report by ID * - `api.feedback.bugReports.updateStatus` - Update bug report status * - `api.feedback.bugReports.archive` - Archive a bug report * - `api.feedback.bugReports.unarchive` - Unarchive a bug report * * - `api.feedback.feedback.create` - Create feedback * - `api.feedback.feedback.list` - List feedback * - `api.feedback.feedback.get` - Get feedback by ID * - `api.feedback.feedback.updateStatus` - Update feedback status * * - `api.feedback.supportTeams.list` - List support teams * - `api.feedback.supportTeams.create` - Create a support team * - `api.feedback.supportTeams.update` - Update a support team * * ### React Components * * Import from `@convex-dev/feedback/react`: * * ```tsx * import { BugReportProvider, BugReportButton } from '@convex-dev/feedback/react'; * ``` * * ### AI Interview Mode * * Enable AI-powered interviews to help users articulate their bug reports * and feedback through a conversational experience: * * ```tsx * import { BugReportButton } from '@convex-dev/feedback/react'; * import { api } from './convex/_generated/api'; * * function App() { * return ( * * ); * } * ``` * * @module */ // Type definitions export type BugSeverity = 'low' | 'medium' | 'high' | 'critical'; export type BugStatus = 'open' | 'in-progress' | 'resolved' | 'closed'; export type FeedbackType = 'feature_request' | 'change_request' | 'general'; export type FeedbackPriority = 'nice_to_have' | 'important' | 'critical'; export type FeedbackStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined'; export type ReporterType = 'staff' | 'customer'; export type Effort = 'low' | 'medium' | 'high'; export type CounterType = 'bug' | 'feedback'; export type PromptTemplate = 'fix' | 'implement' | 'analyze' | 'codebuff'; // Re-export HTTP registration helper export { registerFeedbackRoutes } from './convex/http'; // Re-export HTTP options type from types export type { RegisterFeedbackRoutesOptions } from './types'; // Export document types export type { BugReport, Feedback, SupportTeam, ApiKey, ApiKeyCreated, // Interview types InterviewContext, FeatureArea, KnownIssue, CustomQuestions, InputRequestStatus, InputType, InputOption, InputField, InputConfig, InputRequest, MessageRole, InterviewMessage, GeneratedReport, InterviewState, } from './types';