@orion-studios/payload-studio 0.6.0-beta.5 → 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.
@@ -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 }) {
@@ -2010,44 +2007,6 @@ var getPropSections2 = (props) => {
2010
2007
  }
2011
2008
  return [];
2012
2009
  };
2013
- var getPropDashboardPanels = (props) => {
2014
- if (!props || typeof props !== "object") return [];
2015
- const direct = resolveStudioSectionDashboards(props.dashboardPanels);
2016
- if (direct.length > 0) return direct;
2017
- const clientProps = props.clientProps;
2018
- if (clientProps && typeof clientProps === "object") {
2019
- return resolveStudioSectionDashboards(clientProps.dashboardPanels);
2020
- }
2021
- return [];
2022
- };
2023
- var readImportMap = (props) => {
2024
- if (!props || typeof props !== "object") return void 0;
2025
- const direct = props.importMap;
2026
- if (direct && typeof direct === "object") {
2027
- return direct;
2028
- }
2029
- const payloadLike = props.payload;
2030
- if (payloadLike && typeof payloadLike === "object") {
2031
- const nested = payloadLike.importMap;
2032
- if (nested && typeof nested === "object") {
2033
- return nested;
2034
- }
2035
- }
2036
- const initPageResult = props.initPageResult;
2037
- if (initPageResult && typeof initPageResult === "object") {
2038
- const req = initPageResult.req;
2039
- if (req && typeof req === "object") {
2040
- const payload = req.payload;
2041
- if (payload && typeof payload === "object") {
2042
- const nested = payload.importMap;
2043
- if (nested && typeof nested === "object") {
2044
- return nested;
2045
- }
2046
- }
2047
- }
2048
- }
2049
- return void 0;
2050
- };
2051
2010
  var readUserRole2 = (props) => {
2052
2011
  if (!props || typeof props !== "object") return void 0;
2053
2012
  const user = props.user;
@@ -2102,15 +2061,6 @@ var readAdminBasePath = (props) => {
2102
2061
  }
2103
2062
  return DEFAULT_ADMIN_BASE_PATH2;
2104
2063
  };
2105
- var canAccess2 = (role, roles) => {
2106
- if (!roles || roles.length === 0) {
2107
- return true;
2108
- }
2109
- if (!role) {
2110
- return false;
2111
- }
2112
- return roles.includes(role);
2113
- };
2114
2064
  var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
2115
2065
  const links = [
2116
2066
  {
@@ -2158,39 +2108,11 @@ var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath)
2158
2108
  return true;
2159
2109
  });
2160
2110
  };
2161
- function DashboardPanelFallback({ label }) {
2162
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "orion-dashboard-extension-fallback", children: [
2163
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Extension Unavailable" }),
2164
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: label }),
2165
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "This dashboard panel could not be rendered, but the rest of the dashboard is still available." })
2166
- ] });
2167
- }
2168
- function buildExtensionPanels(adminBasePath, importMap, panels, userRole) {
2169
- const visiblePanels = panels.filter((panel) => canAccess2(userRole, panel.roles));
2170
- return visiblePanels.map((panel) => {
2171
- const href = resolveAdminPath2(adminBasePath, panel.href);
2172
- return {
2173
- id: panel.id,
2174
- node: importMap ? (0, import_RenderServerComponent.RenderServerComponent)({
2175
- Component: panel.Component,
2176
- Fallback: () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
2177
- importMap,
2178
- serverProps: {
2179
- adminBasePath,
2180
- href,
2181
- label: panel.label
2182
- }
2183
- }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
2184
- span: panel.span
2185
- };
2186
- });
2187
- }
2188
2111
  function AdminStudioDashboard(rawProps) {
2189
2112
  const props = rawProps || {};
2190
2113
  const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
2191
2114
  const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
2192
2115
  const sections = getPropSections2(props);
2193
- const dashboardPanels = getPropDashboardPanels(props);
2194
2116
  const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
2195
2117
  const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
2196
2118
  const formSubmissionsCollectionSlug = getPropString2(
@@ -2200,11 +2122,9 @@ function AdminStudioDashboard(rawProps) {
2200
2122
  );
2201
2123
  const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
2202
2124
  const adminBasePath = readAdminBasePath(props);
2203
- const importMap = readImportMap(props);
2204
2125
  const userRole = readUserRole2(props);
2205
2126
  const navProps = {
2206
2127
  brandName: getPropString2(props, "brandName", "Orion Studio"),
2207
- dashboardPanels,
2208
2128
  formSubmissionsCollectionSlug,
2209
2129
  formsCollectionSlug,
2210
2130
  formsEnabled,
@@ -2214,7 +2134,6 @@ function AdminStudioDashboard(rawProps) {
2214
2134
  pagesCollectionSlug,
2215
2135
  sections
2216
2136
  };
2217
- const extensionPanels = buildExtensionPanels(adminBasePath, importMap, dashboardPanels, userRole);
2218
2137
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StudioSectionLayout, { navProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2219
2138
  AdminPage,
2220
2139
  {
@@ -2235,18 +2154,7 @@ function AdminStudioDashboard(rawProps) {
2235
2154
  pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
2236
2155
  sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
2237
2156
  toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
2238
- userRole,
2239
- children: extensionPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2240
- "div",
2241
- {
2242
- className: [
2243
- "orion-dashboard-extension-panel",
2244
- panel.span === "full" ? "is-full" : "is-half"
2245
- ].filter(Boolean).join(" "),
2246
- children: panel.node
2247
- },
2248
- panel.id
2249
- ))
2157
+ userRole
2250
2158
  }
2251
2159
  )
2252
2160
  }
@@ -8,7 +8,7 @@ import {
8
8
  socialMediaConnectionsField,
9
9
  themePreferenceField,
10
10
  withTooltips
11
- } from "../chunk-PKVTM6DY.mjs";
11
+ } from "../chunk-NTXOLLDC.mjs";
12
12
  import "../chunk-Z6L5K5MH.mjs";
13
13
  import {
14
14
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
@@ -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";
@@ -1875,7 +1872,7 @@ function StudioSectionLayout({ children, navProps }) {
1875
1872
  }
1876
1873
 
1877
1874
  // src/admin/components/studio/AdminStudioDashboard.tsx
1878
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1875
+ import { jsx as jsx4 } from "react/jsx-runtime";
1879
1876
  var DEFAULT_ADMIN_BASE_PATH2 = "/admin";
1880
1877
  var normalizePath2 = (value) => {
1881
1878
  if (!value || value === "/") return "/";
@@ -1939,44 +1936,6 @@ var getPropSections2 = (props) => {
1939
1936
  }
1940
1937
  return [];
1941
1938
  };
1942
- var getPropDashboardPanels = (props) => {
1943
- if (!props || typeof props !== "object") return [];
1944
- const direct = resolveStudioSectionDashboards(props.dashboardPanels);
1945
- if (direct.length > 0) return direct;
1946
- const clientProps = props.clientProps;
1947
- if (clientProps && typeof clientProps === "object") {
1948
- return resolveStudioSectionDashboards(clientProps.dashboardPanels);
1949
- }
1950
- return [];
1951
- };
1952
- var readImportMap = (props) => {
1953
- if (!props || typeof props !== "object") return void 0;
1954
- const direct = props.importMap;
1955
- if (direct && typeof direct === "object") {
1956
- return direct;
1957
- }
1958
- const payloadLike = props.payload;
1959
- if (payloadLike && typeof payloadLike === "object") {
1960
- const nested = payloadLike.importMap;
1961
- if (nested && typeof nested === "object") {
1962
- return nested;
1963
- }
1964
- }
1965
- const initPageResult = props.initPageResult;
1966
- if (initPageResult && typeof initPageResult === "object") {
1967
- const req = initPageResult.req;
1968
- if (req && typeof req === "object") {
1969
- const payload = req.payload;
1970
- if (payload && typeof payload === "object") {
1971
- const nested = payload.importMap;
1972
- if (nested && typeof nested === "object") {
1973
- return nested;
1974
- }
1975
- }
1976
- }
1977
- }
1978
- return void 0;
1979
- };
1980
1939
  var readUserRole2 = (props) => {
1981
1940
  if (!props || typeof props !== "object") return void 0;
1982
1941
  const user = props.user;
@@ -2031,15 +1990,6 @@ var readAdminBasePath = (props) => {
2031
1990
  }
2032
1991
  return DEFAULT_ADMIN_BASE_PATH2;
2033
1992
  };
2034
- var canAccess2 = (role, roles) => {
2035
- if (!roles || roles.length === 0) {
2036
- return true;
2037
- }
2038
- if (!role) {
2039
- return false;
2040
- }
2041
- return roles.includes(role);
2042
- };
2043
1993
  var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
2044
1994
  const links = [
2045
1995
  {
@@ -2087,39 +2037,11 @@ var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath)
2087
2037
  return true;
2088
2038
  });
2089
2039
  };
2090
- function DashboardPanelFallback({ label }) {
2091
- return /* @__PURE__ */ jsxs3("div", { className: "orion-dashboard-extension-fallback", children: [
2092
- /* @__PURE__ */ jsx4("span", { className: "orion-dashboard-panel-kicker", children: "Extension Unavailable" }),
2093
- /* @__PURE__ */ jsx4("strong", { children: label }),
2094
- /* @__PURE__ */ jsx4("p", { children: "This dashboard panel could not be rendered, but the rest of the dashboard is still available." })
2095
- ] });
2096
- }
2097
- function buildExtensionPanels(adminBasePath, importMap, panels, userRole) {
2098
- const visiblePanels = panels.filter((panel) => canAccess2(userRole, panel.roles));
2099
- return visiblePanels.map((panel) => {
2100
- const href = resolveAdminPath2(adminBasePath, panel.href);
2101
- return {
2102
- id: panel.id,
2103
- node: importMap ? RenderServerComponent({
2104
- Component: panel.Component,
2105
- Fallback: () => /* @__PURE__ */ jsx4(DashboardPanelFallback, { label: panel.label }),
2106
- importMap,
2107
- serverProps: {
2108
- adminBasePath,
2109
- href,
2110
- label: panel.label
2111
- }
2112
- }) : /* @__PURE__ */ jsx4(DashboardPanelFallback, { label: panel.label }),
2113
- span: panel.span
2114
- };
2115
- });
2116
- }
2117
2040
  function AdminStudioDashboard(rawProps) {
2118
2041
  const props = rawProps || {};
2119
2042
  const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
2120
2043
  const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
2121
2044
  const sections = getPropSections2(props);
2122
- const dashboardPanels = getPropDashboardPanels(props);
2123
2045
  const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
2124
2046
  const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
2125
2047
  const formSubmissionsCollectionSlug = getPropString2(
@@ -2129,11 +2051,9 @@ function AdminStudioDashboard(rawProps) {
2129
2051
  );
2130
2052
  const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
2131
2053
  const adminBasePath = readAdminBasePath(props);
2132
- const importMap = readImportMap(props);
2133
2054
  const userRole = readUserRole2(props);
2134
2055
  const navProps = {
2135
2056
  brandName: getPropString2(props, "brandName", "Orion Studio"),
2136
- dashboardPanels,
2137
2057
  formSubmissionsCollectionSlug,
2138
2058
  formsCollectionSlug,
2139
2059
  formsEnabled,
@@ -2143,7 +2063,6 @@ function AdminStudioDashboard(rawProps) {
2143
2063
  pagesCollectionSlug,
2144
2064
  sections
2145
2065
  };
2146
- const extensionPanels = buildExtensionPanels(adminBasePath, importMap, dashboardPanels, userRole);
2147
2066
  return /* @__PURE__ */ jsx4(StudioSectionLayout, { navProps, children: /* @__PURE__ */ jsx4(
2148
2067
  AdminPage,
2149
2068
  {
@@ -2164,18 +2083,7 @@ function AdminStudioDashboard(rawProps) {
2164
2083
  pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
2165
2084
  sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
2166
2085
  toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
2167
- userRole,
2168
- children: extensionPanels.map((panel) => /* @__PURE__ */ jsx4(
2169
- "div",
2170
- {
2171
- className: [
2172
- "orion-dashboard-extension-panel",
2173
- panel.span === "full" ? "is-full" : "is-half"
2174
- ].filter(Boolean).join(" "),
2175
- children: panel.node
2176
- },
2177
- panel.id
2178
- ))
2086
+ userRole
2179
2087
  }
2180
2088
  )
2181
2089
  }
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 }) {
@@ -2021,44 +2018,6 @@ var getPropSections2 = (props) => {
2021
2018
  }
2022
2019
  return [];
2023
2020
  };
2024
- var getPropDashboardPanels = (props) => {
2025
- if (!props || typeof props !== "object") return [];
2026
- const direct = resolveStudioSectionDashboards(props.dashboardPanels);
2027
- if (direct.length > 0) return direct;
2028
- const clientProps = props.clientProps;
2029
- if (clientProps && typeof clientProps === "object") {
2030
- return resolveStudioSectionDashboards(clientProps.dashboardPanels);
2031
- }
2032
- return [];
2033
- };
2034
- var readImportMap = (props) => {
2035
- if (!props || typeof props !== "object") return void 0;
2036
- const direct = props.importMap;
2037
- if (direct && typeof direct === "object") {
2038
- return direct;
2039
- }
2040
- const payloadLike = props.payload;
2041
- if (payloadLike && typeof payloadLike === "object") {
2042
- const nested = payloadLike.importMap;
2043
- if (nested && typeof nested === "object") {
2044
- return nested;
2045
- }
2046
- }
2047
- const initPageResult = props.initPageResult;
2048
- if (initPageResult && typeof initPageResult === "object") {
2049
- const req = initPageResult.req;
2050
- if (req && typeof req === "object") {
2051
- const payload = req.payload;
2052
- if (payload && typeof payload === "object") {
2053
- const nested = payload.importMap;
2054
- if (nested && typeof nested === "object") {
2055
- return nested;
2056
- }
2057
- }
2058
- }
2059
- }
2060
- return void 0;
2061
- };
2062
2021
  var readUserRole2 = (props) => {
2063
2022
  if (!props || typeof props !== "object") return void 0;
2064
2023
  const user = props.user;
@@ -2113,15 +2072,6 @@ var readAdminBasePath = (props) => {
2113
2072
  }
2114
2073
  return DEFAULT_ADMIN_BASE_PATH2;
2115
2074
  };
2116
- var canAccess2 = (role, roles) => {
2117
- if (!roles || roles.length === 0) {
2118
- return true;
2119
- }
2120
- if (!role) {
2121
- return false;
2122
- }
2123
- return roles.includes(role);
2124
- };
2125
2075
  var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath) => {
2126
2076
  const links = [
2127
2077
  {
@@ -2169,39 +2119,11 @@ var buildSectionLinks = (adminBasePath, sections, formsEnabled, globalsBasePath)
2169
2119
  return true;
2170
2120
  });
2171
2121
  };
2172
- function DashboardPanelFallback({ label }) {
2173
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "orion-dashboard-extension-fallback", children: [
2174
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "orion-dashboard-panel-kicker", children: "Extension Unavailable" }),
2175
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: label }),
2176
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "This dashboard panel could not be rendered, but the rest of the dashboard is still available." })
2177
- ] });
2178
- }
2179
- function buildExtensionPanels(adminBasePath, importMap, panels, userRole) {
2180
- const visiblePanels = panels.filter((panel) => canAccess2(userRole, panel.roles));
2181
- return visiblePanels.map((panel) => {
2182
- const href = resolveAdminPath2(adminBasePath, panel.href);
2183
- return {
2184
- id: panel.id,
2185
- node: importMap ? (0, import_RenderServerComponent.RenderServerComponent)({
2186
- Component: panel.Component,
2187
- Fallback: () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
2188
- importMap,
2189
- serverProps: {
2190
- adminBasePath,
2191
- href,
2192
- label: panel.label
2193
- }
2194
- }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashboardPanelFallback, { label: panel.label }),
2195
- span: panel.span
2196
- };
2197
- });
2198
- }
2199
2122
  function AdminStudioDashboard(rawProps) {
2200
2123
  const props = rawProps || {};
2201
2124
  const formsEnabled = getPropBoolean2(props, "formsEnabled", false);
2202
2125
  const globalsBasePath = getPropString2(props, "globalsBasePath", "/globals");
2203
2126
  const sections = getPropSections2(props);
2204
- const dashboardPanels = getPropDashboardPanels(props);
2205
2127
  const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
2206
2128
  const formsCollectionSlug = getPropString2(props, "formsCollectionSlug", "forms");
2207
2129
  const formSubmissionsCollectionSlug = getPropString2(
@@ -2211,11 +2133,9 @@ function AdminStudioDashboard(rawProps) {
2211
2133
  );
2212
2134
  const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
2213
2135
  const adminBasePath = readAdminBasePath(props);
2214
- const importMap = readImportMap(props);
2215
2136
  const userRole = readUserRole2(props);
2216
2137
  const navProps = {
2217
2138
  brandName: getPropString2(props, "brandName", "Orion Studio"),
2218
- dashboardPanels,
2219
2139
  formSubmissionsCollectionSlug,
2220
2140
  formsCollectionSlug,
2221
2141
  formsEnabled,
@@ -2225,7 +2145,6 @@ function AdminStudioDashboard(rawProps) {
2225
2145
  pagesCollectionSlug,
2226
2146
  sections
2227
2147
  };
2228
- const extensionPanels = buildExtensionPanels(adminBasePath, importMap, dashboardPanels, userRole);
2229
2148
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StudioSectionLayout, { navProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2230
2149
  AdminPage,
2231
2150
  {
@@ -2246,18 +2165,7 @@ function AdminStudioDashboard(rawProps) {
2246
2165
  pagesPath: resolveAdminPath2(adminBasePath, "/pages"),
2247
2166
  sectionLinks: buildSectionLinks(adminBasePath, sections, formsEnabled, globalsBasePath),
2248
2167
  toolsPath: resolveAdminPath2(adminBasePath, "/tools"),
2249
- userRole,
2250
- children: extensionPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2251
- "div",
2252
- {
2253
- className: [
2254
- "orion-dashboard-extension-panel",
2255
- panel.span === "full" ? "is-full" : "is-half"
2256
- ].filter(Boolean).join(" "),
2257
- children: panel.node
2258
- },
2259
- panel.id
2260
- ))
2168
+ userRole
2261
2169
  }
2262
2170
  )
2263
2171
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  admin_exports
3
- } from "./chunk-PKVTM6DY.mjs";
3
+ } from "./chunk-NTXOLLDC.mjs";
4
4
  import {
5
5
  admin_app_exports
6
6
  } from "./chunk-EHUE4LCT.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.5",
3
+ "version": "0.6.0-beta.6",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",