@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.
- package/README.md +58 -68
- package/dist/admin/client.d.mts +6 -0
- package/dist/admin/client.d.ts +6 -0
- package/dist/admin/client.js +4533 -799
- package/dist/admin/client.mjs +3349 -756
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +386 -55
- package/dist/admin/index.mjs +2 -1
- package/dist/admin-app/client.d.mts +1 -0
- package/dist/admin-app/client.d.ts +1 -0
- package/dist/admin-app/client.js +285 -109
- package/dist/admin-app/client.mjs +59 -871
- package/dist/admin-app/index.d.mts +2 -1
- package/dist/admin-app/index.d.ts +2 -1
- package/dist/admin-app/index.mjs +5 -3
- package/dist/admin-app/styles.css +1767 -56
- package/dist/admin.css +158 -35
- package/dist/blocks/index.js +415 -200
- package/dist/blocks/index.mjs +2 -2
- package/dist/{chunk-XK3K5GRP.mjs → chunk-JQAHXYAM.mjs} +271 -67
- package/dist/chunk-KPIX7OSV.mjs +1051 -0
- package/dist/chunk-OQSEJXC4.mjs +166 -0
- package/dist/{chunk-XHWQJUX5.mjs → chunk-OTHERBGX.mjs} +3 -3
- package/dist/chunk-PF3EBZXF.mjs +326 -0
- package/dist/{chunk-74XFAVXU.mjs → chunk-QJAWO6K3.mjs} +377 -55
- package/dist/{chunk-XVH5SCBD.mjs → chunk-RKTIFEUY.mjs} +4 -19
- package/dist/chunk-W2UOCJDX.mjs +32 -0
- package/dist/{chunk-C4J35SPJ.mjs → chunk-XKUTZ7IU.mjs} +257 -452
- package/dist/{index-ZbOx4OCF.d.mts → index-52HdVLQq.d.ts} +12 -22
- package/dist/index-B6_D4Hm4.d.ts +439 -0
- package/dist/index-CYaWadBl.d.mts +439 -0
- package/dist/index-Crx_MtPw.d.ts +223 -0
- package/dist/index-Cv-6qnrw.d.mts +223 -0
- package/dist/{index-ZbOx4OCF.d.ts → index-DEQC3Dwj.d.mts} +12 -22
- package/dist/{index-BIwu3qIH.d.mts → index-DWmudwDm.d.mts} +2 -1
- package/dist/{index-BIwu3qIH.d.ts → index-DWmudwDm.d.ts} +2 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1858 -1202
- package/dist/index.mjs +10 -8
- package/dist/nextjs/index.js +5 -684
- package/dist/nextjs/index.mjs +2 -3
- package/dist/sitePreviewTypes-BkHCWxNW.d.mts +58 -0
- package/dist/sitePreviewTypes-BkHCWxNW.d.ts +58 -0
- package/dist/studio/index.d.mts +1 -1
- package/dist/studio/index.d.ts +1 -1
- package/dist/studio-pages/builder.css +125 -83
- package/dist/studio-pages/client.d.mts +58 -1
- package/dist/studio-pages/client.d.ts +58 -1
- package/dist/studio-pages/client.js +450 -241
- package/dist/studio-pages/client.mjs +455 -247
- package/dist/studio-pages/index.d.mts +3 -2
- package/dist/studio-pages/index.d.ts +3 -2
- package/dist/studio-pages/index.js +418 -183
- package/dist/studio-pages/index.mjs +15 -6
- package/package.json +10 -4
- package/dist/chunk-SIL2J5MF.mjs +0 -155
- package/dist/index-BnoqmQDP.d.mts +0 -219
- package/dist/index-CTpik6fR.d.ts +0 -219
- package/dist/index-R7hA134j.d.mts +0 -140
- package/dist/index-vjrjy0P4.d.ts +0 -140
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions,
|
|
1
|
+
export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioGlobalLink, f as StudioSection, g as StudioSectionCard, h as StudioSectionComponent, j as StudioSectionRole, k as StudioSectionView, l as configureAdmin, m as createHeaderNavItemsField, n as createSocialMediaConnectionsField, o as createSocialMediaGlobal, p as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-CYaWadBl.mjs';
|
|
2
2
|
export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.mjs';
|
|
3
3
|
import 'payload';
|
|
4
|
+
import '../sitePreviewTypes-BkHCWxNW.mjs';
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions,
|
|
1
|
+
export { A as AdminConfig, a as AdminStudioConfig, b as AdminStudioFooterPreviewConfig, c as AdminStudioHeaderPreviewConfig, d as AdminStudioSitePreviewConfig, C as CreateSocialMediaConnectionsFieldOptions, e as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioGlobalLink, f as StudioSection, g as StudioSectionCard, h as StudioSectionComponent, j as StudioSectionRole, k as StudioSectionView, l as configureAdmin, m as createHeaderNavItemsField, n as createSocialMediaConnectionsField, o as createSocialMediaGlobal, p as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-B6_D4Hm4.js';
|
|
2
2
|
export { b as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, c as SOCIAL_MEDIA_ICON_OPTIONS, d as SOCIAL_MEDIA_PLATFORMS, e as SOCIAL_MEDIA_PLATFORM_LABELS, S as SocialMediaGlobalData, f as SocialMediaIconLibrary, g as SocialMediaIconOption, a as SocialMediaPlatform, h as SocialMediaProfileData, i as SocialMediaProfilesData } from '../socialMedia-C05Iy-SV.js';
|
|
3
3
|
import 'payload';
|
|
4
|
+
import '../sitePreviewTypes-BkHCWxNW.js';
|
package/dist/admin/index.js
CHANGED
|
@@ -68,8 +68,21 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
|
|
|
68
68
|
});
|
|
69
69
|
var themePreferenceField = createThemePreferenceField("brand-light");
|
|
70
70
|
|
|
71
|
+
// src/admin-app/routeRegistry.ts
|
|
72
|
+
var adminNavIcons = [
|
|
73
|
+
"dashboard",
|
|
74
|
+
"pages",
|
|
75
|
+
"forms",
|
|
76
|
+
"globals",
|
|
77
|
+
"media",
|
|
78
|
+
"tools",
|
|
79
|
+
"account",
|
|
80
|
+
"analytics"
|
|
81
|
+
];
|
|
82
|
+
|
|
71
83
|
// src/shared/studioSections.ts
|
|
72
84
|
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
85
|
+
var studioIcons = new Set(adminNavIcons);
|
|
73
86
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
74
87
|
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
75
88
|
var normalizePathLikeValue = (value) => {
|
|
@@ -110,6 +123,7 @@ var normalizeCard = (value) => {
|
|
|
110
123
|
...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
|
|
111
124
|
};
|
|
112
125
|
};
|
|
126
|
+
var normalizeIcon = (value) => typeof value === "string" && studioIcons.has(value) ? value : void 0;
|
|
113
127
|
var resolveStudioSections = (value) => {
|
|
114
128
|
if (!Array.isArray(value)) {
|
|
115
129
|
return [];
|
|
@@ -135,6 +149,7 @@ var resolveStudioSections = (value) => {
|
|
|
135
149
|
label,
|
|
136
150
|
href,
|
|
137
151
|
matchPrefixes,
|
|
152
|
+
...normalizeIcon(entry.icon) ? { icon: normalizeIcon(entry.icon) } : {},
|
|
138
153
|
...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
|
|
139
154
|
...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
|
|
140
155
|
});
|
|
@@ -200,17 +215,28 @@ function configureAdmin(config) {
|
|
|
200
215
|
brandPrimary = "#3b82f6",
|
|
201
216
|
brandSecondary = "#8b5cf6",
|
|
202
217
|
defaultTheme = "brand-light",
|
|
203
|
-
logoUrl
|
|
218
|
+
logoUrl,
|
|
219
|
+
allowThemePreference = false
|
|
204
220
|
} = config;
|
|
205
221
|
const studioEnabled = config.studio?.enabled ?? true;
|
|
222
|
+
const formsEnabled = config.studio?.forms?.enabled ?? false;
|
|
223
|
+
const formsCollectionSlug = config.studio?.forms?.collectionSlug || "forms";
|
|
224
|
+
const formSubmissionsCollectionSlug = config.studio?.forms?.submissionsCollectionSlug || "form-submissions";
|
|
225
|
+
const formUploadsCollectionSlug = config.studio?.forms?.uploadsCollectionSlug || "form-uploads";
|
|
206
226
|
const pagesCollectionSlug = config.studio?.pages?.collectionSlug || "pages";
|
|
227
|
+
const builderBasePath = config.studio?.pages?.builderBasePath || "/builder";
|
|
207
228
|
const mediaCollectionSlug = config.studio?.media?.collectionSlug || "media";
|
|
208
|
-
const
|
|
229
|
+
const globalsBasePath = "/site-globals";
|
|
230
|
+
const pagesBasePath = "/pages";
|
|
231
|
+
const formsBasePath = "/forms";
|
|
232
|
+
const mediaBasePath = "/media";
|
|
233
|
+
const toolsBasePath = "/tools";
|
|
234
|
+
const contactFormStudioPath = "/contact-form";
|
|
209
235
|
const configuredGlobals = config.studio?.globals || [
|
|
210
236
|
{ slug: "site-settings", label: "Website Settings" },
|
|
211
237
|
{ slug: "header", label: "Header & Navigation" },
|
|
212
238
|
{ slug: "footer", label: "Footer" },
|
|
213
|
-
{ slug: "
|
|
239
|
+
{ slug: "social-media", label: "Social Media" }
|
|
214
240
|
];
|
|
215
241
|
const globals = configuredGlobals.map((global) => {
|
|
216
242
|
if (global.slug !== "contact-form" || global.href) {
|
|
@@ -223,24 +249,78 @@ function configureAdmin(config) {
|
|
|
223
249
|
});
|
|
224
250
|
const studioSections = resolveStudioSections(config.studio?.sections || []);
|
|
225
251
|
const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
|
|
252
|
+
const sitePreview = config.studio?.sitePreview;
|
|
226
253
|
let cssPath;
|
|
227
254
|
const pkgDist = getPkgDistDir();
|
|
228
255
|
const sourceCssPath = import_path.default.resolve(pkgDist, "admin.css");
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
256
|
+
const adminAppCssPath = import_path.default.resolve(pkgDist, "admin-app", "styles.css");
|
|
257
|
+
const cssSources = [sourceCssPath, adminAppCssPath].filter((filePath) => import_fs.default.existsSync(filePath));
|
|
258
|
+
if (cssSources.length === 0) {
|
|
259
|
+
cssPath = sourceCssPath;
|
|
260
|
+
} else {
|
|
261
|
+
let css = cssSources.map((filePath) => import_fs.default.readFileSync(filePath, "utf-8")).join("\n\n");
|
|
262
|
+
css = css.replace(
|
|
263
|
+
"--orion-cms-brand-primary-fallback: #3b82f6;",
|
|
264
|
+
`--orion-cms-brand-primary-fallback: ${brandPrimary};`
|
|
265
|
+
);
|
|
266
|
+
css = css.replace(
|
|
267
|
+
"--orion-cms-brand-secondary-fallback: #8b5cf6;",
|
|
268
|
+
`--orion-cms-brand-secondary-fallback: ${brandSecondary};`
|
|
269
|
+
);
|
|
270
|
+
const outputBasePath = config.basePath || process.cwd();
|
|
271
|
+
const genDir = import_path.default.resolve(outputBasePath, ".generated");
|
|
234
272
|
if (!import_fs.default.existsSync(genDir)) {
|
|
235
273
|
import_fs.default.mkdirSync(genDir, { recursive: true });
|
|
236
274
|
}
|
|
237
275
|
const genPath = import_path.default.resolve(genDir, "admin.css");
|
|
238
276
|
import_fs.default.writeFileSync(genPath, css);
|
|
239
277
|
cssPath = genPath;
|
|
240
|
-
} else {
|
|
241
|
-
cssPath = sourceCssPath;
|
|
242
278
|
}
|
|
243
279
|
const clientPath = "@orion-studios/payload-studio/admin/client";
|
|
280
|
+
const studioNavClientProps = {
|
|
281
|
+
brandName,
|
|
282
|
+
formSubmissionsCollectionSlug,
|
|
283
|
+
formsCollectionSlug,
|
|
284
|
+
formsEnabled,
|
|
285
|
+
formUploadsCollectionSlug,
|
|
286
|
+
globalsBasePath,
|
|
287
|
+
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
288
|
+
logoUrl,
|
|
289
|
+
mediaCollectionSlug,
|
|
290
|
+
pagesCollectionSlug,
|
|
291
|
+
sections: studioSections
|
|
292
|
+
};
|
|
293
|
+
const studioBackBreadcrumbComponent = {
|
|
294
|
+
exportName: "StudioBackBreadcrumb",
|
|
295
|
+
path: clientPath
|
|
296
|
+
};
|
|
297
|
+
const hasMatchingComponent = (items, exportName) => Array.isArray(items) && items.some(
|
|
298
|
+
(item) => item && typeof item === "object" && item.exportName === exportName && item.path === clientPath
|
|
299
|
+
);
|
|
300
|
+
const appendComponent = (items, component, exportName) => hasMatchingComponent(items, exportName) ? items || [] : [...items || [], component];
|
|
301
|
+
const attachStudioBackBreadcrumbToCollection = (collection) => {
|
|
302
|
+
if (!studioEnabled) {
|
|
303
|
+
return collection;
|
|
304
|
+
}
|
|
305
|
+
const existingBeforeDocumentControls = collection.admin?.components?.edit?.beforeDocumentControls;
|
|
306
|
+
return {
|
|
307
|
+
...collection,
|
|
308
|
+
admin: {
|
|
309
|
+
...collection.admin,
|
|
310
|
+
components: {
|
|
311
|
+
...collection.admin?.components,
|
|
312
|
+
edit: {
|
|
313
|
+
...collection.admin?.components?.edit,
|
|
314
|
+
beforeDocumentControls: appendComponent(
|
|
315
|
+
existingBeforeDocumentControls,
|
|
316
|
+
studioBackBreadcrumbComponent,
|
|
317
|
+
"StudioBackBreadcrumb"
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
};
|
|
244
324
|
return {
|
|
245
325
|
admin: {
|
|
246
326
|
css: cssPath,
|
|
@@ -249,15 +329,7 @@ function configureAdmin(config) {
|
|
|
249
329
|
Nav: {
|
|
250
330
|
exportName: "AdminStudioNav",
|
|
251
331
|
path: clientPath,
|
|
252
|
-
clientProps:
|
|
253
|
-
brandName,
|
|
254
|
-
logoUrl,
|
|
255
|
-
globalsBasePath: "/studio-globals",
|
|
256
|
-
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
257
|
-
mediaCollectionSlug,
|
|
258
|
-
pagesCollectionSlug,
|
|
259
|
-
sections: studioSections
|
|
260
|
-
}
|
|
332
|
+
clientProps: studioNavClientProps
|
|
261
333
|
}
|
|
262
334
|
} : {},
|
|
263
335
|
graphics: {
|
|
@@ -283,37 +355,113 @@ function configureAdmin(config) {
|
|
|
283
355
|
Component: {
|
|
284
356
|
exportName: studioEnabled ? "AdminStudioDashboard" : "Dashboard",
|
|
285
357
|
path: clientPath,
|
|
286
|
-
clientProps:
|
|
287
|
-
brandName,
|
|
288
|
-
logoUrl,
|
|
289
|
-
globalsBasePath: "/studio-globals",
|
|
290
|
-
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
291
|
-
mediaCollectionSlug,
|
|
292
|
-
pagesCollectionSlug,
|
|
293
|
-
sections: studioSections
|
|
294
|
-
}
|
|
358
|
+
clientProps: studioNavClientProps
|
|
295
359
|
}
|
|
296
360
|
},
|
|
297
361
|
...studioEnabled ? {
|
|
298
362
|
studioGlobals: {
|
|
299
|
-
path:
|
|
363
|
+
path: globalsBasePath,
|
|
300
364
|
Component: {
|
|
301
365
|
exportName: "AdminStudioGlobalsView",
|
|
302
366
|
path: clientPath,
|
|
303
367
|
clientProps: {
|
|
368
|
+
...studioNavClientProps,
|
|
304
369
|
globals,
|
|
305
|
-
globalsBasePath
|
|
370
|
+
globalsBasePath
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
studioPages: {
|
|
375
|
+
path: pagesBasePath,
|
|
376
|
+
Component: {
|
|
377
|
+
exportName: "AdminStudioPagesListView",
|
|
378
|
+
path: clientPath,
|
|
379
|
+
clientProps: {
|
|
380
|
+
...studioNavClientProps,
|
|
381
|
+
pagesCollectionSlug
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
studioPageEditor: {
|
|
386
|
+
path: `${pagesBasePath}/:id`,
|
|
387
|
+
Component: {
|
|
388
|
+
exportName: "AdminStudioPageEditView",
|
|
389
|
+
path: clientPath,
|
|
390
|
+
clientProps: {
|
|
391
|
+
...studioNavClientProps,
|
|
392
|
+
builderBasePath
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
studioPageNew: {
|
|
397
|
+
path: `${pagesBasePath}/new`,
|
|
398
|
+
Component: {
|
|
399
|
+
exportName: "AdminStudioNewPageView",
|
|
400
|
+
path: clientPath,
|
|
401
|
+
clientProps: {
|
|
402
|
+
...studioNavClientProps,
|
|
403
|
+
pagesCollectionSlug
|
|
306
404
|
}
|
|
307
405
|
}
|
|
308
406
|
},
|
|
309
407
|
studioContactForm: {
|
|
310
|
-
path:
|
|
408
|
+
path: contactFormStudioPath,
|
|
311
409
|
Component: {
|
|
312
410
|
exportName: "AdminStudioContactFormView",
|
|
313
411
|
path: clientPath,
|
|
314
412
|
clientProps: {
|
|
413
|
+
...studioNavClientProps,
|
|
315
414
|
globalSlug: "contact-form",
|
|
316
|
-
globalsBasePath
|
|
415
|
+
globalsBasePath
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
...formsEnabled ? {
|
|
420
|
+
studioForms: {
|
|
421
|
+
path: formsBasePath,
|
|
422
|
+
Component: {
|
|
423
|
+
exportName: "AdminStudioFormsView",
|
|
424
|
+
path: clientPath,
|
|
425
|
+
clientProps: {
|
|
426
|
+
...studioNavClientProps,
|
|
427
|
+
formsCollectionSlug,
|
|
428
|
+
formSubmissionsCollectionSlug,
|
|
429
|
+
formUploadsCollectionSlug
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
} : {},
|
|
434
|
+
studioMedia: {
|
|
435
|
+
path: mediaBasePath,
|
|
436
|
+
Component: {
|
|
437
|
+
exportName: "AdminStudioMediaView",
|
|
438
|
+
path: clientPath,
|
|
439
|
+
clientProps: {
|
|
440
|
+
...studioNavClientProps,
|
|
441
|
+
mediaCollectionSlug
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
studioMediaItem: {
|
|
446
|
+
path: `${mediaBasePath}/:id`,
|
|
447
|
+
Component: {
|
|
448
|
+
exportName: "AdminStudioMediaItemView",
|
|
449
|
+
path: clientPath,
|
|
450
|
+
clientProps: {
|
|
451
|
+
...studioNavClientProps,
|
|
452
|
+
mediaCollectionSlug
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
studioTools: {
|
|
457
|
+
path: toolsBasePath,
|
|
458
|
+
Component: {
|
|
459
|
+
exportName: "AdminStudioToolsView",
|
|
460
|
+
path: clientPath,
|
|
461
|
+
clientProps: {
|
|
462
|
+
...studioNavClientProps,
|
|
463
|
+
mediaCollectionSlug,
|
|
464
|
+
pagesCollectionSlug
|
|
317
465
|
}
|
|
318
466
|
}
|
|
319
467
|
},
|
|
@@ -322,7 +470,13 @@ function configureAdmin(config) {
|
|
|
322
470
|
id,
|
|
323
471
|
{
|
|
324
472
|
path: view.path,
|
|
325
|
-
Component:
|
|
473
|
+
Component: {
|
|
474
|
+
...view.Component,
|
|
475
|
+
clientProps: {
|
|
476
|
+
...studioNavClientProps,
|
|
477
|
+
...view.Component.clientProps || {}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
326
480
|
}
|
|
327
481
|
])
|
|
328
482
|
)
|
|
@@ -333,19 +487,39 @@ function configureAdmin(config) {
|
|
|
333
487
|
exportName: "ThemeProvider",
|
|
334
488
|
path: clientPath,
|
|
335
489
|
clientProps: {
|
|
490
|
+
allowThemePreference,
|
|
336
491
|
defaultTheme
|
|
337
492
|
}
|
|
338
493
|
}
|
|
339
494
|
],
|
|
340
|
-
|
|
495
|
+
beforeLogin: [
|
|
341
496
|
{
|
|
342
|
-
exportName: "
|
|
497
|
+
exportName: "AdminLoginIntro",
|
|
343
498
|
path: clientPath,
|
|
344
499
|
clientProps: {
|
|
345
|
-
|
|
500
|
+
brandName,
|
|
501
|
+
logoUrl
|
|
346
502
|
}
|
|
347
503
|
}
|
|
348
|
-
]
|
|
504
|
+
],
|
|
505
|
+
afterLogin: [
|
|
506
|
+
{
|
|
507
|
+
exportName: "AdminLoginPasswordToggle",
|
|
508
|
+
path: clientPath
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
...allowThemePreference ? {
|
|
512
|
+
afterNavLinks: [
|
|
513
|
+
{
|
|
514
|
+
exportName: "ThemeSwitcher",
|
|
515
|
+
path: clientPath,
|
|
516
|
+
clientProps: {
|
|
517
|
+
allowThemePreference,
|
|
518
|
+
defaultTheme
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
} : {}
|
|
349
523
|
},
|
|
350
524
|
meta: {
|
|
351
525
|
titleSuffix: ` \u2014 ${brandName}`
|
|
@@ -360,10 +534,76 @@ function configureAdmin(config) {
|
|
|
360
534
|
const hasThemePreference = existingFields.some(
|
|
361
535
|
(field) => typeof field === "object" && field !== null && "name" in field && field.name === "themePreference"
|
|
362
536
|
);
|
|
363
|
-
|
|
537
|
+
const nextCollection = {
|
|
364
538
|
...usersCollection,
|
|
365
|
-
fields: hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
|
|
539
|
+
fields: !allowThemePreference || hasThemePreference ? existingFields : [...existingFields, createThemePreferenceField(defaultTheme)]
|
|
366
540
|
};
|
|
541
|
+
return attachStudioBackBreadcrumbToCollection(nextCollection);
|
|
542
|
+
},
|
|
543
|
+
wrapPagesCollection(pagesCollection) {
|
|
544
|
+
if (!studioEnabled) {
|
|
545
|
+
return pagesCollection;
|
|
546
|
+
}
|
|
547
|
+
const collectionWithBreadcrumb = attachStudioBackBreadcrumbToCollection(pagesCollection);
|
|
548
|
+
const existingEditMenuItems = collectionWithBreadcrumb.admin?.components?.edit?.editMenuItems;
|
|
549
|
+
const existingViews = collectionWithBreadcrumb.admin?.components?.views;
|
|
550
|
+
const existingEditViews = existingViews?.edit;
|
|
551
|
+
const hasCustomEditView = Boolean(
|
|
552
|
+
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
553
|
+
);
|
|
554
|
+
return {
|
|
555
|
+
...collectionWithBreadcrumb,
|
|
556
|
+
admin: {
|
|
557
|
+
...collectionWithBreadcrumb.admin,
|
|
558
|
+
components: {
|
|
559
|
+
...collectionWithBreadcrumb.admin?.components,
|
|
560
|
+
edit: {
|
|
561
|
+
...collectionWithBreadcrumb.admin?.components?.edit,
|
|
562
|
+
editMenuItems: appendComponent(
|
|
563
|
+
existingEditMenuItems,
|
|
564
|
+
{
|
|
565
|
+
exportName: "OpenInStudioMenuItem",
|
|
566
|
+
path: clientPath,
|
|
567
|
+
clientProps: {
|
|
568
|
+
pagesPathBase: pagesBasePath
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
"OpenInStudioMenuItem"
|
|
572
|
+
)
|
|
573
|
+
},
|
|
574
|
+
views: {
|
|
575
|
+
...existingViews,
|
|
576
|
+
...hasCustomEditView ? {} : {
|
|
577
|
+
edit: {
|
|
578
|
+
...existingEditViews,
|
|
579
|
+
default: {
|
|
580
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
581
|
+
Component: {
|
|
582
|
+
exportName: "PageEditRedirectToStudio",
|
|
583
|
+
path: clientPath,
|
|
584
|
+
clientProps: {
|
|
585
|
+
pagesPathBase: pagesBasePath
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
},
|
|
596
|
+
wrapMediaCollection(mediaCollection) {
|
|
597
|
+
return attachStudioBackBreadcrumbToCollection(mediaCollection);
|
|
598
|
+
},
|
|
599
|
+
wrapFormsCollection(formsCollection) {
|
|
600
|
+
return attachStudioBackBreadcrumbToCollection(formsCollection);
|
|
601
|
+
},
|
|
602
|
+
wrapFormSubmissionsCollection(formSubmissionsCollection) {
|
|
603
|
+
return attachStudioBackBreadcrumbToCollection(formSubmissionsCollection);
|
|
604
|
+
},
|
|
605
|
+
wrapFormUploadsCollection(formUploadsCollection) {
|
|
606
|
+
return attachStudioBackBreadcrumbToCollection(formUploadsCollection);
|
|
367
607
|
},
|
|
368
608
|
wrapGlobals(globals2) {
|
|
369
609
|
const labelMap = {
|
|
@@ -376,25 +616,110 @@ function configureAdmin(config) {
|
|
|
376
616
|
return globals2.map((global) => {
|
|
377
617
|
const mapping = labelMap[global.slug];
|
|
378
618
|
if (!mapping) return global;
|
|
619
|
+
const shouldAttachSiteSettingsEditView = studioEnabled && global.slug === "site-settings";
|
|
620
|
+
const shouldAttachSocialMediaEditView = studioEnabled && global.slug === "social-media";
|
|
379
621
|
const shouldAttachContactFormRedirect = studioEnabled && global.slug === "contact-form";
|
|
622
|
+
const shouldAttachHeaderEditView = studioEnabled && global.slug === "header";
|
|
623
|
+
const shouldAttachFooterEditView = studioEnabled && global.slug === "footer";
|
|
380
624
|
const existingViews = global.admin?.components?.views;
|
|
381
625
|
const existingEditViews = existingViews?.edit;
|
|
382
|
-
const
|
|
626
|
+
const hasCustomEditView = Boolean(
|
|
383
627
|
existingEditViews?.root || existingEditViews?.default && typeof existingEditViews.default === "object" && existingEditViews.default.Component
|
|
384
628
|
);
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
629
|
+
const nextEditViews = (() => {
|
|
630
|
+
if (shouldAttachSiteSettingsEditView && !hasCustomEditView) {
|
|
631
|
+
return {
|
|
632
|
+
...existingEditViews,
|
|
633
|
+
default: {
|
|
634
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
635
|
+
Component: {
|
|
636
|
+
exportName: "AdminStudioSiteSettingsGlobalView",
|
|
637
|
+
path: clientPath,
|
|
638
|
+
clientProps: {
|
|
639
|
+
...studioNavClientProps,
|
|
640
|
+
globalSlug: global.slug,
|
|
641
|
+
mediaCollectionSlug
|
|
642
|
+
}
|
|
643
|
+
}
|
|
394
644
|
}
|
|
395
|
-
}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
if (shouldAttachSocialMediaEditView && !hasCustomEditView) {
|
|
648
|
+
return {
|
|
649
|
+
...existingEditViews,
|
|
650
|
+
default: {
|
|
651
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
652
|
+
Component: {
|
|
653
|
+
exportName: "AdminStudioSocialMediaGlobalView",
|
|
654
|
+
path: clientPath,
|
|
655
|
+
clientProps: {
|
|
656
|
+
...studioNavClientProps,
|
|
657
|
+
globalSlug: global.slug
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
if (shouldAttachHeaderEditView && !hasCustomEditView) {
|
|
664
|
+
return {
|
|
665
|
+
...existingEditViews,
|
|
666
|
+
default: {
|
|
667
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
668
|
+
Component: {
|
|
669
|
+
exportName: "AdminStudioHeaderGlobalView",
|
|
670
|
+
path: clientPath,
|
|
671
|
+
clientProps: {
|
|
672
|
+
...studioNavClientProps,
|
|
673
|
+
actionHref: sitePreview?.header?.actionHref,
|
|
674
|
+
actionLabel: sitePreview?.header?.actionLabel,
|
|
675
|
+
globalSlug: global.slug,
|
|
676
|
+
locationSummary: sitePreview?.locationSummary,
|
|
677
|
+
pagesCollectionSlug
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
if (shouldAttachFooterEditView && !hasCustomEditView) {
|
|
684
|
+
return {
|
|
685
|
+
...existingEditViews,
|
|
686
|
+
default: {
|
|
687
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
688
|
+
Component: {
|
|
689
|
+
exportName: "AdminStudioFooterGlobalView",
|
|
690
|
+
path: clientPath,
|
|
691
|
+
clientProps: {
|
|
692
|
+
...studioNavClientProps,
|
|
693
|
+
builtByHref: sitePreview?.footer?.builtByHref,
|
|
694
|
+
builtByLabel: sitePreview?.footer?.builtByLabel,
|
|
695
|
+
description: sitePreview?.footer?.description,
|
|
696
|
+
footerCategories: sitePreview?.footer?.footerCategories,
|
|
697
|
+
footerLinks: sitePreview?.footer?.footerLinks,
|
|
698
|
+
globalSlug: global.slug,
|
|
699
|
+
locationSummary: sitePreview?.locationSummary
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
if (shouldAttachContactFormRedirect && !hasCustomEditView) {
|
|
706
|
+
return {
|
|
707
|
+
...existingEditViews,
|
|
708
|
+
default: {
|
|
709
|
+
...typeof existingEditViews?.default === "object" ? existingEditViews.default : {},
|
|
710
|
+
Component: {
|
|
711
|
+
exportName: "StudioContactFormRedirect",
|
|
712
|
+
path: clientPath,
|
|
713
|
+
clientProps: {
|
|
714
|
+
studioContactFormPath: contactFormStudioPath
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
};
|
|
396
719
|
}
|
|
397
|
-
|
|
720
|
+
return existingEditViews;
|
|
721
|
+
})();
|
|
722
|
+
const existingBeforeDocumentControls = global.admin?.components?.elements?.beforeDocumentControls;
|
|
398
723
|
return {
|
|
399
724
|
...global,
|
|
400
725
|
admin: {
|
|
@@ -402,12 +727,18 @@ function configureAdmin(config) {
|
|
|
402
727
|
group: mapping.group,
|
|
403
728
|
components: {
|
|
404
729
|
...global.admin?.components,
|
|
405
|
-
|
|
730
|
+
elements: {
|
|
731
|
+
...global.admin?.components?.elements,
|
|
732
|
+
beforeDocumentControls: studioEnabled ? appendComponent(
|
|
733
|
+
existingBeforeDocumentControls,
|
|
734
|
+
studioBackBreadcrumbComponent,
|
|
735
|
+
"StudioBackBreadcrumb"
|
|
736
|
+
) : existingBeforeDocumentControls
|
|
737
|
+
},
|
|
738
|
+
...nextEditViews ? {
|
|
406
739
|
views: {
|
|
407
740
|
...existingViews,
|
|
408
|
-
|
|
409
|
-
edit: contactFormEditViews
|
|
410
|
-
} : {}
|
|
741
|
+
edit: nextEditViews
|
|
411
742
|
}
|
|
412
743
|
} : {}
|
|
413
744
|
}
|
package/dist/admin/index.mjs
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
socialMediaConnectionsField,
|
|
8
8
|
themePreferenceField,
|
|
9
9
|
withTooltips
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-QJAWO6K3.mjs";
|
|
11
|
+
import "../chunk-W2UOCJDX.mjs";
|
|
11
12
|
import {
|
|
12
13
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
13
14
|
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
@@ -5,3 +5,4 @@ export { MediaDetailPanel } from './components/MediaDetailPanel'
|
|
|
5
5
|
export { MediaListItem } from './components/MediaListItem'
|
|
6
6
|
export { MediaUploadForm } from './components/MediaUploadForm'
|
|
7
7
|
export { PageEditorFrame } from './components/PageEditorFrame'
|
|
8
|
+
export { SiteFooterPreview, SiteHeaderPreview } from './components/SitePreview'
|
|
@@ -5,3 +5,4 @@ export { MediaDetailPanel } from './components/MediaDetailPanel'
|
|
|
5
5
|
export { MediaListItem } from './components/MediaListItem'
|
|
6
6
|
export { MediaUploadForm } from './components/MediaUploadForm'
|
|
7
7
|
export { PageEditorFrame } from './components/PageEditorFrame'
|
|
8
|
+
export { SiteFooterPreview, SiteHeaderPreview } from './components/SitePreview'
|