@fatagnus/convex-feedback 0.1.0
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/LICENSE +177 -0
- package/README.md +382 -0
- package/dist/convex/agents/bugReportAgent.d.ts +30 -0
- package/dist/convex/agents/bugReportAgent.d.ts.map +1 -0
- package/dist/convex/agents/bugReportAgent.js +243 -0
- package/dist/convex/agents/bugReportAgent.js.map +1 -0
- package/dist/convex/agents/feedbackAgent.d.ts +29 -0
- package/dist/convex/agents/feedbackAgent.d.ts.map +1 -0
- package/dist/convex/agents/feedbackAgent.js +232 -0
- package/dist/convex/agents/feedbackAgent.js.map +1 -0
- package/dist/convex/bugReports.d.ts +49 -0
- package/dist/convex/bugReports.d.ts.map +1 -0
- package/dist/convex/bugReports.js +321 -0
- package/dist/convex/bugReports.js.map +1 -0
- package/dist/convex/convex.config.d.ts +3 -0
- package/dist/convex/convex.config.d.ts.map +1 -0
- package/dist/convex/convex.config.js +6 -0
- package/dist/convex/convex.config.js.map +1 -0
- package/dist/convex/emails/bugReportEmails.d.ts +16 -0
- package/dist/convex/emails/bugReportEmails.d.ts.map +1 -0
- package/dist/convex/emails/bugReportEmails.js +403 -0
- package/dist/convex/emails/bugReportEmails.js.map +1 -0
- package/dist/convex/emails/feedbackEmails.d.ts +16 -0
- package/dist/convex/emails/feedbackEmails.d.ts.map +1 -0
- package/dist/convex/emails/feedbackEmails.js +389 -0
- package/dist/convex/emails/feedbackEmails.js.map +1 -0
- package/dist/convex/feedback.d.ts +49 -0
- package/dist/convex/feedback.d.ts.map +1 -0
- package/dist/convex/feedback.js +327 -0
- package/dist/convex/feedback.js.map +1 -0
- package/dist/convex/index.d.ts +10 -0
- package/dist/convex/index.d.ts.map +1 -0
- package/dist/convex/index.js +12 -0
- package/dist/convex/index.js.map +1 -0
- package/dist/convex/schema.d.ts +200 -0
- package/dist/convex/schema.d.ts.map +1 -0
- package/dist/convex/schema.js +150 -0
- package/dist/convex/schema.js.map +1 -0
- package/dist/convex/supportTeams.d.ts +29 -0
- package/dist/convex/supportTeams.d.ts.map +1 -0
- package/dist/convex/supportTeams.js +159 -0
- package/dist/convex/supportTeams.js.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/react/BugReportButton.d.ts +70 -0
- package/dist/react/BugReportButton.d.ts.map +1 -0
- package/dist/react/BugReportButton.js +371 -0
- package/dist/react/BugReportButton.js.map +1 -0
- package/dist/react/BugReportContext.d.ts +59 -0
- package/dist/react/BugReportContext.d.ts.map +1 -0
- package/dist/react/BugReportContext.js +107 -0
- package/dist/react/BugReportContext.js.map +1 -0
- package/dist/react/index.d.ts +36 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +36 -0
- package/dist/react/index.js.map +1 -0
- package/dist/types.d.ts +89 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +101 -0
- package/src/convex/agents/bugReportAgent.ts +277 -0
- package/src/convex/agents/feedbackAgent.ts +264 -0
- package/src/convex/bugReports.ts +350 -0
- package/src/convex/convex.config.ts +7 -0
- package/src/convex/emails/bugReportEmails.ts +479 -0
- package/src/convex/emails/feedbackEmails.ts +465 -0
- package/src/convex/feedback.ts +356 -0
- package/src/convex/index.ts +28 -0
- package/src/convex/schema.ts +207 -0
- package/src/convex/supportTeams.ts +179 -0
- package/src/index.ts +77 -0
- package/src/react/BugReportButton.tsx +755 -0
- package/src/react/BugReportContext.tsx +146 -0
- package/src/react/index.ts +46 -0
- package/src/types.ts +93 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { defineSchema, defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
// ===== Validators =====
|
|
4
|
+
/**
|
|
5
|
+
* Bug report severity levels
|
|
6
|
+
*/
|
|
7
|
+
export const bugSeverityValidator = v.union(v.literal("low"), v.literal("medium"), v.literal("high"), v.literal("critical"));
|
|
8
|
+
/**
|
|
9
|
+
* Bug report status
|
|
10
|
+
*/
|
|
11
|
+
export const bugStatusValidator = v.union(v.literal("open"), v.literal("in-progress"), v.literal("resolved"), v.literal("closed"));
|
|
12
|
+
/**
|
|
13
|
+
* Feedback type
|
|
14
|
+
*/
|
|
15
|
+
export const feedbackTypeValidator = v.union(v.literal("feature_request"), v.literal("change_request"), v.literal("general"));
|
|
16
|
+
/**
|
|
17
|
+
* Feedback priority
|
|
18
|
+
*/
|
|
19
|
+
export const feedbackPriorityValidator = v.union(v.literal("nice_to_have"), v.literal("important"), v.literal("critical"));
|
|
20
|
+
/**
|
|
21
|
+
* Feedback status
|
|
22
|
+
*/
|
|
23
|
+
export const feedbackStatusValidator = v.union(v.literal("open"), v.literal("under_review"), v.literal("planned"), v.literal("in_progress"), v.literal("completed"), v.literal("declined"));
|
|
24
|
+
/**
|
|
25
|
+
* Reporter type
|
|
26
|
+
*/
|
|
27
|
+
export const reporterTypeValidator = v.union(v.literal("staff"), v.literal("customer"));
|
|
28
|
+
/**
|
|
29
|
+
* Effort estimate
|
|
30
|
+
*/
|
|
31
|
+
export const effortValidator = v.union(v.literal("low"), v.literal("medium"), v.literal("high"));
|
|
32
|
+
// ===== Schema =====
|
|
33
|
+
export default defineSchema({
|
|
34
|
+
/**
|
|
35
|
+
* Bug Reports - in-app bug reports with diagnostics
|
|
36
|
+
*/
|
|
37
|
+
bugReports: defineTable({
|
|
38
|
+
// Report content
|
|
39
|
+
title: v.string(),
|
|
40
|
+
description: v.string(),
|
|
41
|
+
severity: bugSeverityValidator,
|
|
42
|
+
status: bugStatusValidator,
|
|
43
|
+
// Archive flag
|
|
44
|
+
isArchived: v.optional(v.boolean()),
|
|
45
|
+
// Reporter info
|
|
46
|
+
reporterType: reporterTypeValidator,
|
|
47
|
+
reporterId: v.string(),
|
|
48
|
+
reporterEmail: v.string(),
|
|
49
|
+
reporterName: v.string(),
|
|
50
|
+
// Page context
|
|
51
|
+
url: v.string(),
|
|
52
|
+
route: v.optional(v.string()),
|
|
53
|
+
// Browser diagnostics
|
|
54
|
+
browserInfo: v.string(), // JSON stringified browser info
|
|
55
|
+
consoleErrors: v.optional(v.string()), // JSON stringified array of errors
|
|
56
|
+
// Screenshot
|
|
57
|
+
screenshotStorageId: v.optional(v.id("_storage")),
|
|
58
|
+
// Viewport
|
|
59
|
+
viewportWidth: v.number(),
|
|
60
|
+
viewportHeight: v.number(),
|
|
61
|
+
// Network state
|
|
62
|
+
networkState: v.string(), // online/offline
|
|
63
|
+
// AI Analysis fields
|
|
64
|
+
aiSummary: v.optional(v.string()),
|
|
65
|
+
aiRootCauseAnalysis: v.optional(v.string()),
|
|
66
|
+
aiReproductionSteps: v.optional(v.array(v.string())),
|
|
67
|
+
aiSuggestedFix: v.optional(v.string()),
|
|
68
|
+
aiEstimatedEffort: v.optional(effortValidator),
|
|
69
|
+
aiSuggestedSeverity: v.optional(bugSeverityValidator),
|
|
70
|
+
aiAnalyzedAt: v.optional(v.number()),
|
|
71
|
+
aiThreadId: v.optional(v.string()),
|
|
72
|
+
notificationsSentAt: v.optional(v.number()),
|
|
73
|
+
// Timestamps
|
|
74
|
+
createdAt: v.number(),
|
|
75
|
+
updatedAt: v.number(),
|
|
76
|
+
})
|
|
77
|
+
.index("by_status", ["status"])
|
|
78
|
+
.index("by_severity", ["severity"])
|
|
79
|
+
.index("by_reporter", ["reporterType", "reporterId"])
|
|
80
|
+
.index("by_created", ["createdAt"])
|
|
81
|
+
.index("by_archived", ["isArchived"])
|
|
82
|
+
.index("by_ai_analyzed", ["aiAnalyzedAt"]),
|
|
83
|
+
/**
|
|
84
|
+
* Feedback - feature requests, change requests, and general feedback
|
|
85
|
+
*/
|
|
86
|
+
feedback: defineTable({
|
|
87
|
+
// Feedback type
|
|
88
|
+
type: feedbackTypeValidator,
|
|
89
|
+
// Content
|
|
90
|
+
title: v.string(),
|
|
91
|
+
description: v.string(),
|
|
92
|
+
priority: feedbackPriorityValidator,
|
|
93
|
+
status: feedbackStatusValidator,
|
|
94
|
+
// Archive flag
|
|
95
|
+
isArchived: v.optional(v.boolean()),
|
|
96
|
+
// Reporter info
|
|
97
|
+
reporterType: reporterTypeValidator,
|
|
98
|
+
reporterId: v.string(),
|
|
99
|
+
reporterEmail: v.string(),
|
|
100
|
+
reporterName: v.string(),
|
|
101
|
+
// Page context
|
|
102
|
+
url: v.string(),
|
|
103
|
+
route: v.optional(v.string()),
|
|
104
|
+
// Browser diagnostics
|
|
105
|
+
browserInfo: v.string(),
|
|
106
|
+
consoleErrors: v.optional(v.string()),
|
|
107
|
+
// Screenshot
|
|
108
|
+
screenshotStorageId: v.optional(v.id("_storage")),
|
|
109
|
+
// Viewport
|
|
110
|
+
viewportWidth: v.number(),
|
|
111
|
+
viewportHeight: v.number(),
|
|
112
|
+
// Network state
|
|
113
|
+
networkState: v.string(),
|
|
114
|
+
// AI Analysis fields
|
|
115
|
+
aiSummary: v.optional(v.string()),
|
|
116
|
+
aiImpactAnalysis: v.optional(v.string()),
|
|
117
|
+
aiActionItems: v.optional(v.array(v.string())),
|
|
118
|
+
aiEstimatedEffort: v.optional(effortValidator),
|
|
119
|
+
aiSuggestedPriority: v.optional(feedbackPriorityValidator),
|
|
120
|
+
aiAnalyzedAt: v.optional(v.number()),
|
|
121
|
+
aiThreadId: v.optional(v.string()),
|
|
122
|
+
notificationsSentAt: v.optional(v.number()),
|
|
123
|
+
// Timestamps
|
|
124
|
+
createdAt: v.number(),
|
|
125
|
+
updatedAt: v.number(),
|
|
126
|
+
})
|
|
127
|
+
.index("by_status", ["status"])
|
|
128
|
+
.index("by_type", ["type"])
|
|
129
|
+
.index("by_priority", ["priority"])
|
|
130
|
+
.index("by_reporter", ["reporterType", "reporterId"])
|
|
131
|
+
.index("by_created", ["createdAt"])
|
|
132
|
+
.index("by_archived", ["isArchived"])
|
|
133
|
+
.index("by_ai_analyzed", ["aiAnalyzedAt"]),
|
|
134
|
+
/**
|
|
135
|
+
* Support Teams - configure teams for notification routing
|
|
136
|
+
*/
|
|
137
|
+
supportTeams: defineTable({
|
|
138
|
+
teamName: v.string(),
|
|
139
|
+
memberEmails: v.array(v.string()),
|
|
140
|
+
// Multi-select: which feedback types this team handles
|
|
141
|
+
feedbackTypes: v.array(feedbackTypeValidator),
|
|
142
|
+
// Multi-select: which bug report severities this team handles
|
|
143
|
+
bugReportSeverities: v.array(bugSeverityValidator),
|
|
144
|
+
isActive: v.boolean(),
|
|
145
|
+
createdAt: v.number(),
|
|
146
|
+
updatedAt: v.number(),
|
|
147
|
+
})
|
|
148
|
+
.index("by_active", ["isActive"]),
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/convex/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,yBAAyB;AAEzB;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACzC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAChB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CACtB,CAAC;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CACvC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,EACxB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CACpB,CAAC;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CA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AAC,CAAC,MAAM,EAAE;KACtB,CAAC;SACC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;SAC9B,KAAK,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC;SAC1B,KAAK,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC,CAAC;SAClC,KAAK,CAAC,aAAa,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;SACpD,KAAK,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC;SAClC,KAAK,CAAC,aAAa,EAAE,CAAC,YAAY,CAAC,CAAC;SACpC,KAAK,CAAC,gBAAgB,EAAE,CAAC,cAAc,CAAC,CAAC;IAE5C;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;QACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACjC,uDAAuD;QACvD,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;QAC7C,8DAA8D;QAC9D,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;QAClD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;QACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;SACC,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC;CACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List all support teams.
|
|
3
|
+
*/
|
|
4
|
+
export declare const list: any;
|
|
5
|
+
/**
|
|
6
|
+
* Get a support team by ID.
|
|
7
|
+
*/
|
|
8
|
+
export declare const get: any;
|
|
9
|
+
/**
|
|
10
|
+
* Internal query to find all active teams that handle a given feedback type.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getTeamsForFeedbackType: any;
|
|
13
|
+
/**
|
|
14
|
+
* Internal query to find all active teams that handle a given bug report severity.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTeamsForBugReportSeverity: any;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new support team.
|
|
19
|
+
*/
|
|
20
|
+
export declare const create: any;
|
|
21
|
+
/**
|
|
22
|
+
* Update a support team.
|
|
23
|
+
*/
|
|
24
|
+
export declare const update: any;
|
|
25
|
+
/**
|
|
26
|
+
* Delete a support team.
|
|
27
|
+
*/
|
|
28
|
+
export declare const remove: any;
|
|
29
|
+
//# sourceMappingURL=supportTeams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supportTeams.d.ts","sourceRoot":"","sources":["../../src/convex/supportTeams.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,eAAO,MAAM,IAAI,KAcf,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,GAAG,KAQd,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,KAelC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B,KAevC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM,KAoBjB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM,KAuCjB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM,KAcjB,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation, query, internalQuery } from "./_generated/server";
|
|
3
|
+
import { feedbackTypeValidator, bugSeverityValidator, } from "./schema";
|
|
4
|
+
// Return type for support team records
|
|
5
|
+
const supportTeamReturnValidator = v.object({
|
|
6
|
+
_id: v.id("supportTeams"),
|
|
7
|
+
_creationTime: v.number(),
|
|
8
|
+
teamName: v.string(),
|
|
9
|
+
memberEmails: v.array(v.string()),
|
|
10
|
+
feedbackTypes: v.array(feedbackTypeValidator),
|
|
11
|
+
bugReportSeverities: v.array(bugSeverityValidator),
|
|
12
|
+
isActive: v.boolean(),
|
|
13
|
+
createdAt: v.number(),
|
|
14
|
+
updatedAt: v.number(),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* List all support teams.
|
|
18
|
+
*/
|
|
19
|
+
export const list = query({
|
|
20
|
+
args: {
|
|
21
|
+
activeOnly: v.optional(v.boolean()),
|
|
22
|
+
},
|
|
23
|
+
returns: v.array(supportTeamReturnValidator),
|
|
24
|
+
handler: async (ctx, args) => {
|
|
25
|
+
if (args.activeOnly) {
|
|
26
|
+
return await ctx.db
|
|
27
|
+
.query("supportTeams")
|
|
28
|
+
.withIndex("by_active", (q) => q.eq("isActive", true))
|
|
29
|
+
.collect();
|
|
30
|
+
}
|
|
31
|
+
return await ctx.db.query("supportTeams").collect();
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Get a support team by ID.
|
|
36
|
+
*/
|
|
37
|
+
export const get = query({
|
|
38
|
+
args: {
|
|
39
|
+
teamId: v.id("supportTeams"),
|
|
40
|
+
},
|
|
41
|
+
returns: v.union(supportTeamReturnValidator, v.null()),
|
|
42
|
+
handler: async (ctx, args) => {
|
|
43
|
+
return await ctx.db.get(args.teamId);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Internal query to find all active teams that handle a given feedback type.
|
|
48
|
+
*/
|
|
49
|
+
export const getTeamsForFeedbackType = internalQuery({
|
|
50
|
+
args: {
|
|
51
|
+
feedbackType: feedbackTypeValidator,
|
|
52
|
+
},
|
|
53
|
+
returns: v.array(supportTeamReturnValidator),
|
|
54
|
+
handler: async (ctx, args) => {
|
|
55
|
+
const allTeams = await ctx.db
|
|
56
|
+
.query("supportTeams")
|
|
57
|
+
.withIndex("by_active", (q) => q.eq("isActive", true))
|
|
58
|
+
.collect();
|
|
59
|
+
return allTeams.filter((team) => team.feedbackTypes.includes(args.feedbackType));
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Internal query to find all active teams that handle a given bug report severity.
|
|
64
|
+
*/
|
|
65
|
+
export const getTeamsForBugReportSeverity = internalQuery({
|
|
66
|
+
args: {
|
|
67
|
+
severity: bugSeverityValidator,
|
|
68
|
+
},
|
|
69
|
+
returns: v.array(supportTeamReturnValidator),
|
|
70
|
+
handler: async (ctx, args) => {
|
|
71
|
+
const allTeams = await ctx.db
|
|
72
|
+
.query("supportTeams")
|
|
73
|
+
.withIndex("by_active", (q) => q.eq("isActive", true))
|
|
74
|
+
.collect();
|
|
75
|
+
return allTeams.filter((team) => team.bugReportSeverities.includes(args.severity));
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Create a new support team.
|
|
80
|
+
*/
|
|
81
|
+
export const create = mutation({
|
|
82
|
+
args: {
|
|
83
|
+
teamName: v.string(),
|
|
84
|
+
memberEmails: v.array(v.string()),
|
|
85
|
+
feedbackTypes: v.array(feedbackTypeValidator),
|
|
86
|
+
bugReportSeverities: v.array(bugSeverityValidator),
|
|
87
|
+
},
|
|
88
|
+
returns: v.id("supportTeams"),
|
|
89
|
+
handler: async (ctx, args) => {
|
|
90
|
+
const now = Date.now();
|
|
91
|
+
return await ctx.db.insert("supportTeams", {
|
|
92
|
+
teamName: args.teamName,
|
|
93
|
+
memberEmails: args.memberEmails,
|
|
94
|
+
feedbackTypes: args.feedbackTypes,
|
|
95
|
+
bugReportSeverities: args.bugReportSeverities,
|
|
96
|
+
isActive: true,
|
|
97
|
+
createdAt: now,
|
|
98
|
+
updatedAt: now,
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Update a support team.
|
|
104
|
+
*/
|
|
105
|
+
export const update = mutation({
|
|
106
|
+
args: {
|
|
107
|
+
teamId: v.id("supportTeams"),
|
|
108
|
+
teamName: v.optional(v.string()),
|
|
109
|
+
memberEmails: v.optional(v.array(v.string())),
|
|
110
|
+
feedbackTypes: v.optional(v.array(feedbackTypeValidator)),
|
|
111
|
+
bugReportSeverities: v.optional(v.array(bugSeverityValidator)),
|
|
112
|
+
isActive: v.optional(v.boolean()),
|
|
113
|
+
},
|
|
114
|
+
returns: v.null(),
|
|
115
|
+
handler: async (ctx, args) => {
|
|
116
|
+
const team = await ctx.db.get(args.teamId);
|
|
117
|
+
if (!team) {
|
|
118
|
+
throw new Error("Support team not found");
|
|
119
|
+
}
|
|
120
|
+
const updates = {
|
|
121
|
+
updatedAt: Date.now(),
|
|
122
|
+
};
|
|
123
|
+
if (args.teamName !== undefined) {
|
|
124
|
+
updates.teamName = args.teamName;
|
|
125
|
+
}
|
|
126
|
+
if (args.memberEmails !== undefined) {
|
|
127
|
+
updates.memberEmails = args.memberEmails;
|
|
128
|
+
}
|
|
129
|
+
if (args.feedbackTypes !== undefined) {
|
|
130
|
+
updates.feedbackTypes = args.feedbackTypes;
|
|
131
|
+
}
|
|
132
|
+
if (args.bugReportSeverities !== undefined) {
|
|
133
|
+
updates.bugReportSeverities = args.bugReportSeverities;
|
|
134
|
+
}
|
|
135
|
+
if (args.isActive !== undefined) {
|
|
136
|
+
updates.isActive = args.isActive;
|
|
137
|
+
}
|
|
138
|
+
await ctx.db.patch(args.teamId, updates);
|
|
139
|
+
return null;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Delete a support team.
|
|
144
|
+
*/
|
|
145
|
+
export const remove = mutation({
|
|
146
|
+
args: {
|
|
147
|
+
teamId: v.id("supportTeams"),
|
|
148
|
+
},
|
|
149
|
+
returns: v.null(),
|
|
150
|
+
handler: async (ctx, args) => {
|
|
151
|
+
const team = await ctx.db.get(args.teamId);
|
|
152
|
+
if (!team) {
|
|
153
|
+
throw new Error("Support team not found");
|
|
154
|
+
}
|
|
155
|
+
await ctx.db.delete(args.teamId);
|
|
156
|
+
return null;
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=supportTeams.js.map
|
|
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AC,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @convex-dev/feedback
|
|
3
|
+
*
|
|
4
|
+
* Bug reports and feedback collection component for Convex applications.
|
|
5
|
+
*
|
|
6
|
+
* ## Installation
|
|
7
|
+
*
|
|
8
|
+
* ```bash
|
|
9
|
+
* npm install @convex-dev/feedback
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ## Setup
|
|
13
|
+
*
|
|
14
|
+
* 1. Add the component to your `convex/convex.config.ts`:
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { defineApp } from "convex/server";
|
|
18
|
+
* import feedback from "@convex-dev/feedback/convex.config";
|
|
19
|
+
*
|
|
20
|
+
* const app = defineApp();
|
|
21
|
+
* app.use(feedback);
|
|
22
|
+
* export default app;
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* 2. Set required environment variables in your Convex dashboard:
|
|
26
|
+
* - `OPENROUTER_API_KEY` - For AI analysis (optional)
|
|
27
|
+
* - `RESEND_API_KEY` - For email notifications (optional)
|
|
28
|
+
* - `RESEND_FROM_EMAIL` - From address for emails (optional)
|
|
29
|
+
*
|
|
30
|
+
* ## Usage
|
|
31
|
+
*
|
|
32
|
+
* ### Convex Functions
|
|
33
|
+
*
|
|
34
|
+
* The component exposes these functions through `api.feedback`:
|
|
35
|
+
*
|
|
36
|
+
* - `api.feedback.bugReports.create` - Create a bug report
|
|
37
|
+
* - `api.feedback.bugReports.list` - List bug reports
|
|
38
|
+
* - `api.feedback.bugReports.get` - Get a bug report by ID
|
|
39
|
+
* - `api.feedback.bugReports.updateStatus` - Update bug report status
|
|
40
|
+
* - `api.feedback.bugReports.archive` - Archive a bug report
|
|
41
|
+
* - `api.feedback.bugReports.unarchive` - Unarchive a bug report
|
|
42
|
+
*
|
|
43
|
+
* - `api.feedback.feedback.create` - Create feedback
|
|
44
|
+
* - `api.feedback.feedback.list` - List feedback
|
|
45
|
+
* - `api.feedback.feedback.get` - Get feedback by ID
|
|
46
|
+
* - `api.feedback.feedback.updateStatus` - Update feedback status
|
|
47
|
+
*
|
|
48
|
+
* - `api.feedback.supportTeams.list` - List support teams
|
|
49
|
+
* - `api.feedback.supportTeams.create` - Create a support team
|
|
50
|
+
* - `api.feedback.supportTeams.update` - Update a support team
|
|
51
|
+
*
|
|
52
|
+
* ### React Components
|
|
53
|
+
*
|
|
54
|
+
* Import from `@convex-dev/feedback/react`:
|
|
55
|
+
*
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { BugReportProvider, BugReportButton } from '@convex-dev/feedback/react';
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @module
|
|
61
|
+
*/
|
|
62
|
+
export type BugSeverity = 'low' | 'medium' | 'high' | 'critical';
|
|
63
|
+
export type BugStatus = 'open' | 'in-progress' | 'resolved' | 'closed';
|
|
64
|
+
export type FeedbackType = 'feature_request' | 'change_request' | 'general';
|
|
65
|
+
export type FeedbackPriority = 'nice_to_have' | 'important' | 'critical';
|
|
66
|
+
export type FeedbackStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
|
|
67
|
+
export type ReporterType = 'staff' | 'customer';
|
|
68
|
+
export type Effort = 'low' | 'medium' | 'high';
|
|
69
|
+
export type { BugReport, Feedback, SupportTeam, } from './types';
|
|
70
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAGH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AACvE,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAC5E,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AAC5G,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC;AAChD,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAG/C,YAAY,EACV,SAAS,EACT,QAAQ,EACR,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @convex-dev/feedback
|
|
3
|
+
*
|
|
4
|
+
* Bug reports and feedback collection component for Convex applications.
|
|
5
|
+
*
|
|
6
|
+
* ## Installation
|
|
7
|
+
*
|
|
8
|
+
* ```bash
|
|
9
|
+
* npm install @convex-dev/feedback
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ## Setup
|
|
13
|
+
*
|
|
14
|
+
* 1. Add the component to your `convex/convex.config.ts`:
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { defineApp } from "convex/server";
|
|
18
|
+
* import feedback from "@convex-dev/feedback/convex.config";
|
|
19
|
+
*
|
|
20
|
+
* const app = defineApp();
|
|
21
|
+
* app.use(feedback);
|
|
22
|
+
* export default app;
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* 2. Set required environment variables in your Convex dashboard:
|
|
26
|
+
* - `OPENROUTER_API_KEY` - For AI analysis (optional)
|
|
27
|
+
* - `RESEND_API_KEY` - For email notifications (optional)
|
|
28
|
+
* - `RESEND_FROM_EMAIL` - From address for emails (optional)
|
|
29
|
+
*
|
|
30
|
+
* ## Usage
|
|
31
|
+
*
|
|
32
|
+
* ### Convex Functions
|
|
33
|
+
*
|
|
34
|
+
* The component exposes these functions through `api.feedback`:
|
|
35
|
+
*
|
|
36
|
+
* - `api.feedback.bugReports.create` - Create a bug report
|
|
37
|
+
* - `api.feedback.bugReports.list` - List bug reports
|
|
38
|
+
* - `api.feedback.bugReports.get` - Get a bug report by ID
|
|
39
|
+
* - `api.feedback.bugReports.updateStatus` - Update bug report status
|
|
40
|
+
* - `api.feedback.bugReports.archive` - Archive a bug report
|
|
41
|
+
* - `api.feedback.bugReports.unarchive` - Unarchive a bug report
|
|
42
|
+
*
|
|
43
|
+
* - `api.feedback.feedback.create` - Create feedback
|
|
44
|
+
* - `api.feedback.feedback.list` - List feedback
|
|
45
|
+
* - `api.feedback.feedback.get` - Get feedback by ID
|
|
46
|
+
* - `api.feedback.feedback.updateStatus` - Update feedback status
|
|
47
|
+
*
|
|
48
|
+
* - `api.feedback.supportTeams.list` - List support teams
|
|
49
|
+
* - `api.feedback.supportTeams.create` - Create a support team
|
|
50
|
+
* - `api.feedback.supportTeams.update` - Update a support team
|
|
51
|
+
*
|
|
52
|
+
* ### React Components
|
|
53
|
+
*
|
|
54
|
+
* Import from `@convex-dev/feedback/react`:
|
|
55
|
+
*
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { BugReportProvider, BugReportButton } from '@convex-dev/feedback/react';
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @module
|
|
61
|
+
*/
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { FunctionReference } from 'convex/server';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the BugReportButton component
|
|
4
|
+
*/
|
|
5
|
+
export interface BugReportButtonProps {
|
|
6
|
+
/** Reporter type: 'staff' for internal users, 'customer' for external users */
|
|
7
|
+
reporterType: 'staff' | 'customer';
|
|
8
|
+
/** Unique identifier for the reporter */
|
|
9
|
+
reporterId: string;
|
|
10
|
+
/** Reporter's email address */
|
|
11
|
+
reporterEmail: string;
|
|
12
|
+
/** Reporter's display name */
|
|
13
|
+
reporterName: string;
|
|
14
|
+
/** Convex API reference for bug reports */
|
|
15
|
+
bugReportApi: {
|
|
16
|
+
create: FunctionReference<'mutation'>;
|
|
17
|
+
generateUploadUrl: FunctionReference<'mutation'>;
|
|
18
|
+
};
|
|
19
|
+
/** Convex API reference for feedback */
|
|
20
|
+
feedbackApi: {
|
|
21
|
+
create: FunctionReference<'mutation'>;
|
|
22
|
+
generateUploadUrl: FunctionReference<'mutation'>;
|
|
23
|
+
};
|
|
24
|
+
/** Position of the floating button */
|
|
25
|
+
position?: {
|
|
26
|
+
bottom?: number;
|
|
27
|
+
right?: number;
|
|
28
|
+
top?: number;
|
|
29
|
+
left?: number;
|
|
30
|
+
};
|
|
31
|
+
/** Button color (default: red) */
|
|
32
|
+
buttonColor?: string;
|
|
33
|
+
/** Show feedback tab in addition to bug reports */
|
|
34
|
+
showFeedback?: boolean;
|
|
35
|
+
/** Callback when submission succeeds */
|
|
36
|
+
onSuccess?: (type: 'bug' | 'feedback') => void;
|
|
37
|
+
/** Callback when submission fails */
|
|
38
|
+
onError?: (error: Error, type: 'bug' | 'feedback') => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Floating action button for submitting bug reports and feedback.
|
|
42
|
+
* Captures browser diagnostics, console errors, and optional screenshots.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* import { BugReportButton } from '@convex-dev/feedback/react';
|
|
47
|
+
* import { api } from './convex/_generated/api';
|
|
48
|
+
*
|
|
49
|
+
* function App() {
|
|
50
|
+
* return (
|
|
51
|
+
* <BugReportButton
|
|
52
|
+
* reporterType="staff"
|
|
53
|
+
* reporterId={user.id}
|
|
54
|
+
* reporterEmail={user.email}
|
|
55
|
+
* reporterName={user.name}
|
|
56
|
+
* bugReportApi={{
|
|
57
|
+
* create: api.feedback.bugReports.create,
|
|
58
|
+
* generateUploadUrl: api.feedback.bugReports.generateUploadUrl,
|
|
59
|
+
* }}
|
|
60
|
+
* feedbackApi={{
|
|
61
|
+
* create: api.feedback.feedback.create,
|
|
62
|
+
* generateUploadUrl: api.feedback.feedback.generateUploadUrl,
|
|
63
|
+
* }}
|
|
64
|
+
* />
|
|
65
|
+
* );
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function BugReportButton({ reporterType, reporterId, reporterEmail, reporterName, bugReportApi, feedbackApi, position, buttonColor, showFeedback, onSuccess, onError, }: BugReportButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
//# sourceMappingURL=BugReportButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BugReportButton.d.ts","sourceRoot":"","sources":["../../src/react/BugReportButton.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,YAAY,EAAE,OAAO,GAAG,UAAU,CAAC;IACnC,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,YAAY,EAAE;QACZ,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACtC,iBAAiB,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;KAClD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