@orion-studios/payload-studio 0.6.0-beta.8 → 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 +201 -37
- 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-5FNTVRCR.mjs → chunk-MMJNHBOF.mjs} +204 -40
- 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-DyMmaRfI.d.mts → index-BbTcimgH.d.mts} +5 -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-QPDAedIX.d.ts → index-DV-nW43e.d.ts} +5 -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 +533 -172
- 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,8 +186,10 @@ function configureAdmin(config) {
|
|
|
186
186
|
brandPrimary = "#3b82f6",
|
|
187
187
|
brandSecondary = "#8b5cf6",
|
|
188
188
|
defaultTheme = "brand-light",
|
|
189
|
+
logoOnDarkUrl,
|
|
189
190
|
logoUrl,
|
|
190
|
-
allowThemePreference = false
|
|
191
|
+
allowThemePreference = false,
|
|
192
|
+
userSessionDurationSeconds = 60 * 60 * 24
|
|
191
193
|
} = config;
|
|
192
194
|
const studioEnabled = config.studio?.enabled ?? true;
|
|
193
195
|
const formsEnabled = config.studio?.forms?.enabled ?? false;
|
|
@@ -229,23 +231,33 @@ function configureAdmin(config) {
|
|
|
229
231
|
if (cssSources.length === 0) {
|
|
230
232
|
cssPath = sourceCssPath;
|
|
231
233
|
} else {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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;
|
|
245
260
|
}
|
|
246
|
-
const genPath = path.resolve(genDir, "admin.css");
|
|
247
|
-
fs.writeFileSync(genPath, css);
|
|
248
|
-
cssPath = genPath;
|
|
249
261
|
}
|
|
250
262
|
const clientPath = "@orion-studios/payload-studio/admin/client";
|
|
251
263
|
const studioNavClientProps = {
|
|
@@ -292,6 +304,49 @@ function configureAdmin(config) {
|
|
|
292
304
|
}
|
|
293
305
|
};
|
|
294
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
|
+
};
|
|
295
350
|
return {
|
|
296
351
|
admin: {
|
|
297
352
|
css: cssPath,
|
|
@@ -309,6 +364,7 @@ function configureAdmin(config) {
|
|
|
309
364
|
path: clientPath,
|
|
310
365
|
clientProps: {
|
|
311
366
|
brandName,
|
|
367
|
+
logoOnDarkUrl,
|
|
312
368
|
logoUrl
|
|
313
369
|
}
|
|
314
370
|
},
|
|
@@ -317,6 +373,7 @@ function configureAdmin(config) {
|
|
|
317
373
|
path: clientPath,
|
|
318
374
|
clientProps: {
|
|
319
375
|
brandName,
|
|
376
|
+
logoOnDarkUrl,
|
|
320
377
|
logoUrl
|
|
321
378
|
}
|
|
322
379
|
}
|
|
@@ -331,6 +388,7 @@ function configureAdmin(config) {
|
|
|
331
388
|
},
|
|
332
389
|
...studioEnabled ? {
|
|
333
390
|
studioGlobals: {
|
|
391
|
+
exact: true,
|
|
334
392
|
path: globalsBasePath,
|
|
335
393
|
Component: {
|
|
336
394
|
exportName: "AdminStudioGlobalsView",
|
|
@@ -342,10 +400,11 @@ function configureAdmin(config) {
|
|
|
342
400
|
}
|
|
343
401
|
}
|
|
344
402
|
},
|
|
345
|
-
|
|
346
|
-
|
|
403
|
+
studioPageNew: {
|
|
404
|
+
exact: true,
|
|
405
|
+
path: `${pagesBasePath}/new`,
|
|
347
406
|
Component: {
|
|
348
|
-
exportName: "
|
|
407
|
+
exportName: "AdminStudioNewPageView",
|
|
349
408
|
path: clientPath,
|
|
350
409
|
clientProps: {
|
|
351
410
|
...studioNavClientProps,
|
|
@@ -354,6 +413,7 @@ function configureAdmin(config) {
|
|
|
354
413
|
}
|
|
355
414
|
},
|
|
356
415
|
studioPageEditor: {
|
|
416
|
+
exact: true,
|
|
357
417
|
path: `${pagesBasePath}/:id`,
|
|
358
418
|
Component: {
|
|
359
419
|
exportName: "AdminStudioPageEditView",
|
|
@@ -364,10 +424,11 @@ function configureAdmin(config) {
|
|
|
364
424
|
}
|
|
365
425
|
}
|
|
366
426
|
},
|
|
367
|
-
|
|
368
|
-
|
|
427
|
+
studioPages: {
|
|
428
|
+
exact: true,
|
|
429
|
+
path: pagesBasePath,
|
|
369
430
|
Component: {
|
|
370
|
-
exportName: "
|
|
431
|
+
exportName: "AdminStudioPagesListView",
|
|
371
432
|
path: clientPath,
|
|
372
433
|
clientProps: {
|
|
373
434
|
...studioNavClientProps,
|
|
@@ -376,6 +437,7 @@ function configureAdmin(config) {
|
|
|
376
437
|
}
|
|
377
438
|
},
|
|
378
439
|
studioContactForm: {
|
|
440
|
+
exact: true,
|
|
379
441
|
path: contactFormStudioPath,
|
|
380
442
|
Component: {
|
|
381
443
|
exportName: "AdminStudioContactFormView",
|
|
@@ -388,7 +450,47 @@ function configureAdmin(config) {
|
|
|
388
450
|
}
|
|
389
451
|
},
|
|
390
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
|
+
},
|
|
391
492
|
studioForms: {
|
|
493
|
+
exact: true,
|
|
392
494
|
path: formsBasePath,
|
|
393
495
|
Component: {
|
|
394
496
|
exportName: "AdminStudioFormsView",
|
|
@@ -402,10 +504,11 @@ function configureAdmin(config) {
|
|
|
402
504
|
}
|
|
403
505
|
}
|
|
404
506
|
} : {},
|
|
405
|
-
|
|
406
|
-
|
|
507
|
+
studioMediaItem: {
|
|
508
|
+
exact: true,
|
|
509
|
+
path: `${mediaBasePath}/:id`,
|
|
407
510
|
Component: {
|
|
408
|
-
exportName: "
|
|
511
|
+
exportName: "AdminStudioMediaItemView",
|
|
409
512
|
path: clientPath,
|
|
410
513
|
clientProps: {
|
|
411
514
|
...studioNavClientProps,
|
|
@@ -413,10 +516,11 @@ function configureAdmin(config) {
|
|
|
413
516
|
}
|
|
414
517
|
}
|
|
415
518
|
},
|
|
416
|
-
|
|
417
|
-
|
|
519
|
+
studioMedia: {
|
|
520
|
+
exact: true,
|
|
521
|
+
path: mediaBasePath,
|
|
418
522
|
Component: {
|
|
419
|
-
exportName: "
|
|
523
|
+
exportName: "AdminStudioMediaView",
|
|
420
524
|
path: clientPath,
|
|
421
525
|
clientProps: {
|
|
422
526
|
...studioNavClientProps,
|
|
@@ -425,6 +529,7 @@ function configureAdmin(config) {
|
|
|
425
529
|
}
|
|
426
530
|
},
|
|
427
531
|
studioTools: {
|
|
532
|
+
exact: true,
|
|
428
533
|
path: toolsBasePath,
|
|
429
534
|
Component: {
|
|
430
535
|
exportName: "AdminStudioToolsView",
|
|
@@ -469,6 +574,7 @@ function configureAdmin(config) {
|
|
|
469
574
|
path: clientPath,
|
|
470
575
|
clientProps: {
|
|
471
576
|
brandName,
|
|
577
|
+
logoOnDarkUrl,
|
|
472
578
|
logoUrl
|
|
473
579
|
}
|
|
474
580
|
}
|
|
@@ -505,8 +611,17 @@ function configureAdmin(config) {
|
|
|
505
611
|
const hasThemePreference = existingFields.some(
|
|
506
612
|
(field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
|
|
507
613
|
);
|
|
614
|
+
const normalizedAuth = usersCollection.auth === true ? {
|
|
615
|
+
tokenExpiration: userSessionDurationSeconds,
|
|
616
|
+
useSessions: true
|
|
617
|
+
} : usersCollection.auth && typeof usersCollection.auth === "object" ? {
|
|
618
|
+
...usersCollection.auth,
|
|
619
|
+
tokenExpiration: usersCollection.auth.tokenExpiration ?? userSessionDurationSeconds,
|
|
620
|
+
useSessions: usersCollection.auth.useSessions ?? true
|
|
621
|
+
} : usersCollection.auth;
|
|
508
622
|
const nextCollection = {
|
|
509
623
|
...usersCollection,
|
|
624
|
+
auth: normalizedAuth,
|
|
510
625
|
fields: !allowThemePreference || hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
|
|
511
626
|
};
|
|
512
627
|
return attachStudioBackBreadcrumbToCollection(nextCollection);
|
|
@@ -568,25 +683,74 @@ function configureAdmin(config) {
|
|
|
568
683
|
return attachStudioBackBreadcrumbToCollection(mediaCollection);
|
|
569
684
|
},
|
|
570
685
|
wrapFormsCollection(formsCollection) {
|
|
571
|
-
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
|
+
});
|
|
572
693
|
},
|
|
573
694
|
wrapFormSubmissionsCollection(formSubmissionsCollection) {
|
|
574
|
-
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
|
+
});
|
|
575
702
|
},
|
|
576
703
|
wrapFormUploadsCollection(formUploadsCollection) {
|
|
577
|
-
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
|
+
});
|
|
578
711
|
},
|
|
579
712
|
wrapGlobals(globals2) {
|
|
580
|
-
const
|
|
713
|
+
const defaultLabelMap = {
|
|
581
714
|
header: { group: "Site Design", label: "Header & Navigation" },
|
|
582
715
|
footer: { group: "Site Design", label: "Footer" },
|
|
583
716
|
"site-settings": { group: "Site Design", label: "Website Settings" },
|
|
584
717
|
"social-media": { group: "Site Design", label: "Social Media" },
|
|
585
718
|
"contact-form": { group: "Lead Forms", label: "Contact Form" }
|
|
586
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
|
+
};
|
|
587
746
|
return globals2.map((global) => {
|
|
588
|
-
const
|
|
589
|
-
|
|
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);
|
|
590
754
|
const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
|
|
591
755
|
const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
|
|
592
756
|
const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
|
|
@@ -695,7 +859,7 @@ function configureAdmin(config) {
|
|
|
695
859
|
...global,
|
|
696
860
|
admin: {
|
|
697
861
|
...global.admin,
|
|
698
|
-
group: mapping.group,
|
|
862
|
+
...mapping.group ? { group: mapping.group } : {},
|
|
699
863
|
components: {
|
|
700
864
|
...global.admin?.components,
|
|
701
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
|
|