@orion-studios/payload-studio 0.5.0-beta.7 → 0.5.0-beta.70

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 (67) hide show
  1. package/README.md +20 -0
  2. package/dist/admin/client.d.mts +2 -0
  3. package/dist/admin/client.d.ts +2 -0
  4. package/dist/admin/client.js +779 -137
  5. package/dist/admin/client.mjs +769 -129
  6. package/dist/admin/index.d.mts +1 -1
  7. package/dist/admin/index.d.ts +1 -1
  8. package/dist/admin/index.js +100 -8
  9. package/dist/admin/index.mjs +3 -1
  10. package/dist/admin-app/client.d.mts +7 -0
  11. package/dist/admin-app/client.d.ts +7 -0
  12. package/dist/admin-app/client.js +1262 -3
  13. package/dist/admin-app/client.mjs +1164 -2
  14. package/dist/admin-app/index.d.mts +1 -1
  15. package/dist/admin-app/index.d.ts +1 -1
  16. package/dist/admin-app/index.js +167 -0
  17. package/dist/admin-app/index.mjs +13 -1
  18. package/dist/admin-app/styles.css +229 -0
  19. package/dist/blocks/index.js +633 -8
  20. package/dist/blocks/index.mjs +2 -2
  21. package/dist/{chunk-ZLLNO5FM.mjs → chunk-CKX5Y2HU.mjs} +44 -13
  22. package/dist/{chunk-J7W5EE3B.mjs → chunk-HCEPGEAI.mjs} +100 -8
  23. package/dist/chunk-HXGAG6I7.mjs +325 -0
  24. package/dist/chunk-ROTPP5CU.mjs +99 -0
  25. package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
  26. package/dist/chunk-VDGSMD6H.mjs +1072 -0
  27. package/dist/{chunk-PC5622T7.mjs → chunk-XK3K5GRP.mjs} +620 -9
  28. package/dist/chunk-XVH5SCBD.mjs +234 -0
  29. package/dist/{index-CmR6NInu.d.ts → index-BIwu3qIH.d.mts} +29 -3
  30. package/dist/{index-CmR6NInu.d.mts → index-BIwu3qIH.d.ts} +29 -3
  31. package/dist/index-CdnUNrvX.d.mts +134 -0
  32. package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.mts} +1 -0
  33. package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.ts} +1 -0
  34. package/dist/index-DyHbWliW.d.ts +134 -0
  35. package/dist/index-ZbOx4OCF.d.mts +128 -0
  36. package/dist/index-ZbOx4OCF.d.ts +128 -0
  37. package/dist/{index-DJFhANvJ.d.mts → index-cDYkEj29.d.mts} +20 -2
  38. package/dist/{index-DJFhANvJ.d.ts → index-cDYkEj29.d.ts} +20 -2
  39. package/dist/index.d.mts +5 -5
  40. package/dist/index.d.ts +5 -5
  41. package/dist/index.js +2145 -305
  42. package/dist/index.mjs +9 -9
  43. package/dist/nextjs/index.d.mts +1 -1
  44. package/dist/nextjs/index.d.ts +1 -1
  45. package/dist/nextjs/index.js +996 -13
  46. package/dist/nextjs/index.mjs +4 -1
  47. package/dist/studio/index.d.mts +2 -1
  48. package/dist/studio/index.d.ts +2 -1
  49. package/dist/studio/index.js +171 -2
  50. package/dist/studio/index.mjs +7 -3
  51. package/dist/studio-pages/builder.css +358 -8
  52. package/dist/studio-pages/client.d.mts +17 -0
  53. package/dist/studio-pages/client.d.ts +17 -0
  54. package/dist/studio-pages/client.js +5657 -1478
  55. package/dist/studio-pages/client.mjs +5549 -1461
  56. package/dist/studio-pages/index.d.mts +3 -2
  57. package/dist/studio-pages/index.d.ts +3 -2
  58. package/dist/studio-pages/index.js +799 -29
  59. package/dist/studio-pages/index.mjs +6 -2
  60. package/package.json +26 -12
  61. package/dist/chunk-AAOHJDNS.mjs +0 -67
  62. package/dist/chunk-N67KVM2S.mjs +0 -156
  63. package/dist/chunk-UJFU323N.mjs +0 -301
  64. package/dist/index-B9N5MyjF.d.mts +0 -39
  65. package/dist/index-BallJs-K.d.mts +0 -43
  66. package/dist/index-BallJs-K.d.ts +0 -43
  67. package/dist/index-g8tBHLKD.d.ts +0 -39
@@ -43,6 +43,982 @@ function createPayloadClient(config) {
43
43
 
44
44
  // src/nextjs/queries/pages.ts
45
45
  var import_cache = require("next/cache");
46
+
47
+ // src/studio/imageUploadOptimization.ts
48
+ var import_promises = require("fs/promises");
49
+ var DEFAULT_OPTIONS = {
50
+ avifQuality: 50,
51
+ enforceSmallerForLossy: true,
52
+ jpegQuality: 78,
53
+ minBytes: 48 * 1024,
54
+ minQualityFloor: 42,
55
+ onlyIfSmaller: true,
56
+ pngCompressionLevel: 9,
57
+ skipAnimated: true,
58
+ tiffQuality: 75,
59
+ webpQuality: 78
60
+ };
61
+
62
+ // src/studio/index.ts
63
+ var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
64
+ function assertStudioDocumentV1(input) {
65
+ if (!isRecord(input)) {
66
+ throw new Error("Studio document must be an object");
67
+ }
68
+ if (input.schemaVersion !== 1) {
69
+ throw new Error("Unsupported studio schemaVersion");
70
+ }
71
+ if (!Array.isArray(input.nodes)) {
72
+ throw new Error("Studio document nodes must be an array");
73
+ }
74
+ const nodes = input.nodes.map((node, index) => {
75
+ if (!isRecord(node)) {
76
+ throw new Error(`Node at index ${index} must be an object`);
77
+ }
78
+ if (typeof node.id !== "string" || node.id.length === 0) {
79
+ throw new Error(`Node at index ${index} has invalid id`);
80
+ }
81
+ if (typeof node.type !== "string" || node.type.length === 0) {
82
+ throw new Error(`Node at index ${index} has invalid type`);
83
+ }
84
+ if (!isRecord(node.data)) {
85
+ throw new Error(`Node at index ${index} has invalid data`);
86
+ }
87
+ return {
88
+ id: node.id,
89
+ type: node.type,
90
+ data: node.data
91
+ };
92
+ });
93
+ return {
94
+ metadata: isRecord(input.metadata) ? input.metadata : void 0,
95
+ schemaVersion: 1,
96
+ title: typeof input.title === "string" ? input.title : void 0,
97
+ nodes,
98
+ updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
99
+ };
100
+ }
101
+
102
+ // src/blocks/blocks/sectionStyleFields.ts
103
+ var sectionStyleDefaults = {
104
+ contentBackgroundColor: "#ffffff",
105
+ contentBackgroundMode: "none",
106
+ contentGradientAngle: "135",
107
+ contentGradientFrom: "#ffffff",
108
+ contentGradientPreset: "none",
109
+ contentGradientTo: "#f4f6f2",
110
+ contentWidth: "inherit",
111
+ sectionPaddingX: "inherit",
112
+ sectionBackgroundColor: "#ffffff",
113
+ sectionBackgroundMode: "none",
114
+ sectionGradientAngle: "135",
115
+ sectionGradientFrom: "#124a37",
116
+ sectionGradientPreset: "forest",
117
+ sectionGradientTo: "#1f684f",
118
+ sectionPaddingY: "md",
119
+ sectionWidth: "content"
120
+ };
121
+
122
+ // src/studio-pages/builder/settings-v2/types.ts
123
+ var defaultBuilderBlockSettingsV2 = {
124
+ advanced: {
125
+ customClassName: "",
126
+ editCopyInPanel: false,
127
+ hideOnMobile: false
128
+ },
129
+ appearance: {
130
+ contentBackgroundColor: "#ffffff",
131
+ contentBackgroundMode: "none",
132
+ contentGradientAngle: "135",
133
+ contentGradientFrom: "#ffffff",
134
+ contentGradientPreset: "none",
135
+ contentGradientTo: "#f4f6f2",
136
+ sectionBackgroundColor: "#ffffff",
137
+ sectionBackgroundMode: "none",
138
+ sectionGradientAngle: "135",
139
+ sectionGradientFrom: "#124a37",
140
+ sectionGradientPreset: "forest",
141
+ sectionGradientTo: "#1f684f"
142
+ },
143
+ layout: {
144
+ contentWidth: "inherit",
145
+ sectionPaddingX: "inherit",
146
+ sectionPaddingY: "md"
147
+ },
148
+ media: {
149
+ cornerStyle: "rounded",
150
+ fit: "cover",
151
+ height: null,
152
+ position: "center",
153
+ positionX: null,
154
+ positionY: null
155
+ },
156
+ typography: {
157
+ bodyAlign: "left",
158
+ headingAlign: "left",
159
+ letterSpacingPreset: "normal",
160
+ lineHeightPreset: "normal",
161
+ maxTextWidth: "auto"
162
+ },
163
+ version: 2
164
+ };
165
+ var defaultBuilderItemSettingsV2 = {
166
+ layout: {
167
+ contentWidth: "inherit",
168
+ sectionPaddingX: "inherit",
169
+ sectionPaddingY: "md"
170
+ },
171
+ media: {
172
+ cornerStyle: "rounded",
173
+ fit: "cover",
174
+ height: null,
175
+ position: "center",
176
+ positionX: null,
177
+ positionY: null
178
+ },
179
+ typography: {
180
+ bodyAlign: "left",
181
+ headingAlign: "left",
182
+ letterSpacingPreset: "normal",
183
+ lineHeightPreset: "normal",
184
+ maxTextWidth: "auto"
185
+ },
186
+ version: 2
187
+ };
188
+
189
+ // src/studio-pages/builder/adapters/settingsV2.ts
190
+ var isRecord2 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
191
+ var parsePercent = (value) => {
192
+ if (typeof value === "number" && Number.isFinite(value)) {
193
+ return Math.max(0, Math.min(100, value));
194
+ }
195
+ if (typeof value === "string" && value.trim().length > 0) {
196
+ const parsed = Number(value);
197
+ if (Number.isFinite(parsed)) {
198
+ return Math.max(0, Math.min(100, parsed));
199
+ }
200
+ }
201
+ return null;
202
+ };
203
+ var parsePixel = (value) => {
204
+ if (typeof value === "number" && Number.isFinite(value)) {
205
+ return value;
206
+ }
207
+ if (typeof value === "string" && value.trim().length > 0) {
208
+ const parsed = Number(value);
209
+ if (Number.isFinite(parsed)) {
210
+ return parsed;
211
+ }
212
+ }
213
+ return null;
214
+ };
215
+ var mergeSettings = (defaults, input) => {
216
+ if (!isRecord2(input)) {
217
+ return structuredClone(defaults);
218
+ }
219
+ const next = structuredClone(defaults);
220
+ for (const [key, value] of Object.entries(input)) {
221
+ if (isRecord2(value) && isRecord2(next[key])) {
222
+ next[key] = mergeSettings(next[key], value);
223
+ continue;
224
+ }
225
+ if (typeof value !== "undefined") {
226
+ next[key] = value;
227
+ }
228
+ }
229
+ return next;
230
+ };
231
+ var legacyBlockToV2Settings = (block) => {
232
+ const current = mergeSettings(defaultBuilderBlockSettingsV2, block.settings);
233
+ current.layout.contentWidth = block.contentWidth === "narrow" || block.contentWidth === "content" || block.contentWidth === "wide" || block.contentWidth === "full" || block.contentWidth === "inherit" ? block.contentWidth : current.layout.contentWidth;
234
+ current.layout.sectionPaddingX = block.sectionPaddingX === "none" || block.sectionPaddingX === "sm" || block.sectionPaddingX === "md" || block.sectionPaddingX === "lg" || block.sectionPaddingX === "inherit" ? block.sectionPaddingX : current.layout.sectionPaddingX;
235
+ current.layout.sectionPaddingY = block.sectionPaddingY === "none" || block.sectionPaddingY === "sm" || block.sectionPaddingY === "lg" ? block.sectionPaddingY : current.layout.sectionPaddingY;
236
+ current.appearance.sectionBackgroundMode = block.sectionBackgroundMode === "none" || block.sectionBackgroundMode === "color" || block.sectionBackgroundMode === "gradient" ? block.sectionBackgroundMode : current.appearance.sectionBackgroundMode;
237
+ current.appearance.sectionBackgroundColor = typeof block.sectionBackgroundColor === "string" ? block.sectionBackgroundColor : current.appearance.sectionBackgroundColor;
238
+ current.appearance.sectionGradientPreset = typeof block.sectionGradientPreset === "string" ? block.sectionGradientPreset : current.appearance.sectionGradientPreset;
239
+ current.appearance.sectionGradientFrom = typeof block.sectionGradientFrom === "string" ? block.sectionGradientFrom : current.appearance.sectionGradientFrom;
240
+ current.appearance.sectionGradientTo = typeof block.sectionGradientTo === "string" ? block.sectionGradientTo : current.appearance.sectionGradientTo;
241
+ current.appearance.sectionGradientAngle = typeof block.sectionGradientAngle === "string" ? block.sectionGradientAngle : current.appearance.sectionGradientAngle;
242
+ current.appearance.contentBackgroundMode = block.contentBackgroundMode === "none" || block.contentBackgroundMode === "color" || block.contentBackgroundMode === "gradient" ? block.contentBackgroundMode : current.appearance.contentBackgroundMode;
243
+ current.appearance.contentBackgroundColor = typeof block.contentBackgroundColor === "string" ? block.contentBackgroundColor : current.appearance.contentBackgroundColor;
244
+ current.appearance.contentGradientPreset = typeof block.contentGradientPreset === "string" ? block.contentGradientPreset : current.appearance.contentGradientPreset;
245
+ current.appearance.contentGradientFrom = typeof block.contentGradientFrom === "string" ? block.contentGradientFrom : current.appearance.contentGradientFrom;
246
+ current.appearance.contentGradientTo = typeof block.contentGradientTo === "string" ? block.contentGradientTo : current.appearance.contentGradientTo;
247
+ current.appearance.contentGradientAngle = typeof block.contentGradientAngle === "string" ? block.contentGradientAngle : current.appearance.contentGradientAngle;
248
+ if (block.backgroundImageFit === "cover" || block.backgroundImageFit === "contain") {
249
+ current.media.fit = block.backgroundImageFit;
250
+ }
251
+ if (block.imageFit === "cover" || block.imageFit === "contain") {
252
+ current.media.fit = block.imageFit;
253
+ }
254
+ if (block.backgroundImageCornerStyle === "rounded" || block.backgroundImageCornerStyle === "square") {
255
+ current.media.cornerStyle = block.backgroundImageCornerStyle;
256
+ }
257
+ if (block.imageCornerStyle === "rounded" || block.imageCornerStyle === "square") {
258
+ current.media.cornerStyle = block.imageCornerStyle;
259
+ }
260
+ if (block.backgroundImagePosition === "top" || block.backgroundImagePosition === "bottom" || block.backgroundImagePosition === "left" || block.backgroundImagePosition === "right" || block.backgroundImagePosition === "center") {
261
+ current.media.position = block.backgroundImagePosition;
262
+ }
263
+ if (block.imagePosition === "top" || block.imagePosition === "bottom" || block.imagePosition === "left" || block.imagePosition === "right" || block.imagePosition === "center") {
264
+ current.media.position = block.imagePosition;
265
+ }
266
+ current.media.positionX = parsePercent(block.imagePositionX ?? block.backgroundImagePositionX);
267
+ current.media.positionY = parsePercent(block.imagePositionY ?? block.backgroundImagePositionY);
268
+ current.media.height = parsePixel(block.imageHeight);
269
+ current.typography.headingAlign = block.textHeadingAlign === "left" || block.textHeadingAlign === "center" || block.textHeadingAlign === "right" || block.textHeadingAlign === "justify" ? block.textHeadingAlign : current.typography.headingAlign;
270
+ current.typography.bodyAlign = block.textBodyAlign === "left" || block.textBodyAlign === "center" || block.textBodyAlign === "right" || block.textBodyAlign === "justify" ? block.textBodyAlign : current.typography.bodyAlign;
271
+ current.typography.maxTextWidth = block.textMaxWidth === "auto" || block.textMaxWidth === "sm" || block.textMaxWidth === "md" || block.textMaxWidth === "lg" || block.textMaxWidth === "full" ? block.textMaxWidth : current.typography.maxTextWidth;
272
+ current.typography.lineHeightPreset = block.textLineHeightPreset === "tight" || block.textLineHeightPreset === "normal" || block.textLineHeightPreset === "relaxed" ? block.textLineHeightPreset : current.typography.lineHeightPreset;
273
+ current.typography.letterSpacingPreset = block.textLetterSpacingPreset === "tight" || block.textLetterSpacingPreset === "normal" || block.textLetterSpacingPreset === "relaxed" ? block.textLetterSpacingPreset : current.typography.letterSpacingPreset;
274
+ current.advanced.editCopyInPanel = Boolean(block.editCopyInPanel ?? current.advanced.editCopyInPanel);
275
+ current.advanced.customClassName = typeof block.customClassName === "string" ? block.customClassName : current.advanced.customClassName;
276
+ current.advanced.hideOnMobile = Boolean(block.hideOnMobile ?? current.advanced.hideOnMobile);
277
+ return current;
278
+ };
279
+ var v2SettingsToLegacyBlock = (blockWithSettings) => {
280
+ const settings = legacyBlockToV2Settings(blockWithSettings);
281
+ const next = {
282
+ ...blockWithSettings,
283
+ settings
284
+ };
285
+ next.contentWidth = settings.layout.contentWidth;
286
+ next.sectionPaddingX = settings.layout.sectionPaddingX;
287
+ next.sectionPaddingY = settings.layout.sectionPaddingY;
288
+ next.sectionBackgroundMode = settings.appearance.sectionBackgroundMode;
289
+ next.sectionBackgroundColor = settings.appearance.sectionBackgroundColor;
290
+ next.sectionGradientPreset = settings.appearance.sectionGradientPreset;
291
+ next.sectionGradientFrom = settings.appearance.sectionGradientFrom;
292
+ next.sectionGradientTo = settings.appearance.sectionGradientTo;
293
+ next.sectionGradientAngle = settings.appearance.sectionGradientAngle;
294
+ next.contentBackgroundMode = settings.appearance.contentBackgroundMode;
295
+ next.contentBackgroundColor = settings.appearance.contentBackgroundColor;
296
+ next.contentGradientPreset = settings.appearance.contentGradientPreset;
297
+ next.contentGradientFrom = settings.appearance.contentGradientFrom;
298
+ next.contentGradientTo = settings.appearance.contentGradientTo;
299
+ next.contentGradientAngle = settings.appearance.contentGradientAngle;
300
+ next.textHeadingAlign = settings.typography.headingAlign;
301
+ next.textBodyAlign = settings.typography.bodyAlign;
302
+ next.textMaxWidth = settings.typography.maxTextWidth;
303
+ next.textLineHeightPreset = settings.typography.lineHeightPreset;
304
+ next.textLetterSpacingPreset = settings.typography.letterSpacingPreset;
305
+ next.editCopyInPanel = settings.advanced.editCopyInPanel;
306
+ next.customClassName = settings.advanced.customClassName;
307
+ next.hideOnMobile = settings.advanced.hideOnMobile;
308
+ if (next.blockType === "hero") {
309
+ next.backgroundImageFit = settings.media.fit;
310
+ next.backgroundImageCornerStyle = settings.media.cornerStyle;
311
+ next.backgroundImagePosition = settings.media.position;
312
+ next.backgroundImagePositionX = settings.media.positionX;
313
+ next.backgroundImagePositionY = settings.media.positionY;
314
+ } else {
315
+ next.imageFit = settings.media.fit;
316
+ next.imageCornerStyle = settings.media.cornerStyle;
317
+ next.imagePosition = settings.media.position;
318
+ next.imagePositionX = settings.media.positionX;
319
+ next.imagePositionY = settings.media.positionY;
320
+ next.imageHeight = settings.media.height;
321
+ }
322
+ if (Array.isArray(next.items)) {
323
+ next.items = next.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
324
+ }
325
+ return next;
326
+ };
327
+ var legacyItemToV2Settings = (item) => {
328
+ const current = mergeSettings(defaultBuilderItemSettingsV2, item.settings);
329
+ if (item.imageFit === "cover" || item.imageFit === "contain") {
330
+ current.media.fit = item.imageFit;
331
+ }
332
+ if (item.imageCornerStyle === "rounded" || item.imageCornerStyle === "square") {
333
+ current.media.cornerStyle = item.imageCornerStyle;
334
+ }
335
+ if (item.imagePosition === "top" || item.imagePosition === "bottom" || item.imagePosition === "left" || item.imagePosition === "right" || item.imagePosition === "center") {
336
+ current.media.position = item.imagePosition;
337
+ }
338
+ current.media.positionX = parsePercent(item.imagePositionX);
339
+ current.media.positionY = parsePercent(item.imagePositionY);
340
+ current.media.height = parsePixel(item.imageHeight);
341
+ return current;
342
+ };
343
+ var v2SettingsToLegacyItem = (itemWithSettings) => {
344
+ const settings = legacyItemToV2Settings(itemWithSettings);
345
+ return {
346
+ ...itemWithSettings,
347
+ imageCornerStyle: settings.media.cornerStyle,
348
+ imageFit: settings.media.fit,
349
+ imageHeight: settings.media.height,
350
+ imagePosition: settings.media.position,
351
+ imagePositionX: settings.media.positionX,
352
+ imagePositionY: settings.media.positionY,
353
+ settings
354
+ };
355
+ };
356
+ var migrateBlockToSettingsV2 = (block) => {
357
+ const withLegacyMirrors = v2SettingsToLegacyBlock(block);
358
+ if (!Array.isArray(withLegacyMirrors.items)) {
359
+ return withLegacyMirrors;
360
+ }
361
+ return {
362
+ ...withLegacyMirrors,
363
+ items: withLegacyMirrors.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem)
364
+ };
365
+ };
366
+
367
+ // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
368
+ var import_react = require("react");
369
+
370
+ // src/studio-pages/builder/ui/Accordion.tsx
371
+ var import_jsx_runtime = require("react/jsx-runtime");
372
+
373
+ // src/studio-pages/builder/ui/ImageControls.tsx
374
+ var import_jsx_runtime2 = require("react/jsx-runtime");
375
+
376
+ // src/studio-pages/builder/settings-v2/inspectorSchema.ts
377
+ var alignOptions = [
378
+ { label: "Left", value: "left" },
379
+ { label: "Center", value: "center" },
380
+ { label: "Right", value: "right" },
381
+ { label: "Justify", value: "justify" }
382
+ ];
383
+ var layoutFieldSet = [
384
+ {
385
+ group: "layout",
386
+ key: "settings.layout.contentWidth",
387
+ label: "Content Width",
388
+ options: [
389
+ { label: "Inherit Page Default", value: "inherit" },
390
+ { label: "Narrow", value: "narrow" },
391
+ { label: "Content", value: "content" },
392
+ { label: "Wide", value: "wide" },
393
+ { label: "Full", value: "full" }
394
+ ],
395
+ tags: ["width", "container"],
396
+ type: "select"
397
+ },
398
+ {
399
+ group: "layout",
400
+ key: "settings.layout.sectionPaddingY",
401
+ label: "Section Vertical Spacing",
402
+ options: [
403
+ { label: "None", value: "none" },
404
+ { label: "Small", value: "sm" },
405
+ { label: "Medium", value: "md" },
406
+ { label: "Large", value: "lg" }
407
+ ],
408
+ tags: ["spacing", "padding"],
409
+ type: "select"
410
+ },
411
+ {
412
+ group: "layout",
413
+ key: "settings.layout.sectionPaddingX",
414
+ label: "Section Horizontal Spacing",
415
+ options: [
416
+ { label: "Inherit", value: "inherit" },
417
+ { label: "None", value: "none" },
418
+ { label: "Small", value: "sm" },
419
+ { label: "Medium", value: "md" },
420
+ { label: "Large", value: "lg" }
421
+ ],
422
+ tags: ["spacing", "padding"],
423
+ type: "select"
424
+ }
425
+ ];
426
+ var typographyFieldSet = [
427
+ {
428
+ group: "typography",
429
+ key: "settings.typography.headingAlign",
430
+ label: "Heading Alignment",
431
+ options: alignOptions,
432
+ tags: ["text", "align", "heading"],
433
+ type: "select"
434
+ },
435
+ {
436
+ group: "typography",
437
+ key: "settings.typography.bodyAlign",
438
+ label: "Body Alignment",
439
+ options: alignOptions,
440
+ tags: ["text", "align", "paragraph"],
441
+ type: "select"
442
+ },
443
+ {
444
+ group: "typography",
445
+ key: "settings.typography.maxTextWidth",
446
+ label: "Text Width",
447
+ options: [
448
+ { label: "Auto", value: "auto" },
449
+ { label: "Small", value: "sm" },
450
+ { label: "Medium", value: "md" },
451
+ { label: "Large", value: "lg" },
452
+ { label: "Full", value: "full" }
453
+ ],
454
+ tags: ["readability", "measure", "line length"],
455
+ type: "select"
456
+ },
457
+ {
458
+ advanced: true,
459
+ group: "typography",
460
+ key: "settings.typography.lineHeightPreset",
461
+ label: "Line Height",
462
+ options: [
463
+ { label: "Tight", value: "tight" },
464
+ { label: "Normal", value: "normal" },
465
+ { label: "Relaxed", value: "relaxed" }
466
+ ],
467
+ type: "select"
468
+ },
469
+ {
470
+ advanced: true,
471
+ group: "typography",
472
+ key: "settings.typography.letterSpacingPreset",
473
+ label: "Letter Spacing",
474
+ options: [
475
+ { label: "Tight", value: "tight" },
476
+ { label: "Normal", value: "normal" },
477
+ { label: "Relaxed", value: "relaxed" }
478
+ ],
479
+ type: "select"
480
+ }
481
+ ];
482
+ var styleFieldSet = [
483
+ {
484
+ group: "style",
485
+ key: "settings.appearance.sectionBackgroundMode",
486
+ label: "Section Background",
487
+ options: [
488
+ { label: "None", value: "none" },
489
+ { label: "Color", value: "color" },
490
+ { label: "Gradient", value: "gradient" }
491
+ ],
492
+ tags: ["background", "section"],
493
+ type: "select"
494
+ },
495
+ {
496
+ group: "style",
497
+ key: "settings.appearance.sectionBackgroundColor",
498
+ label: "Section Background Color",
499
+ type: "color"
500
+ },
501
+ {
502
+ group: "style",
503
+ key: "settings.appearance.contentBackgroundMode",
504
+ label: "Content Background",
505
+ options: [
506
+ { label: "None", value: "none" },
507
+ { label: "Color", value: "color" },
508
+ { label: "Gradient", value: "gradient" }
509
+ ],
510
+ tags: ["background", "content"],
511
+ type: "select"
512
+ },
513
+ {
514
+ group: "style",
515
+ key: "settings.appearance.contentBackgroundColor",
516
+ label: "Content Background Color",
517
+ type: "color"
518
+ }
519
+ ];
520
+ var commonAdvanced = [
521
+ {
522
+ group: "advanced",
523
+ inlineEditable: false,
524
+ key: "settings.advanced.editCopyInPanel",
525
+ label: "Edit Copy In Panel",
526
+ tags: ["inline", "copy", "text"],
527
+ type: "checkbox"
528
+ },
529
+ {
530
+ advanced: true,
531
+ group: "advanced",
532
+ key: "settings.advanced.hideOnMobile",
533
+ label: "Hide On Mobile",
534
+ type: "checkbox"
535
+ },
536
+ {
537
+ advanced: true,
538
+ group: "advanced",
539
+ key: "settings.advanced.customClassName",
540
+ label: "Custom Class Name",
541
+ type: "text"
542
+ }
543
+ ];
544
+ var mediaFieldSet = [
545
+ {
546
+ group: "media",
547
+ key: "settings.media.fit",
548
+ label: "Image Fit",
549
+ options: [
550
+ { label: "Cover", value: "cover" },
551
+ { label: "Contain", value: "contain" }
552
+ ],
553
+ tags: ["image", "media"],
554
+ type: "select"
555
+ },
556
+ {
557
+ group: "media",
558
+ key: "settings.media.cornerStyle",
559
+ label: "Image Corners",
560
+ options: [
561
+ { label: "Rounded", value: "rounded" },
562
+ { label: "Square", value: "square" }
563
+ ],
564
+ tags: ["image", "radius", "corners"],
565
+ type: "select"
566
+ },
567
+ {
568
+ group: "media",
569
+ key: "settings.media.position",
570
+ label: "Image Position",
571
+ options: [
572
+ { label: "Center", value: "center" },
573
+ { label: "Top", value: "top" },
574
+ { label: "Bottom", value: "bottom" },
575
+ { label: "Left", value: "left" },
576
+ { label: "Right", value: "right" }
577
+ ],
578
+ type: "select"
579
+ }
580
+ ];
581
+ var inspectorDefinitionByBlockType = {
582
+ beforeAfter: {
583
+ blockType: "beforeAfter",
584
+ fields: [
585
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
586
+ { group: "basics", inlineEditable: true, key: "subtitle", label: "Subtitle", type: "textarea" },
587
+ { group: "basics", key: "itemsPerRow", label: "Items Per Row", max: 4, min: 1, type: "number" },
588
+ ...layoutFieldSet,
589
+ ...typographyFieldSet,
590
+ ...styleFieldSet,
591
+ ...commonAdvanced
592
+ ]
593
+ },
594
+ bookingEmbed: {
595
+ blockType: "bookingEmbed",
596
+ fields: [
597
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
598
+ { group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
599
+ { group: "basics", inlineEditable: false, key: "buttonLabel", label: "Button Label", type: "text" },
600
+ { group: "basics", inlineEditable: false, key: "buttonHref", label: "Button URL", type: "text" },
601
+ ...layoutFieldSet,
602
+ ...typographyFieldSet,
603
+ ...styleFieldSet,
604
+ ...commonAdvanced
605
+ ]
606
+ },
607
+ cta: {
608
+ blockType: "cta",
609
+ fields: [
610
+ { group: "basics", inlineEditable: true, key: "headline", label: "Headline", type: "text" },
611
+ { group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
612
+ { group: "basics", inlineEditable: false, key: "buttonLabel", label: "Button Label", type: "text" },
613
+ { group: "basics", inlineEditable: false, key: "buttonHref", label: "Button URL", type: "text" },
614
+ {
615
+ group: "basics",
616
+ key: "style",
617
+ label: "Variant",
618
+ options: [
619
+ { label: "Light", value: "light" },
620
+ { label: "Dark", value: "dark" }
621
+ ],
622
+ type: "select"
623
+ },
624
+ ...layoutFieldSet,
625
+ ...typographyFieldSet,
626
+ ...styleFieldSet,
627
+ ...commonAdvanced
628
+ ]
629
+ },
630
+ faq: {
631
+ blockType: "faq",
632
+ fields: [
633
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
634
+ ...layoutFieldSet,
635
+ ...typographyFieldSet,
636
+ ...styleFieldSet,
637
+ ...commonAdvanced
638
+ ]
639
+ },
640
+ featureGrid: {
641
+ blockType: "featureGrid",
642
+ fields: [
643
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
644
+ {
645
+ group: "basics",
646
+ key: "variant",
647
+ label: "Variant",
648
+ options: [
649
+ { label: "Cards", value: "cards" },
650
+ { label: "Highlight", value: "highlight" }
651
+ ],
652
+ type: "select"
653
+ },
654
+ { group: "basics", key: "itemsPerRow", label: "Items Per Row", max: 6, min: 1, type: "number" },
655
+ ...layoutFieldSet,
656
+ ...typographyFieldSet,
657
+ ...mediaFieldSet,
658
+ ...styleFieldSet,
659
+ ...commonAdvanced
660
+ ]
661
+ },
662
+ formEmbed: {
663
+ blockType: "formEmbed",
664
+ fields: [
665
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
666
+ { group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
667
+ {
668
+ group: "basics",
669
+ key: "formType",
670
+ label: "Form Type",
671
+ options: [{ label: "Quote", value: "quote" }],
672
+ type: "select"
673
+ },
674
+ ...layoutFieldSet,
675
+ ...typographyFieldSet,
676
+ ...styleFieldSet,
677
+ ...commonAdvanced
678
+ ]
679
+ },
680
+ hero: {
681
+ blockType: "hero",
682
+ fields: [
683
+ { group: "basics", inlineEditable: true, key: "kicker", label: "Kicker", type: "text" },
684
+ { group: "basics", inlineEditable: true, key: "headline", label: "Headline", type: "text" },
685
+ { group: "basics", inlineEditable: true, key: "subheadline", label: "Subheadline", type: "textarea" },
686
+ {
687
+ group: "basics",
688
+ key: "variant",
689
+ label: "Variant",
690
+ options: [
691
+ { label: "Default", value: "default" },
692
+ { label: "Centered", value: "centered" }
693
+ ],
694
+ type: "select"
695
+ },
696
+ {
697
+ group: "layout",
698
+ key: "heroHeight",
699
+ label: "Hero Height",
700
+ options: [
701
+ { label: "Small", value: "sm" },
702
+ { label: "Medium (Half Screen)", value: "md" },
703
+ { label: "Full Screen", value: "full" }
704
+ ],
705
+ type: "select"
706
+ },
707
+ ...layoutFieldSet,
708
+ ...typographyFieldSet,
709
+ ...mediaFieldSet,
710
+ ...styleFieldSet,
711
+ ...commonAdvanced
712
+ ]
713
+ },
714
+ logoWall: {
715
+ blockType: "logoWall",
716
+ fields: [
717
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
718
+ { group: "basics", inlineEditable: true, key: "subtitle", label: "Subtitle", type: "textarea" },
719
+ ...layoutFieldSet,
720
+ ...typographyFieldSet,
721
+ ...mediaFieldSet,
722
+ ...styleFieldSet,
723
+ ...commonAdvanced
724
+ ]
725
+ },
726
+ media: {
727
+ blockType: "media",
728
+ fields: [
729
+ { group: "basics", inlineEditable: true, key: "caption", label: "Caption", type: "text" },
730
+ {
731
+ group: "basics",
732
+ key: "size",
733
+ label: "Size",
734
+ options: [
735
+ { label: "Default", value: "default" },
736
+ { label: "Wide", value: "wide" }
737
+ ],
738
+ type: "select"
739
+ },
740
+ ...layoutFieldSet,
741
+ ...typographyFieldSet,
742
+ ...mediaFieldSet,
743
+ ...styleFieldSet,
744
+ ...commonAdvanced
745
+ ]
746
+ },
747
+ richText: {
748
+ blockType: "richText",
749
+ fields: [
750
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
751
+ {
752
+ group: "basics",
753
+ key: "width",
754
+ label: "Rich Text Width",
755
+ options: [
756
+ { label: "Normal", value: "normal" },
757
+ { label: "Narrow", value: "narrow" }
758
+ ],
759
+ type: "select"
760
+ },
761
+ ...layoutFieldSet,
762
+ ...typographyFieldSet,
763
+ ...styleFieldSet,
764
+ ...commonAdvanced
765
+ ]
766
+ },
767
+ stats: {
768
+ blockType: "stats",
769
+ fields: [
770
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
771
+ { group: "basics", inlineEditable: true, key: "subtitle", label: "Subtitle", type: "textarea" },
772
+ ...layoutFieldSet,
773
+ ...typographyFieldSet,
774
+ ...styleFieldSet,
775
+ ...commonAdvanced
776
+ ]
777
+ },
778
+ testimonials: {
779
+ blockType: "testimonials",
780
+ fields: [
781
+ { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
782
+ { group: "basics", key: "visibleCount", label: "Visible At Once", max: 6, min: 1, type: "number" },
783
+ { group: "basics", key: "autoRotate", label: "Auto Rotate", type: "checkbox" },
784
+ {
785
+ advanced: true,
786
+ group: "advanced",
787
+ key: "rotateIntervalSeconds",
788
+ label: "Rotate Interval Seconds",
789
+ max: 30,
790
+ min: 2,
791
+ type: "number"
792
+ },
793
+ ...layoutFieldSet,
794
+ ...typographyFieldSet,
795
+ ...styleFieldSet,
796
+ ...commonAdvanced
797
+ ]
798
+ }
799
+ };
800
+
801
+ // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
802
+ var import_jsx_runtime3 = require("react/jsx-runtime");
803
+
804
+ // src/studio-pages/index.ts
805
+ var withSectionStyleDefaults = (value) => ({
806
+ ...sectionStyleDefaults,
807
+ ...value
808
+ });
809
+ var defaultNodeData = {
810
+ bookingEmbed: {
811
+ ...withSectionStyleDefaults({}),
812
+ buttonHref: "/contact",
813
+ buttonLabel: "Book Consultation",
814
+ description: "Let visitors book a consultation.",
815
+ title: "Book a Time"
816
+ },
817
+ beforeAfter: withSectionStyleDefaults({
818
+ itemsPerRow: 2,
819
+ items: [
820
+ {
821
+ description: "Before and after result summary.",
822
+ imageCornerStyle: "rounded",
823
+ imageFit: "cover",
824
+ imagePosition: "center",
825
+ label: "Project One"
826
+ }
827
+ ],
828
+ subtitle: "Show visual proof from real projects.",
829
+ title: "Before & After Results"
830
+ }),
831
+ cta: {
832
+ ...withSectionStyleDefaults({}),
833
+ backgroundColor: "#1f684f",
834
+ buttonHref: "/contact",
835
+ buttonLabel: "Contact Us",
836
+ description: "Optional supporting copy.",
837
+ headline: "Ready to get started?",
838
+ style: "light"
839
+ },
840
+ faq: {
841
+ ...withSectionStyleDefaults({}),
842
+ items: [{ answer: "Answer goes here.", question: "Frequently asked question?" }],
843
+ title: "Frequently Asked Questions"
844
+ },
845
+ featureGrid: {
846
+ ...withSectionStyleDefaults({}),
847
+ itemsPerRow: 3,
848
+ items: [
849
+ { description: "Explain this point.", iconType: "badge", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
850
+ { description: "Explain this point.", iconType: "badge", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
851
+ { description: "Explain this point.", iconType: "badge", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
852
+ ],
853
+ title: "Section Title",
854
+ variant: "cards"
855
+ },
856
+ formEmbed: {
857
+ ...withSectionStyleDefaults({}),
858
+ description: "Collect lead details from visitors.",
859
+ formType: "quote",
860
+ title: "Request a Quote"
861
+ },
862
+ hero: {
863
+ ...withSectionStyleDefaults({}),
864
+ backgroundColor: "",
865
+ backgroundOverlayMode: "none",
866
+ backgroundOverlayOpacity: 45,
867
+ backgroundOverlayColor: "#000000",
868
+ backgroundOverlayGradientFrom: "#0d4a37",
869
+ backgroundOverlayGradientTo: "#1f684f",
870
+ backgroundOverlayGradientAngle: "135",
871
+ backgroundOverlayGradientFromStrength: 100,
872
+ backgroundOverlayGradientToStrength: 100,
873
+ backgroundOverlayGradientStart: 0,
874
+ backgroundOverlayGradientEnd: 100,
875
+ backgroundOverlayGradientFeather: 100,
876
+ backgroundImageCornerStyle: "rounded",
877
+ backgroundImageFit: "cover",
878
+ backgroundImagePosition: "center",
879
+ heroHeight: "sm",
880
+ headline: "New Hero Section",
881
+ kicker: "Optional kicker",
882
+ primaryHref: "/contact",
883
+ primaryLabel: "Primary Action",
884
+ secondaryHref: "/services",
885
+ secondaryLabel: "Secondary Action",
886
+ subheadline: "Describe your offer clearly for website visitors.",
887
+ variant: "default"
888
+ },
889
+ media: {
890
+ ...withSectionStyleDefaults({}),
891
+ caption: "Add a caption",
892
+ imageCornerStyle: "rounded",
893
+ imageFit: "cover",
894
+ imagePosition: "center",
895
+ size: "default"
896
+ },
897
+ logoWall: withSectionStyleDefaults({
898
+ items: [
899
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
900
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
901
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
902
+ ],
903
+ subtitle: "Trusted by teams and homeowners across Central Texas.",
904
+ title: "Trusted by Local Organizations"
905
+ }),
906
+ richText: {
907
+ ...withSectionStyleDefaults({}),
908
+ content: {
909
+ root: {
910
+ children: [
911
+ {
912
+ children: [
913
+ {
914
+ detail: 0,
915
+ format: 0,
916
+ mode: "normal",
917
+ style: "",
918
+ text: "Write your content here.",
919
+ type: "text",
920
+ version: 1
921
+ }
922
+ ],
923
+ direction: "ltr",
924
+ format: "",
925
+ indent: 0,
926
+ type: "paragraph",
927
+ version: 1
928
+ }
929
+ ],
930
+ direction: "ltr",
931
+ format: "",
932
+ indent: 0,
933
+ type: "root",
934
+ version: 1
935
+ }
936
+ },
937
+ title: "Section Heading",
938
+ width: "normal"
939
+ },
940
+ testimonials: {
941
+ ...withSectionStyleDefaults({}),
942
+ autoRotate: true,
943
+ items: [{ location: "City, ST", name: "Customer Name", quote: "Customer feedback goes here.", rating: 5 }],
944
+ rotateIntervalSeconds: 7,
945
+ title: "What Customers Say",
946
+ visibleCount: 3
947
+ },
948
+ stats: withSectionStyleDefaults({
949
+ items: [
950
+ { description: "Average response time", label: "Same-Day Quotes", value: "24h" },
951
+ { description: "Projects completed", label: "Completed Jobs", value: "1,200+" },
952
+ { description: "Client satisfaction score", label: "Satisfaction", value: "4.9/5" }
953
+ ],
954
+ subtitle: "Highlight measurable outcomes to build trust quickly.",
955
+ title: "Performance Highlights"
956
+ })
957
+ };
958
+ var nodeTypeLabels = {
959
+ bookingEmbed: "Booking Embed",
960
+ beforeAfter: "Before / After",
961
+ cta: "Call To Action",
962
+ faq: "FAQ",
963
+ featureGrid: "Feature Grid",
964
+ formEmbed: "Form Embed",
965
+ hero: "Hero",
966
+ logoWall: "Logo Wall",
967
+ media: "Media",
968
+ richText: "Rich Text",
969
+ stats: "Stats",
970
+ testimonials: "Testimonials"
971
+ };
972
+ var pageNodeTypes = Object.keys(defaultNodeData).map((type) => ({
973
+ type,
974
+ displayName: nodeTypeLabels[type] || type,
975
+ description: `Page node for ${nodeTypeLabels[type] || type}`,
976
+ getDefaultData: () => {
977
+ const migrated = migrateBlockToSettingsV2(structuredClone(defaultNodeData[type]));
978
+ const { blockType: _ignoredBlockType, ...data } = migrated;
979
+ return data;
980
+ }
981
+ }));
982
+ var pageInspectorPanels = Object.keys(defaultNodeData).map((nodeType) => ({
983
+ id: `${nodeType}-panel`,
984
+ label: `${nodeTypeLabels[nodeType] || nodeType} Settings`,
985
+ nodeType,
986
+ fields: inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
987
+ advanced: field.advanced,
988
+ group: field.group,
989
+ inlineEditable: field.inlineEditable,
990
+ key: field.key,
991
+ label: field.label,
992
+ type: field.type
993
+ })) || []
994
+ }));
995
+ var studioDocumentToLayout = (document) => document.nodes.map(
996
+ (node) => migrateBlockToSettingsV2({
997
+ id: node.id,
998
+ blockType: node.type,
999
+ ...node.data
1000
+ })
1001
+ );
1002
+
1003
+ // src/nextjs/queries/pages.ts
1004
+ var PAGE_QUERY_CACHE_VERSION = "v4-published-only-public";
1005
+ function withStudioDocumentLayout(page) {
1006
+ if (!page) {
1007
+ return null;
1008
+ }
1009
+ try {
1010
+ const studioDocument = assertStudioDocumentV1(page.studioDocument);
1011
+ const compiledLayout = studioDocumentToLayout(studioDocument);
1012
+ if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
1013
+ return {
1014
+ ...page,
1015
+ layout: compiledLayout
1016
+ };
1017
+ }
1018
+ } catch {
1019
+ }
1020
+ return page;
1021
+ }
46
1022
  function normalizePath(segments) {
47
1023
  if (!segments || segments.length === 0) {
48
1024
  return "/";
@@ -51,35 +1027,42 @@ function normalizePath(segments) {
51
1027
  return cleaned.length > 0 ? `/${cleaned}` : "/";
52
1028
  }
53
1029
  async function queryPageByPath(payload, path, draft) {
1030
+ const pathWhere = {
1031
+ path: {
1032
+ equals: path
1033
+ }
1034
+ };
1035
+ const publishedWhere = {
1036
+ _status: {
1037
+ equals: "published"
1038
+ }
1039
+ };
54
1040
  const result = await payload.find({
55
1041
  collection: "pages",
56
1042
  depth: 2,
57
1043
  draft,
58
1044
  limit: 1,
59
1045
  overrideAccess: false,
60
- where: {
61
- path: {
62
- equals: path
63
- }
64
- }
1046
+ where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
65
1047
  });
66
1048
  if (result.docs.length > 0) {
67
- return result.docs[0] || null;
1049
+ return withStudioDocumentLayout(result.docs[0] || null);
68
1050
  }
69
1051
  if (path === "/") {
1052
+ const homeWhere = {
1053
+ slug: {
1054
+ equals: "home"
1055
+ }
1056
+ };
70
1057
  const homeResult = await payload.find({
71
1058
  collection: "pages",
72
1059
  depth: 2,
73
1060
  draft,
74
1061
  limit: 1,
75
1062
  overrideAccess: false,
76
- where: {
77
- slug: {
78
- equals: "home"
79
- }
80
- }
1063
+ where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
81
1064
  });
82
- return homeResult.docs[0] || null;
1065
+ return withStudioDocumentLayout(homeResult.docs[0] || null);
83
1066
  }
84
1067
  return null;
85
1068
  }
@@ -89,7 +1072,7 @@ function createPageQueries(getPayloadClient, contentTag = "website-content") {
89
1072
  const payload = await getPayloadClient();
90
1073
  return queryPageByPath(payload, path, false);
91
1074
  },
92
- ["page-by-path"],
1075
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION],
93
1076
  { tags: [contentTag] }
94
1077
  );
95
1078
  async function getPageBySegments(segments, draft = false) {