react-visual-feedback 1.2.1 → 1.3.1

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 CHANGED
@@ -6,23 +6,30 @@ 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 of selected elements with perfect CSS rendering
10
- - 📝 Feedback form with rich context
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, Ctrl+Enter to submit)
13
+ - ⌨️ Keyboard shortcuts (Ctrl+Q to activate, Esc to cancel)
14
14
  - 🌓 Dark mode support
15
15
 
16
- ### Feedback Dashboard (New!)
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
- - **Custom dropdown** with smooth animations
22
- - 🔒 **Permission system** - Users can only view, developers can manage
23
- - 🔄 **Status change callbacks** for database synchronization
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
+ ### Update Notifications
27
+ - 🔔 Beautiful notification component for feedback updates
28
+ - 📬 Show users when their feedback status changes
29
+ - 🎨 Grouped by status (Completed, In Progress, Other)
30
+ - 👋 Dismiss individual updates or all at once
31
+ - ⏰ Smart time formatting (e.g., "2 hours ago", "3 days ago")
32
+
26
33
  ## Installation
27
34
 
28
35
  ```bash
@@ -89,7 +96,6 @@ function FeedbackButtons() {
89
96
 
90
97
  function App() {
91
98
  const handleFeedbackSubmit = async (feedbackData) => {
92
- console.log('Feedback received:', feedbackData);
93
99
  await fetch('/api/feedback', {
94
100
  method: 'POST',
95
101
  headers: { 'Content-Type': 'application/json' },
@@ -97,13 +103,12 @@ function App() {
97
103
  });
98
104
  };
99
105
 
100
- const handleStatusChange = async ({ id, status }) => {
101
- console.log('Status changed:', { id, status });
102
- // Update your database
106
+ const handleStatusChange = async ({ id, status, comment }) => {
107
+ // Update your database with status and developer comment
103
108
  await fetch(`/api/feedback/${id}/status`, {
104
109
  method: 'PATCH',
105
110
  headers: { 'Content-Type': 'application/json' },
106
- body: JSON.stringify({ status })
111
+ body: JSON.stringify({ status, comment })
107
112
  });
108
113
  };
109
114
 
@@ -125,9 +130,72 @@ function App() {
125
130
  export default App;
126
131
  ```
127
132
 
128
- ## Dashboard Features
133
+ ### With Update Notifications
134
+
135
+ ```jsx
136
+ import React, { useState } from 'react';
137
+ import {
138
+ FeedbackProvider,
139
+ FeedbackUpdatesNotification
140
+ } from 'react-visual-feedback';
141
+ import 'react-visual-feedback/dist/index.css';
142
+
143
+ function App() {
144
+ const [showNotifications, setShowNotifications] = useState(false);
145
+ const [updates, setUpdates] = useState([
146
+ {
147
+ id: '1',
148
+ title: 'Button not working on mobile',
149
+ feedback: 'The submit button is not clickable',
150
+ status: 'resolved',
151
+ responseMessage: 'Fixed! The button now works on all devices.',
152
+ resolvedBy: 'John Developer',
153
+ updatedAt: '2025-11-02T14:30:00Z'
154
+ },
155
+ {
156
+ id: '2',
157
+ title: 'Add dark mode',
158
+ feedback: 'Would be great to have dark mode',
159
+ status: 'inProgress',
160
+ responseMessage: 'Working on it! Should be ready next week.',
161
+ assignedTo: 'Sarah Designer',
162
+ estimatedResolutionDate: '2025-11-10T00:00:00Z',
163
+ updatedAt: '2025-11-01T11:00:00Z'
164
+ }
165
+ ]);
166
+
167
+ const handleDismissUpdate = (updateId) => {
168
+ setUpdates(prev => prev.filter(u => u.id !== updateId));
169
+ };
170
+
171
+ const handleDismissAll = () => {
172
+ setUpdates([]);
173
+ setShowNotifications(false);
174
+ };
129
175
 
130
- ### Status Options
176
+ return (
177
+ <FeedbackProvider onSubmit={handleFeedbackSubmit}>
178
+ <YourApp />
179
+
180
+ <button onClick={() => setShowNotifications(true)}>
181
+ 🔔 Updates ({updates.length})
182
+ </button>
183
+
184
+ <FeedbackUpdatesNotification
185
+ isOpen={showNotifications}
186
+ onClose={() => setShowNotifications(false)}
187
+ updates={updates}
188
+ onDismissUpdate={handleDismissUpdate}
189
+ onDismissAll={handleDismissAll}
190
+ />
191
+ </FeedbackProvider>
192
+ );
193
+ }
194
+
195
+ export default App;
196
+ ```
197
+
198
+ ## Status Options
131
199
 
132
200
  The dashboard includes 7 professional status options:
133
201
 
@@ -135,44 +203,11 @@ The dashboard includes 7 professional status options:
135
203
  |--------|-------|-------------|
136
204
  | **Reported** 🔴 | Red | Initial feedback submission |
137
205
  | **Opened** 🟠 | Amber | Acknowledged and under review |
138
- | **Doing it** 🔵 | Blue | Actively being worked on |
206
+ | **In Progress** 🔵 | Blue | Actively being worked on |
139
207
  | **Resolved** 🟢 | Green | Fixed and ready |
140
208
  | **Released** 🟣 | Purple | Deployed to production |
141
209
  | **Blocked** 🔴 | Red | Waiting on dependencies |
142
- | **Won't do** ⚪ | Gray | Not planned for implementation |
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
- ```
210
+ | **Won't Fix** ⚪ | Gray | Not planned for implementation |
176
211
 
177
212
  ## API Reference
178
213
 
@@ -181,7 +216,7 @@ The dashboard supports two modes:
181
216
  | Prop | Type | Required | Default | Description |
182
217
  |------|------|----------|---------|-------------|
183
218
  | `onSubmit` | `(feedbackData) => Promise<void>` | Yes | - | Callback when feedback is submitted |
184
- | `onStatusChange` | `({ id, status }) => void` | No | - | Callback when status changes |
219
+ | `onStatusChange` | `({ id, status, comment }) => void` | No | - | Callback when status changes (includes optional developer comment) |
185
220
  | `children` | `ReactNode` | Yes | - | Your app components |
186
221
  | `dashboard` | `boolean` | No | `false` | Enable dashboard feature |
187
222
  | `dashboardData` | `Array` | No | `undefined` | Custom feedback data (uses localStorage if undefined) |
@@ -189,8 +224,7 @@ The dashboard supports two modes:
189
224
  | `isUser` | `boolean` | No | `true` | Enable user mode (read-only) |
190
225
  | `userName` | `string` | No | `'Anonymous'` | User name for feedback submissions |
191
226
  | `userEmail` | `string` | No | `null` | User email for feedback submissions |
192
- | `isActive` | `boolean` | No | `undefined` | Control widget active state (controlled mode) |
193
- | `onActiveChange` | `(active: boolean) => void` | No | - | Callback when active state changes |
227
+ | `mode` | `'light' \| 'dark'` | No | `'light'` | Theme mode |
194
228
 
195
229
  ### useFeedback Hook
196
230
 
@@ -203,6 +237,32 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
203
237
  - `setIsActive`: `(active: boolean) => void` - Activate/deactivate feedback mode
204
238
  - `setIsDashboardOpen`: `(open: boolean) => void` - Open/close dashboard
205
239
 
240
+ ### FeedbackUpdatesNotification Props
241
+
242
+ | Prop | Type | Required | Default | Description |
243
+ |------|------|----------|---------|-------------|
244
+ | `isOpen` | `boolean` | Yes | - | Controls notification visibility |
245
+ | `onClose` | `() => void` | Yes | - | Callback when notification is closed |
246
+ | `updates` | `Array` | Yes | - | Array of feedback updates to display |
247
+ | `onDismissUpdate` | `(id: string) => void` | No | - | Callback when a single update is dismissed |
248
+ | `onDismissAll` | `() => void` | No | - | Callback when all updates are dismissed |
249
+
250
+ **Update Object Structure:**
251
+ ```typescript
252
+ {
253
+ id: string,
254
+ title?: string,
255
+ feedback: string,
256
+ status: 'reported' | 'opened' | 'inProgress' | 'resolved' | 'released' | 'blocked' | 'wontFix',
257
+ responseMessage?: string,
258
+ assignedTo?: string,
259
+ resolvedBy?: string,
260
+ estimatedResolutionDate?: string,
261
+ updatedAt: string,
262
+ createdAt?: string
263
+ }
264
+ ```
265
+
206
266
  ### Feedback Data Structure
207
267
 
208
268
  ```typescript
@@ -211,7 +271,7 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
211
271
  feedback: string,
212
272
  userName: string,
213
273
  userEmail: string | null,
214
- status: 'reported' | 'opened' | 'doingIt' | 'resolved' | 'released' | 'blocked' | 'wontDo',
274
+ status: 'reported' | 'opened' | 'inProgress' | 'resolved' | 'released' | 'blocked' | 'wontFix',
215
275
  timestamp: string, // ISO 8601 format
216
276
  url: string,
217
277
  elementInfo: {
@@ -220,24 +280,11 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
220
280
  className: string,
221
281
  selector: string,
222
282
  text: string,
223
- position: {
224
- x: number,
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
- }
283
+ position: { x: number, y: number, width: number, height: number },
284
+ styles: { backgroundColor: string, color: string, fontSize: string, fontFamily: string }
235
285
  },
236
286
  screenshot: string, // Base64 encoded PNG
237
- viewport: {
238
- width: number,
239
- height: number
240
- },
287
+ viewport: { width: number, height: number },
241
288
  userAgent: string
242
289
  }
243
290
  ```
@@ -251,114 +298,19 @@ const { isActive, setIsActive, setIsDashboardOpen } = useFeedback();
251
298
  | `Esc` | Cancel/close feedback mode or dashboard |
252
299
  | `Ctrl+Enter` | Submit feedback (when form is open) |
253
300
 
254
- ## Usage Examples
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);
301
+ ## Developer vs User Mode
287
302
 
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([]);
316
-
317
- useEffect(() => {
318
- // Load feedback from your API
319
- fetch('/api/feedback')
320
- .then(res => res.json())
321
- .then(setFeedbackData);
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 */ }
303
+ ### Developer Mode (`isDeveloper={true}`)
304
+ - View all technical details (element info, CSS, viewport, user agent)
305
+ - ✅ Change feedback status with optional comments
306
+ - ✅ Delete feedback items
307
+ - Full control over feedback management
357
308
 
358
- /* Dashboard */
359
- .feedback-dashboard { /* Dashboard container */ }
360
- .feedback-dashboard-backdrop { /* Dashboard backdrop */ }
361
- ```
309
+ ### User Mode (`isDeveloper={false}`)
310
+ - View feedback submissions
311
+ - See current status and developer responses
312
+ - ❌ Cannot change status
313
+ - ❌ Cannot delete items
362
314
 
363
315
  ## How It Works
364
316
 
@@ -376,10 +328,12 @@ The widget comes with default styles, but you can customize them:
376
328
 
377
329
  1. User opens dashboard (Ctrl+Shift+Q or programmatically)
378
330
  2. Dashboard displays all feedback submissions
379
- 3. Developer can change status via dropdown
380
- 4. Status change triggers `onStatusChange` callback
381
- 5. Your backend updates the database
382
- 6. Dashboard reflects the new status
331
+ 3. Developer clicks status dropdown and selects new status
332
+ 4. Status change modal appears for optional developer comment
333
+ 5. Developer adds comment (optional) and confirms
334
+ 6. `onStatusChange` callback triggered with `{ id, status, comment }`
335
+ 7. Your backend updates the database
336
+ 8. Dashboard reflects the new status
383
337
 
384
338
  ## Browser Support
385
339
 
@@ -388,22 +342,6 @@ The widget comes with default styles, but you can customize them:
388
342
  - ✅ Safari
389
343
  - ✅ Opera
390
344
 
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
345
  ## Local Development
408
346
 
409
347
  ```bash
@@ -425,21 +363,28 @@ npm run dev
425
363
 
426
364
  Visit `http://localhost:8080` to see the demo!
427
365
 
428
- ## What's New in v1.2.0
366
+ ## Components Exported
367
+
368
+ ```jsx
369
+ import {
370
+ FeedbackProvider, // Main provider component
371
+ useFeedback, // Hook to control feedback state
372
+ FeedbackUpdatesNotification // Notification component for updates
373
+ } from 'react-visual-feedback';
374
+ ```
375
+
376
+ ## What's New in v1.3.0
429
377
 
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")
378
+ ### Status Change with Comments
379
+ - 💬 Developers can add optional comments when changing status
380
+ - 📝 Comments are passed to `onStatusChange` callback
381
+ - 👥 Comments visible to users as developer responses
437
382
 
438
- ### UI Improvements
439
- - Smooth animations for status dropdown
440
- - 🎨 Professional minimal design
441
- - 🔒 Read-only status for users
442
- - 🗑️ Conditional delete permissions
383
+ ### Update Notifications Component
384
+ - 🔔 New `FeedbackUpdatesNotification` component
385
+ - 📬 Show users updates on their feedback
386
+ - 🎨 Beautifully grouped by status
387
+ - 👋 Dismiss individual or all updates
443
388
 
444
389
  ## License
445
390
 
@@ -455,7 +400,7 @@ Report issues at: https://github.com/Murali1889/react-feedback-widget/issues
455
400
 
456
401
  ## Author
457
402
 
458
- **Murali**
403
+ **Murali Vvrsn Gurajapu**
459
404
  Email: murali.g@hyperverge.co
460
405
 
461
406
  ---