@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.
@@ -0,0 +1,140 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { F as FeedbackListItem } from '../routeMatcher-CmCMn_gT.cjs';
3
+ export { p as pathMatchesAllowlist } from '../routeMatcher-CmCMn_gT.cjs';
4
+ import 'payload';
5
+
6
+ type CapturePolicy = 'current-tab-first' | 'strict-current-tab' | 'any-surface';
7
+ type SubmitPayload = {
8
+ message: string;
9
+ pagePath: string;
10
+ selector?: string;
11
+ selectedText?: string;
12
+ screenshotId?: number | null;
13
+ meta?: {
14
+ userAgent?: string;
15
+ locale?: string;
16
+ viewport?: string;
17
+ };
18
+ };
19
+ type SubmitResult = {
20
+ success: true;
21
+ } | {
22
+ success: false;
23
+ error: string;
24
+ };
25
+ type UploadResult = {
26
+ success: true;
27
+ mediaId: number;
28
+ } | {
29
+ success: false;
30
+ error: string;
31
+ };
32
+ type DeleteResult = {
33
+ success: true;
34
+ } | {
35
+ success: false;
36
+ error: string;
37
+ };
38
+ type DeleteFeedbackResult = {
39
+ success: true;
40
+ } | {
41
+ success: false;
42
+ error: string;
43
+ };
44
+ type FeedbackWidgetProps = {
45
+ title?: string;
46
+ submitLabel?: string;
47
+ uploadLabel?: string;
48
+ allowScreenshotUpload?: boolean;
49
+ screenshotMaxFileSizeBytes?: number;
50
+ screenshotAllowedMimeTypes?: string[];
51
+ capturePolicy?: CapturePolicy;
52
+ onSubmit: (payload: SubmitPayload) => Promise<SubmitResult>;
53
+ onUpload?: (formData: FormData) => Promise<UploadResult>;
54
+ 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
+ };
72
+ declare function FeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, onSubmit, onUpload, onDeleteScreenshot, onDeleteFeedback, showHistory, currentUserId, onUpdateFeedback, history, }: FeedbackWidgetProps): react_jsx_runtime.JSX.Element;
73
+
74
+ declare function AdminFeedbackWidget(): react_jsx_runtime.JSX.Element;
75
+
76
+ type FrontendFeedbackWidgetProps = {
77
+ include: string[];
78
+ locales?: string[];
79
+ title?: string;
80
+ submitLabel?: string;
81
+ uploadLabel?: string;
82
+ showIndicators?: boolean;
83
+ showHistory?: boolean;
84
+ };
85
+ declare function FrontendFeedbackWidget({ include, locales, title, submitLabel, uploadLabel, showIndicators, showHistory, }: FrontendFeedbackWidgetProps): react_jsx_runtime.JSX.Element | null;
86
+
87
+ type FeedbackDetailProps = {
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;
112
+ };
113
+ declare function FeedbackHistory({ feedbacks, totalPages, currentPage, loading, error, currentUserId, onSelectFeedback, onPageChange, onRefetch, }: FeedbackHistoryProps): react_jsx_runtime.JSX.Element;
114
+
115
+ type FeedbackIndicatorsProps = {
116
+ pagePath?: string;
117
+ };
118
+ declare function FeedbackIndicators({ pagePath }: FeedbackIndicatorsProps): null;
119
+
120
+ type UseFeedbackQueryParams = {
121
+ pagePath?: string;
122
+ page?: number;
123
+ limit?: number;
124
+ };
125
+ type UseFeedbackQueryResult = {
126
+ feedbacks: FeedbackListItem[];
127
+ totalPages: number;
128
+ currentPage: number;
129
+ loading: boolean;
130
+ error: string | null;
131
+ refetch: () => void;
132
+ };
133
+ declare function useFeedbackQuery(params: UseFeedbackQueryParams): UseFeedbackQueryResult;
134
+ type UseCurrentUserResult = {
135
+ userId: number | null;
136
+ loading: boolean;
137
+ };
138
+ declare function useCurrentUser(): UseCurrentUserResult;
139
+
140
+ export { AdminFeedbackWidget, type CapturePolicy, type DeleteResult, FeedbackDetail, FeedbackHistory, FeedbackIndicators, FeedbackWidget, FrontendFeedbackWidget, type UploadResult, useCurrentUser, useFeedbackQuery };
@@ -0,0 +1,140 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { F as FeedbackListItem } from '../routeMatcher-CmCMn_gT.js';
3
+ export { p as pathMatchesAllowlist } from '../routeMatcher-CmCMn_gT.js';
4
+ import 'payload';
5
+
6
+ type CapturePolicy = 'current-tab-first' | 'strict-current-tab' | 'any-surface';
7
+ type SubmitPayload = {
8
+ message: string;
9
+ pagePath: string;
10
+ selector?: string;
11
+ selectedText?: string;
12
+ screenshotId?: number | null;
13
+ meta?: {
14
+ userAgent?: string;
15
+ locale?: string;
16
+ viewport?: string;
17
+ };
18
+ };
19
+ type SubmitResult = {
20
+ success: true;
21
+ } | {
22
+ success: false;
23
+ error: string;
24
+ };
25
+ type UploadResult = {
26
+ success: true;
27
+ mediaId: number;
28
+ } | {
29
+ success: false;
30
+ error: string;
31
+ };
32
+ type DeleteResult = {
33
+ success: true;
34
+ } | {
35
+ success: false;
36
+ error: string;
37
+ };
38
+ type DeleteFeedbackResult = {
39
+ success: true;
40
+ } | {
41
+ success: false;
42
+ error: string;
43
+ };
44
+ type FeedbackWidgetProps = {
45
+ title?: string;
46
+ submitLabel?: string;
47
+ uploadLabel?: string;
48
+ allowScreenshotUpload?: boolean;
49
+ screenshotMaxFileSizeBytes?: number;
50
+ screenshotAllowedMimeTypes?: string[];
51
+ capturePolicy?: CapturePolicy;
52
+ onSubmit: (payload: SubmitPayload) => Promise<SubmitResult>;
53
+ onUpload?: (formData: FormData) => Promise<UploadResult>;
54
+ 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
+ };
72
+ declare function FeedbackWidget({ title, submitLabel, uploadLabel, allowScreenshotUpload, screenshotMaxFileSizeBytes, screenshotAllowedMimeTypes, capturePolicy, onSubmit, onUpload, onDeleteScreenshot, onDeleteFeedback, showHistory, currentUserId, onUpdateFeedback, history, }: FeedbackWidgetProps): react_jsx_runtime.JSX.Element;
73
+
74
+ declare function AdminFeedbackWidget(): react_jsx_runtime.JSX.Element;
75
+
76
+ type FrontendFeedbackWidgetProps = {
77
+ include: string[];
78
+ locales?: string[];
79
+ title?: string;
80
+ submitLabel?: string;
81
+ uploadLabel?: string;
82
+ showIndicators?: boolean;
83
+ showHistory?: boolean;
84
+ };
85
+ declare function FrontendFeedbackWidget({ include, locales, title, submitLabel, uploadLabel, showIndicators, showHistory, }: FrontendFeedbackWidgetProps): react_jsx_runtime.JSX.Element | null;
86
+
87
+ type FeedbackDetailProps = {
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;
112
+ };
113
+ declare function FeedbackHistory({ feedbacks, totalPages, currentPage, loading, error, currentUserId, onSelectFeedback, onPageChange, onRefetch, }: FeedbackHistoryProps): react_jsx_runtime.JSX.Element;
114
+
115
+ type FeedbackIndicatorsProps = {
116
+ pagePath?: string;
117
+ };
118
+ declare function FeedbackIndicators({ pagePath }: FeedbackIndicatorsProps): null;
119
+
120
+ type UseFeedbackQueryParams = {
121
+ pagePath?: string;
122
+ page?: number;
123
+ limit?: number;
124
+ };
125
+ type UseFeedbackQueryResult = {
126
+ feedbacks: FeedbackListItem[];
127
+ totalPages: number;
128
+ currentPage: number;
129
+ loading: boolean;
130
+ error: string | null;
131
+ refetch: () => void;
132
+ };
133
+ declare function useFeedbackQuery(params: UseFeedbackQueryParams): UseFeedbackQueryResult;
134
+ type UseCurrentUserResult = {
135
+ userId: number | null;
136
+ loading: boolean;
137
+ };
138
+ declare function useCurrentUser(): UseCurrentUserResult;
139
+
140
+ export { AdminFeedbackWidget, type CapturePolicy, type DeleteResult, FeedbackDetail, FeedbackHistory, FeedbackIndicators, FeedbackWidget, FrontendFeedbackWidget, type UploadResult, useCurrentUser, useFeedbackQuery };