@orion-studios/payload-studio 0.6.0-beta.16 → 0.6.0-beta.18

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.
@@ -323,6 +323,49 @@ function configureAdmin(config) {
323
323
  }
324
324
  };
325
325
  };
326
+ const attachStudioEditRedirectToCollection = (collection, options) => {
327
+ if (!studioEnabled) {
328
+ return collection;
329
+ }
330
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(collection);
331
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
332
+ const existingEditViews = existingViews?.edit;
333
+ const hasCustomEditView = Boolean(
334
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
335
+ );
336
+ if (hasCustomEditView) {
337
+ return collectionWithBreadcrumb;
338
+ }
339
+ return {
340
+ ...collectionWithBreadcrumb,
341
+ admin: {
342
+ ...collectionWithBreadcrumb.admin,
343
+ components: {
344
+ ...collectionWithBreadcrumb.admin?.components,
345
+ views: {
346
+ ...existingViews,
347
+ edit: {
348
+ ...existingEditViews,
349
+ default: {
350
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
351
+ Component: {
352
+ exportName: "StudioDocumentRedirect",
353
+ path: clientPath,
354
+ clientProps: {
355
+ description: options.description,
356
+ ...options.emptyHref ? { emptyHref: options.emptyHref } : {},
357
+ ...options.emptyLabel ? { emptyLabel: options.emptyLabel } : {},
358
+ pathBase: options.pathBase,
359
+ title: options.title
360
+ }
361
+ }
362
+ }
363
+ }
364
+ }
365
+ }
366
+ }
367
+ };
368
+ };
326
369
  return {
327
370
  admin: {
328
371
  css: cssPath,
@@ -433,6 +476,42 @@ function configureAdmin(config) {
433
476
  formUploadsCollectionSlug
434
477
  }
435
478
  }
479
+ },
480
+ studioFormSubmission: {
481
+ path: `${formsBasePath}/submissions/:id`,
482
+ Component: {
483
+ exportName: "AdminStudioFormSubmissionView",
484
+ path: clientPath,
485
+ clientProps: {
486
+ ...studioNavClientProps,
487
+ formsCollectionSlug,
488
+ formSubmissionsCollectionSlug,
489
+ formUploadsCollectionSlug
490
+ }
491
+ }
492
+ },
493
+ studioFormUpload: {
494
+ path: `${formsBasePath}/uploads/:id`,
495
+ Component: {
496
+ exportName: "AdminStudioFormUploadView",
497
+ path: clientPath,
498
+ clientProps: {
499
+ ...studioNavClientProps,
500
+ formUploadsCollectionSlug
501
+ }
502
+ }
503
+ },
504
+ studioFormDetail: {
505
+ path: `${formsBasePath}/:id`,
506
+ Component: {
507
+ exportName: "AdminStudioFormDetailView",
508
+ path: clientPath,
509
+ clientProps: {
510
+ ...studioNavClientProps,
511
+ formsCollectionSlug,
512
+ formSubmissionsCollectionSlug
513
+ }
514
+ }
436
515
  }
437
516
  } : {},
438
517
  studioMedia: {
@@ -611,13 +690,31 @@ function configureAdmin(config) {
611
690
  return attachStudioBackBreadcrumbToCollection(mediaCollection);
612
691
  },
613
692
  wrapFormsCollection(formsCollection) {
614
- return attachStudioBackBreadcrumbToCollection(formsCollection);
693
+ return attachStudioEditRedirectToCollection(formsCollection, {
694
+ description: "Redirecting to the Studio form workspace.",
695
+ emptyHref: formsBasePath,
696
+ emptyLabel: "Open Forms",
697
+ pathBase: formsBasePath,
698
+ title: "Opening Form..."
699
+ });
615
700
  },
616
701
  wrapFormSubmissionsCollection(formSubmissionsCollection) {
617
- return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
702
+ return attachStudioEditRedirectToCollection(formSubmissionsCollection, {
703
+ description: "Redirecting to the Studio submission workspace.",
704
+ emptyHref: formsBasePath,
705
+ emptyLabel: "Open Forms",
706
+ pathBase: `${formsBasePath}/submissions`,
707
+ title: "Opening Submission..."
708
+ });
618
709
  },
619
710
  wrapFormUploadsCollection(formUploadsCollection) {
620
- return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
711
+ return attachStudioEditRedirectToCollection(formUploadsCollection, {
712
+ description: "Redirecting to the Studio upload workspace.",
713
+ emptyHref: formsBasePath,
714
+ emptyLabel: "Open Forms",
715
+ pathBase: `${formsBasePath}/uploads`,
716
+ title: "Opening Upload..."
717
+ });
621
718
  },
622
719
  wrapGlobals(globals2) {
623
720
  const labelMap = {
@@ -7,7 +7,7 @@ import {
7
7
  socialMediaConnectionsField,
8
8
  themePreferenceField,
9
9
  withTooltips
10
- } from "../chunk-XZQILJK3.mjs";
10
+ } from "../chunk-3AHBR7RI.mjs";
11
11
  import "../chunk-W2UOCJDX.mjs";
12
12
  import {
13
13
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
@@ -294,6 +294,49 @@ function configureAdmin(config) {
294
294
  }
295
295
  };
296
296
  };
297
+ const attachStudioEditRedirectToCollection = (collection, options) => {
298
+ if (!studioEnabled) {
299
+ return collection;
300
+ }
301
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(collection);
302
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
303
+ const existingEditViews = existingViews?.edit;
304
+ const hasCustomEditView = Boolean(
305
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
306
+ );
307
+ if (hasCustomEditView) {
308
+ return collectionWithBreadcrumb;
309
+ }
310
+ return {
311
+ ...collectionWithBreadcrumb,
312
+ admin: {
313
+ ...collectionWithBreadcrumb.admin,
314
+ components: {
315
+ ...collectionWithBreadcrumb.admin?.components,
316
+ views: {
317
+ ...existingViews,
318
+ edit: {
319
+ ...existingEditViews,
320
+ default: {
321
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
322
+ Component: {
323
+ exportName: "StudioDocumentRedirect",
324
+ path: clientPath,
325
+ clientProps: {
326
+ description: options.description,
327
+ ...options.emptyHref ? { emptyHref: options.emptyHref } : {},
328
+ ...options.emptyLabel ? { emptyLabel: options.emptyLabel } : {},
329
+ pathBase: options.pathBase,
330
+ title: options.title
331
+ }
332
+ }
333
+ }
334
+ }
335
+ }
336
+ }
337
+ }
338
+ };
339
+ };
297
340
  return {
298
341
  admin: {
299
342
  css: cssPath,
@@ -404,6 +447,42 @@ function configureAdmin(config) {
404
447
  formUploadsCollectionSlug
405
448
  }
406
449
  }
450
+ },
451
+ studioFormSubmission: {
452
+ path: `${formsBasePath}/submissions/:id`,
453
+ Component: {
454
+ exportName: "AdminStudioFormSubmissionView",
455
+ path: clientPath,
456
+ clientProps: {
457
+ ...studioNavClientProps,
458
+ formsCollectionSlug,
459
+ formSubmissionsCollectionSlug,
460
+ formUploadsCollectionSlug
461
+ }
462
+ }
463
+ },
464
+ studioFormUpload: {
465
+ path: `${formsBasePath}/uploads/:id`,
466
+ Component: {
467
+ exportName: "AdminStudioFormUploadView",
468
+ path: clientPath,
469
+ clientProps: {
470
+ ...studioNavClientProps,
471
+ formUploadsCollectionSlug
472
+ }
473
+ }
474
+ },
475
+ studioFormDetail: {
476
+ path: `${formsBasePath}/:id`,
477
+ Component: {
478
+ exportName: "AdminStudioFormDetailView",
479
+ path: clientPath,
480
+ clientProps: {
481
+ ...studioNavClientProps,
482
+ formsCollectionSlug,
483
+ formSubmissionsCollectionSlug
484
+ }
485
+ }
407
486
  }
408
487
  } : {},
409
488
  studioMedia: {
@@ -582,13 +661,31 @@ function configureAdmin(config) {
582
661
  return attachStudioBackBreadcrumbToCollection(mediaCollection);
583
662
  },
584
663
  wrapFormsCollection(formsCollection) {
585
- return attachStudioBackBreadcrumbToCollection(formsCollection);
664
+ return attachStudioEditRedirectToCollection(formsCollection, {
665
+ description: "Redirecting to the Studio form workspace.",
666
+ emptyHref: formsBasePath,
667
+ emptyLabel: "Open Forms",
668
+ pathBase: formsBasePath,
669
+ title: "Opening Form..."
670
+ });
586
671
  },
587
672
  wrapFormSubmissionsCollection(formSubmissionsCollection) {
588
- return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
673
+ return attachStudioEditRedirectToCollection(formSubmissionsCollection, {
674
+ description: "Redirecting to the Studio submission workspace.",
675
+ emptyHref: formsBasePath,
676
+ emptyLabel: "Open Forms",
677
+ pathBase: `${formsBasePath}/submissions`,
678
+ title: "Opening Submission..."
679
+ });
589
680
  },
590
681
  wrapFormUploadsCollection(formUploadsCollection) {
591
- return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
682
+ return attachStudioEditRedirectToCollection(formUploadsCollection, {
683
+ description: "Redirecting to the Studio upload workspace.",
684
+ emptyHref: formsBasePath,
685
+ emptyLabel: "Open Forms",
686
+ pathBase: `${formsBasePath}/uploads`,
687
+ title: "Opening Upload..."
688
+ });
592
689
  },
593
690
  wrapGlobals(globals2) {
594
691
  const labelMap = {
package/dist/index.js CHANGED
@@ -349,6 +349,49 @@ function configureAdmin(config) {
349
349
  }
350
350
  };
351
351
  };
352
+ const attachStudioEditRedirectToCollection = (collection, options) => {
353
+ if (!studioEnabled) {
354
+ return collection;
355
+ }
356
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(collection);
357
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
358
+ const existingEditViews = existingViews?.edit;
359
+ const hasCustomEditView = Boolean(
360
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
361
+ );
362
+ if (hasCustomEditView) {
363
+ return collectionWithBreadcrumb;
364
+ }
365
+ return {
366
+ ...collectionWithBreadcrumb,
367
+ admin: {
368
+ ...collectionWithBreadcrumb.admin,
369
+ components: {
370
+ ...collectionWithBreadcrumb.admin?.components,
371
+ views: {
372
+ ...existingViews,
373
+ edit: {
374
+ ...existingEditViews,
375
+ default: {
376
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
377
+ Component: {
378
+ exportName: "StudioDocumentRedirect",
379
+ path: clientPath,
380
+ clientProps: {
381
+ description: options.description,
382
+ ...options.emptyHref ? { emptyHref: options.emptyHref } : {},
383
+ ...options.emptyLabel ? { emptyLabel: options.emptyLabel } : {},
384
+ pathBase: options.pathBase,
385
+ title: options.title
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+ }
392
+ }
393
+ };
394
+ };
352
395
  return {
353
396
  admin: {
354
397
  css: cssPath,
@@ -459,6 +502,42 @@ function configureAdmin(config) {
459
502
  formUploadsCollectionSlug
460
503
  }
461
504
  }
505
+ },
506
+ studioFormSubmission: {
507
+ path: `${formsBasePath}/submissions/:id`,
508
+ Component: {
509
+ exportName: "AdminStudioFormSubmissionView",
510
+ path: clientPath,
511
+ clientProps: {
512
+ ...studioNavClientProps,
513
+ formsCollectionSlug,
514
+ formSubmissionsCollectionSlug,
515
+ formUploadsCollectionSlug
516
+ }
517
+ }
518
+ },
519
+ studioFormUpload: {
520
+ path: `${formsBasePath}/uploads/:id`,
521
+ Component: {
522
+ exportName: "AdminStudioFormUploadView",
523
+ path: clientPath,
524
+ clientProps: {
525
+ ...studioNavClientProps,
526
+ formUploadsCollectionSlug
527
+ }
528
+ }
529
+ },
530
+ studioFormDetail: {
531
+ path: `${formsBasePath}/:id`,
532
+ Component: {
533
+ exportName: "AdminStudioFormDetailView",
534
+ path: clientPath,
535
+ clientProps: {
536
+ ...studioNavClientProps,
537
+ formsCollectionSlug,
538
+ formSubmissionsCollectionSlug
539
+ }
540
+ }
462
541
  }
463
542
  } : {},
464
543
  studioMedia: {
@@ -637,13 +716,31 @@ function configureAdmin(config) {
637
716
  return attachStudioBackBreadcrumbToCollection(mediaCollection);
638
717
  },
639
718
  wrapFormsCollection(formsCollection) {
640
- return attachStudioBackBreadcrumbToCollection(formsCollection);
719
+ return attachStudioEditRedirectToCollection(formsCollection, {
720
+ description: "Redirecting to the Studio form workspace.",
721
+ emptyHref: formsBasePath,
722
+ emptyLabel: "Open Forms",
723
+ pathBase: formsBasePath,
724
+ title: "Opening Form..."
725
+ });
641
726
  },
642
727
  wrapFormSubmissionsCollection(formSubmissionsCollection) {
643
- return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
728
+ return attachStudioEditRedirectToCollection(formSubmissionsCollection, {
729
+ description: "Redirecting to the Studio submission workspace.",
730
+ emptyHref: formsBasePath,
731
+ emptyLabel: "Open Forms",
732
+ pathBase: `${formsBasePath}/submissions`,
733
+ title: "Opening Submission..."
734
+ });
644
735
  },
645
736
  wrapFormUploadsCollection(formUploadsCollection) {
646
- return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
737
+ return attachStudioEditRedirectToCollection(formUploadsCollection, {
738
+ description: "Redirecting to the Studio upload workspace.",
739
+ emptyHref: formsBasePath,
740
+ emptyLabel: "Open Forms",
741
+ pathBase: `${formsBasePath}/uploads`,
742
+ title: "Opening Upload..."
743
+ });
647
744
  },
648
745
  wrapGlobals(globals2) {
649
746
  const labelMap = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  admin_exports
3
- } from "./chunk-XZQILJK3.mjs";
3
+ } from "./chunk-3AHBR7RI.mjs";
4
4
  import {
5
5
  admin_app_exports
6
6
  } from "./chunk-RKTIFEUY.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.16",
3
+ "version": "0.6.0-beta.18",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",