@orion-studios/payload-studio 0.5.0-beta.113 → 0.5.0-beta.114

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 (42) hide show
  1. package/dist/admin/client.js +1915 -490
  2. package/dist/admin/client.mjs +1327 -445
  3. package/dist/admin/index.d.mts +2 -1
  4. package/dist/admin/index.d.ts +2 -1
  5. package/dist/admin/index.js +253 -50
  6. package/dist/admin/index.mjs +1 -1
  7. package/dist/admin-app/client.d.mts +1 -0
  8. package/dist/admin-app/client.d.ts +1 -0
  9. package/dist/admin-app/client.js +266 -105
  10. package/dist/admin-app/client.mjs +105 -456
  11. package/dist/admin-app/index.d.mts +2 -1
  12. package/dist/admin-app/index.d.ts +2 -1
  13. package/dist/admin-app/styles.css +351 -0
  14. package/dist/admin.css +9 -0
  15. package/dist/{chunk-DAIZDGHL.mjs → chunk-4YPHQYRR.mjs} +253 -50
  16. package/dist/chunk-6NE7GIVT.mjs +555 -0
  17. package/dist/{chunk-3T2P6SDM.mjs → chunk-XKUTZ7IU.mjs} +215 -6
  18. package/dist/{index-DUi_XND6.d.ts → index-Crx_MtPw.d.ts} +33 -3
  19. package/dist/{index-gLl_358v.d.mts → index-Cv-6qnrw.d.mts} +33 -3
  20. package/dist/index-D5yjivF7.d.ts +382 -0
  21. package/dist/index-DH9KGEZ8.d.mts +382 -0
  22. package/dist/{index-BzKOThsI.d.mts → index-DWmudwDm.d.mts} +1 -1
  23. package/dist/{index-BzKOThsI.d.ts → index-DWmudwDm.d.ts} +1 -1
  24. package/dist/{index-7lxTrxSG.d.mts → index-c5-qTRbH.d.mts} +7 -1
  25. package/dist/{index-7lxTrxSG.d.ts → index-yfpxsgUu.d.ts} +7 -1
  26. package/dist/index.d.mts +5 -4
  27. package/dist/index.d.ts +5 -4
  28. package/dist/index.js +459 -56
  29. package/dist/index.mjs +9 -9
  30. package/dist/nextjs/index.mjs +2 -2
  31. package/dist/sitePreviewTypes-BECnq9xI.d.mts +41 -0
  32. package/dist/sitePreviewTypes-BECnq9xI.d.ts +41 -0
  33. package/dist/studio/index.d.mts +1 -1
  34. package/dist/studio/index.d.ts +1 -1
  35. package/dist/studio-pages/index.d.mts +3 -3
  36. package/dist/studio-pages/index.d.ts +3 -3
  37. package/dist/studio-pages/index.js +330 -7
  38. package/dist/studio-pages/index.mjs +10 -3
  39. package/package.json +1 -1
  40. package/dist/index-B7QvY3yF.d.mts +0 -245
  41. package/dist/index-BK03FiEM.d.ts +0 -245
  42. package/dist/{chunk-BET2YLAS.mjs → chunk-OTHERBGX.mjs} +3 -3
@@ -188,13 +188,19 @@ function configureAdmin(config) {
188
188
  const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
189
189
  const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
190
190
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
191
+ const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
191
192
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
192
- const contactFormStudioPath = "/studio-contact-form";
193
+ const globalsBasePath = "/globals";
194
+ const pagesBasePath = "/pages";
195
+ const formsBasePath = "/forms";
196
+ const mediaBasePath = "/media";
197
+ const toolsBasePath = "/tools";
198
+ const contactFormStudioPath = "/contact-form";
193
199
  const configuredGlobals = config.studio?.globals || [
194
200
  { slug: "site-settings", label: "Website Settings" },
195
201
  { slug: "header", label: "Header & Navigation" },
196
202
  { slug: "footer", label: "Footer" },
197
- { slug: "contact-form", label: "Contact Form" }
203
+ { slug: "social-media", label: "Social Media" }
198
204
  ];
199
205
  const globals = configuredGlobals.map((global) => {
200
206
  if (global.slug !== "contact-form" || global.href) {
@@ -207,6 +213,7 @@ function configureAdmin(config) {
207
213
  });
208
214
  const studioSections = resolveStudioSections(config.studio?.sections || []);
209
215
  const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
216
+ const sitePreview = config.studio?.sitePreview;
210
217
  let cssPath;
211
218
  const pkgDist = getPkgDistDir();
212
219
  const sourceCssPath = path.resolve(pkgDist, "admin.css");
@@ -225,6 +232,50 @@ function configureAdmin(config) {
225
232
  cssPath = sourceCssPath;
226
233
  }
227
234
  const clientPath = "@orion-studios/payload-studio/admin/client";
235
+ const studioNavClientProps = {
236
+ brandName,
237
+ formSubmissionsCollectionSlug,
238
+ formsCollectionSlug,
239
+ formsEnabled,
240
+ formUploadsCollectionSlug,
241
+ globalsBasePath,
242
+ globalsExtraMatchPrefixes: [contactFormStudioPath],
243
+ logoUrl,
244
+ mediaCollectionSlug,
245
+ pagesCollectionSlug,
246
+ sections: studioSections
247
+ };
248
+ const studioBackBreadcrumbComponent = {
249
+ exportName: "StudioBackBreadcrumb",
250
+ path: clientPath
251
+ };
252
+ const hasMatchingComponent = (items, exportName) => Array.isArray(items) && items.some(
253
+ (item) => item && typeof item === "object" && item.exportName === exportName && item.path === clientPath
254
+ );
255
+ const appendComponent = (items, component, exportName) => hasMatchingComponent(items, exportName) ? items || [] : [...items || [], component];
256
+ const attachStudioBackBreadcrumbToCollection = (collection) => {
257
+ if (!studioEnabled) {
258
+ return collection;
259
+ }
260
+ const existingBeforeDocumentControls = collection.admin?.components?.edit?.beforeDocumentControls;
261
+ return {
262
+ ...collection,
263
+ admin: {
264
+ ...collection.admin,
265
+ components: {
266
+ ...collection.admin?.components,
267
+ edit: {
268
+ ...collection.admin?.components?.edit,
269
+ beforeDocumentControls: appendComponent(
270
+ existingBeforeDocumentControls,
271
+ studioBackBreadcrumbComponent,
272
+ "StudioBackBreadcrumb"
273
+ )
274
+ }
275
+ }
276
+ }
277
+ };
278
+ };
228
279
  return {
229
280
  admin: {
230
281
  css: cssPath,
@@ -233,19 +284,7 @@ function configureAdmin(config) {
233
284
  Nav: {
234
285
  exportName: "AdminStudioNav",
235
286
  path: clientPath,
236
- clientProps: {
237
- brandName,
238
- logoUrl,
239
- globalsBasePath: "/studio-globals",
240
- globalsExtraMatchPrefixes: [contactFormStudioPath],
241
- formSubmissionsCollectionSlug,
242
- formsCollectionSlug,
243
- formsEnabled,
244
- formUploadsCollectionSlug,
245
- mediaCollectionSlug,
246
- pagesCollectionSlug,
247
- sections: studioSections
248
- }
287
+ clientProps: studioNavClientProps
249
288
  }
250
289
  } : {},
251
290
  graphics: {
@@ -271,51 +310,64 @@ function configureAdmin(config) {
271
310
  Component: {
272
311
  exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
273
312
  path: clientPath,
274
- clientProps: {
275
- brandName,
276
- logoUrl,
277
- globalsBasePath: "/studio-globals",
278
- globalsExtraMatchPrefixes: [contactFormStudioPath],
279
- formSubmissionsCollectionSlug,
280
- formsCollectionSlug,
281
- formsEnabled,
282
- formUploadsCollectionSlug,
283
- mediaCollectionSlug,
284
- pagesCollectionSlug,
285
- sections: studioSections
286
- }
313
+ clientProps: studioNavClientProps
287
314
  }
288
315
  },
289
316
  ...studioEnabled ? {
290
317
  studioGlobals: {
291
- path: "/studio-globals",
318
+ path: globalsBasePath,
292
319
  Component: {
293
320
  exportName: "AdminStudioGlobalsView",
294
321
  path: clientPath,
295
322
  clientProps: {
323
+ ...studioNavClientProps,
296
324
  globals,
297
- globalsBasePath: "/studio-globals"
325
+ globalsBasePath
326
+ }
327
+ }
328
+ },
329
+ studioPages: {
330
+ path: pagesBasePath,
331
+ Component: {
332
+ exportName: "AdminStudioPagesListView",
333
+ path: clientPath,
334
+ clientProps: {
335
+ ...studioNavClientProps,
336
+ pagesCollectionSlug
337
+ }
338
+ }
339
+ },
340
+ studioPageEditor: {
341
+ path: `${pagesBasePath}/:id`,
342
+ Component: {
343
+ exportName: "AdminStudioPageEditView",
344
+ path: clientPath,
345
+ clientProps: {
346
+ ...studioNavClientProps,
347
+ builderBasePath
298
348
  }
299
349
  }
300
350
  },
301
351
  studioContactForm: {
302
- path: "/studio-contact-form",
352
+ path: contactFormStudioPath,
303
353
  Component: {
304
354
  exportName: "AdminStudioContactFormView",
305
355
  path: clientPath,
306
356
  clientProps: {
357
+ ...studioNavClientProps,
307
358
  globalSlug: "contact-form",
308
- globalsBasePath: "/studio-globals"
359
+ globalsBasePath
309
360
  }
310
361
  }
311
362
  },
312
363
  ...formsEnabled ? {
313
364
  studioForms: {
314
- path: "/studio-forms",
365
+ path: formsBasePath,
315
366
  Component: {
316
367
  exportName: "AdminStudioFormsView",
317
368
  path: clientPath,
318
369
  clientProps: {
370
+ ...studioNavClientProps,
319
371
  formsCollectionSlug,
320
372
  formSubmissionsCollectionSlug,
321
373
  formUploadsCollectionSlug
@@ -323,12 +375,41 @@ function configureAdmin(config) {
323
375
  }
324
376
  }
325
377
  } : {},
378
+ studioMedia: {
379
+ path: mediaBasePath,
380
+ Component: {
381
+ exportName: "AdminStudioMediaView",
382
+ path: clientPath,
383
+ clientProps: {
384
+ ...studioNavClientProps,
385
+ mediaCollectionSlug
386
+ }
387
+ }
388
+ },
389
+ studioTools: {
390
+ path: toolsBasePath,
391
+ Component: {
392
+ exportName: "AdminStudioToolsView",
393
+ path: clientPath,
394
+ clientProps: {
395
+ ...studioNavClientProps,
396
+ mediaCollectionSlug,
397
+ pagesCollectionSlug
398
+ }
399
+ }
400
+ },
326
401
  ...Object.fromEntries(
327
402
  Object.entries(studioSectionViews).map(([id, view]) => [
328
403
  id,
329
404
  {
330
405
  path: view.path,
331
- Component: view.Component
406
+ Component: {
407
+ ...view.Component,
408
+ clientProps: {
409
+ ...studioNavClientProps,
410
+ ...view.Component.clientProps || {}
411
+ }
412
+ }
332
413
  }
333
414
  ])
334
415
  )
@@ -366,10 +447,76 @@ function configureAdmin(config) {
366
447
  const hasThemePreference = existingFields.some(
367
448
  (field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
368
449
  );
369
- return {
450
+ const nextCollection = {
370
451
  ...usersCollection,
371
452
  fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
372
453
  };
454
+ return attachStudioBackBreadcrumbToCollection(nextCollection);
455
+ },
456
+ wrapPagesCollection(pagesCollection) {
457
+ if (!studioEnabled) {
458
+ return pagesCollection;
459
+ }
460
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(pagesCollection);
461
+ const existingEditMenuItems = collectionWithBreadcrumb.admin?.components?.edit?.editMenuItems;
462
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
463
+ const existingEditViews = existingViews?.edit;
464
+ const hasCustomEditView = Boolean(
465
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
466
+ );
467
+ return {
468
+ ...collectionWithBreadcrumb,
469
+ admin: {
470
+ ...collectionWithBreadcrumb.admin,
471
+ components: {
472
+ ...collectionWithBreadcrumb.admin?.components,
473
+ edit: {
474
+ ...collectionWithBreadcrumb.admin?.components?.edit,
475
+ editMenuItems: appendComponent(
476
+ existingEditMenuItems,
477
+ {
478
+ exportName: "OpenInStudioMenuItem",
479
+ path: clientPath,
480
+ clientProps: {
481
+ pagesPathBase: pagesBasePath
482
+ }
483
+ },
484
+ "OpenInStudioMenuItem"
485
+ )
486
+ },
487
+ views: {
488
+ ...existingViews,
489
+ ...hasCustomEditView ? {} : {
490
+ edit: {
491
+ ...existingEditViews,
492
+ default: {
493
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
494
+ Component: {
495
+ exportName: "PageEditRedirectToStudio",
496
+ path: clientPath,
497
+ clientProps: {
498
+ pagesPathBase: pagesBasePath
499
+ }
500
+ }
501
+ }
502
+ }
503
+ }
504
+ }
505
+ }
506
+ }
507
+ };
508
+ },
509
+ wrapMediaCollection(mediaCollection) {
510
+ return attachStudioBackBreadcrumbToCollection(mediaCollection);
511
+ },
512
+ wrapFormsCollection(formsCollection) {
513
+ return attachStudioBackBreadcrumbToCollection(formsCollection);
514
+ },
515
+ wrapFormSubmissionsCollection(formSubmissionsCollection) {
516
+ return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
517
+ },
518
+ wrapFormUploadsCollection(formUploadsCollection) {
519
+ return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
373
520
  },
374
521
  wrapGlobals(globals2) {
375
522
  const labelMap = {
@@ -383,24 +530,74 @@ function configureAdmin(config) {
383
530
  const mapping = labelMap[global.slug];
384
531
  if (!mapping) return global;
385
532
  const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
533
+ const shouldAttachHeaderEditView = studioEnabled && global.slug === "header";
534
+ const shouldAttachFooterEditView = studioEnabled && global.slug === "footer";
386
535
  const existingViews = global.admin?.components?.views;
387
536
  const existingEditViews = existingViews?.edit;
388
537
  const hasCustomContactFormEditView = Boolean(
389
538
  existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
390
539
  );
391
- const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
392
- ...existingEditViews,
393
- default: {
394
- ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
395
- Component: {
396
- exportName: "StudioContactFormRedirect",
397
- path: clientPath,
398
- clientProps: {
399
- studioContactFormPath: contactFormStudioPath
540
+ const nextEditViews = (() => {
541
+ if (shouldAttachHeaderEditView && !hasCustomContactFormEditView) {
542
+ return {
543
+ ...existingEditViews,
544
+ default: {
545
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
546
+ Component: {
547
+ exportName: "AdminStudioHeaderGlobalView",
548
+ path: clientPath,
549
+ clientProps: {
550
+ ...studioNavClientProps,
551
+ actionHref: sitePreview?.header?.actionHref,
552
+ actionLabel: sitePreview?.header?.actionLabel,
553
+ globalSlug: global.slug,
554
+ locationSummary: sitePreview?.locationSummary,
555
+ pagesCollectionSlug
556
+ }
557
+ }
400
558
  }
401
- }
559
+ };
560
+ }
561
+ if (shouldAttachFooterEditView && !hasCustomContactFormEditView) {
562
+ return {
563
+ ...existingEditViews,
564
+ default: {
565
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
566
+ Component: {
567
+ exportName: "AdminStudioFooterGlobalView",
568
+ path: clientPath,
569
+ clientProps: {
570
+ ...studioNavClientProps,
571
+ builtByHref: sitePreview?.footer?.builtByHref,
572
+ builtByLabel: sitePreview?.footer?.builtByLabel,
573
+ description: sitePreview?.footer?.description,
574
+ footerCategories: sitePreview?.footer?.footerCategories,
575
+ footerLinks: sitePreview?.footer?.footerLinks,
576
+ globalSlug: global.slug,
577
+ locationSummary: sitePreview?.locationSummary
578
+ }
579
+ }
580
+ }
581
+ };
582
+ }
583
+ if (shouldAttachContactFormRedirect && !hasCustomContactFormEditView) {
584
+ return {
585
+ ...existingEditViews,
586
+ default: {
587
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
588
+ Component: {
589
+ exportName: "StudioContactFormRedirect",
590
+ path: clientPath,
591
+ clientProps: {
592
+ studioContactFormPath: contactFormStudioPath
593
+ }
594
+ }
595
+ }
596
+ };
402
597
  }
403
- } : existingEditViews;
598
+ return existingEditViews;
599
+ })();
600
+ const existingBeforeDocumentControls = global.admin?.components?.elements?.beforeDocumentControls;
404
601
  return {
405
602
  ...global,
406
603
  admin: {
@@ -408,12 +605,18 @@ function configureAdmin(config) {
408
605
  group: mapping.group,
409
606
  components: {
410
607
  ...global.admin?.components,
411
- ...shouldAttachContactFormRedirect ? {
608
+ elements: {
609
+ ...global.admin?.components?.elements,
610
+ beforeDocumentControls: studioEnabled ? appendComponent(
611
+ existingBeforeDocumentControls,
612
+ studioBackBreadcrumbComponent,
613
+ "StudioBackBreadcrumb"
614
+ ) : existingBeforeDocumentControls
615
+ },
616
+ ...nextEditViews ? {
412
617
  views: {
413
618
  ...existingViews,
414
- ...contactFormEditViews ? {
415
- edit: contactFormEditViews
416
- } : {}
619
+ edit: nextEditViews
417
620
  }
418
621
  } : {}
419
622
  }