@payloadcms/next 3.0.0-beta.80 → 3.0.0-beta.81

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getViewsFromConfig.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getViewsFromConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAa9B,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,MAAM,IAAI;IAClD,SAAS,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,kBAAkB,+EAM5B;IACD,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAA;IACvB,cAAc,EAAE,oBAAoB,GAAG,gBAAgB,CAAA;IACvD,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB,KAAG;IACF,UAAU,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACnD,WAAW,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACpD;;OAEG;IACH,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAC1C,GAAG,IA+TH,CAAA"}
1
+ {"version":3,"file":"getViewsFromConfig.d.ts","sourceRoot":"","sources":["../../../src/views/Document/getViewsFromConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAa9B,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,MAAM,IAAI;IAClD,SAAS,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,kBAAkB,+EAM5B;IACD,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAA;IACvB,cAAc,EAAE,oBAAoB,GAAG,gBAAgB,CAAA;IACvD,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB,KAAG;IACF,UAAU,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACnD,WAAW,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACpD;;OAEG;IACH,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAC1C,GAAG,IA6SH,CAAA"}
@@ -16,295 +16,281 @@ export const getViewsFromConfig = ({ collectionConfig, config, docPermissions, g
16
16
  const views = collectionConfig && collectionConfig?.admin?.components?.views || globalConfig && globalConfig?.admin?.components?.views;
17
17
  const livePreviewEnabled = collectionConfig && collectionConfig?.admin?.livePreview || config?.admin?.livePreview?.collections?.includes(collectionConfig?.slug) || globalConfig && globalConfig?.admin?.livePreview || config?.admin?.livePreview?.globals?.includes(globalConfig?.slug);
18
18
  if (collectionConfig) {
19
- const editConfig = collectionConfig?.admin?.components?.views?.edit;
20
- const EditOverride = typeof editConfig === 'function' ? editConfig : null;
21
- if (EditOverride) {
22
- CustomView = EditOverride;
23
- }
24
- if (!EditOverride) {
25
- const [collectionEntity, collectionSlug, segment3, segment4, segment5, ...remainingSegments] = routeSegments;
26
- if (!docPermissions?.read?.permission) {
27
- notFound();
28
- } else {
29
- // `../:id`, or `../create`
30
- switch(routeSegments.length){
31
- case 3:
32
- {
33
- switch(segment3){
34
- case 'create':
35
- {
36
- if ('create' in docPermissions && docPermissions?.create?.permission) {
37
- CustomView = {
38
- payloadComponent: getCustomViewByKey(views, 'default')
39
- };
40
- DefaultView = {
41
- Component: DefaultEditView
42
- };
43
- } else {
44
- ErrorView = {
45
- Component: UnauthorizedView
46
- };
47
- }
48
- break;
49
- }
50
- default:
51
- {
19
+ const [collectionEntity, collectionSlug, segment3, segment4, segment5, ...remainingSegments] = routeSegments;
20
+ if (!docPermissions?.read?.permission) {
21
+ notFound();
22
+ } else {
23
+ // `../:id`, or `../create`
24
+ switch(routeSegments.length){
25
+ case 3:
26
+ {
27
+ switch(segment3){
28
+ case 'create':
29
+ {
30
+ if ('create' in docPermissions && docPermissions?.create?.permission) {
52
31
  CustomView = {
53
32
  payloadComponent: getCustomViewByKey(views, 'default')
54
33
  };
55
34
  DefaultView = {
56
35
  Component: DefaultEditView
57
36
  };
58
- break;
37
+ } else {
38
+ ErrorView = {
39
+ Component: UnauthorizedView
40
+ };
59
41
  }
60
- }
61
- break;
42
+ break;
43
+ }
44
+ default:
45
+ {
46
+ CustomView = {
47
+ payloadComponent: getCustomViewByKey(views, 'default')
48
+ };
49
+ DefaultView = {
50
+ Component: DefaultEditView
51
+ };
52
+ break;
53
+ }
62
54
  }
63
- // `../:id/api`, `../:id/preview`, `../:id/versions`, etc
64
- case 4:
65
- {
66
- switch(segment4){
67
- case 'api':
68
- {
69
- if (collectionConfig?.admin?.hideAPIURL !== true) {
70
- CustomView = {
71
- payloadComponent: getCustomViewByKey(views, 'api')
72
- };
73
- DefaultView = {
74
- Component: DefaultAPIView
75
- };
76
- }
77
- break;
78
- }
79
- case 'preview':
80
- {
81
- if (livePreviewEnabled) {
82
- DefaultView = {
83
- Component: DefaultLivePreviewView
84
- };
85
- }
86
- break;
55
+ break;
56
+ }
57
+ // `../:id/api`, `../:id/preview`, `../:id/versions`, etc
58
+ case 4:
59
+ {
60
+ switch(segment4){
61
+ case 'api':
62
+ {
63
+ if (collectionConfig?.admin?.hideAPIURL !== true) {
64
+ CustomView = {
65
+ payloadComponent: getCustomViewByKey(views, 'api')
66
+ };
67
+ DefaultView = {
68
+ Component: DefaultAPIView
69
+ };
87
70
  }
88
- case 'versions':
89
- {
90
- if (docPermissions?.readVersions?.permission) {
91
- CustomView = {
92
- payloadComponent: getCustomViewByKey(views, 'versions')
93
- };
94
- DefaultView = {
95
- Component: DefaultVersionsView
96
- };
97
- } else {
98
- ErrorView = {
99
- Component: UnauthorizedView
100
- };
101
- }
102
- break;
71
+ break;
72
+ }
73
+ case 'preview':
74
+ {
75
+ if (livePreviewEnabled) {
76
+ DefaultView = {
77
+ Component: DefaultLivePreviewView
78
+ };
103
79
  }
104
- default:
105
- {
106
- const baseRoute = [
107
- adminRoute !== '/' && adminRoute,
108
- 'collections',
109
- collectionSlug,
110
- segment3
111
- ].filter(Boolean).join('/');
112
- const currentRoute = [
113
- baseRoute,
114
- segment4,
115
- segment5,
116
- ...remainingSegments
117
- ].filter(Boolean).join('/');
80
+ break;
81
+ }
82
+ case 'versions':
83
+ {
84
+ if (docPermissions?.readVersions?.permission) {
118
85
  CustomView = {
119
- payloadComponent: getCustomViewByRoute({
120
- baseRoute,
121
- currentRoute,
122
- views
123
- })
86
+ payloadComponent: getCustomViewByKey(views, 'versions')
87
+ };
88
+ DefaultView = {
89
+ Component: DefaultVersionsView
90
+ };
91
+ } else {
92
+ ErrorView = {
93
+ Component: UnauthorizedView
124
94
  };
125
- break;
126
95
  }
127
- }
128
- break;
129
- }
130
- // `../:id/versions/:version`, etc
131
- default:
132
- {
133
- if (segment4 === 'versions') {
134
- if (docPermissions?.readVersions?.permission) {
96
+ break;
97
+ }
98
+ default:
99
+ {
100
+ const baseRoute = [
101
+ adminRoute !== '/' && adminRoute,
102
+ 'collections',
103
+ collectionSlug,
104
+ segment3
105
+ ].filter(Boolean).join('/');
106
+ const currentRoute = [
107
+ baseRoute,
108
+ segment4,
109
+ segment5,
110
+ ...remainingSegments
111
+ ].filter(Boolean).join('/');
135
112
  CustomView = {
136
- payloadComponent: getCustomViewByKey(views, 'version')
137
- };
138
- DefaultView = {
139
- Component: DefaultVersionView
140
- };
141
- } else {
142
- ErrorView = {
143
- Component: UnauthorizedView
113
+ payloadComponent: getCustomViewByRoute({
114
+ baseRoute,
115
+ currentRoute,
116
+ views
117
+ })
144
118
  };
119
+ break;
145
120
  }
146
- } else {
147
- const baseRoute = [
148
- adminRoute !== '/' && adminRoute,
149
- collectionEntity,
150
- collectionSlug,
151
- segment3
152
- ].filter(Boolean).join('/');
153
- const currentRoute = [
154
- baseRoute,
155
- segment4,
156
- segment5,
157
- ...remainingSegments
158
- ].filter(Boolean).join('/');
121
+ }
122
+ break;
123
+ }
124
+ // `../:id/versions/:version`, etc
125
+ default:
126
+ {
127
+ if (segment4 === 'versions') {
128
+ if (docPermissions?.readVersions?.permission) {
159
129
  CustomView = {
160
- payloadComponent: getCustomViewByRoute({
161
- baseRoute,
162
- currentRoute,
163
- views
164
- })
130
+ payloadComponent: getCustomViewByKey(views, 'version')
131
+ };
132
+ DefaultView = {
133
+ Component: DefaultVersionView
134
+ };
135
+ } else {
136
+ ErrorView = {
137
+ Component: UnauthorizedView
165
138
  };
166
139
  }
167
- break;
140
+ } else {
141
+ const baseRoute = [
142
+ adminRoute !== '/' && adminRoute,
143
+ collectionEntity,
144
+ collectionSlug,
145
+ segment3
146
+ ].filter(Boolean).join('/');
147
+ const currentRoute = [
148
+ baseRoute,
149
+ segment4,
150
+ segment5,
151
+ ...remainingSegments
152
+ ].filter(Boolean).join('/');
153
+ CustomView = {
154
+ payloadComponent: getCustomViewByRoute({
155
+ baseRoute,
156
+ currentRoute,
157
+ views
158
+ })
159
+ };
168
160
  }
169
- }
161
+ break;
162
+ }
170
163
  }
171
164
  }
172
165
  }
173
166
  if (globalConfig) {
174
- const editConfig = globalConfig?.admin?.components?.views?.edit;
175
- const EditOverride = typeof editConfig === 'function' ? editConfig : null;
176
- if (EditOverride) {
177
- CustomView = EditOverride;
178
- }
179
- if (!EditOverride) {
180
- const [globalEntity, globalSlug, segment3, ...remainingSegments] = routeSegments;
181
- if (!docPermissions?.read?.permission) {
182
- notFound();
183
- } else {
184
- switch(routeSegments.length){
185
- case 2:
186
- {
187
- CustomView = {
188
- payloadComponent: getCustomViewByKey(views, 'default')
189
- };
190
- DefaultView = {
191
- Component: DefaultEditView
192
- };
193
- break;
194
- }
195
- case 3:
196
- {
197
- // `../:slug/api`, `../:slug/preview`, `../:slug/versions`, etc
198
- switch(segment3){
199
- case 'api':
200
- {
201
- if (globalConfig?.admin?.hideAPIURL !== true) {
202
- CustomView = {
203
- payloadComponent: getCustomViewByKey(views, 'api')
204
- };
205
- DefaultView = {
206
- Component: DefaultAPIView
207
- };
208
- }
209
- break;
167
+ const [globalEntity, globalSlug, segment3, ...remainingSegments] = routeSegments;
168
+ if (!docPermissions?.read?.permission) {
169
+ notFound();
170
+ } else {
171
+ switch(routeSegments.length){
172
+ case 2:
173
+ {
174
+ CustomView = {
175
+ payloadComponent: getCustomViewByKey(views, 'default')
176
+ };
177
+ DefaultView = {
178
+ Component: DefaultEditView
179
+ };
180
+ break;
181
+ }
182
+ case 3:
183
+ {
184
+ // `../:slug/api`, `../:slug/preview`, `../:slug/versions`, etc
185
+ switch(segment3){
186
+ case 'api':
187
+ {
188
+ if (globalConfig?.admin?.hideAPIURL !== true) {
189
+ CustomView = {
190
+ payloadComponent: getCustomViewByKey(views, 'api')
191
+ };
192
+ DefaultView = {
193
+ Component: DefaultAPIView
194
+ };
210
195
  }
211
- case 'preview':
212
- {
213
- if (livePreviewEnabled) {
214
- DefaultView = {
215
- Component: DefaultLivePreviewView
216
- };
217
- }
218
- break;
196
+ break;
197
+ }
198
+ case 'preview':
199
+ {
200
+ if (livePreviewEnabled) {
201
+ DefaultView = {
202
+ Component: DefaultLivePreviewView
203
+ };
219
204
  }
220
- case 'versions':
221
- {
222
- if (docPermissions?.readVersions?.permission) {
223
- CustomView = {
224
- payloadComponent: getCustomViewByKey(views, 'versions')
225
- };
226
- DefaultView = {
227
- Component: DefaultVersionsView
228
- };
229
- } else {
230
- ErrorView = {
231
- Component: UnauthorizedView
232
- };
233
- }
234
- break;
205
+ break;
206
+ }
207
+ case 'versions':
208
+ {
209
+ if (docPermissions?.readVersions?.permission) {
210
+ CustomView = {
211
+ payloadComponent: getCustomViewByKey(views, 'versions')
212
+ };
213
+ DefaultView = {
214
+ Component: DefaultVersionsView
215
+ };
216
+ } else {
217
+ ErrorView = {
218
+ Component: UnauthorizedView
219
+ };
235
220
  }
236
- default:
237
- {
238
- if (docPermissions?.read?.permission) {
239
- const baseRoute = [
240
- adminRoute,
241
- globalEntity,
242
- globalSlug,
243
- segment3
244
- ].filter(Boolean).join('/');
245
- const currentRoute = [
221
+ break;
222
+ }
223
+ default:
224
+ {
225
+ if (docPermissions?.read?.permission) {
226
+ const baseRoute = [
227
+ adminRoute,
228
+ globalEntity,
229
+ globalSlug,
230
+ segment3
231
+ ].filter(Boolean).join('/');
232
+ const currentRoute = [
233
+ baseRoute,
234
+ segment3,
235
+ ...remainingSegments
236
+ ].filter(Boolean).join('/');
237
+ CustomView = {
238
+ payloadComponent: getCustomViewByRoute({
246
239
  baseRoute,
247
- segment3,
248
- ...remainingSegments
249
- ].filter(Boolean).join('/');
250
- CustomView = {
251
- payloadComponent: getCustomViewByRoute({
252
- baseRoute,
253
- currentRoute,
254
- views
255
- })
256
- };
257
- DefaultView = {
258
- Component: DefaultEditView
259
- };
260
- } else {
261
- ErrorView = {
262
- Component: UnauthorizedView
263
- };
264
- }
265
- break;
240
+ currentRoute,
241
+ views
242
+ })
243
+ };
244
+ DefaultView = {
245
+ Component: DefaultEditView
246
+ };
247
+ } else {
248
+ ErrorView = {
249
+ Component: UnauthorizedView
250
+ };
266
251
  }
267
- }
268
- break;
269
- }
270
- default:
271
- {
272
- // `../:slug/versions/:version`, etc
273
- if (segment3 === 'versions') {
274
- if (docPermissions?.readVersions?.permission) {
275
- CustomView = {
276
- payloadComponent: getCustomViewByKey(views, 'version')
277
- };
278
- DefaultView = {
279
- Component: DefaultVersionView
280
- };
281
- } else {
282
- ErrorView = {
283
- Component: UnauthorizedView
284
- };
252
+ break;
285
253
  }
286
- } else {
287
- const baseRoute = [
288
- adminRoute !== '/' && adminRoute,
289
- 'globals',
290
- globalSlug
291
- ].filter(Boolean).join('/');
292
- const currentRoute = [
293
- baseRoute,
294
- segment3,
295
- ...remainingSegments
296
- ].filter(Boolean).join('/');
254
+ }
255
+ break;
256
+ }
257
+ default:
258
+ {
259
+ // `../:slug/versions/:version`, etc
260
+ if (segment3 === 'versions') {
261
+ if (docPermissions?.readVersions?.permission) {
297
262
  CustomView = {
298
- payloadComponent: getCustomViewByRoute({
299
- baseRoute,
300
- currentRoute,
301
- views
302
- })
263
+ payloadComponent: getCustomViewByKey(views, 'version')
264
+ };
265
+ DefaultView = {
266
+ Component: DefaultVersionView
267
+ };
268
+ } else {
269
+ ErrorView = {
270
+ Component: UnauthorizedView
303
271
  };
304
272
  }
305
- break;
273
+ } else {
274
+ const baseRoute = [
275
+ adminRoute !== '/' && adminRoute,
276
+ 'globals',
277
+ globalSlug
278
+ ].filter(Boolean).join('/');
279
+ const currentRoute = [
280
+ baseRoute,
281
+ segment3,
282
+ ...remainingSegments
283
+ ].filter(Boolean).join('/');
284
+ CustomView = {
285
+ payloadComponent: getCustomViewByRoute({
286
+ baseRoute,
287
+ currentRoute,
288
+ views
289
+ })
290
+ };
306
291
  }
307
- }
292
+ break;
293
+ }
308
294
  }
309
295
  }
310
296
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/Document/getViewsFromConfig.tsx"],"sourcesContent":["import type {\n AdminViewProps,\n CollectionPermission,\n GlobalPermission,\n PayloadComponent,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n ServerSideEditViewProps,\n} from 'payload'\nimport type React from 'react'\n\nimport { notFound } from 'next/navigation.js'\n\nimport { APIView as DefaultAPIView } from '../API/index.js'\nimport { EditView as DefaultEditView } from '../Edit/index.js'\nimport { LivePreviewView as DefaultLivePreviewView } from '../LivePreview/index.js'\nimport { UnauthorizedView } from '../Unauthorized/index.js'\nimport { VersionView as DefaultVersionView } from '../Version/index.js'\nimport { VersionsView as DefaultVersionsView } from '../Versions/index.js'\nimport { getCustomViewByKey } from './getCustomViewByKey.js'\nimport { getCustomViewByRoute } from './getCustomViewByRoute.js'\n\nexport type ViewFromConfig<TProps extends object> = {\n Component?: React.FC<TProps>\n payloadComponent?: PayloadComponent<TProps>\n}\n\nexport const getViewsFromConfig = ({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments,\n}: {\n collectionConfig?: SanitizedCollectionConfig\n config: SanitizedConfig\n docPermissions: CollectionPermission | GlobalPermission\n globalConfig?: SanitizedGlobalConfig\n routeSegments: string[]\n}): {\n CustomView: ViewFromConfig<ServerSideEditViewProps>\n DefaultView: ViewFromConfig<ServerSideEditViewProps>\n /**\n * The error view to display if CustomView or DefaultView do not exist (could be either due to not found, or unauthorized). Can be null\n */\n ErrorView: ViewFromConfig<AdminViewProps>\n} | null => {\n // Conditionally import and lazy load the default view\n let DefaultView: ViewFromConfig<ServerSideEditViewProps> = null\n let CustomView: ViewFromConfig<ServerSideEditViewProps> = null\n let ErrorView: ViewFromConfig<AdminViewProps> = null\n\n const {\n routes: { admin: adminRoute },\n } = config\n\n const views =\n (collectionConfig && collectionConfig?.admin?.components?.views) ||\n (globalConfig && globalConfig?.admin?.components?.views)\n\n const livePreviewEnabled =\n (collectionConfig && collectionConfig?.admin?.livePreview) ||\n config?.admin?.livePreview?.collections?.includes(collectionConfig?.slug) ||\n (globalConfig && globalConfig?.admin?.livePreview) ||\n config?.admin?.livePreview?.globals?.includes(globalConfig?.slug)\n\n if (collectionConfig) {\n const editConfig = collectionConfig?.admin?.components?.views?.edit\n const EditOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (EditOverride) {\n CustomView = EditOverride\n }\n\n if (!EditOverride) {\n const [collectionEntity, collectionSlug, segment3, segment4, segment5, ...remainingSegments] =\n routeSegments\n\n if (!docPermissions?.read?.permission) {\n notFound()\n } else {\n // `../:id`, or `../create`\n switch (routeSegments.length) {\n case 3: {\n switch (segment3) {\n case 'create': {\n if ('create' in docPermissions && docPermissions?.create?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'default'),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n\n default: {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'default'),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n break\n }\n }\n break\n }\n\n // `../:id/api`, `../:id/preview`, `../:id/versions`, etc\n case 4: {\n switch (segment4) {\n case 'api': {\n if (collectionConfig?.admin?.hideAPIURL !== true) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'api'),\n }\n DefaultView = {\n Component: DefaultAPIView,\n }\n }\n break\n }\n\n case 'preview': {\n if (livePreviewEnabled) {\n DefaultView = {\n Component: DefaultLivePreviewView,\n }\n }\n break\n }\n\n case 'versions': {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'versions'),\n }\n DefaultView = {\n Component: DefaultVersionsView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n\n default: {\n const baseRoute = [\n adminRoute !== '/' && adminRoute,\n 'collections',\n collectionSlug,\n segment3,\n ]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n break\n }\n }\n break\n }\n\n // `../:id/versions/:version`, etc\n default: {\n if (segment4 === 'versions') {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'version'),\n }\n DefaultView = {\n Component: DefaultVersionView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n } else {\n const baseRoute = [\n adminRoute !== '/' && adminRoute,\n collectionEntity,\n collectionSlug,\n segment3,\n ]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n }\n break\n }\n }\n }\n }\n }\n\n if (globalConfig) {\n const editConfig = globalConfig?.admin?.components?.views?.edit\n const EditOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (EditOverride) {\n CustomView = EditOverride\n }\n\n if (!EditOverride) {\n const [globalEntity, globalSlug, segment3, ...remainingSegments] = routeSegments\n\n if (!docPermissions?.read?.permission) {\n notFound()\n } else {\n switch (routeSegments.length) {\n case 2: {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'default'),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n break\n }\n\n case 3: {\n // `../:slug/api`, `../:slug/preview`, `../:slug/versions`, etc\n switch (segment3) {\n case 'api': {\n if (globalConfig?.admin?.hideAPIURL !== true) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'api'),\n }\n DefaultView = {\n Component: DefaultAPIView,\n }\n }\n break\n }\n\n case 'preview': {\n if (livePreviewEnabled) {\n DefaultView = {\n Component: DefaultLivePreviewView,\n }\n }\n break\n }\n\n case 'versions': {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'versions'),\n }\n DefaultView = {\n Component: DefaultVersionsView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n\n default: {\n if (docPermissions?.read?.permission) {\n const baseRoute = [adminRoute, globalEntity, globalSlug, segment3]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment3, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n }\n break\n }\n\n default: {\n // `../:slug/versions/:version`, etc\n if (segment3 === 'versions') {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'version'),\n }\n DefaultView = {\n Component: DefaultVersionView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n } else {\n const baseRoute = [adminRoute !== '/' && adminRoute, 'globals', globalSlug]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment3, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n }\n break\n }\n }\n }\n }\n }\n\n return {\n CustomView,\n DefaultView,\n ErrorView,\n }\n}\n"],"names":["notFound","APIView","DefaultAPIView","EditView","DefaultEditView","LivePreviewView","DefaultLivePreviewView","UnauthorizedView","VersionView","DefaultVersionView","VersionsView","DefaultVersionsView","getCustomViewByKey","getCustomViewByRoute","getViewsFromConfig","collectionConfig","config","docPermissions","globalConfig","routeSegments","DefaultView","CustomView","ErrorView","routes","admin","adminRoute","views","components","livePreviewEnabled","livePreview","collections","includes","slug","globals","editConfig","edit","EditOverride","collectionEntity","collectionSlug","segment3","segment4","segment5","remainingSegments","read","permission","length","create","payloadComponent","Component","hideAPIURL","readVersions","baseRoute","filter","Boolean","join","currentRoute","globalEntity","globalSlug"],"mappings":"AAYA,SAASA,QAAQ,QAAQ,qBAAoB;AAE7C,SAASC,WAAWC,cAAc,QAAQ,kBAAiB;AAC3D,SAASC,YAAYC,eAAe,QAAQ,mBAAkB;AAC9D,SAASC,mBAAmBC,sBAAsB,QAAQ,0BAAyB;AACnF,SAASC,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AAkBlC,qBAAqB;wCACrCsC;wCACAI;wCACA7B;oCACF;gCACF;4BACF;4BACA;wBACF;gBACF;YACF;QACF;IACF;IAEA,OAAO;QACLL;QACAD;QACAE;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/views/Document/getViewsFromConfig.tsx"],"sourcesContent":["import type {\n AdminViewProps,\n CollectionPermission,\n GlobalPermission,\n PayloadComponent,\n SanitizedCollectionConfig,\n SanitizedConfig,\n SanitizedGlobalConfig,\n ServerSideEditViewProps,\n} from 'payload'\nimport type React from 'react'\n\nimport { notFound } from 'next/navigation.js'\n\nimport { APIView as DefaultAPIView } from '../API/index.js'\nimport { EditView as DefaultEditView } from '../Edit/index.js'\nimport { LivePreviewView as DefaultLivePreviewView } from '../LivePreview/index.js'\nimport { UnauthorizedView } from '../Unauthorized/index.js'\nimport { VersionView as DefaultVersionView } from '../Version/index.js'\nimport { VersionsView as DefaultVersionsView } from '../Versions/index.js'\nimport { getCustomViewByKey } from './getCustomViewByKey.js'\nimport { getCustomViewByRoute } from './getCustomViewByRoute.js'\n\nexport type ViewFromConfig<TProps extends object> = {\n Component?: React.FC<TProps>\n payloadComponent?: PayloadComponent<TProps>\n}\n\nexport const getViewsFromConfig = ({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments,\n}: {\n collectionConfig?: SanitizedCollectionConfig\n config: SanitizedConfig\n docPermissions: CollectionPermission | GlobalPermission\n globalConfig?: SanitizedGlobalConfig\n routeSegments: string[]\n}): {\n CustomView: ViewFromConfig<ServerSideEditViewProps>\n DefaultView: ViewFromConfig<ServerSideEditViewProps>\n /**\n * The error view to display if CustomView or DefaultView do not exist (could be either due to not found, or unauthorized). Can be null\n */\n ErrorView: ViewFromConfig<AdminViewProps>\n} | null => {\n // Conditionally import and lazy load the default view\n let DefaultView: ViewFromConfig<ServerSideEditViewProps> = null\n let CustomView: ViewFromConfig<ServerSideEditViewProps> = null\n let ErrorView: ViewFromConfig<AdminViewProps> = null\n\n const {\n routes: { admin: adminRoute },\n } = config\n\n const views =\n (collectionConfig && collectionConfig?.admin?.components?.views) ||\n (globalConfig && globalConfig?.admin?.components?.views)\n\n const livePreviewEnabled =\n (collectionConfig && collectionConfig?.admin?.livePreview) ||\n config?.admin?.livePreview?.collections?.includes(collectionConfig?.slug) ||\n (globalConfig && globalConfig?.admin?.livePreview) ||\n config?.admin?.livePreview?.globals?.includes(globalConfig?.slug)\n\n if (collectionConfig) {\n const [collectionEntity, collectionSlug, segment3, segment4, segment5, ...remainingSegments] =\n routeSegments\n\n if (!docPermissions?.read?.permission) {\n notFound()\n } else {\n // `../:id`, or `../create`\n switch (routeSegments.length) {\n case 3: {\n switch (segment3) {\n case 'create': {\n if ('create' in docPermissions && docPermissions?.create?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'default'),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n\n default: {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'default'),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n break\n }\n }\n break\n }\n\n // `../:id/api`, `../:id/preview`, `../:id/versions`, etc\n case 4: {\n switch (segment4) {\n case 'api': {\n if (collectionConfig?.admin?.hideAPIURL !== true) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'api'),\n }\n DefaultView = {\n Component: DefaultAPIView,\n }\n }\n break\n }\n\n case 'preview': {\n if (livePreviewEnabled) {\n DefaultView = {\n Component: DefaultLivePreviewView,\n }\n }\n break\n }\n\n case 'versions': {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'versions'),\n }\n DefaultView = {\n Component: DefaultVersionsView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n\n default: {\n const baseRoute = [\n adminRoute !== '/' && adminRoute,\n 'collections',\n collectionSlug,\n segment3,\n ]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n break\n }\n }\n break\n }\n\n // `../:id/versions/:version`, etc\n default: {\n if (segment4 === 'versions') {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'version'),\n }\n DefaultView = {\n Component: DefaultVersionView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n } else {\n const baseRoute = [\n adminRoute !== '/' && adminRoute,\n collectionEntity,\n collectionSlug,\n segment3,\n ]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n }\n break\n }\n }\n }\n }\n\n if (globalConfig) {\n const [globalEntity, globalSlug, segment3, ...remainingSegments] = routeSegments\n\n if (!docPermissions?.read?.permission) {\n notFound()\n } else {\n switch (routeSegments.length) {\n case 2: {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'default'),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n break\n }\n\n case 3: {\n // `../:slug/api`, `../:slug/preview`, `../:slug/versions`, etc\n switch (segment3) {\n case 'api': {\n if (globalConfig?.admin?.hideAPIURL !== true) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'api'),\n }\n DefaultView = {\n Component: DefaultAPIView,\n }\n }\n break\n }\n\n case 'preview': {\n if (livePreviewEnabled) {\n DefaultView = {\n Component: DefaultLivePreviewView,\n }\n }\n break\n }\n\n case 'versions': {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'versions'),\n }\n DefaultView = {\n Component: DefaultVersionsView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n\n default: {\n if (docPermissions?.read?.permission) {\n const baseRoute = [adminRoute, globalEntity, globalSlug, segment3]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment3, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n DefaultView = {\n Component: DefaultEditView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n break\n }\n }\n break\n }\n\n default: {\n // `../:slug/versions/:version`, etc\n if (segment3 === 'versions') {\n if (docPermissions?.readVersions?.permission) {\n CustomView = {\n payloadComponent: getCustomViewByKey(views, 'version'),\n }\n DefaultView = {\n Component: DefaultVersionView,\n }\n } else {\n ErrorView = {\n Component: UnauthorizedView,\n }\n }\n } else {\n const baseRoute = [adminRoute !== '/' && adminRoute, 'globals', globalSlug]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment3, ...remainingSegments]\n .filter(Boolean)\n .join('/')\n\n CustomView = {\n payloadComponent: getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n }),\n }\n }\n break\n }\n }\n }\n }\n\n return {\n CustomView,\n DefaultView,\n ErrorView,\n }\n}\n"],"names":["notFound","APIView","DefaultAPIView","EditView","DefaultEditView","LivePreviewView","DefaultLivePreviewView","UnauthorizedView","VersionView","DefaultVersionView","VersionsView","DefaultVersionsView","getCustomViewByKey","getCustomViewByRoute","getViewsFromConfig","collectionConfig","config","docPermissions","globalConfig","routeSegments","DefaultView","CustomView","ErrorView","routes","admin","adminRoute","views","components","livePreviewEnabled","livePreview","collections","includes","slug","globals","collectionEntity","collectionSlug","segment3","segment4","segment5","remainingSegments","read","permission","length","create","payloadComponent","Component","hideAPIURL","readVersions","baseRoute","filter","Boolean","join","currentRoute","globalEntity","globalSlug"],"mappings":"AAYA,SAASA,QAAQ,QAAQ,qBAAoB;AAE7C,SAASC,WAAWC,cAAc,QAAQ,kBAAiB;AAC3D,SAASC,YAAYC,e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B,WAAWtC;wCACb;oCACF;oCACA;gCACF;4BAEA;gCAAS;oCACP,IAAIU,gBAAgBuB,MAAMC,YAAY;wCACpC,MAAMO,YAAY;4CAACvB;4CAAY4B;4CAAcC;4CAAYlB;yCAAS,CAC/Da,MAAM,CAACC,SACPC,IAAI,CAAC;wCAER,MAAMC,eAAe;4CAACJ;4CAAWZ;+CAAaG;yCAAkB,CAC7DU,MAAM,CAACC,SACPC,IAAI,CAAC;wCAER9B,aAAa;4CACXuB,kBAAkB/B,qBAAqB;gDACrCmC;gDACAI;gDACA1B;4CACF;wCACF;wCACAN,cAAc;4CACZyB,WAAWzC;wCACb;oCACF,OAAO;wCACLkB,YAAY;4CACVuB,WAAWtC;wCACb;oCACF;oCACA;gCACF;wBACF;wBACA;oBACF;gBAEA;oBAAS;wBACP,oCAAoC;wBACpC,IAAI6B,aAAa,YAAY;4BAC3B,IAAInB,gBAAgB8B,cAAcN,YAAY;gCAC5CpB,aAAa;oCACXuB,kBAAkBhC,mBAAmBc,OAAO;gCAC9C;gCACAN,cAAc;oCACZyB,WAAWpC;gCACb;4BACF,OAAO;gCACLa,YAAY;oCACVuB,WAAWtC;gCACb;4BACF;wBACF,OAAO;4BACL,MAAMyC,YAAY;gCAACvB,eAAe,OAAOA;gCAAY;gCAAW6B;6BAAW,CACxEL,MAAM,CAACC,SACPC,IAAI,CAAC;4BAER,MAAMC,eAAe;gCAACJ;gCAAWZ;mCAAaG;6BAAkB,CAC7DU,MAAM,CAACC,SACPC,IAAI,CAAC;4BAER9B,aAAa;gCACXuB,kBAAkB/B,qBAAqB;oCACrCmC;oCACAI;oCACA1B;gCACF;4BACF;wBACF;wBACA;oBACF;YACF;QACF;IACF;IAEA,OAAO;QACLL;QACAD;QACAE;IACF;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAA;AAUhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AASrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAkR7C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,SAAS,CAAA;AAUhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AASrE,eAAO,MAAM,gBAAgB,EAAE,wBAAiE,CAAA;AAEhG,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA6R7C,CAAA"}
@@ -20,7 +20,7 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
20
20
  collectionSlug,
21
21
  globalSlug
22
22
  });
23
- let ViewOverride;
23
+ let RootViewOverride;
24
24
  let CustomView;
25
25
  let DefaultView;
26
26
  let ErrorView;
@@ -66,8 +66,8 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
66
66
  }
67
67
  const apiQueryParams = `?${params.toString()}`;
68
68
  apiURL = `${serverURL}${apiRoute}/${collectionSlug}/${id}${apiQueryParams}`;
69
- ViewOverride = collectionConfig?.admin?.components?.views?.edit?.default && 'Component' in collectionConfig.admin.components.views.edit.default ? createMappedComponent(collectionConfig?.admin?.components?.views?.edit?.default?.Component, undefined, undefined, 'collectionConfig?.admin?.components?.views?.edit?.default') : null;
70
- if (!ViewOverride) {
69
+ RootViewOverride = collectionConfig?.admin?.components?.views?.edit?.root && 'Component' in collectionConfig.admin.components.views.edit.root ? createMappedComponent(collectionConfig?.admin?.components?.views?.edit?.root?.Component, undefined, undefined, 'collectionConfig?.admin?.components?.views?.edit?.root') : null;
70
+ if (!RootViewOverride) {
71
71
  const collectionViews = getViewsFromConfig({
72
72
  collectionConfig,
73
73
  config,
@@ -78,7 +78,7 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
78
78
  DefaultView = createMappedComponent(collectionViews?.DefaultView?.payloadComponent, undefined, collectionViews?.DefaultView?.Component, 'collectionViews?.DefaultView.payloadComponent');
79
79
  ErrorView = createMappedComponent(collectionViews?.ErrorView?.payloadComponent, undefined, collectionViews?.ErrorView?.Component, 'collectionViews?.ErrorView.payloadComponent');
80
80
  }
81
- if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {
81
+ if (!CustomView && !DefaultView && !RootViewOverride && !ErrorView) {
82
82
  ErrorView = createMappedComponent(undefined, undefined, NotFoundView, 'NotFoundView');
83
83
  }
84
84
  }
@@ -97,9 +97,8 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
97
97
  }
98
98
  const apiQueryParams = `?${params.toString()}`;
99
99
  apiURL = `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`;
100
- const editConfig = globalConfig?.admin?.components?.views?.edit;
101
- ViewOverride = typeof editConfig === 'function' ? editConfig : null;
102
- if (!ViewOverride) {
100
+ RootViewOverride = globalConfig?.admin?.components?.views?.edit?.root && 'Component' in globalConfig.admin.components.views.edit.root ? createMappedComponent(globalConfig?.admin?.components?.views?.edit?.root?.Component, undefined, undefined, 'globalConfig?.admin?.components?.views?.edit?.root') : null;
101
+ if (!RootViewOverride) {
103
102
  const globalViews = getViewsFromConfig({
104
103
  config,
105
104
  docPermissions,
@@ -109,7 +108,7 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
109
108
  CustomView = createMappedComponent(globalViews?.CustomView?.payloadComponent, undefined, globalViews?.CustomView?.Component, 'globalViews?.CustomView.payloadComponent');
110
109
  DefaultView = createMappedComponent(globalViews?.DefaultView?.payloadComponent, undefined, globalViews?.DefaultView?.Component, 'globalViews?.DefaultView.payloadComponent');
111
110
  ErrorView = createMappedComponent(globalViews?.ErrorView?.payloadComponent, undefined, globalViews?.ErrorView?.Component, 'globalViews?.ErrorView.payloadComponent');
112
- if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {
111
+ if (!CustomView && !DefaultView && !RootViewOverride && !ErrorView) {
113
112
  ErrorView = createMappedComponent(undefined, undefined, NotFoundView, 'NotFoundView');
114
113
  }
115
114
  }
@@ -154,7 +153,7 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
154
153
  initialState: formState,
155
154
  isEditing: isEditing,
156
155
  children: [
157
- !ViewOverride && /*#__PURE__*/ _jsx(DocumentHeader, {
156
+ !RootViewOverride && /*#__PURE__*/ _jsx(DocumentHeader, {
158
157
  collectionConfig: collectionConfig,
159
158
  globalConfig: globalConfig,
160
159
  i18n: i18n,
@@ -169,7 +168,7 @@ export const Document = async ({ importMap, initPageResult, params, searchParams
169
168
  children: ErrorView ? /*#__PURE__*/ _jsx(RenderComponent, {
170
169
  mappedComponent: ErrorView
171
170
  }) : /*#__PURE__*/ _jsx(RenderComponent, {
172
- mappedComponent: ViewOverride ? ViewOverride : CustomView ? CustomView : DefaultView
171
+ mappedComponent: RootViewOverride ? RootViewOverride : CustomView ? CustomView : DefaultView
173
172
  })
174
173
  }, `${collectionSlug || globalSlug}${locale?.code ? `-${locale?.code}` : ''}`)
175
174
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewProps,\n EditViewComponent,\n MappedComponent,\n ServerSideEditViewProps,\n} from 'payload'\n\nimport { DocumentInfoProvider, EditDepthProvider, HydrateAuthProvider } from '@payloadcms/ui'\nimport {\n RenderComponent,\n formatAdminURL,\n getCreateMappedComponent,\n isEditing as getIsEditing,\n} from '@payloadcms/ui/shared'\nimport { notFound, redirect } from 'next/navigation.js'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getViewsFromConfig } from './getViewsFromConfig.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport const Document: React.FC<AdminViewProps> = async ({\n importMap,\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n docID: id,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n\n const isEditing = getIsEditing({ id, collectionSlug, globalSlug })\n\n let ViewOverride: MappedComponent<ServerSideEditViewProps>\n let CustomView: MappedComponent<ServerSideEditViewProps>\n let DefaultView: MappedComponent<ServerSideEditViewProps>\n let ErrorView: MappedComponent<AdminViewProps>\n\n let apiURL: string\n\n const { data, formState } = await getDocumentData({\n id,\n collectionConfig,\n globalConfig,\n locale,\n req,\n })\n\n const { docPermissions, hasPublishPermission, hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data,\n globalConfig,\n req,\n })\n\n const createMappedComponent = getCreateMappedComponent({\n importMap,\n serverProps: {\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n user,\n },\n })\n\n if (collectionConfig) {\n if (!visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) {\n notFound()\n }\n\n const params = new URLSearchParams()\n if (collectionConfig.versions?.drafts) {\n params.append('draft', 'true')\n }\n if (locale?.code) {\n params.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${params.toString()}`\n\n apiURL = `${serverURL}${apiRoute}/${collectionSlug}/${id}${apiQueryParams}`\n\n ViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.default &&\n 'Component' in collectionConfig.admin.components.views.edit.default\n ? createMappedComponent(\n collectionConfig?.admin?.components?.views?.edit?.default\n ?.Component as EditViewComponent, // some type info gets lost from Config => SanitizedConfig due to our usage of Deep type operations from ts-essentials. Despite .Component being defined as EditViewComponent, this info is lost and we need cast it here.\n undefined,\n undefined,\n 'collectionConfig?.admin?.components?.views?.edit?.default',\n )\n : null\n\n if (!ViewOverride) {\n const collectionViews = getViewsFromConfig({\n collectionConfig,\n config,\n docPermissions,\n routeSegments: segments,\n })\n\n CustomView = createMappedComponent(\n collectionViews?.CustomView?.payloadComponent,\n undefined,\n collectionViews?.CustomView?.Component,\n 'collectionViews?.CustomView.payloadComponent',\n )\n\n DefaultView = createMappedComponent(\n collectionViews?.DefaultView?.payloadComponent,\n undefined,\n collectionViews?.DefaultView?.Component,\n 'collectionViews?.DefaultView.payloadComponent',\n )\n\n ErrorView = createMappedComponent(\n collectionViews?.ErrorView?.payloadComponent,\n undefined,\n collectionViews?.ErrorView?.Component,\n 'collectionViews?.ErrorView.payloadComponent',\n )\n }\n\n if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {\n ErrorView = createMappedComponent(undefined, undefined, NotFoundView, 'NotFoundView')\n }\n }\n\n if (globalConfig) {\n if (!visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)) {\n notFound()\n }\n\n const params = new URLSearchParams({\n locale: locale?.code,\n })\n if (globalConfig.versions?.drafts) {\n params.append('draft', 'true')\n }\n if (locale?.code) {\n params.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${params.toString()}`\n\n apiURL = `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`\n\n const editConfig = globalConfig?.admin?.components?.views?.edit\n ViewOverride = typeof editConfig === 'function' ? editConfig : null\n\n if (!ViewOverride) {\n const globalViews = getViewsFromConfig({\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n })\n\n CustomView = createMappedComponent(\n globalViews?.CustomView?.payloadComponent,\n undefined,\n globalViews?.CustomView?.Component,\n 'globalViews?.CustomView.payloadComponent',\n )\n\n DefaultView = createMappedComponent(\n globalViews?.DefaultView?.payloadComponent,\n undefined,\n globalViews?.DefaultView?.Component,\n 'globalViews?.DefaultView.payloadComponent',\n )\n\n ErrorView = createMappedComponent(\n globalViews?.ErrorView?.payloadComponent,\n undefined,\n globalViews?.ErrorView?.Component,\n 'globalViews?.ErrorView.payloadComponent',\n )\n\n if (!CustomView && !DefaultView && !ViewOverride && !ErrorView) {\n ErrorView = createMappedComponent(undefined, undefined, NotFoundView, 'NotFoundView')\n }\n }\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave =\n hasSavePermission &&\n ((collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave))\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n if (shouldAutosave && !validateDraftData && !id && collectionSlug) {\n const doc = await payload.create({\n collection: collectionSlug,\n data: {},\n depth: 0,\n draft: true,\n fallbackLocale: null,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n serverURL,\n })\n redirect(redirectURL)\n } else {\n notFound()\n }\n }\n\n return (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n disableActions={false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={data}\n initialState={formState}\n isEditing={isEditing}\n >\n {!ViewOverride && (\n <DocumentHeader\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n i18n={i18n}\n payload={payload}\n permissions={permissions}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n {/**\n * After bumping the Next.js canary to 104, and React to 19.0.0-rc-06d0b89e-20240801\" we have to deepCopy the permissions object (https://github.com/payloadcms/payload/pull/7541).\n * If both HydrateClientUser and RenderCustomComponent receive the same permissions object (same object reference), we get a\n * \"TypeError: Cannot read properties of undefined (reading '$$typeof')\" error when loading up some version views - for example a versions\n * view in the draft-posts collection of the versions test suite. RenderCustomComponent is what renders the versions view.\n *\n * // TODO: Revisit this in the future and figure out why this is happening. Might be a React/Next.js bug. We don't know why it happens, and a future React/Next version might unbreak this (keep an eye on this and remove deepCopyObjectSimple if that's the case)\n */}\n <EditDepthProvider\n depth={1}\n key={`${collectionSlug || globalSlug}${locale?.code ? `-${locale?.code}` : ''}`}\n >\n {ErrorView ? (\n <RenderComponent mappedComponent={ErrorView} />\n ) : (\n <RenderComponent\n mappedComponent={ViewOverride ? ViewOverride : CustomView ? CustomView : DefaultView}\n />\n )}\n </EditDepthProvider>\n </DocumentInfoProvider>\n )\n}\n"],"names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","RenderComponent","formatAdminURL","getCreateMappedComponent","isEditing","getIsEditing","notFound","redirect","React","DocumentHeader","NotFoundView","getDocumentData","getDocumentPermissions","getMetaBySegment","getViewsFromConfig","generateMetadata","args","Document","importMap","initPageResult","params","searchParams","collectionConfig","docID","id","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","ViewOverride","CustomView","DefaultView","ErrorView","apiURL","data","formState","docPermissions","hasPublishPermission","hasSavePermission","createMappedComponent","serverProps","routeSegments","collections","find","visibleSlug","URLSearchParams","versions","drafts","append","code","apiQueryParams","toString","components","views","edit","default","Component","collectionViews","payloadComponent","globals","editConfig","globalViews","shouldAutosave","autosave","validateDraftData","validate","doc","create","collection","depth","draft","fallbackLocale","redirectURL","path","disableActions","initialData","initialState","mappedComponent"],"mappings":";AAOA,SAASA,oBAAoB,EAAEC,iBAAiB,EAAEC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,eAAeC,aAAaA,aAAaC;;eANxE,CAAC,EAAEN,kBAAkBG,WAAW,EAAEpB,QAAQyC,OAAO,CAAC,CAAC,EAAEzC,QAAQyC,KAAK,CAAC,GAAG,GAAG,CAAC;;;AAYvF,EAAC"}
1
+ {"version":3,"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewProps,\n EditViewComponent,\n MappedComponent,\n ServerSideEditViewProps,\n} from 'payload'\n\nimport { DocumentInfoProvider, EditDepthProvider, HydrateAuthProvider } from '@payloadcms/ui'\nimport {\n RenderComponent,\n formatAdminURL,\n getCreateMappedComponent,\n isEditing as getIsEditing,\n} from '@payloadcms/ui/shared'\nimport { notFound, redirect } from 'next/navigation.js'\nimport React from 'react'\n\nimport type { GenerateEditViewMetadata } from './getMetaBySegment.js'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { getDocumentData } from './getDocumentData.js'\nimport { getDocumentPermissions } from './getDocumentPermissions.js'\nimport { getMetaBySegment } from './getMetaBySegment.js'\nimport { getViewsFromConfig } from './getViewsFromConfig.js'\n\nexport const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)\n\nexport const Document: React.FC<AdminViewProps> = async ({\n importMap,\n initPageResult,\n params,\n searchParams,\n}) => {\n const {\n collectionConfig,\n docID: id,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n serverURL,\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n\n const isEditing = getIsEditing({ id, collectionSlug, globalSlug })\n\n let RootViewOverride: MappedComponent<ServerSideEditViewProps>\n let CustomView: MappedComponent<ServerSideEditViewProps>\n let DefaultView: MappedComponent<ServerSideEditViewProps>\n let ErrorView: MappedComponent<AdminViewProps>\n\n let apiURL: string\n\n const { data, formState } = await getDocumentData({\n id,\n collectionConfig,\n globalConfig,\n locale,\n req,\n })\n\n const { docPermissions, hasPublishPermission, hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data,\n globalConfig,\n req,\n })\n\n const createMappedComponent = getCreateMappedComponent({\n importMap,\n serverProps: {\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n user,\n },\n })\n\n if (collectionConfig) {\n if (!visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) {\n notFound()\n }\n\n const params = new URLSearchParams()\n if (collectionConfig.versions?.drafts) {\n params.append('draft', 'true')\n }\n if (locale?.code) {\n params.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${params.toString()}`\n\n apiURL = `${serverURL}${apiRoute}/${collectionSlug}/${id}${apiQueryParams}`\n\n RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? createMappedComponent(\n collectionConfig?.admin?.components?.views?.edit?.root?.Component as EditViewComponent, // some type info gets lost from Config => SanitizedConfig due to our usage of Deep type operations from ts-essentials. Despite .Component being defined as EditViewComponent, this info is lost and we need cast it here.\n undefined,\n undefined,\n 'collectionConfig?.admin?.components?.views?.edit?.root',\n )\n : null\n\n if (!RootViewOverride) {\n const collectionViews = getViewsFromConfig({\n collectionConfig,\n config,\n docPermissions,\n routeSegments: segments,\n })\n\n CustomView = createMappedComponent(\n collectionViews?.CustomView?.payloadComponent,\n undefined,\n collectionViews?.CustomView?.Component,\n 'collectionViews?.CustomView.payloadComponent',\n )\n\n DefaultView = createMappedComponent(\n collectionViews?.DefaultView?.payloadComponent,\n undefined,\n collectionViews?.DefaultView?.Component,\n 'collectionViews?.DefaultView.payloadComponent',\n )\n\n ErrorView = createMappedComponent(\n collectionViews?.ErrorView?.payloadComponent,\n undefined,\n collectionViews?.ErrorView?.Component,\n 'collectionViews?.ErrorView.payloadComponent',\n )\n }\n\n if (!CustomView && !DefaultView && !RootViewOverride && !ErrorView) {\n ErrorView = createMappedComponent(undefined, undefined, NotFoundView, 'NotFoundView')\n }\n }\n\n if (globalConfig) {\n if (!visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)) {\n notFound()\n }\n\n const params = new URLSearchParams({\n locale: locale?.code,\n })\n\n if (globalConfig.versions?.drafts) {\n params.append('draft', 'true')\n }\n\n if (locale?.code) {\n params.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${params.toString()}`\n\n apiURL = `${serverURL}${apiRoute}/${globalSlug}${apiQueryParams}`\n\n RootViewOverride =\n globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? createMappedComponent(\n globalConfig?.admin?.components?.views?.edit?.root?.Component as EditViewComponent, // some type info gets lost from Config => SanitizedConfig due to our usage of Deep type operations from ts-essentials. Despite .Component being defined as EditViewComponent, this info is lost and we need cast it here.\n undefined,\n undefined,\n 'globalConfig?.admin?.components?.views?.edit?.root',\n )\n : null\n\n if (!RootViewOverride) {\n const globalViews = getViewsFromConfig({\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n })\n\n CustomView = createMappedComponent(\n globalViews?.CustomView?.payloadComponent,\n undefined,\n globalViews?.CustomView?.Component,\n 'globalViews?.CustomView.payloadComponent',\n )\n\n DefaultView = createMappedComponent(\n globalViews?.DefaultView?.payloadComponent,\n undefined,\n globalViews?.DefaultView?.Component,\n 'globalViews?.DefaultView.payloadComponent',\n )\n\n ErrorView = createMappedComponent(\n globalViews?.ErrorView?.payloadComponent,\n undefined,\n globalViews?.ErrorView?.Component,\n 'globalViews?.ErrorView.payloadComponent',\n )\n\n if (!CustomView && !DefaultView && !RootViewOverride && !ErrorView) {\n ErrorView = createMappedComponent(undefined, undefined, NotFoundView, 'NotFoundView')\n }\n }\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave =\n hasSavePermission &&\n ((collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave) ||\n (globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave))\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n if (shouldAutosave && !validateDraftData && !id && collectionSlug) {\n const doc = await payload.create({\n collection: collectionSlug,\n data: {},\n depth: 0,\n draft: true,\n fallbackLocale: null,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n serverURL,\n })\n redirect(redirectURL)\n } else {\n notFound()\n }\n }\n\n return (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n disableActions={false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n id={id}\n initialData={data}\n initialState={formState}\n isEditing={isEditing}\n >\n {!RootViewOverride && (\n <DocumentHeader\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n i18n={i18n}\n payload={payload}\n permissions={permissions}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n {/**\n * After bumping the Next.js canary to 104, and React to 19.0.0-rc-06d0b89e-20240801\" we have to deepCopy the permissions object (https://github.com/payloadcms/payload/pull/7541).\n * If both HydrateClientUser and RenderCustomComponent receive the same permissions object (same object reference), we get a\n * \"TypeError: Cannot read properties of undefined (reading '$$typeof')\" error when loading up some version views - for example a versions\n * view in the draft-posts collection of the versions test suite. RenderCustomComponent is what renders the versions view.\n *\n * // TODO: Revisit this in the future and figure out why this is happening. Might be a React/Next.js bug. We don't know why it happens, and a future React/Next version might unbreak this (keep an eye on this and remove deepCopyObjectSimple if that's the case)\n */}\n <EditDepthProvider\n depth={1}\n key={`${collectionSlug || globalSlug}${locale?.code ? `-${locale?.code}` : ''}`}\n >\n {ErrorView ? (\n <RenderComponent mappedComponent={ErrorView} />\n ) : (\n <RenderComponent\n mappedComponent={\n RootViewOverride ? RootViewOverride : CustomView ? CustomView : DefaultView\n }\n />\n )}\n </EditDepthProvider>\n </DocumentInfoProvider>\n )\n}\n"],"names":["DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","RenderComponent","formatAdminURL","getCreateMappedComponent","isEditing","getIsEditing","notFound","redirect","React","DocumentHeader","NotFoundView","getDocumentData","getDocumentPermissions","getMetaBySegment","getViewsFromConfig","generateMetadata","args","Document","importMap","initPageResult","params","searchParams","collectionConfig","docID","id","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","serverURL","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","RootViewOverride","CustomView","DefaultView","ErrorView","apiURL","data","formState","docPermissions","hasPublishPermission","hasSavePermission","createMappedComponent","serverProps","routeSegments","collections","find","visibleSlug","URLSearchParams","versions","drafts","append","code","apiQueryParams","toString","components","views","edit","root","Component","collectionViews","payloadComponent","globals","globalViews","shouldAutosave","autosave","validateDraftData","validate","doc","create","collection","depth","draft","fallbackLocale","redirectURL","path","disableActions","initialData","initialState","mappedComponent"],"mappings":";AAOA,SAASA,oBAAoB,EAAEC,iBAAiB,EAAEC,mBAAmB,QAAQ,iBAAgB;AAC7F,SACEC,eAAe,EACfC,cAAc,EACdC,wBAAwB,EACxBC,aAAaC,YAAY,QACpB,wBAAuB;AAC9B,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,qBAAoB;AACvD,OAAOC,WAAW,QAAO;AAIzB,SAASC,cAAc,QAAQ,yCAAwC;AACvE,SAASC,YAAY,QAAQ,uBAAsB;AACnD,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,OAAO,MAAMC,mBAA6C,OAAOC,OAASH,iBAAiBG,MAAK;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AQiB;IAE5E,IAAIH,kBAAkB,CAACE,qBAAqB,CAACzD,MAAMmB,gBAAgB;QACjE,MAAMwC,MAAM,MAAMrD,QAAQsD,MAAM,CAAC;YAC/BC,YAAY1C;YACZS,MAAM,CAAC;YACPkC,OAAO;YACPC,OAAO;YACPC,gBAAgB;YAChB9D,QAAQA,QAAQyC;YAChBvC;YACAU;QACF;QAEA,IAAI6C,KAAK3D,IAAI;YACX,MAAMiE,cAAcvF,eAAe;gBACjCgC;gBACAwD,MAAM,CAAC,aAAa,EAAE/C,eAAe,CAAC,EAAEwC,IAAI3D,EAAE,CAAC,CAAC;gBAChDa;YACF;YACA9B,SAASkF;QACX,OAAO;YACLnF;QACF;IACF;IAEA,qBACE,MAACR;QACCqD,QAAQA;QACRR,gBAAgBrB,kBAAkBsB;QAClC+C,gBAAgB;QAChBrC,gBAAgBA;QAChBR,YAAYrB,cAAcmB;QAC1BW,sBAAsBA;QACtBC,mBAAmBA;QACnBhC,IAAIA;QACJoE,aAAaxC;QACbyC,cAAcxC;QACdjD,WAAWA;;YAEV,CAAC2C,kCACA,KAACtC;gBACCa,kBAAkBA;gBAClBG,cAAcA;gBACdI,MAAMA;gBACNC,SAASA;gBACTH,aAAaA;;0BAGjB,KAAC3B;gBAAoB2B,aAAaA;;0BASlC,KAAC5B;gBACCuF,OAAO;0BAGNpC,0BACC,KAACjD;oBAAgB6F,iBAAiB5C;mCAElC,KAACjD;oBACC6F,iBACE/C,mBAAmBA,mBAAmBC,aAAaA,aAAaC;;eAPjE,CAAC,EAAEN,kBAAkBG,WAAW,EAAEpB,QAAQyC,OAAO,CAAC,CAAC,EAAEzC,QAAQyC,KAAK,CAAC,GAAG,GAAG,CAAC;;;AAcvF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.0.0-beta.80",
3
+ "version": "3.0.0-beta.81",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,9 +63,9 @@
63
63
  "sonner": "^1.5.0",
64
64
  "uuid": "10.0.0",
65
65
  "ws": "^8.16.0",
66
- "@payloadcms/graphql": "3.0.0-beta.80",
67
- "@payloadcms/translations": "3.0.0-beta.80",
68
- "@payloadcms/ui": "3.0.0-beta.80"
66
+ "@payloadcms/graphql": "3.0.0-beta.81",
67
+ "@payloadcms/ui": "3.0.0-beta.81",
68
+ "@payloadcms/translations": "3.0.0-beta.81"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@next/eslint-plugin-next": "^14.1.0",
@@ -78,12 +78,12 @@
78
78
  "esbuild-sass-plugin": "3.3.1",
79
79
  "swc-plugin-transform-remove-imports": "1.15.0",
80
80
  "@payloadcms/eslint-config": "3.0.0-beta.59",
81
- "payload": "3.0.0-beta.80"
81
+ "payload": "3.0.0-beta.81"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "graphql": "^16.8.1",
85
85
  "next": "^15.0.0-canary.104",
86
- "payload": "3.0.0-beta.80"
86
+ "payload": "3.0.0-beta.81"
87
87
  },
88
88
  "engines": {
89
89
  "node": "^18.20.2 || >=20.9.0"