@payloadcms/next 3.43.0-canary.6 → 3.43.0-internal.693bd81
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/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +36 -26
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.d.ts +6 -0
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.d.ts.map +1 -0
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +34 -0
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -0
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.d.ts +7 -0
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.d.ts.map +1 -0
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +17 -0
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -0
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +81 -35
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts +6 -8
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +61 -91
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
- package/dist/utilities/handleServerFunctions.js +0 -2
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/views/BrowseByFolder/buildView.d.ts.map +1 -1
- package/dist/views/BrowseByFolder/buildView.js +61 -40
- package/dist/views/BrowseByFolder/buildView.js.map +1 -1
- package/dist/views/CollectionFolders/buildView.d.ts.map +1 -1
- package/dist/views/CollectionFolders/buildView.js +59 -45
- package/dist/views/CollectionFolders/buildView.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.d.ts.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +3 -10
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.d.ts +27 -0
- package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -0
- package/dist/views/Document/getViewsFromConfig.js +330 -0
- package/dist/views/Document/getViewsFromConfig.js.map +1 -0
- package/dist/views/Document/index.d.ts +1 -2
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +76 -34
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/LivePreview/index.client.js +1 -3
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts +0 -1
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +1 -9
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/index.scss +0 -4
- package/dist/views/Version/SelectComparison/index.js +0 -1
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +0 -2
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/views/Document/getDocumentView.d.ts +0 -18
- package/dist/views/Document/getDocumentView.d.ts.map +0 -1
- package/dist/views/Document/getDocumentView.js +0 -264
- package/dist/views/Document/getDocumentView.js.map +0 -1
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { APIView as DefaultAPIView } from '../API/index.js';
|
|
2
|
-
import { EditView as DefaultEditView } from '../Edit/index.js';
|
|
3
|
-
import { LivePreviewView as DefaultLivePreviewView } from '../LivePreview/index.js';
|
|
4
|
-
import { UnauthorizedViewWithGutter } from '../Unauthorized/index.js';
|
|
5
|
-
import { VersionView as DefaultVersionView } from '../Version/index.js';
|
|
6
|
-
import { VersionsView as DefaultVersionsView } from '../Versions/index.js';
|
|
7
|
-
import { getCustomViewByKey } from './getCustomViewByKey.js';
|
|
8
|
-
import { getCustomViewByRoute } from './getCustomViewByRoute.js';
|
|
9
|
-
export const getDocumentView = ({
|
|
10
|
-
collectionConfig,
|
|
11
|
-
config,
|
|
12
|
-
docPermissions,
|
|
13
|
-
globalConfig,
|
|
14
|
-
routeSegments
|
|
15
|
-
}) => {
|
|
16
|
-
// Conditionally import and lazy load the default view
|
|
17
|
-
let View = null;
|
|
18
|
-
let viewKey;
|
|
19
|
-
const {
|
|
20
|
-
routes: {
|
|
21
|
-
admin: adminRoute
|
|
22
|
-
}
|
|
23
|
-
} = config;
|
|
24
|
-
const views = collectionConfig && collectionConfig?.admin?.components?.views || globalConfig && globalConfig?.admin?.components?.views;
|
|
25
|
-
if (!docPermissions?.read) {
|
|
26
|
-
throw new Error('not-found');
|
|
27
|
-
}
|
|
28
|
-
if (collectionConfig) {
|
|
29
|
-
const [collectionEntity, collectionSlug, segment3, segment4, segment5, ...remainingSegments] = routeSegments;
|
|
30
|
-
// --> /collections/:collectionSlug/:id
|
|
31
|
-
// --> /collections/:collectionSlug/create
|
|
32
|
-
switch (routeSegments.length) {
|
|
33
|
-
case 3:
|
|
34
|
-
{
|
|
35
|
-
switch (segment3) {
|
|
36
|
-
// --> /collections/:collectionSlug/create
|
|
37
|
-
case 'create':
|
|
38
|
-
{
|
|
39
|
-
if ('create' in docPermissions && docPermissions.create) {
|
|
40
|
-
View = getCustomViewByKey(views, 'default') || DefaultEditView;
|
|
41
|
-
} else {
|
|
42
|
-
View = UnauthorizedViewWithGutter;
|
|
43
|
-
}
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
// --> /collections/:collectionSlug/:id
|
|
47
|
-
default:
|
|
48
|
-
{
|
|
49
|
-
const baseRoute = [adminRoute !== '/' && adminRoute, 'collections', collectionSlug, segment3].filter(Boolean).join('/');
|
|
50
|
-
const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments].filter(Boolean).join('/');
|
|
51
|
-
const {
|
|
52
|
-
Component: CustomViewComponent,
|
|
53
|
-
viewKey: customViewKey
|
|
54
|
-
} = getCustomViewByRoute({
|
|
55
|
-
baseRoute,
|
|
56
|
-
currentRoute,
|
|
57
|
-
views
|
|
58
|
-
});
|
|
59
|
-
if (customViewKey) {
|
|
60
|
-
viewKey = customViewKey;
|
|
61
|
-
View = CustomViewComponent;
|
|
62
|
-
} else {
|
|
63
|
-
View = getCustomViewByKey(views, 'default') || DefaultEditView;
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
// --> /collections/:collectionSlug/:id/api
|
|
71
|
-
// --> /collections/:collectionSlug/:id/preview
|
|
72
|
-
// --> /collections/:collectionSlug/:id/versions
|
|
73
|
-
// --> /collections/:collectionSlug/:id/<custom-segment>
|
|
74
|
-
case 4:
|
|
75
|
-
{
|
|
76
|
-
switch (segment4) {
|
|
77
|
-
// --> /collections/:collectionSlug/:id/api
|
|
78
|
-
case 'api':
|
|
79
|
-
{
|
|
80
|
-
if (collectionConfig?.admin?.hideAPIURL !== true) {
|
|
81
|
-
View = getCustomViewByKey(views, 'api') || DefaultAPIView;
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case 'preview':
|
|
86
|
-
{
|
|
87
|
-
// --> /collections/:collectionSlug/:id/preview
|
|
88
|
-
if (collectionConfig && collectionConfig?.admin?.livePreview || config?.admin?.livePreview?.collections?.includes(collectionConfig?.slug)) {
|
|
89
|
-
View = getCustomViewByKey(views, 'livePreview') || DefaultLivePreviewView;
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
case 'versions':
|
|
94
|
-
{
|
|
95
|
-
// --> /collections/:collectionSlug/:id/versions
|
|
96
|
-
if (docPermissions?.readVersions) {
|
|
97
|
-
View = getCustomViewByKey(views, 'versions') || DefaultVersionsView;
|
|
98
|
-
} else {
|
|
99
|
-
View = UnauthorizedViewWithGutter;
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
// --> /collections/:collectionSlug/:id/<custom-segment>
|
|
104
|
-
default:
|
|
105
|
-
{
|
|
106
|
-
const baseRoute = [adminRoute !== '/' && adminRoute, 'collections', collectionSlug, segment3].filter(Boolean).join('/');
|
|
107
|
-
const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments].filter(Boolean).join('/');
|
|
108
|
-
const {
|
|
109
|
-
Component: CustomViewComponent,
|
|
110
|
-
viewKey: customViewKey
|
|
111
|
-
} = getCustomViewByRoute({
|
|
112
|
-
baseRoute,
|
|
113
|
-
currentRoute,
|
|
114
|
-
views
|
|
115
|
-
});
|
|
116
|
-
if (customViewKey) {
|
|
117
|
-
viewKey = customViewKey;
|
|
118
|
-
View = CustomViewComponent;
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
// --> /collections/:collectionSlug/:id/versions/:version
|
|
126
|
-
// --> /collections/:collectionSlug/:id/<custom-segment>/<custom-segment>
|
|
127
|
-
default:
|
|
128
|
-
{
|
|
129
|
-
// --> /collections/:collectionSlug/:id/versions/:version
|
|
130
|
-
if (segment4 === 'versions') {
|
|
131
|
-
if (docPermissions?.readVersions) {
|
|
132
|
-
View = getCustomViewByKey(views, 'version') || DefaultVersionView;
|
|
133
|
-
} else {
|
|
134
|
-
View = UnauthorizedViewWithGutter;
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
// --> /collections/:collectionSlug/:id/<custom-segment>/<custom-segment>
|
|
138
|
-
const baseRoute = [adminRoute !== '/' && adminRoute, collectionEntity, collectionSlug, segment3].filter(Boolean).join('/');
|
|
139
|
-
const currentRoute = [baseRoute, segment4, segment5, ...remainingSegments].filter(Boolean).join('/');
|
|
140
|
-
const {
|
|
141
|
-
Component: CustomViewComponent,
|
|
142
|
-
viewKey: customViewKey
|
|
143
|
-
} = getCustomViewByRoute({
|
|
144
|
-
baseRoute,
|
|
145
|
-
currentRoute,
|
|
146
|
-
views
|
|
147
|
-
});
|
|
148
|
-
if (customViewKey) {
|
|
149
|
-
viewKey = customViewKey;
|
|
150
|
-
View = CustomViewComponent;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (globalConfig) {
|
|
158
|
-
const [globalEntity, globalSlug, segment3, ...remainingSegments] = routeSegments;
|
|
159
|
-
switch (routeSegments.length) {
|
|
160
|
-
// --> /globals/:globalSlug
|
|
161
|
-
case 2:
|
|
162
|
-
{
|
|
163
|
-
View = getCustomViewByKey(views, 'default') || DefaultEditView;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
case 3:
|
|
167
|
-
{
|
|
168
|
-
// --> /globals/:globalSlug/api
|
|
169
|
-
// --> /globals/:globalSlug/preview
|
|
170
|
-
// --> /globals/:globalSlug/versions
|
|
171
|
-
// --> /globals/:globalSlug/<custom-segment>
|
|
172
|
-
switch (segment3) {
|
|
173
|
-
// --> /globals/:globalSlug/api
|
|
174
|
-
case 'api':
|
|
175
|
-
{
|
|
176
|
-
if (globalConfig?.admin?.hideAPIURL !== true) {
|
|
177
|
-
View = getCustomViewByKey(views, 'api') || DefaultAPIView;
|
|
178
|
-
}
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
case 'preview':
|
|
182
|
-
{
|
|
183
|
-
// --> /globals/:globalSlug/preview
|
|
184
|
-
if (globalConfig && globalConfig?.admin?.livePreview || config?.admin?.livePreview?.globals?.includes(globalConfig?.slug)) {
|
|
185
|
-
View = getCustomViewByKey(views, 'livePreview') || DefaultLivePreviewView;
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
case 'versions':
|
|
190
|
-
{
|
|
191
|
-
// --> /globals/:globalSlug/versions
|
|
192
|
-
if (docPermissions?.readVersions) {
|
|
193
|
-
View = getCustomViewByKey(views, 'versions') || DefaultVersionsView;
|
|
194
|
-
} else {
|
|
195
|
-
View = UnauthorizedViewWithGutter;
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
// --> /globals/:globalSlug/<custom-segment>
|
|
200
|
-
default:
|
|
201
|
-
{
|
|
202
|
-
if (docPermissions?.read) {
|
|
203
|
-
const baseRoute = [adminRoute, globalEntity, globalSlug, segment3].filter(Boolean).join('/');
|
|
204
|
-
const currentRoute = [baseRoute, segment3, ...remainingSegments].filter(Boolean).join('/');
|
|
205
|
-
const {
|
|
206
|
-
Component: CustomViewComponent,
|
|
207
|
-
viewKey: customViewKey
|
|
208
|
-
} = getCustomViewByRoute({
|
|
209
|
-
baseRoute,
|
|
210
|
-
currentRoute,
|
|
211
|
-
views
|
|
212
|
-
});
|
|
213
|
-
if (customViewKey) {
|
|
214
|
-
viewKey = customViewKey;
|
|
215
|
-
View = CustomViewComponent;
|
|
216
|
-
} else {
|
|
217
|
-
View = DefaultEditView;
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
View = UnauthorizedViewWithGutter;
|
|
221
|
-
}
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
// --> /globals/:globalSlug/versions/:version
|
|
228
|
-
// --> /globals/:globalSlug/<custom-segment>/<custom-segment>
|
|
229
|
-
default:
|
|
230
|
-
{
|
|
231
|
-
// --> /globals/:globalSlug/versions/:version
|
|
232
|
-
if (segment3 === 'versions') {
|
|
233
|
-
if (docPermissions?.readVersions) {
|
|
234
|
-
View = getCustomViewByKey(views, 'version') || DefaultVersionView;
|
|
235
|
-
} else {
|
|
236
|
-
View = UnauthorizedViewWithGutter;
|
|
237
|
-
}
|
|
238
|
-
} else {
|
|
239
|
-
// --> /globals/:globalSlug/<custom-segment>/<custom-segment>
|
|
240
|
-
const baseRoute = [adminRoute !== '/' && adminRoute, 'globals', globalSlug].filter(Boolean).join('/');
|
|
241
|
-
const currentRoute = [baseRoute, segment3, ...remainingSegments].filter(Boolean).join('/');
|
|
242
|
-
const {
|
|
243
|
-
Component: CustomViewComponent,
|
|
244
|
-
viewKey: customViewKey
|
|
245
|
-
} = getCustomViewByRoute({
|
|
246
|
-
baseRoute,
|
|
247
|
-
currentRoute,
|
|
248
|
-
views
|
|
249
|
-
});
|
|
250
|
-
if (customViewKey) {
|
|
251
|
-
viewKey = customViewKey;
|
|
252
|
-
View = CustomViewComponent;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
View,
|
|
261
|
-
viewKey
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
|
-
//# sourceMappingURL=getDocumentView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDocumentView.js","names":["APIView","DefaultAPIView","EditView","DefaultEditView","LivePreviewView","DefaultLivePreviewView","UnauthorizedViewWithGutter","VersionView","DefaultVersionView","VersionsView","DefaultVersionsView","getCustomViewByKey","getCustomViewByRoute","getDocumentView","collectionConfig","config","docPermissions","globalConfig","routeSegments","View","viewKey","routes","admin","adminRoute","views","components","read","Error","collectionEntity","collectionSlug","segment3","segment4","segment5","remainingSegments","length","create","baseRoute","filter","Boolean","join","currentRoute","Component","CustomViewComponent","customViewKey","hideAPIURL","livePreview","collections","includes","slug","readVersions","globalEntity","globalSlug","globals"],"sources":["../../../src/views/Document/getDocumentView.tsx"],"sourcesContent":["import type {\n PayloadComponent,\n SanitizedCollectionConfig,\n SanitizedCollectionPermission,\n SanitizedConfig,\n SanitizedGlobalConfig,\n SanitizedGlobalPermission,\n} from 'payload'\nimport type React from 'react'\n\nimport type { ViewToRender } from './index.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 { UnauthorizedViewWithGutter } 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 ComponentConfig?: PayloadComponent<TProps>\n}\n\nexport const getDocumentView = ({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments,\n}: {\n collectionConfig?: SanitizedCollectionConfig\n config: SanitizedConfig\n docPermissions: SanitizedCollectionPermission | SanitizedGlobalPermission\n globalConfig?: SanitizedGlobalConfig\n routeSegments: string[]\n}): {\n View: ViewToRender\n viewKey: string\n} | null => {\n // Conditionally import and lazy load the default view\n let View: ViewToRender = null\n let viewKey: string\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 if (!docPermissions?.read) {\n throw new Error('not-found')\n }\n\n if (collectionConfig) {\n const [collectionEntity, collectionSlug, segment3, segment4, segment5, ...remainingSegments] =\n routeSegments\n\n // --> /collections/:collectionSlug/:id\n // --> /collections/:collectionSlug/create\n switch (routeSegments.length) {\n case 3: {\n switch (segment3) {\n // --> /collections/:collectionSlug/create\n case 'create': {\n if ('create' in docPermissions && docPermissions.create) {\n View = getCustomViewByKey(views, 'default') || DefaultEditView\n } else {\n View = UnauthorizedViewWithGutter\n }\n break\n }\n\n // --> /collections/:collectionSlug/:id\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 const { Component: CustomViewComponent, viewKey: customViewKey } = getCustomViewByRoute(\n {\n baseRoute,\n currentRoute,\n views,\n },\n )\n\n if (customViewKey) {\n viewKey = customViewKey\n View = CustomViewComponent\n } else {\n View = getCustomViewByKey(views, 'default') || DefaultEditView\n }\n\n break\n }\n }\n break\n }\n\n // --> /collections/:collectionSlug/:id/api\n // --> /collections/:collectionSlug/:id/preview\n // --> /collections/:collectionSlug/:id/versions\n // --> /collections/:collectionSlug/:id/<custom-segment>\n case 4: {\n switch (segment4) {\n // --> /collections/:collectionSlug/:id/api\n case 'api': {\n if (collectionConfig?.admin?.hideAPIURL !== true) {\n View = getCustomViewByKey(views, 'api') || DefaultAPIView\n }\n break\n }\n\n case 'preview': {\n // --> /collections/:collectionSlug/:id/preview\n if (\n (collectionConfig && collectionConfig?.admin?.livePreview) ||\n config?.admin?.livePreview?.collections?.includes(collectionConfig?.slug)\n ) {\n View = getCustomViewByKey(views, 'livePreview') || DefaultLivePreviewView\n }\n break\n }\n\n case 'versions': {\n // --> /collections/:collectionSlug/:id/versions\n if (docPermissions?.readVersions) {\n View = getCustomViewByKey(views, 'versions') || DefaultVersionsView\n } else {\n View = UnauthorizedViewWithGutter\n }\n break\n }\n\n // --> /collections/:collectionSlug/:id/<custom-segment>\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 const { Component: CustomViewComponent, viewKey: customViewKey } = getCustomViewByRoute(\n {\n baseRoute,\n currentRoute,\n views,\n },\n )\n\n if (customViewKey) {\n viewKey = customViewKey\n View = CustomViewComponent\n }\n\n break\n }\n }\n break\n }\n\n // --> /collections/:collectionSlug/:id/versions/:version\n // --> /collections/:collectionSlug/:id/<custom-segment>/<custom-segment>\n default: {\n // --> /collections/:collectionSlug/:id/versions/:version\n if (segment4 === 'versions') {\n if (docPermissions?.readVersions) {\n View = getCustomViewByKey(views, 'version') || DefaultVersionView\n } else {\n View = UnauthorizedViewWithGutter\n }\n } else {\n // --> /collections/:collectionSlug/:id/<custom-segment>/<custom-segment>\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 const { Component: CustomViewComponent, viewKey: customViewKey } = getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n })\n\n if (customViewKey) {\n viewKey = customViewKey\n View = CustomViewComponent\n }\n }\n\n break\n }\n }\n }\n\n if (globalConfig) {\n const [globalEntity, globalSlug, segment3, ...remainingSegments] = routeSegments\n\n switch (routeSegments.length) {\n // --> /globals/:globalSlug\n case 2: {\n View = getCustomViewByKey(views, 'default') || DefaultEditView\n break\n }\n\n case 3: {\n // --> /globals/:globalSlug/api\n // --> /globals/:globalSlug/preview\n // --> /globals/:globalSlug/versions\n // --> /globals/:globalSlug/<custom-segment>\n switch (segment3) {\n // --> /globals/:globalSlug/api\n case 'api': {\n if (globalConfig?.admin?.hideAPIURL !== true) {\n View = getCustomViewByKey(views, 'api') || DefaultAPIView\n }\n\n break\n }\n\n case 'preview': {\n // --> /globals/:globalSlug/preview\n if (\n (globalConfig && globalConfig?.admin?.livePreview) ||\n config?.admin?.livePreview?.globals?.includes(globalConfig?.slug)\n ) {\n View = getCustomViewByKey(views, 'livePreview') || DefaultLivePreviewView\n }\n\n break\n }\n\n case 'versions': {\n // --> /globals/:globalSlug/versions\n if (docPermissions?.readVersions) {\n View = getCustomViewByKey(views, 'versions') || DefaultVersionsView\n } else {\n View = UnauthorizedViewWithGutter\n }\n break\n }\n\n // --> /globals/:globalSlug/<custom-segment>\n default: {\n if (docPermissions?.read) {\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 const { Component: CustomViewComponent, viewKey: customViewKey } =\n getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n })\n\n if (customViewKey) {\n viewKey = customViewKey\n\n View = CustomViewComponent\n } else {\n View = DefaultEditView\n }\n } else {\n View = UnauthorizedViewWithGutter\n }\n break\n }\n }\n break\n }\n\n // --> /globals/:globalSlug/versions/:version\n // --> /globals/:globalSlug/<custom-segment>/<custom-segment>\n default: {\n // --> /globals/:globalSlug/versions/:version\n if (segment3 === 'versions') {\n if (docPermissions?.readVersions) {\n View = getCustomViewByKey(views, 'version') || DefaultVersionView\n } else {\n View = UnauthorizedViewWithGutter\n }\n } else {\n // --> /globals/:globalSlug/<custom-segment>/<custom-segment>\n const baseRoute = [adminRoute !== '/' && adminRoute, 'globals', globalSlug]\n .filter(Boolean)\n .join('/')\n\n const currentRoute = [baseRoute, segment3, ...remainingSegments].filter(Boolean).join('/')\n\n const { Component: CustomViewComponent, viewKey: customViewKey } = getCustomViewByRoute({\n baseRoute,\n currentRoute,\n views,\n })\n\n if (customViewKey) {\n viewKey = customViewKey\n View = CustomViewComponent\n }\n }\n\n break\n }\n }\n }\n\n return {\n View,\n viewKey,\n }\n}\n"],"mappings":"AAYA,SAASA,OAAA,IAAWC,cAAc,QAAQ;AAC1C,SAASC,QAAA,IAAYC,eAAe,QAAQ;AAC5C,SAASC,eAAA,IAAmBC,sBAAsB,QAAQ;AAC1D,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,YAAA,IAAgBC,mBAAmB,QAAQ;AACpD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AAOrC,OAAO,MAAMC,eAAA,GAAkBA,CAAC;EAC9BC,gBAAgB;EAChBC,MAAM;EACNC,cAAc;EACdC,YAAY;EACZC;AAAa,CAOd;EA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