@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 +47 -106
- package/dist/client/index.cjs +2851 -0
- package/dist/client/index.d.cts +140 -0
- package/dist/client/index.d.ts +140 -0
- package/dist/client/index.js +2838 -0
- package/dist/index.cjs +646 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +643 -0
- package/dist/routeMatcher-CmCMn_gT.d.cts +54 -0
- package/dist/routeMatcher-CmCMn_gT.d.ts +54 -0
- package/package.json +25 -5
- package/src/client/AdminFeedbackWidget.tsx +0 -63
- package/src/client/FeedbackWidget.tsx +0 -1438
- package/src/client/FrontendFeedbackWidget.tsx +0 -100
- package/src/client/index.ts +0 -4
- package/src/client/routeMatcher.ts +0 -18
- package/src/collections/AdminFeedback.ts +0 -325
- package/src/index.ts +0 -108
- package/src/server/sendFeedbackEmail.ts +0 -141
- package/src/types.ts +0 -73
- package/tsconfig.build.json +0 -14
- package/tsconfig.json +0 -19
- package/tsup.config.ts +0 -29
package/README.md
CHANGED
|
@@ -1,64 +1,55 @@
|
|
|
1
|
-

|
|
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
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
24
|
-
|
|
19
|
+
# pnpm
|
|
20
|
+
pnpm add @matija2209/payload-plugin-admin-feedback
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
# npm
|
|
23
|
+
npm install @matija2209/payload-plugin-admin-feedback
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @matija2209/payload-plugin-admin-feedback
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
# bun
|
|
29
|
+
bun add @matija2209/payload-plugin-admin-feedback
|
|
30
|
+
```
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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: '
|
|
48
|
-
|
|
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
|
-
- `
|
|
70
|
-
- `
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
74
|
-
- `
|
|
75
|
-
- `
|
|
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 `
|
|
74
|
+
Add the `FeedbackWidget` to your frontend layout to enable feedback for your users.
|
|
102
75
|
|
|
103
76
|
```tsx
|
|
104
|
-
import {
|
|
77
|
+
import { FeedbackWidget } from '@matija2209/payload-plugin-admin-feedback/client';
|
|
105
78
|
|
|
106
|
-
export default function
|
|
79
|
+
export default function RootLayout({ children }) {
|
|
107
80
|
return (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
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
|
|