@orion-studios/payload-studio 0.5.0-beta.99 → 0.6.0-beta.10

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.
Files changed (62) hide show
  1. package/README.md +58 -68
  2. package/dist/admin/client.d.mts +7 -1
  3. package/dist/admin/client.d.ts +7 -1
  4. package/dist/admin/client.js +5446 -985
  5. package/dist/admin/client.mjs +4408 -1090
  6. package/dist/admin/index.d.mts +2 -1
  7. package/dist/admin/index.d.ts +2 -1
  8. package/dist/admin/index.js +396 -55
  9. package/dist/admin/index.mjs +2 -1
  10. package/dist/admin-app/client.d.mts +1 -0
  11. package/dist/admin-app/client.d.ts +1 -0
  12. package/dist/admin-app/client.js +285 -109
  13. package/dist/admin-app/client.mjs +59 -871
  14. package/dist/admin-app/index.d.mts +2 -1
  15. package/dist/admin-app/index.d.ts +2 -1
  16. package/dist/admin-app/index.mjs +5 -3
  17. package/dist/admin-app/styles.css +2118 -56
  18. package/dist/admin.css +158 -35
  19. package/dist/blocks/index.js +415 -200
  20. package/dist/blocks/index.mjs +2 -2
  21. package/dist/{chunk-XK3K5GRP.mjs → chunk-JQAHXYAM.mjs} +271 -67
  22. package/dist/chunk-KPIX7OSV.mjs +1051 -0
  23. package/dist/chunk-OQSEJXC4.mjs +166 -0
  24. package/dist/{chunk-XHWQJUX5.mjs → chunk-OTHERBGX.mjs} +3 -3
  25. package/dist/chunk-PF3EBZXF.mjs +326 -0
  26. package/dist/{chunk-XVH5SCBD.mjs → chunk-RKTIFEUY.mjs} +4 -19
  27. package/dist/chunk-W2UOCJDX.mjs +32 -0
  28. package/dist/{chunk-74XFAVXU.mjs → chunk-WLOPFFN2.mjs} +387 -55
  29. package/dist/{chunk-C4J35SPJ.mjs → chunk-XKUTZ7IU.mjs} +257 -452
  30. package/dist/{index-ZbOx4OCF.d.mts → index-52HdVLQq.d.ts} +12 -22
  31. package/dist/index-Bm2SaC3r.d.mts +187 -0
  32. package/dist/index-CkT_eyhK.d.ts +187 -0
  33. package/dist/index-Crx_MtPw.d.ts +223 -0
  34. package/dist/index-Cv-6qnrw.d.mts +223 -0
  35. package/dist/{index-ZbOx4OCF.d.ts → index-DEQC3Dwj.d.mts} +12 -22
  36. package/dist/{index-BIwu3qIH.d.mts → index-DWmudwDm.d.mts} +2 -1
  37. package/dist/{index-BIwu3qIH.d.ts → index-DWmudwDm.d.ts} +2 -1
  38. package/dist/index.d.mts +5 -4
  39. package/dist/index.d.ts +5 -4
  40. package/dist/index.js +1868 -1202
  41. package/dist/index.mjs +10 -8
  42. package/dist/nextjs/index.js +5 -684
  43. package/dist/nextjs/index.mjs +2 -3
  44. package/dist/sitePreviewTypes-BkHCWxNW.d.mts +58 -0
  45. package/dist/sitePreviewTypes-BkHCWxNW.d.ts +58 -0
  46. package/dist/studio/index.d.mts +1 -1
  47. package/dist/studio/index.d.ts +1 -1
  48. package/dist/studio-pages/builder.css +125 -83
  49. package/dist/studio-pages/client.d.mts +58 -1
  50. package/dist/studio-pages/client.d.ts +58 -1
  51. package/dist/studio-pages/client.js +450 -241
  52. package/dist/studio-pages/client.mjs +455 -247
  53. package/dist/studio-pages/index.d.mts +3 -2
  54. package/dist/studio-pages/index.d.ts +3 -2
  55. package/dist/studio-pages/index.js +418 -183
  56. package/dist/studio-pages/index.mjs +15 -6
  57. package/package.json +10 -4
  58. package/dist/chunk-SIL2J5MF.mjs +0 -155
  59. package/dist/index-BnoqmQDP.d.mts +0 -219
  60. package/dist/index-CTpik6fR.d.ts +0 -219
  61. package/dist/index-R7hA134j.d.mts +0 -140
  62. package/dist/index-vjrjy0P4.d.ts +0 -140
@@ -1,3 +1,4 @@
1
- export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioSection, b as StudioSectionCard, c as StudioSectionComponent, d as StudioSectionRole, e as StudioSectionView, f as configureAdmin, g as createHeaderNavItemsField, h as createSocialMediaConnectionsField, j as createSocialMediaGlobal, k as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-BnoqmQDP.mjs';
1
+ export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioDashboardPanel, f as ResolvedStudioSection, S as StudioDashboardPanel, g as StudioDashboardPanelSpan, h as StudioGlobalLink, j as StudioSection, k as StudioSectionCard, l as StudioSectionComponent, m as StudioSectionRole, n as StudioSectionView, o as configureAdmin, p as createHeaderNavItemsField, q as createSocialMediaConnectionsField, r as createSocialMediaGlobal, s as createThemePreferenceField, t as socialMediaConnectionsField, u as themePreferenceField, w as withTooltips } from '../index-Bm2SaC3r.mjs';
2
2
  export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.mjs';
3
3
  import 'payload';
4
+ import '../sitePreviewTypes-BkHCWxNW.mjs';
@@ -1,3 +1,4 @@
1
- export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioSection, b as StudioSectionCard, c as StudioSectionComponent, d as StudioSectionRole, e as StudioSectionView, f as configureAdmin, g as createHeaderNavItemsField, h as createSocialMediaConnectionsField, j as createSocialMediaGlobal, k as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-CTpik6fR.js';
1
+ export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioDashboardPanel, f as ResolvedStudioSection, S as StudioDashboardPanel, g as StudioDashboardPanelSpan, h as StudioGlobalLink, j as StudioSection, k as StudioSectionCard, l as StudioSectionComponent, m as StudioSectionRole, n as StudioSectionView, o as configureAdmin, p as createHeaderNavItemsField, q as createSocialMediaConnectionsField, r as createSocialMediaGlobal, s as createThemePreferenceField, t as socialMediaConnectionsField, u as themePreferenceField, w as withTooltips } from '../index-CkT_eyhK.js';
2
2
  export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.js';
3
3
  import 'payload';
4
+ import '../sitePreviewTypes-BkHCWxNW.js';
@@ -68,8 +68,21 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
68
68
  });
69
69
  var themePreferenceField = createThemePreferenceField("brand-light");
70
70
 
71
+ // src/admin-app/routeRegistry.ts
72
+ var adminNavIcons = [
73
+ "dashboard",
74
+ "pages",
75
+ "forms",
76
+ "globals",
77
+ "media",
78
+ "tools",
79
+ "account",
80
+ "analytics"
81
+ ];
82
+
71
83
  // src/shared/studioSections.ts
72
84
  var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
85
+ var studioIcons = new Set(adminNavIcons);
73
86
  var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
74
87
  var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
75
88
  var normalizePathLikeValue = (value) => {
@@ -110,6 +123,7 @@ var normalizeCard = (value) => {
110
123
  ...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
111
124
  };
112
125
  };
126
+ var normalizeIcon = (value) => typeof value === "string" && studioIcons.has(value) ? value : void 0;
113
127
  var resolveStudioSections = (value) => {
114
128
  if (!Array.isArray(value)) {
115
129
  return [];
@@ -135,6 +149,7 @@ var resolveStudioSections = (value) => {
135
149
  label,
136
150
  href,
137
151
  matchPrefixes,
152
+ ...normalizeIcon(entry.icon) ? { icon: normalizeIcon(entry.icon) } : {},
138
153
  ...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
139
154
  ...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
140
155
  });
@@ -200,17 +215,29 @@ function configureAdmin(config) {
200
215
  brandPrimary = "#3b82f6",
201
216
  brandSecondary = "#8b5cf6",
202
217
  defaultTheme = "brand-light",
203
- logoUrl
218
+ logoUrl,
219
+ allowThemePreference = false,
220
+ userSessionDurationSeconds = 60 * 60 * 24
204
221
  } = config;
205
222
  const studioEnabled = config.studio?.enabled ?? true;
223
+ const formsEnabled = config.studio?.forms?.enabled ?? false;
224
+ const formsCollectionSlug = config.studio?.forms?.collectionSlug || "forms";
225
+ const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
226
+ const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
206
227
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
228
+ const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
207
229
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
208
- const contactFormStudioPath = "/studio-contact-form";
230
+ const globalsBasePath = "/site-globals";
231
+ const pagesBasePath = "/pages";
232
+ const formsBasePath = "/forms";
233
+ const mediaBasePath = "/media";
234
+ const toolsBasePath = "/tools";
235
+ const contactFormStudioPath = "/contact-form";
209
236
  const configuredGlobals = config.studio?.globals || [
210
237
  { slug: "site-settings", label: "Website Settings" },
211
238
  { slug: "header", label: "Header & Navigation" },
212
239
  { slug: "footer", label: "Footer" },
213
- { slug: "contact-form", label: "Contact Form" }
240
+ { slug: "social-media", label: "Social Media" }
214
241
  ];
215
242
  const globals = configuredGlobals.map((global) => {
216
243
  if (global.slug !== "contact-form" || global.href) {
@@ -223,24 +250,78 @@ function configureAdmin(config) {
223
250
  });
224
251
  const studioSections = resolveStudioSections(config.studio?.sections || []);
225
252
  const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
253
+ const sitePreview = config.studio?.sitePreview;
226
254
  let cssPath;
227
255
  const pkgDist = getPkgDistDir();
228
256
  const sourceCssPath = import_path.default.resolve(pkgDist, "admin.css");
229
- if (config.basePath && import_fs.default.existsSync(sourceCssPath)) {
230
- let css = import_fs.default.readFileSync(sourceCssPath, "utf-8");
231
- css = css.replace("--brand-primary: #3b82f6;", `--brand-primary: ${brandPrimary};`);
232
- css = css.replace("--brand-secondary: #8b5cf6;", `--brand-secondary: ${brandSecondary};`);
233
- const genDir = import_path.default.resolve(config.basePath, ".generated");
257
+ const adminAppCssPath = import_path.default.resolve(pkgDist, "admin-app", "styles.css");
258
+ const cssSources = [sourceCssPath, adminAppCssPath].filter((filePath) => import_fs.default.existsSync(filePath));
259
+ if (cssSources.length === 0) {
260
+ cssPath = sourceCssPath;
261
+ } else {
262
+ let css = cssSources.map((filePath) => import_fs.default.readFileSync(filePath, "utf-8")).join("\n\n");
263
+ css = css.replace(
264
+ "--orion-cms-brand-primary-fallback: #3b82f6;",
265
+ `--orion-cms-brand-primary-fallback: ${brandPrimary};`
266
+ );
267
+ css = css.replace(
268
+ "--orion-cms-brand-secondary-fallback: #8b5cf6;",
269
+ `--orion-cms-brand-secondary-fallback: ${brandSecondary};`
270
+ );
271
+ const outputBasePath = config.basePath || process.cwd();
272
+ const genDir = import_path.default.resolve(outputBasePath, ".generated");
234
273
  if (!import_fs.default.existsSync(genDir)) {
235
274
  import_fs.default.mkdirSync(genDir, { recursive: true });
236
275
  }
237
276
  const genPath = import_path.default.resolve(genDir, "admin.css");
238
277
  import_fs.default.writeFileSync(genPath, css);
239
278
  cssPath = genPath;
240
- } else {
241
- cssPath = sourceCssPath;
242
279
  }
243
280
  const clientPath = "@orion-studios/payload-studio/admin/client";
281
+ const studioNavClientProps = {
282
+ brandName,
283
+ formSubmissionsCollectionSlug,
284
+ formsCollectionSlug,
285
+ formsEnabled,
286
+ formUploadsCollectionSlug,
287
+ globalsBasePath,
288
+ globalsExtraMatchPrefixes: [contactFormStudioPath],
289
+ logoUrl,
290
+ mediaCollectionSlug,
291
+ pagesCollectionSlug,
292
+ sections: studioSections
293
+ };
294
+ const studioBackBreadcrumbComponent = {
295
+ exportName: "StudioBackBreadcrumb",
296
+ path: clientPath
297
+ };
298
+ const hasMatchingComponent = (items, exportName) => Array.isArray(items) && items.some(
299
+ (item) => item && typeof item === "object" && item.exportName === exportName && item.path === clientPath
300
+ );
301
+ const appendComponent = (items, component, exportName) => hasMatchingComponent(items, exportName) ? items || [] : [...items || [], component];
302
+ const attachStudioBackBreadcrumbToCollection = (collection) => {
303
+ if (!studioEnabled) {
304
+ return collection;
305
+ }
306
+ const existingBeforeDocumentControls = collection.admin?.components?.edit?.beforeDocumentControls;
307
+ return {
308
+ ...collection,
309
+ admin: {
310
+ ...collection.admin,
311
+ components: {
312
+ ...collection.admin?.components,
313
+ edit: {
314
+ ...collection.admin?.components?.edit,
315
+ beforeDocumentControls: appendComponent(
316
+ existingBeforeDocumentControls,
317
+ studioBackBreadcrumbComponent,
318
+ "StudioBackBreadcrumb"
319
+ )
320
+ }
321
+ }
322
+ }
323
+ };
324
+ };
244
325
  return {
245
326
  admin: {
246
327
  css: cssPath,
@@ -249,15 +330,7 @@ function configureAdmin(config) {
249
330
  Nav: {
250
331
  exportName: "AdminStudioNav",
251
332
  path: clientPath,
252
- clientProps: {
253
- brandName,
254
- logoUrl,
255
- globalsBasePath: "/studio-globals",
256
- globalsExtraMatchPrefixes: [contactFormStudioPath],
257
- mediaCollectionSlug,
258
- pagesCollectionSlug,
259
- sections: studioSections
260
- }
333
+ clientProps: studioNavClientProps
261
334
  }
262
335
  } : {},
263
336
  graphics: {
@@ -283,37 +356,113 @@ function configureAdmin(config) {
283
356
  Component: {
284
357
  exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
285
358
  path: clientPath,
286
- clientProps: {
287
- brandName,
288
- logoUrl,
289
- globalsBasePath: "/studio-globals",
290
- globalsExtraMatchPrefixes: [contactFormStudioPath],
291
- mediaCollectionSlug,
292
- pagesCollectionSlug,
293
- sections: studioSections
294
- }
359
+ clientProps: studioNavClientProps
295
360
  }
296
361
  },
297
362
  ...studioEnabled ? {
298
363
  studioGlobals: {
299
- path: "/studio-globals",
364
+ path: globalsBasePath,
300
365
  Component: {
301
366
  exportName: "AdminStudioGlobalsView",
302
367
  path: clientPath,
303
368
  clientProps: {
369
+ ...studioNavClientProps,
304
370
  globals,
305
- globalsBasePath: "/studio-globals"
371
+ globalsBasePath
372
+ }
373
+ }
374
+ },
375
+ studioPages: {
376
+ path: pagesBasePath,
377
+ Component: {
378
+ exportName: "AdminStudioPagesListView",
379
+ path: clientPath,
380
+ clientProps: {
381
+ ...studioNavClientProps,
382
+ pagesCollectionSlug
383
+ }
384
+ }
385
+ },
386
+ studioPageEditor: {
387
+ path: `${pagesBasePath}/:id`,
388
+ Component: {
389
+ exportName: "AdminStudioPageEditView",
390
+ path: clientPath,
391
+ clientProps: {
392
+ ...studioNavClientProps,
393
+ builderBasePath
394
+ }
395
+ }
396
+ },
397
+ studioPageNew: {
398
+ path: `${pagesBasePath}/new`,
399
+ Component: {
400
+ exportName: "AdminStudioNewPageView",
401
+ path: clientPath,
402
+ clientProps: {
403
+ ...studioNavClientProps,
404
+ pagesCollectionSlug
306
405
  }
307
406
  }
308
407
  },
309
408
  studioContactForm: {
310
- path: "/studio-contact-form",
409
+ path: contactFormStudioPath,
311
410
  Component: {
312
411
  exportName: "AdminStudioContactFormView",
313
412
  path: clientPath,
314
413
  clientProps: {
414
+ ...studioNavClientProps,
315
415
  globalSlug: "contact-form",
316
- globalsBasePath: "/studio-globals"
416
+ globalsBasePath
417
+ }
418
+ }
419
+ },
420
+ ...formsEnabled ? {
421
+ studioForms: {
422
+ path: formsBasePath,
423
+ Component: {
424
+ exportName: "AdminStudioFormsView",
425
+ path: clientPath,
426
+ clientProps: {
427
+ ...studioNavClientProps,
428
+ formsCollectionSlug,
429
+ formSubmissionsCollectionSlug,
430
+ formUploadsCollectionSlug
431
+ }
432
+ }
433
+ }
434
+ } : {},
435
+ studioMedia: {
436
+ path: mediaBasePath,
437
+ Component: {
438
+ exportName: "AdminStudioMediaView",
439
+ path: clientPath,
440
+ clientProps: {
441
+ ...studioNavClientProps,
442
+ mediaCollectionSlug
443
+ }
444
+ }
445
+ },
446
+ studioMediaItem: {
447
+ path: `${mediaBasePath}/:id`,
448
+ Component: {
449
+ exportName: "AdminStudioMediaItemView",
450
+ path: clientPath,
451
+ clientProps: {
452
+ ...studioNavClientProps,
453
+ mediaCollectionSlug
454
+ }
455
+ }
456
+ },
457
+ studioTools: {
458
+ path: toolsBasePath,
459
+ Component: {
460
+ exportName: "AdminStudioToolsView",
461
+ path: clientPath,
462
+ clientProps: {
463
+ ...studioNavClientProps,
464
+ mediaCollectionSlug,
465
+ pagesCollectionSlug
317
466
  }
318
467
  }
319
468
  },
@@ -322,7 +471,13 @@ function configureAdmin(config) {
322
471
  id,
323
472
  {
324
473
  path: view.path,
325
- Component: view.Component
474
+ Component: {
475
+ ...view.Component,
476
+ clientProps: {
477
+ ...studioNavClientProps,
478
+ ...view.Component.clientProps || {}
479
+ }
480
+ }
326
481
  }
327
482
  ])
328
483
  )
@@ -333,19 +488,39 @@ function configureAdmin(config) {
333
488
  exportName: "ThemeProvider",
334
489
  path: clientPath,
335
490
  clientProps: {
491
+ allowThemePreference,
336
492
  defaultTheme
337
493
  }
338
494
  }
339
495
  ],
340
- afterNavLinks: [
496
+ beforeLogin: [
341
497
  {
342
- exportName: "ThemeSwitcher",
498
+ exportName: "AdminLoginIntro",
343
499
  path: clientPath,
344
500
  clientProps: {
345
- defaultTheme
501
+ brandName,
502
+ logoUrl
346
503
  }
347
504
  }
348
- ]
505
+ ],
506
+ afterLogin: [
507
+ {
508
+ exportName: "AdminLoginPasswordToggle",
509
+ path: clientPath
510
+ }
511
+ ],
512
+ ...allowThemePreference ? {
513
+ afterNavLinks: [
514
+ {
515
+ exportName: "ThemeSwitcher",
516
+ path: clientPath,
517
+ clientProps: {
518
+ allowThemePreference,
519
+ defaultTheme
520
+ }
521
+ }
522
+ ]
523
+ } : {}
349
524
  },
350
525
  meta: {
351
526
  titleSuffix: ` \u2014 ${brandName}`
@@ -360,10 +535,85 @@ function configureAdmin(config) {
360
535
  const hasThemePreference = existingFields.some(
361
536
  (field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
362
537
  );
363
- return {
538
+ const normalizedAuth = usersCollection.auth === true ? {
539
+ tokenExpiration: userSessionDurationSeconds,
540
+ useSessions: true
541
+ } : usersCollection.auth && typeof usersCollection.auth === "object" ? {
542
+ ...usersCollection.auth,
543
+ tokenExpiration: usersCollection.auth.tokenExpiration ?? userSessionDurationSeconds,
544
+ useSessions: usersCollection.auth.useSessions ?? true
545
+ } : usersCollection.auth;
546
+ const nextCollection = {
364
547
  ...usersCollection,
365
- fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
548
+ auth: normalizedAuth,
549
+ fields: !allowThemePreference || hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
366
550
  };
551
+ return attachStudioBackBreadcrumbToCollection(nextCollection);
552
+ },
553
+ wrapPagesCollection(pagesCollection) {
554
+ if (!studioEnabled) {
555
+ return pagesCollection;
556
+ }
557
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(pagesCollection);
558
+ const existingEditMenuItems = collectionWithBreadcrumb.admin?.components?.edit?.editMenuItems;
559
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
560
+ const existingEditViews = existingViews?.edit;
561
+ const hasCustomEditView = Boolean(
562
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
563
+ );
564
+ return {
565
+ ...collectionWithBreadcrumb,
566
+ admin: {
567
+ ...collectionWithBreadcrumb.admin,
568
+ components: {
569
+ ...collectionWithBreadcrumb.admin?.components,
570
+ edit: {
571
+ ...collectionWithBreadcrumb.admin?.components?.edit,
572
+ editMenuItems: appendComponent(
573
+ existingEditMenuItems,
574
+ {
575
+ exportName: "OpenInStudioMenuItem",
576
+ path: clientPath,
577
+ clientProps: {
578
+ pagesPathBase: pagesBasePath
579
+ }
580
+ },
581
+ "OpenInStudioMenuItem"
582
+ )
583
+ },
584
+ views: {
585
+ ...existingViews,
586
+ ...hasCustomEditView ? {} : {
587
+ edit: {
588
+ ...existingEditViews,
589
+ default: {
590
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
591
+ Component: {
592
+ exportName: "PageEditRedirectToStudio",
593
+ path: clientPath,
594
+ clientProps: {
595
+ pagesPathBase: pagesBasePath
596
+ }
597
+ }
598
+ }
599
+ }
600
+ }
601
+ }
602
+ }
603
+ }
604
+ };
605
+ },
606
+ wrapMediaCollection(mediaCollection) {
607
+ return attachStudioBackBreadcrumbToCollection(mediaCollection);
608
+ },
609
+ wrapFormsCollection(formsCollection) {
610
+ return attachStudioBackBreadcrumbToCollection(formsCollection);
611
+ },
612
+ wrapFormSubmissionsCollection(formSubmissionsCollection) {
613
+ return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
614
+ },
615
+ wrapFormUploadsCollection(formUploadsCollection) {
616
+ return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
367
617
  },
368
618
  wrapGlobals(globals2) {
369
619
  const labelMap = {
@@ -376,25 +626,110 @@ function configureAdmin(config) {
376
626
  return globals2.map((global) => {
377
627
  const mapping = labelMap[global.slug];
378
628
  if (!mapping) return global;
629
+ const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
630
+ const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
379
631
  const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
632
+ const shouldAttachHeaderEditView = studioEnabled && global.slug === "header";
633
+ const shouldAttachFooterEditView = studioEnabled && global.slug === "footer";
380
634
  const existingViews = global.admin?.components?.views;
381
635
  const existingEditViews = existingViews?.edit;
382
- const hasCustomContactFormEditView = Boolean(
636
+ const hasCustomEditView = Boolean(
383
637
  existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
384
638
  );
385
- const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
386
- ...existingEditViews,
387
- default: {
388
- ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
389
- Component: {
390
- exportName: "StudioContactFormRedirect",
391
- path: clientPath,
392
- clientProps: {
393
- studioContactFormPath: contactFormStudioPath
639
+ const nextEditViews = (() => {
640
+ if (shouldAttachSiteSettingsEditView && !hasCustomEditView) {
641
+ return {
642
+ ...existingEditViews,
643
+ default: {
644
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
645
+ Component: {
646
+ exportName: "AdminStudioSiteSettingsGlobalView",
647
+ path: clientPath,
648
+ clientProps: {
649
+ ...studioNavClientProps,
650
+ globalSlug: global.slug,
651
+ mediaCollectionSlug
652
+ }
653
+ }
394
654
  }
395
- }
655
+ };
656
+ }
657
+ if (shouldAttachSocialMediaEditView && !hasCustomEditView) {
658
+ return {
659
+ ...existingEditViews,
660
+ default: {
661
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
662
+ Component: {
663
+ exportName: "AdminStudioSocialMediaGlobalView",
664
+ path: clientPath,
665
+ clientProps: {
666
+ ...studioNavClientProps,
667
+ globalSlug: global.slug
668
+ }
669
+ }
670
+ }
671
+ };
672
+ }
673
+ if (shouldAttachHeaderEditView && !hasCustomEditView) {
674
+ return {
675
+ ...existingEditViews,
676
+ default: {
677
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
678
+ Component: {
679
+ exportName: "AdminStudioHeaderGlobalView",
680
+ path: clientPath,
681
+ clientProps: {
682
+ ...studioNavClientProps,
683
+ actionHref: sitePreview?.header?.actionHref,
684
+ actionLabel: sitePreview?.header?.actionLabel,
685
+ globalSlug: global.slug,
686
+ locationSummary: sitePreview?.locationSummary,
687
+ pagesCollectionSlug
688
+ }
689
+ }
690
+ }
691
+ };
692
+ }
693
+ if (shouldAttachFooterEditView && !hasCustomEditView) {
694
+ return {
695
+ ...existingEditViews,
696
+ default: {
697
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
698
+ Component: {
699
+ exportName: "AdminStudioFooterGlobalView",
700
+ path: clientPath,
701
+ clientProps: {
702
+ ...studioNavClientProps,
703
+ builtByHref: sitePreview?.footer?.builtByHref,
704
+ builtByLabel: sitePreview?.footer?.builtByLabel,
705
+ description: sitePreview?.footer?.description,
706
+ footerCategories: sitePreview?.footer?.footerCategories,
707
+ footerLinks: sitePreview?.footer?.footerLinks,
708
+ globalSlug: global.slug,
709
+ locationSummary: sitePreview?.locationSummary
710
+ }
711
+ }
712
+ }
713
+ };
714
+ }
715
+ if (shouldAttachContactFormRedirect && !hasCustomEditView) {
716
+ return {
717
+ ...existingEditViews,
718
+ default: {
719
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
720
+ Component: {
721
+ exportName: "StudioContactFormRedirect",
722
+ path: clientPath,
723
+ clientProps: {
724
+ studioContactFormPath: contactFormStudioPath
725
+ }
726
+ }
727
+ }
728
+ };
396
729
  }
397
- } : existingEditViews;
730
+ return existingEditViews;
731
+ })();
732
+ const existingBeforeDocumentControls = global.admin?.components?.elements?.beforeDocumentControls;
398
733
  return {
399
734
  ...global,
400
735
  admin: {
@@ -402,12 +737,18 @@ function configureAdmin(config) {
402
737
  group: mapping.group,
403
738
  components: {
404
739
  ...global.admin?.components,
405
- ...shouldAttachContactFormRedirect ? {
740
+ elements: {
741
+ ...global.admin?.components?.elements,
742
+ beforeDocumentControls: studioEnabled ? appendComponent(
743
+ existingBeforeDocumentControls,
744
+ studioBackBreadcrumbComponent,
745
+ "StudioBackBreadcrumb"
746
+ ) : existingBeforeDocumentControls
747
+ },
748
+ ...nextEditViews ? {
406
749
  views: {
407
750
  ...existingViews,
408
- ...contactFormEditViews ? {
409
- edit: contactFormEditViews
410
- } : {}
751
+ edit: nextEditViews
411
752
  }
412
753
  } : {}
413
754
  }
@@ -7,7 +7,8 @@ import {
7
7
  socialMediaConnectionsField,
8
8
  themePreferenceField,
9
9
  withTooltips
10
- } from "../chunk-74XFAVXU.mjs";
10
+ } from "../chunk-WLOPFFN2.mjs";
11
+ import "../chunk-W2UOCJDX.mjs";
11
12
  import {
12
13
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
13
14
  SOCIAL_MEDIA_ICON_OPTIONS,
@@ -5,3 +5,4 @@ export { MediaDetailPanel } from './components/MediaDetailPanel'
5
5
  export { MediaListItem } from './components/MediaListItem'
6
6
  export { MediaUploadForm } from './components/MediaUploadForm'
7
7
  export { PageEditorFrame } from './components/PageEditorFrame'
8
+ export { SiteFooterPreview, SiteHeaderPreview } from './components/SitePreview'
@@ -5,3 +5,4 @@ export { MediaDetailPanel } from './components/MediaDetailPanel'
5
5
  export { MediaListItem } from './components/MediaListItem'
6
6
  export { MediaUploadForm } from './components/MediaUploadForm'
7
7
  export { PageEditorFrame } from './components/PageEditorFrame'
8
+ export { SiteFooterPreview, SiteHeaderPreview } from './components/SitePreview'