react-visual-feedback 1.4.8 → 1.4.9

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
@@ -8,9 +8,11 @@ A powerful, visual feedback collection tool for React applications with screen r
8
8
  - **Visual Element Selection** - Click any element with hover highlighting
9
9
  - **Screenshot Capture** - Automatic pixel-perfect screenshot with CSS rendering
10
10
  - **Screen Recording** - Record screen with audio and capture console/network logs
11
+ - **Manual Feedback** - `Alt+A` to open form directly without selection
12
+ - **File Attachments** - Drag & drop support for Images, Videos, PDFs, and other files
11
13
  - **Canvas Drawing** - Annotate screenshots with drawings and highlights
12
14
  - **React Component Detection** - Automatically detects React component names and source files
13
- - **Keyboard Shortcuts** - `Alt+Q` to activate, `Esc` to cancel
15
+ - **Keyboard Shortcuts** - `Alt+Q` (Selection), `Alt+A` (Manual), `Alt+W` (Record), `Esc` (Cancel)
14
16
 
15
17
  ### Session Replay
16
18
  - **Video Playback** - Watch recorded user sessions
@@ -51,6 +53,7 @@ import { FeedbackProvider } from 'react-visual-feedback';
51
53
  function App() {
52
54
  const handleFeedbackSubmit = async (feedbackData) => {
53
55
  console.log('Feedback received:', feedbackData);
56
+ // feedbackData.attachment contains any manually uploaded file
54
57
  await fetch('/api/feedback', {
55
58
  method: 'POST',
56
59
  headers: { 'Content-Type': 'application/json' },
@@ -88,7 +91,7 @@ function FeedbackButtons() {
88
91
 
89
92
  function App() {
90
93
  const handleFeedbackSubmit = async (feedbackData) => {
91
- // feedbackData contains: feedback, screenshot, video, eventLogs, elementInfo, etc.
94
+ // feedbackData contains: feedback, screenshot, video, attachment, eventLogs, elementInfo, etc.
92
95
  await fetch('/api/feedback', {
93
96
  method: 'POST',
94
97
  headers: { 'Content-Type': 'application/json' },
@@ -113,6 +116,7 @@ function App() {
113
116
  userName="John Doe"
114
117
  userEmail="john@example.com"
115
118
  mode="light"
119
+ defaultOpen={false} // Set to true to open feedback form on mount
116
120
  >
117
121
  <YourApp />
118
122
  <FeedbackButtons />
@@ -138,6 +142,7 @@ function App() {
138
142
  | `mode` | `'light' \| 'dark'` | `'light'` | Theme mode |
139
143
  | `isActive` | `boolean` | - | Controlled active state |
140
144
  | `onActiveChange` | `(active) => void` | - | Callback for controlled mode |
145
+ | `defaultOpen` | `boolean` | `false` | Open manual feedback form immediately on mount |
141
146
 
142
147
  ### FeedbackDashboard Props
143
148
 
@@ -204,11 +209,11 @@ interface FeedbackData {
204
209
  height: number;
205
210
  };
206
211
 
207
- // Screenshot (for element selection)
208
- screenshot?: string; // Base64 PNG data URL
212
+ // Attachments
213
+ screenshot?: string; // Base64 PNG data URL (Automatic)
214
+ video?: string; // Base64 webm data URL (Recording)
215
+ attachment?: File; // Generic file (Manual Upload)
209
216
 
210
- // Video (for screen recording)
211
- video?: string; // Base64 webm data URL
212
217
  eventLogs?: EventLog[]; // Console/network logs
213
218
 
214
219
  // Element info (for element selection)
@@ -284,6 +289,17 @@ CREATE TABLE feedback_videos (
284
289
  created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
285
290
  );
286
291
 
292
+ -- Generic attachments table
293
+ CREATE TABLE feedback_attachments (
294
+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
295
+ feedback_id UUID NOT NULL REFERENCES feedback(id) ON DELETE CASCADE,
296
+ file_name VARCHAR(255),
297
+ file_type VARCHAR(100),
298
+ file_size_bytes BIGINT,
299
+ file_data TEXT, -- Base64 or URL
300
+ created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
301
+ );
302
+
287
303
  -- Event logs table (console logs, network requests)
288
304
  CREATE TABLE feedback_event_logs (
289
305
  id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
@@ -409,6 +425,19 @@ CREATE TABLE feedback_videos (
409
425
  FOREIGN KEY (feedback_id) REFERENCES feedback(id) ON DELETE CASCADE
410
426
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
411
427
 
428
+ -- Attachments table
429
+ CREATE TABLE feedback_attachments (
430
+ id CHAR(36) PRIMARY KEY DEFAULT (UUID()),
431
+ feedback_id CHAR(36) NOT NULL,
432
+ file_name VARCHAR(255),
433
+ file_type VARCHAR(100),
434
+ file_size_bytes BIGINT,
435
+ file_data LONGTEXT,
436
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
437
+
438
+ FOREIGN KEY (feedback_id) REFERENCES feedback(id) ON DELETE CASCADE
439
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
440
+
412
441
  -- Event logs table
413
442
  CREATE TABLE feedback_event_logs (
414
443
  id CHAR(36) PRIMARY KEY DEFAULT (UUID()),
@@ -470,7 +499,7 @@ CREATE TABLE feedback_status_history (
470
499
  // POST /api/feedback - Submit new feedback
471
500
  app.post('/api/feedback', async (req, res) => {
472
501
  const { feedback, type, userName, userEmail, url, userAgent,
473
- viewport, screenshot, video, eventLogs, elementInfo } = req.body;
502
+ viewport, screenshot, video, attachment, eventLogs, elementInfo } = req.body;
474
503
 
475
504
  // Start transaction
476
505
  const client = await pool.connect();
@@ -501,6 +530,16 @@ app.post('/api/feedback', async (req, res) => {
501
530
  VALUES ($1, $2)
502
531
  `, [feedbackId, video]);
503
532
  }
533
+
534
+ // Insert manual attachment (generic file)
535
+ if (attachment) {
536
+ // Note: 'attachment' here is assumed to be pre-processed/uploaded file metadata + content
537
+ // In a real app, you might handle file upload separately (multipart/form-data)
538
+ await client.query(`
539
+ INSERT INTO feedback_attachments (feedback_id, file_name, file_data)
540
+ VALUES ($1, $2, $3)
541
+ `, [feedbackId, attachment.name, attachment.data]);
542
+ }
504
543
 
505
544
  // Insert event logs if exist
506
545
  if (eventLogs?.length) {
@@ -573,6 +612,7 @@ app.patch('/api/feedback/:id/status', async (req, res) => {
573
612
  | Shortcut | Action |
574
613
  |----------|--------|
575
614
  | `Alt+Q` | Activate feedback mode (element selection) |
615
+ | `Alt+A` | Open Manual Feedback form |
576
616
  | `Alt+W` | Start screen recording |
577
617
  | `Alt+Shift+Q` | Open dashboard |
578
618
  | `Esc` | Cancel/close |
@@ -845,6 +885,15 @@ import {
845
885
 
846
886
  ## Changelog
847
887
 
888
+ ### v1.5.0
889
+ - **Added**: Manual feedback mode (`Alt+A`) - open form without selecting an element
890
+ - **Added**: `defaultOpen` prop to automatically open form on mount
891
+ - **Added**: Drag & Drop file upload support
892
+ - **Added**: Support for generic file attachments (PDF, etc.)
893
+ - **Improved**: Dark mode colors for better contrast and readability
894
+ - **Improved**: Dashboard status badges now have solid backgrounds for better visibility
895
+ - **Improved**: Screenshot preview in dashboard with zoom overlay
896
+
848
897
  ### v1.4.2
849
898
  - **Fixed**: Modal state not resetting after submission (was showing "Sending..." on reopen)
850
899
  - **Added**: `Alt+W` keyboard shortcut for video recording