@david-xpn/llm-ui-feedback 0.1.0 → 0.1.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
@@ -45,6 +45,7 @@ That's it. A floating `+` button appears in the bottom-right corner. Click it to
45
45
  | `position` | `'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left'` | `'bottom-right'` | Corner position for the floating button |
46
46
  | `buttonColor` | `string` | `'#3b82f6'` | Hex color for the FAB button |
47
47
  | `hotkey` | `string` | `undefined` | Keyboard shortcut to toggle pick mode (e.g. `'Alt+F'`) |
48
+ | `enabled` | `boolean` | `true` | Whether the widget is rendered. Use to conditionally show the widget. |
48
49
 
49
50
  ### Example with all props
50
51
 
@@ -56,6 +57,21 @@ That's it. A floating `+` button appears in the bottom-right corner. Click it to
56
57
  />
57
58
  ```
58
59
 
60
+ ### Conditional rendering
61
+
62
+ Use the `enabled` prop to control when the widget is visible:
63
+
64
+ ```tsx
65
+ // Only on localhost
66
+ <FeedbackWidget enabled={location.hostname === 'localhost'} />
67
+
68
+ // Only for admins
69
+ <FeedbackWidget enabled={user.isSuperAdmin} />
70
+
71
+ // Only in dev/staging
72
+ <FeedbackWidget enabled={process.env.NODE_ENV !== 'production'} />
73
+ ```
74
+
59
75
  ## How It Works
60
76
 
61
77
  1. User clicks the `+` floating button to enter **pick mode**
package/dist/index.d.mts CHANGED
@@ -14,10 +14,41 @@ interface FeedbackEntry {
14
14
  elementText: string;
15
15
  comment: string;
16
16
  screenshot: string | null;
17
+ /** S3 object key for backends that store screenshots separately. */
18
+ screenshotKey?: string;
17
19
  prompt: string;
20
+ feedbackGroupId?: string;
21
+ }
22
+ interface Draft {
23
+ id: string;
24
+ timestamp: string;
25
+ url: string;
26
+ componentPath: string;
27
+ components: ComponentInfo[];
28
+ elementText: string;
29
+ comment: string;
30
+ screenshotKey?: string;
31
+ prompt: string;
32
+ createdBy: string;
33
+ createdByEmail?: string;
34
+ createdByName?: string;
35
+ }
36
+ type FeedbackGroupStatus = 'created' | 'in_progress' | 'resolved' | 'skipped' | 'will_not_do';
37
+ interface FeedbackGroup {
38
+ id: string;
39
+ title: string;
40
+ createdAt: string;
41
+ createdBy: string;
42
+ createdByEmail?: string;
43
+ createdByName?: string;
44
+ status?: FeedbackGroupStatus;
45
+ shareToken?: string;
46
+ entryCount?: number;
18
47
  }
19
48
  interface CapturedContext {
20
49
  url: string;
50
+ urlPath: string;
51
+ reportedAt: string;
21
52
  componentPath: string;
22
53
  components: ComponentInfo[];
23
54
  elementText: string;
@@ -26,17 +57,17 @@ interface CapturedContext {
26
57
  }
27
58
 
28
59
  interface FeedbackWidgetProps {
29
- /** Corner position for the floating buttons. Default: 'bottom-right' */
60
+ /** Tenant identifier required. */
61
+ clientId: string;
62
+ /** Backend API URL. Defaults to the production Lambda Function URL. */
63
+ apiUrl?: string;
64
+ /** Corner position for the floating button. Default: 'bottom-right' */
30
65
  position?: WidgetPosition;
31
- /** Hex color for the FAB and badge accent. Default: '#3b82f6' */
66
+ /** Hex color for the FAB accent. Default: '#3b82f6' */
32
67
  buttonColor?: string;
33
- /** Keyboard shortcut to toggle pick mode, e.g. 'Alt+F'. No default (opt-in only). */
68
+ /** Keyboard shortcut to toggle the panel, e.g. 'Alt+F'. No default (opt-in only). */
34
69
  hotkey?: string;
35
70
  }
36
- declare function FeedbackWidget({ position, buttonColor, hotkey, }?: FeedbackWidgetProps): React.ReactPortal;
37
-
38
- declare function loadEntries(): FeedbackEntry[];
39
- declare function deleteEntry(id: string): void;
40
- declare function clearEntries(): void;
71
+ declare function FeedbackWidget({ clientId, apiUrl, position, buttonColor, hotkey, }: FeedbackWidgetProps): React.ReactPortal | null;
41
72
 
42
- export { type CapturedContext, type ComponentInfo, type FeedbackEntry, FeedbackWidget, type FeedbackWidgetProps, type WidgetPosition, clearEntries, deleteEntry, loadEntries };
73
+ export { type CapturedContext, type ComponentInfo, type Draft, type FeedbackEntry, type FeedbackGroup, FeedbackWidget, type FeedbackWidgetProps, type WidgetPosition };
package/dist/index.d.ts CHANGED
@@ -14,10 +14,41 @@ interface FeedbackEntry {
14
14
  elementText: string;
15
15
  comment: string;
16
16
  screenshot: string | null;
17
+ /** S3 object key for backends that store screenshots separately. */
18
+ screenshotKey?: string;
17
19
  prompt: string;
20
+ feedbackGroupId?: string;
21
+ }
22
+ interface Draft {
23
+ id: string;
24
+ timestamp: string;
25
+ url: string;
26
+ componentPath: string;
27
+ components: ComponentInfo[];
28
+ elementText: string;
29
+ comment: string;
30
+ screenshotKey?: string;
31
+ prompt: string;
32
+ createdBy: string;
33
+ createdByEmail?: string;
34
+ createdByName?: string;
35
+ }
36
+ type FeedbackGroupStatus = 'created' | 'in_progress' | 'resolved' | 'skipped' | 'will_not_do';
37
+ interface FeedbackGroup {
38
+ id: string;
39
+ title: string;
40
+ createdAt: string;
41
+ createdBy: string;
42
+ createdByEmail?: string;
43
+ createdByName?: string;
44
+ status?: FeedbackGroupStatus;
45
+ shareToken?: string;
46
+ entryCount?: number;
18
47
  }
19
48
  interface CapturedContext {
20
49
  url: string;
50
+ urlPath: string;
51
+ reportedAt: string;
21
52
  componentPath: string;
22
53
  components: ComponentInfo[];
23
54
  elementText: string;
@@ -26,17 +57,17 @@ interface CapturedContext {
26
57
  }
27
58
 
28
59
  interface FeedbackWidgetProps {
29
- /** Corner position for the floating buttons. Default: 'bottom-right' */
60
+ /** Tenant identifier required. */
61
+ clientId: string;
62
+ /** Backend API URL. Defaults to the production Lambda Function URL. */
63
+ apiUrl?: string;
64
+ /** Corner position for the floating button. Default: 'bottom-right' */
30
65
  position?: WidgetPosition;
31
- /** Hex color for the FAB and badge accent. Default: '#3b82f6' */
66
+ /** Hex color for the FAB accent. Default: '#3b82f6' */
32
67
  buttonColor?: string;
33
- /** Keyboard shortcut to toggle pick mode, e.g. 'Alt+F'. No default (opt-in only). */
68
+ /** Keyboard shortcut to toggle the panel, e.g. 'Alt+F'. No default (opt-in only). */
34
69
  hotkey?: string;
35
70
  }
36
- declare function FeedbackWidget({ position, buttonColor, hotkey, }?: FeedbackWidgetProps): React.ReactPortal;
37
-
38
- declare function loadEntries(): FeedbackEntry[];
39
- declare function deleteEntry(id: string): void;
40
- declare function clearEntries(): void;
71
+ declare function FeedbackWidget({ clientId, apiUrl, position, buttonColor, hotkey, }: FeedbackWidgetProps): React.ReactPortal | null;
41
72
 
42
- export { type CapturedContext, type ComponentInfo, type FeedbackEntry, FeedbackWidget, type FeedbackWidgetProps, type WidgetPosition, clearEntries, deleteEntry, loadEntries };
73
+ export { type CapturedContext, type ComponentInfo, type Draft, type FeedbackEntry, type FeedbackGroup, FeedbackWidget, type FeedbackWidgetProps, type WidgetPosition };