@orion-studios/payload-studio 0.5.0-beta.97 → 0.5.0-beta.99
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 +1 -1
- package/dist/admin/client.js +164 -43
- package/dist/admin/client.mjs +164 -43
- package/dist/admin/index.d.mts +2 -2
- package/dist/admin/index.d.ts +2 -2
- package/dist/admin/index.js +147 -11
- package/dist/admin/index.mjs +2 -2
- package/dist/{chunk-YJPNN3O3.mjs → chunk-74XFAVXU.mjs} +124 -4
- package/dist/{chunk-CKEUQCDC.mjs → chunk-XHWQJUX5.mjs} +1 -1
- package/dist/{chunk-ZFJJQ4YK.mjs → chunk-ZTXJG4K5.mjs} +24 -8
- package/dist/{index-D8RxRIh3.d.ts → index-BnoqmQDP.d.mts} +44 -3
- package/dist/{index-CodQ-io_.d.mts → index-CTpik6fR.d.ts} +44 -3
- package/dist/{index-CW02UDzl.d.mts → index-D8BNfUJb.d.mts} +1 -1
- package/dist/{index-BBUjXVqQ.d.ts → index-DD_E2UfJ.d.ts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +166 -30
- package/dist/index.mjs +3 -3
- package/dist/nextjs/index.d.mts +2 -2
- package/dist/nextjs/index.d.ts +2 -2
- package/dist/nextjs/index.js +24 -8
- package/dist/nextjs/index.mjs +2 -2
- package/dist/{socialMedia-CXaTwojP.d.mts → socialMedia-C05Iy-SV.d.mts} +2 -2
- package/dist/{socialMedia-CXaTwojP.d.ts → socialMedia-C05Iy-SV.d.ts} +2 -2
- package/package.json +10 -2
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, c as configureAdmin,
|
|
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-
|
|
1
|
+
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioSection, b as StudioSectionCard, c as StudioSectionComponent, d as StudioSectionRole, e as StudioSectionView, f as configureAdmin, g as createHeaderNavItemsField, h as createSocialMediaConnectionsField, j as createSocialMediaGlobal, k as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-BnoqmQDP.mjs';
|
|
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';
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, c as configureAdmin,
|
|
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-
|
|
1
|
+
export { A as AdminConfig, C as CreateSocialMediaConnectionsFieldOptions, a as CreateSocialMediaGlobalOptions, R as ResolvedStudioSection, S as StudioSection, b as StudioSectionCard, c as StudioSectionComponent, d as StudioSectionRole, e as StudioSectionView, f as configureAdmin, g as createHeaderNavItemsField, h as createSocialMediaConnectionsField, j as createSocialMediaGlobal, k as createThemePreferenceField, s as socialMediaConnectionsField, t as themePreferenceField, w as withTooltips } from '../index-CTpik6fR.js';
|
|
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';
|
package/dist/admin/index.js
CHANGED
|
@@ -68,6 +68,113 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
|
|
|
68
68
|
});
|
|
69
69
|
var themePreferenceField = createThemePreferenceField("brand-light");
|
|
70
70
|
|
|
71
|
+
// src/shared/studioSections.ts
|
|
72
|
+
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
73
|
+
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
74
|
+
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
75
|
+
var normalizePathLikeValue = (value) => {
|
|
76
|
+
const trimmed = value.trim();
|
|
77
|
+
if (!trimmed) {
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
if (isAbsoluteExternalURL(trimmed)) {
|
|
81
|
+
return trimmed;
|
|
82
|
+
}
|
|
83
|
+
const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
84
|
+
const normalized = withLeadingSlash.replace(/\/+$/, "");
|
|
85
|
+
return normalized || "/";
|
|
86
|
+
};
|
|
87
|
+
var normalizeStringArray = (value) => {
|
|
88
|
+
if (!Array.isArray(value)) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
return value.filter((entry) => typeof entry === "string").map((entry) => normalizePathLikeValue(entry)).filter((entry) => entry.length > 0);
|
|
92
|
+
};
|
|
93
|
+
var normalizeRoles = (value) => {
|
|
94
|
+
if (!Array.isArray(value)) {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
const roles = value.filter((entry) => typeof entry === "string" && studioRoles.has(entry));
|
|
98
|
+
return roles.length > 0 ? roles : void 0;
|
|
99
|
+
};
|
|
100
|
+
var normalizeCard = (value) => {
|
|
101
|
+
if (!isRecord(value) || typeof value.title !== "string") {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
const title = value.title.trim();
|
|
105
|
+
if (!title) {
|
|
106
|
+
return void 0;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
title,
|
|
110
|
+
...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
var resolveStudioSections = (value) => {
|
|
114
|
+
if (!Array.isArray(value)) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
const sections = [];
|
|
118
|
+
const seen = /* @__PURE__ */ new Set();
|
|
119
|
+
for (const entry of value) {
|
|
120
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || typeof entry.label !== "string") {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const id = entry.id.trim();
|
|
124
|
+
const label = entry.label.trim();
|
|
125
|
+
if (!id || !label || seen.has(id)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const href = typeof entry.href === "string" && entry.href.trim().length > 0 ? normalizePathLikeValue(entry.href) : isRecord(entry.view) && typeof entry.view.path === "string" ? normalizePathLikeValue(entry.view.path) : "";
|
|
129
|
+
if (!href) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const matchPrefixes = Array.from(/* @__PURE__ */ new Set([href, ...normalizeStringArray(entry.matchPrefixes)]));
|
|
133
|
+
sections.push({
|
|
134
|
+
id,
|
|
135
|
+
label,
|
|
136
|
+
href,
|
|
137
|
+
matchPrefixes,
|
|
138
|
+
...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
|
|
139
|
+
...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
|
|
140
|
+
});
|
|
141
|
+
seen.add(id);
|
|
142
|
+
}
|
|
143
|
+
return sections;
|
|
144
|
+
};
|
|
145
|
+
var resolveStudioSectionViews = (value) => {
|
|
146
|
+
if (!Array.isArray(value)) {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
const views = {};
|
|
150
|
+
for (const entry of value) {
|
|
151
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || !isRecord(entry.view)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const id = entry.id.trim();
|
|
155
|
+
const view = entry.view;
|
|
156
|
+
const component = isRecord(view.Component) ? view.Component : null;
|
|
157
|
+
if (!id || typeof view.path !== "string" || !component || typeof component.exportName !== "string" || typeof component.path !== "string") {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const path2 = normalizePathLikeValue(view.path);
|
|
161
|
+
const componentPath = component.path.trim();
|
|
162
|
+
const exportName = component.exportName.trim();
|
|
163
|
+
if (!path2 || !componentPath || !exportName) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
views[id] = {
|
|
167
|
+
path: path2,
|
|
168
|
+
Component: {
|
|
169
|
+
exportName,
|
|
170
|
+
path: componentPath,
|
|
171
|
+
...isRecord(component.clientProps) ? { clientProps: component.clientProps } : {}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return views;
|
|
176
|
+
};
|
|
177
|
+
|
|
71
178
|
// src/admin/helpers/configureAdmin.ts
|
|
72
179
|
var import_meta = {};
|
|
73
180
|
function getPkgDistDir() {
|
|
@@ -114,6 +221,8 @@ function configureAdmin(config) {
|
|
|
114
221
|
href: contactFormStudioPath
|
|
115
222
|
};
|
|
116
223
|
});
|
|
224
|
+
const studioSections = resolveStudioSections(config.studio?.sections || []);
|
|
225
|
+
const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
|
|
117
226
|
let cssPath;
|
|
118
227
|
const pkgDist = getPkgDistDir();
|
|
119
228
|
const sourceCssPath = import_path.default.resolve(pkgDist, "admin.css");
|
|
@@ -146,7 +255,8 @@ function configureAdmin(config) {
|
|
|
146
255
|
globalsBasePath: "/studio-globals",
|
|
147
256
|
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
148
257
|
mediaCollectionSlug,
|
|
149
|
-
pagesCollectionSlug
|
|
258
|
+
pagesCollectionSlug,
|
|
259
|
+
sections: studioSections
|
|
150
260
|
}
|
|
151
261
|
}
|
|
152
262
|
} : {},
|
|
@@ -179,7 +289,8 @@ function configureAdmin(config) {
|
|
|
179
289
|
globalsBasePath: "/studio-globals",
|
|
180
290
|
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
181
291
|
mediaCollectionSlug,
|
|
182
|
-
pagesCollectionSlug
|
|
292
|
+
pagesCollectionSlug,
|
|
293
|
+
sections: studioSections
|
|
183
294
|
}
|
|
184
295
|
}
|
|
185
296
|
},
|
|
@@ -205,7 +316,16 @@ function configureAdmin(config) {
|
|
|
205
316
|
globalsBasePath: "/studio-globals"
|
|
206
317
|
}
|
|
207
318
|
}
|
|
208
|
-
}
|
|
319
|
+
},
|
|
320
|
+
...Object.fromEntries(
|
|
321
|
+
Object.entries(studioSectionViews).map(([id, view]) => [
|
|
322
|
+
id,
|
|
323
|
+
{
|
|
324
|
+
path: view.path,
|
|
325
|
+
Component: view.Component
|
|
326
|
+
}
|
|
327
|
+
])
|
|
328
|
+
)
|
|
209
329
|
} : {}
|
|
210
330
|
},
|
|
211
331
|
providers: [
|
|
@@ -418,35 +538,51 @@ var SOCIAL_MEDIA_PLATFORMS = [
|
|
|
418
538
|
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
419
539
|
facebook: [
|
|
420
540
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
421
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" }
|
|
541
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
|
|
542
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
|
|
543
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
|
|
422
544
|
],
|
|
423
545
|
instagram: [
|
|
424
546
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
425
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" }
|
|
547
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
|
|
548
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
|
|
549
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
|
|
426
550
|
],
|
|
427
551
|
x: [
|
|
428
552
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
429
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" }
|
|
553
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
|
|
554
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
|
|
555
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
|
|
430
556
|
],
|
|
431
557
|
linkedin: [
|
|
432
558
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
433
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" }
|
|
559
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
|
|
560
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
|
|
561
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
|
|
434
562
|
],
|
|
435
563
|
youtube: [
|
|
436
564
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
437
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" }
|
|
565
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
|
|
566
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
|
|
567
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
|
|
438
568
|
],
|
|
439
569
|
tiktok: [
|
|
440
570
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
441
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" }
|
|
571
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
|
|
572
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
|
|
573
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
|
|
442
574
|
],
|
|
443
575
|
pinterest: [
|
|
444
576
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
445
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" }
|
|
577
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
|
|
578
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
|
|
579
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
|
|
446
580
|
],
|
|
447
581
|
snapchat: [
|
|
448
582
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
449
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" }
|
|
583
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
|
|
584
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
|
|
585
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
|
|
450
586
|
]
|
|
451
587
|
};
|
|
452
588
|
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
package/dist/admin/index.mjs
CHANGED
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
socialMediaConnectionsField,
|
|
8
8
|
themePreferenceField,
|
|
9
9
|
withTooltips
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-74XFAVXU.mjs";
|
|
11
11
|
import {
|
|
12
12
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
13
13
|
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
14
14
|
SOCIAL_MEDIA_PLATFORMS,
|
|
15
15
|
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-ZTXJG4K5.mjs";
|
|
17
17
|
import "../chunk-6BWS3CLP.mjs";
|
|
18
18
|
export {
|
|
19
19
|
SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
SOCIAL_MEDIA_ICON_OPTIONS,
|
|
4
4
|
SOCIAL_MEDIA_PLATFORMS,
|
|
5
5
|
SOCIAL_MEDIA_PLATFORM_LABELS
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZTXJG4K5.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__export,
|
|
9
9
|
__require
|
|
@@ -49,6 +49,113 @@ var createThemePreferenceField = (defaultTheme = "brand-light") => ({
|
|
|
49
49
|
});
|
|
50
50
|
var themePreferenceField = createThemePreferenceField("brand-light");
|
|
51
51
|
|
|
52
|
+
// src/shared/studioSections.ts
|
|
53
|
+
var studioRoles = /* @__PURE__ */ new Set(["admin", "editor", "client"]);
|
|
54
|
+
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
55
|
+
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
56
|
+
var normalizePathLikeValue = (value) => {
|
|
57
|
+
const trimmed = value.trim();
|
|
58
|
+
if (!trimmed) {
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
if (isAbsoluteExternalURL(trimmed)) {
|
|
62
|
+
return trimmed;
|
|
63
|
+
}
|
|
64
|
+
const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
65
|
+
const normalized = withLeadingSlash.replace(/\/+$/, "");
|
|
66
|
+
return normalized || "/";
|
|
67
|
+
};
|
|
68
|
+
var normalizeStringArray = (value) => {
|
|
69
|
+
if (!Array.isArray(value)) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
return value.filter((entry) => typeof entry === "string").map((entry) => normalizePathLikeValue(entry)).filter((entry) => entry.length > 0);
|
|
73
|
+
};
|
|
74
|
+
var normalizeRoles = (value) => {
|
|
75
|
+
if (!Array.isArray(value)) {
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
const roles = value.filter((entry) => typeof entry === "string" && studioRoles.has(entry));
|
|
79
|
+
return roles.length > 0 ? roles : void 0;
|
|
80
|
+
};
|
|
81
|
+
var normalizeCard = (value) => {
|
|
82
|
+
if (!isRecord(value) || typeof value.title !== "string") {
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
const title = value.title.trim();
|
|
86
|
+
if (!title) {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
title,
|
|
91
|
+
...typeof value.description === "string" && value.description.trim().length > 0 ? { description: value.description.trim() } : {}
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
var resolveStudioSections = (value) => {
|
|
95
|
+
if (!Array.isArray(value)) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
const sections = [];
|
|
99
|
+
const seen = /* @__PURE__ */ new Set();
|
|
100
|
+
for (const entry of value) {
|
|
101
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || typeof entry.label !== "string") {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const id = entry.id.trim();
|
|
105
|
+
const label = entry.label.trim();
|
|
106
|
+
if (!id || !label || seen.has(id)) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const href = typeof entry.href === "string" && entry.href.trim().length > 0 ? normalizePathLikeValue(entry.href) : isRecord(entry.view) && typeof entry.view.path === "string" ? normalizePathLikeValue(entry.view.path) : "";
|
|
110
|
+
if (!href) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const matchPrefixes = Array.from(/* @__PURE__ */ new Set([href, ...normalizeStringArray(entry.matchPrefixes)]));
|
|
114
|
+
sections.push({
|
|
115
|
+
id,
|
|
116
|
+
label,
|
|
117
|
+
href,
|
|
118
|
+
matchPrefixes,
|
|
119
|
+
...normalizeRoles(entry.roles) ? { roles: normalizeRoles(entry.roles) } : {},
|
|
120
|
+
...normalizeCard(entry.card) ? { card: normalizeCard(entry.card) } : {}
|
|
121
|
+
});
|
|
122
|
+
seen.add(id);
|
|
123
|
+
}
|
|
124
|
+
return sections;
|
|
125
|
+
};
|
|
126
|
+
var resolveStudioSectionViews = (value) => {
|
|
127
|
+
if (!Array.isArray(value)) {
|
|
128
|
+
return {};
|
|
129
|
+
}
|
|
130
|
+
const views = {};
|
|
131
|
+
for (const entry of value) {
|
|
132
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || !isRecord(entry.view)) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const id = entry.id.trim();
|
|
136
|
+
const view = entry.view;
|
|
137
|
+
const component = isRecord(view.Component) ? view.Component : null;
|
|
138
|
+
if (!id || typeof view.path !== "string" || !component || typeof component.exportName !== "string" || typeof component.path !== "string") {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const path2 = normalizePathLikeValue(view.path);
|
|
142
|
+
const componentPath = component.path.trim();
|
|
143
|
+
const exportName = component.exportName.trim();
|
|
144
|
+
if (!path2 || !componentPath || !exportName) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
views[id] = {
|
|
148
|
+
path: path2,
|
|
149
|
+
Component: {
|
|
150
|
+
exportName,
|
|
151
|
+
path: componentPath,
|
|
152
|
+
...isRecord(component.clientProps) ? { clientProps: component.clientProps } : {}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return views;
|
|
157
|
+
};
|
|
158
|
+
|
|
52
159
|
// src/admin/helpers/configureAdmin.ts
|
|
53
160
|
function getPkgDistDir() {
|
|
54
161
|
try {
|
|
@@ -94,6 +201,8 @@ function configureAdmin(config) {
|
|
|
94
201
|
href: contactFormStudioPath
|
|
95
202
|
};
|
|
96
203
|
});
|
|
204
|
+
const studioSections = resolveStudioSections(config.studio?.sections || []);
|
|
205
|
+
const studioSectionViews = resolveStudioSectionViews(config.studio?.sections || []);
|
|
97
206
|
let cssPath;
|
|
98
207
|
const pkgDist = getPkgDistDir();
|
|
99
208
|
const sourceCssPath = path.resolve(pkgDist, "admin.css");
|
|
@@ -126,7 +235,8 @@ function configureAdmin(config) {
|
|
|
126
235
|
globalsBasePath: "/studio-globals",
|
|
127
236
|
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
128
237
|
mediaCollectionSlug,
|
|
129
|
-
pagesCollectionSlug
|
|
238
|
+
pagesCollectionSlug,
|
|
239
|
+
sections: studioSections
|
|
130
240
|
}
|
|
131
241
|
}
|
|
132
242
|
} : {},
|
|
@@ -159,7 +269,8 @@ function configureAdmin(config) {
|
|
|
159
269
|
globalsBasePath: "/studio-globals",
|
|
160
270
|
globalsExtraMatchPrefixes: [contactFormStudioPath],
|
|
161
271
|
mediaCollectionSlug,
|
|
162
|
-
pagesCollectionSlug
|
|
272
|
+
pagesCollectionSlug,
|
|
273
|
+
sections: studioSections
|
|
163
274
|
}
|
|
164
275
|
}
|
|
165
276
|
},
|
|
@@ -185,7 +296,16 @@ function configureAdmin(config) {
|
|
|
185
296
|
globalsBasePath: "/studio-globals"
|
|
186
297
|
}
|
|
187
298
|
}
|
|
188
|
-
}
|
|
299
|
+
},
|
|
300
|
+
...Object.fromEntries(
|
|
301
|
+
Object.entries(studioSectionViews).map(([id, view]) => [
|
|
302
|
+
id,
|
|
303
|
+
{
|
|
304
|
+
path: view.path,
|
|
305
|
+
Component: view.Component
|
|
306
|
+
}
|
|
307
|
+
])
|
|
308
|
+
)
|
|
189
309
|
} : {}
|
|
190
310
|
},
|
|
191
311
|
providers: [
|
|
@@ -22,35 +22,51 @@ var SOCIAL_MEDIA_PLATFORMS = [
|
|
|
22
22
|
var SOCIAL_MEDIA_ICON_OPTIONS = {
|
|
23
23
|
facebook: [
|
|
24
24
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:facebook" },
|
|
25
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" }
|
|
25
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:facebook-f" },
|
|
26
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-facebook" },
|
|
27
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:facebook-fill" }
|
|
26
28
|
],
|
|
27
29
|
instagram: [
|
|
28
30
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:instagram" },
|
|
29
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" }
|
|
31
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:instagram" },
|
|
32
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-instagram" },
|
|
33
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:instagram-fill" }
|
|
30
34
|
],
|
|
31
35
|
x: [
|
|
32
36
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:x" },
|
|
33
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" }
|
|
37
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:x-twitter" },
|
|
38
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-x" },
|
|
39
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:twitter-x-fill" }
|
|
34
40
|
],
|
|
35
41
|
linkedin: [
|
|
36
42
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:linkedin" },
|
|
37
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" }
|
|
43
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:linkedin-in" },
|
|
44
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-linkedin" },
|
|
45
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:linkedin-fill" }
|
|
38
46
|
],
|
|
39
47
|
youtube: [
|
|
40
48
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:youtube" },
|
|
41
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" }
|
|
49
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:youtube" },
|
|
50
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-youtube" },
|
|
51
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:youtube-fill" }
|
|
42
52
|
],
|
|
43
53
|
tiktok: [
|
|
44
54
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:tiktok" },
|
|
45
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" }
|
|
55
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:tiktok" },
|
|
56
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-tiktok" },
|
|
57
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:tiktok-fill" }
|
|
46
58
|
],
|
|
47
59
|
pinterest: [
|
|
48
60
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:pinterest" },
|
|
49
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" }
|
|
61
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:pinterest-p" },
|
|
62
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-pinterest" },
|
|
63
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:pinterest-fill" }
|
|
50
64
|
],
|
|
51
65
|
snapchat: [
|
|
52
66
|
{ label: "Simple Icons", library: "simple-icons", value: "simple-icons:snapchat" },
|
|
53
|
-
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" }
|
|
67
|
+
{ label: "Font Awesome Brands", library: "font-awesome-brands", value: "fa6-brands:snapchat" },
|
|
68
|
+
{ label: "Tabler Brands", library: "tabler-brands", value: "tabler:brand-snapchat" },
|
|
69
|
+
{ label: "Remix Icons", library: "remix-icons", value: "ri:snapchat-fill" }
|
|
54
70
|
]
|
|
55
71
|
};
|
|
56
72
|
var SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM = SOCIAL_MEDIA_PLATFORMS.reduce(
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
import { Field, CollectionConfig, GlobalConfig } from 'payload';
|
|
2
|
-
import { a as SocialMediaPlatform, 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, h as SocialMediaProfileData, i as SocialMediaProfilesData } from './socialMedia-
|
|
2
|
+
import { a as SocialMediaPlatform, 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, h as SocialMediaProfileData, i as SocialMediaProfilesData } from './socialMedia-C05Iy-SV.mjs';
|
|
3
3
|
|
|
4
4
|
type ThemeOption = 'light' | 'dark' | 'brand-light' | 'brand-dark';
|
|
5
5
|
declare const createThemePreferenceField: (defaultTheme?: ThemeOption) => Field;
|
|
6
6
|
declare const themePreferenceField: Field;
|
|
7
7
|
|
|
8
|
+
type StudioSectionRole = 'admin' | 'editor' | 'client';
|
|
9
|
+
type StudioSectionCard = {
|
|
10
|
+
description?: string;
|
|
11
|
+
title: string;
|
|
12
|
+
};
|
|
13
|
+
type StudioSectionComponent = {
|
|
14
|
+
clientProps?: Record<string, unknown>;
|
|
15
|
+
exportName: string;
|
|
16
|
+
path: string;
|
|
17
|
+
};
|
|
18
|
+
type StudioSectionView = {
|
|
19
|
+
Component: StudioSectionComponent;
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
type StudioSection = {
|
|
23
|
+
card?: StudioSectionCard;
|
|
24
|
+
href?: string;
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
matchPrefixes?: string[];
|
|
28
|
+
roles?: StudioSectionRole[];
|
|
29
|
+
view?: StudioSectionView;
|
|
30
|
+
};
|
|
31
|
+
type ResolvedStudioSection = {
|
|
32
|
+
card?: StudioSectionCard;
|
|
33
|
+
href: string;
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
matchPrefixes: string[];
|
|
37
|
+
roles?: StudioSectionRole[];
|
|
38
|
+
};
|
|
39
|
+
|
|
8
40
|
type StudioGlobalLink = {
|
|
9
41
|
description?: string;
|
|
10
42
|
href?: string;
|
|
@@ -21,6 +53,7 @@ interface AdminStudioConfig {
|
|
|
21
53
|
builderBasePath?: string;
|
|
22
54
|
collectionSlug?: string;
|
|
23
55
|
};
|
|
56
|
+
sections?: StudioSection[];
|
|
24
57
|
}
|
|
25
58
|
interface AdminConfig {
|
|
26
59
|
brandName: string;
|
|
@@ -87,6 +120,7 @@ declare function configureAdmin(config: AdminConfig): {
|
|
|
87
120
|
globalsExtraMatchPrefixes: string[];
|
|
88
121
|
mediaCollectionSlug: string;
|
|
89
122
|
pagesCollectionSlug: string;
|
|
123
|
+
sections: ResolvedStudioSection[];
|
|
90
124
|
};
|
|
91
125
|
};
|
|
92
126
|
};
|
|
@@ -115,6 +149,7 @@ declare function configureAdmin(config: AdminConfig): {
|
|
|
115
149
|
globalsExtraMatchPrefixes: string[];
|
|
116
150
|
mediaCollectionSlug: string;
|
|
117
151
|
pagesCollectionSlug: string;
|
|
152
|
+
sections: ResolvedStudioSection[];
|
|
118
153
|
};
|
|
119
154
|
} | undefined;
|
|
120
155
|
};
|
|
@@ -153,6 +188,7 @@ declare const createSocialMediaGlobal: (options?: CreateSocialMediaGlobalOptions
|
|
|
153
188
|
type index_AdminConfig = AdminConfig;
|
|
154
189
|
type index_CreateSocialMediaConnectionsFieldOptions = CreateSocialMediaConnectionsFieldOptions;
|
|
155
190
|
type index_CreateSocialMediaGlobalOptions = CreateSocialMediaGlobalOptions;
|
|
191
|
+
type index_ResolvedStudioSection = ResolvedStudioSection;
|
|
156
192
|
declare const index_SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: typeof SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM;
|
|
157
193
|
declare const index_SOCIAL_MEDIA_ICON_OPTIONS: typeof SOCIAL_MEDIA_ICON_OPTIONS;
|
|
158
194
|
declare const index_SOCIAL_MEDIA_PLATFORMS: typeof SOCIAL_MEDIA_PLATFORMS;
|
|
@@ -163,6 +199,11 @@ declare const index_SocialMediaIconOption: typeof SocialMediaIconOption;
|
|
|
163
199
|
declare const index_SocialMediaPlatform: typeof SocialMediaPlatform;
|
|
164
200
|
declare const index_SocialMediaProfileData: typeof SocialMediaProfileData;
|
|
165
201
|
declare const index_SocialMediaProfilesData: typeof SocialMediaProfilesData;
|
|
202
|
+
type index_StudioSection = StudioSection;
|
|
203
|
+
type index_StudioSectionCard = StudioSectionCard;
|
|
204
|
+
type index_StudioSectionComponent = StudioSectionComponent;
|
|
205
|
+
type index_StudioSectionRole = StudioSectionRole;
|
|
206
|
+
type index_StudioSectionView = StudioSectionView;
|
|
166
207
|
declare const index_configureAdmin: typeof configureAdmin;
|
|
167
208
|
declare const index_createHeaderNavItemsField: typeof createHeaderNavItemsField;
|
|
168
209
|
declare const index_createSocialMediaConnectionsField: typeof createSocialMediaConnectionsField;
|
|
@@ -172,7 +213,7 @@ declare const index_socialMediaConnectionsField: typeof socialMediaConnectionsFi
|
|
|
172
213
|
declare const index_themePreferenceField: typeof themePreferenceField;
|
|
173
214
|
declare const index_withTooltips: typeof withTooltips;
|
|
174
215
|
declare namespace index {
|
|
175
|
-
export { type index_AdminConfig as AdminConfig, type index_CreateSocialMediaConnectionsFieldOptions as CreateSocialMediaConnectionsFieldOptions, type index_CreateSocialMediaGlobalOptions as CreateSocialMediaGlobalOptions, index_SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, index_SOCIAL_MEDIA_ICON_OPTIONS as SOCIAL_MEDIA_ICON_OPTIONS, index_SOCIAL_MEDIA_PLATFORMS as SOCIAL_MEDIA_PLATFORMS, index_SOCIAL_MEDIA_PLATFORM_LABELS as SOCIAL_MEDIA_PLATFORM_LABELS, index_SocialMediaGlobalData as SocialMediaGlobalData, index_SocialMediaIconLibrary as SocialMediaIconLibrary, index_SocialMediaIconOption as SocialMediaIconOption, index_SocialMediaPlatform as SocialMediaPlatform, index_SocialMediaProfileData as SocialMediaProfileData, index_SocialMediaProfilesData as SocialMediaProfilesData, index_configureAdmin as configureAdmin, index_createHeaderNavItemsField as createHeaderNavItemsField, index_createSocialMediaConnectionsField as createSocialMediaConnectionsField, index_createSocialMediaGlobal as createSocialMediaGlobal, index_createThemePreferenceField as createThemePreferenceField, index_socialMediaConnectionsField as socialMediaConnectionsField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
|
|
216
|
+
export { type index_AdminConfig as AdminConfig, type index_CreateSocialMediaConnectionsFieldOptions as CreateSocialMediaConnectionsFieldOptions, type index_CreateSocialMediaGlobalOptions as CreateSocialMediaGlobalOptions, type index_ResolvedStudioSection as ResolvedStudioSection, index_SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM as SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM, index_SOCIAL_MEDIA_ICON_OPTIONS as SOCIAL_MEDIA_ICON_OPTIONS, index_SOCIAL_MEDIA_PLATFORMS as SOCIAL_MEDIA_PLATFORMS, index_SOCIAL_MEDIA_PLATFORM_LABELS as SOCIAL_MEDIA_PLATFORM_LABELS, index_SocialMediaGlobalData as SocialMediaGlobalData, index_SocialMediaIconLibrary as SocialMediaIconLibrary, index_SocialMediaIconOption as SocialMediaIconOption, index_SocialMediaPlatform as SocialMediaPlatform, index_SocialMediaProfileData as SocialMediaProfileData, index_SocialMediaProfilesData as SocialMediaProfilesData, type index_StudioSection as StudioSection, type index_StudioSectionCard as StudioSectionCard, type index_StudioSectionComponent as StudioSectionComponent, type index_StudioSectionRole as StudioSectionRole, type index_StudioSectionView as StudioSectionView, index_configureAdmin as configureAdmin, index_createHeaderNavItemsField as createHeaderNavItemsField, index_createSocialMediaConnectionsField as createSocialMediaConnectionsField, index_createSocialMediaGlobal as createSocialMediaGlobal, index_createThemePreferenceField as createThemePreferenceField, index_socialMediaConnectionsField as socialMediaConnectionsField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
|
|
176
217
|
}
|
|
177
218
|
|
|
178
|
-
export { type AdminConfig as A, type CreateSocialMediaConnectionsFieldOptions as C, type CreateSocialMediaGlobalOptions as a,
|
|
219
|
+
export { type AdminConfig as A, type CreateSocialMediaConnectionsFieldOptions as C, type ResolvedStudioSection as R, type StudioSection as S, type CreateSocialMediaGlobalOptions as a, type StudioSectionCard as b, type StudioSectionComponent as c, type StudioSectionRole as d, type StudioSectionView as e, configureAdmin as f, createHeaderNavItemsField as g, createSocialMediaConnectionsField as h, index as i, createSocialMediaGlobal as j, createThemePreferenceField as k, socialMediaConnectionsField as s, themePreferenceField as t, withTooltips as w };
|