@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/dist/index.d.cts CHANGED
@@ -1,6 +1,79 @@
1
1
  import * as payload from 'payload';
2
- import { A as AdminFeedbackPluginOptions } from './routeMatcher-CmCMn_gT.cjs';
3
- export { p as pathMatchesAllowlist } from './routeMatcher-CmCMn_gT.cjs';
2
+ import { Config, PayloadRequest, CollectionConfig } from 'payload';
3
+
4
+ type TenantResolveArgs = {
5
+ req: PayloadRequest;
6
+ tenantSlug: string | null;
7
+ };
8
+ type TenantConfig = {
9
+ enabled?: boolean;
10
+ /** Tenants collection slug used to resolve slug → id (default `tenants`). */
11
+ collectionSlug?: string;
12
+ /** Relationship field on the upload collection (default `tenant`). */
13
+ fieldName?: string;
14
+ /** FormData key for an explicit tenant slug from the client (default `tenant`). */
15
+ formDataSlugKey?: string;
16
+ /** URL path segments — tenant slug is the segment immediately before each marker. */
17
+ pathMarkers?: string[];
18
+ /** Host-specific fallback when slug lookup is not enough (admin cookie, subdomain, …). */
19
+ resolveTenantId?: (args: TenantResolveArgs) => Promise<number | null> | number | null;
20
+ };
21
+ type FrontendDisplayConfig = {
22
+ enabled?: boolean;
23
+ include?: string[];
24
+ };
25
+ type ScreenshotConfig = {
26
+ enabled?: boolean;
27
+ maxFileSizeBytes?: number;
28
+ allowedMimeTypes?: string[];
29
+ capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface';
30
+ };
31
+ type FeedbackAccess = Pick<NonNullable<CollectionConfig['access']>, 'create' | 'read' | 'update' | 'delete'>;
32
+ type AdminWidgetConfig = {
33
+ /** Register the widget in `admin.components.providers` (default `false`). */
34
+ enabled?: boolean;
35
+ title?: string;
36
+ submitLabel?: string;
37
+ uploadLabel?: string;
38
+ };
39
+ type AdminFeedbackPluginOptions = {
40
+ enabled?: boolean;
41
+ emailTo: string | string[];
42
+ fromLabel?: string;
43
+ fromName?: string;
44
+ fromAddress?: string;
45
+ email?: Config['email'];
46
+ allowScreenshotUpload?: boolean;
47
+ maxMessageLength?: number;
48
+ mediaCollectionSlug?: string;
49
+ strictMediaCollection?: boolean;
50
+ screenshot?: ScreenshotConfig;
51
+ frontend?: FrontendDisplayConfig;
52
+ frontendRouteMatcher?: (pathname: string) => boolean;
53
+ tenant?: TenantConfig;
54
+ /**
55
+ * Access for the `admin-feedback` collection, per operation. Unset operations keep
56
+ * the defaults: create/read/update/delete need a signed-in user. The submit and
57
+ * upload endpoints check `create`, so this is the one place to restrict who may report.
58
+ */
59
+ access?: Partial<FeedbackAccess>;
60
+ /** Last word on the generated collection (labels, admin group, extra fields, hooks). */
61
+ collectionOverrides?: (collection: CollectionConfig) => CollectionConfig;
62
+ /** Floating widget in the Payload admin, registered by the plugin. */
63
+ adminWidget?: AdminWidgetConfig;
64
+ /**
65
+ * Absolute base URL of the admin host, used for the "View in Admin" link and
66
+ * relative screenshot URLs in the e-mail. Defaults to `config.serverURL`, then
67
+ * `NEXT_PUBLIC_SERVER_URL`.
68
+ */
69
+ adminBaseUrl?: string;
70
+ /** Locale for the date in the e-mail (default `sl-SI`, as in 1.0.x). */
71
+ emailDateLocale?: string;
72
+ };
73
+
74
+ declare const pathMatchesAllowlist: (pathname: string, patterns: string[]) => boolean;
75
+
76
+ declare const extractTenantSlugFromPathname: (pathname: string, pathMarkers: string[]) => string | null;
4
77
 
5
78
  declare const adminFeedbackPlugin: (options: AdminFeedbackPluginOptions) => payload.Plugin;
6
79
 
@@ -10,4 +83,4 @@ declare module 'payload' {
10
83
  }
11
84
  }
12
85
 
13
- export { AdminFeedbackPluginOptions, adminFeedbackPlugin };
86
+ export { type AdminFeedbackPluginOptions, type AdminWidgetConfig, type FeedbackAccess, type TenantConfig, adminFeedbackPlugin, extractTenantSlugFromPathname, pathMatchesAllowlist };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,79 @@
1
1
  import * as payload from 'payload';
2
- import { A as AdminFeedbackPluginOptions } from './routeMatcher-CmCMn_gT.js';
3
- export { p as pathMatchesAllowlist } from './routeMatcher-CmCMn_gT.js';
2
+ import { Config, PayloadRequest, CollectionConfig } from 'payload';
3
+
4
+ type TenantResolveArgs = {
5
+ req: PayloadRequest;
6
+ tenantSlug: string | null;
7
+ };
8
+ type TenantConfig = {
9
+ enabled?: boolean;
10
+ /** Tenants collection slug used to resolve slug → id (default `tenants`). */
11
+ collectionSlug?: string;
12
+ /** Relationship field on the upload collection (default `tenant`). */
13
+ fieldName?: string;
14
+ /** FormData key for an explicit tenant slug from the client (default `tenant`). */
15
+ formDataSlugKey?: string;
16
+ /** URL path segments — tenant slug is the segment immediately before each marker. */
17
+ pathMarkers?: string[];
18
+ /** Host-specific fallback when slug lookup is not enough (admin cookie, subdomain, …). */
19
+ resolveTenantId?: (args: TenantResolveArgs) => Promise<number | null> | number | null;
20
+ };
21
+ type FrontendDisplayConfig = {
22
+ enabled?: boolean;
23
+ include?: string[];
24
+ };
25
+ type ScreenshotConfig = {
26
+ enabled?: boolean;
27
+ maxFileSizeBytes?: number;
28
+ allowedMimeTypes?: string[];
29
+ capturePolicy?: 'current-tab-first' | 'strict-current-tab' | 'any-surface';
30
+ };
31
+ type FeedbackAccess = Pick<NonNullable<CollectionConfig['access']>, 'create' | 'read' | 'update' | 'delete'>;
32
+ type AdminWidgetConfig = {
33
+ /** Register the widget in `admin.components.providers` (default `false`). */
34
+ enabled?: boolean;
35
+ title?: string;
36
+ submitLabel?: string;
37
+ uploadLabel?: string;
38
+ };
39
+ type AdminFeedbackPluginOptions = {
40
+ enabled?: boolean;
41
+ emailTo: string | string[];
42
+ fromLabel?: string;
43
+ fromName?: string;
44
+ fromAddress?: string;
45
+ email?: Config['email'];
46
+ allowScreenshotUpload?: boolean;
47
+ maxMessageLength?: number;
48
+ mediaCollectionSlug?: string;
49
+ strictMediaCollection?: boolean;
50
+ screenshot?: ScreenshotConfig;
51
+ frontend?: FrontendDisplayConfig;
52
+ frontendRouteMatcher?: (pathname: string) => boolean;
53
+ tenant?: TenantConfig;
54
+ /**
55
+ * Access for the `admin-feedback` collection, per operation. Unset operations keep
56
+ * the defaults: create/read/update/delete need a signed-in user. The submit and
57
+ * upload endpoints check `create`, so this is the one place to restrict who may report.
58
+ */
59
+ access?: Partial<FeedbackAccess>;
60
+ /** Last word on the generated collection (labels, admin group, extra fields, hooks). */
61
+ collectionOverrides?: (collection: CollectionConfig) => CollectionConfig;
62
+ /** Floating widget in the Payload admin, registered by the plugin. */
63
+ adminWidget?: AdminWidgetConfig;
64
+ /**
65
+ * Absolute base URL of the admin host, used for the "View in Admin" link and
66
+ * relative screenshot URLs in the e-mail. Defaults to `config.serverURL`, then
67
+ * `NEXT_PUBLIC_SERVER_URL`.
68
+ */
69
+ adminBaseUrl?: string;
70
+ /** Locale for the date in the e-mail (default `sl-SI`, as in 1.0.x). */
71
+ emailDateLocale?: string;
72
+ };
73
+
74
+ declare const pathMatchesAllowlist: (pathname: string, patterns: string[]) => boolean;
75
+
76
+ declare const extractTenantSlugFromPathname: (pathname: string, pathMarkers: string[]) => string | null;
4
77
 
5
78
  declare const adminFeedbackPlugin: (options: AdminFeedbackPluginOptions) => payload.Plugin;
6
79
 
@@ -10,4 +83,4 @@ declare module 'payload' {
10
83
  }
11
84
  }
12
85
 
13
- export { AdminFeedbackPluginOptions, adminFeedbackPlugin };
86
+ export { type AdminFeedbackPluginOptions, type AdminWidgetConfig, type FeedbackAccess, type TenantConfig, adminFeedbackPlugin, extractTenantSlugFromPathname, pathMatchesAllowlist };