@orion-studios/payload-studio 0.6.0-beta.9 → 0.7.0
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.
- package/README.md +6 -1
- package/bin/init.js +329 -0
- package/dist/admin/client.js +2106 -585
- package/dist/admin/client.mjs +2161 -653
- package/dist/admin/index.d.mts +2 -2
- package/dist/admin/index.d.ts +2 -2
- package/dist/admin/index.js +190 -36
- package/dist/admin/index.mjs +2 -2
- package/dist/admin-app/client.js +14 -5
- package/dist/admin-app/client.mjs +1 -1
- package/dist/admin-app/index.d.mts +2 -2
- package/dist/admin-app/index.d.ts +2 -2
- package/dist/admin-app/styles.css +361 -41
- package/dist/admin.css +98 -2
- package/dist/blocks/index.mjs +1 -2
- package/dist/builder-v2/client.d.mts +18 -0
- package/dist/builder-v2/client.d.ts +18 -0
- package/dist/builder-v2/client.js +4287 -0
- package/dist/builder-v2/client.mjs +4162 -0
- package/dist/builder-v2/index.d.mts +249 -0
- package/dist/builder-v2/index.d.ts +249 -0
- package/dist/builder-v2/index.js +836 -0
- package/dist/builder-v2/index.mjs +786 -0
- package/dist/builder-v2/styles.css +2705 -0
- package/dist/{chunk-PF3EBZXF.mjs → chunk-7ZMXZRBP.mjs} +39 -3
- package/dist/{chunk-XKUTZ7IU.mjs → chunk-DTHBPJXU.mjs} +246 -25
- package/dist/{chunk-JQAHXYAM.mjs → chunk-KMYMSR7W.mjs} +163 -3
- package/dist/{chunk-WLOPFFN2.mjs → chunk-MMJNHBOF.mjs} +193 -39
- package/dist/{chunk-KPIX7OSV.mjs → chunk-NF37A575.mjs} +14 -5
- package/dist/{chunk-OTHERBGX.mjs → chunk-OF6BATTO.mjs} +57 -112
- package/dist/chunk-VA545CHJ.mjs +202 -0
- package/dist/forms/index.d.mts +25 -0
- package/dist/forms/index.d.ts +25 -0
- package/dist/forms/index.js +237 -0
- package/dist/forms/index.mjs +25 -0
- package/dist/forms/server.d.mts +35 -0
- package/dist/forms/server.d.ts +35 -0
- package/dist/forms/server.js +442 -0
- package/dist/forms/server.mjs +228 -0
- package/dist/{index-Crx_MtPw.d.ts → index-0xXWuOuz.d.ts} +38 -6
- package/dist/{index-Cv-6qnrw.d.mts → index-BU82akSL.d.mts} +38 -6
- package/dist/{index-Bm2SaC3r.d.mts → index-BbTcimgH.d.mts} +4 -2
- package/dist/{index-D8BNfUJb.d.mts → index-Cen-9wcc.d.mts} +17 -5
- package/dist/{index-52HdVLQq.d.ts → index-DAdN56fM.d.ts} +1 -1
- package/dist/{index-CkT_eyhK.d.ts → index-DV-nW43e.d.ts} +4 -2
- package/dist/{index-DEQC3Dwj.d.mts → index-G_uTNffQ.d.mts} +1 -1
- package/dist/{index-DD_E2UfJ.d.ts → index-gxcMPpm-.d.ts} +17 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +522 -171
- package/dist/index.mjs +10 -11
- package/dist/nextjs/index.d.mts +1 -1
- package/dist/nextjs/index.d.ts +1 -1
- package/dist/nextjs/index.js +95 -114
- package/dist/nextjs/index.mjs +2 -2
- package/dist/{sitePreviewTypes-BkHCWxNW.d.mts → sitePreviewTypes-BrJwGzJj.d.mts} +1 -1
- package/dist/{sitePreviewTypes-BkHCWxNW.d.ts → sitePreviewTypes-BrJwGzJj.d.ts} +1 -1
- package/dist/studio-pages/builder.css +66 -5
- package/dist/studio-pages/client.js +618 -73
- package/dist/studio-pages/client.mjs +641 -96
- package/dist/studio-pages/index.d.mts +1 -1
- package/dist/studio-pages/index.d.ts +1 -1
- package/dist/studio-pages/index.js +1893 -24
- package/dist/studio-pages/index.mjs +11 -3
- package/package.json +38 -3
- package/dist/chunk-OQSEJXC4.mjs +0 -166
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
adminNavIcons
|
|
3
|
-
} from "./chunk-W2UOCJDX.mjs";
|
|
4
1
|
import {
|
|
5
2
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
6
3
|
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
7
4
|
SOCIAL_MEDIA_PLATFORMS,
|
|
8
5
|
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
9
6
|
} from "./chunk-ZTXJG4K5.mjs";
|
|
7
|
+
import {
|
|
8
|
+
adminNavIcons
|
|
9
|
+
} from "./chunk-W2UOCJDX.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__export,
|
|
12
12
|
__require
|
|
@@ -53,7 +53,7 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
|
|
|
53
53
|
var themePreferenceField = createThemePreferenceField("brand-light");
|
|
54
54
|
|
|
55
55
|
// src/shared/studioSections.ts
|
|
56
|
-
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
56
|
+
var studioRoles = /* @__PURE__ */ new Set(["admin", "developer", "editor", "client"]);
|
|
57
57
|
var studioIcons = new Set(adminNavIcons);
|
|
58
58
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
59
59
|
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
@@ -186,6 +186,7 @@ function configureAdmin(config) {
|
|
|
186
186
|
brandPrimary = "#3b82f6",
|
|
187
187
|
brandSecondary = "#8b5cf6",
|
|
188
188
|
defaultTheme = "brand-light",
|
|
189
|
+
logoOnDarkUrl,
|
|
189
190
|
logoUrl,
|
|
190
191
|
allowThemePreference = false,
|
|
191
192
|
userSessionDurationSeconds = 60 * 60 * 24
|
|
@@ -230,23 +231,33 @@ function configureAdmin(config) {
|
|
|
230
231
|
if (cssSources.length === 0) {
|
|
231
232
|
cssPath = sourceCssPath;
|
|
232
233
|
} else {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
234
|
+
try {
|
|
235
|
+
let css = cssSources.map((filePath) => fs.readFileSync(filePath, "utf-8")).join("\n\n");
|
|
236
|
+
css = css.replace(
|
|
237
|
+
"--orion-cms-brand-primary-fallback: #3b82f6;",
|
|
238
|
+
`--orion-cms-brand-primary-fallback: ${brandPrimary};`
|
|
239
|
+
);
|
|
240
|
+
css = css.replace(
|
|
241
|
+
"--orion-cms-brand-secondary-fallback: #8b5cf6;",
|
|
242
|
+
`--orion-cms-brand-secondary-fallback: ${brandSecondary};`
|
|
243
|
+
);
|
|
244
|
+
const outputBasePath = config.basePath || process.cwd();
|
|
245
|
+
const genDir = path.resolve(outputBasePath, ".generated");
|
|
246
|
+
const genPath = path.resolve(genDir, "admin.css");
|
|
247
|
+
let existing = null;
|
|
248
|
+
try {
|
|
249
|
+
existing = fs.readFileSync(genPath, "utf-8");
|
|
250
|
+
} catch {
|
|
251
|
+
existing = null;
|
|
252
|
+
}
|
|
253
|
+
if (existing !== css) {
|
|
254
|
+
fs.mkdirSync(genDir, { recursive: true });
|
|
255
|
+
fs.writeFileSync(genPath, css);
|
|
256
|
+
}
|
|
257
|
+
cssPath = genPath;
|
|
258
|
+
} catch {
|
|
259
|
+
cssPath = sourceCssPath;
|
|
246
260
|
}
|
|
247
|
-
const genPath = path.resolve(genDir, "admin.css");
|
|
248
|
-
fs.writeFileSync(genPath, css);
|
|
249
|
-
cssPath = genPath;
|
|
250
261
|
}
|
|
251
262
|
const clientPath = "@orion-studios/payload-studio/admin/client";
|
|
252
263
|
const studioNavClientProps = {
|
|
@@ -293,6 +304,49 @@ function configureAdmin(config) {
|
|
|
293
304
|
}
|
|
294
305
|
};
|
|
295
306
|
};
|
|
307
|
+
const attachStudioEditRedirectToCollection = (collection, options) => {
|
|
308
|
+
if (!studioEnabled) {
|
|
309
|
+
return collection;
|
|
310
|
+
}
|
|
311
|
+
const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(collection);
|
|
312
|
+
const existingViews = collectionWithBreadcrumb.admin?.components?.views;
|
|
313
|
+
const existingEditViews = existingViews?.edit;
|
|
314
|
+
const hasCustomEditView = Boolean(
|
|
315
|
+
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
316
|
+
);
|
|
317
|
+
if (hasCustomEditView) {
|
|
318
|
+
return collectionWithBreadcrumb;
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
...collectionWithBreadcrumb,
|
|
322
|
+
admin: {
|
|
323
|
+
...collectionWithBreadcrumb.admin,
|
|
324
|
+
components: {
|
|
325
|
+
...collectionWithBreadcrumb.admin?.components,
|
|
326
|
+
views: {
|
|
327
|
+
...existingViews,
|
|
328
|
+
edit: {
|
|
329
|
+
...existingEditViews,
|
|
330
|
+
default: {
|
|
331
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
332
|
+
Component: {
|
|
333
|
+
exportName: "StudioDocumentRedirect",
|
|
334
|
+
path: clientPath,
|
|
335
|
+
clientProps: {
|
|
336
|
+
description: options.description,
|
|
337
|
+
...options.emptyHref ? { emptyHref: options.emptyHref } : {},
|
|
338
|
+
...options.emptyLabel ? { emptyLabel: options.emptyLabel } : {},
|
|
339
|
+
pathBase: options.pathBase,
|
|
340
|
+
title: options.title
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
};
|
|
296
350
|
return {
|
|
297
351
|
admin: {
|
|
298
352
|
css: cssPath,
|
|
@@ -310,6 +364,7 @@ function configureAdmin(config) {
|
|
|
310
364
|
path: clientPath,
|
|
311
365
|
clientProps: {
|
|
312
366
|
brandName,
|
|
367
|
+
logoOnDarkUrl,
|
|
313
368
|
logoUrl
|
|
314
369
|
}
|
|
315
370
|
},
|
|
@@ -318,6 +373,7 @@ function configureAdmin(config) {
|
|
|
318
373
|
path: clientPath,
|
|
319
374
|
clientProps: {
|
|
320
375
|
brandName,
|
|
376
|
+
logoOnDarkUrl,
|
|
321
377
|
logoUrl
|
|
322
378
|
}
|
|
323
379
|
}
|
|
@@ -332,6 +388,7 @@ function configureAdmin(config) {
|
|
|
332
388
|
},
|
|
333
389
|
...studioEnabled ? {
|
|
334
390
|
studioGlobals: {
|
|
391
|
+
exact: true,
|
|
335
392
|
path: globalsBasePath,
|
|
336
393
|
Component: {
|
|
337
394
|
exportName: "AdminStudioGlobalsView",
|
|
@@ -343,10 +400,11 @@ function configureAdmin(config) {
|
|
|
343
400
|
}
|
|
344
401
|
}
|
|
345
402
|
},
|
|
346
|
-
|
|
347
|
-
|
|
403
|
+
studioPageNew: {
|
|
404
|
+
exact: true,
|
|
405
|
+
path: `${pagesBasePath}/new`,
|
|
348
406
|
Component: {
|
|
349
|
-
exportName: "
|
|
407
|
+
exportName: "AdminStudioNewPageView",
|
|
350
408
|
path: clientPath,
|
|
351
409
|
clientProps: {
|
|
352
410
|
...studioNavClientProps,
|
|
@@ -355,6 +413,7 @@ function configureAdmin(config) {
|
|
|
355
413
|
}
|
|
356
414
|
},
|
|
357
415
|
studioPageEditor: {
|
|
416
|
+
exact: true,
|
|
358
417
|
path: `${pagesBasePath}/:id`,
|
|
359
418
|
Component: {
|
|
360
419
|
exportName: "AdminStudioPageEditView",
|
|
@@ -365,10 +424,11 @@ function configureAdmin(config) {
|
|
|
365
424
|
}
|
|
366
425
|
}
|
|
367
426
|
},
|
|
368
|
-
|
|
369
|
-
|
|
427
|
+
studioPages: {
|
|
428
|
+
exact: true,
|
|
429
|
+
path: pagesBasePath,
|
|
370
430
|
Component: {
|
|
371
|
-
exportName: "
|
|
431
|
+
exportName: "AdminStudioPagesListView",
|
|
372
432
|
path: clientPath,
|
|
373
433
|
clientProps: {
|
|
374
434
|
...studioNavClientProps,
|
|
@@ -377,6 +437,7 @@ function configureAdmin(config) {
|
|
|
377
437
|
}
|
|
378
438
|
},
|
|
379
439
|
studioContactForm: {
|
|
440
|
+
exact: true,
|
|
380
441
|
path: contactFormStudioPath,
|
|
381
442
|
Component: {
|
|
382
443
|
exportName: "AdminStudioContactFormView",
|
|
@@ -389,7 +450,47 @@ function configureAdmin(config) {
|
|
|
389
450
|
}
|
|
390
451
|
},
|
|
391
452
|
...formsEnabled ? {
|
|
453
|
+
studioFormSubmission: {
|
|
454
|
+
exact: true,
|
|
455
|
+
path: `${formsBasePath}/submissions/:id`,
|
|
456
|
+
Component: {
|
|
457
|
+
exportName: "AdminStudioFormSubmissionView",
|
|
458
|
+
path: clientPath,
|
|
459
|
+
clientProps: {
|
|
460
|
+
...studioNavClientProps,
|
|
461
|
+
formsCollectionSlug,
|
|
462
|
+
formSubmissionsCollectionSlug,
|
|
463
|
+
formUploadsCollectionSlug
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
studioFormUpload: {
|
|
468
|
+
exact: true,
|
|
469
|
+
path: `${formsBasePath}/uploads/:id`,
|
|
470
|
+
Component: {
|
|
471
|
+
exportName: "AdminStudioFormUploadView",
|
|
472
|
+
path: clientPath,
|
|
473
|
+
clientProps: {
|
|
474
|
+
...studioNavClientProps,
|
|
475
|
+
formUploadsCollectionSlug
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
studioFormDetail: {
|
|
480
|
+
exact: true,
|
|
481
|
+
path: `${formsBasePath}/:id`,
|
|
482
|
+
Component: {
|
|
483
|
+
exportName: "AdminStudioFormDetailView",
|
|
484
|
+
path: clientPath,
|
|
485
|
+
clientProps: {
|
|
486
|
+
...studioNavClientProps,
|
|
487
|
+
formsCollectionSlug,
|
|
488
|
+
formSubmissionsCollectionSlug
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
392
492
|
studioForms: {
|
|
493
|
+
exact: true,
|
|
393
494
|
path: formsBasePath,
|
|
394
495
|
Component: {
|
|
395
496
|
exportName: "AdminStudioFormsView",
|
|
@@ -403,10 +504,11 @@ function configureAdmin(config) {
|
|
|
403
504
|
}
|
|
404
505
|
}
|
|
405
506
|
} : {},
|
|
406
|
-
|
|
407
|
-
|
|
507
|
+
studioMediaItem: {
|
|
508
|
+
exact: true,
|
|
509
|
+
path: `${mediaBasePath}/:id`,
|
|
408
510
|
Component: {
|
|
409
|
-
exportName: "
|
|
511
|
+
exportName: "AdminStudioMediaItemView",
|
|
410
512
|
path: clientPath,
|
|
411
513
|
clientProps: {
|
|
412
514
|
...studioNavClientProps,
|
|
@@ -414,10 +516,11 @@ function configureAdmin(config) {
|
|
|
414
516
|
}
|
|
415
517
|
}
|
|
416
518
|
},
|
|
417
|
-
|
|
418
|
-
|
|
519
|
+
studioMedia: {
|
|
520
|
+
exact: true,
|
|
521
|
+
path: mediaBasePath,
|
|
419
522
|
Component: {
|
|
420
|
-
exportName: "
|
|
523
|
+
exportName: "AdminStudioMediaView",
|
|
421
524
|
path: clientPath,
|
|
422
525
|
clientProps: {
|
|
423
526
|
...studioNavClientProps,
|
|
@@ -426,6 +529,7 @@ function configureAdmin(config) {
|
|
|
426
529
|
}
|
|
427
530
|
},
|
|
428
531
|
studioTools: {
|
|
532
|
+
exact: true,
|
|
429
533
|
path: toolsBasePath,
|
|
430
534
|
Component: {
|
|
431
535
|
exportName: "AdminStudioToolsView",
|
|
@@ -470,6 +574,7 @@ function configureAdmin(config) {
|
|
|
470
574
|
path: clientPath,
|
|
471
575
|
clientProps: {
|
|
472
576
|
brandName,
|
|
577
|
+
logoOnDarkUrl,
|
|
473
578
|
logoUrl
|
|
474
579
|
}
|
|
475
580
|
}
|
|
@@ -578,25 +683,74 @@ function configureAdmin(config) {
|
|
|
578
683
|
return attachStudioBackBreadcrumbToCollection(mediaCollection);
|
|
579
684
|
},
|
|
580
685
|
wrapFormsCollection(formsCollection) {
|
|
581
|
-
return
|
|
686
|
+
return attachStudioEditRedirectToCollection(formsCollection, {
|
|
687
|
+
description: "Redirecting to the Studio form workspace.",
|
|
688
|
+
emptyHref: formsBasePath,
|
|
689
|
+
emptyLabel: "Open Forms",
|
|
690
|
+
pathBase: formsBasePath,
|
|
691
|
+
title: "Opening Form..."
|
|
692
|
+
});
|
|
582
693
|
},
|
|
583
694
|
wrapFormSubmissionsCollection(formSubmissionsCollection) {
|
|
584
|
-
return
|
|
695
|
+
return attachStudioEditRedirectToCollection(formSubmissionsCollection, {
|
|
696
|
+
description: "Redirecting to the Studio submission workspace.",
|
|
697
|
+
emptyHref: formsBasePath,
|
|
698
|
+
emptyLabel: "Open Forms",
|
|
699
|
+
pathBase: `${formsBasePath}/submissions`,
|
|
700
|
+
title: "Opening Submission..."
|
|
701
|
+
});
|
|
585
702
|
},
|
|
586
703
|
wrapFormUploadsCollection(formUploadsCollection) {
|
|
587
|
-
return
|
|
704
|
+
return attachStudioEditRedirectToCollection(formUploadsCollection, {
|
|
705
|
+
description: "Redirecting to the Studio upload workspace.",
|
|
706
|
+
emptyHref: formsBasePath,
|
|
707
|
+
emptyLabel: "Open Forms",
|
|
708
|
+
pathBase: `${formsBasePath}/uploads`,
|
|
709
|
+
title: "Opening Upload..."
|
|
710
|
+
});
|
|
588
711
|
},
|
|
589
712
|
wrapGlobals(globals2) {
|
|
590
|
-
const
|
|
713
|
+
const defaultLabelMap = {
|
|
591
714
|
header: { group: "Site Design", label: "Header & Navigation" },
|
|
592
715
|
footer: { group: "Site Design", label: "Footer" },
|
|
593
716
|
"site-settings": { group: "Site Design", label: "Website Settings" },
|
|
594
717
|
"social-media": { group: "Site Design", label: "Social Media" },
|
|
595
718
|
"contact-form": { group: "Lead Forms", label: "Contact Form" }
|
|
596
719
|
};
|
|
720
|
+
const configuredBySlug = new Map(
|
|
721
|
+
(config.studio?.globals || []).map((link) => [link.slug, link])
|
|
722
|
+
);
|
|
723
|
+
const attachBreadcrumbToGlobal = (global) => {
|
|
724
|
+
if (!studioEnabled) {
|
|
725
|
+
return global;
|
|
726
|
+
}
|
|
727
|
+
const existingControls = global.admin?.components?.elements?.beforeDocumentControls;
|
|
728
|
+
return {
|
|
729
|
+
...global,
|
|
730
|
+
admin: {
|
|
731
|
+
...global.admin,
|
|
732
|
+
components: {
|
|
733
|
+
...global.admin?.components,
|
|
734
|
+
elements: {
|
|
735
|
+
...global.admin?.components?.elements,
|
|
736
|
+
beforeDocumentControls: appendComponent(
|
|
737
|
+
existingControls,
|
|
738
|
+
studioBackBreadcrumbComponent,
|
|
739
|
+
"StudioBackBreadcrumb"
|
|
740
|
+
)
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
};
|
|
597
746
|
return globals2.map((global) => {
|
|
598
|
-
const
|
|
599
|
-
|
|
747
|
+
const configured = configuredBySlug.get(global.slug);
|
|
748
|
+
const defaults = defaultLabelMap[global.slug];
|
|
749
|
+
const mapping = configured || defaults ? {
|
|
750
|
+
group: configured?.group || defaults?.group,
|
|
751
|
+
label: configured?.label || defaults?.label || global.slug
|
|
752
|
+
} : void 0;
|
|
753
|
+
if (!mapping) return attachBreadcrumbToGlobal(global);
|
|
600
754
|
const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
|
|
601
755
|
const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
|
|
602
756
|
const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
|
|
@@ -705,7 +859,7 @@ function configureAdmin(config) {
|
|
|
705
859
|
...global,
|
|
706
860
|
admin: {
|
|
707
861
|
...global.admin,
|
|
708
|
-
group: mapping.group,
|
|
862
|
+
...mapping.group ? { group: mapping.group } : {},
|
|
709
863
|
components: {
|
|
710
864
|
...global.admin?.components,
|
|
711
865
|
elements: {
|
|
@@ -92,6 +92,14 @@ function NavIcon({ name }) {
|
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
function LogoutIcon() {
|
|
96
|
+
const props = { width: iconSize, height: iconSize, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", style: iconStyle };
|
|
97
|
+
return /* @__PURE__ */ jsxs("svg", { ...props, "aria-hidden": "true", children: [
|
|
98
|
+
/* @__PURE__ */ jsx("path", { d: "M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" }),
|
|
99
|
+
/* @__PURE__ */ jsx("polyline", { points: "10 17 5 12 10 7" }),
|
|
100
|
+
/* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "17", y2: "12" })
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
95
103
|
function AdminShellClient({
|
|
96
104
|
children,
|
|
97
105
|
brandName,
|
|
@@ -103,14 +111,12 @@ function AdminShellClient({
|
|
|
103
111
|
onLogout,
|
|
104
112
|
storageKey = "orion-admin-shell-collapsed"
|
|
105
113
|
}) {
|
|
106
|
-
const [collapsed, setCollapsed] = useState(
|
|
114
|
+
const [collapsed, setCollapsed] = useState(true);
|
|
107
115
|
const [loggingOut, setLoggingOut] = useState(false);
|
|
108
116
|
useEffect(() => {
|
|
109
117
|
try {
|
|
110
118
|
const stored = window.localStorage.getItem(storageKey);
|
|
111
|
-
|
|
112
|
-
setCollapsed(true);
|
|
113
|
-
}
|
|
119
|
+
setCollapsed(stored === "1");
|
|
114
120
|
} catch {
|
|
115
121
|
}
|
|
116
122
|
}, [storageKey]);
|
|
@@ -172,7 +178,10 @@ function AdminShellClient({
|
|
|
172
178
|
/* @__PURE__ */ jsx("div", { className: "orion-admin-user-label", children: "Signed in as" }),
|
|
173
179
|
/* @__PURE__ */ jsx("div", { className: "orion-admin-user-email", children: userEmail })
|
|
174
180
|
] }) : null,
|
|
175
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ jsxs("button", { className: "orion-admin-logout", disabled: loggingOut, onClick: handleLogout, type: "button", children: [
|
|
182
|
+
/* @__PURE__ */ jsx(LogoutIcon, {}),
|
|
183
|
+
/* @__PURE__ */ jsx("span", { children: loggingOut ? "Logging out..." : "Log out" })
|
|
184
|
+
] })
|
|
176
185
|
] })
|
|
177
186
|
] }),
|
|
178
187
|
/* @__PURE__ */ jsx("main", { className: "orion-admin-main", children })
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-ZTXJG4K5.mjs";
|
|
6
6
|
import {
|
|
7
7
|
studioDocumentToLayout
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7ZMXZRBP.mjs";
|
|
9
9
|
import {
|
|
10
10
|
assertStudioDocumentV1
|
|
11
11
|
} from "./chunk-ADIIWIYL.mjs";
|
|
@@ -26,12 +26,15 @@ __export(nextjs_exports, {
|
|
|
26
26
|
|
|
27
27
|
// src/nextjs/client/payload.ts
|
|
28
28
|
import { getPayload } from "payload";
|
|
29
|
-
var payloadPromise = null;
|
|
30
29
|
var WEBSITE_CONTENT_TAG = "website-content";
|
|
31
30
|
function createPayloadClient(config) {
|
|
31
|
+
let payloadPromise = null;
|
|
32
32
|
return function getPayloadClient() {
|
|
33
33
|
if (!payloadPromise) {
|
|
34
|
-
payloadPromise = getPayload({ config })
|
|
34
|
+
payloadPromise = Promise.resolve(config).then((resolvedConfig) => getPayload({ config: resolvedConfig })).catch((error) => {
|
|
35
|
+
payloadPromise = null;
|
|
36
|
+
throw error;
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
return payloadPromise;
|
|
37
40
|
};
|
|
@@ -64,7 +67,7 @@ function normalizePath(segments) {
|
|
|
64
67
|
const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
|
|
65
68
|
return cleaned.length > 0 ? `/${cleaned}` : "/";
|
|
66
69
|
}
|
|
67
|
-
async function queryPageByPath(payload, path, draft) {
|
|
70
|
+
async function queryPageByPath(payload, path, draft, collectionSlug, homeSlug) {
|
|
68
71
|
const pathWhere = {
|
|
69
72
|
path: {
|
|
70
73
|
equals: path
|
|
@@ -76,7 +79,7 @@ async function queryPageByPath(payload, path, draft) {
|
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
const result = await payload.find({
|
|
79
|
-
collection:
|
|
82
|
+
collection: collectionSlug,
|
|
80
83
|
depth: 2,
|
|
81
84
|
draft,
|
|
82
85
|
limit: 1,
|
|
@@ -89,11 +92,11 @@ async function queryPageByPath(payload, path, draft) {
|
|
|
89
92
|
if (path === "/") {
|
|
90
93
|
const homeWhere = {
|
|
91
94
|
slug: {
|
|
92
|
-
equals:
|
|
95
|
+
equals: homeSlug
|
|
93
96
|
}
|
|
94
97
|
};
|
|
95
98
|
const homeResult = await payload.find({
|
|
96
|
-
collection:
|
|
99
|
+
collection: collectionSlug,
|
|
97
100
|
depth: 2,
|
|
98
101
|
draft,
|
|
99
102
|
limit: 1,
|
|
@@ -104,27 +107,31 @@ async function queryPageByPath(payload, path, draft) {
|
|
|
104
107
|
}
|
|
105
108
|
return null;
|
|
106
109
|
}
|
|
107
|
-
function createPageQueries(getPayloadClient,
|
|
110
|
+
function createPageQueries(getPayloadClient, contentTagOrOptions = "website-content") {
|
|
111
|
+
const options = typeof contentTagOrOptions === "string" ? { contentTag: contentTagOrOptions } : contentTagOrOptions;
|
|
112
|
+
const contentTag = options.contentTag || "website-content";
|
|
113
|
+
const pagesCollectionSlug = options.pagesCollectionSlug || "pages";
|
|
114
|
+
const homeSlug = options.homeSlug || "home";
|
|
108
115
|
const getPublishedPageByPathCached = unstable_cache(
|
|
109
116
|
async (path) => {
|
|
110
117
|
const payload = await getPayloadClient();
|
|
111
|
-
return queryPageByPath(payload, path, false);
|
|
118
|
+
return queryPageByPath(payload, path, false, pagesCollectionSlug, homeSlug);
|
|
112
119
|
},
|
|
113
|
-
["page-by-path", PAGE_QUERY_CACHE_VERSION],
|
|
120
|
+
["page-by-path", PAGE_QUERY_CACHE_VERSION, pagesCollectionSlug, homeSlug, contentTag],
|
|
114
121
|
{ tags: [contentTag] }
|
|
115
122
|
);
|
|
116
123
|
async function getPageBySegments(segments, draft = false) {
|
|
117
124
|
const path = normalizePath(segments);
|
|
118
125
|
const payload = await getPayloadClient();
|
|
119
126
|
if (draft) {
|
|
120
|
-
return queryPageByPath(payload, path, true);
|
|
127
|
+
return queryPageByPath(payload, path, true, pagesCollectionSlug, homeSlug);
|
|
121
128
|
}
|
|
122
129
|
return getPublishedPageByPathCached(path);
|
|
123
130
|
}
|
|
124
131
|
async function listPublishedPagePaths() {
|
|
125
132
|
const payload = await getPayloadClient();
|
|
126
133
|
const pages = await payload.find({
|
|
127
|
-
collection:
|
|
134
|
+
collection: pagesCollectionSlug,
|
|
128
135
|
depth: 0,
|
|
129
136
|
draft: false,
|
|
130
137
|
limit: 1e3,
|
|
@@ -153,108 +160,46 @@ function createPageQueries(getPayloadClient, contentTag = "website-content") {
|
|
|
153
160
|
|
|
154
161
|
// src/nextjs/queries/site.ts
|
|
155
162
|
import { unstable_cache as unstable_cache2 } from "next/cache";
|
|
156
|
-
function createSiteQueries(getPayloadClient,
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
return
|
|
189
|
-
}
|
|
190
|
-
["footer-global"],
|
|
191
|
-
{ tags: [contentTag] }
|
|
192
|
-
);
|
|
193
|
-
const getSocialMediaCached = unstable_cache2(
|
|
194
|
-
async () => {
|
|
195
|
-
const payload = await getPayloadClient();
|
|
196
|
-
const socialMedia = await payload.findGlobal({
|
|
197
|
-
slug: "social-media",
|
|
198
|
-
depth: 1
|
|
199
|
-
});
|
|
200
|
-
return socialMedia;
|
|
201
|
-
},
|
|
202
|
-
["social-media-global"],
|
|
203
|
-
{ tags: [contentTag] }
|
|
204
|
-
);
|
|
205
|
-
async function getSiteSettings(draft = false) {
|
|
206
|
-
if (draft) {
|
|
207
|
-
const payload = await getPayloadClient();
|
|
208
|
-
const settings = await payload.findGlobal({
|
|
209
|
-
slug: "site-settings",
|
|
210
|
-
depth: 1,
|
|
211
|
-
draft: true
|
|
212
|
-
});
|
|
213
|
-
return settings;
|
|
214
|
-
}
|
|
215
|
-
return getSiteSettingsCached();
|
|
216
|
-
}
|
|
217
|
-
async function getHeader(draft = false) {
|
|
218
|
-
if (draft) {
|
|
219
|
-
const payload = await getPayloadClient();
|
|
220
|
-
const header = await payload.findGlobal({
|
|
221
|
-
slug: "header",
|
|
222
|
-
depth: 1,
|
|
223
|
-
draft: true
|
|
224
|
-
});
|
|
225
|
-
return header;
|
|
226
|
-
}
|
|
227
|
-
return getHeaderCached();
|
|
228
|
-
}
|
|
229
|
-
async function getFooter(draft = false) {
|
|
230
|
-
if (draft) {
|
|
231
|
-
const payload = await getPayloadClient();
|
|
232
|
-
const footer = await payload.findGlobal({
|
|
233
|
-
slug: "footer",
|
|
234
|
-
depth: 1,
|
|
235
|
-
draft: true
|
|
236
|
-
});
|
|
237
|
-
return footer;
|
|
238
|
-
}
|
|
239
|
-
return getFooterCached();
|
|
240
|
-
}
|
|
241
|
-
async function getSocialMedia(draft = false) {
|
|
242
|
-
if (draft) {
|
|
243
|
-
const payload = await getPayloadClient();
|
|
244
|
-
const socialMedia = await payload.findGlobal({
|
|
245
|
-
slug: "social-media",
|
|
246
|
-
depth: 1,
|
|
247
|
-
draft: true
|
|
248
|
-
});
|
|
249
|
-
return socialMedia;
|
|
250
|
-
}
|
|
251
|
-
return getSocialMediaCached();
|
|
163
|
+
function createSiteQueries(getPayloadClient, contentTagOrOptions = "website-content") {
|
|
164
|
+
const options = typeof contentTagOrOptions === "string" ? { contentTag: contentTagOrOptions } : contentTagOrOptions;
|
|
165
|
+
const contentTag = options.contentTag || "website-content";
|
|
166
|
+
const siteSettingsSlug = options.siteSettingsSlug || "site-settings";
|
|
167
|
+
const headerSlug = options.headerSlug || "header";
|
|
168
|
+
const footerSlug = options.footerSlug || "footer";
|
|
169
|
+
const socialMediaSlug = options.socialMediaSlug || "social-media";
|
|
170
|
+
function createGlobalQuery(slug, cacheKey) {
|
|
171
|
+
const getCached = unstable_cache2(
|
|
172
|
+
async () => {
|
|
173
|
+
const payload = await getPayloadClient();
|
|
174
|
+
const data = await payload.findGlobal({
|
|
175
|
+
slug,
|
|
176
|
+
depth: 1,
|
|
177
|
+
overrideAccess: false
|
|
178
|
+
});
|
|
179
|
+
return data;
|
|
180
|
+
},
|
|
181
|
+
[cacheKey, slug, contentTag],
|
|
182
|
+
{ tags: [contentTag] }
|
|
183
|
+
);
|
|
184
|
+
return async function getGlobal(draft = false) {
|
|
185
|
+
if (draft) {
|
|
186
|
+
const payload = await getPayloadClient();
|
|
187
|
+
const data = await payload.findGlobal({
|
|
188
|
+
slug,
|
|
189
|
+
depth: 1,
|
|
190
|
+
draft: true,
|
|
191
|
+
overrideAccess: false
|
|
192
|
+
});
|
|
193
|
+
return data;
|
|
194
|
+
}
|
|
195
|
+
return getCached();
|
|
196
|
+
};
|
|
252
197
|
}
|
|
253
198
|
return {
|
|
254
|
-
getSiteSettings,
|
|
255
|
-
getHeader,
|
|
256
|
-
getFooter,
|
|
257
|
-
getSocialMedia
|
|
199
|
+
getSiteSettings: createGlobalQuery(siteSettingsSlug, "site-settings-global"),
|
|
200
|
+
getHeader: createGlobalQuery(headerSlug, "header-global"),
|
|
201
|
+
getFooter: createGlobalQuery(footerSlug, "footer-global"),
|
|
202
|
+
getSocialMedia: createGlobalQuery(socialMediaSlug, "social-media-global")
|
|
258
203
|
};
|
|
259
204
|
}
|
|
260
205
|
|