@matija2209/payload-plugin-admin-feedback 1.0.3 → 1.0.4
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 +29 -0
- package/README.md +155 -47
- package/dist/client/index.cjs +772 -1985
- package/dist/client/index.d.cts +7 -83
- package/dist/client/index.d.ts +7 -83
- package/dist/client/index.js +772 -1980
- package/dist/index.cjs +116 -182
- package/dist/index.d.cts +50 -3
- package/dist/index.d.ts +50 -3
- package/dist/index.js +116 -183
- package/package.json +25 -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/index.js
CHANGED
|
@@ -12,90 +12,8 @@ var corsHeaders = (req, init) => headersWithCors({
|
|
|
12
12
|
headers: new Headers(init),
|
|
13
13
|
req
|
|
14
14
|
});
|
|
15
|
-
var getCreatorId = (createdBy) => {
|
|
16
|
-
if (!createdBy) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
if (typeof createdBy === "object" && createdBy !== null && "id" in createdBy) {
|
|
20
|
-
const value = createdBy.id;
|
|
21
|
-
return value !== void 0 && value !== null ? String(value) : null;
|
|
22
|
-
}
|
|
23
|
-
if (typeof createdBy === "number" || typeof createdBy === "string") {
|
|
24
|
-
return String(createdBy);
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
};
|
|
28
|
-
var getRelationId = (value) => {
|
|
29
|
-
if (!value) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
if (typeof value === "object" && value !== null && "id" in value) {
|
|
33
|
-
const relationId = value.id;
|
|
34
|
-
return relationId !== void 0 && relationId !== null ? String(relationId) : null;
|
|
35
|
-
}
|
|
36
|
-
if (typeof value === "number" || typeof value === "string") {
|
|
37
|
-
return String(value);
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
};
|
|
41
15
|
|
|
42
|
-
// src/
|
|
43
|
-
var createDeleteFeedbackEndpoint = (mediaCollectionSlug) => ({
|
|
44
|
-
path: "/delete/:id",
|
|
45
|
-
method: "delete",
|
|
46
|
-
handler: async (req) => {
|
|
47
|
-
try {
|
|
48
|
-
if (!req.user) {
|
|
49
|
-
return Response.json(
|
|
50
|
-
{ success: false, error: "Unauthorized" },
|
|
51
|
-
{ status: 401, headers: corsHeaders(req) }
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
const id = req.routeParams?.id;
|
|
55
|
-
if (!id) {
|
|
56
|
-
return Response.json(
|
|
57
|
-
{ success: false, error: "Missing feedback ID." },
|
|
58
|
-
{ status: 400, headers: corsHeaders(req) }
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
const existing = await req.payload.findByID({
|
|
62
|
-
collection: "admin-feedback",
|
|
63
|
-
id
|
|
64
|
-
});
|
|
65
|
-
if (String(req.user.id) !== getCreatorId(existing.createdBy)) {
|
|
66
|
-
return Response.json(
|
|
67
|
-
{ success: false, error: "You can only delete your own feedback." },
|
|
68
|
-
{ status: 403, headers: corsHeaders(req) }
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
const screenshotId = getRelationId(existing.screenshot);
|
|
72
|
-
if (screenshotId) {
|
|
73
|
-
try {
|
|
74
|
-
await req.payload.delete({
|
|
75
|
-
collection: mediaCollectionSlug,
|
|
76
|
-
id: screenshotId
|
|
77
|
-
});
|
|
78
|
-
} catch (error) {
|
|
79
|
-
req.payload.logger.warn(
|
|
80
|
-
`Failed to delete feedback screenshot ${screenshotId}: ${error instanceof Error ? error.message : "unknown error"}`
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
await req.payload.delete({
|
|
85
|
-
collection: "admin-feedback",
|
|
86
|
-
id
|
|
87
|
-
});
|
|
88
|
-
return Response.json({ success: true }, { headers: corsHeaders(req) });
|
|
89
|
-
} catch (error) {
|
|
90
|
-
return Response.json(
|
|
91
|
-
{ success: false, error: error instanceof Error ? error.message : "Unknown error" },
|
|
92
|
-
{ status: 500, headers: corsHeaders(req) }
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// src/collections/admin-feedback/endpoints/deleteUpload.ts
|
|
16
|
+
// src/endpoints/deleteUpload.ts
|
|
99
17
|
var createDeleteUploadEndpoint = (mediaCollectionSlug) => ({
|
|
100
18
|
path: "/upload/:id",
|
|
101
19
|
method: "delete",
|
|
@@ -118,7 +36,10 @@ var createDeleteUploadEndpoint = (mediaCollectionSlug) => ({
|
|
|
118
36
|
collection: mediaCollectionSlug,
|
|
119
37
|
id
|
|
120
38
|
});
|
|
121
|
-
return Response.json(
|
|
39
|
+
return Response.json(
|
|
40
|
+
{ success: true },
|
|
41
|
+
{ headers: corsHeaders(req) }
|
|
42
|
+
);
|
|
122
43
|
} catch (error) {
|
|
123
44
|
return Response.json(
|
|
124
45
|
{ success: false, error: error instanceof Error ? error.message : "Unknown error" },
|
|
@@ -128,7 +49,7 @@ var createDeleteUploadEndpoint = (mediaCollectionSlug) => ({
|
|
|
128
49
|
}
|
|
129
50
|
});
|
|
130
51
|
|
|
131
|
-
// src/
|
|
52
|
+
// src/endpoints/submit.ts
|
|
132
53
|
var createSubmitEndpoint = () => ({
|
|
133
54
|
path: "/submit",
|
|
134
55
|
method: "post",
|
|
@@ -159,7 +80,10 @@ var createSubmitEndpoint = () => ({
|
|
|
159
80
|
}
|
|
160
81
|
}
|
|
161
82
|
});
|
|
162
|
-
return Response.json(
|
|
83
|
+
return Response.json(
|
|
84
|
+
{ success: true, id: doc.id },
|
|
85
|
+
{ headers: corsHeaders(req) }
|
|
86
|
+
);
|
|
163
87
|
} catch (error) {
|
|
164
88
|
return Response.json(
|
|
165
89
|
{ success: false, error: error instanceof Error ? error.message : "Unknown error" },
|
|
@@ -169,61 +93,57 @@ var createSubmitEndpoint = () => ({
|
|
|
169
93
|
}
|
|
170
94
|
});
|
|
171
95
|
|
|
172
|
-
// src/
|
|
173
|
-
var
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
96
|
+
// src/tenant/extractTenantSlug.ts
|
|
97
|
+
var extractTenantSlugFromPathname = (pathname, pathMarkers) => {
|
|
98
|
+
if (pathMarkers.length === 0) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const segments = pathname.split("?")[0].split("/").filter(Boolean);
|
|
102
|
+
for (const marker of pathMarkers) {
|
|
103
|
+
const markerIndex = segments.indexOf(marker);
|
|
104
|
+
if (markerIndex > 0) {
|
|
105
|
+
return segments[markerIndex - 1] ?? null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// src/tenant/resolveUploadTenant.ts
|
|
112
|
+
var resolveFeedbackUploadTenantId = async (req, options, tenantSlugFromForm) => {
|
|
113
|
+
const tenantConfig = options.tenant;
|
|
114
|
+
if (!tenantConfig?.enabled) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
let tenantSlug = tenantSlugFromForm;
|
|
118
|
+
if (!tenantSlug && tenantConfig.pathMarkers?.length) {
|
|
177
119
|
try {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
const id = req.routeParams?.id;
|
|
185
|
-
if (!id) {
|
|
186
|
-
return Response.json(
|
|
187
|
-
{ success: false, error: "Missing feedback ID." },
|
|
188
|
-
{ status: 400, headers: corsHeaders(req) }
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
const existing = await req.payload.findByID({
|
|
192
|
-
collection: "admin-feedback",
|
|
193
|
-
id
|
|
194
|
-
});
|
|
195
|
-
if (String(req.user.id) !== getCreatorId(existing.createdBy)) {
|
|
196
|
-
return Response.json(
|
|
197
|
-
{ success: false, error: "You can only edit your own feedback." },
|
|
198
|
-
{ status: 403, headers: corsHeaders(req) }
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
const body = await req.json();
|
|
202
|
-
const updateData = {};
|
|
203
|
-
const newMessage = trim(body?.message);
|
|
204
|
-
if (newMessage) {
|
|
205
|
-
updateData.message = newMessage;
|
|
206
|
-
}
|
|
207
|
-
if (body && "screenshotId" in body) {
|
|
208
|
-
updateData.screenshot = body.screenshotId || null;
|
|
209
|
-
}
|
|
210
|
-
const updated = await req.payload.update({
|
|
211
|
-
collection: "admin-feedback",
|
|
212
|
-
id: existing.id,
|
|
213
|
-
data: updateData
|
|
214
|
-
});
|
|
215
|
-
return Response.json({ success: true, doc: updated }, { headers: corsHeaders(req) });
|
|
216
|
-
} catch (error) {
|
|
217
|
-
return Response.json(
|
|
218
|
-
{ success: false, error: error instanceof Error ? error.message : "Unknown error" },
|
|
219
|
-
{ status: 500, headers: corsHeaders(req) }
|
|
220
|
-
);
|
|
120
|
+
const url = new URL(req.url || "", `http://${req.headers.get("host") || "localhost"}`);
|
|
121
|
+
tenantSlug = extractTenantSlugFromPathname(url.pathname, tenantConfig.pathMarkers);
|
|
122
|
+
} catch {
|
|
123
|
+
tenantSlug = null;
|
|
221
124
|
}
|
|
222
125
|
}
|
|
223
|
-
|
|
126
|
+
const collectionSlug = tenantConfig.collectionSlug || "tenants";
|
|
127
|
+
if (tenantSlug) {
|
|
128
|
+
const found = await req.payload.find({
|
|
129
|
+
collection: collectionSlug,
|
|
130
|
+
where: { slug: { equals: tenantSlug } },
|
|
131
|
+
limit: 1,
|
|
132
|
+
overrideAccess: true
|
|
133
|
+
});
|
|
134
|
+
const doc = found.docs[0];
|
|
135
|
+
if (doc?.id != null) {
|
|
136
|
+
return Number(doc.id);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (tenantConfig.resolveTenantId) {
|
|
140
|
+
return tenantConfig.resolveTenantId({ req, tenantSlug: tenantSlug ?? null });
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
};
|
|
224
144
|
|
|
225
|
-
// src/
|
|
226
|
-
var createUploadEndpoint = (mediaCollectionSlug) => ({
|
|
145
|
+
// src/endpoints/upload.ts
|
|
146
|
+
var createUploadEndpoint = (mediaCollectionSlug, options) => ({
|
|
227
147
|
path: "/upload",
|
|
228
148
|
method: "post",
|
|
229
149
|
handler: async (req) => {
|
|
@@ -237,7 +157,10 @@ var createUploadEndpoint = (mediaCollectionSlug) => ({
|
|
|
237
157
|
const formData = await req.formData();
|
|
238
158
|
const file = formData.get("file");
|
|
239
159
|
const altRaw = formData.get("alt");
|
|
160
|
+
const tenantSlugKey = options.tenant?.formDataSlugKey || "tenant";
|
|
161
|
+
const tenantSlugRaw = formData.get(tenantSlugKey);
|
|
240
162
|
const alt = typeof altRaw === "string" ? altRaw.trim() : "";
|
|
163
|
+
const tenantSlugFromForm = typeof tenantSlugRaw === "string" ? tenantSlugRaw.trim() : "";
|
|
241
164
|
if (!(file instanceof File)) {
|
|
242
165
|
return Response.json(
|
|
243
166
|
{ success: false, error: "Missing file." },
|
|
@@ -250,11 +173,27 @@ var createUploadEndpoint = (mediaCollectionSlug) => ({
|
|
|
250
173
|
{ status: 400, headers: corsHeaders(req) }
|
|
251
174
|
);
|
|
252
175
|
}
|
|
176
|
+
const mediaData = {
|
|
177
|
+
alt: alt || file.name
|
|
178
|
+
};
|
|
179
|
+
if (options.tenant?.enabled) {
|
|
180
|
+
const tenantId = await resolveFeedbackUploadTenantId(
|
|
181
|
+
req,
|
|
182
|
+
options,
|
|
183
|
+
tenantSlugFromForm || null
|
|
184
|
+
);
|
|
185
|
+
if (typeof tenantId !== "number") {
|
|
186
|
+
return Response.json(
|
|
187
|
+
{ success: false, error: "Tenant context required." },
|
|
188
|
+
{ status: 400, headers: corsHeaders(req) }
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
mediaData[options.tenant.fieldName || "tenant"] = tenantId;
|
|
192
|
+
}
|
|
253
193
|
const media = await req.payload.create({
|
|
254
194
|
collection: mediaCollectionSlug,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
},
|
|
195
|
+
overrideAccess: true,
|
|
196
|
+
data: mediaData,
|
|
258
197
|
file: {
|
|
259
198
|
data: Buffer.from(await file.arrayBuffer()),
|
|
260
199
|
mimetype: file.type || "application/octet-stream",
|
|
@@ -275,15 +214,6 @@ var createUploadEndpoint = (mediaCollectionSlug) => ({
|
|
|
275
214
|
}
|
|
276
215
|
});
|
|
277
216
|
|
|
278
|
-
// src/collections/admin-feedback/endpoints/index.ts
|
|
279
|
-
var createAdminFeedbackEndpoints = (mediaCollectionSlug) => [
|
|
280
|
-
createSubmitEndpoint(),
|
|
281
|
-
createUploadEndpoint(mediaCollectionSlug),
|
|
282
|
-
createDeleteUploadEndpoint(mediaCollectionSlug),
|
|
283
|
-
createUpdateFeedbackEndpoint(),
|
|
284
|
-
createDeleteFeedbackEndpoint(mediaCollectionSlug)
|
|
285
|
-
];
|
|
286
|
-
|
|
287
217
|
// src/server/sendFeedbackEmail.ts
|
|
288
218
|
async function sendFeedbackEmail(payload, options, data) {
|
|
289
219
|
if (!options.emailTo) {
|
|
@@ -406,7 +336,7 @@ async function sendFeedbackEmail(payload, options, data) {
|
|
|
406
336
|
await payload.sendEmail(emailMessage);
|
|
407
337
|
}
|
|
408
338
|
|
|
409
|
-
// src/
|
|
339
|
+
// src/hooks/afterChange.ts
|
|
410
340
|
var createAfterChangeHook = (options) => {
|
|
411
341
|
return async ({ doc, operation, req }) => {
|
|
412
342
|
if (operation !== "create") {
|
|
@@ -436,39 +366,35 @@ var createAfterChangeHook = (options) => {
|
|
|
436
366
|
};
|
|
437
367
|
};
|
|
438
368
|
|
|
439
|
-
// src/
|
|
440
|
-
var
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
369
|
+
// src/hooks/beforeChange.ts
|
|
370
|
+
var createBeforeChangeHook = () => {
|
|
371
|
+
return ({ data, req, operation }) => {
|
|
372
|
+
if (!data) {
|
|
373
|
+
return data;
|
|
374
|
+
}
|
|
375
|
+
const nextData = { ...data };
|
|
376
|
+
const message = trim(nextData.message);
|
|
377
|
+
const pagePath = trim(nextData.pagePath);
|
|
378
|
+
nextData.message = message || "";
|
|
379
|
+
nextData.pagePath = pagePath || "/";
|
|
380
|
+
nextData.selector = trim(nextData.selector);
|
|
381
|
+
nextData.selectedText = trim(nextData.selectedText);
|
|
382
|
+
const existingMeta = typeof nextData.meta === "object" && nextData.meta !== null ? nextData.meta : {};
|
|
383
|
+
nextData.meta = {
|
|
384
|
+
...existingMeta,
|
|
385
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
386
|
+
userAgent: trim(existingMeta.userAgent),
|
|
387
|
+
locale: trim(existingMeta.locale),
|
|
388
|
+
viewport: trim(existingMeta.viewport)
|
|
389
|
+
};
|
|
390
|
+
if (operation === "create" && req.user && !nextData.createdBy) {
|
|
391
|
+
nextData.createdBy = req.user.id;
|
|
392
|
+
}
|
|
393
|
+
return nextData;
|
|
458
394
|
};
|
|
459
|
-
if (operation === "create" && req.user && !nextData.createdBy) {
|
|
460
|
-
nextData.createdBy = req.user.id;
|
|
461
|
-
}
|
|
462
|
-
return nextData;
|
|
463
395
|
};
|
|
464
396
|
|
|
465
|
-
// src/collections/
|
|
466
|
-
var createAdminFeedbackHooks = (options) => ({
|
|
467
|
-
beforeChange: [normalizeFeedbackBeforeChange],
|
|
468
|
-
afterChange: [createAfterChangeHook(options)]
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// src/collections/admin-feedback/index.ts
|
|
397
|
+
// src/collections/AdminFeedback.ts
|
|
472
398
|
var createAdminFeedbackCollection = (options, mediaCollectionSlug) => {
|
|
473
399
|
return {
|
|
474
400
|
slug: "admin-feedback",
|
|
@@ -487,8 +413,15 @@ var createAdminFeedbackCollection = (options, mediaCollectionSlug) => {
|
|
|
487
413
|
update: ({ req }) => Boolean(req.user),
|
|
488
414
|
delete: ({ req }) => Boolean(req.user)
|
|
489
415
|
},
|
|
490
|
-
endpoints:
|
|
491
|
-
|
|
416
|
+
endpoints: [
|
|
417
|
+
createSubmitEndpoint(),
|
|
418
|
+
createUploadEndpoint(mediaCollectionSlug, options),
|
|
419
|
+
createDeleteUploadEndpoint(mediaCollectionSlug)
|
|
420
|
+
],
|
|
421
|
+
hooks: {
|
|
422
|
+
beforeChange: [createBeforeChangeHook()],
|
|
423
|
+
afterChange: [createAfterChangeHook(options)]
|
|
424
|
+
},
|
|
492
425
|
fields: [
|
|
493
426
|
{
|
|
494
427
|
name: "message",
|
|
@@ -640,4 +573,4 @@ var adminFeedbackPlugin = definePlugin({
|
|
|
640
573
|
}
|
|
641
574
|
});
|
|
642
575
|
|
|
643
|
-
export { adminFeedbackPlugin, pathMatchesAllowlist };
|
|
576
|
+
export { adminFeedbackPlugin, extractTenantSlugFromPathname, pathMatchesAllowlist };
|
package/package.json
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matija2209/payload-plugin-admin-feedback",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Floating admin feedback widget plugin for Payload CMS.",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist",
|
|
7
|
-
"README.md",
|
|
8
|
-
"public"
|
|
9
|
-
],
|
|
3
|
+
"version": "1.0.4",
|
|
10
4
|
"repository": {
|
|
11
5
|
"type": "git",
|
|
12
6
|
"url": "git+https://github.com/matija2209/payload-plugin-admin-feedback.git"
|
|
13
7
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"url": "https://github.com/matija2209/payload-plugin-admin-feedback/issues"
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
17
10
|
},
|
|
11
|
+
"description": "Floating admin feedback widget plugin for Payload CMS.",
|
|
18
12
|
"license": "MIT",
|
|
19
13
|
"type": "module",
|
|
20
14
|
"main": "./dist/index.js",
|
|
21
15
|
"types": "./dist/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
22
21
|
"exports": {
|
|
23
22
|
".": {
|
|
24
23
|
"types": "./dist/index.d.ts",
|
|
@@ -31,19 +30,24 @@
|
|
|
31
30
|
"require": "./dist/client/index.cjs"
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup && node scripts/stamp-client-boundary.mjs",
|
|
35
|
+
"dev": "tsup --watch",
|
|
36
|
+
"prepublishOnly": "npm run build"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
+
"next": "^15.0.0 || ^16.0.0",
|
|
39
40
|
"payload": "^3.84.1",
|
|
40
|
-
"react": "^19.0.0"
|
|
41
|
+
"react": "^19.0.0",
|
|
42
|
+
"react-dom": "^19.0.0"
|
|
41
43
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/react": "^19.2.14",
|
|
46
|
+
"next": "^16.0.0",
|
|
47
|
+
"payload": "^3.0.0",
|
|
48
|
+
"react": "^19.0.0",
|
|
49
|
+
"react-dom": "^19.0.0",
|
|
50
|
+
"tsup": "^8.5.1",
|
|
51
|
+
"typescript": "^5.9.3"
|
|
48
52
|
}
|
|
49
|
-
}
|
|
53
|
+
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Config } from 'payload';
|
|
2
|
-
|
|
3
|
-
type FrontendDisplayConfig = {
|
|
4
|
-
enabled?: boolean;
|
|
5
|
-
include?: string[];
|
|
6
|
-
};
|
|
7
|
-
type ScreenshotConfig = {
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
maxFileSizeBytes?: number;
|
|
10
|
-
allowedMimeTypes?: string[];
|
|
11
|
-
capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface';
|
|
12
|
-
};
|
|
13
|
-
type AdminFeedbackPluginOptions = {
|
|
14
|
-
enabled?: boolean;
|
|
15
|
-
emailTo: string | string[];
|
|
16
|
-
fromLabel?: string;
|
|
17
|
-
fromName?: string;
|
|
18
|
-
fromAddress?: string;
|
|
19
|
-
email?: Config['email'];
|
|
20
|
-
allowScreenshotUpload?: boolean;
|
|
21
|
-
maxMessageLength?: number;
|
|
22
|
-
mediaCollectionSlug?: string;
|
|
23
|
-
strictMediaCollection?: boolean;
|
|
24
|
-
screenshot?: ScreenshotConfig;
|
|
25
|
-
frontend?: FrontendDisplayConfig;
|
|
26
|
-
frontendRouteMatcher?: (pathname: string) => boolean;
|
|
27
|
-
};
|
|
28
|
-
type FeedbackStatus = 'new' | 'triaged' | 'resolved';
|
|
29
|
-
type FeedbackScreenshotInfo = {
|
|
30
|
-
id: number;
|
|
31
|
-
url?: string;
|
|
32
|
-
filename?: string;
|
|
33
|
-
alt?: string;
|
|
34
|
-
};
|
|
35
|
-
type FeedbackCreatedByInfo = {
|
|
36
|
-
id: number;
|
|
37
|
-
email?: string;
|
|
38
|
-
};
|
|
39
|
-
type FeedbackListItem = {
|
|
40
|
-
id: number;
|
|
41
|
-
message: string;
|
|
42
|
-
pagePath: string;
|
|
43
|
-
selector?: string | null;
|
|
44
|
-
selectedText?: string | null;
|
|
45
|
-
status: FeedbackStatus;
|
|
46
|
-
createdAt: string;
|
|
47
|
-
updatedAt: string;
|
|
48
|
-
createdBy?: FeedbackCreatedByInfo | number | null;
|
|
49
|
-
screenshot?: FeedbackScreenshotInfo | number | null;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
declare const pathMatchesAllowlist: (pathname: string, patterns: string[]) => boolean;
|
|
53
|
-
|
|
54
|
-
export { type AdminFeedbackPluginOptions as A, type FeedbackListItem as F, pathMatchesAllowlist as p };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Config } from 'payload';
|
|
2
|
-
|
|
3
|
-
type FrontendDisplayConfig = {
|
|
4
|
-
enabled?: boolean;
|
|
5
|
-
include?: string[];
|
|
6
|
-
};
|
|
7
|
-
type ScreenshotConfig = {
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
maxFileSizeBytes?: number;
|
|
10
|
-
allowedMimeTypes?: string[];
|
|
11
|
-
capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface';
|
|
12
|
-
};
|
|
13
|
-
type AdminFeedbackPluginOptions = {
|
|
14
|
-
enabled?: boolean;
|
|
15
|
-
emailTo: string | string[];
|
|
16
|
-
fromLabel?: string;
|
|
17
|
-
fromName?: string;
|
|
18
|
-
fromAddress?: string;
|
|
19
|
-
email?: Config['email'];
|
|
20
|
-
allowScreenshotUpload?: boolean;
|
|
21
|
-
maxMessageLength?: number;
|
|
22
|
-
mediaCollectionSlug?: string;
|
|
23
|
-
strictMediaCollection?: boolean;
|
|
24
|
-
screenshot?: ScreenshotConfig;
|
|
25
|
-
frontend?: FrontendDisplayConfig;
|
|
26
|
-
frontendRouteMatcher?: (pathname: string) => boolean;
|
|
27
|
-
};
|
|
28
|
-
type FeedbackStatus = 'new' | 'triaged' | 'resolved';
|
|
29
|
-
type FeedbackScreenshotInfo = {
|
|
30
|
-
id: number;
|
|
31
|
-
url?: string;
|
|
32
|
-
filename?: string;
|
|
33
|
-
alt?: string;
|
|
34
|
-
};
|
|
35
|
-
type FeedbackCreatedByInfo = {
|
|
36
|
-
id: number;
|
|
37
|
-
email?: string;
|
|
38
|
-
};
|
|
39
|
-
type FeedbackListItem = {
|
|
40
|
-
id: number;
|
|
41
|
-
message: string;
|
|
42
|
-
pagePath: string;
|
|
43
|
-
selector?: string | null;
|
|
44
|
-
selectedText?: string | null;
|
|
45
|
-
status: FeedbackStatus;
|
|
46
|
-
createdAt: string;
|
|
47
|
-
updatedAt: string;
|
|
48
|
-
createdBy?: FeedbackCreatedByInfo | number | null;
|
|
49
|
-
screenshot?: FeedbackScreenshotInfo | number | null;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
declare const pathMatchesAllowlist: (pathname: string, patterns: string[]) => boolean;
|
|
53
|
-
|
|
54
|
-
export { type AdminFeedbackPluginOptions as A, type FeedbackListItem as F, pathMatchesAllowlist as p };
|
|
Binary file
|