@orion-studios/payload-studio 0.5.0-beta.99 → 0.6.0-beta.1
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/README.md +58 -68
- package/dist/admin/client.d.mts +5 -0
- package/dist/admin/client.d.ts +5 -0
- package/dist/admin/client.js +4440 -806
- package/dist/admin/client.mjs +3279 -785
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +380 -55
- package/dist/admin/index.mjs +2 -1
- package/dist/admin-app/client.d.mts +1 -0
- package/dist/admin-app/client.d.ts +1 -0
- package/dist/admin-app/client.js +285 -109
- package/dist/admin-app/client.mjs +59 -871
- package/dist/admin-app/index.d.mts +2 -1
- package/dist/admin-app/index.d.ts +2 -1
- package/dist/admin-app/index.mjs +5 -3
- package/dist/admin-app/styles.css +1708 -56
- package/dist/admin.css +158 -35
- package/dist/blocks/index.js +415 -200
- package/dist/blocks/index.mjs +2 -2
- package/dist/{chunk-XK3K5GRP.mjs → chunk-JQAHXYAM.mjs} +271 -67
- package/dist/chunk-KPIX7OSV.mjs +1051 -0
- package/dist/chunk-OQSEJXC4.mjs +166 -0
- package/dist/{chunk-XHWQJUX5.mjs → chunk-OTHERBGX.mjs} +3 -3
- package/dist/chunk-PF3EBZXF.mjs +326 -0
- package/dist/{chunk-74XFAVXU.mjs → chunk-Q2HGC67S.mjs} +371 -55
- package/dist/{chunk-XVH5SCBD.mjs → chunk-RKTIFEUY.mjs} +4 -19
- package/dist/chunk-W2UOCJDX.mjs +32 -0
- package/dist/{chunk-C4J35SPJ.mjs → chunk-XKUTZ7IU.mjs} +257 -452
- package/dist/{index-ZbOx4OCF.d.mts → index-52HdVLQq.d.ts} +12 -22
- package/dist/index-BMitiKK8.d.ts +435 -0
- package/dist/index-Crx_MtPw.d.ts +223 -0
- package/dist/index-Cv-6qnrw.d.mts +223 -0
- package/dist/{index-ZbOx4OCF.d.ts → index-DEQC3Dwj.d.mts} +12 -22
- package/dist/{index-BIwu3qIH.d.mts → index-DWmudwDm.d.mts} +2 -1
- package/dist/{index-BIwu3qIH.d.ts → index-DWmudwDm.d.ts} +2 -1
- package/dist/index-D_b24Gef.d.mts +435 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1855 -1205
- package/dist/index.mjs +10 -8
- package/dist/nextjs/index.js +5 -684
- package/dist/nextjs/index.mjs +2 -3
- package/dist/sitePreviewTypes-BkHCWxNW.d.mts +58 -0
- package/dist/sitePreviewTypes-BkHCWxNW.d.ts +58 -0
- package/dist/studio/index.d.mts +1 -1
- package/dist/studio/index.d.ts +1 -1
- package/dist/studio-pages/builder.css +125 -83
- package/dist/studio-pages/client.d.mts +58 -1
- package/dist/studio-pages/client.d.ts +58 -1
- package/dist/studio-pages/client.js +450 -241
- package/dist/studio-pages/client.mjs +455 -247
- package/dist/studio-pages/index.d.mts +3 -2
- package/dist/studio-pages/index.d.ts +3 -2
- package/dist/studio-pages/index.js +418 -183
- package/dist/studio-pages/index.mjs +15 -6
- package/package.json +10 -4
- package/dist/chunk-SIL2J5MF.mjs +0 -155
- package/dist/index-BnoqmQDP.d.mts +0 -219
- package/dist/index-CTpik6fR.d.ts +0 -219
- package/dist/index-R7hA134j.d.mts +0 -140
- package/dist/index-vjrjy0P4.d.ts +0 -140
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminNavIcons
|
|
3
|
+
} from "./chunk-W2UOCJDX.mjs";
|
|
1
4
|
import {
|
|
2
5
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
3
6
|
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
@@ -51,6 +54,7 @@ var themePreferenceField = createThemePreferenceField("brand-light");
|
|
|
51
54
|
|
|
52
55
|
// src/shared/studioSections.ts
|
|
53
56
|
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
57
|
+
var studioIcons = new Set(adminNavIcons);
|
|
54
58
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
55
59
|
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
56
60
|
var normalizePathLikeValue = (value) => {
|
|
@@ -91,6 +95,7 @@ var normalizeCard = (value) => {
|
|
|
91
95
|
...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
|
|
92
96
|
};
|
|
93
97
|
};
|
|
98
|
+
var normalizeIcon = (value) => typeof value === "string" && studioIcons.has(value) ? value : void 0;
|
|
94
99
|
var resolveStudioSections = (value) => {
|
|
95
100
|
if (!Array.isArray(value)) {
|
|
96
101
|
return [];
|
|
@@ -116,6 +121,7 @@ var resolveStudioSections = (value) => {
|
|
|
116
121
|
label,
|
|
117
122
|
href,
|
|
118
123
|
matchPrefixes,
|
|
124
|
+
...normalizeIcon(entry.icon) ? { icon: normalizeIcon(entry.icon) } : {},
|
|
119
125
|
...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
|
|
120
126
|
...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
|
|
121
127
|
});
|
|
@@ -180,17 +186,28 @@ function configureAdmin(config) {
|
|
|
180
186
|
brandPrimary = "#3b82f6",
|
|
181
187
|
brandSecondary = "#8b5cf6",
|
|
182
188
|
defaultTheme = "brand-light",
|
|
183
|
-
logoUrl
|
|
189
|
+
logoUrl,
|
|
190
|
+
allowThemePreference = false
|
|
184
191
|
} = config;
|
|
185
192
|
const studioEnabled = config.studio?.enabled ?? true;
|
|
193
|
+
const formsEnabled = config.studio?.forms?.enabled ?? false;
|
|
194
|
+
const formsCollectionSlug = config.studio?.forms?.collectionSlug || "forms";
|
|
195
|
+
const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
|
|
196
|
+
const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
|
|
186
197
|
const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
|
|
198
|
+
const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
|
|
187
199
|
const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
|
|
188
|
-
const
|
|
200
|
+
const globalsBasePath = "/site-globals";
|
|
201
|
+
const pagesBasePath = "/pages";
|
|
202
|
+
const formsBasePath = "/forms";
|
|
203
|
+
const mediaBasePath = "/media";
|
|
204
|
+
const toolsBasePath = "/tools";
|
|
205
|
+
const contactFormStudioPath = "/contact-form";
|
|
189
206
|
const configuredGlobals = config.studio?.globals || [
|
|
190
207
|
{ slug: "site-settings", label: "Website Settings" },
|
|
191
208
|
{ slug: "header", label: "Header & Navigation" },
|
|
192
209
|
{ slug: "footer", label: "Footer" },
|
|
193
|
-
{ slug: "
|
|
210
|
+
{ slug: "social-media", label: "Social Media" }
|
|
194
211
|
];
|
|
195
212
|
const globals = configuredGlobals.map((global) => {
|
|
196
213
|
if (global.slug !== "contact-form" || global.href) {
|
|
@@ -203,24 +220,78 @@ function configureAdmin(config) {
|
|
|
203
220
|
});
|
|
204
221
|
const studioSections = resolveStudioSections(config.studio?.sections || []);
|
|
205
222
|
const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
|
|
223
|
+
const sitePreview = config.studio?.sitePreview;
|
|
206
224
|
let cssPath;
|
|
207
225
|
const pkgDist = getPkgDistDir();
|
|
208
226
|
const sourceCssPath = path.resolve(pkgDist, "admin.css");
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
227
|
+
const adminAppCssPath = path.resolve(pkgDist, "admin-app", "styles.css");
|
|
228
|
+
const cssSources = [sourceCssPath, adminAppCssPath].filter((filePath) => fs.existsSync(filePath));
|
|
229
|
+
if (cssSources.length === 0) {
|
|
230
|
+
cssPath = sourceCssPath;
|
|
231
|
+
} else {
|
|
232
|
+
let css = cssSources.map((filePath) => fs.readFileSync(filePath, "utf-8")).join("\n\n");
|
|
233
|
+
css = css.replace(
|
|
234
|
+
"--orion-cms-brand-primary-fallback: #3b82f6;",
|
|
235
|
+
`--orion-cms-brand-primary-fallback: ${brandPrimary};`
|
|
236
|
+
);
|
|
237
|
+
css = css.replace(
|
|
238
|
+
"--orion-cms-brand-secondary-fallback: #8b5cf6;",
|
|
239
|
+
`--orion-cms-brand-secondary-fallback: ${brandSecondary};`
|
|
240
|
+
);
|
|
241
|
+
const outputBasePath = config.basePath || process.cwd();
|
|
242
|
+
const genDir = path.resolve(outputBasePath, ".generated");
|
|
214
243
|
if (!fs.existsSync(genDir)) {
|
|
215
244
|
fs.mkdirSync(genDir, { recursive: true });
|
|
216
245
|
}
|
|
217
246
|
const genPath = path.resolve(genDir, "admin.css");
|
|
218
247
|
fs.writeFileSync(genPath, css);
|
|
219
248
|
cssPath = genPath;
|
|
220
|
-
} else {
|
|
221
|
-
cssPath = sourceCssPath;
|
|
222
249
|
}
|
|
223
250
|
const clientPath = "@orion-studios/payload-studio/admin/client";
|
|
251
|
+
const studioNavClientProps = {
|
|
252
|
+
brandName,
|
|
253
|
+
formSubmissionsCollectionSlug,
|
|
254
|
+
formsCollectionSlug,
|
|
255
|
+
formsEnabled,
|
|
256
|
+
formUploadsCollectionSlug,
|
|
257
|
+
globalsBasePath,
|
|
258
|
+
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
259
|
+
logoUrl,
|
|
260
|
+
mediaCollectionSlug,
|
|
261
|
+
pagesCollectionSlug,
|
|
262
|
+
sections: studioSections
|
|
263
|
+
};
|
|
264
|
+
const studioBackBreadcrumbComponent = {
|
|
265
|
+
exportName: "StudioBackBreadcrumb",
|
|
266
|
+
path: clientPath
|
|
267
|
+
};
|
|
268
|
+
const hasMatchingComponent = (items, exportName) => Array.isArray(items) && items.some(
|
|
269
|
+
(item) => item && typeof item === "object" && item.exportName === exportName && item.path === clientPath
|
|
270
|
+
);
|
|
271
|
+
const appendComponent = (items, component, exportName) => hasMatchingComponent(items, exportName) ? items || [] : [...items || [], component];
|
|
272
|
+
const attachStudioBackBreadcrumbToCollection = (collection) => {
|
|
273
|
+
if (!studioEnabled) {
|
|
274
|
+
return collection;
|
|
275
|
+
}
|
|
276
|
+
const existingBeforeDocumentControls = collection.admin?.components?.edit?.beforeDocumentControls;
|
|
277
|
+
return {
|
|
278
|
+
...collection,
|
|
279
|
+
admin: {
|
|
280
|
+
...collection.admin,
|
|
281
|
+
components: {
|
|
282
|
+
...collection.admin?.components,
|
|
283
|
+
edit: {
|
|
284
|
+
...collection.admin?.components?.edit,
|
|
285
|
+
beforeDocumentControls: appendComponent(
|
|
286
|
+
existingBeforeDocumentControls,
|
|
287
|
+
studioBackBreadcrumbComponent,
|
|
288
|
+
"StudioBackBreadcrumb"
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
};
|
|
224
295
|
return {
|
|
225
296
|
admin: {
|
|
226
297
|
css: cssPath,
|
|
@@ -229,15 +300,7 @@ function configureAdmin(config) {
|
|
|
229
300
|
Nav: {
|
|
230
301
|
exportName: "AdminStudioNav",
|
|
231
302
|
path: clientPath,
|
|
232
|
-
clientProps:
|
|
233
|
-
brandName,
|
|
234
|
-
logoUrl,
|
|
235
|
-
globalsBasePath: "/studio-globals",
|
|
236
|
-
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
237
|
-
mediaCollectionSlug,
|
|
238
|
-
pagesCollectionSlug,
|
|
239
|
-
sections: studioSections
|
|
240
|
-
}
|
|
303
|
+
clientProps: studioNavClientProps
|
|
241
304
|
}
|
|
242
305
|
} : {},
|
|
243
306
|
graphics: {
|
|
@@ -263,37 +326,113 @@ function configureAdmin(config) {
|
|
|
263
326
|
Component: {
|
|
264
327
|
exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
|
|
265
328
|
path: clientPath,
|
|
266
|
-
clientProps:
|
|
267
|
-
brandName,
|
|
268
|
-
logoUrl,
|
|
269
|
-
globalsBasePath: "/studio-globals",
|
|
270
|
-
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
271
|
-
mediaCollectionSlug,
|
|
272
|
-
pagesCollectionSlug,
|
|
273
|
-
sections: studioSections
|
|
274
|
-
}
|
|
329
|
+
clientProps: studioNavClientProps
|
|
275
330
|
}
|
|
276
331
|
},
|
|
277
332
|
...studioEnabled ? {
|
|
278
333
|
studioGlobals: {
|
|
279
|
-
path:
|
|
334
|
+
path: globalsBasePath,
|
|
280
335
|
Component: {
|
|
281
336
|
exportName: "AdminStudioGlobalsView",
|
|
282
337
|
path: clientPath,
|
|
283
338
|
clientProps: {
|
|
339
|
+
...studioNavClientProps,
|
|
284
340
|
globals,
|
|
285
|
-
globalsBasePath
|
|
341
|
+
globalsBasePath
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
studioPages: {
|
|
346
|
+
path: pagesBasePath,
|
|
347
|
+
Component: {
|
|
348
|
+
exportName: "AdminStudioPagesListView",
|
|
349
|
+
path: clientPath,
|
|
350
|
+
clientProps: {
|
|
351
|
+
...studioNavClientProps,
|
|
352
|
+
pagesCollectionSlug
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
studioPageEditor: {
|
|
357
|
+
path: `${pagesBasePath}/:id`,
|
|
358
|
+
Component: {
|
|
359
|
+
exportName: "AdminStudioPageEditView",
|
|
360
|
+
path: clientPath,
|
|
361
|
+
clientProps: {
|
|
362
|
+
...studioNavClientProps,
|
|
363
|
+
builderBasePath
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
studioPageNew: {
|
|
368
|
+
path: `${pagesBasePath}/new`,
|
|
369
|
+
Component: {
|
|
370
|
+
exportName: "AdminStudioNewPageView",
|
|
371
|
+
path: clientPath,
|
|
372
|
+
clientProps: {
|
|
373
|
+
...studioNavClientProps,
|
|
374
|
+
pagesCollectionSlug
|
|
286
375
|
}
|
|
287
376
|
}
|
|
288
377
|
},
|
|
289
378
|
studioContactForm: {
|
|
290
|
-
path:
|
|
379
|
+
path: contactFormStudioPath,
|
|
291
380
|
Component: {
|
|
292
381
|
exportName: "AdminStudioContactFormView",
|
|
293
382
|
path: clientPath,
|
|
294
383
|
clientProps: {
|
|
384
|
+
...studioNavClientProps,
|
|
295
385
|
globalSlug: "contact-form",
|
|
296
|
-
globalsBasePath
|
|
386
|
+
globalsBasePath
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
...formsEnabled ? {
|
|
391
|
+
studioForms: {
|
|
392
|
+
path: formsBasePath,
|
|
393
|
+
Component: {
|
|
394
|
+
exportName: "AdminStudioFormsView",
|
|
395
|
+
path: clientPath,
|
|
396
|
+
clientProps: {
|
|
397
|
+
...studioNavClientProps,
|
|
398
|
+
formsCollectionSlug,
|
|
399
|
+
formSubmissionsCollectionSlug,
|
|
400
|
+
formUploadsCollectionSlug
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
} : {},
|
|
405
|
+
studioMedia: {
|
|
406
|
+
path: mediaBasePath,
|
|
407
|
+
Component: {
|
|
408
|
+
exportName: "AdminStudioMediaView",
|
|
409
|
+
path: clientPath,
|
|
410
|
+
clientProps: {
|
|
411
|
+
...studioNavClientProps,
|
|
412
|
+
mediaCollectionSlug
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
studioMediaItem: {
|
|
417
|
+
path: `${mediaBasePath}/:id`,
|
|
418
|
+
Component: {
|
|
419
|
+
exportName: "AdminStudioMediaItemView",
|
|
420
|
+
path: clientPath,
|
|
421
|
+
clientProps: {
|
|
422
|
+
...studioNavClientProps,
|
|
423
|
+
mediaCollectionSlug
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
studioTools: {
|
|
428
|
+
path: toolsBasePath,
|
|
429
|
+
Component: {
|
|
430
|
+
exportName: "AdminStudioToolsView",
|
|
431
|
+
path: clientPath,
|
|
432
|
+
clientProps: {
|
|
433
|
+
...studioNavClientProps,
|
|
434
|
+
mediaCollectionSlug,
|
|
435
|
+
pagesCollectionSlug
|
|
297
436
|
}
|
|
298
437
|
}
|
|
299
438
|
},
|
|
@@ -302,7 +441,13 @@ function configureAdmin(config) {
|
|
|
302
441
|
id,
|
|
303
442
|
{
|
|
304
443
|
path: view.path,
|
|
305
|
-
Component:
|
|
444
|
+
Component: {
|
|
445
|
+
...view.Component,
|
|
446
|
+
clientProps: {
|
|
447
|
+
...studioNavClientProps,
|
|
448
|
+
...view.Component.clientProps || {}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
306
451
|
}
|
|
307
452
|
])
|
|
308
453
|
)
|
|
@@ -313,19 +458,33 @@ function configureAdmin(config) {
|
|
|
313
458
|
exportName: "ThemeProvider",
|
|
314
459
|
path: clientPath,
|
|
315
460
|
clientProps: {
|
|
461
|
+
allowThemePreference,
|
|
316
462
|
defaultTheme
|
|
317
463
|
}
|
|
318
464
|
}
|
|
319
465
|
],
|
|
320
|
-
|
|
466
|
+
beforeLogin: [
|
|
321
467
|
{
|
|
322
|
-
exportName: "
|
|
468
|
+
exportName: "AdminLoginIntro",
|
|
323
469
|
path: clientPath,
|
|
324
470
|
clientProps: {
|
|
325
|
-
|
|
471
|
+
brandName,
|
|
472
|
+
logoUrl
|
|
326
473
|
}
|
|
327
474
|
}
|
|
328
|
-
]
|
|
475
|
+
],
|
|
476
|
+
...allowThemePreference ? {
|
|
477
|
+
afterNavLinks: [
|
|
478
|
+
{
|
|
479
|
+
exportName: "ThemeSwitcher",
|
|
480
|
+
path: clientPath,
|
|
481
|
+
clientProps: {
|
|
482
|
+
allowThemePreference,
|
|
483
|
+
defaultTheme
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
]
|
|
487
|
+
} : {}
|
|
329
488
|
},
|
|
330
489
|
meta: {
|
|
331
490
|
titleSuffix: ` \u2014 ${brandName}`
|
|
@@ -340,10 +499,76 @@ function configureAdmin(config) {
|
|
|
340
499
|
const hasThemePreference = existingFields.some(
|
|
341
500
|
(field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
|
|
342
501
|
);
|
|
343
|
-
|
|
502
|
+
const nextCollection = {
|
|
344
503
|
...usersCollection,
|
|
345
|
-
fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
|
|
504
|
+
fields: !allowThemePreference || hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
|
|
346
505
|
};
|
|
506
|
+
return attachStudioBackBreadcrumbToCollection(nextCollection);
|
|
507
|
+
},
|
|
508
|
+
wrapPagesCollection(pagesCollection) {
|
|
509
|
+
if (!studioEnabled) {
|
|
510
|
+
return pagesCollection;
|
|
511
|
+
}
|
|
512
|
+
const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(pagesCollection);
|
|
513
|
+
const existingEditMenuItems = collectionWithBreadcrumb.admin?.components?.edit?.editMenuItems;
|
|
514
|
+
const existingViews = collectionWithBreadcrumb.admin?.components?.views;
|
|
515
|
+
const existingEditViews = existingViews?.edit;
|
|
516
|
+
const hasCustomEditView = Boolean(
|
|
517
|
+
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
518
|
+
);
|
|
519
|
+
return {
|
|
520
|
+
...collectionWithBreadcrumb,
|
|
521
|
+
admin: {
|
|
522
|
+
...collectionWithBreadcrumb.admin,
|
|
523
|
+
components: {
|
|
524
|
+
...collectionWithBreadcrumb.admin?.components,
|
|
525
|
+
edit: {
|
|
526
|
+
...collectionWithBreadcrumb.admin?.components?.edit,
|
|
527
|
+
editMenuItems: appendComponent(
|
|
528
|
+
existingEditMenuItems,
|
|
529
|
+
{
|
|
530
|
+
exportName: "OpenInStudioMenuItem",
|
|
531
|
+
path: clientPath,
|
|
532
|
+
clientProps: {
|
|
533
|
+
pagesPathBase: pagesBasePath
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"OpenInStudioMenuItem"
|
|
537
|
+
)
|
|
538
|
+
},
|
|
539
|
+
views: {
|
|
540
|
+
...existingViews,
|
|
541
|
+
...hasCustomEditView ? {} : {
|
|
542
|
+
edit: {
|
|
543
|
+
...existingEditViews,
|
|
544
|
+
default: {
|
|
545
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
546
|
+
Component: {
|
|
547
|
+
exportName: "PageEditRedirectToStudio",
|
|
548
|
+
path: clientPath,
|
|
549
|
+
clientProps: {
|
|
550
|
+
pagesPathBase: pagesBasePath
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
},
|
|
561
|
+
wrapMediaCollection(mediaCollection) {
|
|
562
|
+
return attachStudioBackBreadcrumbToCollection(mediaCollection);
|
|
563
|
+
},
|
|
564
|
+
wrapFormsCollection(formsCollection) {
|
|
565
|
+
return attachStudioBackBreadcrumbToCollection(formsCollection);
|
|
566
|
+
},
|
|
567
|
+
wrapFormSubmissionsCollection(formSubmissionsCollection) {
|
|
568
|
+
return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
|
|
569
|
+
},
|
|
570
|
+
wrapFormUploadsCollection(formUploadsCollection) {
|
|
571
|
+
return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
|
|
347
572
|
},
|
|
348
573
|
wrapGlobals(globals2) {
|
|
349
574
|
const labelMap = {
|
|
@@ -356,25 +581,110 @@ function configureAdmin(config) {
|
|
|
356
581
|
return globals2.map((global) => {
|
|
357
582
|
const mapping = labelMap[global.slug];
|
|
358
583
|
if (!mapping) return global;
|
|
584
|
+
const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
|
|
585
|
+
const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
|
|
359
586
|
const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
|
|
587
|
+
const shouldAttachHeaderEditView = studioEnabled && global.slug === "header";
|
|
588
|
+
const shouldAttachFooterEditView = studioEnabled && global.slug === "footer";
|
|
360
589
|
const existingViews = global.admin?.components?.views;
|
|
361
590
|
const existingEditViews = existingViews?.edit;
|
|
362
|
-
const
|
|
591
|
+
const hasCustomEditView = Boolean(
|
|
363
592
|
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
364
593
|
);
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
594
|
+
const nextEditViews = (() => {
|
|
595
|
+
if (shouldAttachSiteSettingsEditView && !hasCustomEditView) {
|
|
596
|
+
return {
|
|
597
|
+
...existingEditViews,
|
|
598
|
+
default: {
|
|
599
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
600
|
+
Component: {
|
|
601
|
+
exportName: "AdminStudioSiteSettingsGlobalView",
|
|
602
|
+
path: clientPath,
|
|
603
|
+
clientProps: {
|
|
604
|
+
...studioNavClientProps,
|
|
605
|
+
globalSlug: global.slug,
|
|
606
|
+
mediaCollectionSlug
|
|
607
|
+
}
|
|
608
|
+
}
|
|
374
609
|
}
|
|
375
|
-
}
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
if (shouldAttachSocialMediaEditView && !hasCustomEditView) {
|
|
613
|
+
return {
|
|
614
|
+
...existingEditViews,
|
|
615
|
+
default: {
|
|
616
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
617
|
+
Component: {
|
|
618
|
+
exportName: "AdminStudioSocialMediaGlobalView",
|
|
619
|
+
path: clientPath,
|
|
620
|
+
clientProps: {
|
|
621
|
+
...studioNavClientProps,
|
|
622
|
+
globalSlug: global.slug
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
if (shouldAttachHeaderEditView && !hasCustomEditView) {
|
|
629
|
+
return {
|
|
630
|
+
...existingEditViews,
|
|
631
|
+
default: {
|
|
632
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
633
|
+
Component: {
|
|
634
|
+
exportName: "AdminStudioHeaderGlobalView",
|
|
635
|
+
path: clientPath,
|
|
636
|
+
clientProps: {
|
|
637
|
+
...studioNavClientProps,
|
|
638
|
+
actionHref: sitePreview?.header?.actionHref,
|
|
639
|
+
actionLabel: sitePreview?.header?.actionLabel,
|
|
640
|
+
globalSlug: global.slug,
|
|
641
|
+
locationSummary: sitePreview?.locationSummary,
|
|
642
|
+
pagesCollectionSlug
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
if (shouldAttachFooterEditView && !hasCustomEditView) {
|
|
649
|
+
return {
|
|
650
|
+
...existingEditViews,
|
|
651
|
+
default: {
|
|
652
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
653
|
+
Component: {
|
|
654
|
+
exportName: "AdminStudioFooterGlobalView",
|
|
655
|
+
path: clientPath,
|
|
656
|
+
clientProps: {
|
|
657
|
+
...studioNavClientProps,
|
|
658
|
+
builtByHref: sitePreview?.footer?.builtByHref,
|
|
659
|
+
builtByLabel: sitePreview?.footer?.builtByLabel,
|
|
660
|
+
description: sitePreview?.footer?.description,
|
|
661
|
+
footerCategories: sitePreview?.footer?.footerCategories,
|
|
662
|
+
footerLinks: sitePreview?.footer?.footerLinks,
|
|
663
|
+
globalSlug: global.slug,
|
|
664
|
+
locationSummary: sitePreview?.locationSummary
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
if (shouldAttachContactFormRedirect && !hasCustomEditView) {
|
|
671
|
+
return {
|
|
672
|
+
...existingEditViews,
|
|
673
|
+
default: {
|
|
674
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
675
|
+
Component: {
|
|
676
|
+
exportName: "StudioContactFormRedirect",
|
|
677
|
+
path: clientPath,
|
|
678
|
+
clientProps: {
|
|
679
|
+
studioContactFormPath: contactFormStudioPath
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
};
|
|
376
684
|
}
|
|
377
|
-
|
|
685
|
+
return existingEditViews;
|
|
686
|
+
})();
|
|
687
|
+
const existingBeforeDocumentControls = global.admin?.components?.elements?.beforeDocumentControls;
|
|
378
688
|
return {
|
|
379
689
|
...global,
|
|
380
690
|
admin: {
|
|
@@ -382,12 +692,18 @@ function configureAdmin(config) {
|
|
|
382
692
|
group: mapping.group,
|
|
383
693
|
components: {
|
|
384
694
|
...global.admin?.components,
|
|
385
|
-
|
|
695
|
+
elements: {
|
|
696
|
+
...global.admin?.components?.elements,
|
|
697
|
+
beforeDocumentControls: studioEnabled ? appendComponent(
|
|
698
|
+
existingBeforeDocumentControls,
|
|
699
|
+
studioBackBreadcrumbComponent,
|
|
700
|
+
"StudioBackBreadcrumb"
|
|
701
|
+
) : existingBeforeDocumentControls
|
|
702
|
+
},
|
|
703
|
+
...nextEditViews ? {
|
|
386
704
|
views: {
|
|
387
705
|
...existingViews,
|
|
388
|
-
|
|
389
|
-
edit: contactFormEditViews
|
|
390
|
-
} : {}
|
|
706
|
+
edit: nextEditViews
|
|
391
707
|
}
|
|
392
708
|
} : {}
|
|
393
709
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
navItemIsActive,
|
|
3
|
+
roleCanAccessNav
|
|
4
|
+
} from "./chunk-W2UOCJDX.mjs";
|
|
1
5
|
import {
|
|
2
6
|
__export
|
|
3
7
|
} from "./chunk-6BWS3CLP.mjs";
|
|
@@ -202,23 +206,6 @@ var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
|
|
|
202
206
|
return [];
|
|
203
207
|
};
|
|
204
208
|
|
|
205
|
-
// src/admin-app/routeRegistry.ts
|
|
206
|
-
var roleCanAccessNav = (role, item) => {
|
|
207
|
-
if (!item.roles || item.roles.length === 0) {
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
|
-
if (!role) {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
return item.roles.includes(role);
|
|
214
|
-
};
|
|
215
|
-
var navItemIsActive = (pathname, item) => {
|
|
216
|
-
if (item.href === "/admin") {
|
|
217
|
-
return pathname === "/admin";
|
|
218
|
-
}
|
|
219
|
-
return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
220
|
-
};
|
|
221
|
-
|
|
222
209
|
export {
|
|
223
210
|
AdminBreadcrumbs,
|
|
224
211
|
AdminPage,
|
|
@@ -228,7 +215,5 @@ export {
|
|
|
228
215
|
getAdminNavRows,
|
|
229
216
|
normalizeAdminNavInputs,
|
|
230
217
|
parseAdminHeaderNavFromForm,
|
|
231
|
-
roleCanAccessNav,
|
|
232
|
-
navItemIsActive,
|
|
233
218
|
admin_app_exports
|
|
234
219
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/admin-app/routeRegistry.ts
|
|
2
|
+
var adminNavIcons = [
|
|
3
|
+
"dashboard",
|
|
4
|
+
"pages",
|
|
5
|
+
"forms",
|
|
6
|
+
"globals",
|
|
7
|
+
"media",
|
|
8
|
+
"tools",
|
|
9
|
+
"account",
|
|
10
|
+
"analytics"
|
|
11
|
+
];
|
|
12
|
+
var roleCanAccessNav = (role, item) => {
|
|
13
|
+
if (!item.roles || item.roles.length === 0) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (!role) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return item.roles.includes(role);
|
|
20
|
+
};
|
|
21
|
+
var navItemIsActive = (pathname, item) => {
|
|
22
|
+
if (item.href === "/admin") {
|
|
23
|
+
return pathname === "/admin";
|
|
24
|
+
}
|
|
25
|
+
return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
adminNavIcons,
|
|
30
|
+
roleCanAccessNav,
|
|
31
|
+
navItemIsActive
|
|
32
|
+
};
|