@orion-studios/payload-studio 0.5.0-beta.4 → 0.5.0-beta.41

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 (46) hide show
  1. package/dist/admin/client.js +68 -7
  2. package/dist/admin/client.mjs +68 -7
  3. package/dist/admin/index.d.mts +1 -1
  4. package/dist/admin/index.d.ts +1 -1
  5. package/dist/admin/index.js +37 -0
  6. package/dist/admin/index.mjs +3 -1
  7. package/dist/admin-app/client.d.mts +4 -0
  8. package/dist/admin-app/client.d.ts +4 -0
  9. package/dist/admin-app/client.js +705 -2
  10. package/dist/admin-app/client.mjs +701 -1
  11. package/dist/admin-app/index.d.mts +1 -1
  12. package/dist/admin-app/index.d.ts +1 -1
  13. package/dist/admin-app/index.js +167 -0
  14. package/dist/admin-app/index.mjs +13 -1
  15. package/dist/admin-app/styles.css +127 -0
  16. package/dist/blocks/index.js +457 -5
  17. package/dist/blocks/index.mjs +2 -2
  18. package/dist/{chunk-J7W5EE3B.mjs → chunk-7IGLXLUB.mjs} +37 -0
  19. package/dist/{chunk-ZLLNO5FM.mjs → chunk-GNYOAC5N.mjs} +44 -13
  20. package/dist/{chunk-UJFU323N.mjs → chunk-LB72FZZ3.mjs} +33 -9
  21. package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
  22. package/dist/{chunk-PC5622T7.mjs → chunk-XQYJXB46.mjs} +444 -6
  23. package/dist/chunk-XVH5SCBD.mjs +234 -0
  24. package/dist/index-BBvk9b9i.d.mts +97 -0
  25. package/dist/index-BBvk9b9i.d.ts +97 -0
  26. package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.mts} +1 -0
  27. package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.ts} +1 -0
  28. package/dist/{index-DJFhANvJ.d.ts → index-Dj21uD_B.d.mts} +5 -2
  29. package/dist/{index-DJFhANvJ.d.mts → index-Dj21uD_B.d.ts} +5 -2
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +904 -204
  33. package/dist/index.mjs +12 -12
  34. package/dist/nextjs/index.d.mts +1 -1
  35. package/dist/nextjs/index.d.ts +1 -1
  36. package/dist/nextjs/index.js +290 -13
  37. package/dist/nextjs/index.mjs +4 -1
  38. package/dist/studio-pages/builder.css +25 -1
  39. package/dist/studio-pages/client.js +3593 -1279
  40. package/dist/studio-pages/client.mjs +3593 -1279
  41. package/dist/studio-pages/index.js +33 -8
  42. package/dist/studio-pages/index.mjs +2 -2
  43. package/package.json +24 -12
  44. package/dist/chunk-AAOHJDNS.mjs +0 -67
  45. package/dist/index-BallJs-K.d.mts +0 -43
  46. package/dist/index-BallJs-K.d.ts +0 -43
@@ -56,6 +56,7 @@ var sectionStyleDefaults = {
56
56
  contentGradientPreset: "none",
57
57
  contentGradientTo: "#f4f6f2",
58
58
  contentWidth: "inherit",
59
+ sectionPaddingX: "inherit",
59
60
  sectionBackgroundColor: "#ffffff",
60
61
  sectionBackgroundMode: "none",
61
62
  sectionGradientAngle: "135",
@@ -93,6 +94,19 @@ var sectionStyleFields = () => [
93
94
  type: "select",
94
95
  defaultValue: sectionStyleDefaults.sectionPaddingY,
95
96
  options: [
97
+ { label: "None", value: "none" },
98
+ { label: "Small", value: "sm" },
99
+ { label: "Medium", value: "md" },
100
+ { label: "Large", value: "lg" }
101
+ ]
102
+ },
103
+ {
104
+ name: "sectionPaddingX",
105
+ type: "select",
106
+ defaultValue: sectionStyleDefaults.sectionPaddingX,
107
+ options: [
108
+ { label: "Inherit", value: "inherit" },
109
+ { label: "None", value: "none" },
96
110
  { label: "Small", value: "sm" },
97
111
  { label: "Medium", value: "md" },
98
112
  { label: "Large", value: "lg" }
@@ -231,6 +245,67 @@ var BeforeAfterBlock = {
231
245
  relationTo: "media",
232
246
  required: false
233
247
  },
248
+ {
249
+ name: "imageHeight",
250
+ type: "number",
251
+ defaultValue: 160,
252
+ min: 60,
253
+ max: 600,
254
+ admin: {
255
+ description: "Overrides the before/after image height (in pixels).",
256
+ step: 10
257
+ }
258
+ },
259
+ {
260
+ name: "imageFit",
261
+ type: "select",
262
+ defaultValue: "cover",
263
+ options: [
264
+ { label: "Cover", value: "cover" },
265
+ { label: "Contain", value: "contain" }
266
+ ]
267
+ },
268
+ {
269
+ name: "imageCornerStyle",
270
+ type: "select",
271
+ defaultValue: "rounded",
272
+ options: [
273
+ { label: "Rounded", value: "rounded" },
274
+ { label: "Square", value: "square" }
275
+ ]
276
+ },
277
+ {
278
+ name: "imagePosition",
279
+ type: "select",
280
+ defaultValue: "center",
281
+ options: [
282
+ { label: "Center", value: "center" },
283
+ { label: "Top", value: "top" },
284
+ { label: "Bottom", value: "bottom" },
285
+ { label: "Left", value: "left" },
286
+ { label: "Right", value: "right" }
287
+ ]
288
+ },
289
+ {
290
+ name: "imagePositionX",
291
+ type: "number",
292
+ min: 0,
293
+ max: 100,
294
+ admin: {
295
+ description: "Optional custom horizontal focus (0-100). Overrides Image Position when set.",
296
+ step: 1
297
+ }
298
+ },
299
+ {
300
+ name: "imagePositionY",
301
+ type: "number",
302
+ min: 0,
303
+ max: 100,
304
+ admin: {
305
+ description: "Optional custom vertical focus (0-100). Overrides Image Position when set.",
306
+ step: 1
307
+ }
308
+ },
234
309
  {
235
310
  name: "description",
236
311
  type: "textarea"
@@ -416,11 +491,43 @@ var FeatureGridBlock = {
416
491
  name: "description",
417
492
  type: "textarea"
418
493
  },
494
+ {
495
+ name: "iconType",
496
+ type: "select",
497
+ defaultValue: "badge",
498
+ options: [
499
+ { label: "Badge Text", value: "badge" },
500
+ { label: "Icon", value: "lucide" }
501
+ ],
502
+ admin: {
503
+ description: "Choose whether this item uses a short badge label or an icon."
504
+ }
505
+ },
419
506
  {
420
507
  name: "icon",
421
508
  type: "text",
422
509
  admin: {
423
- description: 'Optional short icon label (e.g. "01", "Leaf", "Star").'
510
+ description: 'Optional short icon label (e.g. "01", "Leaf", "Star").',
511
+ condition: (_, siblingData) => siblingData?.iconType !== "lucide"
512
+ }
513
+ },
514
+ {
515
+ name: "iconLucide",
516
+ type: "select",
517
+ options: [
518
+ { label: "Shield Check", value: "ShieldCheck" },
519
+ { label: "Clock", value: "Clock" },
520
+ { label: "Leaf", value: "Leaf" },
521
+ { label: "Dollar Sign", value: "DollarSign" },
522
+ { label: "Hard Hat", value: "HardHat" },
523
+ { label: "Sparkles", value: "Sparkles" },
524
+ { label: "Tree Pine", value: "TreePine" },
525
+ { label: "Badge Check", value: "BadgeCheck" },
526
+ { label: "Calendar Clock", value: "CalendarClock" }
527
+ ],
528
+ admin: {
529
+ description: "Select an icon for this item.",
530
+ condition: (_, siblingData) => siblingData?.iconType === "lucide"
424
531
  }
425
532
  },
426
533
  {
@@ -428,6 +535,67 @@ var FeatureGridBlock = {
428
535
  type: "upload",
429
536
  relationTo: "media",
430
537
  required: false
538
+ },
539
+ {
540
+ name: "imageHeight",
541
+ type: "number",
542
+ defaultValue: 160,
543
+ min: 40,
544
+ max: 600,
545
+ admin: {
546
+ description: "Overrides the image height in the builder/section (in pixels).",
547
+ step: 10
548
+ }
549
+ },
550
+ {
551
+ name: "imageFit",
552
+ type: "select",
553
+ defaultValue: "cover",
554
+ options: [
555
+ { label: "Cover", value: "cover" },
556
+ { label: "Contain", value: "contain" }
557
+ ]
558
+ },
559
+ {
560
+ name: "imageCornerStyle",
561
+ type: "select",
562
+ defaultValue: "rounded",
563
+ options: [
564
+ { label: "Rounded", value: "rounded" },
565
+ { label: "Square", value: "square" }
566
+ ]
567
+ },
568
+ {
569
+ name: "imagePosition",
570
+ type: "select",
571
+ defaultValue: "center",
572
+ options: [
573
+ { label: "Center", value: "center" },
574
+ { label: "Top", value: "top" },
575
+ { label: "Bottom", value: "bottom" },
576
+ { label: "Left", value: "left" },
577
+ { label: "Right", value: "right" }
578
+ ]
579
+ },
580
+ {
581
+ name: "imagePositionX",
582
+ type: "number",
583
+ min: 0,
584
+ max: 100,
585
+ admin: {
586
+ description: "Optional custom horizontal focus (0-100). Overrides Image Position when set.",
587
+ step: 1
588
+ }
589
+ },
590
+ {
591
+ name: "imagePositionY",
592
+ type: "number",
593
+ min: 0,
594
+ max: 100,
595
+ admin: {
596
+ description: "Optional custom vertical focus (0-100). Overrides Image Position when set.",
597
+ step: 1
598
+ }
431
599
  }
432
600
  ]
433
601
  },
@@ -554,10 +722,44 @@ var HeroBlock = {
554
722
  relationTo: "media"
555
723
  },
556
724
  {
557
- name: "backgroundImageURL",
558
- type: "text",
725
+ name: "backgroundImageFit",
726
+ type: "select",
727
+ defaultValue: "cover",
728
+ options: [
729
+ { label: "Cover", value: "cover" },
730
+ { label: "Cover (Square)", value: "cover-square" },
731
+ { label: "Contain", value: "contain" },
732
+ { label: "Contain (Square)", value: "contain-square" }
733
+ ],
559
734
  admin: {
560
- description: "Optional external/background image URL override for this hero section."
735
+ description: "How the hero image should be sized within the section."
736
+ }
737
+ },
738
+ {
739
+ name: "backgroundImageCornerStyle",
740
+ type: "select",
741
+ defaultValue: "rounded",
742
+ options: [
743
+ { label: "Rounded", value: "rounded" },
744
+ { label: "Square", value: "square" }
745
+ ],
746
+ admin: {
747
+ description: "How the hero image corners should appear."
748
+ }
749
+ },
750
+ {
751
+ name: "backgroundImagePosition",
752
+ type: "select",
753
+ defaultValue: "center",
754
+ options: [
755
+ { label: "Center", value: "center" },
756
+ { label: "Top", value: "top" },
757
+ { label: "Bottom", value: "bottom" },
758
+ { label: "Left", value: "left" },
759
+ { label: "Right", value: "right" }
760
+ ],
761
+ admin: {
762
+ description: "Where the hero image should anchor inside the section."
561
763
  }
562
764
  },
563
765
  {
@@ -567,6 +769,113 @@ var HeroBlock = {
567
769
  description: "Optional background color override (example: #124a37)."
568
770
  }
569
771
  },
772
+ {
773
+ name: "backgroundOverlayMode",
774
+ type: "select",
775
+ defaultValue: "none",
776
+ options: [
777
+ { label: "None", value: "none" },
778
+ { label: "Solid", value: "solid" },
779
+ { label: "Gradient", value: "gradient" }
780
+ ],
781
+ admin: {
782
+ description: "Optional overlay on top of the hero image (applies when an image is present)."
783
+ }
784
+ },
785
+ {
786
+ name: "backgroundOverlayOpacity",
787
+ type: "number",
788
+ defaultValue: 45,
789
+ min: 0,
790
+ max: 100,
791
+ admin: {
792
+ description: "Overlay opacity (0-100).",
793
+ step: 1
794
+ }
795
+ },
796
+ {
797
+ name: "backgroundOverlayColor",
798
+ type: "text",
799
+ admin: {
800
+ description: "Overlay solid color (example: #000000). Used when Overlay Mode is Solid."
801
+ }
802
+ },
803
+ {
804
+ name: "backgroundOverlayGradientFrom",
805
+ type: "text",
806
+ admin: {
807
+ description: "Gradient overlay start color (example: #0d4a37). Used when Overlay Mode is Gradient."
808
+ }
809
+ },
810
+ {
811
+ name: "backgroundOverlayGradientTo",
812
+ type: "text",
813
+ admin: {
814
+ description: "Gradient overlay end color (example: #1f684f). Used when Overlay Mode is Gradient."
815
+ }
816
+ },
817
+ {
818
+ name: "backgroundOverlayGradientAngle",
819
+ type: "text",
820
+ admin: {
821
+ description: "Gradient overlay angle in degrees (0-360). Used when Overlay Mode is Gradient."
822
+ }
823
+ },
824
+ {
825
+ name: "backgroundOverlayGradientFromStrength",
826
+ type: "number",
827
+ defaultValue: 100,
828
+ min: 0,
829
+ max: 100,
830
+ admin: {
831
+ description: "Gradient start strength (0-100). Set to 0 for transparent.",
832
+ step: 1
833
+ }
834
+ },
835
+ {
836
+ name: "backgroundOverlayGradientToStrength",
837
+ type: "number",
838
+ defaultValue: 100,
839
+ min: 0,
840
+ max: 100,
841
+ admin: {
842
+ description: "Gradient end strength (0-100). Set to 0 for transparent.",
843
+ step: 1
844
+ }
845
+ },
846
+ {
847
+ name: "backgroundOverlayGradientStart",
848
+ type: "number",
849
+ defaultValue: 0,
850
+ min: 0,
851
+ max: 100,
852
+ admin: {
853
+ description: "Where the gradient starts (0-100).",
854
+ step: 1
855
+ }
856
+ },
857
+ {
858
+ name: "backgroundOverlayGradientEnd",
859
+ type: "number",
860
+ defaultValue: 100,
861
+ min: 0,
862
+ max: 100,
863
+ admin: {
864
+ description: "Where the gradient ends (0-100).",
865
+ step: 1
866
+ }
867
+ },
868
+ {
869
+ name: "backgroundOverlayGradientFeather",
870
+ type: "number",
871
+ defaultValue: 100,
872
+ min: 0,
873
+ max: 100,
874
+ admin: {
875
+ description: "How soft the transition is (0 = hard edge, 100 = smooth).",
876
+ step: 1
877
+ }
878
+ },
570
879
  {
571
880
  name: "variant",
572
881
  type: "select",
@@ -582,6 +891,28 @@ var HeroBlock = {
582
891
  }
583
892
  ]
584
893
  },
894
+ {
895
+ name: "heroHeight",
896
+ type: "select",
897
+ defaultValue: "sm",
898
+ options: [
899
+ {
900
+ label: "Small",
901
+ value: "sm"
902
+ },
903
+ {
904
+ label: "Medium (Half Screen)",
905
+ value: "md"
906
+ },
907
+ {
908
+ label: "Full Screen",
909
+ value: "full"
910
+ }
911
+ ],
912
+ admin: {
913
+ description: "Controls the vertical height of the hero section."
914
+ }
915
+ },
585
916
  ...sectionStyleFields()
586
917
  ]
587
918
  };
@@ -627,6 +958,67 @@ var LogoWallBlock = {
627
958
  relationTo: "media",
628
959
  required: false
629
960
  },
961
+ {
962
+ name: "imageHeight",
963
+ type: "number",
964
+ defaultValue: 64,
965
+ min: 24,
966
+ max: 200,
967
+ admin: {
968
+ description: "Overrides the logo image height (in pixels).",
969
+ step: 4
970
+ }
971
+ },
972
+ {
973
+ name: "imageFit",
974
+ type: "select",
975
+ defaultValue: "contain",
976
+ options: [
977
+ { label: "Cover", value: "cover" },
978
+ { label: "Contain", value: "contain" }
979
+ ]
980
+ },
981
+ {
982
+ name: "imageCornerStyle",
983
+ type: "select",
984
+ defaultValue: "rounded",
985
+ options: [
986
+ { label: "Rounded", value: "rounded" },
987
+ { label: "Square", value: "square" }
988
+ ]
989
+ },
990
+ {
991
+ name: "imagePosition",
992
+ type: "select",
993
+ defaultValue: "center",
994
+ options: [
995
+ { label: "Center", value: "center" },
996
+ { label: "Top", value: "top" },
997
+ { label: "Bottom", value: "bottom" },
998
+ { label: "Left", value: "left" },
999
+ { label: "Right", value: "right" }
1000
+ ]
1001
+ },
1002
+ {
1003
+ name: "imagePositionX",
1004
+ type: "number",
1005
+ min: 0,
1006
+ max: 100,
1007
+ admin: {
1008
+ description: "Optional custom horizontal focus (0-100). Overrides Image Position when set.",
1009
+ step: 1
1010
+ }
1011
+ },
1012
+ {
1013
+ name: "imagePositionY",
1014
+ type: "number",
1015
+ min: 0,
1016
+ max: 100,
1017
+ admin: {
1018
+ description: "Optional custom vertical focus (0-100). Overrides Image Position when set.",
1019
+ step: 1
1020
+ }
1021
+ },
630
1022
  {
631
1023
  name: "href",
632
1024
  type: "text"
@@ -677,6 +1069,36 @@ var MediaBlock = {
677
1069
  }
678
1070
  ]
679
1071
  },
1072
+ {
1073
+ name: "imageFit",
1074
+ type: "select",
1075
+ defaultValue: "cover",
1076
+ options: [
1077
+ { label: "Cover", value: "cover" },
1078
+ { label: "Contain", value: "contain" }
1079
+ ]
1080
+ },
1081
+ {
1082
+ name: "imageCornerStyle",
1083
+ type: "select",
1084
+ defaultValue: "rounded",
1085
+ options: [
1086
+ { label: "Rounded", value: "rounded" },
1087
+ { label: "Square", value: "square" }
1088
+ ]
1089
+ },
1090
+ {
1091
+ name: "imagePosition",
1092
+ type: "select",
1093
+ defaultValue: "center",
1094
+ options: [
1095
+ { label: "Center", value: "center" },
1096
+ { label: "Top", value: "top" },
1097
+ { label: "Bottom", value: "bottom" },
1098
+ { label: "Left", value: "left" },
1099
+ { label: "Right", value: "right" }
1100
+ ]
1101
+ },
680
1102
  ...sectionStyleFields()
681
1103
  ]
682
1104
  };
@@ -794,11 +1216,41 @@ var TestimonialsBlock = {
794
1216
  type: "text",
795
1217
  required: true
796
1218
  },
1219
+ {
1220
+ name: "visibleCount",
1221
+ type: "number",
1222
+ defaultValue: 3,
1223
+ min: 1,
1224
+ max: 6,
1225
+ admin: {
1226
+ description: "How many testimonials to show at once.",
1227
+ step: 1
1228
+ }
1229
+ },
1230
+ {
1231
+ name: "autoRotate",
1232
+ type: "checkbox",
1233
+ defaultValue: true,
1234
+ admin: {
1235
+ description: "Automatically rotates through all testimonials."
1236
+ }
1237
+ },
1238
+ {
1239
+ name: "rotateIntervalSeconds",
1240
+ type: "number",
1241
+ defaultValue: 7,
1242
+ min: 2,
1243
+ max: 30,
1244
+ admin: {
1245
+ description: "How often to rotate (in seconds).",
1246
+ step: 1
1247
+ }
1248
+ },
797
1249
  {
798
1250
  name: "items",
799
1251
  type: "array",
800
1252
  minRows: 1,
801
- maxRows: 6,
1253
+ maxRows: 30,
802
1254
  fields: [
803
1255
  {
804
1256
  name: "quote",
@@ -17,8 +17,8 @@ import {
17
17
  defaultPageLayoutBlocks,
18
18
  sectionPresets,
19
19
  templateStarterPresets
20
- } from "../chunk-PC5622T7.mjs";
21
- import "../chunk-ETRRXURT.mjs";
20
+ } from "../chunk-XQYJXB46.mjs";
21
+ import "../chunk-SIL2J5MF.mjs";
22
22
  import "../chunk-6BWS3CLP.mjs";
23
23
  export {
24
24
  BeforeAfterBlock,
@@ -7,6 +7,7 @@ import {
7
7
  var admin_exports = {};
8
8
  __export(admin_exports, {
9
9
  configureAdmin: () => configureAdmin,
10
+ createHeaderNavItemsField: () => createHeaderNavItemsField,
10
11
  createThemePreferenceField: () => createThemePreferenceField,
11
12
  themePreferenceField: () => themePreferenceField,
12
13
  withTooltips: () => withTooltips
@@ -269,10 +270,46 @@ function addTooltipToField(field, tooltips) {
269
270
  return field;
270
271
  }
271
272
 
273
+ // src/admin/fields/headerNav.ts
274
+ var createHeaderNavItemsField = () => ({
275
+ name: "navItems",
276
+ type: "array",
277
+ labels: { singular: "Navigation Link", plural: "Navigation Links" },
278
+ admin: {
279
+ description: "The links displayed in your website's main navigation menu."
280
+ },
281
+ fields: [
282
+ {
283
+ name: "label",
284
+ type: "text",
285
+ required: true,
286
+ admin: {
287
+ description: "The text shown for this navigation link."
288
+ }
289
+ },
290
+ {
291
+ name: "href",
292
+ type: "text",
293
+ required: true,
294
+ admin: {
295
+ description: 'The URL this link points to (e.g., "/about" or "https://example.com").'
296
+ }
297
+ },
298
+ {
299
+ name: "parentHref",
300
+ type: "text",
301
+ admin: {
302
+ description: "Optional parent link URL. If set to another nav item href, this item appears in that dropdown."
303
+ }
304
+ }
305
+ ]
306
+ });
307
+
272
308
  export {
273
309
  createThemePreferenceField,
274
310
  themePreferenceField,
275
311
  configureAdmin,
276
312
  withTooltips,
313
+ createHeaderNavItemsField,
277
314
  admin_exports
278
315
  };
@@ -1,3 +1,9 @@
1
+ import {
2
+ assertStudioDocumentV1
3
+ } from "./chunk-N67KVM2S.mjs";
4
+ import {
5
+ studioDocumentToLayout
6
+ } from "./chunk-LB72FZZ3.mjs";
1
7
  import {
2
8
  __export
3
9
  } from "./chunk-6BWS3CLP.mjs";
@@ -27,6 +33,24 @@ function createPayloadClient(config) {
27
33
 
28
34
  // src/nextjs/queries/pages.ts
29
35
  import { unstable_cache } from "next/cache";
36
+ var PAGE_QUERY_CACHE_VERSION = "v2-studio-layout-published-only";
37
+ function withStudioDocumentLayout(page) {
38
+ if (!page) {
39
+ return null;
40
+ }
41
+ try {
42
+ const studioDocument = assertStudioDocumentV1(page.studioDocument);
43
+ const compiledLayout = studioDocumentToLayout(studioDocument);
44
+ if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
45
+ return {
46
+ ...page,
47
+ layout: compiledLayout
48
+ };
49
+ }
50
+ } catch {
51
+ }
52
+ return page;
53
+ }
30
54
  function normalizePath(segments) {
31
55
  if (!segments || segments.length === 0) {
32
56
  return "/";
@@ -35,35 +59,42 @@ function normalizePath(segments) {
35
59
  return cleaned.length > 0 ? `/${cleaned}` : "/";
36
60
  }
37
61
  async function queryPageByPath(payload, path, draft) {
62
+ const pathWhere = {
63
+ path: {
64
+ equals: path
65
+ }
66
+ };
67
+ const publishedWhere = {
68
+ _status: {
69
+ equals: "published"
70
+ }
71
+ };
38
72
  const result = await payload.find({
39
73
  collection: "pages",
40
74
  depth: 2,
41
75
  draft,
42
76
  limit: 1,
43
77
  overrideAccess: false,
44
- where: {
45
- path: {
46
- equals: path
47
- }
48
- }
78
+ where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
49
79
  });
50
80
  if (result.docs.length > 0) {
51
- return result.docs[0] || null;
81
+ return withStudioDocumentLayout(result.docs[0] || null);
52
82
  }
53
83
  if (path === "/") {
84
+ const homeWhere = {
85
+ slug: {
86
+ equals: "home"
87
+ }
88
+ };
54
89
  const homeResult = await payload.find({
55
90
  collection: "pages",
56
91
  depth: 2,
57
92
  draft,
58
93
  limit: 1,
59
94
  overrideAccess: false,
60
- where: {
61
- slug: {
62
- equals: "home"
63
- }
64
- }
95
+ where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
65
96
  });
66
- return homeResult.docs[0] || null;
97
+ return withStudioDocumentLayout(homeResult.docs[0] || null);
67
98
  }
68
99
  return null;
69
100
  }
@@ -73,7 +104,7 @@ function createPageQueries(getPayloadClient, contentTag = "website-content") {
73
104
  const payload = await getPayloadClient();
74
105
  return queryPageByPath(payload, path, false);
75
106
  },
76
- ["page-by-path"],
107
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION],
77
108
  { tags: [contentTag] }
78
109
  );
79
110
  async function getPageBySegments(segments, draft = false) {