@matija2209/payload-plugin-admin-feedback 1.0.0 → 1.0.3

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
@@ -1,64 +1,55 @@
1
- ![Payload Admin Feedback Plugin header](./public/payload-admin-plugin-header.png)
1
+ ![Payload Admin Feedback Plugin header](https://img.buildwithmatija.com/api/images/wv5oune7/file/social)
2
2
 
3
- # payload-plugin-admin-feedback
3
+ # @matija2209/payload-plugin-admin-feedback
4
4
 
5
5
  Floating feedback/chat widget plugin for Payload CMS admin and selected Next.js frontend routes.
6
6
 
7
7
  ## Features
8
8
 
9
- - Adds `admin-feedback` collection to Payload
10
- - Floating client widget with:
11
- - message input
12
- - current page path capture
13
- - optional CSS selector capture
14
- - current-tab-first screenshot capture, full-screen annotation, clipboard paste, and file upload
15
- - native HTML5 tools for pen, rectangle, arrow, text, undo, redo, clear, and revert
16
- - Email notification on feedback creation through configured Payload email adapter
17
- - Frontend allowlist route matching helper
18
- - Strict media collection validation with fail-fast startup errors
9
+ - **Premium Email Notifications**: Beautifully formatted HTML emails with screenshot previews and direct admin panel links.
10
+ - **Flexible Email Routing**: Send feedback to specific addresses with custom "From" name/address support.
11
+ - **Smart Path Tracking**: Automatically captures the page path where feedback was submitted.
12
+ - **Advanced Annotation Tools**: Full-screen editor for screenshots with pen, rectangle, arrow, and text tools.
13
+ - **Easy Integration**: Hooks into your existing Payload email adapter (Brevo, Resend, Nodemailer, etc.).
14
+ - **Next.js Support**: Includes client components for both Admin panel and Frontend routes.
19
15
 
20
16
  ## Install
21
17
 
22
18
  ```bash
23
- pnpm add payload-plugin-admin-feedback
24
- ```
19
+ # pnpm
20
+ pnpm add @matija2209/payload-plugin-admin-feedback
25
21
 
26
- ## Requirements
22
+ # npm
23
+ npm install @matija2209/payload-plugin-admin-feedback
27
24
 
28
- - `payload` `^3.84.1` (native advanced plugin API with `definePlugin`)
29
- - `react` ^19
25
+ # yarn
26
+ yarn add @matija2209/payload-plugin-admin-feedback
30
27
 
31
- ## Version Compatibility
28
+ # bun
29
+ bun add @matija2209/payload-plugin-admin-feedback
30
+ ```
32
31
 
33
- | Plugin Version | Payload Version |
34
- | -------------- | --------------- |
35
- | 1.x.x | ^3.84.1 |
32
+ ## Requirements
33
+
34
+ - `payload` `^3.84.1`
35
+ - `react` `^19.0.0`
36
36
 
37
37
  ## Usage
38
38
 
39
39
  ```ts
40
40
  import { buildConfig } from 'payload'
41
- import { adminFeedbackPlugin } from 'payload-plugin-admin-feedback'
41
+ import { adminFeedbackPlugin } from '@matija2209/payload-plugin-admin-feedback'
42
42
 
43
43
  export default buildConfig({
44
44
  // ...
45
45
  plugins: [
46
46
  adminFeedbackPlugin({
47
- emailTo: 'it@example.com',
48
- fromLabel: 'Store Admin Feedback',
47
+ emailTo: 'admin@example.com',
48
+ fromName: 'Kmetija Mehak Feedback',
49
+ fromAddress: 'ne-odgovarjaj@kmetijamehak.si', // Must be a verified sender in your email adapter
50
+ fromLabel: 'Store Feedback',
49
51
  allowScreenshotUpload: true,
50
52
  mediaCollectionSlug: 'media',
51
- strictMediaCollection: true,
52
- screenshot: {
53
- maxFileSizeBytes: 5 * 1024 * 1024,
54
- allowedMimeTypes: ['image/png', 'image/jpeg', 'image/webp'],
55
- capturePolicy: 'current-tab-first',
56
- },
57
- maxMessageLength: 3000,
58
- frontend: {
59
- enabled: true,
60
- include: ['/marketplace*', '/profile*'],
61
- },
62
53
  }),
63
54
  ],
64
55
  })
@@ -66,93 +57,43 @@ export default buildConfig({
66
57
 
67
58
  ## Plugin Options
68
59
 
69
- - `enabled?: boolean` default `true`
70
- - `emailTo: string | string[]` required
71
- - `fromLabel?: string`
72
- - `allowScreenshotUpload?: boolean` default `true`
73
- - `mediaCollectionSlug?: string` default `'media'`
74
- - `strictMediaCollection?: boolean` default `true`
75
- - `screenshot?: { enabled?: boolean; maxFileSizeBytes?: number; allowedMimeTypes?: string[]; capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface' }`
76
- - `maxMessageLength?: number` default `3000`
60
+ - `emailTo: string | string[]` (Required): Where to send the feedback emails.
61
+ - `fromName?: string`: The name shown in the "From" field of the email.
62
+ - `fromAddress?: string`: The email address used as the sender.
63
+ - `email?: EmailAdapter`: Optional override for the Payload email adapter.
64
+ - `fromLabel?: string`: A label used in the email subject and header.
65
+ - `allowScreenshotUpload?: boolean` (default: `true`)
66
+ - `mediaCollectionSlug?: string` (default: `'media'`)
67
+ - `maxMessageLength?: number` (default: `3000`)
77
68
  - `frontend?: { enabled?: boolean; include?: string[] }`
78
- - `frontendRouteMatcher?: (pathname: string) => boolean`
79
-
80
- ## Screenshot Capture Behavior
81
-
82
- - `current-tab-first` is the default. The widget prefers the active browser tab and still accepts window or screen capture if the browser returns a broader surface.
83
- - `strict-current-tab` requires the captured surface to resolve as a browser tab and fails otherwise.
84
- - `any-surface` allows the browser to offer any supported surface without tab-first constraints.
85
- - Captured, pasted, and uploaded images all open in the same full-screen HTML5 annotation editor and are exported as a flattened PNG before upload.
86
-
87
- ## Storage Adapter Compatibility
88
-
89
- The plugin uploads images through the resolved Payload upload collection, not directly to a specific storage adapter.
90
-
91
- - If your upload collection is configured with `@payloadcms/storage-*`, uploads are automatically stored there.
92
- - If the configured collection slug is missing or not upload-enabled, plugin initialization fails with a clear error.
93
- - In strict mode (default), there are no fallback guesses to other collections.
94
69
 
95
70
  ## Client Components
96
71
 
97
- The plugin exports React client components for embedding the feedback widget on frontend routes and in the admin panel.
98
-
99
72
  ### Frontend Widget
100
73
 
101
- Add the `FrontendFeedbackWidget` to any layout or page that should show the floating feedback button. It uses `usePathname` from `next/navigation` to detect the current route and show/hide the widget based on the `include` patterns.
74
+ Add the `FeedbackWidget` to your frontend layout to enable feedback for your users.
102
75
 
103
76
  ```tsx
104
- import { FrontendFeedbackWidget } from 'payload-plugin-admin-feedback/client';
77
+ import { FeedbackWidget } from '@matija2209/payload-plugin-admin-feedback/client';
105
78
 
106
- export default function MyLayout({ children }: { children: React.ReactNode }) {
79
+ export default function RootLayout({ children }) {
107
80
  return (
108
- <>
109
- {children}
110
- <FrontendFeedbackWidget
111
- include={['/dashboard', '/dashboard/*', '/settings']}
112
- />
113
- </>
81
+ <html>
82
+ <body>
83
+ {children}
84
+ <FeedbackWidget
85
+ title="Send us your feedback"
86
+ include={['/shop*', '/account*']}
87
+ />
88
+ </body>
89
+ </html>
114
90
  );
115
91
  }
116
92
  ```
117
93
 
118
- **Props**
119
-
120
- | Prop | Type | Default | Description |
121
- | ---- | ---- | ------- | ----------- |
122
- | `include` | `string[]` | required | Glob patterns for routes where the widget is visible |
123
- | `position` | `{ bottom?: number; right?: number }` | `{ bottom: 20, right: 20 }` | Pixel offset from the viewport edge |
124
- | `buttonLabel` | `string` | `'Feedback'` | Text shown on the floating button |
125
- | `dialogTitle` | `string` | `'Send Feedback'` | Title shown in the dialog header |
126
-
127
- **Glob patterns** support `*` (single segment) and `**` (recursive):
128
- `/admin/*` matches `/admin/users` but not `/admin/settings/roles`.
129
- `/admin/**` matches `/admin`, `/admin/users`, `/admin/settings/roles`, etc.
130
-
131
94
  ### Admin Widget
132
95
 
133
- For rendering the widget inside the Payload admin panel:
134
-
135
- ```tsx
136
- import { AdminFeedbackWidget } from 'payload-plugin-admin-feedback/client';
137
-
138
- <AdminFeedbackWidget />
139
- ```
140
-
141
- ### Route Matcher
142
-
143
- A utility for programmatic path matching, exported for reuse:
144
-
145
- ```ts
146
- import { pathMatchesAllowlist } from 'payload-plugin-admin-feedback/client';
147
-
148
- const visible = pathMatchesAllowlist('/dashboard/users', ['/dashboard', '/dashboard/*']);
149
- // => true
150
- ```
151
-
152
- ## Migration Notes
153
-
154
- - The plugin uses native Payload advanced plugin metadata (`slug`, `order`, `options`) via `definePlugin`.
155
- - Existing usage with `adminFeedbackPlugin({ ...options })` remains unchanged.
96
+ The plugin automatically integrates with the Payload admin panel, but you can also use the exported components for custom placement.
156
97
 
157
98
  ## License
158
99