@fatagnus/convex-feedback 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +346 -4
- package/dist/index.d.ts +17 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/react/BugReportButton.d.ts.map +1 -1
- package/dist/react/BugReportButton.js +7 -3
- package/dist/react/BugReportButton.js.map +1 -1
- package/package.json +12 -5
- package/src/convex/_generated/api.ts +2923 -0
- package/src/convex/_generated/component.ts +892 -0
- package/src/convex/_generated/dataModel.ts +60 -0
- package/src/convex/_generated/server.ts +161 -0
- package/src/convex/agents/bugReportAgent.ts +37 -3
- package/src/convex/agents/feedbackAgent.ts +37 -3
- package/src/convex/agents/feedbackInterviewAgent.ts +6 -12
- package/src/convex/agents/index.ts +12 -5
- package/src/convex/apiKeys.test.ts +79 -0
- package/src/convex/apiKeys.ts +223 -0
- package/src/convex/bugReports.ts +148 -9
- package/src/convex/emails/bugReportEmails.ts +6 -3
- package/src/convex/emails/feedbackEmails.ts +6 -3
- package/src/convex/feedback.ts +155 -8
- package/src/convex/http.test.ts +76 -0
- package/src/convex/http.ts +630 -0
- package/src/convex/index.ts +11 -0
- package/src/convex/prompts.test.ts +185 -0
- package/src/convex/prompts.ts +605 -0
- package/src/convex/schema.ts +52 -2
- package/src/convex/ticketNumbers.ts +4 -0
- package/src/convex/tsconfig.json +24 -0
- package/src/index.ts +49 -1
- package/src/types.ts +38 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
/* This TypeScript project config describes the environment that
|
|
3
|
+
* Convex functions run in and is used for typechecking.
|
|
4
|
+
* You can modify it, but some settings required to use Convex
|
|
5
|
+
* cannot be changed.
|
|
6
|
+
*/
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
/* Defaults from Convex */
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"lib": ["ES2021", "dom"],
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"strict": false,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"noErrorTruncation": true,
|
|
16
|
+
|
|
17
|
+
/* Required for bundler-style imports */
|
|
18
|
+
"moduleResolution": "Bundler",
|
|
19
|
+
"module": "ESNext",
|
|
20
|
+
"isolatedModules": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["./**/*"],
|
|
23
|
+
"exclude": ["node_modules"]
|
|
24
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,45 @@
|
|
|
22
22
|
* export default app;
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* 2.
|
|
25
|
+
* 2. Register HTTP routes in your `convex/http.ts` (optional, for ticket API):
|
|
26
|
+
*
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { httpRouter } from "convex/server";
|
|
29
|
+
* import { registerFeedbackRoutes } from "@convex-dev/feedback";
|
|
30
|
+
*
|
|
31
|
+
* const http = httpRouter();
|
|
32
|
+
*
|
|
33
|
+
* // Register feedback API routes
|
|
34
|
+
* registerFeedbackRoutes(http, { pathPrefix: "/feedback" });
|
|
35
|
+
*
|
|
36
|
+
* // Your other routes...
|
|
37
|
+
* export default http;
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* This registers these endpoints:
|
|
41
|
+
* - GET /feedback/api/prompt/{ticketNumber} - Fetch AI prompt
|
|
42
|
+
* - GET /feedback/api/items - List items
|
|
43
|
+
* - GET /feedback/api/items/{ticketNumber} - Get single item
|
|
44
|
+
* - PATCH /feedback/api/items/{ticketNumber}/status - Update status
|
|
45
|
+
* - PATCH /feedback/api/items/{ticketNumber}/archive - Archive/unarchive
|
|
46
|
+
*
|
|
47
|
+
* 3. Pass API keys when creating bug reports/feedback:
|
|
48
|
+
*
|
|
49
|
+
* **Important:** Convex components don't inherit environment variables from the
|
|
50
|
+
* parent app. You must pass the API keys when calling the component's create
|
|
51
|
+
* mutations:
|
|
52
|
+
*
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // In your parent app wrapper function:
|
|
55
|
+
* await ctx.runMutation(components.feedback.bugReports.create, {
|
|
56
|
+
* ...args,
|
|
57
|
+
* openRouterApiKey: process.env.OPENROUTER_API_KEY,
|
|
58
|
+
* resendApiKey: process.env.RESEND_API_KEY,
|
|
59
|
+
* resendFromEmail: process.env.RESEND_FROM_EMAIL,
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* The following environment variables should be set in your Convex dashboard:
|
|
26
64
|
* - `OPENROUTER_API_KEY` - For AI analysis (optional)
|
|
27
65
|
* - `RESEND_API_KEY` - For email notifications (optional)
|
|
28
66
|
* - `RESEND_FROM_EMAIL` - From address for emails (optional)
|
|
@@ -124,12 +162,22 @@ export type FeedbackPriority = 'nice_to_have' | 'important' | 'critical';
|
|
|
124
162
|
export type FeedbackStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
|
|
125
163
|
export type ReporterType = 'staff' | 'customer';
|
|
126
164
|
export type Effort = 'low' | 'medium' | 'high';
|
|
165
|
+
export type CounterType = 'bug' | 'feedback';
|
|
166
|
+
export type PromptTemplate = 'fix' | 'implement' | 'analyze' | 'codebuff';
|
|
167
|
+
|
|
168
|
+
// Re-export HTTP registration helper
|
|
169
|
+
export { registerFeedbackRoutes } from './convex/http';
|
|
170
|
+
|
|
171
|
+
// Re-export HTTP options type from types
|
|
172
|
+
export type { RegisterFeedbackRoutesOptions } from './types';
|
|
127
173
|
|
|
128
174
|
// Export document types
|
|
129
175
|
export type {
|
|
130
176
|
BugReport,
|
|
131
177
|
Feedback,
|
|
132
178
|
SupportTeam,
|
|
179
|
+
ApiKey,
|
|
180
|
+
ApiKeyCreated,
|
|
133
181
|
// Interview types
|
|
134
182
|
InterviewContext,
|
|
135
183
|
FeatureArea,
|
package/src/types.ts
CHANGED
|
@@ -171,6 +171,7 @@ export interface InterviewState {
|
|
|
171
171
|
export interface BugReport {
|
|
172
172
|
_id: string;
|
|
173
173
|
_creationTime: number;
|
|
174
|
+
ticketNumber?: string;
|
|
174
175
|
title: string;
|
|
175
176
|
description: string;
|
|
176
177
|
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
@@ -208,6 +209,7 @@ export interface BugReport {
|
|
|
208
209
|
export interface Feedback {
|
|
209
210
|
_id: string;
|
|
210
211
|
_creationTime: number;
|
|
212
|
+
ticketNumber?: string;
|
|
211
213
|
type: 'feature_request' | 'change_request' | 'general';
|
|
212
214
|
title: string;
|
|
213
215
|
description: string;
|
|
@@ -239,6 +241,31 @@ export interface Feedback {
|
|
|
239
241
|
updatedAt: number;
|
|
240
242
|
}
|
|
241
243
|
|
|
244
|
+
/**
|
|
245
|
+
* API Key document type (without the actual key)
|
|
246
|
+
*/
|
|
247
|
+
export interface ApiKey {
|
|
248
|
+
_id: string;
|
|
249
|
+
keyPrefix: string;
|
|
250
|
+
name: string;
|
|
251
|
+
expiresAt?: number;
|
|
252
|
+
isRevoked: boolean;
|
|
253
|
+
revokedAt?: number;
|
|
254
|
+
createdAt: number;
|
|
255
|
+
isExpired: boolean;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* API Key creation result (includes the full key)
|
|
260
|
+
*/
|
|
261
|
+
export interface ApiKeyCreated {
|
|
262
|
+
key: string;
|
|
263
|
+
keyPrefix: string;
|
|
264
|
+
name: string;
|
|
265
|
+
expiresAt: number | null;
|
|
266
|
+
createdAt: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
242
269
|
/**
|
|
243
270
|
* Support team document type
|
|
244
271
|
*/
|
|
@@ -253,3 +280,14 @@ export interface SupportTeam {
|
|
|
253
280
|
createdAt: number;
|
|
254
281
|
updatedAt: number;
|
|
255
282
|
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Options for registering feedback HTTP routes
|
|
286
|
+
*/
|
|
287
|
+
export interface RegisterFeedbackRoutesOptions {
|
|
288
|
+
/**
|
|
289
|
+
* Optional path prefix for all routes (e.g., "/feedback" -> "/feedback/api/items")
|
|
290
|
+
* Default: "" (no prefix)
|
|
291
|
+
*/
|
|
292
|
+
pathPrefix?: string;
|
|
293
|
+
}
|