quick-bug-reporter-react 1.0.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/README.md +184 -0
- package/dist/index.cjs +3048 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +331 -0
- package/dist/index.d.ts +331 -0
- package/dist/index.js +3028 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# quick-bug-reporter-react
|
|
2
|
+
|
|
3
|
+
Drop-in bug reporter for React apps — screenshot capture, video recording, annotation, and Linear/Jira integration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Screenshot capture** — Full-page or region selection via `html2canvas-pro`
|
|
8
|
+
- **Video recording** — Screen + microphone via `MediaRecorder` API
|
|
9
|
+
- **Annotation** — Drag-to-highlight on captured screenshots
|
|
10
|
+
- **Network logging** — Automatic fetch interception during capture
|
|
11
|
+
- **Integrations** — Linear and Jira (direct API or backend proxy)
|
|
12
|
+
- **Zero config UI** — Floating bug button + modal wizard, ships its own styles
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install quick-bug-reporter-react
|
|
18
|
+
# or
|
|
19
|
+
pnpm add quick-bug-reporter-react
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
|
|
24
|
+
- React 18+ or 19+
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### 1. Import styles
|
|
29
|
+
|
|
30
|
+
The library ships a pre-built CSS file. Import it once in your app entry point:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import "quick-bug-reporter-react/styles.css";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> **Already using Tailwind CSS v4?** You can skip the CSS import and instead add
|
|
37
|
+
> `@source "node_modules/quick-bug-reporter-react/dist";` to your main CSS file so
|
|
38
|
+
> Tailwind picks up the library's utility classes.
|
|
39
|
+
|
|
40
|
+
### 2. Add the provider and UI
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import {
|
|
44
|
+
BugReporterProvider,
|
|
45
|
+
FloatingBugButton,
|
|
46
|
+
BugReporterModal,
|
|
47
|
+
LinearIntegration,
|
|
48
|
+
} from "quick-bug-reporter-react";
|
|
49
|
+
|
|
50
|
+
const linear = new LinearIntegration({
|
|
51
|
+
submitProxyEndpoint: "/api/bug-report",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default function App({ children }) {
|
|
55
|
+
return (
|
|
56
|
+
<BugReporterProvider
|
|
57
|
+
integrations={{ linear }}
|
|
58
|
+
defaultProvider="linear"
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
<FloatingBugButton />
|
|
62
|
+
<BugReporterModal />
|
|
63
|
+
</BugReporterProvider>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That's it — a floating "Report Bug" button appears in the bottom-right corner.
|
|
69
|
+
|
|
70
|
+
## Integrations
|
|
71
|
+
|
|
72
|
+
Both integrations support two modes:
|
|
73
|
+
|
|
74
|
+
| Mode | When to use | How it works |
|
|
75
|
+
|------|------------|--------------|
|
|
76
|
+
| **Backend proxy** (recommended) | Production apps | Your server-side endpoint receives the report and calls Linear/Jira. API keys stay on the server. |
|
|
77
|
+
| **Direct API** | Server-side only (Next.js API routes, etc.) | The library calls Linear/Jira APIs directly. **⚠️ Does NOT work from browser-only SPAs due to CORS.** |
|
|
78
|
+
|
|
79
|
+
### Linear
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { LinearIntegration } from "quick-bug-reporter-react";
|
|
83
|
+
|
|
84
|
+
// ✅ Recommended: Backend proxy (works everywhere)
|
|
85
|
+
const linear = new LinearIntegration({
|
|
86
|
+
submitProxyEndpoint: "/api/bug-report",
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// ⚠️ Direct API — server-side / Next.js API routes only
|
|
90
|
+
// Does NOT work from browser SPAs (CORS + exposes API key)
|
|
91
|
+
const linear = new LinearIntegration({
|
|
92
|
+
apiKey: "lin_api_...",
|
|
93
|
+
teamId: "TEAM_ID",
|
|
94
|
+
projectId: "PROJECT_ID", // optional
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Jira
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { JiraIntegration } from "quick-bug-reporter-react";
|
|
102
|
+
|
|
103
|
+
// ✅ Recommended: Backend proxy
|
|
104
|
+
const jira = new JiraIntegration({
|
|
105
|
+
submitProxyEndpoint: "/api/bug-report",
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// ⚠️ Direct API — server-side only (CORS + exposes credentials)
|
|
109
|
+
const jira = new JiraIntegration({
|
|
110
|
+
baseUrl: "https://your-domain.atlassian.net",
|
|
111
|
+
email: "you@example.com",
|
|
112
|
+
apiToken: "...",
|
|
113
|
+
projectKey: "BUG",
|
|
114
|
+
issueType: "Bug", // optional, defaults to "Bug"
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Proxy endpoint
|
|
119
|
+
|
|
120
|
+
Your backend proxy receives a `FormData` POST with these fields:
|
|
121
|
+
|
|
122
|
+
| Field | Type | Description |
|
|
123
|
+
|-------|------|-------------|
|
|
124
|
+
| `provider` | string | `"linear"` or `"jira"` |
|
|
125
|
+
| `title` | string | Bug title |
|
|
126
|
+
| `description` | string | Bug description |
|
|
127
|
+
| `pageUrl` | string | URL where the bug was reported |
|
|
128
|
+
| `userAgent` | string | Browser user agent |
|
|
129
|
+
| `captureMode` | string | `"screenshot"` or `"video"` |
|
|
130
|
+
| `clientMetadata` | JSON string | Device/browser metadata |
|
|
131
|
+
| `networkLogs` | string | Formatted network logs |
|
|
132
|
+
| `screenshotFile` | File | Screenshot PNG (if applicable) |
|
|
133
|
+
| `screenRecordingFile` | File | Screen recording WebM (if applicable) |
|
|
134
|
+
| `requestsLogFile` | File | Network logs as .txt |
|
|
135
|
+
|
|
136
|
+
The proxy should return JSON:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"linear": { "id": "...", "identifier": "ENG-123", "url": "https://..." },
|
|
141
|
+
"warnings": []
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Advanced: Custom fetch
|
|
146
|
+
|
|
147
|
+
Both integrations accept a `fetchImpl` option to customize how HTTP requests are made (useful for adding auth headers, logging, or proxying):
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const linear = new LinearIntegration({
|
|
151
|
+
apiKey: "...",
|
|
152
|
+
teamId: "...",
|
|
153
|
+
fetchImpl: (input, init) => {
|
|
154
|
+
console.log("Request:", input);
|
|
155
|
+
return fetch(input, init);
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Exports
|
|
161
|
+
|
|
162
|
+
### UI Components
|
|
163
|
+
|
|
164
|
+
- `BugReporterProvider` — Context provider, wraps your app
|
|
165
|
+
- `FloatingBugButton` — Floating action button with capture menu
|
|
166
|
+
- `BugReporterModal` — Two-step wizard (review capture → add context & submit)
|
|
167
|
+
- `useBugReporter()` — Hook to build custom UI on top of the bug reporter
|
|
168
|
+
|
|
169
|
+
### Core Classes (headless usage)
|
|
170
|
+
|
|
171
|
+
- `BugReporter` — Orchestrates capture + submission (no UI)
|
|
172
|
+
- `BugSession` — Manages a single capture session
|
|
173
|
+
- `ScreenshotCapturer` — HTML-to-canvas screenshot engine
|
|
174
|
+
- `ScreenRecorder` — Screen + mic recording via MediaRecorder
|
|
175
|
+
- `NetworkLogger` — Fetch interception logger
|
|
176
|
+
|
|
177
|
+
### Integrations
|
|
178
|
+
|
|
179
|
+
- `LinearIntegration` — Linear issue creation + file upload
|
|
180
|
+
- `JiraIntegration` — Jira issue creation + attachment upload
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|