react-visual-feedback 1.2.1 → 1.3.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 +46 -215
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,21 +6,21 @@ A powerful, visual feedback collection tool for React applications with an integ
|
|
|
6
6
|
|
|
7
7
|
### Feedback Collection
|
|
8
8
|
- 🎯 Visual element selection with hover highlighting
|
|
9
|
-
- 📸 Automatic screenshot capture
|
|
10
|
-
- 📝
|
|
9
|
+
- 📸 Automatic screenshot capture with perfect CSS rendering
|
|
10
|
+
- 📝 Rich feedback form with context
|
|
11
11
|
- ⚡ Lightweight and performant
|
|
12
12
|
- 🎨 Works with any CSS framework (Tailwind, Bootstrap, Material-UI, etc.)
|
|
13
|
-
- ⌨️ Keyboard shortcuts (Ctrl+Q to activate, Esc to cancel
|
|
13
|
+
- ⌨️ Keyboard shortcuts (Ctrl+Q to activate, Esc to cancel)
|
|
14
14
|
- 🌓 Dark mode support
|
|
15
15
|
|
|
16
|
-
### Feedback Dashboard
|
|
17
|
-
- 📊
|
|
18
|
-
- 👨💻
|
|
19
|
-
- 👤
|
|
20
|
-
- 🏷️
|
|
21
|
-
-
|
|
22
|
-
- 🔒
|
|
23
|
-
- 🔄
|
|
16
|
+
### Feedback Dashboard
|
|
17
|
+
- 📊 Professional dashboard with localStorage or custom data source
|
|
18
|
+
- 👨💻 Developer mode with full technical details
|
|
19
|
+
- 👤 User mode for simplified feedback view
|
|
20
|
+
- 🏷️ Status management with 7 professional status options
|
|
21
|
+
- 💬 Status change modal with developer comments
|
|
22
|
+
- 🔒 Permission system - Users can only view, developers can manage
|
|
23
|
+
- 🔄 Status change callbacks for database synchronization
|
|
24
24
|
- ⌨️ Dashboard keyboard shortcut (Ctrl+Shift+Q)
|
|
25
25
|
|
|
26
26
|
## Installation
|
|
@@ -89,7 +89,6 @@ function FeedbackButtons() {
|
|
|
89
89
|
|
|
90
90
|
function App() {
|
|
91
91
|
const handleFeedbackSubmit = async (feedbackData) => {
|
|
92
|
-
console.log('Feedback received:', feedbackData);
|
|
93
92
|
await fetch('/api/feedback', {
|
|
94
93
|
method: 'POST',
|
|
95
94
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -97,13 +96,12 @@ function App() {
|
|
|
97
96
|
});
|
|
98
97
|
};
|
|
99
98
|
|
|
100
|
-
const handleStatusChange = async ({ id, status }) => {
|
|
101
|
-
|
|
102
|
-
// Update your database
|
|
99
|
+
const handleStatusChange = async ({ id, status, comment }) => {
|
|
100
|
+
// Update your database with status and developer comment
|
|
103
101
|
await fetch(`/api/feedback/${id}/status`, {
|
|
104
102
|
method: 'PATCH',
|
|
105
103
|
headers: { 'Content-Type': 'application/json' },
|
|
106
|
-
body: JSON.stringify({ status })
|
|
104
|
+
body: JSON.stringify({ status, comment })
|
|
107
105
|
});
|
|
108
106
|
};
|
|
109
107
|
|
|
@@ -125,9 +123,7 @@ function App() {
|
|
|
125
123
|
export default App;
|
|
126
124
|
```
|
|
127
125
|
|
|
128
|
-
##
|
|
129
|
-
|
|
130
|
-
### Status Options
|
|
126
|
+
## Status Options
|
|
131
127
|
|
|
132
128
|
The dashboard includes 7 professional status options:
|
|
133
129
|
|
|
@@ -135,44 +131,11 @@ The dashboard includes 7 professional status options:
|
|
|
135
131
|
|--------|-------|-------------|
|
|
136
132
|
| **Reported** 🔴 | Red | Initial feedback submission |
|
|
137
133
|
| **Opened** 🟠 | Amber | Acknowledged and under review |
|
|
138
|
-
| **
|
|
134
|
+
| **In Progress** 🔵 | Blue | Actively being worked on |
|
|
139
135
|
| **Resolved** 🟢 | Green | Fixed and ready |
|
|
140
136
|
| **Released** 🟣 | Purple | Deployed to production |
|
|
141
137
|
| **Blocked** 🔴 | Red | Waiting on dependencies |
|
|
142
|
-
| **Won't
|
|
143
|
-
|
|
144
|
-
### Developer vs User Mode
|
|
145
|
-
|
|
146
|
-
#### Developer Mode (`isDeveloper={true}`)
|
|
147
|
-
- ✅ View all technical details (element info, CSS, viewport, user agent)
|
|
148
|
-
- ✅ Change feedback status
|
|
149
|
-
- ✅ Delete feedback items
|
|
150
|
-
- ✅ Full control over feedback management
|
|
151
|
-
|
|
152
|
-
#### User Mode (`isDeveloper={false}`)
|
|
153
|
-
- ✅ View feedback submissions
|
|
154
|
-
- ✅ See current status (read-only)
|
|
155
|
-
- ❌ Cannot change status
|
|
156
|
-
- ❌ Cannot delete items
|
|
157
|
-
- Perfect for product managers and stakeholders
|
|
158
|
-
|
|
159
|
-
### Data Persistence
|
|
160
|
-
|
|
161
|
-
The dashboard supports two modes:
|
|
162
|
-
|
|
163
|
-
1. **localStorage** (default) - Automatic persistence in browser
|
|
164
|
-
2. **Custom data source** - Pass your own data via `dashboardData` prop
|
|
165
|
-
|
|
166
|
-
```jsx
|
|
167
|
-
// Using localStorage (automatic)
|
|
168
|
-
<FeedbackProvider dashboard={true}>
|
|
169
|
-
|
|
170
|
-
// Using custom data source
|
|
171
|
-
<FeedbackProvider
|
|
172
|
-
dashboard={true}
|
|
173
|
-
dashboardData={yourFeedbackArray}
|
|
174
|
-
>
|
|
175
|
-
```
|
|
138
|
+
| **Won't Fix** ⚪ | Gray | Not planned for implementation |
|
|
176
139
|
|
|
177
140
|
## API Reference
|
|
178
141
|
|
|
@@ -181,7 +144,7 @@ The dashboard supports two modes:
|
|
|
181
144
|
| Prop | Type | Required | Default | Description |
|
|
182
145
|
|------|------|----------|---------|-------------|
|
|
183
146
|
| `onSubmit` | `(feedbackData) => Promise<void>` | Yes | - | Callback when feedback is submitted |
|
|
184
|
-
| `onStatusChange` | `({ id, status }) => void` | No | - | Callback when status changes |
|
|
147
|
+
| `onStatusChange` | `({ id, status, comment }) => void` | No | - | Callback when status changes (includes optional developer comment) |
|
|
185
148
|
| `children` | `ReactNode` | Yes | - | Your app components |
|
|
186
149
|
| `dashboard` | `boolean` | No | `false` | Enable dashboard feature |
|
|
187
150
|
| `dashboardData` | `Array` | No | `undefined` | Custom feedback data (uses localStorage if undefined) |
|
|
@@ -189,8 +152,7 @@ The dashboard supports two modes:
|
|
|
189
152
|
| `isUser` | `boolean` | No | `true` | Enable user mode (read-only) |
|
|
190
153
|
| `userName` | `string` | No | `'Anonymous'` | User name for feedback submissions |
|
|
191
154
|
| `userEmail` | `string` | No | `null` | User email for feedback submissions |
|
|
192
|
-
| `
|
|
193
|
-
| `onActiveChange` | `(active: boolean) => void` | No | - | Callback when active state changes |
|
|
155
|
+
| `mode` | `'light' \| 'dark'` | No | `'light'` | Theme mode |
|
|
194
156
|
|
|
195
157
|
### useFeedback Hook
|
|
196
158
|
|
|
@@ -211,7 +173,7 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
|
|
|
211
173
|
feedback: string,
|
|
212
174
|
userName: string,
|
|
213
175
|
userEmail: string | null,
|
|
214
|
-
status: 'reported' | 'opened' | '
|
|
176
|
+
status: 'reported' | 'opened' | 'inProgress' | 'resolved' | 'released' | 'blocked' | 'wontFix',
|
|
215
177
|
timestamp: string, // ISO 8601 format
|
|
216
178
|
url: string,
|
|
217
179
|
elementInfo: {
|
|
@@ -220,24 +182,11 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
|
|
|
220
182
|
className: string,
|
|
221
183
|
selector: string,
|
|
222
184
|
text: string,
|
|
223
|
-
position: {
|
|
224
|
-
|
|
225
|
-
y: number,
|
|
226
|
-
width: number,
|
|
227
|
-
height: number
|
|
228
|
-
},
|
|
229
|
-
styles: {
|
|
230
|
-
backgroundColor: string,
|
|
231
|
-
color: string,
|
|
232
|
-
fontSize: string,
|
|
233
|
-
fontFamily: string
|
|
234
|
-
}
|
|
185
|
+
position: { x: number, y: number, width: number, height: number },
|
|
186
|
+
styles: { backgroundColor: string, color: string, fontSize: string, fontFamily: string }
|
|
235
187
|
},
|
|
236
188
|
screenshot: string, // Base64 encoded PNG
|
|
237
|
-
viewport: {
|
|
238
|
-
width: number,
|
|
239
|
-
height: number
|
|
240
|
-
},
|
|
189
|
+
viewport: { width: number, height: number },
|
|
241
190
|
userAgent: string
|
|
242
191
|
}
|
|
243
192
|
```
|
|
@@ -251,114 +200,19 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
|
|
|
251
200
|
| `Esc` | Cancel/close feedback mode or dashboard |
|
|
252
201
|
| `Ctrl+Enter` | Submit feedback (when form is open) |
|
|
253
202
|
|
|
254
|
-
##
|
|
255
|
-
|
|
256
|
-
### Example 1: Basic Feedback Collection
|
|
257
|
-
|
|
258
|
-
```jsx
|
|
259
|
-
import { FeedbackProvider, useFeedback } from 'react-visual-feedback';
|
|
260
|
-
import 'react-visual-feedback/dist/index.css';
|
|
261
|
-
|
|
262
|
-
function FeedbackButton() {
|
|
263
|
-
const { setIsActive } = useFeedback();
|
|
264
|
-
return <button onClick={() => setIsActive(true)}>Report Issue</button>;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function App() {
|
|
268
|
-
return (
|
|
269
|
-
<FeedbackProvider onSubmit={async (data) => {
|
|
270
|
-
await fetch('/api/feedback', {
|
|
271
|
-
method: 'POST',
|
|
272
|
-
body: JSON.stringify(data)
|
|
273
|
-
});
|
|
274
|
-
}}>
|
|
275
|
-
<YourApp />
|
|
276
|
-
<FeedbackButton />
|
|
277
|
-
</FeedbackProvider>
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Example 2: Full Dashboard with Status Management
|
|
283
|
-
|
|
284
|
-
```jsx
|
|
285
|
-
function App() {
|
|
286
|
-
const [isDeveloper, setIsDeveloper] = useState(true);
|
|
287
|
-
|
|
288
|
-
const handleStatusChange = async ({ id, status }) => {
|
|
289
|
-
// Update database
|
|
290
|
-
await fetch(`/api/feedback/${id}`, {
|
|
291
|
-
method: 'PATCH',
|
|
292
|
-
body: JSON.stringify({ status })
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
return (
|
|
297
|
-
<FeedbackProvider
|
|
298
|
-
dashboard={true}
|
|
299
|
-
isDeveloper={isDeveloper}
|
|
300
|
-
onSubmit={handleFeedbackSubmit}
|
|
301
|
-
onStatusChange={handleStatusChange}
|
|
302
|
-
userName="Jane Smith"
|
|
303
|
-
userEmail="jane@company.com"
|
|
304
|
-
>
|
|
305
|
-
<YourApp />
|
|
306
|
-
</FeedbackProvider>
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Example 3: Custom Data Source
|
|
312
|
-
|
|
313
|
-
```jsx
|
|
314
|
-
function App() {
|
|
315
|
-
const [feedbackData, setFeedbackData] = useState([]);
|
|
203
|
+
## Developer vs User Mode
|
|
316
204
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}, []);
|
|
323
|
-
|
|
324
|
-
return (
|
|
325
|
-
<FeedbackProvider
|
|
326
|
-
dashboard={true}
|
|
327
|
-
dashboardData={feedbackData}
|
|
328
|
-
isDeveloper={true}
|
|
329
|
-
onStatusChange={async ({ id, status }) => {
|
|
330
|
-
// Update API
|
|
331
|
-
await fetch(`/api/feedback/${id}`, {
|
|
332
|
-
method: 'PATCH',
|
|
333
|
-
body: JSON.stringify({ status })
|
|
334
|
-
});
|
|
335
|
-
// Reload data
|
|
336
|
-
const updated = await fetch('/api/feedback').then(r => r.json());
|
|
337
|
-
setFeedbackData(updated);
|
|
338
|
-
}}
|
|
339
|
-
>
|
|
340
|
-
<YourApp />
|
|
341
|
-
</FeedbackProvider>
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## Styling
|
|
347
|
-
|
|
348
|
-
The widget comes with default styles, but you can customize them:
|
|
349
|
-
|
|
350
|
-
```css
|
|
351
|
-
/* Feedback Collection */
|
|
352
|
-
.feedback-overlay { /* Background overlay */ }
|
|
353
|
-
.feedback-highlight { /* Element highlight */ }
|
|
354
|
-
.feedback-tooltip { /* Element info tooltip */ }
|
|
355
|
-
.feedback-modal { /* Feedback form modal */ }
|
|
356
|
-
.feedback-backdrop { /* Modal backdrop */ }
|
|
205
|
+
### Developer Mode (`isDeveloper={true}`)
|
|
206
|
+
- ✅ View all technical details (element info, CSS, viewport, user agent)
|
|
207
|
+
- ✅ Change feedback status with optional comments
|
|
208
|
+
- ✅ Delete feedback items
|
|
209
|
+
- ✅ Full control over feedback management
|
|
357
210
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
211
|
+
### User Mode (`isDeveloper={false}`)
|
|
212
|
+
- ✅ View feedback submissions
|
|
213
|
+
- ✅ See current status and developer responses
|
|
214
|
+
- ❌ Cannot change status
|
|
215
|
+
- ❌ Cannot delete items
|
|
362
216
|
|
|
363
217
|
## How It Works
|
|
364
218
|
|
|
@@ -376,10 +230,12 @@ The widget comes with default styles, but you can customize them:
|
|
|
376
230
|
|
|
377
231
|
1. User opens dashboard (Ctrl+Shift+Q or programmatically)
|
|
378
232
|
2. Dashboard displays all feedback submissions
|
|
379
|
-
3. Developer
|
|
380
|
-
4. Status change
|
|
381
|
-
5.
|
|
382
|
-
6.
|
|
233
|
+
3. Developer clicks status dropdown and selects new status
|
|
234
|
+
4. Status change modal appears for optional developer comment
|
|
235
|
+
5. Developer adds comment (optional) and confirms
|
|
236
|
+
6. `onStatusChange` callback triggered with `{ id, status, comment }`
|
|
237
|
+
7. Your backend updates the database
|
|
238
|
+
8. Dashboard reflects the new status
|
|
383
239
|
|
|
384
240
|
## Browser Support
|
|
385
241
|
|
|
@@ -388,22 +244,6 @@ The widget comes with default styles, but you can customize them:
|
|
|
388
244
|
- ✅ Safari
|
|
389
245
|
- ✅ Opera
|
|
390
246
|
|
|
391
|
-
## Screenshot Capture
|
|
392
|
-
|
|
393
|
-
Uses `html-to-image` with `html2canvas` fallback for:
|
|
394
|
-
- ✅ Perfect CSS rendering
|
|
395
|
-
- ✅ Tailwind, Bootstrap, Material-UI support
|
|
396
|
-
- ✅ Gradients, shadows, modern CSS
|
|
397
|
-
- ✅ High-resolution (2x pixel ratio)
|
|
398
|
-
|
|
399
|
-
## Dependencies
|
|
400
|
-
|
|
401
|
-
- React ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
402
|
-
- react-dom ^16.8.0 || ^17.0.0 || ^18.0.0
|
|
403
|
-
- html-to-image ^1.11.13
|
|
404
|
-
- html2canvas ^1.4.1
|
|
405
|
-
- lucide-react ^0.263.1
|
|
406
|
-
|
|
407
247
|
## Local Development
|
|
408
248
|
|
|
409
249
|
```bash
|
|
@@ -425,21 +265,12 @@ npm run dev
|
|
|
425
265
|
|
|
426
266
|
Visit `http://localhost:8080` to see the demo!
|
|
427
267
|
|
|
428
|
-
## What's New in v1.
|
|
429
|
-
|
|
430
|
-
### Dashboard Feature
|
|
431
|
-
- 📊 Complete feedback management dashboard
|
|
432
|
-
- 👨💻 Developer/User mode with permission system
|
|
433
|
-
- 🏷️ 7 professional status options with custom dropdown
|
|
434
|
-
- 🔄 Status change callbacks for database sync
|
|
435
|
-
- 💾 localStorage or custom data source support
|
|
436
|
-
- 📅 Improved timestamp formatting (e.g., "21 Oct 2025 at 9:35 PM")
|
|
268
|
+
## What's New in v1.3.0
|
|
437
269
|
|
|
438
|
-
###
|
|
439
|
-
-
|
|
440
|
-
-
|
|
441
|
-
-
|
|
442
|
-
- 🗑️ Conditional delete permissions
|
|
270
|
+
### Status Change with Comments
|
|
271
|
+
- 💬 Developers can add optional comments when changing status
|
|
272
|
+
- 📝 Comments are passed to `onStatusChange` callback
|
|
273
|
+
- 👥 Comments visible to users as developer responses
|
|
443
274
|
|
|
444
275
|
## License
|
|
445
276
|
|
|
@@ -455,7 +286,7 @@ Report issues at: https://github.com/Murali1889/react-feedback-widget/issues
|
|
|
455
286
|
|
|
456
287
|
## Author
|
|
457
288
|
|
|
458
|
-
**Murali**
|
|
289
|
+
**Murali Vvrsn Gurajapu**
|
|
459
290
|
Email: murali.g@hyperverge.co
|
|
460
291
|
|
|
461
292
|
---
|