@matija2209/payload-plugin-admin-feedback 1.0.3 → 1.1.0
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/CHANGELOG.md +56 -0
- package/README.md +178 -47
- package/dist/client/index.cjs +841 -2024
- package/dist/client/index.d.cts +35 -85
- package/dist/client/index.d.ts +35 -85
- package/dist/client/index.js +840 -2019
- package/dist/index.cjs +266 -209
- package/dist/index.d.cts +76 -3
- package/dist/index.d.ts +76 -3
- package/dist/index.js +266 -210
- package/package.json +30 -21
- package/dist/routeMatcher-CmCMn_gT.d.cts +0 -54
- package/dist/routeMatcher-CmCMn_gT.d.ts +0 -54
- package/public/payload-admin-plugin-header.png +0 -0
package/dist/client/index.d.cts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { F as FeedbackListItem } from '../routeMatcher-CmCMn_gT.cjs';
|
|
3
|
-
export { p as pathMatchesAllowlist } from '../routeMatcher-CmCMn_gT.cjs';
|
|
4
|
-
import 'payload';
|
|
1
|
+
import React from 'react';
|
|
5
2
|
|
|
6
3
|
type CapturePolicy = 'current-tab-first' | 'strict-current-tab' | 'any-surface';
|
|
7
4
|
type SubmitPayload = {
|
|
@@ -35,12 +32,6 @@ type DeleteResult = {
|
|
|
35
32
|
success: false;
|
|
36
33
|
error: string;
|
|
37
34
|
};
|
|
38
|
-
type DeleteFeedbackResult = {
|
|
39
|
-
success: true;
|
|
40
|
-
} | {
|
|
41
|
-
success: false;
|
|
42
|
-
error: string;
|
|
43
|
-
};
|
|
44
35
|
type FeedbackWidgetProps = {
|
|
45
36
|
title?: string;
|
|
46
37
|
submitLabel?: string;
|
|
@@ -52,89 +43,48 @@ type FeedbackWidgetProps = {
|
|
|
52
43
|
onSubmit: (payload: SubmitPayload) => Promise<SubmitResult>;
|
|
53
44
|
onUpload?: (formData: FormData) => Promise<UploadResult>;
|
|
54
45
|
onDeleteScreenshot?: (mediaId: number) => Promise<DeleteResult>;
|
|
55
|
-
onDeleteFeedback?: (id: number) => Promise<DeleteFeedbackResult>;
|
|
56
|
-
showHistory?: boolean;
|
|
57
|
-
currentUserId?: number | null;
|
|
58
|
-
onUpdateFeedback?: (id: number, data: {
|
|
59
|
-
message?: string;
|
|
60
|
-
screenshotId?: number | null;
|
|
61
|
-
}) => Promise<boolean>;
|
|
62
|
-
history?: {
|
|
63
|
-
feedbacks: FeedbackListItem[];
|
|
64
|
-
totalPages: number;
|
|
65
|
-
currentPage: number;
|
|
66
|
-
loading: boolean;
|
|
67
|
-
error: string | null;
|
|
68
|
-
refetch: () => void;
|
|
69
|
-
onPageChange: (page: number) => void;
|
|
70
|
-
};
|
|
71
46
|
};
|
|
72
|
-
declare function FeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, onSubmit, onUpload, onDeleteScreenshot,
|
|
73
|
-
|
|
74
|
-
declare function AdminFeedbackWidget(): react_jsx_runtime.JSX.Element;
|
|
47
|
+
declare function FeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, onSubmit, onUpload, onDeleteScreenshot, }: FeedbackWidgetProps): React.JSX.Element;
|
|
75
48
|
|
|
76
|
-
type
|
|
77
|
-
include: string[];
|
|
78
|
-
locales?: string[];
|
|
49
|
+
type AdminFeedbackWidgetProps = {
|
|
79
50
|
title?: string;
|
|
80
51
|
submitLabel?: string;
|
|
81
52
|
uploadLabel?: string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
feedback: FeedbackListItem;
|
|
89
|
-
currentUserId: number | null;
|
|
90
|
-
capturePolicy: CapturePolicy;
|
|
91
|
-
onBack: () => void;
|
|
92
|
-
onUpdate: (id: number, data: {
|
|
93
|
-
message?: string;
|
|
94
|
-
screenshotId?: number | null;
|
|
95
|
-
}) => Promise<boolean>;
|
|
96
|
-
onDelete: (id: number) => Promise<boolean>;
|
|
97
|
-
onUpload: (formData: FormData) => Promise<UploadResult>;
|
|
98
|
-
onDeleteScreenshot: (mediaId: number) => Promise<DeleteResult>;
|
|
99
|
-
};
|
|
100
|
-
declare function FeedbackDetail({ feedback, currentUserId, capturePolicy: _capturePolicy, onBack, onUpdate, onDelete, onUpload, onDeleteScreenshot, }: FeedbackDetailProps): react_jsx_runtime.JSX.Element;
|
|
101
|
-
|
|
102
|
-
type FeedbackHistoryProps = {
|
|
103
|
-
feedbacks: FeedbackListItem[];
|
|
104
|
-
totalPages: number;
|
|
105
|
-
currentPage: number;
|
|
106
|
-
loading: boolean;
|
|
107
|
-
error: string | null;
|
|
108
|
-
currentUserId: number | null;
|
|
109
|
-
onSelectFeedback: (id: number) => void;
|
|
110
|
-
onPageChange: (page: number) => void;
|
|
111
|
-
onRefetch: () => void;
|
|
53
|
+
allowScreenshotUpload?: boolean;
|
|
54
|
+
screenshotMaxFileSizeBytes?: number;
|
|
55
|
+
screenshotAllowedMimeTypes?: string[];
|
|
56
|
+
capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface';
|
|
57
|
+
/** Payload REST base path (`config.routes.api`), default `/api`. */
|
|
58
|
+
apiRoute?: string;
|
|
112
59
|
};
|
|
113
|
-
declare function
|
|
60
|
+
declare function AdminFeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, apiRoute, }: AdminFeedbackWidgetProps): React.JSX.Element;
|
|
114
61
|
|
|
115
|
-
type
|
|
116
|
-
|
|
62
|
+
type AdminFeedbackProviderProps = Omit<AdminFeedbackWidgetProps, 'apiRoute'> & {
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
/** Collection slug whose `create` permission decides whether the widget shows. */
|
|
65
|
+
collectionSlug?: string;
|
|
117
66
|
};
|
|
118
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Admin provider the plugin registers in `admin.components.providers` when
|
|
69
|
+
* `adminWidget.enabled` is set. It renders the widget only for a signed-in user
|
|
70
|
+
* whose permissions allow creating feedback, so the login screen and accounts
|
|
71
|
+
* without access never see a button that would fail.
|
|
72
|
+
*/
|
|
73
|
+
declare function AdminFeedbackProvider({ children, collectionSlug, ...widgetProps }: AdminFeedbackProviderProps): React.JSX.Element;
|
|
119
74
|
|
|
120
|
-
type
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
133
|
-
declare function useFeedbackQuery(params: UseFeedbackQueryParams): UseFeedbackQueryResult;
|
|
134
|
-
type UseCurrentUserResult = {
|
|
135
|
-
userId: number | null;
|
|
136
|
-
loading: boolean;
|
|
75
|
+
type FrontendFeedbackWidgetProps = {
|
|
76
|
+
include: string[];
|
|
77
|
+
locales?: string[];
|
|
78
|
+
title?: string;
|
|
79
|
+
submitLabel?: string;
|
|
80
|
+
uploadLabel?: string;
|
|
81
|
+
/** URL markers (`pisarna`, `narocilnica`, …) — tenant slug is the segment before the marker. */
|
|
82
|
+
tenantPathMarkers?: string[];
|
|
83
|
+
/** FormData key for tenant slug on upload (default `tenant`). */
|
|
84
|
+
tenantFormDataKey?: string;
|
|
85
|
+
/** Payload REST base path (`config.routes.api`), default `/api`. */
|
|
86
|
+
apiRoute?: string;
|
|
137
87
|
};
|
|
138
|
-
declare function
|
|
88
|
+
declare function FrontendFeedbackWidget({ include, locales, title, submitLabel, uploadLabel, tenantPathMarkers, tenantFormDataKey, apiRoute, }: FrontendFeedbackWidgetProps): React.JSX.Element | null;
|
|
139
89
|
|
|
140
|
-
export {
|
|
90
|
+
export { AdminFeedbackProvider, AdminFeedbackWidget, type AdminFeedbackWidgetProps, FeedbackWidget, FrontendFeedbackWidget };
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { F as FeedbackListItem } from '../routeMatcher-CmCMn_gT.js';
|
|
3
|
-
export { p as pathMatchesAllowlist } from '../routeMatcher-CmCMn_gT.js';
|
|
4
|
-
import 'payload';
|
|
1
|
+
import React from 'react';
|
|
5
2
|
|
|
6
3
|
type CapturePolicy = 'current-tab-first' | 'strict-current-tab' | 'any-surface';
|
|
7
4
|
type SubmitPayload = {
|
|
@@ -35,12 +32,6 @@ type DeleteResult = {
|
|
|
35
32
|
success: false;
|
|
36
33
|
error: string;
|
|
37
34
|
};
|
|
38
|
-
type DeleteFeedbackResult = {
|
|
39
|
-
success: true;
|
|
40
|
-
} | {
|
|
41
|
-
success: false;
|
|
42
|
-
error: string;
|
|
43
|
-
};
|
|
44
35
|
type FeedbackWidgetProps = {
|
|
45
36
|
title?: string;
|
|
46
37
|
submitLabel?: string;
|
|
@@ -52,89 +43,48 @@ type FeedbackWidgetProps = {
|
|
|
52
43
|
onSubmit: (payload: SubmitPayload) => Promise<SubmitResult>;
|
|
53
44
|
onUpload?: (formData: FormData) => Promise<UploadResult>;
|
|
54
45
|
onDeleteScreenshot?: (mediaId: number) => Promise<DeleteResult>;
|
|
55
|
-
onDeleteFeedback?: (id: number) => Promise<DeleteFeedbackResult>;
|
|
56
|
-
showHistory?: boolean;
|
|
57
|
-
currentUserId?: number | null;
|
|
58
|
-
onUpdateFeedback?: (id: number, data: {
|
|
59
|
-
message?: string;
|
|
60
|
-
screenshotId?: number | null;
|
|
61
|
-
}) => Promise<boolean>;
|
|
62
|
-
history?: {
|
|
63
|
-
feedbacks: FeedbackListItem[];
|
|
64
|
-
totalPages: number;
|
|
65
|
-
currentPage: number;
|
|
66
|
-
loading: boolean;
|
|
67
|
-
error: string | null;
|
|
68
|
-
refetch: () => void;
|
|
69
|
-
onPageChange: (page: number) => void;
|
|
70
|
-
};
|
|
71
46
|
};
|
|
72
|
-
declare function FeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, onSubmit, onUpload, onDeleteScreenshot,
|
|
73
|
-
|
|
74
|
-
declare function AdminFeedbackWidget(): react_jsx_runtime.JSX.Element;
|
|
47
|
+
declare function FeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, onSubmit, onUpload, onDeleteScreenshot, }: FeedbackWidgetProps): React.JSX.Element;
|
|
75
48
|
|
|
76
|
-
type
|
|
77
|
-
include: string[];
|
|
78
|
-
locales?: string[];
|
|
49
|
+
type AdminFeedbackWidgetProps = {
|
|
79
50
|
title?: string;
|
|
80
51
|
submitLabel?: string;
|
|
81
52
|
uploadLabel?: string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
feedback: FeedbackListItem;
|
|
89
|
-
currentUserId: number | null;
|
|
90
|
-
capturePolicy: CapturePolicy;
|
|
91
|
-
onBack: () => void;
|
|
92
|
-
onUpdate: (id: number, data: {
|
|
93
|
-
message?: string;
|
|
94
|
-
screenshotId?: number | null;
|
|
95
|
-
}) => Promise<boolean>;
|
|
96
|
-
onDelete: (id: number) => Promise<boolean>;
|
|
97
|
-
onUpload: (formData: FormData) => Promise<UploadResult>;
|
|
98
|
-
onDeleteScreenshot: (mediaId: number) => Promise<DeleteResult>;
|
|
99
|
-
};
|
|
100
|
-
declare function FeedbackDetail({ feedback, currentUserId, capturePolicy: _capturePolicy, onBack, onUpdate, onDelete, onUpload, onDeleteScreenshot, }: FeedbackDetailProps): react_jsx_runtime.JSX.Element;
|
|
101
|
-
|
|
102
|
-
type FeedbackHistoryProps = {
|
|
103
|
-
feedbacks: FeedbackListItem[];
|
|
104
|
-
totalPages: number;
|
|
105
|
-
currentPage: number;
|
|
106
|
-
loading: boolean;
|
|
107
|
-
error: string | null;
|
|
108
|
-
currentUserId: number | null;
|
|
109
|
-
onSelectFeedback: (id: number) => void;
|
|
110
|
-
onPageChange: (page: number) => void;
|
|
111
|
-
onRefetch: () => void;
|
|
53
|
+
allowScreenshotUpload?: boolean;
|
|
54
|
+
screenshotMaxFileSizeBytes?: number;
|
|
55
|
+
screenshotAllowedMimeTypes?: string[];
|
|
56
|
+
capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface';
|
|
57
|
+
/** Payload REST base path (`config.routes.api`), default `/api`. */
|
|
58
|
+
apiRoute?: string;
|
|
112
59
|
};
|
|
113
|
-
declare function
|
|
60
|
+
declare function AdminFeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, apiRoute, }: AdminFeedbackWidgetProps): React.JSX.Element;
|
|
114
61
|
|
|
115
|
-
type
|
|
116
|
-
|
|
62
|
+
type AdminFeedbackProviderProps = Omit<AdminFeedbackWidgetProps, 'apiRoute'> & {
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
/** Collection slug whose `create` permission decides whether the widget shows. */
|
|
65
|
+
collectionSlug?: string;
|
|
117
66
|
};
|
|
118
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Admin provider the plugin registers in `admin.components.providers` when
|
|
69
|
+
* `adminWidget.enabled` is set. It renders the widget only for a signed-in user
|
|
70
|
+
* whose permissions allow creating feedback, so the login screen and accounts
|
|
71
|
+
* without access never see a button that would fail.
|
|
72
|
+
*/
|
|
73
|
+
declare function AdminFeedbackProvider({ children, collectionSlug, ...widgetProps }: AdminFeedbackProviderProps): React.JSX.Element;
|
|
119
74
|
|
|
120
|
-
type
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
133
|
-
declare function useFeedbackQuery(params: UseFeedbackQueryParams): UseFeedbackQueryResult;
|
|
134
|
-
type UseCurrentUserResult = {
|
|
135
|
-
userId: number | null;
|
|
136
|
-
loading: boolean;
|
|
75
|
+
type FrontendFeedbackWidgetProps = {
|
|
76
|
+
include: string[];
|
|
77
|
+
locales?: string[];
|
|
78
|
+
title?: string;
|
|
79
|
+
submitLabel?: string;
|
|
80
|
+
uploadLabel?: string;
|
|
81
|
+
/** URL markers (`pisarna`, `narocilnica`, …) — tenant slug is the segment before the marker. */
|
|
82
|
+
tenantPathMarkers?: string[];
|
|
83
|
+
/** FormData key for tenant slug on upload (default `tenant`). */
|
|
84
|
+
tenantFormDataKey?: string;
|
|
85
|
+
/** Payload REST base path (`config.routes.api`), default `/api`. */
|
|
86
|
+
apiRoute?: string;
|
|
137
87
|
};
|
|
138
|
-
declare function
|
|
88
|
+
declare function FrontendFeedbackWidget({ include, locales, title, submitLabel, uploadLabel, tenantPathMarkers, tenantFormDataKey, apiRoute, }: FrontendFeedbackWidgetProps): React.JSX.Element | null;
|
|
139
89
|
|
|
140
|
-
export {
|
|
90
|
+
export { AdminFeedbackProvider, AdminFeedbackWidget, type AdminFeedbackWidgetProps, FeedbackWidget, FrontendFeedbackWidget };
|