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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +58 -68
  2. package/dist/admin/client.d.mts +6 -0
  3. package/dist/admin/client.d.ts +6 -0
  4. package/dist/admin/client.js +4533 -799
  5. package/dist/admin/client.mjs +3349 -756
  6. package/dist/admin/index.d.mts +2 -1
  7. package/dist/admin/index.d.ts +2 -1
  8. package/dist/admin/index.js +386 -55
  9. package/dist/admin/index.mjs +2 -1
  10. package/dist/admin-app/client.d.mts +1 -0
  11. package/dist/admin-app/client.d.ts +1 -0
  12. package/dist/admin-app/client.js +285 -109
  13. package/dist/admin-app/client.mjs +59 -871
  14. package/dist/admin-app/index.d.mts +2 -1
  15. package/dist/admin-app/index.d.ts +2 -1
  16. package/dist/admin-app/index.mjs +5 -3
  17. package/dist/admin-app/styles.css +1767 -56
  18. package/dist/admin.css +158 -35
  19. package/dist/blocks/index.js +415 -200
  20. package/dist/blocks/index.mjs +2 -2
  21. package/dist/{chunk-XK3K5GRP.mjs → chunk-JQAHXYAM.mjs} +271 -67
  22. package/dist/chunk-KPIX7OSV.mjs +1051 -0
  23. package/dist/chunk-OQSEJXC4.mjs +166 -0
  24. package/dist/{chunk-XHWQJUX5.mjs → chunk-OTHERBGX.mjs} +3 -3
  25. package/dist/chunk-PF3EBZXF.mjs +326 -0
  26. package/dist/{chunk-74XFAVXU.mjs → chunk-QJAWO6K3.mjs} +377 -55
  27. package/dist/{chunk-XVH5SCBD.mjs → chunk-RKTIFEUY.mjs} +4 -19
  28. package/dist/chunk-W2UOCJDX.mjs +32 -0
  29. package/dist/{chunk-C4J35SPJ.mjs → chunk-XKUTZ7IU.mjs} +257 -452
  30. package/dist/{index-ZbOx4OCF.d.mts → index-52HdVLQq.d.ts} +12 -22
  31. package/dist/index-B6_D4Hm4.d.ts +439 -0
  32. package/dist/index-CYaWadBl.d.mts +439 -0
  33. package/dist/index-Crx_MtPw.d.ts +223 -0
  34. package/dist/index-Cv-6qnrw.d.mts +223 -0
  35. package/dist/{index-ZbOx4OCF.d.ts → index-DEQC3Dwj.d.mts} +12 -22
  36. package/dist/{index-BIwu3qIH.d.mts → index-DWmudwDm.d.mts} +2 -1
  37. package/dist/{index-BIwu3qIH.d.ts → index-DWmudwDm.d.ts} +2 -1
  38. package/dist/index.d.mts +5 -4
  39. package/dist/index.d.ts +5 -4
  40. package/dist/index.js +1858 -1202
  41. package/dist/index.mjs +10 -8
  42. package/dist/nextjs/index.js +5 -684
  43. package/dist/nextjs/index.mjs +2 -3
  44. package/dist/sitePreviewTypes-BkHCWxNW.d.mts +58 -0
  45. package/dist/sitePreviewTypes-BkHCWxNW.d.ts +58 -0
  46. package/dist/studio/index.d.mts +1 -1
  47. package/dist/studio/index.d.ts +1 -1
  48. package/dist/studio-pages/builder.css +125 -83
  49. package/dist/studio-pages/client.d.mts +58 -1
  50. package/dist/studio-pages/client.d.ts +58 -1
  51. package/dist/studio-pages/client.js +450 -241
  52. package/dist/studio-pages/client.mjs +455 -247
  53. package/dist/studio-pages/index.d.mts +3 -2
  54. package/dist/studio-pages/index.d.ts +3 -2
  55. package/dist/studio-pages/index.js +418 -183
  56. package/dist/studio-pages/index.mjs +15 -6
  57. package/package.json +10 -4
  58. package/dist/chunk-SIL2J5MF.mjs +0 -155
  59. package/dist/index-BnoqmQDP.d.mts +0 -219
  60. package/dist/index-CTpik6fR.d.ts +0 -219
  61. package/dist/index-R7hA134j.d.mts +0 -140
  62. package/dist/index-vjrjy0P4.d.ts +0 -140
package/dist/index.js CHANGED
@@ -79,8 +79,36 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
79
79
  });
80
80
  var themePreferenceField = createThemePreferenceField("brand-light");
81
81
 
82
+ // src/admin-app/routeRegistry.ts
83
+ var adminNavIcons = [
84
+ "dashboard",
85
+ "pages",
86
+ "forms",
87
+ "globals",
88
+ "media",
89
+ "tools",
90
+ "account",
91
+ "analytics"
92
+ ];
93
+ var roleCanAccessNav = (role, item) => {
94
+ if (!item.roles || item.roles.length === 0) {
95
+ return true;
96
+ }
97
+ if (!role) {
98
+ return false;
99
+ }
100
+ return item.roles.includes(role);
101
+ };
102
+ var navItemIsActive = (pathname, item) => {
103
+ if (item.href === "/admin") {
104
+ return pathname === "/admin";
105
+ }
106
+ return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
107
+ };
108
+
82
109
  // src/shared/studioSections.ts
83
110
  var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
111
+ var studioIcons = new Set(adminNavIcons);
84
112
  var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
85
113
  var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
86
114
  var normalizePathLikeValue = (value) => {
@@ -121,6 +149,7 @@ var normalizeCard = (value) => {
121
149
  ...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
122
150
  };
123
151
  };
152
+ var normalizeIcon = (value) => typeof value === "string" && studioIcons.has(value) ? value : void 0;
124
153
  var resolveStudioSections = (value) => {
125
154
  if (!Array.isArray(value)) {
126
155
  return [];
@@ -146,6 +175,7 @@ var resolveStudioSections = (value) => {
146
175
  label,
147
176
  href,
148
177
  matchPrefixes,
178
+ ...normalizeIcon(entry.icon) ? { icon: normalizeIcon(entry.icon) } : {},
149
179
  ...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
150
180
  ...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
151
181
  });
@@ -211,17 +241,28 @@ function configureAdmin(config) {
211
241
  brandPrimary = "#3b82f6",
212
242
  brandSecondary = "#8b5cf6",
213
243
  defaultTheme = "brand-light",
214
- logoUrl
244
+ logoUrl,
245
+ allowThemePreference = false
215
246
  } = config;
216
247
  const studioEnabled = config.studio?.enabled ?? true;
248
+ const formsEnabled = config.studio?.forms?.enabled ?? false;
249
+ const formsCollectionSlug = config.studio?.forms?.collectionSlug || "forms";
250
+ const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
251
+ const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
217
252
  const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
253
+ const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
218
254
  const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
219
- const contactFormStudioPath = "/studio-contact-form";
255
+ const globalsBasePath = "/site-globals";
256
+ const pagesBasePath = "/pages";
257
+ const formsBasePath = "/forms";
258
+ const mediaBasePath = "/media";
259
+ const toolsBasePath = "/tools";
260
+ const contactFormStudioPath = "/contact-form";
220
261
  const configuredGlobals = config.studio?.globals || [
221
262
  { slug: "site-settings", label: "Website Settings" },
222
263
  { slug: "header", label: "Header & Navigation" },
223
264
  { slug: "footer", label: "Footer" },
224
- { slug: "contact-form", label: "Contact Form" }
265
+ { slug: "social-media", label: "Social Media" }
225
266
  ];
226
267
  const globals = configuredGlobals.map((global) => {
227
268
  if (global.slug !== "contact-form" || global.href) {
@@ -234,24 +275,78 @@ function configureAdmin(config) {
234
275
  });
235
276
  const studioSections = resolveStudioSections(config.studio?.sections || []);
236
277
  const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
278
+ const sitePreview = config.studio?.sitePreview;
237
279
  let cssPath;
238
280
  const pkgDist = getPkgDistDir();
239
281
  const sourceCssPath = import_path.default.resolve(pkgDist, "admin.css");
240
- if (config.basePath && import_fs.default.existsSync(sourceCssPath)) {
241
- let css = import_fs.default.readFileSync(sourceCssPath, "utf-8");
242
- css = css.replace("--brand-primary: #3b82f6;", `--brand-primary: ${brandPrimary};`);
243
- css = css.replace("--brand-secondary: #8b5cf6;", `--brand-secondary: ${brandSecondary};`);
244
- const genDir = import_path.default.resolve(config.basePath, ".generated");
282
+ const adminAppCssPath = import_path.default.resolve(pkgDist, "admin-app", "styles.css");
283
+ const cssSources = [sourceCssPath, adminAppCssPath].filter((filePath) => import_fs.default.existsSync(filePath));
284
+ if (cssSources.length === 0) {
285
+ cssPath = sourceCssPath;
286
+ } else {
287
+ let css = cssSources.map((filePath) => import_fs.default.readFileSync(filePath, "utf-8")).join("\n\n");
288
+ css = css.replace(
289
+ "--orion-cms-brand-primary-fallback: #3b82f6;",
290
+ `--orion-cms-brand-primary-fallback: ${brandPrimary};`
291
+ );
292
+ css = css.replace(
293
+ "--orion-cms-brand-secondary-fallback: #8b5cf6;",
294
+ `--orion-cms-brand-secondary-fallback: ${brandSecondary};`
295
+ );
296
+ const outputBasePath = config.basePath || process.cwd();
297
+ const genDir = import_path.default.resolve(outputBasePath, ".generated");
245
298
  if (!import_fs.default.existsSync(genDir)) {
246
299
  import_fs.default.mkdirSync(genDir, { recursive: true });
247
300
  }
248
301
  const genPath = import_path.default.resolve(genDir, "admin.css");
249
302
  import_fs.default.writeFileSync(genPath, css);
250
303
  cssPath = genPath;
251
- } else {
252
- cssPath = sourceCssPath;
253
304
  }
254
305
  const clientPath = "@orion-studios/payload-studio/admin/client";
306
+ const studioNavClientProps = {
307
+ brandName,
308
+ formSubmissionsCollectionSlug,
309
+ formsCollectionSlug,
310
+ formsEnabled,
311
+ formUploadsCollectionSlug,
312
+ globalsBasePath,
313
+ globalsExtraMatchPrefixes: [contactFormStudioPath],
314
+ logoUrl,
315
+ mediaCollectionSlug,
316
+ pagesCollectionSlug,
317
+ sections: studioSections
318
+ };
319
+ const studioBackBreadcrumbComponent = {
320
+ exportName: "StudioBackBreadcrumb",
321
+ path: clientPath
322
+ };
323
+ const hasMatchingComponent = (items, exportName) => Array.isArray(items) && items.some(
324
+ (item) => item && typeof item === "object" && item.exportName === exportName && item.path === clientPath
325
+ );
326
+ const appendComponent = (items, component, exportName) => hasMatchingComponent(items, exportName) ? items || [] : [...items || [], component];
327
+ const attachStudioBackBreadcrumbToCollection = (collection) => {
328
+ if (!studioEnabled) {
329
+ return collection;
330
+ }
331
+ const existingBeforeDocumentControls = collection.admin?.components?.edit?.beforeDocumentControls;
332
+ return {
333
+ ...collection,
334
+ admin: {
335
+ ...collection.admin,
336
+ components: {
337
+ ...collection.admin?.components,
338
+ edit: {
339
+ ...collection.admin?.components?.edit,
340
+ beforeDocumentControls: appendComponent(
341
+ existingBeforeDocumentControls,
342
+ studioBackBreadcrumbComponent,
343
+ "StudioBackBreadcrumb"
344
+ )
345
+ }
346
+ }
347
+ }
348
+ };
349
+ };
255
350
  return {
256
351
  admin: {
257
352
  css: cssPath,
@@ -260,15 +355,7 @@ function configureAdmin(config) {
260
355
  Nav: {
261
356
  exportName: "AdminStudioNav",
262
357
  path: clientPath,
263
- clientProps: {
264
- brandName,
265
- logoUrl,
266
- globalsBasePath: "/studio-globals",
267
- globalsExtraMatchPrefixes: [contactFormStudioPath],
268
- mediaCollectionSlug,
269
- pagesCollectionSlug,
270
- sections: studioSections
271
- }
358
+ clientProps: studioNavClientProps
272
359
  }
273
360
  } : {},
274
361
  graphics: {
@@ -294,37 +381,113 @@ function configureAdmin(config) {
294
381
  Component: {
295
382
  exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
296
383
  path: clientPath,
297
- clientProps: {
298
- brandName,
299
- logoUrl,
300
- globalsBasePath: "/studio-globals",
301
- globalsExtraMatchPrefixes: [contactFormStudioPath],
302
- mediaCollectionSlug,
303
- pagesCollectionSlug,
304
- sections: studioSections
305
- }
384
+ clientProps: studioNavClientProps
306
385
  }
307
386
  },
308
387
  ...studioEnabled ? {
309
388
  studioGlobals: {
310
- path: "/studio-globals",
389
+ path: globalsBasePath,
311
390
  Component: {
312
391
  exportName: "AdminStudioGlobalsView",
313
392
  path: clientPath,
314
393
  clientProps: {
394
+ ...studioNavClientProps,
315
395
  globals,
316
- globalsBasePath: "/studio-globals"
396
+ globalsBasePath
397
+ }
398
+ }
399
+ },
400
+ studioPages: {
401
+ path: pagesBasePath,
402
+ Component: {
403
+ exportName: "AdminStudioPagesListView",
404
+ path: clientPath,
405
+ clientProps: {
406
+ ...studioNavClientProps,
407
+ pagesCollectionSlug
408
+ }
409
+ }
410
+ },
411
+ studioPageEditor: {
412
+ path: `${pagesBasePath}/:id`,
413
+ Component: {
414
+ exportName: "AdminStudioPageEditView",
415
+ path: clientPath,
416
+ clientProps: {
417
+ ...studioNavClientProps,
418
+ builderBasePath
419
+ }
420
+ }
421
+ },
422
+ studioPageNew: {
423
+ path: `${pagesBasePath}/new`,
424
+ Component: {
425
+ exportName: "AdminStudioNewPageView",
426
+ path: clientPath,
427
+ clientProps: {
428
+ ...studioNavClientProps,
429
+ pagesCollectionSlug
317
430
  }
318
431
  }
319
432
  },
320
433
  studioContactForm: {
321
- path: "/studio-contact-form",
434
+ path: contactFormStudioPath,
322
435
  Component: {
323
436
  exportName: "AdminStudioContactFormView",
324
437
  path: clientPath,
325
438
  clientProps: {
439
+ ...studioNavClientProps,
326
440
  globalSlug: "contact-form",
327
- globalsBasePath: "/studio-globals"
441
+ globalsBasePath
442
+ }
443
+ }
444
+ },
445
+ ...formsEnabled ? {
446
+ studioForms: {
447
+ path: formsBasePath,
448
+ Component: {
449
+ exportName: "AdminStudioFormsView",
450
+ path: clientPath,
451
+ clientProps: {
452
+ ...studioNavClientProps,
453
+ formsCollectionSlug,
454
+ formSubmissionsCollectionSlug,
455
+ formUploadsCollectionSlug
456
+ }
457
+ }
458
+ }
459
+ } : {},
460
+ studioMedia: {
461
+ path: mediaBasePath,
462
+ Component: {
463
+ exportName: "AdminStudioMediaView",
464
+ path: clientPath,
465
+ clientProps: {
466
+ ...studioNavClientProps,
467
+ mediaCollectionSlug
468
+ }
469
+ }
470
+ },
471
+ studioMediaItem: {
472
+ path: `${mediaBasePath}/:id`,
473
+ Component: {
474
+ exportName: "AdminStudioMediaItemView",
475
+ path: clientPath,
476
+ clientProps: {
477
+ ...studioNavClientProps,
478
+ mediaCollectionSlug
479
+ }
480
+ }
481
+ },
482
+ studioTools: {
483
+ path: toolsBasePath,
484
+ Component: {
485
+ exportName: "AdminStudioToolsView",
486
+ path: clientPath,
487
+ clientProps: {
488
+ ...studioNavClientProps,
489
+ mediaCollectionSlug,
490
+ pagesCollectionSlug
328
491
  }
329
492
  }
330
493
  },
@@ -333,7 +496,13 @@ function configureAdmin(config) {
333
496
  id,
334
497
  {
335
498
  path: view.path,
336
- Component: view.Component
499
+ Component: {
500
+ ...view.Component,
501
+ clientProps: {
502
+ ...studioNavClientProps,
503
+ ...view.Component.clientProps || {}
504
+ }
505
+ }
337
506
  }
338
507
  ])
339
508
  )
@@ -344,19 +513,39 @@ function configureAdmin(config) {
344
513
  exportName: "ThemeProvider",
345
514
  path: clientPath,
346
515
  clientProps: {
516
+ allowThemePreference,
347
517
  defaultTheme
348
518
  }
349
519
  }
350
520
  ],
351
- afterNavLinks: [
521
+ beforeLogin: [
352
522
  {
353
- exportName: "ThemeSwitcher",
523
+ exportName: "AdminLoginIntro",
354
524
  path: clientPath,
355
525
  clientProps: {
356
- defaultTheme
526
+ brandName,
527
+ logoUrl
357
528
  }
358
529
  }
359
- ]
530
+ ],
531
+ afterLogin: [
532
+ {
533
+ exportName: "AdminLoginPasswordToggle",
534
+ path: clientPath
535
+ }
536
+ ],
537
+ ...allowThemePreference ? {
538
+ afterNavLinks: [
539
+ {
540
+ exportName: "ThemeSwitcher",
541
+ path: clientPath,
542
+ clientProps: {
543
+ allowThemePreference,
544
+ defaultTheme
545
+ }
546
+ }
547
+ ]
548
+ } : {}
360
549
  },
361
550
  meta: {
362
551
  titleSuffix: ` \u2014 ${brandName}`
@@ -371,11 +560,77 @@ function configureAdmin(config) {
371
560
  const hasThemePreference = existingFields.some(
372
561
  (field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
373
562
  );
374
- return {
563
+ const nextCollection = {
375
564
  ...usersCollection,
376
- fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
565
+ fields: !allowThemePreference || hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
566
+ };
567
+ return attachStudioBackBreadcrumbToCollection(nextCollection);
568
+ },
569
+ wrapPagesCollection(pagesCollection) {
570
+ if (!studioEnabled) {
571
+ return pagesCollection;
572
+ }
573
+ const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(pagesCollection);
574
+ const existingEditMenuItems = collectionWithBreadcrumb.admin?.components?.edit?.editMenuItems;
575
+ const existingViews = collectionWithBreadcrumb.admin?.components?.views;
576
+ const existingEditViews = existingViews?.edit;
577
+ const hasCustomEditView = Boolean(
578
+ existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
579
+ );
580
+ return {
581
+ ...collectionWithBreadcrumb,
582
+ admin: {
583
+ ...collectionWithBreadcrumb.admin,
584
+ components: {
585
+ ...collectionWithBreadcrumb.admin?.components,
586
+ edit: {
587
+ ...collectionWithBreadcrumb.admin?.components?.edit,
588
+ editMenuItems: appendComponent(
589
+ existingEditMenuItems,
590
+ {
591
+ exportName: "OpenInStudioMenuItem",
592
+ path: clientPath,
593
+ clientProps: {
594
+ pagesPathBase: pagesBasePath
595
+ }
596
+ },
597
+ "OpenInStudioMenuItem"
598
+ )
599
+ },
600
+ views: {
601
+ ...existingViews,
602
+ ...hasCustomEditView ? {} : {
603
+ edit: {
604
+ ...existingEditViews,
605
+ default: {
606
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
607
+ Component: {
608
+ exportName: "PageEditRedirectToStudio",
609
+ path: clientPath,
610
+ clientProps: {
611
+ pagesPathBase: pagesBasePath
612
+ }
613
+ }
614
+ }
615
+ }
616
+ }
617
+ }
618
+ }
619
+ }
377
620
  };
378
621
  },
622
+ wrapMediaCollection(mediaCollection) {
623
+ return attachStudioBackBreadcrumbToCollection(mediaCollection);
624
+ },
625
+ wrapFormsCollection(formsCollection) {
626
+ return attachStudioBackBreadcrumbToCollection(formsCollection);
627
+ },
628
+ wrapFormSubmissionsCollection(formSubmissionsCollection) {
629
+ return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
630
+ },
631
+ wrapFormUploadsCollection(formUploadsCollection) {
632
+ return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
633
+ },
379
634
  wrapGlobals(globals2) {
380
635
  const labelMap = {
381
636
  header: { group: "Site Design", label: "Header & Navigation" },
@@ -387,25 +642,110 @@ function configureAdmin(config) {
387
642
  return globals2.map((global) => {
388
643
  const mapping = labelMap[global.slug];
389
644
  if (!mapping) return global;
645
+ const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
646
+ const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
390
647
  const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
648
+ const shouldAttachHeaderEditView = studioEnabled && global.slug === "header";
649
+ const shouldAttachFooterEditView = studioEnabled && global.slug === "footer";
391
650
  const existingViews = global.admin?.components?.views;
392
651
  const existingEditViews = existingViews?.edit;
393
- const hasCustomContactFormEditView = Boolean(
652
+ const hasCustomEditView = Boolean(
394
653
  existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
395
654
  );
396
- const contactFormEditViews = shouldAttachContactFormRedirect && !hasCustomContactFormEditView ? {
397
- ...existingEditViews,
398
- default: {
399
- ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
400
- Component: {
401
- exportName: "StudioContactFormRedirect",
402
- path: clientPath,
403
- clientProps: {
404
- studioContactFormPath: contactFormStudioPath
655
+ const nextEditViews = (() => {
656
+ if (shouldAttachSiteSettingsEditView && !hasCustomEditView) {
657
+ return {
658
+ ...existingEditViews,
659
+ default: {
660
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
661
+ Component: {
662
+ exportName: "AdminStudioSiteSettingsGlobalView",
663
+ path: clientPath,
664
+ clientProps: {
665
+ ...studioNavClientProps,
666
+ globalSlug: global.slug,
667
+ mediaCollectionSlug
668
+ }
669
+ }
405
670
  }
406
- }
671
+ };
672
+ }
673
+ if (shouldAttachSocialMediaEditView && !hasCustomEditView) {
674
+ return {
675
+ ...existingEditViews,
676
+ default: {
677
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
678
+ Component: {
679
+ exportName: "AdminStudioSocialMediaGlobalView",
680
+ path: clientPath,
681
+ clientProps: {
682
+ ...studioNavClientProps,
683
+ globalSlug: global.slug
684
+ }
685
+ }
686
+ }
687
+ };
688
+ }
689
+ if (shouldAttachHeaderEditView && !hasCustomEditView) {
690
+ return {
691
+ ...existingEditViews,
692
+ default: {
693
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
694
+ Component: {
695
+ exportName: "AdminStudioHeaderGlobalView",
696
+ path: clientPath,
697
+ clientProps: {
698
+ ...studioNavClientProps,
699
+ actionHref: sitePreview?.header?.actionHref,
700
+ actionLabel: sitePreview?.header?.actionLabel,
701
+ globalSlug: global.slug,
702
+ locationSummary: sitePreview?.locationSummary,
703
+ pagesCollectionSlug
704
+ }
705
+ }
706
+ }
707
+ };
708
+ }
709
+ if (shouldAttachFooterEditView && !hasCustomEditView) {
710
+ return {
711
+ ...existingEditViews,
712
+ default: {
713
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
714
+ Component: {
715
+ exportName: "AdminStudioFooterGlobalView",
716
+ path: clientPath,
717
+ clientProps: {
718
+ ...studioNavClientProps,
719
+ builtByHref: sitePreview?.footer?.builtByHref,
720
+ builtByLabel: sitePreview?.footer?.builtByLabel,
721
+ description: sitePreview?.footer?.description,
722
+ footerCategories: sitePreview?.footer?.footerCategories,
723
+ footerLinks: sitePreview?.footer?.footerLinks,
724
+ globalSlug: global.slug,
725
+ locationSummary: sitePreview?.locationSummary
726
+ }
727
+ }
728
+ }
729
+ };
407
730
  }
408
- } : existingEditViews;
731
+ if (shouldAttachContactFormRedirect && !hasCustomEditView) {
732
+ return {
733
+ ...existingEditViews,
734
+ default: {
735
+ ...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
736
+ Component: {
737
+ exportName: "StudioContactFormRedirect",
738
+ path: clientPath,
739
+ clientProps: {
740
+ studioContactFormPath: contactFormStudioPath
741
+ }
742
+ }
743
+ }
744
+ };
745
+ }
746
+ return existingEditViews;
747
+ })();
748
+ const existingBeforeDocumentControls = global.admin?.components?.elements?.beforeDocumentControls;
409
749
  return {
410
750
  ...global,
411
751
  admin: {
@@ -413,12 +753,18 @@ function configureAdmin(config) {
413
753
  group: mapping.group,
414
754
  components: {
415
755
  ...global.admin?.components,
416
- ...shouldAttachContactFormRedirect ? {
756
+ elements: {
757
+ ...global.admin?.components?.elements,
758
+ beforeDocumentControls: studioEnabled ? appendComponent(
759
+ existingBeforeDocumentControls,
760
+ studioBackBreadcrumbComponent,
761
+ "StudioBackBreadcrumb"
762
+ ) : existingBeforeDocumentControls
763
+ },
764
+ ...nextEditViews ? {
417
765
  views: {
418
766
  ...existingViews,
419
- ...contactFormEditViews ? {
420
- edit: contactFormEditViews
421
- } : {}
767
+ edit: nextEditViews
422
768
  }
423
769
  } : {}
424
770
  }
@@ -885,23 +1231,6 @@ var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
885
1231
  return [];
886
1232
  };
887
1233
 
888
- // src/admin-app/routeRegistry.ts
889
- var roleCanAccessNav = (role, item) => {
890
- if (!item.roles || item.roles.length === 0) {
891
- return true;
892
- }
893
- if (!role) {
894
- return false;
895
- }
896
- return item.roles.includes(role);
897
- };
898
- var navItemIsActive = (pathname, item) => {
899
- if (item.href === "/admin") {
900
- return pathname === "/admin";
901
- }
902
- return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
903
- };
904
-
905
1234
  // src/blocks/index.ts
906
1235
  var blocks_exports = {};
907
1236
  __export(blocks_exports, {
@@ -938,208 +1267,233 @@ var sectionStyleDefaults = {
938
1267
  contentGradientAngle: "135",
939
1268
  contentGradientFrom: "#ffffff",
940
1269
  contentGradientPreset: "none",
941
- contentGradientTo: "#f4f6f2",
1270
+ contentGradientTo: "#f4f6f8",
942
1271
  contentWidth: "inherit",
943
1272
  sectionPaddingX: "inherit",
944
1273
  sectionBackgroundColor: "#ffffff",
945
1274
  sectionBackgroundMode: "none",
946
1275
  sectionGradientAngle: "135",
947
- sectionGradientFrom: "#124a37",
948
- sectionGradientPreset: "forest",
949
- sectionGradientTo: "#1f684f",
1276
+ sectionGradientFrom: "#334b63",
1277
+ sectionGradientPreset: "slate",
1278
+ sectionGradientTo: "#496582",
950
1279
  sectionPaddingY: "md",
951
1280
  sectionWidth: "content"
952
1281
  };
953
- var sectionStyleFields = () => [
954
- {
955
- name: "sectionWidth",
956
- type: "select",
957
- defaultValue: sectionStyleDefaults.sectionWidth,
958
- options: [
959
- { label: "Content", value: "content" },
960
- { label: "Wide", value: "wide" },
961
- { label: "Full", value: "full" }
962
- ]
963
- },
964
- {
965
- name: "contentWidth",
966
- type: "select",
967
- defaultValue: sectionStyleDefaults.contentWidth,
968
- options: [
969
- { label: "Inherit", value: "inherit" },
970
- { label: "Narrow", value: "narrow" },
971
- { label: "Content", value: "content" },
972
- { label: "Wide", value: "wide" },
973
- { label: "Full", value: "full" }
974
- ]
975
- },
976
- {
977
- name: "sectionPaddingY",
978
- type: "select",
979
- defaultValue: sectionStyleDefaults.sectionPaddingY,
980
- options: [
981
- { label: "None", value: "none" },
982
- { label: "Small", value: "sm" },
983
- { label: "Medium", value: "md" },
984
- { label: "Large", value: "lg" }
985
- ]
986
- },
987
- {
988
- name: "sectionPaddingX",
989
- type: "select",
990
- defaultValue: sectionStyleDefaults.sectionPaddingX,
991
- options: [
992
- { label: "Inherit", value: "inherit" },
993
- { label: "None", value: "none" },
994
- { label: "Small", value: "sm" },
995
- { label: "Medium", value: "md" },
996
- { label: "Large", value: "lg" }
997
- ]
998
- },
999
- {
1000
- name: "sectionBackgroundMode",
1001
- type: "select",
1002
- defaultValue: sectionStyleDefaults.sectionBackgroundMode,
1003
- options: [
1004
- { label: "None", value: "none" },
1005
- { label: "Color", value: "color" },
1006
- { label: "Gradient", value: "gradient" }
1007
- ]
1008
- },
1009
- {
1010
- name: "sectionBackgroundColor",
1011
- type: "text",
1012
- defaultValue: sectionStyleDefaults.sectionBackgroundColor
1013
- },
1014
- {
1015
- name: "sectionGradientPreset",
1016
- type: "select",
1017
- defaultValue: sectionStyleDefaults.sectionGradientPreset,
1018
- options: [
1019
- { label: "None", value: "none" },
1020
- { label: "Forest", value: "forest" },
1021
- { label: "Moss", value: "moss" },
1022
- { label: "Cream", value: "cream" },
1023
- { label: "Slate", value: "slate" }
1024
- ]
1025
- },
1026
- {
1027
- name: "sectionGradientFrom",
1028
- type: "text",
1029
- defaultValue: sectionStyleDefaults.sectionGradientFrom
1030
- },
1031
- {
1032
- name: "sectionGradientTo",
1033
- type: "text",
1034
- defaultValue: sectionStyleDefaults.sectionGradientTo
1035
- },
1036
- {
1037
- name: "sectionGradientAngle",
1038
- type: "text",
1039
- defaultValue: sectionStyleDefaults.sectionGradientAngle
1040
- },
1041
- {
1042
- name: "contentBackgroundMode",
1043
- type: "select",
1044
- defaultValue: sectionStyleDefaults.contentBackgroundMode,
1045
- options: [
1046
- { label: "None", value: "none" },
1047
- { label: "Color", value: "color" },
1048
- { label: "Gradient", value: "gradient" }
1049
- ]
1050
- },
1051
- {
1052
- name: "contentBackgroundColor",
1053
- type: "text",
1054
- defaultValue: sectionStyleDefaults.contentBackgroundColor
1055
- },
1056
- {
1057
- name: "contentGradientPreset",
1058
- type: "select",
1059
- defaultValue: sectionStyleDefaults.contentGradientPreset,
1060
- options: [
1061
- { label: "None", value: "none" },
1062
- { label: "Cloud", value: "cloud" },
1063
- { label: "Sand", value: "sand" },
1064
- { label: "Mint", value: "mint" },
1065
- { label: "Night", value: "night" }
1066
- ]
1067
- },
1068
- {
1069
- name: "contentGradientFrom",
1070
- type: "text",
1071
- defaultValue: sectionStyleDefaults.contentGradientFrom
1072
- },
1073
- {
1074
- name: "contentGradientTo",
1075
- type: "text",
1076
- defaultValue: sectionStyleDefaults.contentGradientTo
1077
- },
1078
- {
1079
- name: "contentGradientAngle",
1080
- type: "text",
1081
- defaultValue: sectionStyleDefaults.contentGradientAngle
1082
- }
1083
- ];
1084
-
1085
- // src/blocks/blocks/BeforeAfter.ts
1086
- var BeforeAfterBlock = {
1087
- slug: "beforeAfter",
1088
- imageURL: "/images/project-before-2.svg",
1089
- imageAltText: "Before and after section preview",
1282
+ var hideFromCMS = (field) => ({
1283
+ ...field,
1090
1284
  admin: {
1091
- components: {
1092
- Label: builderBlockLabelComponent
1093
- }
1094
- },
1095
- labels: {
1096
- singular: "Before / After",
1097
- plural: "Before / After"
1098
- },
1099
- fields: [
1285
+ ...field.admin || {},
1286
+ hidden: true
1287
+ }
1288
+ });
1289
+ var sectionStyleFields = () => {
1290
+ const fields = [
1100
1291
  {
1101
- name: "title",
1102
- type: "text",
1103
- required: true
1292
+ name: "sectionWidth",
1293
+ type: "select",
1294
+ defaultValue: sectionStyleDefaults.sectionWidth,
1295
+ options: [
1296
+ { label: "Content", value: "content" },
1297
+ { label: "Wide", value: "wide" },
1298
+ { label: "Full", value: "full" }
1299
+ ]
1104
1300
  },
1105
1301
  {
1106
- name: "subtitle",
1107
- type: "textarea"
1302
+ name: "contentWidth",
1303
+ type: "select",
1304
+ defaultValue: sectionStyleDefaults.contentWidth,
1305
+ options: [
1306
+ { label: "Inherit", value: "inherit" },
1307
+ { label: "Narrow", value: "narrow" },
1308
+ { label: "Content", value: "content" },
1309
+ { label: "Wide", value: "wide" },
1310
+ { label: "Full", value: "full" }
1311
+ ]
1108
1312
  },
1109
1313
  {
1110
- name: "itemsPerRow",
1111
- type: "number",
1112
- defaultValue: 2,
1113
- min: 1,
1114
- max: 4,
1115
- admin: {
1116
- description: "How many project cards to show per row on desktop.",
1117
- step: 1
1118
- }
1314
+ name: "sectionPaddingY",
1315
+ type: "select",
1316
+ defaultValue: sectionStyleDefaults.sectionPaddingY,
1317
+ options: [
1318
+ { label: "None", value: "none" },
1319
+ { label: "Small", value: "sm" },
1320
+ { label: "Medium", value: "md" },
1321
+ { label: "Large", value: "lg" }
1322
+ ]
1119
1323
  },
1120
1324
  {
1121
- name: "items",
1122
- type: "array",
1123
- minRows: 1,
1124
- maxRows: 30,
1125
- fields: [
1126
- {
1127
- name: "label",
1128
- type: "text",
1129
- required: true
1130
- },
1131
- {
1132
- name: "beforeMedia",
1133
- type: "upload",
1134
- relationTo: "media",
1135
- required: false
1136
- },
1325
+ name: "sectionPaddingX",
1326
+ type: "select",
1327
+ defaultValue: sectionStyleDefaults.sectionPaddingX,
1328
+ options: [
1329
+ { label: "Inherit", value: "inherit" },
1330
+ { label: "None", value: "none" },
1331
+ { label: "Small", value: "sm" },
1332
+ { label: "Medium", value: "md" },
1333
+ { label: "Large", value: "lg" }
1334
+ ]
1335
+ },
1336
+ {
1337
+ name: "sectionBackgroundMode",
1338
+ type: "select",
1339
+ defaultValue: sectionStyleDefaults.sectionBackgroundMode,
1340
+ options: [
1341
+ { label: "None", value: "none" },
1342
+ { label: "Color", value: "color" },
1343
+ { label: "Gradient", value: "gradient" }
1344
+ ]
1345
+ },
1346
+ {
1347
+ name: "sectionBackgroundColor",
1348
+ type: "text",
1349
+ defaultValue: sectionStyleDefaults.sectionBackgroundColor
1350
+ },
1351
+ {
1352
+ name: "sectionGradientPreset",
1353
+ type: "select",
1354
+ defaultValue: sectionStyleDefaults.sectionGradientPreset,
1355
+ options: [
1356
+ { label: "None", value: "none" },
1357
+ { label: "Brand", value: "brand" },
1358
+ { label: "Forest", value: "forest" },
1359
+ { label: "Moss", value: "moss" },
1360
+ { label: "Cream", value: "cream" },
1361
+ { label: "Slate", value: "slate" }
1362
+ ]
1363
+ },
1364
+ {
1365
+ name: "sectionGradientFrom",
1366
+ type: "text",
1367
+ defaultValue: sectionStyleDefaults.sectionGradientFrom
1368
+ },
1369
+ {
1370
+ name: "sectionGradientTo",
1371
+ type: "text",
1372
+ defaultValue: sectionStyleDefaults.sectionGradientTo
1373
+ },
1374
+ {
1375
+ name: "sectionGradientAngle",
1376
+ type: "text",
1377
+ defaultValue: sectionStyleDefaults.sectionGradientAngle
1378
+ },
1379
+ {
1380
+ name: "contentBackgroundMode",
1381
+ type: "select",
1382
+ defaultValue: sectionStyleDefaults.contentBackgroundMode,
1383
+ options: [
1384
+ { label: "None", value: "none" },
1385
+ { label: "Color", value: "color" },
1386
+ { label: "Gradient", value: "gradient" }
1387
+ ]
1388
+ },
1389
+ {
1390
+ name: "contentBackgroundColor",
1391
+ type: "text",
1392
+ defaultValue: sectionStyleDefaults.contentBackgroundColor
1393
+ },
1394
+ {
1395
+ name: "contentGradientPreset",
1396
+ type: "select",
1397
+ defaultValue: sectionStyleDefaults.contentGradientPreset,
1398
+ options: [
1399
+ { label: "None", value: "none" },
1400
+ { label: "Cloud", value: "cloud" },
1401
+ { label: "Sand", value: "sand" },
1402
+ { label: "Mint", value: "mint" },
1403
+ { label: "Night", value: "night" }
1404
+ ]
1405
+ },
1406
+ {
1407
+ name: "contentGradientFrom",
1408
+ type: "text",
1409
+ defaultValue: sectionStyleDefaults.contentGradientFrom
1410
+ },
1411
+ {
1412
+ name: "contentGradientTo",
1413
+ type: "text",
1414
+ defaultValue: sectionStyleDefaults.contentGradientTo
1415
+ },
1416
+ {
1417
+ name: "contentGradientAngle",
1418
+ type: "text",
1419
+ defaultValue: sectionStyleDefaults.contentGradientAngle
1420
+ }
1421
+ ];
1422
+ return fields.map(hideFromCMS);
1423
+ };
1424
+
1425
+ // src/blocks/blocks/BeforeAfter.ts
1426
+ var BeforeAfterBlock = {
1427
+ slug: "beforeAfter",
1428
+ imageURL: "/images/project-before-2.svg",
1429
+ imageAltText: "Before and after section preview",
1430
+ admin: {
1431
+ components: {
1432
+ Label: builderBlockLabelComponent
1433
+ }
1434
+ },
1435
+ labels: {
1436
+ singular: "Before / After",
1437
+ plural: "Before / After"
1438
+ },
1439
+ fields: [
1440
+ {
1441
+ name: "title",
1442
+ type: "text",
1443
+ required: true
1444
+ },
1445
+ {
1446
+ name: "subtitle",
1447
+ type: "textarea"
1448
+ },
1449
+ {
1450
+ name: "itemsPerRow",
1451
+ type: "number",
1452
+ defaultValue: 2,
1453
+ min: 1,
1454
+ max: 4,
1455
+ admin: {
1456
+ description: "How many project cards to show per row on desktop.",
1457
+ step: 1
1458
+ }
1459
+ },
1460
+ {
1461
+ name: "items",
1462
+ type: "array",
1463
+ minRows: 1,
1464
+ maxRows: 30,
1465
+ fields: [
1466
+ {
1467
+ name: "label",
1468
+ type: "text",
1469
+ required: true
1470
+ },
1471
+ {
1472
+ name: "beforeMedia",
1473
+ type: "upload",
1474
+ relationTo: "media",
1475
+ required: false
1476
+ },
1477
+ {
1478
+ name: "beforeImageURL",
1479
+ type: "text",
1480
+ admin: {
1481
+ description: "Optional direct URL for the before image when using an external asset."
1482
+ }
1483
+ },
1137
1484
  {
1138
1485
  name: "afterMedia",
1139
1486
  type: "upload",
1140
1487
  relationTo: "media",
1141
1488
  required: false
1142
1489
  },
1490
+ {
1491
+ name: "afterImageURL",
1492
+ type: "text",
1493
+ admin: {
1494
+ description: "Optional direct URL for the after image when using an external asset."
1495
+ }
1496
+ },
1143
1497
  {
1144
1498
  name: "imageHeight",
1145
1499
  type: "number",
@@ -1295,6 +1649,10 @@ var CtaBlock = {
1295
1649
  name: "description",
1296
1650
  type: "textarea"
1297
1651
  },
1652
+ {
1653
+ name: "eyebrow",
1654
+ type: "text"
1655
+ },
1298
1656
  {
1299
1657
  name: "buttonLabel",
1300
1658
  type: "text"
@@ -1325,9 +1683,33 @@ var CtaBlock = {
1325
1683
  name: "backgroundColor",
1326
1684
  type: "text",
1327
1685
  admin: {
1328
- description: "Optional background color override for the CTA strip (example: #124a37)."
1686
+ description: "Optional background color override for the CTA strip (example: #334b63)."
1687
+ }
1688
+ },
1689
+ {
1690
+ name: "media",
1691
+ type: "upload",
1692
+ relationTo: "media",
1693
+ required: false
1694
+ },
1695
+ {
1696
+ name: "imageURL",
1697
+ type: "text",
1698
+ admin: {
1699
+ description: "Optional direct image URL when this CTA should use an external image."
1329
1700
  }
1330
1701
  },
1702
+ {
1703
+ name: "bullets",
1704
+ type: "array",
1705
+ fields: [
1706
+ {
1707
+ name: "label",
1708
+ type: "text",
1709
+ required: true
1710
+ }
1711
+ ]
1712
+ },
1331
1713
  {
1332
1714
  name: "settings",
1333
1715
  type: "json",
@@ -1355,6 +1737,10 @@ var FaqBlock = {
1355
1737
  plural: "FAQs"
1356
1738
  },
1357
1739
  fields: [
1740
+ {
1741
+ name: "eyebrow",
1742
+ type: "text"
1743
+ },
1358
1744
  {
1359
1745
  name: "title",
1360
1746
  type: "text",
@@ -1412,10 +1798,17 @@ var FeatureGridBlock = {
1412
1798
  plural: "Feature Grids"
1413
1799
  },
1414
1800
  fields: [
1801
+ {
1802
+ name: "eyebrow",
1803
+ type: "text"
1804
+ },
1415
1805
  {
1416
1806
  name: "title",
1417
- type: "text",
1418
- required: true
1807
+ type: "text"
1808
+ },
1809
+ {
1810
+ name: "subtitle",
1811
+ type: "textarea"
1419
1812
  },
1420
1813
  {
1421
1814
  name: "itemsPerRow",
@@ -1443,6 +1836,16 @@ var FeatureGridBlock = {
1443
1836
  name: "description",
1444
1837
  type: "textarea"
1445
1838
  },
1839
+ {
1840
+ name: "tone",
1841
+ type: "select",
1842
+ defaultValue: "warm",
1843
+ options: [
1844
+ { label: "Warm", value: "warm" },
1845
+ { label: "Cool", value: "cool" },
1846
+ { label: "Neutral", value: "neutral" }
1847
+ ]
1848
+ },
1446
1849
  {
1447
1850
  name: "iconType",
1448
1851
  type: "select",
@@ -1488,6 +1891,39 @@ var FeatureGridBlock = {
1488
1891
  relationTo: "media",
1489
1892
  required: false
1490
1893
  },
1894
+ {
1895
+ name: "imageURL",
1896
+ type: "text",
1897
+ admin: {
1898
+ description: "Optional direct image URL when this item should use an external image."
1899
+ }
1900
+ },
1901
+ {
1902
+ name: "embedURL",
1903
+ type: "text",
1904
+ admin: {
1905
+ description: "Optional iframe/embed URL for items like maps or other embedded content."
1906
+ }
1907
+ },
1908
+ {
1909
+ name: "buttonLabel",
1910
+ type: "text"
1911
+ },
1912
+ {
1913
+ name: "buttonHref",
1914
+ type: "text"
1915
+ },
1916
+ {
1917
+ name: "bullets",
1918
+ type: "array",
1919
+ fields: [
1920
+ {
1921
+ name: "label",
1922
+ type: "text",
1923
+ required: true
1924
+ }
1925
+ ]
1926
+ },
1491
1927
  {
1492
1928
  name: "imageHeight",
1493
1929
  type: "number",
@@ -1570,6 +2006,22 @@ var FeatureGridBlock = {
1570
2006
  {
1571
2007
  label: "Highlight",
1572
2008
  value: "highlight"
2009
+ },
2010
+ {
2011
+ label: "Split List",
2012
+ value: "splitList"
2013
+ },
2014
+ {
2015
+ label: "Panels",
2016
+ value: "panels"
2017
+ },
2018
+ {
2019
+ label: "Catalog",
2020
+ value: "catalog"
2021
+ },
2022
+ {
2023
+ label: "Contact Split",
2024
+ value: "contact"
1573
2025
  }
1574
2026
  ]
1575
2027
  },
@@ -1577,7 +2029,7 @@ var FeatureGridBlock = {
1577
2029
  name: "backgroundColor",
1578
2030
  type: "text",
1579
2031
  admin: {
1580
- description: "Optional background color override when using the Highlight variant (example: #1f684f)."
2032
+ description: "Optional background color override when using the Highlight variant (example: #334b63)."
1581
2033
  }
1582
2034
  },
1583
2035
  {
@@ -1607,6 +2059,10 @@ var FormEmbedBlock = {
1607
2059
  plural: "Form Embeds"
1608
2060
  },
1609
2061
  fields: [
2062
+ {
2063
+ name: "eyebrow",
2064
+ type: "text"
2065
+ },
1610
2066
  {
1611
2067
  name: "title",
1612
2068
  type: "text"
@@ -1615,6 +2071,10 @@ var FormEmbedBlock = {
1615
2071
  name: "description",
1616
2072
  type: "textarea"
1617
2073
  },
2074
+ {
2075
+ name: "submitLabel",
2076
+ type: "text"
2077
+ },
1618
2078
  {
1619
2079
  name: "formType",
1620
2080
  type: "select",
@@ -1696,6 +2156,13 @@ var HeroBlock = {
1696
2156
  type: "upload",
1697
2157
  relationTo: "media"
1698
2158
  },
2159
+ {
2160
+ name: "backgroundImageURL",
2161
+ type: "text",
2162
+ admin: {
2163
+ description: "Optional direct image URL when the hero should use an external image source."
2164
+ }
2165
+ },
1699
2166
  {
1700
2167
  name: "backgroundImageFit",
1701
2168
  type: "select",
@@ -1741,7 +2208,7 @@ var HeroBlock = {
1741
2208
  name: "backgroundColor",
1742
2209
  type: "text",
1743
2210
  admin: {
1744
- description: "Optional background color override (example: #124a37)."
2211
+ description: "Optional background color override (example: #334b63)."
1745
2212
  }
1746
2213
  },
1747
2214
  {
@@ -1779,14 +2246,14 @@ var HeroBlock = {
1779
2246
  name: "backgroundOverlayGradientFrom",
1780
2247
  type: "text",
1781
2248
  admin: {
1782
- description: "Gradient overlay start color (example: #0d4a37). Used when Overlay Mode is Gradient."
2249
+ description: "Gradient overlay start color (example: #334b63). Used when Overlay Mode is Gradient."
1783
2250
  }
1784
2251
  },
1785
2252
  {
1786
2253
  name: "backgroundOverlayGradientTo",
1787
2254
  type: "text",
1788
2255
  admin: {
1789
- description: "Gradient overlay end color (example: #1f684f). Used when Overlay Mode is Gradient."
2256
+ description: "Gradient overlay end color (example: #496582). Used when Overlay Mode is Gradient."
1790
2257
  }
1791
2258
  },
1792
2259
  {
@@ -1941,6 +2408,13 @@ var LogoWallBlock = {
1941
2408
  relationTo: "media",
1942
2409
  required: false
1943
2410
  },
2411
+ {
2412
+ name: "imageURL",
2413
+ type: "text",
2414
+ admin: {
2415
+ description: "Optional direct image URL for this logo when using an external asset."
2416
+ }
2417
+ },
1944
2418
  {
1945
2419
  name: "imageHeight",
1946
2420
  type: "number",
@@ -2046,7 +2520,14 @@ var MediaBlock = {
2046
2520
  name: "image",
2047
2521
  type: "upload",
2048
2522
  relationTo: "media",
2049
- required: true
2523
+ required: false
2524
+ },
2525
+ {
2526
+ name: "imageURL",
2527
+ type: "text",
2528
+ admin: {
2529
+ description: "Optional direct image URL when this section should use an external image."
2530
+ }
2050
2531
  },
2051
2532
  {
2052
2533
  name: "caption",
@@ -2124,6 +2605,21 @@ var RichTextBlock = {
2124
2605
  plural: "Rich Text Sections"
2125
2606
  },
2126
2607
  fields: [
2608
+ {
2609
+ name: "variant",
2610
+ type: "select",
2611
+ defaultValue: "default",
2612
+ options: [
2613
+ {
2614
+ label: "Default",
2615
+ value: "default"
2616
+ },
2617
+ {
2618
+ label: "Quote Banner",
2619
+ value: "quoteBanner"
2620
+ }
2621
+ ]
2622
+ },
2127
2623
  {
2128
2624
  name: "title",
2129
2625
  type: "text"
@@ -2134,36 +2630,84 @@ var RichTextBlock = {
2134
2630
  required: true
2135
2631
  },
2136
2632
  {
2137
- name: "width",
2138
- type: "select",
2139
- defaultValue: "normal",
2140
- options: [
2633
+ name: "statsItems",
2634
+ type: "array",
2635
+ fields: [
2141
2636
  {
2142
- label: "Normal",
2143
- value: "normal"
2637
+ name: "value",
2638
+ type: "text",
2639
+ required: true
2144
2640
  },
2145
2641
  {
2146
- label: "Narrow",
2147
- value: "narrow"
2642
+ name: "label",
2643
+ type: "text",
2644
+ required: true
2148
2645
  }
2149
2646
  ]
2150
2647
  },
2151
2648
  {
2152
- name: "settings",
2153
- type: "json",
2154
- admin: {
2155
- description: "Internal builder settings schema v2.",
2156
- hidden: true
2157
- }
2158
- },
2159
- ...sectionStyleFields()
2160
- ]
2161
- };
2162
-
2163
- // src/blocks/blocks/Stats.ts
2164
- var StatsBlock = {
2165
- slug: "stats",
2166
- imageURL: "/images/service-removal.svg",
2649
+ name: "cards",
2650
+ type: "array",
2651
+ fields: [
2652
+ {
2653
+ name: "eyebrow",
2654
+ type: "text"
2655
+ },
2656
+ {
2657
+ name: "title",
2658
+ type: "text",
2659
+ required: true
2660
+ },
2661
+ {
2662
+ name: "description",
2663
+ type: "textarea"
2664
+ },
2665
+ {
2666
+ name: "media",
2667
+ type: "upload",
2668
+ relationTo: "media",
2669
+ required: false
2670
+ },
2671
+ {
2672
+ name: "imageURL",
2673
+ type: "text",
2674
+ admin: {
2675
+ description: "Optional direct image URL when this card should use an external image."
2676
+ }
2677
+ }
2678
+ ]
2679
+ },
2680
+ {
2681
+ name: "width",
2682
+ type: "select",
2683
+ defaultValue: "normal",
2684
+ options: [
2685
+ {
2686
+ label: "Normal",
2687
+ value: "normal"
2688
+ },
2689
+ {
2690
+ label: "Narrow",
2691
+ value: "narrow"
2692
+ }
2693
+ ]
2694
+ },
2695
+ {
2696
+ name: "settings",
2697
+ type: "json",
2698
+ admin: {
2699
+ description: "Internal builder settings schema v2.",
2700
+ hidden: true
2701
+ }
2702
+ },
2703
+ ...sectionStyleFields()
2704
+ ]
2705
+ };
2706
+
2707
+ // src/blocks/blocks/Stats.ts
2708
+ var StatsBlock = {
2709
+ slug: "stats",
2710
+ imageURL: "/images/service-removal.svg",
2167
2711
  imageAltText: "Stats section preview",
2168
2712
  admin: {
2169
2713
  components: {
@@ -2387,18 +2931,18 @@ var sectionPresets = [
2387
2931
  blocks: [
2388
2932
  {
2389
2933
  blockType: "hero",
2390
- kicker: "Licensed + Insured",
2391
- headline: "Expert Tree Care for Central Texas",
2392
- subheadline: "Reliable trimming, safe removals, and stump grinding for residential and commercial properties.",
2393
- primaryLabel: "Get Your Free Quote",
2934
+ kicker: "Trusted Team",
2935
+ headline: "A clear headline for your primary offer",
2936
+ subheadline: "Explain what you offer, who it is for, and why it matters in one strong supporting sentence.",
2937
+ primaryLabel: "Get Started",
2394
2938
  primaryHref: "/contact",
2395
- secondaryLabel: "See Our Work",
2396
- secondaryHref: "/portfolio"
2939
+ secondaryLabel: "Learn More",
2940
+ secondaryHref: "/about"
2397
2941
  },
2398
2942
  {
2399
2943
  blockType: "cta",
2400
- headline: "Need a quote this week?",
2401
- description: "Call (512) 555-0149 or request an on-site estimate online.",
2944
+ headline: "Ready for the next step?",
2945
+ description: "Use a short call to action with a direct path to contact or purchase.",
2402
2946
  buttonLabel: "Contact Us",
2403
2947
  buttonHref: "/contact",
2404
2948
  style: "light"
@@ -2416,19 +2960,19 @@ var sectionPresets = [
2416
2960
  variant: "cards",
2417
2961
  items: [
2418
2962
  {
2419
- title: "Tree Trimming & Pruning",
2420
- description: "Canopy balancing, deadwood removal, and seasonal pruning.",
2421
- icon: "Trim"
2963
+ title: "Service One",
2964
+ description: "Briefly describe this offer or outcome.",
2965
+ icon: "01"
2422
2966
  },
2423
2967
  {
2424
- title: "Safe Tree Removal",
2425
- description: "Controlled removal for hazardous or unstable trees.",
2426
- icon: "Remove"
2968
+ title: "Service Two",
2969
+ description: "Briefly describe this offer or outcome.",
2970
+ icon: "02"
2427
2971
  },
2428
2972
  {
2429
- title: "Stump Grinding",
2430
- description: "Below-grade stump grinding and cleanup.",
2431
- icon: "Stump"
2973
+ title: "Service Three",
2974
+ description: "Briefly describe this offer or outcome.",
2975
+ icon: "03"
2432
2976
  }
2433
2977
  ]
2434
2978
  }
@@ -2444,15 +2988,15 @@ var sectionPresets = [
2444
2988
  title: "What Homeowners Say",
2445
2989
  items: [
2446
2990
  {
2447
- quote: "Great communication, fair pricing, and the cleanup was perfect. We will use them again.",
2448
- name: "Katie M.",
2449
- location: "Austin, TX",
2991
+ quote: "The experience was smooth, thoughtful, and exactly what we hoped for.",
2992
+ name: "Customer Name",
2993
+ location: "City, ST",
2450
2994
  rating: 5
2451
2995
  },
2452
2996
  {
2453
- quote: "They removed a dangerous limb over our driveway quickly and safely.",
2454
- name: "James R.",
2455
- location: "Round Rock, TX",
2997
+ quote: "Fast communication, strong service, and a result we would happily recommend.",
2998
+ name: "Customer Name",
2999
+ location: "City, ST",
2456
3000
  rating: 5
2457
3001
  }
2458
3002
  ]
@@ -2462,12 +3006,12 @@ var sectionPresets = [
2462
3006
  title: "Common Questions",
2463
3007
  items: [
2464
3008
  {
2465
- question: "How quickly can you schedule service?",
2466
- answer: "Most estimate requests are scheduled within 24 hours."
3009
+ question: "How quickly do you respond?",
3010
+ answer: "Replace this with a concise answer to a common customer question."
2467
3011
  },
2468
3012
  {
2469
- question: "Do you provide cleanup?",
2470
- answer: "Yes. Debris haul-off and cleanup are included in quoted scopes."
3013
+ question: "What is included?",
3014
+ answer: "Replace this with another concise answer that reduces buying friction."
2471
3015
  }
2472
3016
  ]
2473
3017
  }
@@ -2481,13 +3025,13 @@ var sectionPresets = [
2481
3025
  {
2482
3026
  blockType: "formEmbed",
2483
3027
  title: "Request a Quote",
2484
- description: "Share your project details and we will follow up quickly.",
3028
+ description: "Share a few details and your team can follow up with next steps.",
2485
3029
  formType: "quote"
2486
3030
  },
2487
3031
  {
2488
3032
  blockType: "bookingEmbed",
2489
3033
  title: "Prefer to book a consultation?",
2490
- description: "Choose a time window and we will confirm availability.",
3034
+ description: "Offer an alternative scheduling path for visitors who prefer to book directly.",
2491
3035
  buttonLabel: "Book Consultation",
2492
3036
  buttonHref: "/contact"
2493
3037
  }
@@ -2499,14 +3043,14 @@ var templateStarterPresets = {
2499
3043
  {
2500
3044
  blockType: "hero",
2501
3045
  headline: "Contact Us",
2502
- subheadline: "Request a quote, ask a question, or book a consultation window.",
2503
- primaryLabel: "Call (512) 555-0149",
2504
- primaryHref: "tel:+15125550149"
3046
+ subheadline: "Tell visitors exactly how to reach you and what to expect next.",
3047
+ primaryLabel: "Email Us",
3048
+ primaryHref: "mailto:hello@example.com"
2505
3049
  },
2506
3050
  {
2507
3051
  blockType: "formEmbed",
2508
3052
  title: "Request a Quote",
2509
- description: "Tell us about your project and we will follow up quickly.",
3053
+ description: "Use this space for a form embed or lead capture flow.",
2510
3054
  formType: "quote"
2511
3055
  },
2512
3056
  {
@@ -2514,8 +3058,8 @@ var templateStarterPresets = {
2514
3058
  title: "Common Questions",
2515
3059
  items: [
2516
3060
  {
2517
- question: "How quickly can you provide an estimate?",
2518
- answer: "Most estimates are scheduled within 24 hours."
3061
+ question: "How quickly will you respond?",
3062
+ answer: "Replace with the answer that best fits your operating process."
2519
3063
  }
2520
3064
  ]
2521
3065
  }
@@ -2524,27 +3068,27 @@ var templateStarterPresets = {
2524
3068
  {
2525
3069
  blockType: "hero",
2526
3070
  kicker: "Locally Owned",
2527
- headline: "Expert Tree Care for Central Texas",
2528
- subheadline: "Premium trimming, removal, and cleanup with safety-first execution.",
2529
- primaryLabel: "Get Your Free Quote",
3071
+ headline: "Lead with your strongest offer",
3072
+ subheadline: "Support the headline with a concise sentence that clarifies benefits and audience.",
3073
+ primaryLabel: "Get Started",
2530
3074
  primaryHref: "/contact",
2531
3075
  secondaryLabel: "View Services",
2532
3076
  secondaryHref: "/services"
2533
3077
  },
2534
3078
  {
2535
3079
  blockType: "featureGrid",
2536
- title: "Why Homeowners Choose Us",
3080
+ title: "Why clients choose us",
2537
3081
  variant: "highlight",
2538
3082
  items: [
2539
- { title: "Transparent Pricing", description: "Clear written estimates.", icon: "01" },
2540
- { title: "Safety-First Crew", description: "Property protection and planning.", icon: "02" },
2541
- { title: "Fast Scheduling", description: "Quick estimates and service windows.", icon: "03" }
3083
+ { title: "Clear Value", description: "Explain your first differentiator.", icon: "01" },
3084
+ { title: "Reliable Process", description: "Explain your second differentiator.", icon: "02" },
3085
+ { title: "Strong Results", description: "Explain your third differentiator.", icon: "03" }
2542
3086
  ]
2543
3087
  },
2544
3088
  {
2545
3089
  blockType: "cta",
2546
- headline: "Need a quote this week?",
2547
- description: "Call (512) 555-0149 or request an estimate online.",
3090
+ headline: "Ready to take the next step?",
3091
+ description: "Add a direct conversion prompt with a clear primary action.",
2548
3092
  buttonLabel: "Contact Us",
2549
3093
  buttonHref: "/contact",
2550
3094
  style: "light"
@@ -2553,9 +3097,9 @@ var templateStarterPresets = {
2553
3097
  services: [
2554
3098
  {
2555
3099
  blockType: "hero",
2556
- headline: "Tree Services Built for Safety and Curb Appeal",
2557
- subheadline: "Core offerings first, with clear scopes and scheduling.",
2558
- primaryLabel: "Schedule Estimate",
3100
+ headline: "Services Built Around Your Process",
3101
+ subheadline: "Summarize the core offerings with a short clarity-first introduction.",
3102
+ primaryLabel: "Request Info",
2559
3103
  primaryHref: "/contact"
2560
3104
  },
2561
3105
  {
@@ -2564,19 +3108,19 @@ var templateStarterPresets = {
2564
3108
  variant: "cards",
2565
3109
  items: [
2566
3110
  {
2567
- title: "Tree Trimming & Pruning",
2568
- description: "Selective pruning for structure, clearance, and health.",
2569
- icon: "Trim"
3111
+ title: "Service One",
3112
+ description: "Replace with a short description.",
3113
+ icon: "01"
2570
3114
  },
2571
3115
  {
2572
- title: "Tree Removal",
2573
- description: "Controlled removal for unstable or hazardous trees.",
2574
- icon: "Remove"
3116
+ title: "Service Two",
3117
+ description: "Replace with a short description.",
3118
+ icon: "02"
2575
3119
  },
2576
3120
  {
2577
- title: "Stump Grinding",
2578
- description: "Below-grade grinding and cleanup.",
2579
- icon: "Stump"
3121
+ title: "Service Three",
3122
+ description: "Replace with a short description.",
3123
+ icon: "03"
2580
3124
  }
2581
3125
  ]
2582
3126
  },
@@ -2585,8 +3129,8 @@ var templateStarterPresets = {
2585
3129
  title: "Frequently Asked Questions",
2586
3130
  items: [
2587
3131
  {
2588
- question: "Do you handle storm cleanup?",
2589
- answer: "Yes. We prioritize urgent hazards after severe weather."
3132
+ question: "Do you offer custom scopes?",
3133
+ answer: "Replace this with an answer that fits your business."
2590
3134
  }
2591
3135
  ]
2592
3136
  }
@@ -2984,20 +3528,6 @@ function migrateStudioDocument(value, migrations) {
2984
3528
  return assertStudioDocumentV1(current);
2985
3529
  }
2986
3530
 
2987
- // src/studio-pages/index.ts
2988
- var studio_pages_exports = {};
2989
- __export(studio_pages_exports, {
2990
- createDefaultStudioDocument: () => createDefaultStudioDocument,
2991
- defaultBuilderThemeTokens: () => defaultBuilderThemeTokens,
2992
- layoutToStudioDocument: () => layoutToStudioDocument,
2993
- pageInspectorPanels: () => pageInspectorPanels,
2994
- pageNodeTypes: () => pageNodeTypes,
2995
- pagePaletteGroups: () => pagePaletteGroups,
2996
- pageStudioModuleManifest: () => pageStudioModuleManifest,
2997
- resolveBuilderThemeTokens: () => resolveBuilderThemeTokens,
2998
- studioDocumentToLayout: () => studioDocumentToLayout
2999
- });
3000
-
3001
3531
  // src/studio-pages/builder/settings-v2/types.ts
3002
3532
  var defaultBuilderBlockSettingsV2 = {
3003
3533
  advanced: {
@@ -3011,13 +3541,13 @@ var defaultBuilderBlockSettingsV2 = {
3011
3541
  contentGradientAngle: "135",
3012
3542
  contentGradientFrom: "#ffffff",
3013
3543
  contentGradientPreset: "none",
3014
- contentGradientTo: "#f4f6f2",
3544
+ contentGradientTo: "#f4f6f8",
3015
3545
  sectionBackgroundColor: "#ffffff",
3016
3546
  sectionBackgroundMode: "none",
3017
3547
  sectionGradientAngle: "135",
3018
- sectionGradientFrom: "#124a37",
3019
- sectionGradientPreset: "forest",
3020
- sectionGradientTo: "#1f684f"
3548
+ sectionGradientFrom: "#334b63",
3549
+ sectionGradientPreset: "slate",
3550
+ sectionGradientTo: "#496582"
3021
3551
  },
3022
3552
  layout: {
3023
3553
  contentWidth: "inherit",
@@ -3078,9 +3608,9 @@ var defaultBuilderItemSettingsV2 = {
3078
3608
  };
3079
3609
  var defaultBuilderThemeTokens = {
3080
3610
  colors: {
3081
- accent: "#0d4a37",
3082
- bodyText: "#13211c",
3083
- headingText: "#13211c",
3611
+ accent: "#334b63",
3612
+ bodyText: "#425163",
3613
+ headingText: "#182332",
3084
3614
  surface: "#ffffff"
3085
3615
  },
3086
3616
  radii: {
@@ -3276,218 +3806,433 @@ var migrateBlockToSettingsV2 = (block) => {
3276
3806
  };
3277
3807
  };
3278
3808
 
3279
- // src/studio-pages/builder/settings-v2/themeTokens.ts
3280
- var isRecord4 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
3281
- var merge = (base, next) => {
3282
- if (!next || !isRecord4(next)) {
3283
- return base;
3284
- }
3285
- const merged = { ...base };
3286
- for (const [key, value] of Object.entries(next)) {
3287
- if (isRecord4(value) && isRecord4(merged[key])) {
3288
- merged[key] = merge(merged[key], value);
3289
- continue;
3290
- }
3291
- if (typeof value !== "undefined") {
3292
- merged[key] = value;
3293
- }
3809
+ // src/studio-pages/document.ts
3810
+ var ensureNodeID = (value, index) => {
3811
+ if (typeof value === "string" && value.trim().length > 0) {
3812
+ return value.trim();
3294
3813
  }
3295
- return merged;
3814
+ return `node-${index + 1}`;
3296
3815
  };
3297
- var resolveBuilderThemeTokens = (layers) => {
3298
- const withSite = merge(defaultBuilderThemeTokens, layers.site);
3299
- const withPage = merge(withSite, layers.page);
3300
- return merge(withPage, layers.block);
3816
+ var layoutToStudioDocument = (layout, title, metadata) => {
3817
+ const nodes = layout.filter((block) => typeof block.blockType === "string").map((rawBlock, index) => {
3818
+ const block = migrateBlockToSettingsV2(rawBlock);
3819
+ const blockType = String(block.blockType);
3820
+ const { id, blockType: _ignoredBlockType, ...data } = block;
3821
+ return {
3822
+ id: ensureNodeID(id, index),
3823
+ type: blockType,
3824
+ data
3825
+ };
3826
+ });
3827
+ return {
3828
+ metadata,
3829
+ schemaVersion: 1,
3830
+ title,
3831
+ nodes,
3832
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
3833
+ };
3301
3834
  };
3835
+ var studioDocumentToLayout = (document) => document.nodes.map(
3836
+ (node) => migrateBlockToSettingsV2({
3837
+ id: node.id,
3838
+ blockType: node.type,
3839
+ ...node.data
3840
+ })
3841
+ );
3842
+ var createDefaultStudioDocument = (title) => ({
3843
+ metadata: {},
3844
+ schemaVersion: 1,
3845
+ title,
3846
+ nodes: [],
3847
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
3848
+ });
3302
3849
 
3303
- // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
3304
- var import_react2 = require("react");
3305
-
3306
- // src/studio-pages/builder/ui/Accordion.tsx
3307
- var import_react = require("react");
3308
- var import_jsx_runtime4 = require("react/jsx-runtime");
3309
-
3310
- // src/studio-pages/builder/ui/ImageControls.tsx
3311
- var import_jsx_runtime5 = require("react/jsx-runtime");
3312
-
3313
- // src/studio-pages/builder/settings-v2/inspectorSchema.ts
3314
- var alignOptions = [
3315
- { label: "Left", value: "left" },
3316
- { label: "Center", value: "center" },
3317
- { label: "Right", value: "right" },
3318
- { label: "Justify", value: "justify" }
3319
- ];
3320
- var layoutFieldSet = [
3321
- {
3322
- group: "layout",
3323
- key: "settings.layout.contentWidth",
3324
- label: "Content Width",
3325
- options: [
3326
- { label: "Inherit Page Default", value: "inherit" },
3327
- { label: "Narrow", value: "narrow" },
3328
- { label: "Content", value: "content" },
3329
- { label: "Wide", value: "wide" },
3330
- { label: "Full", value: "full" }
3331
- ],
3332
- tags: ["width", "container"],
3333
- type: "select"
3334
- },
3335
- {
3336
- group: "layout",
3337
- key: "settings.layout.linkVerticalPadding",
3338
- label: "Keep Top and Bottom Equal",
3339
- tags: ["spacing", "padding", "equal", "lock", "vertical"],
3340
- type: "checkbox"
3341
- },
3342
- {
3343
- group: "layout",
3344
- key: "settings.layout.paddingTopPt",
3345
- label: "Top Padding (pt)",
3346
- max: 240,
3347
- min: 0,
3348
- tags: ["spacing", "padding", "top", "vertical"],
3349
- type: "number"
3350
- },
3351
- {
3352
- group: "layout",
3353
- key: "settings.layout.paddingBottomPt",
3354
- label: "Bottom Padding (pt)",
3355
- max: 240,
3356
- min: 0,
3357
- tags: ["spacing", "padding", "bottom", "vertical"],
3358
- type: "number"
3359
- },
3360
- {
3361
- group: "layout",
3362
- key: "settings.layout.linkHorizontalPadding",
3363
- label: "Keep Left and Right Equal",
3364
- tags: ["spacing", "padding", "equal", "lock", "horizontal"],
3365
- type: "checkbox"
3366
- },
3367
- {
3368
- group: "layout",
3369
- key: "settings.layout.paddingLeftPt",
3370
- label: "Left Padding (pt)",
3371
- max: 240,
3372
- min: 0,
3373
- tags: ["spacing", "padding", "left", "horizontal"],
3374
- type: "number"
3375
- },
3376
- {
3377
- group: "layout",
3378
- key: "settings.layout.paddingRightPt",
3379
- label: "Right Padding (pt)",
3380
- max: 240,
3381
- min: 0,
3382
- tags: ["spacing", "padding", "right", "horizontal"],
3383
- type: "number"
3850
+ // src/nextjs/queries/pages.ts
3851
+ var PAGE_QUERY_CACHE_VERSION = "v4-published-only-public";
3852
+ function withStudioDocumentLayout(page) {
3853
+ if (!page) {
3854
+ return null;
3384
3855
  }
3385
- ];
3386
- var typographyFieldSet = [
3387
- {
3388
- group: "typography",
3389
- key: "settings.typography.headingAlign",
3390
- label: "Heading Alignment",
3391
- options: alignOptions,
3392
- tags: ["text", "align", "heading"],
3393
- type: "select"
3394
- },
3395
- {
3396
- group: "typography",
3397
- key: "settings.typography.bodyAlign",
3398
- label: "Body Alignment",
3399
- options: alignOptions,
3400
- tags: ["text", "align", "paragraph"],
3401
- type: "select"
3402
- },
3403
- {
3404
- group: "typography",
3405
- key: "settings.typography.maxTextWidth",
3406
- label: "Text Width",
3407
- options: [
3408
- { label: "Auto", value: "auto" },
3409
- { label: "Small", value: "sm" },
3410
- { label: "Medium", value: "md" },
3411
- { label: "Large", value: "lg" },
3412
- { label: "Full", value: "full" }
3413
- ],
3414
- tags: ["readability", "measure", "line length"],
3415
- type: "select"
3416
- },
3417
- {
3418
- advanced: true,
3419
- group: "typography",
3420
- key: "settings.typography.lineHeightPreset",
3421
- label: "Line Height",
3422
- options: [
3423
- { label: "Tight", value: "tight" },
3424
- { label: "Normal", value: "normal" },
3425
- { label: "Relaxed", value: "relaxed" }
3426
- ],
3427
- type: "select"
3428
- },
3429
- {
3430
- advanced: true,
3431
- group: "typography",
3432
- key: "settings.typography.letterSpacingPreset",
3433
- label: "Letter Spacing",
3434
- options: [
3435
- { label: "Tight", value: "tight" },
3436
- { label: "Normal", value: "normal" },
3437
- { label: "Relaxed", value: "relaxed" }
3438
- ],
3439
- type: "select"
3856
+ try {
3857
+ const studioDocument = assertStudioDocumentV1(page.studioDocument);
3858
+ const compiledLayout = studioDocumentToLayout(studioDocument);
3859
+ if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
3860
+ return {
3861
+ ...page,
3862
+ layout: compiledLayout
3863
+ };
3864
+ }
3865
+ } catch {
3440
3866
  }
3441
- ];
3442
- var styleFieldSet = [
3443
- {
3444
- group: "style",
3445
- key: "settings.appearance.sectionBackgroundMode",
3446
- label: "Section Background",
3447
- options: [
3448
- { label: "None", value: "none" },
3449
- { label: "Color", value: "color" },
3450
- { label: "Gradient", value: "gradient" }
3451
- ],
3452
- tags: ["background", "section"],
3453
- type: "select"
3454
- },
3455
- {
3456
- group: "style",
3457
- key: "settings.appearance.sectionBackgroundColor",
3458
- label: "Section Background Color",
3459
- type: "color"
3460
- },
3461
- {
3462
- group: "style",
3463
- key: "settings.appearance.contentBackgroundMode",
3464
- label: "Content Background",
3465
- options: [
3466
- { label: "None", value: "none" },
3467
- { label: "Color", value: "color" },
3468
- { label: "Gradient", value: "gradient" }
3469
- ],
3470
- tags: ["background", "content"],
3471
- type: "select"
3472
- },
3473
- {
3474
- group: "style",
3475
- key: "settings.appearance.contentBackgroundColor",
3476
- label: "Content Background Color",
3477
- type: "color"
3867
+ return page;
3868
+ }
3869
+ function normalizePath(segments) {
3870
+ if (!segments || segments.length === 0) {
3871
+ return "/";
3478
3872
  }
3479
- ];
3480
- var commonAdvanced = [
3481
- {
3482
- group: "advanced",
3483
- inlineEditable: false,
3484
- key: "settings.advanced.editCopyInPanel",
3485
- label: "Edit Copy In Panel",
3486
- tags: ["inline", "copy", "text"],
3487
- type: "checkbox"
3488
- },
3489
- {
3490
- advanced: true,
3873
+ const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
3874
+ return cleaned.length > 0 ? `/${cleaned}` : "/";
3875
+ }
3876
+ async function queryPageByPath(payload, path2, draft) {
3877
+ const pathWhere = {
3878
+ path: {
3879
+ equals: path2
3880
+ }
3881
+ };
3882
+ const publishedWhere = {
3883
+ _status: {
3884
+ equals: "published"
3885
+ }
3886
+ };
3887
+ const result = await payload.find({
3888
+ collection: "pages",
3889
+ depth: 2,
3890
+ draft,
3891
+ limit: 1,
3892
+ overrideAccess: false,
3893
+ where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
3894
+ });
3895
+ if (result.docs.length > 0) {
3896
+ return withStudioDocumentLayout(result.docs[0] || null);
3897
+ }
3898
+ if (path2 === "/") {
3899
+ const homeWhere = {
3900
+ slug: {
3901
+ equals: "home"
3902
+ }
3903
+ };
3904
+ const homeResult = await payload.find({
3905
+ collection: "pages",
3906
+ depth: 2,
3907
+ draft,
3908
+ limit: 1,
3909
+ overrideAccess: false,
3910
+ where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
3911
+ });
3912
+ return withStudioDocumentLayout(homeResult.docs[0] || null);
3913
+ }
3914
+ return null;
3915
+ }
3916
+ function createPageQueries(getPayloadClient, contentTag = "website-content") {
3917
+ const getPublishedPageByPathCached = (0, import_cache.unstable_cache)(
3918
+ async (path2) => {
3919
+ const payload = await getPayloadClient();
3920
+ return queryPageByPath(payload, path2, false);
3921
+ },
3922
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION],
3923
+ { tags: [contentTag] }
3924
+ );
3925
+ async function getPageBySegments(segments, draft = false) {
3926
+ const path2 = normalizePath(segments);
3927
+ const payload = await getPayloadClient();
3928
+ if (draft) {
3929
+ return queryPageByPath(payload, path2, true);
3930
+ }
3931
+ return getPublishedPageByPathCached(path2);
3932
+ }
3933
+ async function listPublishedPagePaths() {
3934
+ const payload = await getPayloadClient();
3935
+ const pages = await payload.find({
3936
+ collection: "pages",
3937
+ depth: 0,
3938
+ draft: false,
3939
+ limit: 1e3,
3940
+ pagination: false,
3941
+ overrideAccess: false,
3942
+ where: {
3943
+ _status: {
3944
+ equals: "published"
3945
+ }
3946
+ }
3947
+ });
3948
+ return pages.docs.map((doc) => doc.path).filter((path2) => typeof path2 === "string" && path2.length > 0);
3949
+ }
3950
+ function pathToSegments(path2) {
3951
+ if (!path2 || path2 === "/") {
3952
+ return [];
3953
+ }
3954
+ return path2.split("/").filter(Boolean);
3955
+ }
3956
+ return {
3957
+ getPageBySegments,
3958
+ listPublishedPagePaths,
3959
+ pathToSegments
3960
+ };
3961
+ }
3962
+
3963
+ // src/nextjs/queries/site.ts
3964
+ var import_cache2 = require("next/cache");
3965
+ function createSiteQueries(getPayloadClient, contentTag = "website-content") {
3966
+ const getSiteSettingsCached = (0, import_cache2.unstable_cache)(
3967
+ async () => {
3968
+ const payload = await getPayloadClient();
3969
+ const settings = await payload.findGlobal({
3970
+ slug: "site-settings",
3971
+ depth: 1
3972
+ });
3973
+ return settings;
3974
+ },
3975
+ ["site-settings-global"],
3976
+ { tags: [contentTag] }
3977
+ );
3978
+ const getHeaderCached = (0, import_cache2.unstable_cache)(
3979
+ async () => {
3980
+ const payload = await getPayloadClient();
3981
+ const header = await payload.findGlobal({
3982
+ slug: "header",
3983
+ depth: 1
3984
+ });
3985
+ return header;
3986
+ },
3987
+ ["header-global"],
3988
+ { tags: [contentTag] }
3989
+ );
3990
+ const getFooterCached = (0, import_cache2.unstable_cache)(
3991
+ async () => {
3992
+ const payload = await getPayloadClient();
3993
+ const footer = await payload.findGlobal({
3994
+ slug: "footer",
3995
+ depth: 1
3996
+ });
3997
+ return footer;
3998
+ },
3999
+ ["footer-global"],
4000
+ { tags: [contentTag] }
4001
+ );
4002
+ const getSocialMediaCached = (0, import_cache2.unstable_cache)(
4003
+ async () => {
4004
+ const payload = await getPayloadClient();
4005
+ const socialMedia = await payload.findGlobal({
4006
+ slug: "social-media",
4007
+ depth: 1
4008
+ });
4009
+ return socialMedia;
4010
+ },
4011
+ ["social-media-global"],
4012
+ { tags: [contentTag] }
4013
+ );
4014
+ async function getSiteSettings(draft = false) {
4015
+ if (draft) {
4016
+ const payload = await getPayloadClient();
4017
+ const settings = await payload.findGlobal({
4018
+ slug: "site-settings",
4019
+ depth: 1,
4020
+ draft: true
4021
+ });
4022
+ return settings;
4023
+ }
4024
+ return getSiteSettingsCached();
4025
+ }
4026
+ async function getHeader(draft = false) {
4027
+ if (draft) {
4028
+ const payload = await getPayloadClient();
4029
+ const header = await payload.findGlobal({
4030
+ slug: "header",
4031
+ depth: 1,
4032
+ draft: true
4033
+ });
4034
+ return header;
4035
+ }
4036
+ return getHeaderCached();
4037
+ }
4038
+ async function getFooter(draft = false) {
4039
+ if (draft) {
4040
+ const payload = await getPayloadClient();
4041
+ const footer = await payload.findGlobal({
4042
+ slug: "footer",
4043
+ depth: 1,
4044
+ draft: true
4045
+ });
4046
+ return footer;
4047
+ }
4048
+ return getFooterCached();
4049
+ }
4050
+ async function getSocialMedia(draft = false) {
4051
+ if (draft) {
4052
+ const payload = await getPayloadClient();
4053
+ const socialMedia = await payload.findGlobal({
4054
+ slug: "social-media",
4055
+ depth: 1,
4056
+ draft: true
4057
+ });
4058
+ return socialMedia;
4059
+ }
4060
+ return getSocialMediaCached();
4061
+ }
4062
+ return {
4063
+ getSiteSettings,
4064
+ getHeader,
4065
+ getFooter,
4066
+ getSocialMedia
4067
+ };
4068
+ }
4069
+
4070
+ // src/nextjs/utilities/media.ts
4071
+ function resolveMedia(media) {
4072
+ if (!media) {
4073
+ return null;
4074
+ }
4075
+ if (typeof media === "number" || typeof media === "string") {
4076
+ return null;
4077
+ }
4078
+ if (media.url) {
4079
+ return {
4080
+ url: media.url,
4081
+ alt: media.alt || ""
4082
+ };
4083
+ }
4084
+ if (media.filename) {
4085
+ return {
4086
+ url: `/media/${media.filename}`,
4087
+ alt: media.alt || ""
4088
+ };
4089
+ }
4090
+ return null;
4091
+ }
4092
+
4093
+ // src/nextjs/utilities/socialMedia.ts
4094
+ function resolveSocialMediaLinks(data) {
4095
+ const profiles = data?.profiles;
4096
+ if (!profiles || typeof profiles !== "object") {
4097
+ return [];
4098
+ }
4099
+ return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
4100
+ const profile = profiles[platform];
4101
+ if (!profile || typeof profile !== "object") {
4102
+ return acc;
4103
+ }
4104
+ const url = typeof profile.url === "string" ? profile.url.trim() : "";
4105
+ if (!url) {
4106
+ return acc;
4107
+ }
4108
+ const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
4109
+ acc.push({
4110
+ icon,
4111
+ label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
4112
+ platform,
4113
+ url
4114
+ });
4115
+ return acc;
4116
+ }, []);
4117
+ }
4118
+
4119
+ // src/studio-pages/index.ts
4120
+ var studio_pages_exports = {};
4121
+ __export(studio_pages_exports, {
4122
+ createDefaultStudioDocument: () => createDefaultStudioDocument,
4123
+ createStudioPageService: () => createStudioPageService,
4124
+ defaultBuilderThemeTokens: () => defaultBuilderThemeTokens,
4125
+ getStudioDocumentFromPage: () => getStudioDocumentFromPage,
4126
+ layoutToStudioDocument: () => layoutToStudioDocument,
4127
+ pageInspectorPanels: () => pageInspectorPanels,
4128
+ pageNodeTypes: () => pageNodeTypes,
4129
+ pagePaletteGroups: () => pagePaletteGroups,
4130
+ pageStudioModuleManifest: () => pageStudioModuleManifest,
4131
+ resolveBuilderThemeTokens: () => resolveBuilderThemeTokens,
4132
+ studioDocumentToLayout: () => studioDocumentToLayout,
4133
+ toEditorInitialDoc: () => toEditorInitialDoc
4134
+ });
4135
+
4136
+ // src/studio-pages/builder/settings-v2/themeTokens.ts
4137
+ var isRecord4 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
4138
+ var merge = (base, next) => {
4139
+ if (!next || !isRecord4(next)) {
4140
+ return base;
4141
+ }
4142
+ const merged = { ...base };
4143
+ for (const [key, value] of Object.entries(next)) {
4144
+ if (isRecord4(value) && isRecord4(merged[key])) {
4145
+ merged[key] = merge(merged[key], value);
4146
+ continue;
4147
+ }
4148
+ if (typeof value !== "undefined") {
4149
+ merged[key] = value;
4150
+ }
4151
+ }
4152
+ return merged;
4153
+ };
4154
+ var resolveBuilderThemeTokens = (layers) => {
4155
+ const withSite = merge(defaultBuilderThemeTokens, layers.site);
4156
+ const withPage = merge(withSite, layers.page);
4157
+ return merge(withPage, layers.block);
4158
+ };
4159
+
4160
+ // src/studio-pages/builder/settings-v2/inspectorSchema.ts
4161
+ var alignOptions = [
4162
+ { label: "Left", value: "left" },
4163
+ { label: "Center", value: "center" },
4164
+ { label: "Right", value: "right" },
4165
+ { label: "Justify", value: "justify" }
4166
+ ];
4167
+ var layoutFieldSet = [];
4168
+ var typographyFieldSet = [
4169
+ {
4170
+ group: "typography",
4171
+ key: "settings.typography.headingAlign",
4172
+ label: "Heading Alignment",
4173
+ options: alignOptions,
4174
+ tags: ["text", "align", "heading"],
4175
+ type: "select"
4176
+ },
4177
+ {
4178
+ group: "typography",
4179
+ key: "settings.typography.bodyAlign",
4180
+ label: "Body Alignment",
4181
+ options: alignOptions,
4182
+ tags: ["text", "align", "paragraph"],
4183
+ type: "select"
4184
+ },
4185
+ {
4186
+ group: "typography",
4187
+ key: "settings.typography.maxTextWidth",
4188
+ label: "Text Width",
4189
+ options: [
4190
+ { label: "Auto", value: "auto" },
4191
+ { label: "Small", value: "sm" },
4192
+ { label: "Medium", value: "md" },
4193
+ { label: "Large", value: "lg" },
4194
+ { label: "Full", value: "full" }
4195
+ ],
4196
+ tags: ["readability", "measure", "line length"],
4197
+ type: "select"
4198
+ },
4199
+ {
4200
+ advanced: true,
4201
+ group: "typography",
4202
+ key: "settings.typography.lineHeightPreset",
4203
+ label: "Line Height",
4204
+ options: [
4205
+ { label: "Tight", value: "tight" },
4206
+ { label: "Normal", value: "normal" },
4207
+ { label: "Relaxed", value: "relaxed" }
4208
+ ],
4209
+ type: "select"
4210
+ },
4211
+ {
4212
+ advanced: true,
4213
+ group: "typography",
4214
+ key: "settings.typography.letterSpacingPreset",
4215
+ label: "Letter Spacing",
4216
+ options: [
4217
+ { label: "Tight", value: "tight" },
4218
+ { label: "Normal", value: "normal" },
4219
+ { label: "Relaxed", value: "relaxed" }
4220
+ ],
4221
+ type: "select"
4222
+ }
4223
+ ];
4224
+ var styleFieldSet = [];
4225
+ var commonAdvanced = [
4226
+ {
4227
+ group: "advanced",
4228
+ inlineEditable: false,
4229
+ key: "settings.advanced.editCopyInPanel",
4230
+ label: "Edit Copy In Panel",
4231
+ tags: ["inline", "copy", "text"],
4232
+ type: "checkbox"
4233
+ },
4234
+ {
4235
+ advanced: true,
3491
4236
  group: "advanced",
3492
4237
  key: "settings.advanced.hideOnMobile",
3493
4238
  label: "Hide On Mobile",
@@ -3577,6 +4322,7 @@ var inspectorDefinitionByBlockType = {
3577
4322
  faq: {
3578
4323
  blockType: "faq",
3579
4324
  fields: [
4325
+ { group: "basics", inlineEditable: true, key: "eyebrow", label: "Eyebrow", type: "text" },
3580
4326
  { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
3581
4327
  ...layoutFieldSet,
3582
4328
  ...typographyFieldSet,
@@ -3587,6 +4333,7 @@ var inspectorDefinitionByBlockType = {
3587
4333
  featureGrid: {
3588
4334
  blockType: "featureGrid",
3589
4335
  fields: [
4336
+ { group: "basics", inlineEditable: true, key: "eyebrow", label: "Eyebrow", type: "text" },
3590
4337
  { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
3591
4338
  {
3592
4339
  group: "basics",
@@ -3594,7 +4341,11 @@ var inspectorDefinitionByBlockType = {
3594
4341
  label: "Variant",
3595
4342
  options: [
3596
4343
  { label: "Cards", value: "cards" },
3597
- { label: "Highlight", value: "highlight" }
4344
+ { label: "Highlight", value: "highlight" },
4345
+ { label: "Split List", value: "splitList" },
4346
+ { label: "Panels", value: "panels" },
4347
+ { label: "Catalog", value: "catalog" },
4348
+ { label: "Contact Split", value: "contact" }
3598
4349
  ],
3599
4350
  type: "select"
3600
4351
  },
@@ -3609,6 +4360,7 @@ var inspectorDefinitionByBlockType = {
3609
4360
  formEmbed: {
3610
4361
  blockType: "formEmbed",
3611
4362
  fields: [
4363
+ { group: "basics", inlineEditable: true, key: "eyebrow", label: "Eyebrow", type: "text" },
3612
4364
  { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
3613
4365
  { group: "basics", inlineEditable: true, key: "description", label: "Description", type: "textarea" },
3614
4366
  {
@@ -3641,7 +4393,7 @@ var inspectorDefinitionByBlockType = {
3641
4393
  type: "select"
3642
4394
  },
3643
4395
  {
3644
- group: "layout",
4396
+ group: "basics",
3645
4397
  key: "heroHeight",
3646
4398
  label: "Hero Height",
3647
4399
  options: [
@@ -3694,6 +4446,16 @@ var inspectorDefinitionByBlockType = {
3694
4446
  richText: {
3695
4447
  blockType: "richText",
3696
4448
  fields: [
4449
+ {
4450
+ group: "basics",
4451
+ key: "variant",
4452
+ label: "Variant",
4453
+ options: [
4454
+ { label: "Default", value: "default" },
4455
+ { label: "Quote Banner", value: "quoteBanner" }
4456
+ ],
4457
+ type: "select"
4458
+ },
3697
4459
  { group: "basics", inlineEditable: true, key: "title", label: "Title", type: "text" },
3698
4460
  {
3699
4461
  group: "basics",
@@ -3729,677 +4491,571 @@ var inspectorDefinitionByBlockType = {
3729
4491
  { group: "basics", key: "visibleCount", label: "Visible At Once", max: 6, min: 1, type: "number" },
3730
4492
  { group: "basics", key: "autoRotate", label: "Auto Rotate", type: "checkbox" },
3731
4493
  {
3732
- advanced: true,
3733
- group: "advanced",
3734
- key: "rotateIntervalSeconds",
3735
- label: "Rotate Interval Seconds",
3736
- max: 30,
3737
- min: 2,
3738
- type: "number"
3739
- },
3740
- ...layoutFieldSet,
3741
- ...typographyFieldSet,
3742
- ...styleFieldSet,
3743
- ...commonAdvanced
3744
- ]
3745
- }
3746
- };
3747
-
3748
- // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
3749
- var import_jsx_runtime6 = require("react/jsx-runtime");
3750
-
3751
- // src/studio-pages/migrations.ts
3752
- var isRecord5 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
3753
- var assertPageStudioDocumentV1 = (value) => {
3754
- if (!isRecord5(value)) {
3755
- throw new Error("Studio document must be an object");
3756
- }
3757
- if (value.schemaVersion !== 1) {
3758
- throw new Error("Unsupported studio schemaVersion");
3759
- }
3760
- if (!Array.isArray(value.nodes)) {
3761
- throw new Error("Studio document nodes must be an array");
3762
- }
3763
- const nodes = value.nodes.map((node, index) => {
3764
- if (!isRecord5(node)) {
3765
- throw new Error(`Node at index ${index} must be an object`);
3766
- }
3767
- if (typeof node.id !== "string" || node.id.length === 0) {
3768
- throw new Error(`Node at index ${index} has invalid id`);
3769
- }
3770
- if (typeof node.type !== "string" || node.type.length === 0) {
3771
- throw new Error(`Node at index ${index} has invalid type`);
3772
- }
3773
- if (!isRecord5(node.data)) {
3774
- throw new Error(`Node at index ${index} has invalid data`);
3775
- }
3776
- return {
3777
- data: node.data,
3778
- id: node.id,
3779
- type: node.type
3780
- };
3781
- });
3782
- return {
3783
- metadata: isRecord5(value.metadata) ? value.metadata : void 0,
3784
- nodes,
3785
- schemaVersion: 1,
3786
- title: typeof value.title === "string" ? value.title : void 0,
3787
- updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
3788
- };
3789
- };
3790
- var migratePageNodeToSettingsV2 = (node) => {
3791
- const normalized = migrateBlockToSettingsV2({
3792
- blockType: node.type,
3793
- ...node.data
3794
- });
3795
- const { blockType: _ignoredBlockType, ...data } = normalized;
3796
- return {
3797
- ...node,
3798
- data
3799
- };
3800
- };
3801
- var migratePageDocumentSettingsToV2 = (value) => {
3802
- const current = assertPageStudioDocumentV1(value);
3803
- return {
3804
- ...current,
3805
- nodes: current.nodes.map(migratePageNodeToSettingsV2)
3806
- };
3807
- };
3808
- var pageStudioMigrations = [
3809
- {
3810
- fromVersion: 1,
3811
- migrate: migratePageDocumentSettingsToV2,
3812
- toVersion: 1
3813
- }
3814
- ];
3815
-
3816
- // src/studio-pages/index.ts
3817
- var withSectionStyleDefaults = (value) => ({
3818
- ...sectionStyleDefaults,
3819
- ...value
3820
- });
3821
- var defaultNodeData = {
3822
- bookingEmbed: {
3823
- ...withSectionStyleDefaults({}),
3824
- buttonHref: "/contact",
3825
- buttonLabel: "Book Consultation",
3826
- description: "Let visitors book a consultation.",
3827
- title: "Book a Time"
3828
- },
3829
- beforeAfter: withSectionStyleDefaults({
3830
- itemsPerRow: 2,
3831
- items: [
3832
- {
3833
- description: "Before and after result summary.",
3834
- imageCornerStyle: "rounded",
3835
- imageFit: "cover",
3836
- imagePosition: "center",
3837
- label: "Project One"
3838
- }
3839
- ],
3840
- subtitle: "Show visual proof from real projects.",
3841
- title: "Before & After Results"
3842
- }),
3843
- cta: {
3844
- ...withSectionStyleDefaults({}),
3845
- backgroundColor: "#1f684f",
3846
- buttonHref: "/contact",
3847
- buttonLabel: "Contact Us",
3848
- description: "Optional supporting copy.",
3849
- headline: "Ready to get started?",
3850
- style: "light"
3851
- },
3852
- faq: {
3853
- ...withSectionStyleDefaults({}),
3854
- items: [{ answer: "Answer goes here.", question: "Frequently asked question?" }],
3855
- title: "Frequently Asked Questions"
3856
- },
3857
- featureGrid: {
3858
- ...withSectionStyleDefaults({}),
3859
- itemsPerRow: 3,
3860
- items: [
3861
- { description: "Explain this point.", iconType: "badge", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
3862
- { description: "Explain this point.", iconType: "badge", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
3863
- { description: "Explain this point.", iconType: "badge", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
3864
- ],
3865
- title: "Section Title",
3866
- variant: "cards"
3867
- },
3868
- formEmbed: {
3869
- ...withSectionStyleDefaults({}),
3870
- description: "Collect lead details from visitors.",
3871
- formType: "quote",
3872
- title: "Request a Quote"
3873
- },
3874
- hero: {
3875
- ...withSectionStyleDefaults({}),
3876
- backgroundColor: "",
3877
- backgroundOverlayMode: "none",
3878
- backgroundOverlayOpacity: 45,
3879
- backgroundOverlayColor: "#000000",
3880
- backgroundOverlayGradientFrom: "#0d4a37",
3881
- backgroundOverlayGradientTo: "#1f684f",
3882
- backgroundOverlayGradientAngle: "135",
3883
- backgroundOverlayGradientFromStrength: 100,
3884
- backgroundOverlayGradientToStrength: 100,
3885
- backgroundOverlayGradientStart: 0,
3886
- backgroundOverlayGradientEnd: 100,
3887
- backgroundOverlayGradientFeather: 100,
3888
- backgroundImageCornerStyle: "rounded",
3889
- backgroundImageFit: "cover",
3890
- backgroundImagePosition: "center",
3891
- heroHeight: "sm",
3892
- headline: "New Hero Section",
3893
- kicker: "Optional kicker",
3894
- primaryHref: "/contact",
3895
- primaryLabel: "Primary Action",
3896
- secondaryHref: "/services",
3897
- secondaryLabel: "Secondary Action",
3898
- subheadline: "Describe your offer clearly for website visitors.",
3899
- variant: "default"
3900
- },
3901
- media: {
3902
- ...withSectionStyleDefaults({}),
3903
- caption: "Add a caption",
3904
- imageCornerStyle: "rounded",
3905
- imageFit: "cover",
3906
- imagePosition: "center",
3907
- size: "default"
3908
- },
3909
- logoWall: withSectionStyleDefaults({
3910
- items: [
3911
- { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
3912
- { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
3913
- { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
3914
- ],
3915
- subtitle: "Trusted by teams and homeowners across Central Texas.",
3916
- title: "Trusted by Local Organizations"
3917
- }),
3918
- richText: {
3919
- ...withSectionStyleDefaults({}),
3920
- content: {
3921
- root: {
3922
- children: [
3923
- {
3924
- children: [
3925
- {
3926
- detail: 0,
3927
- format: 0,
3928
- mode: "normal",
3929
- style: "",
3930
- text: "Write your content here.",
3931
- type: "text",
3932
- version: 1
3933
- }
3934
- ],
3935
- direction: "ltr",
3936
- format: "",
3937
- indent: 0,
3938
- type: "paragraph",
3939
- version: 1
3940
- }
3941
- ],
3942
- direction: "ltr",
3943
- format: "",
3944
- indent: 0,
3945
- type: "root",
3946
- version: 1
3947
- }
3948
- },
3949
- title: "Section Heading",
3950
- width: "normal"
3951
- },
3952
- testimonials: {
3953
- ...withSectionStyleDefaults({}),
3954
- autoRotate: true,
3955
- items: [{ location: "City, ST", name: "Customer Name", quote: "Customer feedback goes here.", rating: 5 }],
3956
- rotateIntervalSeconds: 7,
3957
- title: "What Customers Say",
3958
- visibleCount: 3
3959
- },
3960
- stats: withSectionStyleDefaults({
3961
- items: [
3962
- { description: "Average response time", label: "Same-Day Quotes", value: "24h" },
3963
- { description: "Projects completed", label: "Completed Jobs", value: "1,200+" },
3964
- { description: "Client satisfaction score", label: "Satisfaction", value: "4.9/5" }
3965
- ],
3966
- subtitle: "Highlight measurable outcomes to build trust quickly.",
3967
- title: "Performance Highlights"
3968
- })
4494
+ advanced: true,
4495
+ group: "advanced",
4496
+ key: "rotateIntervalSeconds",
4497
+ label: "Rotate Interval Seconds",
4498
+ max: 30,
4499
+ min: 2,
4500
+ type: "number"
4501
+ },
4502
+ ...layoutFieldSet,
4503
+ ...typographyFieldSet,
4504
+ ...styleFieldSet,
4505
+ ...commonAdvanced
4506
+ ]
4507
+ }
3969
4508
  };
3970
- var nodeTypeLabels = {
3971
- bookingEmbed: "Booking Embed",
3972
- beforeAfter: "Before / After",
3973
- cta: "Call To Action",
3974
- faq: "FAQ",
3975
- featureGrid: "Feature Grid",
3976
- formEmbed: "Form Embed",
3977
- hero: "Hero",
3978
- logoWall: "Logo Wall",
3979
- media: "Media",
3980
- richText: "Rich Text",
3981
- stats: "Stats",
3982
- testimonials: "Testimonials"
4509
+
4510
+ // src/studio-pages/pageService.ts
4511
+ var isRecord5 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
4512
+ var toRecordArray = (value) => Array.isArray(value) ? value.filter((item) => isRecord5(item)) : [];
4513
+ var getRelationID = (value) => {
4514
+ if (typeof value === "number" || typeof value === "string") {
4515
+ return value;
4516
+ }
4517
+ if (!isRecord5(value)) {
4518
+ return null;
4519
+ }
4520
+ const id = value.id;
4521
+ return typeof id === "number" || typeof id === "string" ? id : null;
3983
4522
  };
3984
- var pageNodeTypes = Object.keys(defaultNodeData).map((type) => ({
3985
- type,
3986
- displayName: nodeTypeLabels[type] || type,
3987
- description: `Page node for ${nodeTypeLabels[type] || type}`,
3988
- getDefaultData: () => {
3989
- const migrated = migrateBlockToSettingsV2(structuredClone(defaultNodeData[type]));
3990
- const { blockType: _ignoredBlockType, ...data } = migrated;
3991
- return data;
4523
+ var asLayoutArray = (value) => toRecordArray(value);
4524
+ var hydrateRelationship = (valueFromStudio, valueFromLayout) => {
4525
+ if (isRecord5(valueFromStudio)) {
4526
+ return valueFromStudio;
3992
4527
  }
3993
- }));
3994
- var validatePageDocument = (document) => {
3995
- const issues = [];
3996
- if (!document.title || document.title.trim().length === 0) {
3997
- issues.push({
3998
- code: "pages.title.required",
3999
- message: "Page title is required before publishing.",
4000
- path: "title",
4001
- severity: "error"
4002
- });
4528
+ if (!isRecord5(valueFromLayout)) {
4529
+ return valueFromStudio;
4003
4530
  }
4004
- if (document.nodes.length === 0) {
4005
- issues.push({
4006
- code: "pages.nodes.required",
4007
- message: "At least one section is required.",
4008
- path: "nodes",
4009
- severity: "error"
4010
- });
4531
+ const studioID = getRelationID(valueFromStudio);
4532
+ const layoutID = getRelationID(valueFromLayout);
4533
+ if (studioID === null || layoutID === null || String(studioID) !== String(layoutID)) {
4534
+ return valueFromStudio;
4011
4535
  }
4012
- document.nodes.forEach((node, index) => {
4013
- if (node.type === "hero" && typeof node.data.headline !== "string") {
4014
- issues.push({
4015
- code: "pages.hero.headline",
4016
- message: "Hero section requires a headline.",
4017
- path: `nodes.${index}.data.headline`,
4018
- severity: "error"
4019
- });
4020
- }
4021
- });
4022
- return issues;
4536
+ return valueFromLayout;
4023
4537
  };
4024
- var pagePaletteGroups = [
4025
- {
4026
- id: "page-core",
4027
- label: "Core Sections",
4028
- items: [
4029
- { nodeType: "hero", title: "Hero", description: "Top-of-page headline and CTA" },
4030
- { nodeType: "featureGrid", title: "Feature Grid", description: "Service or value cards" },
4031
- { nodeType: "stats", title: "Stats", description: "Key performance highlights" },
4032
- { nodeType: "logoWall", title: "Logo Wall", description: "Trust logos and badges" },
4033
- { nodeType: "beforeAfter", title: "Before / After", description: "Visual before-and-after gallery" },
4034
- { nodeType: "richText", title: "Rich Text", description: "Long-form content area" },
4035
- { nodeType: "media", title: "Media", description: "Image/video section" },
4036
- { nodeType: "testimonials", title: "Testimonials", description: "Social proof quotes" },
4037
- { nodeType: "faq", title: "FAQ", description: "Question-and-answer section" },
4038
- { nodeType: "cta", title: "Call To Action", description: "Conversion strip with button" },
4039
- { nodeType: "formEmbed", title: "Form Embed", description: "Lead capture form" },
4040
- { nodeType: "bookingEmbed", title: "Booking Embed", description: "Scheduling panel" }
4041
- ]
4042
- }
4043
- ];
4044
- var pageInspectorPanelRegistry = Object.keys(defaultNodeData).map((nodeType) => ({
4045
- nodeType,
4046
- panelID: `${nodeType}-panel`,
4047
- panelLabel: `${nodeTypeLabels[nodeType] || nodeType} Settings`
4048
- }));
4049
- var resolvePanelFields = (nodeType) => inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
4050
- advanced: field.advanced,
4051
- group: field.group,
4052
- inlineEditable: field.inlineEditable,
4053
- key: field.key,
4054
- label: field.label,
4055
- type: field.type
4056
- })) || [];
4057
- var pageInspectorPanels = pageInspectorPanelRegistry.map((entry) => ({
4058
- fields: resolvePanelFields(entry.nodeType),
4059
- id: entry.panelID,
4060
- label: entry.panelLabel,
4061
- nodeType: entry.nodeType
4062
- }));
4063
- var pageStudioModuleManifest = {
4064
- id: "studio-pages",
4065
- version: "0.1.0-beta.0",
4066
- displayName: "Pages Studio Module",
4067
- nodeTypes: pageNodeTypes,
4068
- paletteGroups: pagePaletteGroups,
4069
- inspectorPanels: pageInspectorPanels,
4070
- validators: [validatePageDocument],
4071
- migrations: pageStudioMigrations,
4072
- compiler: {
4073
- compileNode: (node) => {
4074
- const normalized = migrateBlockToSettingsV2({
4075
- blockType: node.type,
4076
- ...node.data
4538
+ var hydrateDocumentWithLayoutRelations = (document, layout) => {
4539
+ const nextNodes = document.nodes.map((node, index) => {
4540
+ const layoutBlock = layout[index];
4541
+ if (!isRecord5(layoutBlock)) {
4542
+ return node;
4543
+ }
4544
+ if (typeof layoutBlock.blockType !== "string" || layoutBlock.blockType !== node.type) {
4545
+ return node;
4546
+ }
4547
+ const nextData = { ...node.data };
4548
+ if (node.type === "hero") {
4549
+ nextData.media = hydrateRelationship(nextData.media, layoutBlock.media);
4550
+ }
4551
+ if (node.type === "media") {
4552
+ nextData.image = hydrateRelationship(nextData.image, layoutBlock.image);
4553
+ }
4554
+ if (node.type === "featureGrid" || node.type === "logoWall" || node.type === "beforeAfter") {
4555
+ const studioItems = Array.isArray(nextData.items) ? nextData.items : [];
4556
+ const layoutItems = Array.isArray(layoutBlock.items) ? layoutBlock.items : [];
4557
+ nextData.items = studioItems.map((rawStudioItem, itemIndex) => {
4558
+ if (!isRecord5(rawStudioItem)) {
4559
+ return rawStudioItem;
4560
+ }
4561
+ const layoutItem = layoutItems[itemIndex];
4562
+ if (!isRecord5(layoutItem)) {
4563
+ return rawStudioItem;
4564
+ }
4565
+ const nextItem = { ...rawStudioItem };
4566
+ nextItem.media = hydrateRelationship(nextItem.media, layoutItem.media);
4567
+ nextItem.beforeMedia = hydrateRelationship(nextItem.beforeMedia, layoutItem.beforeMedia);
4568
+ nextItem.afterMedia = hydrateRelationship(nextItem.afterMedia, layoutItem.afterMedia);
4569
+ return nextItem;
4077
4570
  });
4078
- return {
4079
- id: node.id,
4080
- ...normalized
4081
- };
4082
4571
  }
4083
- },
4084
- permissions: [
4085
- { action: "read", role: "admin" },
4086
- { action: "read", role: "editor" },
4087
- { action: "read", role: "client" },
4088
- { action: "update", role: "admin" },
4089
- { action: "update", role: "editor" },
4090
- { action: "update", role: "client" },
4091
- { action: "publish", role: "admin" },
4092
- { action: "publish", role: "editor" }
4093
- ]
4094
- };
4095
- var ensureNodeID = (inputID, index) => {
4096
- if (typeof inputID === "string" && inputID.length > 0) {
4097
- return inputID;
4098
- }
4099
- return `node-${index + 1}`;
4100
- };
4101
- var layoutToStudioDocument = (layout, title, metadata) => {
4102
- const nodes = layout.filter((block) => typeof block.blockType === "string").map((rawBlock, index) => {
4103
- const block = migrateBlockToSettingsV2(rawBlock);
4104
- const blockType = String(block.blockType);
4105
- const { id, blockType: _ignoredBlockType, ...data } = block;
4106
4572
  return {
4107
- id: ensureNodeID(id, index),
4108
- type: blockType,
4109
- data
4573
+ ...node,
4574
+ data: nextData
4110
4575
  };
4111
4576
  });
4112
4577
  return {
4113
- metadata,
4114
- schemaVersion: 1,
4115
- title,
4116
- nodes,
4117
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
4578
+ ...document,
4579
+ nodes: nextNodes
4118
4580
  };
4119
4581
  };
4120
- var studioDocumentToLayout = (document) => document.nodes.map(
4121
- (node) => migrateBlockToSettingsV2({
4122
- id: node.id,
4123
- blockType: node.type,
4124
- ...node.data
4125
- })
4126
- );
4127
- var createDefaultStudioDocument = (title) => ({
4128
- metadata: {},
4582
+ var normalizeDocument = (document) => ({
4583
+ ...document,
4129
4584
  schemaVersion: 1,
4130
- title,
4131
- nodes: [],
4132
4585
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
4133
4586
  });
4134
-
4135
- // src/nextjs/queries/pages.ts
4136
- var PAGE_QUERY_CACHE_VERSION = "v4-published-only-public";
4137
- function withStudioDocumentLayout(page) {
4138
- if (!page) {
4139
- return null;
4140
- }
4141
- try {
4142
- const studioDocument = assertStudioDocumentV1(page.studioDocument);
4143
- const compiledLayout = studioDocumentToLayout(studioDocument);
4144
- if (Array.isArray(compiledLayout) && compiledLayout.length > 0) {
4145
- return {
4146
- ...page,
4147
- layout: compiledLayout
4148
- };
4149
- }
4150
- } catch {
4151
- }
4152
- return page;
4153
- }
4154
- function normalizePath(segments) {
4155
- if (!segments || segments.length === 0) {
4156
- return "/";
4157
- }
4158
- const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
4159
- return cleaned.length > 0 ? `/${cleaned}` : "/";
4160
- }
4161
- async function queryPageByPath(payload, path2, draft) {
4162
- const pathWhere = {
4163
- path: {
4164
- equals: path2
4587
+ var normalizeLegacyHeroDefaults = (document) => {
4588
+ const nodes = document.nodes.map((node) => {
4589
+ if (node.type !== "hero" || !isRecord5(node.data)) {
4590
+ return node;
4165
4591
  }
4166
- };
4167
- const publishedWhere = {
4168
- _status: {
4169
- equals: "published"
4592
+ const nextData = { ...node.data };
4593
+ const heroBackgroundColor = typeof nextData.backgroundColor === "string" ? nextData.backgroundColor.trim().toLowerCase() : "";
4594
+ const sectionBackgroundMode = typeof nextData.sectionBackgroundMode === "string" ? nextData.sectionBackgroundMode : "none";
4595
+ const hasBackgroundImageURL = typeof nextData.backgroundImageURL === "string" && nextData.backgroundImageURL.trim().length > 0;
4596
+ const mediaRelation = getRelationID(nextData.media);
4597
+ if (heroBackgroundColor === "#124a37" && sectionBackgroundMode === "none" && !hasBackgroundImageURL && mediaRelation === null) {
4598
+ nextData.backgroundColor = "";
4170
4599
  }
4171
- };
4172
- const result = await payload.find({
4173
- collection: "pages",
4174
- depth: 2,
4175
- draft,
4176
- limit: 1,
4177
- overrideAccess: false,
4178
- where: draft ? pathWhere : { and: [pathWhere, publishedWhere] }
4179
- });
4180
- if (result.docs.length > 0) {
4181
- return withStudioDocumentLayout(result.docs[0] || null);
4182
- }
4183
- if (path2 === "/") {
4184
- const homeWhere = {
4185
- slug: {
4186
- equals: "home"
4187
- }
4600
+ return {
4601
+ ...node,
4602
+ data: nextData
4188
4603
  };
4189
- const homeResult = await payload.find({
4190
- collection: "pages",
4191
- depth: 2,
4192
- draft,
4193
- limit: 1,
4194
- overrideAccess: false,
4195
- where: draft ? homeWhere : { and: [homeWhere, publishedWhere] }
4196
- });
4197
- return withStudioDocumentLayout(homeResult.docs[0] || null);
4604
+ });
4605
+ return {
4606
+ ...document,
4607
+ nodes
4608
+ };
4609
+ };
4610
+ var assertCanPublish = (issues) => {
4611
+ const publishErrors = issues.filter((issue) => issue.severity === "error");
4612
+ if (publishErrors.length > 0) {
4613
+ throw new Error(`Cannot publish page: ${publishErrors[0].message}`);
4198
4614
  }
4199
- return null;
4200
- }
4201
- function createPageQueries(getPayloadClient, contentTag = "website-content") {
4202
- const getPublishedPageByPathCached = (0, import_cache.unstable_cache)(
4203
- async (path2) => {
4204
- const payload = await getPayloadClient();
4205
- return queryPageByPath(payload, path2, false);
4206
- },
4207
- ["page-by-path", PAGE_QUERY_CACHE_VERSION],
4208
- { tags: [contentTag] }
4209
- );
4210
- async function getPageBySegments(segments, draft = false) {
4211
- const path2 = normalizePath(segments);
4212
- const payload = await getPayloadClient();
4213
- if (draft) {
4214
- return queryPageByPath(payload, path2, true);
4615
+ };
4616
+ var getStudioDocumentFromPage = (doc) => {
4617
+ const title = typeof doc.title === "string" ? doc.title : void 0;
4618
+ const layout = asLayoutArray(doc.layout);
4619
+ try {
4620
+ const studioDocument = assertStudioDocumentV1(doc.studioDocument);
4621
+ if (layout.length > 0) {
4622
+ return hydrateDocumentWithLayoutRelations(studioDocument, layout);
4215
4623
  }
4216
- return getPublishedPageByPathCached(path2);
4624
+ return studioDocument;
4625
+ } catch {
4626
+ if (layout.length > 0) {
4627
+ return layoutToStudioDocument(layout, title);
4628
+ }
4629
+ return createEmptyStudioDocument(title);
4217
4630
  }
4218
- async function listPublishedPagePaths() {
4219
- const payload = await getPayloadClient();
4220
- const pages = await payload.find({
4221
- collection: "pages",
4222
- depth: 0,
4223
- draft: false,
4224
- limit: 1e3,
4225
- pagination: false,
4631
+ };
4632
+ var createStudioPageService = ({
4633
+ collectionSlug = "pages",
4634
+ modules,
4635
+ payload,
4636
+ user
4637
+ }) => ({
4638
+ getPageForStudio: async (pageID) => {
4639
+ const page = await payload.findByID({
4640
+ collection: collectionSlug,
4641
+ depth: 2,
4642
+ draft: true,
4643
+ id: pageID,
4226
4644
  overrideAccess: false,
4227
- where: {
4228
- _status: {
4229
- equals: "published"
4230
- }
4231
- }
4645
+ user
4232
4646
  });
4233
- return pages.docs.map((doc) => doc.path).filter((path2) => typeof path2 === "string" && path2.length > 0);
4647
+ const studioDocument = getStudioDocumentFromPage(page);
4648
+ return {
4649
+ id: String(page.id),
4650
+ slug: typeof page.slug === "string" ? page.slug : "",
4651
+ studioDocument,
4652
+ title: typeof page.title === "string" ? page.title : "Untitled Page"
4653
+ };
4654
+ },
4655
+ validateStudioDocument: (document) => validateStudioDocument(document, modules),
4656
+ saveDraft: async (pageID, document, _metadata) => {
4657
+ const normalizedDocument = normalizeLegacyHeroDefaults(normalizeDocument(document));
4658
+ const compileResult = compileStudioDocument(normalizedDocument, modules);
4659
+ await payload.update({
4660
+ collection: collectionSlug,
4661
+ data: {
4662
+ _status: "draft",
4663
+ layout: compileResult.layout,
4664
+ studioDocument: normalizedDocument,
4665
+ studioValidationIssues: compileResult.issues,
4666
+ title: normalizedDocument.title
4667
+ },
4668
+ id: pageID,
4669
+ overrideAccess: false,
4670
+ user
4671
+ });
4672
+ return {
4673
+ id: pageID,
4674
+ status: "draft"
4675
+ };
4676
+ },
4677
+ publish: async (pageID, document, _metadata) => {
4678
+ const normalizedDocument = normalizeLegacyHeroDefaults(normalizeDocument(document));
4679
+ const compileResult = compileStudioDocument(normalizedDocument, modules);
4680
+ assertCanPublish(compileResult.issues);
4681
+ await payload.update({
4682
+ collection: collectionSlug,
4683
+ data: {
4684
+ _status: "published",
4685
+ layout: compileResult.layout,
4686
+ studioDocument: normalizedDocument,
4687
+ studioValidationIssues: compileResult.issues,
4688
+ title: normalizedDocument.title
4689
+ },
4690
+ id: pageID,
4691
+ overrideAccess: false,
4692
+ user
4693
+ });
4694
+ return {
4695
+ id: pageID,
4696
+ status: "published"
4697
+ };
4234
4698
  }
4235
- function pathToSegments(path2) {
4236
- if (!path2 || path2 === "/") {
4237
- return [];
4238
- }
4239
- return path2.split("/").filter(Boolean);
4699
+ });
4700
+ var toEditorInitialDoc = (payloadPage) => ({
4701
+ layout: studioDocumentToLayout(payloadPage.studioDocument),
4702
+ slug: typeof payloadPage.slug === "string" ? payloadPage.slug : "",
4703
+ studioDocument: payloadPage.studioDocument,
4704
+ title: payloadPage.title
4705
+ });
4706
+
4707
+ // src/studio-pages/migrations.ts
4708
+ var isRecord6 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
4709
+ var assertPageStudioDocumentV1 = (value) => {
4710
+ if (!isRecord6(value)) {
4711
+ throw new Error("Studio document must be an object");
4712
+ }
4713
+ if (value.schemaVersion !== 1) {
4714
+ throw new Error("Unsupported studio schemaVersion");
4715
+ }
4716
+ if (!Array.isArray(value.nodes)) {
4717
+ throw new Error("Studio document nodes must be an array");
4240
4718
  }
4719
+ const nodes = value.nodes.map((node, index) => {
4720
+ if (!isRecord6(node)) {
4721
+ throw new Error(`Node at index ${index} must be an object`);
4722
+ }
4723
+ if (typeof node.id !== "string" || node.id.length === 0) {
4724
+ throw new Error(`Node at index ${index} has invalid id`);
4725
+ }
4726
+ if (typeof node.type !== "string" || node.type.length === 0) {
4727
+ throw new Error(`Node at index ${index} has invalid type`);
4728
+ }
4729
+ if (!isRecord6(node.data)) {
4730
+ throw new Error(`Node at index ${index} has invalid data`);
4731
+ }
4732
+ return {
4733
+ data: node.data,
4734
+ id: node.id,
4735
+ type: node.type
4736
+ };
4737
+ });
4241
4738
  return {
4242
- getPageBySegments,
4243
- listPublishedPagePaths,
4244
- pathToSegments
4739
+ metadata: isRecord6(value.metadata) ? value.metadata : void 0,
4740
+ nodes,
4741
+ schemaVersion: 1,
4742
+ title: typeof value.title === "string" ? value.title : void 0,
4743
+ updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
4245
4744
  };
4246
- }
4745
+ };
4746
+ var migratePageNodeToSettingsV2 = (node) => {
4747
+ const normalized = migrateBlockToSettingsV2({
4748
+ blockType: node.type,
4749
+ ...node.data
4750
+ });
4751
+ const { blockType: _ignoredBlockType, ...data } = normalized;
4752
+ return {
4753
+ ...node,
4754
+ data
4755
+ };
4756
+ };
4757
+ var migratePageDocumentSettingsToV2 = (value) => {
4758
+ const current = assertPageStudioDocumentV1(value);
4759
+ return {
4760
+ ...current,
4761
+ nodes: current.nodes.map(migratePageNodeToSettingsV2)
4762
+ };
4763
+ };
4764
+ var pageStudioMigrations = [
4765
+ {
4766
+ fromVersion: 1,
4767
+ migrate: migratePageDocumentSettingsToV2,
4768
+ toVersion: 1
4769
+ }
4770
+ ];
4247
4771
 
4248
- // src/nextjs/queries/site.ts
4249
- var import_cache2 = require("next/cache");
4250
- function createSiteQueries(getPayloadClient, contentTag = "website-content") {
4251
- const getSiteSettingsCached = (0, import_cache2.unstable_cache)(
4252
- async () => {
4253
- const payload = await getPayloadClient();
4254
- const settings = await payload.findGlobal({
4255
- slug: "site-settings",
4256
- depth: 1
4257
- });
4258
- return settings;
4259
- },
4260
- ["site-settings-global"],
4261
- { tags: [contentTag] }
4262
- );
4263
- const getHeaderCached = (0, import_cache2.unstable_cache)(
4264
- async () => {
4265
- const payload = await getPayloadClient();
4266
- const header = await payload.findGlobal({
4267
- slug: "header",
4268
- depth: 1
4269
- });
4270
- return header;
4271
- },
4272
- ["header-global"],
4273
- { tags: [contentTag] }
4274
- );
4275
- const getFooterCached = (0, import_cache2.unstable_cache)(
4276
- async () => {
4277
- const payload = await getPayloadClient();
4278
- const footer = await payload.findGlobal({
4279
- slug: "footer",
4280
- depth: 1
4281
- });
4282
- return footer;
4283
- },
4284
- ["footer-global"],
4285
- { tags: [contentTag] }
4286
- );
4287
- const getSocialMediaCached = (0, import_cache2.unstable_cache)(
4288
- async () => {
4289
- const payload = await getPayloadClient();
4290
- const socialMedia = await payload.findGlobal({
4291
- slug: "social-media",
4292
- depth: 1
4293
- });
4294
- return socialMedia;
4772
+ // src/studio-pages/index.ts
4773
+ var withSectionStyleDefaults = (value) => ({
4774
+ ...sectionStyleDefaults,
4775
+ ...value
4776
+ });
4777
+ var defaultNodeData = {
4778
+ bookingEmbed: {
4779
+ ...withSectionStyleDefaults({}),
4780
+ buttonHref: "/contact",
4781
+ buttonLabel: "Book Consultation",
4782
+ description: "Let visitors book a consultation.",
4783
+ title: "Book a Time"
4784
+ },
4785
+ beforeAfter: withSectionStyleDefaults({
4786
+ itemsPerRow: 2,
4787
+ items: [
4788
+ {
4789
+ description: "Before and after result summary.",
4790
+ imageCornerStyle: "rounded",
4791
+ imageFit: "cover",
4792
+ imagePosition: "center",
4793
+ label: "Project One"
4794
+ }
4795
+ ],
4796
+ subtitle: "Show visual proof from real projects.",
4797
+ title: "Before & After Results"
4798
+ }),
4799
+ cta: {
4800
+ ...withSectionStyleDefaults({}),
4801
+ backgroundColor: "",
4802
+ bullets: [],
4803
+ buttonHref: "/contact",
4804
+ buttonLabel: "Contact Us",
4805
+ description: "Optional supporting copy.",
4806
+ eyebrow: "",
4807
+ headline: "Ready to get started?",
4808
+ imageURL: "",
4809
+ style: "light"
4810
+ },
4811
+ faq: {
4812
+ ...withSectionStyleDefaults({}),
4813
+ items: [{ answer: "Answer goes here.", question: "Frequently asked question?" }],
4814
+ title: "Frequently Asked Questions"
4815
+ },
4816
+ featureGrid: {
4817
+ ...withSectionStyleDefaults({}),
4818
+ itemsPerRow: 3,
4819
+ items: [
4820
+ { description: "Explain this point.", iconType: "badge", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
4821
+ { description: "Explain this point.", iconType: "badge", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
4822
+ { description: "Explain this point.", iconType: "badge", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
4823
+ ],
4824
+ subtitle: "",
4825
+ title: "Section Title",
4826
+ variant: "cards"
4827
+ },
4828
+ formEmbed: {
4829
+ ...withSectionStyleDefaults({}),
4830
+ description: "Collect lead details from visitors.",
4831
+ formType: "quote",
4832
+ submitLabel: "Submit",
4833
+ title: "Request a Quote"
4834
+ },
4835
+ hero: {
4836
+ ...withSectionStyleDefaults({}),
4837
+ backgroundColor: "",
4838
+ backgroundImageURL: "",
4839
+ backgroundOverlayMode: "none",
4840
+ backgroundOverlayOpacity: 45,
4841
+ backgroundOverlayColor: "#000000",
4842
+ backgroundOverlayGradientFrom: "#334b63",
4843
+ backgroundOverlayGradientTo: "#496582",
4844
+ backgroundOverlayGradientAngle: "135",
4845
+ backgroundOverlayGradientFromStrength: 100,
4846
+ backgroundOverlayGradientToStrength: 100,
4847
+ backgroundOverlayGradientStart: 0,
4848
+ backgroundOverlayGradientEnd: 100,
4849
+ backgroundOverlayGradientFeather: 100,
4850
+ backgroundImageCornerStyle: "rounded",
4851
+ backgroundImageFit: "cover",
4852
+ backgroundImagePosition: "center",
4853
+ heroHeight: "sm",
4854
+ headline: "New Hero Section",
4855
+ kicker: "Optional kicker",
4856
+ primaryHref: "/contact",
4857
+ primaryLabel: "Primary Action",
4858
+ secondaryHref: "/services",
4859
+ secondaryLabel: "Secondary Action",
4860
+ subheadline: "Describe your offer clearly for website visitors.",
4861
+ variant: "default"
4862
+ },
4863
+ media: {
4864
+ ...withSectionStyleDefaults({}),
4865
+ caption: "Add a caption",
4866
+ imageCornerStyle: "rounded",
4867
+ imageFit: "cover",
4868
+ imagePosition: "center",
4869
+ size: "default"
4870
+ },
4871
+ logoWall: withSectionStyleDefaults({
4872
+ items: [
4873
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
4874
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
4875
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
4876
+ ],
4877
+ subtitle: "Show logos from trusted associations, partners, or collaborators.",
4878
+ title: "Trusted by Great Partners"
4879
+ }),
4880
+ richText: {
4881
+ ...withSectionStyleDefaults({}),
4882
+ cards: [],
4883
+ content: {
4884
+ root: {
4885
+ children: [
4886
+ {
4887
+ children: [
4888
+ {
4889
+ detail: 0,
4890
+ format: 0,
4891
+ mode: "normal",
4892
+ style: "",
4893
+ text: "Write your content here.",
4894
+ type: "text",
4895
+ version: 1
4896
+ }
4897
+ ],
4898
+ direction: "ltr",
4899
+ format: "",
4900
+ indent: 0,
4901
+ type: "paragraph",
4902
+ version: 1
4903
+ }
4904
+ ],
4905
+ direction: "ltr",
4906
+ format: "",
4907
+ indent: 0,
4908
+ type: "root",
4909
+ version: 1
4910
+ }
4295
4911
  },
4296
- ["social-media-global"],
4297
- { tags: [contentTag] }
4298
- );
4299
- async function getSiteSettings(draft = false) {
4300
- if (draft) {
4301
- const payload = await getPayloadClient();
4302
- const settings = await payload.findGlobal({
4303
- slug: "site-settings",
4304
- depth: 1,
4305
- draft: true
4306
- });
4307
- return settings;
4308
- }
4309
- return getSiteSettingsCached();
4912
+ statsItems: [],
4913
+ title: "Section Heading",
4914
+ width: "normal"
4915
+ },
4916
+ testimonials: {
4917
+ ...withSectionStyleDefaults({}),
4918
+ autoRotate: true,
4919
+ items: [{ location: "City, ST", name: "Customer Name", quote: "Customer feedback goes here.", rating: 5 }],
4920
+ rotateIntervalSeconds: 7,
4921
+ title: "What Customers Say",
4922
+ visibleCount: 3
4923
+ },
4924
+ stats: withSectionStyleDefaults({
4925
+ items: [
4926
+ { description: "Average first response", label: "Response Time", value: "24h" },
4927
+ { description: "Client satisfaction score", label: "Satisfaction", value: "4.9/5" },
4928
+ { description: "Recent projects or clients served", label: "Recent Work", value: "150+" }
4929
+ ],
4930
+ subtitle: "Highlight measurable outcomes to build trust quickly.",
4931
+ title: "Performance Highlights"
4932
+ })
4933
+ };
4934
+ var nodeTypeLabels = {
4935
+ bookingEmbed: "Booking Embed",
4936
+ beforeAfter: "Before / After",
4937
+ cta: "Call To Action",
4938
+ faq: "FAQ",
4939
+ featureGrid: "Feature Grid",
4940
+ formEmbed: "Form Embed",
4941
+ hero: "Hero",
4942
+ logoWall: "Logo Wall",
4943
+ media: "Media",
4944
+ richText: "Rich Text",
4945
+ stats: "Stats",
4946
+ testimonials: "Testimonials"
4947
+ };
4948
+ var pageNodeTypes = Object.keys(defaultNodeData).map((type) => ({
4949
+ type,
4950
+ displayName: nodeTypeLabels[type] || type,
4951
+ description: `Page node for ${nodeTypeLabels[type] || type}`,
4952
+ getDefaultData: () => {
4953
+ const migrated = migrateBlockToSettingsV2(structuredClone(defaultNodeData[type]));
4954
+ const { blockType: _ignoredBlockType, ...data } = migrated;
4955
+ return data;
4310
4956
  }
4311
- async function getHeader(draft = false) {
4312
- if (draft) {
4313
- const payload = await getPayloadClient();
4314
- const header = await payload.findGlobal({
4315
- slug: "header",
4316
- depth: 1,
4317
- draft: true
4318
- });
4319
- return header;
4320
- }
4321
- return getHeaderCached();
4957
+ }));
4958
+ var validatePageDocument = (document) => {
4959
+ const issues = [];
4960
+ if (!document.title || document.title.trim().length === 0) {
4961
+ issues.push({
4962
+ code: "pages.title.required",
4963
+ message: "Page title is required before publishing.",
4964
+ path: "title",
4965
+ severity: "error"
4966
+ });
4322
4967
  }
4323
- async function getFooter(draft = false) {
4324
- if (draft) {
4325
- const payload = await getPayloadClient();
4326
- const footer = await payload.findGlobal({
4327
- slug: "footer",
4328
- depth: 1,
4329
- draft: true
4330
- });
4331
- return footer;
4332
- }
4333
- return getFooterCached();
4968
+ if (document.nodes.length === 0) {
4969
+ issues.push({
4970
+ code: "pages.nodes.required",
4971
+ message: "At least one section is required.",
4972
+ path: "nodes",
4973
+ severity: "error"
4974
+ });
4334
4975
  }
4335
- async function getSocialMedia(draft = false) {
4336
- if (draft) {
4337
- const payload = await getPayloadClient();
4338
- const socialMedia = await payload.findGlobal({
4339
- slug: "social-media",
4340
- depth: 1,
4341
- draft: true
4976
+ document.nodes.forEach((node, index) => {
4977
+ if (node.type === "hero" && typeof node.data.headline !== "string") {
4978
+ issues.push({
4979
+ code: "pages.hero.headline",
4980
+ message: "Hero section requires a headline.",
4981
+ path: `nodes.${index}.data.headline`,
4982
+ severity: "error"
4342
4983
  });
4343
- return socialMedia;
4344
4984
  }
4345
- return getSocialMediaCached();
4346
- }
4347
- return {
4348
- getSiteSettings,
4349
- getHeader,
4350
- getFooter,
4351
- getSocialMedia
4352
- };
4353
- }
4354
-
4355
- // src/nextjs/utilities/media.ts
4356
- function resolveMedia(media) {
4357
- if (!media) {
4358
- return null;
4359
- }
4360
- if (typeof media === "number" || typeof media === "string") {
4361
- return null;
4362
- }
4363
- if (media.url) {
4364
- return {
4365
- url: media.url,
4366
- alt: media.alt || ""
4367
- };
4368
- }
4369
- if (media.filename) {
4370
- return {
4371
- url: `/media/${media.filename}`,
4372
- alt: media.alt || ""
4373
- };
4374
- }
4375
- return null;
4376
- }
4377
-
4378
- // src/nextjs/utilities/socialMedia.ts
4379
- function resolveSocialMediaLinks(data) {
4380
- const profiles = data?.profiles;
4381
- if (!profiles || typeof profiles !== "object") {
4382
- return [];
4985
+ });
4986
+ return issues;
4987
+ };
4988
+ var pagePaletteGroups = [
4989
+ {
4990
+ id: "page-core",
4991
+ label: "Core Sections",
4992
+ items: [
4993
+ { nodeType: "hero", title: "Hero", description: "Top-of-page headline and CTA" },
4994
+ { nodeType: "featureGrid", title: "Feature Grid", description: "Service or value cards" },
4995
+ { nodeType: "stats", title: "Stats", description: "Key performance highlights" },
4996
+ { nodeType: "logoWall", title: "Logo Wall", description: "Trust logos and badges" },
4997
+ { nodeType: "beforeAfter", title: "Before / After", description: "Visual before-and-after gallery" },
4998
+ { nodeType: "richText", title: "Rich Text", description: "Long-form content area" },
4999
+ { nodeType: "media", title: "Media", description: "Image/video section" },
5000
+ { nodeType: "testimonials", title: "Testimonials", description: "Social proof quotes" },
5001
+ { nodeType: "faq", title: "FAQ", description: "Question-and-answer section" },
5002
+ { nodeType: "cta", title: "Call To Action", description: "Conversion strip with button" },
5003
+ { nodeType: "formEmbed", title: "Form Embed", description: "Lead capture form" },
5004
+ { nodeType: "bookingEmbed", title: "Booking Embed", description: "Scheduling panel" }
5005
+ ]
4383
5006
  }
4384
- return SOCIAL_MEDIA_PLATFORMS.reduce((acc, platform) => {
4385
- const profile = profiles[platform];
4386
- if (!profile || typeof profile !== "object") {
4387
- return acc;
4388
- }
4389
- const url = typeof profile.url === "string" ? profile.url.trim() : "";
4390
- if (!url) {
4391
- return acc;
5007
+ ];
5008
+ var pageInspectorPanelRegistry = Object.keys(defaultNodeData).map((nodeType) => ({
5009
+ nodeType,
5010
+ panelID: `${nodeType}-panel`,
5011
+ panelLabel: `${nodeTypeLabels[nodeType] || nodeType} Settings`
5012
+ }));
5013
+ var resolvePanelFields = (nodeType) => inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
5014
+ advanced: field.advanced,
5015
+ group: field.group,
5016
+ inlineEditable: field.inlineEditable,
5017
+ key: field.key,
5018
+ label: field.label,
5019
+ type: field.type
5020
+ })) || [];
5021
+ var pageInspectorPanels = pageInspectorPanelRegistry.map((entry) => ({
5022
+ fields: resolvePanelFields(entry.nodeType),
5023
+ id: entry.panelID,
5024
+ label: entry.panelLabel,
5025
+ nodeType: entry.nodeType
5026
+ }));
5027
+ var pageStudioModuleManifest = {
5028
+ id: "studio-pages",
5029
+ version: "0.1.0-beta.0",
5030
+ displayName: "Pages Studio Module",
5031
+ nodeTypes: pageNodeTypes,
5032
+ paletteGroups: pagePaletteGroups,
5033
+ inspectorPanels: pageInspectorPanels,
5034
+ validators: [validatePageDocument],
5035
+ migrations: pageStudioMigrations,
5036
+ compiler: {
5037
+ compileNode: (node) => {
5038
+ const normalized = migrateBlockToSettingsV2({
5039
+ blockType: node.type,
5040
+ ...node.data
5041
+ });
5042
+ return {
5043
+ id: node.id,
5044
+ ...normalized
5045
+ };
4392
5046
  }
4393
- const icon = typeof profile.icon === "string" && profile.icon.trim().length > 0 ? profile.icon.trim() : SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM[platform];
4394
- acc.push({
4395
- icon,
4396
- label: SOCIAL_MEDIA_PLATFORM_LABELS[platform],
4397
- platform,
4398
- url
4399
- });
4400
- return acc;
4401
- }, []);
4402
- }
5047
+ },
5048
+ permissions: [
5049
+ { action: "read", role: "admin" },
5050
+ { action: "read", role: "editor" },
5051
+ { action: "read", role: "client" },
5052
+ { action: "update", role: "admin" },
5053
+ { action: "update", role: "editor" },
5054
+ { action: "update", role: "client" },
5055
+ { action: "publish", role: "admin" },
5056
+ { action: "publish", role: "editor" }
5057
+ ]
5058
+ };
4403
5059
  // Annotate the CommonJS export names for ESM import in node:
4404
5060
  0 && (module.exports = {
4405
5061
  admin,