@orion-studios/payload-studio 0.6.0-beta.4 → 0.6.0-beta.6
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/dist/admin/client.js +1 -1
- package/dist/admin/client.mjs +1 -1
- package/dist/admin/index.js +4 -96
- package/dist/admin/index.mjs +1 -1
- package/dist/{chunk-DYXSAVUQ.mjs → chunk-NTXOLLDC.mjs} +5 -97
- package/dist/index.js +4 -96
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/admin/client.js
CHANGED
|
@@ -1248,7 +1248,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
1248
1248
|
let cancelled = false;
|
|
1249
1249
|
const run = async () => {
|
|
1250
1250
|
try {
|
|
1251
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
1251
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
1252
1252
|
credentials: "include"
|
|
1253
1253
|
});
|
|
1254
1254
|
if (!res.ok) return;
|
package/dist/admin/client.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
59
59
|
let cancelled = false;
|
|
60
60
|
const run = async () => {
|
|
61
61
|
try {
|
|
62
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
62
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
63
63
|
credentials: "include"
|
|
64
64
|
});
|
|
65
65
|
if (!res.ok) return;
|
package/dist/admin/index.js
CHANGED
|
@@ -828,9 +828,6 @@ function configureAdmin(config) {
|
|
|
828
828
|
};
|
|
829
829
|
}
|
|
830
830
|
|
|
831
|
-
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
832
|
-
var import_RenderServerComponent = require("@payloadcms/ui/elements/RenderServerComponent");
|
|
833
|
-
|
|
834
831
|
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
835
832
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
836
833
|
function AdminBreadcrumbs({ items }) {
|
|
@@ -1069,7 +1066,6 @@ function SnapshotMetric({ card }) {
|
|
|
1069
1066
|
] });
|
|
1070
1067
|
}
|
|
1071
1068
|
function AdminStudioDashboardClient({
|
|
1072
|
-
extensionPanels = [],
|
|
1073
1069
|
formSubmissionsCollectionSlug,
|
|
1074
1070
|
formsCollectionSlug,
|
|
1075
1071
|
formsEnabled,
|
|
@@ -1081,7 +1077,8 @@ function AdminStudioDashboardClient({
|
|
|
1081
1077
|
pagesPath,
|
|
1082
1078
|
sectionLinks,
|
|
1083
1079
|
toolsPath,
|
|
1084
|
-
userRole
|
|
1080
|
+
userRole,
|
|
1081
|
+
children
|
|
1085
1082
|
}) {
|
|
1086
1083
|
const role = isRole(userRole) ? userRole : void 0;
|
|
1087
1084
|
const [state, setState] = (0, import_react.useState)(
|
|
@@ -1462,17 +1459,7 @@ function AdminStudioDashboardClient({
|
|
|
1462
1459
|
] }),
|
|
1463
1460
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
1464
1461
|
snapshotCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SnapshotMetric, { card }, card.kicker)),
|
|
1465
|
-
|
|
1466
|
-
"div",
|
|
1467
|
-
{
|
|
1468
|
-
className: [
|
|
1469
|
-
"orion-dashboard-extension-panel",
|
|
1470
|
-
panel.span === "full" ? "is-full" : "is-half"
|
|
1471
|
-
].filter(Boolean).join(" "),
|
|
1472
|
-
children: panel.node
|
|
1473
|
-
},
|
|
1474
|
-
panel.id
|
|
1475
|
-
))
|
|
1462
|
+
children
|
|
1476
1463
|
] }),
|
|
1477
1464
|
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
1478
1465
|
] })
|
|
@@ -1673,7 +1660,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
1673
1660
|
let cancelled = false;
|
|
1674
1661
|
const run = async () => {
|
|
1675
1662
|
try {
|
|
1676
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
1663
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
1677
1664
|
credentials: "include"
|
|
1678
1665
|
});
|
|
1679
1666
|
if (!res.ok) return;
|
|
@@ -2020,44 +2007,6 @@ var getPropSections2 = (props) => {
|
|
|
2020
2007
|
}
|
|
2021
2008
|
return [];
|
|
2022
2009
|
};
|
|
2023
|
-
var getPropDashboardPanels = (props) => {
|
|
2024
|
-
if (!props || typeof props !== "object") return [];
|
|
2025
|
-
const direct = resolveStudioSectionDashboards(props.dashboardPanels);
|
|
2026
|
-
if (direct.length > 0) return direct;
|
|
2027
|
-
const clientProps = props.clientProps;
|
|
2028
|
-
if (clientProps && typeof clientProps === "object") {
|
|
2029
|
-
return resolveStudioSectionDashboards(clientProps.dashboardPanels);
|
|
2030
|
-
}
|
|
2031
|
-
return [];
|
|
2032
|
-
};
|
|
2033
|
-
var readImportMap = (props) => {
|
|
2034
|
-
if (!props || typeof props !== "object") return void 0;
|
|
2035
|
-
const direct = props.importMap;
|
|
2036
|
-
if (direct && typeof direct === "object") {
|
|
2037
|
-
return direct;
|
|
2038
|
-
}
|
|
2039
|
-
const payloadLike = props.payload;
|
|
2040
|
-
if (payloadLike && typeof payloadLike === "object") {
|
|
2041
|
-
const nested = payloadLike.importMap;
|
|
2042
|
-
if (nested && typeof nested === "object") {
|
|
2043
|
-
return nested;
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
const initPageResult = props.initPageResult;
|
|
2047
|
-
if (initPageResult && typeof initPageResult === "object") {
|
|
2048
|
-
const req = initPageResult.req;
|
|
2049
|
-
if (req && typeof req === "object") {
|
|
2050
|
-
const payload = req.payload;
|
|
2051
|
-
if (payload && typeof payload === "object") {
|
|
2052
|
-
const nested = payload.importMap;
|
|
2053
|
-
if (nested && typeof nested === "object") {
|
|
2054
|
-
return nested;
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
return void 0;
|
|
2060
|
-
};
|
|
2061
2010
|
var readUserRole2 = (props) => {
|
|
2062
2011
|
if (!props || typeof props !== "object") return void 0;
|
|
2063
2012
|
const user = props.user;
|
|
@@ -2112,15 +2061,6 @@ var readAdminBasePath = (props) => {
|
|
|
2112
2061
|
}
|
|
2113
2062
|
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2114
2063
|
};
|
|
2115
|
-
var canAccess2 = (role, roles) => {
|
|
2116
|
-
if (!roles || roles.length === 0) {
|
|
2117
|
-
return true;
|
|
2118
|
-
}
|
|
2119
|
-
if (!role) {
|
|
2120
|
-
return false;
|
|
2121
|
-
}
|
|
2122
|
-
return roles.includes(role);
|
|
2123
|
-
};
|
|
2124
2064
|
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2125
2065
|
const links = [
|
|
2126
2066
|
{
|
|
@@ -2168,39 +2108,11 @@ var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath)
|
|
|
2168
2108
|
return true;
|
|
2169
2109
|
});
|
|
2170
2110
|
};
|
|
2171
|
-
function DashboardPanelFallback({ label }) {
|
|
2172
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "orion-dashboard-extension-fallback", children: [
|
|
2173
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Extension Unavailable" }),
|
|
2174
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: label }),
|
|
2175
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "This dashboard panel could not be rendered, but the rest of the dashboard is still available." })
|
|
2176
|
-
] });
|
|
2177
|
-
}
|
|
2178
|
-
function buildExtensionPanels(adminBasePath, importMap, panels, userRole) {
|
|
2179
|
-
const visiblePanels = panels.filter((panel) => canAccess2(userRole, panel.roles));
|
|
2180
|
-
return visiblePanels.map((panel) => {
|
|
2181
|
-
const href = resolveAdminPath2(adminBasePath, panel.href);
|
|
2182
|
-
return {
|
|
2183
|
-
id: panel.id,
|
|
2184
|
-
node: importMap ? (0, import_RenderServerComponent.RenderServerComponent)({
|
|
2185
|
-
Component: panel.Component,
|
|
2186
|
-
Fallback: () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
|
|
2187
|
-
importMap,
|
|
2188
|
-
serverProps: {
|
|
2189
|
-
adminBasePath,
|
|
2190
|
-
href,
|
|
2191
|
-
label: panel.label
|
|
2192
|
-
}
|
|
2193
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
|
|
2194
|
-
span: panel.span
|
|
2195
|
-
};
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
2111
|
function AdminStudioDashboard(rawProps) {
|
|
2199
2112
|
const props = rawProps || {};
|
|
2200
2113
|
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2201
2114
|
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2202
2115
|
const sections = getPropSections2(props);
|
|
2203
|
-
const dashboardPanels = getPropDashboardPanels(props);
|
|
2204
2116
|
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2205
2117
|
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2206
2118
|
const formSubmissionsCollectionSlug = getPropString2(
|
|
@@ -2210,11 +2122,9 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2210
2122
|
);
|
|
2211
2123
|
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2212
2124
|
const adminBasePath = readAdminBasePath(props);
|
|
2213
|
-
const importMap = readImportMap(props);
|
|
2214
2125
|
const userRole = readUserRole2(props);
|
|
2215
2126
|
const navProps = {
|
|
2216
2127
|
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2217
|
-
dashboardPanels,
|
|
2218
2128
|
formSubmissionsCollectionSlug,
|
|
2219
2129
|
formsCollectionSlug,
|
|
2220
2130
|
formsEnabled,
|
|
@@ -2224,7 +2134,6 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2224
2134
|
pagesCollectionSlug,
|
|
2225
2135
|
sections
|
|
2226
2136
|
};
|
|
2227
|
-
const extensionPanels = buildExtensionPanels(adminBasePath, importMap, dashboardPanels, userRole);
|
|
2228
2137
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StudioSectionLayout, { navProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2229
2138
|
AdminPage,
|
|
2230
2139
|
{
|
|
@@ -2234,7 +2143,6 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2234
2143
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2235
2144
|
AdminStudioDashboardClient,
|
|
2236
2145
|
{
|
|
2237
|
-
extensionPanels,
|
|
2238
2146
|
formSubmissionsCollectionSlug,
|
|
2239
2147
|
formsCollectionSlug,
|
|
2240
2148
|
formsEnabled,
|
package/dist/admin/index.mjs
CHANGED
|
@@ -787,9 +787,6 @@ function configureAdmin(config) {
|
|
|
787
787
|
};
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
-
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
791
|
-
import { RenderServerComponent } from "@payloadcms/ui/elements/RenderServerComponent";
|
|
792
|
-
|
|
793
790
|
// src/admin/components/studio/AdminStudioDashboardClient.tsx
|
|
794
791
|
import { startTransition, useEffect, useMemo, useState } from "react";
|
|
795
792
|
import Link from "next/link";
|
|
@@ -998,7 +995,6 @@ function SnapshotMetric({ card }) {
|
|
|
998
995
|
] });
|
|
999
996
|
}
|
|
1000
997
|
function AdminStudioDashboardClient({
|
|
1001
|
-
extensionPanels = [],
|
|
1002
998
|
formSubmissionsCollectionSlug,
|
|
1003
999
|
formsCollectionSlug,
|
|
1004
1000
|
formsEnabled,
|
|
@@ -1010,7 +1006,8 @@ function AdminStudioDashboardClient({
|
|
|
1010
1006
|
pagesPath,
|
|
1011
1007
|
sectionLinks,
|
|
1012
1008
|
toolsPath,
|
|
1013
|
-
userRole
|
|
1009
|
+
userRole,
|
|
1010
|
+
children
|
|
1014
1011
|
}) {
|
|
1015
1012
|
const role = isRole(userRole) ? userRole : void 0;
|
|
1016
1013
|
const [state, setState] = useState(
|
|
@@ -1391,17 +1388,7 @@ function AdminStudioDashboardClient({
|
|
|
1391
1388
|
] }),
|
|
1392
1389
|
/* @__PURE__ */ jsxs("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
1393
1390
|
snapshotCards.map((card) => /* @__PURE__ */ jsx(SnapshotMetric, { card }, card.kicker)),
|
|
1394
|
-
|
|
1395
|
-
"div",
|
|
1396
|
-
{
|
|
1397
|
-
className: [
|
|
1398
|
-
"orion-dashboard-extension-panel",
|
|
1399
|
-
panel.span === "full" ? "is-full" : "is-half"
|
|
1400
|
-
].filter(Boolean).join(" "),
|
|
1401
|
-
children: panel.node
|
|
1402
|
-
},
|
|
1403
|
-
panel.id
|
|
1404
|
-
))
|
|
1391
|
+
children
|
|
1405
1392
|
] }),
|
|
1406
1393
|
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ jsx("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
1407
1394
|
] })
|
|
@@ -1602,7 +1589,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
1602
1589
|
let cancelled = false;
|
|
1603
1590
|
const run = async () => {
|
|
1604
1591
|
try {
|
|
1605
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
1592
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
1606
1593
|
credentials: "include"
|
|
1607
1594
|
});
|
|
1608
1595
|
if (!res.ok) return;
|
|
@@ -1885,7 +1872,7 @@ function StudioSectionLayout({ children, navProps }) {
|
|
|
1885
1872
|
}
|
|
1886
1873
|
|
|
1887
1874
|
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
1888
|
-
import { jsx as jsx4
|
|
1875
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1889
1876
|
var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
|
|
1890
1877
|
var normalizePath2 = (value) => {
|
|
1891
1878
|
if (!value || value === "/") return "/";
|
|
@@ -1949,44 +1936,6 @@ var getPropSections2 = (props) => {
|
|
|
1949
1936
|
}
|
|
1950
1937
|
return [];
|
|
1951
1938
|
};
|
|
1952
|
-
var getPropDashboardPanels = (props) => {
|
|
1953
|
-
if (!props || typeof props !== "object") return [];
|
|
1954
|
-
const direct = resolveStudioSectionDashboards(props.dashboardPanels);
|
|
1955
|
-
if (direct.length > 0) return direct;
|
|
1956
|
-
const clientProps = props.clientProps;
|
|
1957
|
-
if (clientProps && typeof clientProps === "object") {
|
|
1958
|
-
return resolveStudioSectionDashboards(clientProps.dashboardPanels);
|
|
1959
|
-
}
|
|
1960
|
-
return [];
|
|
1961
|
-
};
|
|
1962
|
-
var readImportMap = (props) => {
|
|
1963
|
-
if (!props || typeof props !== "object") return void 0;
|
|
1964
|
-
const direct = props.importMap;
|
|
1965
|
-
if (direct && typeof direct === "object") {
|
|
1966
|
-
return direct;
|
|
1967
|
-
}
|
|
1968
|
-
const payloadLike = props.payload;
|
|
1969
|
-
if (payloadLike && typeof payloadLike === "object") {
|
|
1970
|
-
const nested = payloadLike.importMap;
|
|
1971
|
-
if (nested && typeof nested === "object") {
|
|
1972
|
-
return nested;
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
const initPageResult = props.initPageResult;
|
|
1976
|
-
if (initPageResult && typeof initPageResult === "object") {
|
|
1977
|
-
const req = initPageResult.req;
|
|
1978
|
-
if (req && typeof req === "object") {
|
|
1979
|
-
const payload = req.payload;
|
|
1980
|
-
if (payload && typeof payload === "object") {
|
|
1981
|
-
const nested = payload.importMap;
|
|
1982
|
-
if (nested && typeof nested === "object") {
|
|
1983
|
-
return nested;
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
return void 0;
|
|
1989
|
-
};
|
|
1990
1939
|
var readUserRole2 = (props) => {
|
|
1991
1940
|
if (!props || typeof props !== "object") return void 0;
|
|
1992
1941
|
const user = props.user;
|
|
@@ -2041,15 +1990,6 @@ var readAdminBasePath = (props) => {
|
|
|
2041
1990
|
}
|
|
2042
1991
|
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2043
1992
|
};
|
|
2044
|
-
var canAccess2 = (role, roles) => {
|
|
2045
|
-
if (!roles || roles.length === 0) {
|
|
2046
|
-
return true;
|
|
2047
|
-
}
|
|
2048
|
-
if (!role) {
|
|
2049
|
-
return false;
|
|
2050
|
-
}
|
|
2051
|
-
return roles.includes(role);
|
|
2052
|
-
};
|
|
2053
1993
|
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2054
1994
|
const links = [
|
|
2055
1995
|
{
|
|
@@ -2097,39 +2037,11 @@ var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath)
|
|
|
2097
2037
|
return true;
|
|
2098
2038
|
});
|
|
2099
2039
|
};
|
|
2100
|
-
function DashboardPanelFallback({ label }) {
|
|
2101
|
-
return /* @__PURE__ */ jsxs3("div", { className: "orion-dashboard-extension-fallback", children: [
|
|
2102
|
-
/* @__PURE__ */ jsx4("span", { className: "orion-dashboard-panel-kicker", children: "Extension Unavailable" }),
|
|
2103
|
-
/* @__PURE__ */ jsx4("strong", { children: label }),
|
|
2104
|
-
/* @__PURE__ */ jsx4("p", { children: "This dashboard panel could not be rendered, but the rest of the dashboard is still available." })
|
|
2105
|
-
] });
|
|
2106
|
-
}
|
|
2107
|
-
function buildExtensionPanels(adminBasePath, importMap, panels, userRole) {
|
|
2108
|
-
const visiblePanels = panels.filter((panel) => canAccess2(userRole, panel.roles));
|
|
2109
|
-
return visiblePanels.map((panel) => {
|
|
2110
|
-
const href = resolveAdminPath2(adminBasePath, panel.href);
|
|
2111
|
-
return {
|
|
2112
|
-
id: panel.id,
|
|
2113
|
-
node: importMap ? RenderServerComponent({
|
|
2114
|
-
Component: panel.Component,
|
|
2115
|
-
Fallback: () => /* @__PURE__ */ jsx4(DashboardPanelFallback, { label: panel.label }),
|
|
2116
|
-
importMap,
|
|
2117
|
-
serverProps: {
|
|
2118
|
-
adminBasePath,
|
|
2119
|
-
href,
|
|
2120
|
-
label: panel.label
|
|
2121
|
-
}
|
|
2122
|
-
}) : /* @__PURE__ */ jsx4(DashboardPanelFallback, { label: panel.label }),
|
|
2123
|
-
span: panel.span
|
|
2124
|
-
};
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
2040
|
function AdminStudioDashboard(rawProps) {
|
|
2128
2041
|
const props = rawProps || {};
|
|
2129
2042
|
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2130
2043
|
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2131
2044
|
const sections = getPropSections2(props);
|
|
2132
|
-
const dashboardPanels = getPropDashboardPanels(props);
|
|
2133
2045
|
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2134
2046
|
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2135
2047
|
const formSubmissionsCollectionSlug = getPropString2(
|
|
@@ -2139,11 +2051,9 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2139
2051
|
);
|
|
2140
2052
|
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2141
2053
|
const adminBasePath = readAdminBasePath(props);
|
|
2142
|
-
const importMap = readImportMap(props);
|
|
2143
2054
|
const userRole = readUserRole2(props);
|
|
2144
2055
|
const navProps = {
|
|
2145
2056
|
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2146
|
-
dashboardPanels,
|
|
2147
2057
|
formSubmissionsCollectionSlug,
|
|
2148
2058
|
formsCollectionSlug,
|
|
2149
2059
|
formsEnabled,
|
|
@@ -2153,7 +2063,6 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2153
2063
|
pagesCollectionSlug,
|
|
2154
2064
|
sections
|
|
2155
2065
|
};
|
|
2156
|
-
const extensionPanels = buildExtensionPanels(adminBasePath, importMap, dashboardPanels, userRole);
|
|
2157
2066
|
return /* @__PURE__ */ jsx4(StudioSectionLayout, { navProps, children: /* @__PURE__ */ jsx4(
|
|
2158
2067
|
AdminPage,
|
|
2159
2068
|
{
|
|
@@ -2163,7 +2072,6 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2163
2072
|
children: /* @__PURE__ */ jsx4(
|
|
2164
2073
|
AdminStudioDashboardClient,
|
|
2165
2074
|
{
|
|
2166
|
-
extensionPanels,
|
|
2167
2075
|
formSubmissionsCollectionSlug,
|
|
2168
2076
|
formsCollectionSlug,
|
|
2169
2077
|
formsEnabled,
|
package/dist/index.js
CHANGED
|
@@ -839,9 +839,6 @@ function configureAdmin(config) {
|
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
843
|
-
var import_RenderServerComponent = require("@payloadcms/ui/elements/RenderServerComponent");
|
|
844
|
-
|
|
845
842
|
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
846
843
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
847
844
|
function AdminBreadcrumbs({ items }) {
|
|
@@ -1080,7 +1077,6 @@ function SnapshotMetric({ card }) {
|
|
|
1080
1077
|
] });
|
|
1081
1078
|
}
|
|
1082
1079
|
function AdminStudioDashboardClient({
|
|
1083
|
-
extensionPanels = [],
|
|
1084
1080
|
formSubmissionsCollectionSlug,
|
|
1085
1081
|
formsCollectionSlug,
|
|
1086
1082
|
formsEnabled,
|
|
@@ -1092,7 +1088,8 @@ function AdminStudioDashboardClient({
|
|
|
1092
1088
|
pagesPath,
|
|
1093
1089
|
sectionLinks,
|
|
1094
1090
|
toolsPath,
|
|
1095
|
-
userRole
|
|
1091
|
+
userRole,
|
|
1092
|
+
children
|
|
1096
1093
|
}) {
|
|
1097
1094
|
const role = isRole(userRole) ? userRole : void 0;
|
|
1098
1095
|
const [state, setState] = (0, import_react.useState)(
|
|
@@ -1473,17 +1470,7 @@ function AdminStudioDashboardClient({
|
|
|
1473
1470
|
] }),
|
|
1474
1471
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-dashboard-snapshot-grid", children: [
|
|
1475
1472
|
snapshotCards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SnapshotMetric, { card }, card.kicker)),
|
|
1476
|
-
|
|
1477
|
-
"div",
|
|
1478
|
-
{
|
|
1479
|
-
className: [
|
|
1480
|
-
"orion-dashboard-extension-panel",
|
|
1481
|
-
panel.span === "full" ? "is-full" : "is-half"
|
|
1482
|
-
].filter(Boolean).join(" "),
|
|
1483
|
-
children: panel.node
|
|
1484
|
-
},
|
|
1485
|
-
panel.id
|
|
1486
|
-
))
|
|
1473
|
+
children
|
|
1487
1474
|
] }),
|
|
1488
1475
|
state.pages.status === "error" || state.media.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-dashboard-inline-note", children: "Some dashboard modules could not be loaded. The rest of the workspace remains available." }) : null
|
|
1489
1476
|
] })
|
|
@@ -1684,7 +1671,7 @@ function useSiteBranding(defaultName, defaultLogoUrl) {
|
|
|
1684
1671
|
let cancelled = false;
|
|
1685
1672
|
const run = async () => {
|
|
1686
1673
|
try {
|
|
1687
|
-
const res = await fetch("/api/globals/site-settings?depth=1
|
|
1674
|
+
const res = await fetch("/api/globals/site-settings?depth=1", {
|
|
1688
1675
|
credentials: "include"
|
|
1689
1676
|
});
|
|
1690
1677
|
if (!res.ok) return;
|
|
@@ -2031,44 +2018,6 @@ var getPropSections2 = (props) => {
|
|
|
2031
2018
|
}
|
|
2032
2019
|
return [];
|
|
2033
2020
|
};
|
|
2034
|
-
var getPropDashboardPanels = (props) => {
|
|
2035
|
-
if (!props || typeof props !== "object") return [];
|
|
2036
|
-
const direct = resolveStudioSectionDashboards(props.dashboardPanels);
|
|
2037
|
-
if (direct.length > 0) return direct;
|
|
2038
|
-
const clientProps = props.clientProps;
|
|
2039
|
-
if (clientProps && typeof clientProps === "object") {
|
|
2040
|
-
return resolveStudioSectionDashboards(clientProps.dashboardPanels);
|
|
2041
|
-
}
|
|
2042
|
-
return [];
|
|
2043
|
-
};
|
|
2044
|
-
var readImportMap = (props) => {
|
|
2045
|
-
if (!props || typeof props !== "object") return void 0;
|
|
2046
|
-
const direct = props.importMap;
|
|
2047
|
-
if (direct && typeof direct === "object") {
|
|
2048
|
-
return direct;
|
|
2049
|
-
}
|
|
2050
|
-
const payloadLike = props.payload;
|
|
2051
|
-
if (payloadLike && typeof payloadLike === "object") {
|
|
2052
|
-
const nested = payloadLike.importMap;
|
|
2053
|
-
if (nested && typeof nested === "object") {
|
|
2054
|
-
return nested;
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
const initPageResult = props.initPageResult;
|
|
2058
|
-
if (initPageResult && typeof initPageResult === "object") {
|
|
2059
|
-
const req = initPageResult.req;
|
|
2060
|
-
if (req && typeof req === "object") {
|
|
2061
|
-
const payload = req.payload;
|
|
2062
|
-
if (payload && typeof payload === "object") {
|
|
2063
|
-
const nested = payload.importMap;
|
|
2064
|
-
if (nested && typeof nested === "object") {
|
|
2065
|
-
return nested;
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
return void 0;
|
|
2071
|
-
};
|
|
2072
2021
|
var readUserRole2 = (props) => {
|
|
2073
2022
|
if (!props || typeof props !== "object") return void 0;
|
|
2074
2023
|
const user = props.user;
|
|
@@ -2123,15 +2072,6 @@ var readAdminBasePath = (props) => {
|
|
|
2123
2072
|
}
|
|
2124
2073
|
return DEFAULT_ADMIN_BASE_PATH2;
|
|
2125
2074
|
};
|
|
2126
|
-
var canAccess2 = (role, roles) => {
|
|
2127
|
-
if (!roles || roles.length === 0) {
|
|
2128
|
-
return true;
|
|
2129
|
-
}
|
|
2130
|
-
if (!role) {
|
|
2131
|
-
return false;
|
|
2132
|
-
}
|
|
2133
|
-
return roles.includes(role);
|
|
2134
|
-
};
|
|
2135
2075
|
var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
|
|
2136
2076
|
const links = [
|
|
2137
2077
|
{
|
|
@@ -2179,39 +2119,11 @@ var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath)
|
|
|
2179
2119
|
return true;
|
|
2180
2120
|
});
|
|
2181
2121
|
};
|
|
2182
|
-
function DashboardPanelFallback({ label }) {
|
|
2183
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "orion-dashboard-extension-fallback", children: [
|
|
2184
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Extension Unavailable" }),
|
|
2185
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: label }),
|
|
2186
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "This dashboard panel could not be rendered, but the rest of the dashboard is still available." })
|
|
2187
|
-
] });
|
|
2188
|
-
}
|
|
2189
|
-
function buildExtensionPanels(adminBasePath, importMap, panels, userRole) {
|
|
2190
|
-
const visiblePanels = panels.filter((panel) => canAccess2(userRole, panel.roles));
|
|
2191
|
-
return visiblePanels.map((panel) => {
|
|
2192
|
-
const href = resolveAdminPath2(adminBasePath, panel.href);
|
|
2193
|
-
return {
|
|
2194
|
-
id: panel.id,
|
|
2195
|
-
node: importMap ? (0, import_RenderServerComponent.RenderServerComponent)({
|
|
2196
|
-
Component: panel.Component,
|
|
2197
|
-
Fallback: () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
|
|
2198
|
-
importMap,
|
|
2199
|
-
serverProps: {
|
|
2200
|
-
adminBasePath,
|
|
2201
|
-
href,
|
|
2202
|
-
label: panel.label
|
|
2203
|
-
}
|
|
2204
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
|
|
2205
|
-
span: panel.span
|
|
2206
|
-
};
|
|
2207
|
-
});
|
|
2208
|
-
}
|
|
2209
2122
|
function AdminStudioDashboard(rawProps) {
|
|
2210
2123
|
const props = rawProps || {};
|
|
2211
2124
|
const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
|
|
2212
2125
|
const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
|
|
2213
2126
|
const sections = getPropSections2(props);
|
|
2214
|
-
const dashboardPanels = getPropDashboardPanels(props);
|
|
2215
2127
|
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
2216
2128
|
const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
|
|
2217
2129
|
const formSubmissionsCollectionSlug = getPropString2(
|
|
@@ -2221,11 +2133,9 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2221
2133
|
);
|
|
2222
2134
|
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
2223
2135
|
const adminBasePath = readAdminBasePath(props);
|
|
2224
|
-
const importMap = readImportMap(props);
|
|
2225
2136
|
const userRole = readUserRole2(props);
|
|
2226
2137
|
const navProps = {
|
|
2227
2138
|
brandName: getPropString2(props, "brandName", "Orion Studio"),
|
|
2228
|
-
dashboardPanels,
|
|
2229
2139
|
formSubmissionsCollectionSlug,
|
|
2230
2140
|
formsCollectionSlug,
|
|
2231
2141
|
formsEnabled,
|
|
@@ -2235,7 +2145,6 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2235
2145
|
pagesCollectionSlug,
|
|
2236
2146
|
sections
|
|
2237
2147
|
};
|
|
2238
|
-
const extensionPanels = buildExtensionPanels(adminBasePath, importMap, dashboardPanels, userRole);
|
|
2239
2148
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StudioSectionLayout, { navProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2240
2149
|
AdminPage,
|
|
2241
2150
|
{
|
|
@@ -2245,7 +2154,6 @@ function AdminStudioDashboard(rawProps) {
|
|
|
2245
2154
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2246
2155
|
AdminStudioDashboardClient,
|
|
2247
2156
|
{
|
|
2248
|
-
extensionPanels,
|
|
2249
2157
|
formSubmissionsCollectionSlug,
|
|
2250
2158
|
formsCollectionSlug,
|
|
2251
2159
|
formsEnabled,
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED