@orion-studios/payload-studio 0.5.0-beta.8 → 0.5.0-beta.80
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 +20 -0
- package/dist/admin/client.d.mts +2 -0
- package/dist/admin/client.d.ts +2 -0
- package/dist/admin/client.js +779 -137
- package/dist/admin/client.mjs +769 -129
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +100 -8
- package/dist/admin/index.mjs +3 -1
- package/dist/admin-app/client.d.mts +7 -0
- package/dist/admin-app/client.d.ts +7 -0
- package/dist/admin-app/client.js +1262 -3
- package/dist/admin-app/client.mjs +1164 -2
- package/dist/admin-app/index.d.mts +1 -1
- package/dist/admin-app/index.d.ts +1 -1
- package/dist/admin-app/index.js +167 -0
- package/dist/admin-app/index.mjs +13 -1
- package/dist/admin-app/styles.css +229 -0
- package/dist/blocks/index.js +633 -8
- package/dist/blocks/index.mjs +2 -2
- package/dist/chunk-ADIIWIYL.mjs +322 -0
- package/dist/{chunk-ZLLNO5FM.mjs → chunk-AFLEATYB.mjs} +44 -13
- package/dist/chunk-FWVVRZ32.mjs +1143 -0
- package/dist/{chunk-J7W5EE3B.mjs → chunk-HCEPGEAI.mjs} +100 -8
- package/dist/chunk-ROTPP5CU.mjs +99 -0
- package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
- package/dist/{chunk-PC5622T7.mjs → chunk-XK3K5GRP.mjs} +620 -9
- package/dist/chunk-XVH5SCBD.mjs +234 -0
- package/dist/index-BBp-3l6M.d.ts +134 -0
- package/dist/{index-CmR6NInu.d.ts → index-BIwu3qIH.d.mts} +29 -3
- package/dist/{index-CmR6NInu.d.mts → index-BIwu3qIH.d.ts} +29 -3
- package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.mts} +1 -0
- package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.ts} +1 -0
- package/dist/index-DT_Vorvh.d.mts +134 -0
- package/dist/index-ZbOx4OCF.d.mts +128 -0
- package/dist/index-ZbOx4OCF.d.ts +128 -0
- package/dist/{index-DJFhANvJ.d.mts → index-cDYkEj29.d.mts} +20 -2
- package/dist/{index-DJFhANvJ.d.ts → index-cDYkEj29.d.ts} +20 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2232 -324
- package/dist/index.mjs +7 -7
- package/dist/nextjs/index.d.mts +1 -1
- package/dist/nextjs/index.d.ts +1 -1
- package/dist/nextjs/index.js +1002 -13
- package/dist/nextjs/index.mjs +4 -1
- package/dist/studio/index.d.mts +2 -1
- package/dist/studio/index.d.ts +2 -1
- package/dist/studio/index.js +171 -5
- package/dist/studio/index.mjs +7 -3
- package/dist/studio-pages/builder.css +472 -8
- package/dist/studio-pages/client.d.mts +17 -0
- package/dist/studio-pages/client.d.ts +17 -0
- package/dist/studio-pages/client.js +5057 -2546
- package/dist/studio-pages/client.mjs +4972 -2552
- package/dist/studio-pages/index.d.mts +3 -2
- package/dist/studio-pages/index.d.ts +3 -2
- package/dist/studio-pages/index.js +873 -32
- package/dist/studio-pages/index.mjs +6 -2
- package/package.json +26 -12
- package/dist/chunk-AAOHJDNS.mjs +0 -67
- package/dist/chunk-N67KVM2S.mjs +0 -156
- package/dist/chunk-TVDMZNKU.mjs +0 -301
- package/dist/index-B9N5MyjF.d.mts +0 -39
- package/dist/index-BallJs-K.d.mts +0 -43
- package/dist/index-BallJs-K.d.ts +0 -43
- package/dist/index-g8tBHLKD.d.ts +0 -39
package/dist/admin/client.mjs
CHANGED
|
@@ -1096,6 +1096,83 @@ function WelcomeHeader({
|
|
|
1096
1096
|
|
|
1097
1097
|
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
1098
1098
|
import { SetStepNav } from "@payloadcms/ui";
|
|
1099
|
+
|
|
1100
|
+
// src/admin/components/studio/adminPathUtils.ts
|
|
1101
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
1102
|
+
var DEFAULT_ADMIN_BASE_PATH = "/admin";
|
|
1103
|
+
var normalizePath = (value) => {
|
|
1104
|
+
if (!value || value === "/") return "/";
|
|
1105
|
+
const withLeadingSlash = value.startsWith("/") ? value : `/${value}`;
|
|
1106
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
1107
|
+
return trimmed.length > 0 ? trimmed : "/";
|
|
1108
|
+
};
|
|
1109
|
+
var normalizeAdminBasePath = (value) => {
|
|
1110
|
+
const normalized = normalizePath(value);
|
|
1111
|
+
return normalized === "/" ? DEFAULT_ADMIN_BASE_PATH : normalized;
|
|
1112
|
+
};
|
|
1113
|
+
var detectAdminBasePath = (pathname, fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1114
|
+
const normalizedPathname = normalizePath(pathname);
|
|
1115
|
+
const normalizedFallback = normalizeAdminBasePath(fallback);
|
|
1116
|
+
const markers = [
|
|
1117
|
+
"/studio-contact-form",
|
|
1118
|
+
"/studio-globals",
|
|
1119
|
+
"/collections/",
|
|
1120
|
+
"/globals/",
|
|
1121
|
+
"/pages/",
|
|
1122
|
+
"/tools",
|
|
1123
|
+
"/media",
|
|
1124
|
+
"/logout",
|
|
1125
|
+
"/login"
|
|
1126
|
+
];
|
|
1127
|
+
for (const marker of markers) {
|
|
1128
|
+
const index = normalizedPathname.indexOf(marker);
|
|
1129
|
+
if (index > 0) {
|
|
1130
|
+
return normalizeAdminBasePath(normalizedPathname.slice(0, index));
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
if (normalizedPathname === normalizedFallback || normalizedPathname.startsWith(`${normalizedFallback}/`)) {
|
|
1134
|
+
return normalizedFallback;
|
|
1135
|
+
}
|
|
1136
|
+
const segments = normalizedPathname.split("/").filter(Boolean);
|
|
1137
|
+
if (segments.length > 0) {
|
|
1138
|
+
return normalizeAdminBasePath(`/${segments[0]}`);
|
|
1139
|
+
}
|
|
1140
|
+
return normalizedFallback;
|
|
1141
|
+
};
|
|
1142
|
+
var isAbsoluteExternalURL = (value) => /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("//");
|
|
1143
|
+
var resolveAdminPath = (adminBasePath, targetPath) => {
|
|
1144
|
+
if (!targetPath) return adminBasePath;
|
|
1145
|
+
if (isAbsoluteExternalURL(targetPath)) return targetPath;
|
|
1146
|
+
const normalizedBasePath = normalizeAdminBasePath(adminBasePath);
|
|
1147
|
+
const normalizedTargetPath = normalizePath(targetPath);
|
|
1148
|
+
if (normalizedTargetPath === "/admin") {
|
|
1149
|
+
return normalizedBasePath;
|
|
1150
|
+
}
|
|
1151
|
+
if (normalizedTargetPath.startsWith("/admin/")) {
|
|
1152
|
+
return `${normalizedBasePath}${normalizedTargetPath.slice("/admin".length)}`;
|
|
1153
|
+
}
|
|
1154
|
+
if (normalizedTargetPath === normalizedBasePath || normalizedTargetPath.startsWith(`${normalizedBasePath}/`)) {
|
|
1155
|
+
return normalizedTargetPath;
|
|
1156
|
+
}
|
|
1157
|
+
if (normalizedTargetPath === "/") {
|
|
1158
|
+
return normalizedBasePath;
|
|
1159
|
+
}
|
|
1160
|
+
return `${normalizedBasePath}${normalizedTargetPath}`;
|
|
1161
|
+
};
|
|
1162
|
+
var useAdminBasePath = (fallback = DEFAULT_ADMIN_BASE_PATH) => {
|
|
1163
|
+
const [adminBasePath, setAdminBasePath] = useState5(normalizeAdminBasePath(fallback));
|
|
1164
|
+
useEffect6(() => {
|
|
1165
|
+
const update = () => {
|
|
1166
|
+
setAdminBasePath(detectAdminBasePath(window.location.pathname, fallback));
|
|
1167
|
+
};
|
|
1168
|
+
update();
|
|
1169
|
+
window.addEventListener("popstate", update);
|
|
1170
|
+
return () => window.removeEventListener("popstate", update);
|
|
1171
|
+
}, [fallback]);
|
|
1172
|
+
return adminBasePath;
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
// src/admin/components/studio/AdminStudioDashboard.tsx
|
|
1099
1176
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1100
1177
|
var cardStyle = {
|
|
1101
1178
|
background: "var(--theme-elevation-0)",
|
|
@@ -1119,9 +1196,13 @@ var getPropString = (props, key, fallback) => {
|
|
|
1119
1196
|
function AdminStudioDashboard(props) {
|
|
1120
1197
|
const pagesCollectionSlug = getPropString(props, "pagesCollectionSlug", "pages");
|
|
1121
1198
|
const mediaCollectionSlug = getPropString(props, "mediaCollectionSlug", "media");
|
|
1122
|
-
const globalsBasePath = getPropString(props, "globalsBasePath", "/
|
|
1199
|
+
const globalsBasePath = getPropString(props, "globalsBasePath", "/studio-globals");
|
|
1200
|
+
const adminBasePath = useAdminBasePath();
|
|
1201
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1202
|
+
const pagesPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
1203
|
+
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
1123
1204
|
return /* @__PURE__ */ jsxs9("div", { style: { padding: "1.2rem 1.2rem 2.5rem" }, children: [
|
|
1124
|
-
/* @__PURE__ */ jsx10(SetStepNav, { nav: [{ label: "Dashboard", url:
|
|
1205
|
+
/* @__PURE__ */ jsx10(SetStepNav, { nav: [{ label: "Dashboard", url: adminBasePath }] }),
|
|
1125
1206
|
/* @__PURE__ */ jsx10("h1", { style: { fontSize: "1.6rem", margin: 0 }, children: "Studio" }),
|
|
1126
1207
|
/* @__PURE__ */ jsx10("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Pick what you want to edit." }),
|
|
1127
1208
|
/* @__PURE__ */ jsxs9(
|
|
@@ -1134,15 +1215,15 @@ function AdminStudioDashboard(props) {
|
|
|
1134
1215
|
marginTop: "1.1rem"
|
|
1135
1216
|
},
|
|
1136
1217
|
children: [
|
|
1137
|
-
/* @__PURE__ */ jsxs9("a", { href:
|
|
1218
|
+
/* @__PURE__ */ jsxs9("a", { href: pagesPath, style: cardStyle, children: [
|
|
1138
1219
|
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Pages" }),
|
|
1139
1220
|
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Edit your site pages with the custom editor." })
|
|
1140
1221
|
] }),
|
|
1141
|
-
/* @__PURE__ */ jsxs9("a", { href:
|
|
1222
|
+
/* @__PURE__ */ jsxs9("a", { href: resolvedGlobalsBasePath, style: cardStyle, children: [
|
|
1142
1223
|
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Globals" }),
|
|
1143
1224
|
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Site settings, header, footer." })
|
|
1144
1225
|
] }),
|
|
1145
|
-
/* @__PURE__ */ jsxs9("a", { href:
|
|
1226
|
+
/* @__PURE__ */ jsxs9("a", { href: mediaPath, style: cardStyle, children: [
|
|
1146
1227
|
/* @__PURE__ */ jsx10("div", { style: { fontWeight: 900 }, children: "Media" }),
|
|
1147
1228
|
/* @__PURE__ */ jsx10("div", { style: { color: "var(--theme-elevation-600)", marginTop: "0.25rem" }, children: "Upload and manage images and files." })
|
|
1148
1229
|
] })
|
|
@@ -1153,7 +1234,7 @@ function AdminStudioDashboard(props) {
|
|
|
1153
1234
|
}
|
|
1154
1235
|
|
|
1155
1236
|
// src/admin/components/studio/AdminStudioNav.tsx
|
|
1156
|
-
import { useEffect as
|
|
1237
|
+
import { useEffect as useEffect7, useMemo, useState as useState6 } from "react";
|
|
1157
1238
|
import { Logout, useAuth } from "@payloadcms/ui";
|
|
1158
1239
|
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1159
1240
|
var isAdmin = (user) => {
|
|
@@ -1183,47 +1264,83 @@ var getPropBoolean = (props, key, fallback) => {
|
|
|
1183
1264
|
}
|
|
1184
1265
|
return fallback;
|
|
1185
1266
|
};
|
|
1267
|
+
var getPropStringArray = (props, key, fallback) => {
|
|
1268
|
+
if (!props || typeof props !== "object") return fallback;
|
|
1269
|
+
const read = (candidate) => Array.isArray(candidate) ? candidate.filter((value) => typeof value === "string" && value.length > 0) : null;
|
|
1270
|
+
const direct = read(props[key]);
|
|
1271
|
+
if (direct) return direct;
|
|
1272
|
+
const clientProps = props.clientProps;
|
|
1273
|
+
if (clientProps && typeof clientProps === "object") {
|
|
1274
|
+
const nested = read(clientProps[key]);
|
|
1275
|
+
if (nested) return nested;
|
|
1276
|
+
}
|
|
1277
|
+
return fallback;
|
|
1278
|
+
};
|
|
1186
1279
|
function AdminStudioNav(props) {
|
|
1187
1280
|
const { user } = useAuth();
|
|
1188
1281
|
const brandName = getPropString2(props, "brandName", "Orion Studio");
|
|
1189
1282
|
const logoUrl = getPropString2(props, "logoUrl", "");
|
|
1190
1283
|
const pagesCollectionSlug = getPropString2(props, "pagesCollectionSlug", "pages");
|
|
1191
1284
|
const mediaCollectionSlug = getPropString2(props, "mediaCollectionSlug", "media");
|
|
1192
|
-
const globalsBasePath = getPropString2(props, "globalsBasePath", "/
|
|
1285
|
+
const globalsBasePath = getPropString2(props, "globalsBasePath", "/studio-globals");
|
|
1286
|
+
const globalsExtraMatchPrefixes = getPropStringArray(props, "globalsExtraMatchPrefixes", []);
|
|
1193
1287
|
const compact = getPropBoolean(props, "compact", false);
|
|
1288
|
+
const adminBasePath = useAdminBasePath();
|
|
1194
1289
|
const branding = useSiteBranding(brandName, logoUrl || void 0);
|
|
1195
1290
|
const resolvedName = branding.siteName || brandName;
|
|
1196
|
-
const [pathname, setPathname] =
|
|
1197
|
-
|
|
1291
|
+
const [pathname, setPathname] = useState6("");
|
|
1292
|
+
useEffect7(() => {
|
|
1198
1293
|
const update = () => setPathname(window.location.pathname);
|
|
1199
1294
|
update();
|
|
1200
1295
|
window.addEventListener("popstate", update);
|
|
1201
1296
|
return () => window.removeEventListener("popstate", update);
|
|
1202
1297
|
}, []);
|
|
1203
|
-
const pagesPath = `/
|
|
1204
|
-
const mediaPath = `/
|
|
1298
|
+
const pagesPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
1299
|
+
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
1300
|
+
const usersPath = resolveAdminPath(adminBasePath, "/collections/users");
|
|
1301
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1302
|
+
const resolvedGlobalsExtraMatchPrefixes = globalsExtraMatchPrefixes.map(
|
|
1303
|
+
(prefix) => resolveAdminPath(adminBasePath, prefix)
|
|
1304
|
+
);
|
|
1305
|
+
const dashboardPath = adminBasePath;
|
|
1205
1306
|
const links = useMemo(
|
|
1206
1307
|
() => [
|
|
1207
|
-
{ href:
|
|
1308
|
+
{ href: dashboardPath, label: "Dashboard", matchPrefixes: [dashboardPath] },
|
|
1208
1309
|
{
|
|
1209
1310
|
href: pagesPath,
|
|
1210
1311
|
label: "Pages",
|
|
1211
1312
|
matchPrefixes: [pagesPath]
|
|
1212
1313
|
},
|
|
1213
|
-
{
|
|
1314
|
+
{
|
|
1315
|
+
href: resolvedGlobalsBasePath,
|
|
1316
|
+
label: "Globals",
|
|
1317
|
+
matchPrefixes: [
|
|
1318
|
+
resolvedGlobalsBasePath,
|
|
1319
|
+
resolveAdminPath(adminBasePath, "/globals"),
|
|
1320
|
+
...resolvedGlobalsExtraMatchPrefixes
|
|
1321
|
+
]
|
|
1322
|
+
},
|
|
1214
1323
|
{
|
|
1215
1324
|
href: mediaPath,
|
|
1216
1325
|
label: "Media",
|
|
1217
1326
|
matchPrefixes: [mediaPath]
|
|
1218
1327
|
},
|
|
1219
1328
|
{
|
|
1220
|
-
href:
|
|
1329
|
+
href: usersPath,
|
|
1221
1330
|
label: "Admin Tools",
|
|
1222
|
-
matchPrefixes: [
|
|
1331
|
+
matchPrefixes: [usersPath],
|
|
1223
1332
|
adminOnly: true
|
|
1224
1333
|
}
|
|
1225
1334
|
],
|
|
1226
|
-
[
|
|
1335
|
+
[
|
|
1336
|
+
adminBasePath,
|
|
1337
|
+
dashboardPath,
|
|
1338
|
+
mediaPath,
|
|
1339
|
+
pagesPath,
|
|
1340
|
+
resolvedGlobalsBasePath,
|
|
1341
|
+
resolvedGlobalsExtraMatchPrefixes,
|
|
1342
|
+
usersPath
|
|
1343
|
+
]
|
|
1227
1344
|
);
|
|
1228
1345
|
const linkStyle = (active) => ({
|
|
1229
1346
|
alignItems: "center",
|
|
@@ -1281,7 +1398,7 @@ function AdminStudioNav(props) {
|
|
|
1281
1398
|
!compact ? /* @__PURE__ */ jsx11("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.85rem" }, children: "Studio" }) : null
|
|
1282
1399
|
] }),
|
|
1283
1400
|
/* @__PURE__ */ jsx11("nav", { style: { display: "grid", gap: "0.25rem" }, children: links.filter((link) => !link.adminOnly || isAdmin(user)).map((link) => {
|
|
1284
|
-
const active = link.href ===
|
|
1401
|
+
const active = link.href === dashboardPath ? pathname === dashboardPath : link.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
1285
1402
|
return /* @__PURE__ */ jsx11("a", { href: link.href, style: linkStyle(active), title: link.label, children: compact ? link.label.slice(0, 1) : link.label }, link.href);
|
|
1286
1403
|
}) }),
|
|
1287
1404
|
/* @__PURE__ */ jsx11("div", { style: { flex: 1 } }),
|
|
@@ -1308,7 +1425,7 @@ function AdminStudioNav(props) {
|
|
|
1308
1425
|
}
|
|
1309
1426
|
|
|
1310
1427
|
// src/admin/components/studio/AdminStudioPagesListView.tsx
|
|
1311
|
-
import { useEffect as
|
|
1428
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useState as useState7 } from "react";
|
|
1312
1429
|
import { SetStepNav as SetStepNav2, useAuth as useAuth2 } from "@payloadcms/ui";
|
|
1313
1430
|
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1314
1431
|
var isAdmin2 = (user) => {
|
|
@@ -1330,9 +1447,12 @@ var getPropString3 = (props, key, fallback) => {
|
|
|
1330
1447
|
function AdminStudioPagesListView(props) {
|
|
1331
1448
|
const { user } = useAuth2();
|
|
1332
1449
|
const pagesCollectionSlug = getPropString3(props, "pagesCollectionSlug", "pages");
|
|
1333
|
-
const
|
|
1334
|
-
const
|
|
1335
|
-
const
|
|
1450
|
+
const adminBasePath = useAdminBasePath();
|
|
1451
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1452
|
+
const rawPagesCollectionPath = resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`);
|
|
1453
|
+
const [loading, setLoading] = useState7(true);
|
|
1454
|
+
const [error, setError] = useState7(null);
|
|
1455
|
+
const [docs, setDocs] = useState7([]);
|
|
1336
1456
|
const apiURL = useMemo2(() => {
|
|
1337
1457
|
const params = new URLSearchParams({
|
|
1338
1458
|
depth: "0",
|
|
@@ -1342,7 +1462,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1342
1462
|
});
|
|
1343
1463
|
return `/api/${pagesCollectionSlug}?${params.toString()}`;
|
|
1344
1464
|
}, [pagesCollectionSlug]);
|
|
1345
|
-
|
|
1465
|
+
useEffect8(() => {
|
|
1346
1466
|
let cancelled = false;
|
|
1347
1467
|
const run = async () => {
|
|
1348
1468
|
setLoading(true);
|
|
@@ -1368,7 +1488,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1368
1488
|
};
|
|
1369
1489
|
}, [apiURL]);
|
|
1370
1490
|
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
1371
|
-
/* @__PURE__ */ jsx12(SetStepNav2, { nav: [{ label: "Pages", url:
|
|
1491
|
+
/* @__PURE__ */ jsx12(SetStepNav2, { nav: [{ label: "Pages", url: pagesPath }] }),
|
|
1372
1492
|
/* @__PURE__ */ jsxs11("div", { style: { alignItems: "flex-end", display: "flex", gap: "0.75rem" }, children: [
|
|
1373
1493
|
/* @__PURE__ */ jsxs11("div", { style: { flex: 1 }, children: [
|
|
1374
1494
|
/* @__PURE__ */ jsx12("h1", { style: { margin: 0 }, children: "Pages" }),
|
|
@@ -1377,7 +1497,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1377
1497
|
isAdmin2(user) ? /* @__PURE__ */ jsx12(
|
|
1378
1498
|
"a",
|
|
1379
1499
|
{
|
|
1380
|
-
href:
|
|
1500
|
+
href: `${rawPagesCollectionPath}/create`,
|
|
1381
1501
|
style: {
|
|
1382
1502
|
background: "var(--theme-elevation-900)",
|
|
1383
1503
|
borderRadius: 12,
|
|
@@ -1414,7 +1534,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1414
1534
|
return /* @__PURE__ */ jsxs11(
|
|
1415
1535
|
"a",
|
|
1416
1536
|
{
|
|
1417
|
-
href: `/
|
|
1537
|
+
href: resolveAdminPath(adminBasePath, `/pages/${id}`),
|
|
1418
1538
|
style: {
|
|
1419
1539
|
background: "var(--theme-elevation-0)",
|
|
1420
1540
|
border: "1px solid var(--theme-elevation-150)",
|
|
@@ -1481,7 +1601,7 @@ function AdminStudioPagesListView(props) {
|
|
|
1481
1601
|
}
|
|
1482
1602
|
|
|
1483
1603
|
// src/admin/components/studio/AdminStudioPageEditView.tsx
|
|
1484
|
-
import { useEffect as
|
|
1604
|
+
import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef3, useState as useState8 } from "react";
|
|
1485
1605
|
import { SetStepNav as SetStepNav3, toast, useAuth as useAuth3 } from "@payloadcms/ui";
|
|
1486
1606
|
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1487
1607
|
var isAdmin3 = (user) => {
|
|
@@ -1514,18 +1634,27 @@ var getParam = (params, key) => {
|
|
|
1514
1634
|
return null;
|
|
1515
1635
|
};
|
|
1516
1636
|
var getPageIDFromPathname = (pathname) => {
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1637
|
+
const marker = "/pages/";
|
|
1638
|
+
const markerIndex = pathname.indexOf(marker);
|
|
1639
|
+
if (markerIndex < 0) return null;
|
|
1640
|
+
const pagePart = pathname.slice(markerIndex + marker.length).split("/")[0];
|
|
1641
|
+
return pagePart ? decodeURIComponent(pagePart) : null;
|
|
1519
1642
|
};
|
|
1520
1643
|
function AdminStudioPageEditView(props) {
|
|
1521
1644
|
const { user } = useAuth3();
|
|
1645
|
+
const adminBasePath = useAdminBasePath();
|
|
1522
1646
|
const iframeRef = useRef3(null);
|
|
1523
|
-
const [saving, setSaving] =
|
|
1647
|
+
const [saving, setSaving] = useState8(null);
|
|
1648
|
+
const [dirty, setDirty] = useState8(false);
|
|
1649
|
+
const [hasUnpublishedChanges, setHasUnpublishedChanges] = useState8(false);
|
|
1650
|
+
const [canUndo, setCanUndo] = useState8(false);
|
|
1651
|
+
const [canRedo, setCanRedo] = useState8(false);
|
|
1524
1652
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
1653
|
+
const pagesPath = resolveAdminPath(adminBasePath, "/pages");
|
|
1525
1654
|
const pageIDFromParams = useMemo3(() => getParam(props.params, "id"), [props.params]);
|
|
1526
|
-
const [pageID, setPageID] =
|
|
1527
|
-
const [didResolvePathFallback, setDidResolvePathFallback] =
|
|
1528
|
-
|
|
1655
|
+
const [pageID, setPageID] = useState8(pageIDFromParams);
|
|
1656
|
+
const [didResolvePathFallback, setDidResolvePathFallback] = useState8(false);
|
|
1657
|
+
useEffect9(() => {
|
|
1529
1658
|
if (pageIDFromParams) {
|
|
1530
1659
|
setPageID(pageIDFromParams);
|
|
1531
1660
|
setDidResolvePathFallback(true);
|
|
@@ -1537,6 +1666,44 @@ function AdminStudioPageEditView(props) {
|
|
|
1537
1666
|
setDidResolvePathFallback(true);
|
|
1538
1667
|
}, [pageIDFromParams]);
|
|
1539
1668
|
const canPublish = isAdmin3(user) || isEditor(user);
|
|
1669
|
+
const refreshUnpublishedState = async (id) => {
|
|
1670
|
+
try {
|
|
1671
|
+
const response = await fetch(
|
|
1672
|
+
`/api/pages/versions?depth=0&limit=25&sort=-updatedAt&where[parent][equals]=${encodeURIComponent(id)}`,
|
|
1673
|
+
{
|
|
1674
|
+
credentials: "include"
|
|
1675
|
+
}
|
|
1676
|
+
);
|
|
1677
|
+
if (!response.ok) {
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
const payload = await response.json();
|
|
1681
|
+
const docs = Array.isArray(payload.docs) ? payload.docs : [];
|
|
1682
|
+
let latestDraft = 0;
|
|
1683
|
+
let latestPublished = 0;
|
|
1684
|
+
docs.forEach((doc) => {
|
|
1685
|
+
const status = doc.version?._status;
|
|
1686
|
+
const millis = typeof doc.updatedAt === "string" ? Date.parse(doc.updatedAt) : Number.NaN;
|
|
1687
|
+
if (!Number.isFinite(millis)) {
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
if (status === "draft") {
|
|
1691
|
+
latestDraft = Math.max(latestDraft, millis);
|
|
1692
|
+
}
|
|
1693
|
+
if (status === "published") {
|
|
1694
|
+
latestPublished = Math.max(latestPublished, millis);
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1697
|
+
setHasUnpublishedChanges(latestDraft > 0 && latestDraft >= latestPublished);
|
|
1698
|
+
} catch {
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
useEffect9(() => {
|
|
1702
|
+
if (!pageID) {
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
void refreshUnpublishedState(pageID);
|
|
1706
|
+
}, [pageID]);
|
|
1540
1707
|
const requestSave = (status) => {
|
|
1541
1708
|
const iframe = iframeRef.current;
|
|
1542
1709
|
if (!iframe?.contentWindow) {
|
|
@@ -1546,17 +1713,43 @@ function AdminStudioPageEditView(props) {
|
|
|
1546
1713
|
setSaving(status);
|
|
1547
1714
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "save", status }, "*");
|
|
1548
1715
|
};
|
|
1549
|
-
|
|
1716
|
+
const requestHistoryAction = (type) => {
|
|
1717
|
+
const iframe = iframeRef.current;
|
|
1718
|
+
if (!iframe?.contentWindow) {
|
|
1719
|
+
toast.error("Editor is not ready yet. Please try again.");
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
1723
|
+
};
|
|
1724
|
+
useEffect9(() => {
|
|
1550
1725
|
const onMessage = (event) => {
|
|
1551
1726
|
const data = event.data;
|
|
1552
|
-
if (!data || data.source !== "payload-visual-builder-child" || data.type !== "
|
|
1727
|
+
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
1553
1728
|
return;
|
|
1554
1729
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1730
|
+
if (data.type === "dirty-state") {
|
|
1731
|
+
setDirty(Boolean(data.dirty));
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
if (data.type === "history-state") {
|
|
1735
|
+
setCanUndo(Boolean(data.canUndo));
|
|
1736
|
+
setCanRedo(Boolean(data.canRedo));
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
if (data.type === "save-result") {
|
|
1740
|
+
setSaving(null);
|
|
1741
|
+
if (data.ok) {
|
|
1742
|
+
if (data.status === "draft") {
|
|
1743
|
+
setHasUnpublishedChanges(true);
|
|
1744
|
+
} else if (data.status === "published") {
|
|
1745
|
+
setHasUnpublishedChanges(false);
|
|
1746
|
+
} else if (pageID) {
|
|
1747
|
+
void refreshUnpublishedState(pageID);
|
|
1748
|
+
}
|
|
1749
|
+
toast.success(typeof data.message === "string" ? data.message : "Saved.");
|
|
1750
|
+
} else {
|
|
1751
|
+
toast.error(typeof data.message === "string" ? data.message : "Save failed.");
|
|
1752
|
+
}
|
|
1560
1753
|
}
|
|
1561
1754
|
};
|
|
1562
1755
|
window.addEventListener("message", onMessage);
|
|
@@ -1568,8 +1761,8 @@ function AdminStudioPageEditView(props) {
|
|
|
1568
1761
|
SetStepNav3,
|
|
1569
1762
|
{
|
|
1570
1763
|
nav: [
|
|
1571
|
-
{ label: "Pages", url:
|
|
1572
|
-
{ label: "Page Editor", url:
|
|
1764
|
+
{ label: "Pages", url: pagesPath },
|
|
1765
|
+
{ label: "Page Editor", url: pagesPath }
|
|
1573
1766
|
]
|
|
1574
1767
|
}
|
|
1575
1768
|
),
|
|
@@ -1583,8 +1776,8 @@ function AdminStudioPageEditView(props) {
|
|
|
1583
1776
|
SetStepNav3,
|
|
1584
1777
|
{
|
|
1585
1778
|
nav: [
|
|
1586
|
-
{ label: "Pages", url:
|
|
1587
|
-
{ label: "Page Editor", url:
|
|
1779
|
+
{ label: "Pages", url: pagesPath },
|
|
1780
|
+
{ label: "Page Editor", url: pagesPath }
|
|
1588
1781
|
]
|
|
1589
1782
|
}
|
|
1590
1783
|
),
|
|
@@ -1597,8 +1790,8 @@ function AdminStudioPageEditView(props) {
|
|
|
1597
1790
|
SetStepNav3,
|
|
1598
1791
|
{
|
|
1599
1792
|
nav: [
|
|
1600
|
-
{ label: "Pages", url:
|
|
1601
|
-
{ label: `Page ${pageID}`, url: `/
|
|
1793
|
+
{ label: "Pages", url: pagesPath },
|
|
1794
|
+
{ label: `Page ${pageID}`, url: resolveAdminPath(adminBasePath, `/pages/${pageID}`) }
|
|
1602
1795
|
]
|
|
1603
1796
|
}
|
|
1604
1797
|
),
|
|
@@ -1638,6 +1831,56 @@ function AdminStudioPageEditView(props) {
|
|
|
1638
1831
|
)
|
|
1639
1832
|
] }),
|
|
1640
1833
|
/* @__PURE__ */ jsxs12("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
1834
|
+
/* @__PURE__ */ jsx13("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
1835
|
+
/* @__PURE__ */ jsx13(
|
|
1836
|
+
"div",
|
|
1837
|
+
{
|
|
1838
|
+
style: {
|
|
1839
|
+
background: hasUnpublishedChanges ? "#fff3cd" : "#e7f7ee",
|
|
1840
|
+
border: `1px solid ${hasUnpublishedChanges ? "#f0c36d" : "#87c79e"}`,
|
|
1841
|
+
borderRadius: 999,
|
|
1842
|
+
color: hasUnpublishedChanges ? "#6a4a00" : "#0e5a2a",
|
|
1843
|
+
fontSize: "0.75rem",
|
|
1844
|
+
fontWeight: 800,
|
|
1845
|
+
padding: "0.2rem 0.55rem",
|
|
1846
|
+
whiteSpace: "nowrap"
|
|
1847
|
+
},
|
|
1848
|
+
title: hasUnpublishedChanges ? "There are saved draft changes not yet published." : "The live page matches the latest published content.",
|
|
1849
|
+
children: hasUnpublishedChanges ? "Unpublished draft changes" : "Live is up to date"
|
|
1850
|
+
}
|
|
1851
|
+
),
|
|
1852
|
+
/* @__PURE__ */ jsx13(
|
|
1853
|
+
"button",
|
|
1854
|
+
{
|
|
1855
|
+
disabled: !canUndo,
|
|
1856
|
+
onClick: () => requestHistoryAction("undo"),
|
|
1857
|
+
style: {
|
|
1858
|
+
border: "1px solid var(--theme-elevation-300)",
|
|
1859
|
+
borderRadius: 12,
|
|
1860
|
+
cursor: canUndo ? "pointer" : "not-allowed",
|
|
1861
|
+
fontWeight: 800,
|
|
1862
|
+
padding: "0.5rem 0.65rem"
|
|
1863
|
+
},
|
|
1864
|
+
type: "button",
|
|
1865
|
+
children: "Undo"
|
|
1866
|
+
}
|
|
1867
|
+
),
|
|
1868
|
+
/* @__PURE__ */ jsx13(
|
|
1869
|
+
"button",
|
|
1870
|
+
{
|
|
1871
|
+
disabled: !canRedo,
|
|
1872
|
+
onClick: () => requestHistoryAction("redo"),
|
|
1873
|
+
style: {
|
|
1874
|
+
border: "1px solid var(--theme-elevation-300)",
|
|
1875
|
+
borderRadius: 12,
|
|
1876
|
+
cursor: canRedo ? "pointer" : "not-allowed",
|
|
1877
|
+
fontWeight: 800,
|
|
1878
|
+
padding: "0.5rem 0.65rem"
|
|
1879
|
+
},
|
|
1880
|
+
type: "button",
|
|
1881
|
+
children: "Redo"
|
|
1882
|
+
}
|
|
1883
|
+
),
|
|
1641
1884
|
/* @__PURE__ */ jsx13(
|
|
1642
1885
|
"button",
|
|
1643
1886
|
{
|
|
@@ -1683,7 +1926,13 @@ function AdminStudioPageEditView(props) {
|
|
|
1683
1926
|
ref: iframeRef,
|
|
1684
1927
|
src: `${builderBasePath.replace(/\/$/, "")}/${pageID}`,
|
|
1685
1928
|
style: { border: "none", height: "100%", width: "100%" },
|
|
1686
|
-
title: "Page Builder"
|
|
1929
|
+
title: "Page Builder",
|
|
1930
|
+
onLoad: () => {
|
|
1931
|
+
const iframe = iframeRef.current;
|
|
1932
|
+
if (!iframe?.contentWindow) return;
|
|
1933
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "dirty-check-request" }, "*");
|
|
1934
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "history-check-request" }, "*");
|
|
1935
|
+
}
|
|
1687
1936
|
}
|
|
1688
1937
|
)
|
|
1689
1938
|
] })
|
|
@@ -1716,42 +1965,48 @@ var getPropString5 = (props, key, fallback) => {
|
|
|
1716
1965
|
return fallback;
|
|
1717
1966
|
};
|
|
1718
1967
|
function AdminStudioGlobalsView(props) {
|
|
1719
|
-
const globalsBasePath = getPropString5(props, "globalsBasePath", "/
|
|
1968
|
+
const globalsBasePath = getPropString5(props, "globalsBasePath", "/studio-globals");
|
|
1969
|
+
const adminBasePath = useAdminBasePath();
|
|
1970
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
1720
1971
|
const globals = getPropGlobals(props) || [
|
|
1721
1972
|
{ slug: "site-settings", label: "Website Settings" },
|
|
1722
1973
|
{ slug: "header", label: "Header & Navigation" },
|
|
1723
|
-
{ slug: "footer", label: "Footer" }
|
|
1974
|
+
{ slug: "footer", label: "Footer" },
|
|
1975
|
+
{ slug: "contact-form", label: "Contact Form", href: "/studio-contact-form" }
|
|
1724
1976
|
];
|
|
1725
1977
|
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
1726
|
-
/* @__PURE__ */ jsx14(SetStepNav4, { nav: [{ label: "Globals", url:
|
|
1978
|
+
/* @__PURE__ */ jsx14(SetStepNav4, { nav: [{ label: "Globals", url: resolvedGlobalsBasePath }] }),
|
|
1727
1979
|
/* @__PURE__ */ jsx14("h1", { style: { margin: 0 }, children: "Globals" }),
|
|
1728
1980
|
/* @__PURE__ */ jsx14("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Site-wide settings." }),
|
|
1729
|
-
/* @__PURE__ */ jsx14("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: globals.map((global) =>
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
href: `/
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1981
|
+
/* @__PURE__ */ jsx14("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: globals.map((global) => {
|
|
1982
|
+
const href = resolveAdminPath(
|
|
1983
|
+
adminBasePath,
|
|
1984
|
+
typeof global.href === "string" ? global.href : `/globals/${global.slug}`
|
|
1985
|
+
);
|
|
1986
|
+
return /* @__PURE__ */ jsxs13(
|
|
1987
|
+
"a",
|
|
1988
|
+
{
|
|
1989
|
+
href,
|
|
1990
|
+
style: {
|
|
1991
|
+
background: "var(--theme-elevation-0)",
|
|
1992
|
+
border: "1px solid var(--theme-elevation-150)",
|
|
1993
|
+
borderRadius: 16,
|
|
1994
|
+
color: "inherit",
|
|
1995
|
+
padding: "0.85rem 1rem",
|
|
1996
|
+
textDecoration: "none"
|
|
1997
|
+
},
|
|
1998
|
+
children: [
|
|
1999
|
+
/* @__PURE__ */ jsx14("div", { style: { fontWeight: 900 }, children: global.label }),
|
|
2000
|
+
/* @__PURE__ */ jsx14("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: typeof global.description === "string" && global.description.length > 0 ? global.description : href })
|
|
2001
|
+
]
|
|
1740
2002
|
},
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
"/admin/globals/",
|
|
1745
|
-
global.slug
|
|
1746
|
-
] })
|
|
1747
|
-
]
|
|
1748
|
-
},
|
|
1749
|
-
global.slug
|
|
1750
|
-
)) }),
|
|
2003
|
+
global.slug
|
|
2004
|
+
);
|
|
2005
|
+
}) }),
|
|
1751
2006
|
/* @__PURE__ */ jsx14("div", { style: { marginTop: "1rem" }, children: /* @__PURE__ */ jsx14(
|
|
1752
2007
|
"a",
|
|
1753
2008
|
{
|
|
1754
|
-
href:
|
|
2009
|
+
href: resolvedGlobalsBasePath,
|
|
1755
2010
|
style: { color: "var(--theme-elevation-700)", fontSize: "0.85rem", textDecoration: "none" },
|
|
1756
2011
|
children: "Reload Globals view"
|
|
1757
2012
|
}
|
|
@@ -1759,9 +2014,24 @@ function AdminStudioGlobalsView(props) {
|
|
|
1759
2014
|
] });
|
|
1760
2015
|
}
|
|
1761
2016
|
|
|
1762
|
-
// src/admin/components/studio/
|
|
2017
|
+
// src/admin/components/studio/AdminStudioContactFormView.tsx
|
|
2018
|
+
import { useEffect as useEffect10, useMemo as useMemo4, useState as useState9 } from "react";
|
|
1763
2019
|
import { SetStepNav as SetStepNav5 } from "@payloadcms/ui";
|
|
1764
|
-
import {
|
|
2020
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2021
|
+
var defaultDoc = {
|
|
2022
|
+
disabledMessage: "This form is temporarily unavailable. Please call us for immediate service.",
|
|
2023
|
+
enabled: true,
|
|
2024
|
+
errorMessage: "Submission failed. Please call us at (512) 555-0149.",
|
|
2025
|
+
notificationEmail: "",
|
|
2026
|
+
serviceOptions: [
|
|
2027
|
+
{ label: "Tree Trimming" },
|
|
2028
|
+
{ label: "Tree Removal" },
|
|
2029
|
+
{ label: "Stump Grinding" },
|
|
2030
|
+
{ label: "Storm Cleanup" }
|
|
2031
|
+
],
|
|
2032
|
+
submitButtonLabel: "Send Request",
|
|
2033
|
+
successMessage: "Thanks, your request has been received. We will follow up shortly."
|
|
2034
|
+
};
|
|
1765
2035
|
var getPropString6 = (props, key, fallback) => {
|
|
1766
2036
|
if (!props || typeof props !== "object") return fallback;
|
|
1767
2037
|
const direct = props[key];
|
|
@@ -1773,16 +2043,330 @@ var getPropString6 = (props, key, fallback) => {
|
|
|
1773
2043
|
}
|
|
1774
2044
|
return fallback;
|
|
1775
2045
|
};
|
|
2046
|
+
var normalizeOption = (value) => {
|
|
2047
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
2048
|
+
const label = value.label;
|
|
2049
|
+
if (typeof label !== "string") return null;
|
|
2050
|
+
const trimmed = label.trim();
|
|
2051
|
+
if (!trimmed) return null;
|
|
2052
|
+
return { label: trimmed };
|
|
2053
|
+
};
|
|
2054
|
+
var normalizeDoc = (value) => {
|
|
2055
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
2056
|
+
return defaultDoc;
|
|
2057
|
+
}
|
|
2058
|
+
const record = value;
|
|
2059
|
+
const options = Array.isArray(record.serviceOptions) ? record.serviceOptions.map(normalizeOption).filter((option) => option !== null) : defaultDoc.serviceOptions;
|
|
2060
|
+
return {
|
|
2061
|
+
disabledMessage: typeof record.disabledMessage === "string" && record.disabledMessage.length > 0 ? record.disabledMessage : defaultDoc.disabledMessage,
|
|
2062
|
+
enabled: record.enabled !== false,
|
|
2063
|
+
errorMessage: typeof record.errorMessage === "string" && record.errorMessage.length > 0 ? record.errorMessage : defaultDoc.errorMessage,
|
|
2064
|
+
notificationEmail: typeof record.notificationEmail === "string" ? record.notificationEmail : defaultDoc.notificationEmail,
|
|
2065
|
+
serviceOptions: options.length > 0 ? options : defaultDoc.serviceOptions,
|
|
2066
|
+
submitButtonLabel: typeof record.submitButtonLabel === "string" && record.submitButtonLabel.length > 0 ? record.submitButtonLabel : defaultDoc.submitButtonLabel,
|
|
2067
|
+
successMessage: typeof record.successMessage === "string" && record.successMessage.length > 0 ? record.successMessage : defaultDoc.successMessage
|
|
2068
|
+
};
|
|
2069
|
+
};
|
|
2070
|
+
var inputStyle = {
|
|
2071
|
+
background: "var(--theme-elevation-0)",
|
|
2072
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
2073
|
+
borderRadius: 10,
|
|
2074
|
+
color: "inherit",
|
|
2075
|
+
fontSize: "0.95rem",
|
|
2076
|
+
minHeight: 42,
|
|
2077
|
+
padding: "0.55rem 0.65rem",
|
|
2078
|
+
width: "100%"
|
|
2079
|
+
};
|
|
2080
|
+
var fieldLabelStyle = {
|
|
2081
|
+
color: "var(--theme-elevation-800)",
|
|
2082
|
+
display: "grid",
|
|
2083
|
+
fontSize: "0.88rem",
|
|
2084
|
+
fontWeight: 700,
|
|
2085
|
+
gap: "0.35rem"
|
|
2086
|
+
};
|
|
2087
|
+
var buttonStyle = {
|
|
2088
|
+
background: "var(--theme-success-700)",
|
|
2089
|
+
border: "1px solid var(--theme-success-700)",
|
|
2090
|
+
borderRadius: 10,
|
|
2091
|
+
color: "#fff",
|
|
2092
|
+
cursor: "pointer",
|
|
2093
|
+
fontSize: "0.9rem",
|
|
2094
|
+
fontWeight: 800,
|
|
2095
|
+
minHeight: 40,
|
|
2096
|
+
padding: "0 0.9rem"
|
|
2097
|
+
};
|
|
2098
|
+
var ghostButtonStyle = {
|
|
2099
|
+
...buttonStyle,
|
|
2100
|
+
background: "transparent",
|
|
2101
|
+
color: "var(--theme-elevation-900)"
|
|
2102
|
+
};
|
|
2103
|
+
function AdminStudioContactFormView(props) {
|
|
2104
|
+
const globalSlug = getPropString6(props, "globalSlug", "contact-form");
|
|
2105
|
+
const globalsBasePath = getPropString6(props, "globalsBasePath", "/studio-globals");
|
|
2106
|
+
const adminBasePath = useAdminBasePath();
|
|
2107
|
+
const resolvedGlobalsBasePath = resolveAdminPath(adminBasePath, globalsBasePath);
|
|
2108
|
+
const rawGlobalPath = resolveAdminPath(adminBasePath, `/globals/${globalSlug}`);
|
|
2109
|
+
const [doc, setDoc] = useState9(defaultDoc);
|
|
2110
|
+
const [error, setError] = useState9(null);
|
|
2111
|
+
const [isLoading, setIsLoading] = useState9(true);
|
|
2112
|
+
const [isSaving, setIsSaving] = useState9(false);
|
|
2113
|
+
const [savedMessage, setSavedMessage] = useState9(null);
|
|
2114
|
+
useEffect10(() => {
|
|
2115
|
+
let mounted = true;
|
|
2116
|
+
const load = async () => {
|
|
2117
|
+
setIsLoading(true);
|
|
2118
|
+
setError(null);
|
|
2119
|
+
setSavedMessage(null);
|
|
2120
|
+
try {
|
|
2121
|
+
const response = await fetch(`/api/globals/${globalSlug}?depth=0&draft=true`, {
|
|
2122
|
+
credentials: "same-origin"
|
|
2123
|
+
});
|
|
2124
|
+
if (!response.ok) {
|
|
2125
|
+
throw new Error(`Failed to load global (${response.status}).`);
|
|
2126
|
+
}
|
|
2127
|
+
const json = await response.json();
|
|
2128
|
+
if (!mounted) return;
|
|
2129
|
+
setDoc(normalizeDoc(json));
|
|
2130
|
+
} catch (loadError) {
|
|
2131
|
+
if (!mounted) return;
|
|
2132
|
+
setError(loadError instanceof Error ? loadError.message : "Failed to load contact form settings.");
|
|
2133
|
+
} finally {
|
|
2134
|
+
if (mounted) {
|
|
2135
|
+
setIsLoading(false);
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
};
|
|
2139
|
+
void load();
|
|
2140
|
+
return () => {
|
|
2141
|
+
mounted = false;
|
|
2142
|
+
};
|
|
2143
|
+
}, [globalSlug]);
|
|
2144
|
+
const payload = useMemo4(
|
|
2145
|
+
() => ({
|
|
2146
|
+
disabledMessage: doc.disabledMessage,
|
|
2147
|
+
enabled: doc.enabled,
|
|
2148
|
+
errorMessage: doc.errorMessage,
|
|
2149
|
+
notificationEmail: doc.notificationEmail.trim(),
|
|
2150
|
+
serviceOptions: doc.serviceOptions.map((option) => ({ label: option.label.trim() })).filter((option) => option.label.length > 0),
|
|
2151
|
+
submitButtonLabel: doc.submitButtonLabel,
|
|
2152
|
+
successMessage: doc.successMessage
|
|
2153
|
+
}),
|
|
2154
|
+
[doc]
|
|
2155
|
+
);
|
|
2156
|
+
const save = async () => {
|
|
2157
|
+
setIsSaving(true);
|
|
2158
|
+
setError(null);
|
|
2159
|
+
setSavedMessage(null);
|
|
2160
|
+
try {
|
|
2161
|
+
const response = await fetch(`/api/globals/${globalSlug}`, {
|
|
2162
|
+
body: JSON.stringify(payload),
|
|
2163
|
+
credentials: "same-origin",
|
|
2164
|
+
headers: {
|
|
2165
|
+
"Content-Type": "application/json"
|
|
2166
|
+
},
|
|
2167
|
+
method: "PATCH"
|
|
2168
|
+
});
|
|
2169
|
+
if (!response.ok) {
|
|
2170
|
+
throw new Error(`Failed to save settings (${response.status}).`);
|
|
2171
|
+
}
|
|
2172
|
+
const json = await response.json();
|
|
2173
|
+
setDoc(normalizeDoc(json));
|
|
2174
|
+
setSavedMessage("Saved.");
|
|
2175
|
+
} catch (saveError) {
|
|
2176
|
+
setError(saveError instanceof Error ? saveError.message : "Failed to save contact form settings.");
|
|
2177
|
+
} finally {
|
|
2178
|
+
setIsSaving(false);
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
return /* @__PURE__ */ jsxs14("div", { style: { paddingBottom: "2rem" }, children: [
|
|
2182
|
+
/* @__PURE__ */ jsx15(
|
|
2183
|
+
SetStepNav5,
|
|
2184
|
+
{
|
|
2185
|
+
nav: [
|
|
2186
|
+
{ label: "Globals", url: resolvedGlobalsBasePath },
|
|
2187
|
+
{ label: "Contact Form" }
|
|
2188
|
+
]
|
|
2189
|
+
}
|
|
2190
|
+
),
|
|
2191
|
+
/* @__PURE__ */ jsx15("h1", { style: { margin: 0 }, children: "Contact Form" }),
|
|
2192
|
+
/* @__PURE__ */ jsx15("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Edit form behavior and submission messaging without leaving Studio." }),
|
|
2193
|
+
isLoading ? /* @__PURE__ */ jsx15("p", { style: { color: "var(--theme-elevation-600)" }, children: "Loading form settings\u2026" }) : null,
|
|
2194
|
+
error ? /* @__PURE__ */ jsx15("p", { style: { color: "var(--theme-error-600)" }, children: error }) : null,
|
|
2195
|
+
savedMessage ? /* @__PURE__ */ jsx15("p", { style: { color: "var(--theme-success-700)" }, children: savedMessage }) : null,
|
|
2196
|
+
!isLoading ? /* @__PURE__ */ jsxs14("div", { style: { display: "grid", gap: "1rem", marginTop: "1rem", maxWidth: 900 }, children: [
|
|
2197
|
+
/* @__PURE__ */ jsxs14("label", { style: { ...fieldLabelStyle, alignItems: "center", display: "flex", gap: "0.6rem" }, children: [
|
|
2198
|
+
/* @__PURE__ */ jsx15(
|
|
2199
|
+
"input",
|
|
2200
|
+
{
|
|
2201
|
+
checked: doc.enabled,
|
|
2202
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, enabled: event.target.checked })),
|
|
2203
|
+
type: "checkbox"
|
|
2204
|
+
}
|
|
2205
|
+
),
|
|
2206
|
+
"Form enabled"
|
|
2207
|
+
] }),
|
|
2208
|
+
/* @__PURE__ */ jsxs14("label", { style: fieldLabelStyle, children: [
|
|
2209
|
+
"Notification Email",
|
|
2210
|
+
/* @__PURE__ */ jsx15(
|
|
2211
|
+
"input",
|
|
2212
|
+
{
|
|
2213
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, notificationEmail: event.target.value })),
|
|
2214
|
+
style: inputStyle,
|
|
2215
|
+
type: "email",
|
|
2216
|
+
value: doc.notificationEmail
|
|
2217
|
+
}
|
|
2218
|
+
)
|
|
2219
|
+
] }),
|
|
2220
|
+
/* @__PURE__ */ jsxs14("label", { style: fieldLabelStyle, children: [
|
|
2221
|
+
"Submit Button Label",
|
|
2222
|
+
/* @__PURE__ */ jsx15(
|
|
2223
|
+
"input",
|
|
2224
|
+
{
|
|
2225
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, submitButtonLabel: event.target.value })),
|
|
2226
|
+
style: inputStyle,
|
|
2227
|
+
type: "text",
|
|
2228
|
+
value: doc.submitButtonLabel
|
|
2229
|
+
}
|
|
2230
|
+
)
|
|
2231
|
+
] }),
|
|
2232
|
+
/* @__PURE__ */ jsxs14("label", { style: fieldLabelStyle, children: [
|
|
2233
|
+
"Success Message",
|
|
2234
|
+
/* @__PURE__ */ jsx15(
|
|
2235
|
+
"input",
|
|
2236
|
+
{
|
|
2237
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, successMessage: event.target.value })),
|
|
2238
|
+
style: inputStyle,
|
|
2239
|
+
type: "text",
|
|
2240
|
+
value: doc.successMessage
|
|
2241
|
+
}
|
|
2242
|
+
)
|
|
2243
|
+
] }),
|
|
2244
|
+
/* @__PURE__ */ jsxs14("label", { style: fieldLabelStyle, children: [
|
|
2245
|
+
"Error Message",
|
|
2246
|
+
/* @__PURE__ */ jsx15(
|
|
2247
|
+
"input",
|
|
2248
|
+
{
|
|
2249
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, errorMessage: event.target.value })),
|
|
2250
|
+
style: inputStyle,
|
|
2251
|
+
type: "text",
|
|
2252
|
+
value: doc.errorMessage
|
|
2253
|
+
}
|
|
2254
|
+
)
|
|
2255
|
+
] }),
|
|
2256
|
+
/* @__PURE__ */ jsxs14("label", { style: fieldLabelStyle, children: [
|
|
2257
|
+
"Disabled Message",
|
|
2258
|
+
/* @__PURE__ */ jsx15(
|
|
2259
|
+
"input",
|
|
2260
|
+
{
|
|
2261
|
+
onChange: (event) => setDoc((prev) => ({ ...prev, disabledMessage: event.target.value })),
|
|
2262
|
+
style: inputStyle,
|
|
2263
|
+
type: "text",
|
|
2264
|
+
value: doc.disabledMessage
|
|
2265
|
+
}
|
|
2266
|
+
)
|
|
2267
|
+
] }),
|
|
2268
|
+
/* @__PURE__ */ jsxs14(
|
|
2269
|
+
"div",
|
|
2270
|
+
{
|
|
2271
|
+
style: {
|
|
2272
|
+
background: "var(--theme-elevation-0)",
|
|
2273
|
+
border: "1px solid var(--theme-elevation-200)",
|
|
2274
|
+
borderRadius: 14,
|
|
2275
|
+
padding: "0.85rem"
|
|
2276
|
+
},
|
|
2277
|
+
children: [
|
|
2278
|
+
/* @__PURE__ */ jsx15("div", { style: { fontWeight: 900, marginBottom: "0.65rem" }, children: "Service Options" }),
|
|
2279
|
+
/* @__PURE__ */ jsx15("div", { style: { display: "grid", gap: "0.55rem" }, children: doc.serviceOptions.map((option, index) => /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
2280
|
+
/* @__PURE__ */ jsx15(
|
|
2281
|
+
"input",
|
|
2282
|
+
{
|
|
2283
|
+
onChange: (event) => setDoc((prev) => ({
|
|
2284
|
+
...prev,
|
|
2285
|
+
serviceOptions: prev.serviceOptions.map(
|
|
2286
|
+
(row, rowIndex) => rowIndex === index ? { label: event.target.value } : row
|
|
2287
|
+
)
|
|
2288
|
+
})),
|
|
2289
|
+
style: inputStyle,
|
|
2290
|
+
type: "text",
|
|
2291
|
+
value: option.label
|
|
2292
|
+
}
|
|
2293
|
+
),
|
|
2294
|
+
/* @__PURE__ */ jsx15(
|
|
2295
|
+
"button",
|
|
2296
|
+
{
|
|
2297
|
+
onClick: () => setDoc((prev) => ({
|
|
2298
|
+
...prev,
|
|
2299
|
+
serviceOptions: prev.serviceOptions.length > 1 ? prev.serviceOptions.filter((_, rowIndex) => rowIndex !== index) : prev.serviceOptions
|
|
2300
|
+
})),
|
|
2301
|
+
style: ghostButtonStyle,
|
|
2302
|
+
type: "button",
|
|
2303
|
+
children: "Remove"
|
|
2304
|
+
}
|
|
2305
|
+
)
|
|
2306
|
+
] }, `${index}-${option.label}`)) }),
|
|
2307
|
+
/* @__PURE__ */ jsx15(
|
|
2308
|
+
"button",
|
|
2309
|
+
{
|
|
2310
|
+
onClick: () => setDoc((prev) => ({
|
|
2311
|
+
...prev,
|
|
2312
|
+
serviceOptions: [...prev.serviceOptions, { label: "" }]
|
|
2313
|
+
})),
|
|
2314
|
+
style: { ...ghostButtonStyle, marginTop: "0.7rem" },
|
|
2315
|
+
type: "button",
|
|
2316
|
+
children: "Add Service"
|
|
2317
|
+
}
|
|
2318
|
+
)
|
|
2319
|
+
]
|
|
2320
|
+
}
|
|
2321
|
+
),
|
|
2322
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: "0.6rem" }, children: [
|
|
2323
|
+
/* @__PURE__ */ jsx15("button", { disabled: isSaving, onClick: () => void save(), style: buttonStyle, type: "button", children: isSaving ? "Saving\u2026" : "Save Form Settings" }),
|
|
2324
|
+
/* @__PURE__ */ jsx15(
|
|
2325
|
+
"a",
|
|
2326
|
+
{
|
|
2327
|
+
href: rawGlobalPath,
|
|
2328
|
+
style: {
|
|
2329
|
+
...ghostButtonStyle,
|
|
2330
|
+
alignItems: "center",
|
|
2331
|
+
display: "inline-flex",
|
|
2332
|
+
justifyContent: "center",
|
|
2333
|
+
textDecoration: "none"
|
|
2334
|
+
},
|
|
2335
|
+
children: "Open Raw Global"
|
|
2336
|
+
}
|
|
2337
|
+
)
|
|
2338
|
+
] })
|
|
2339
|
+
] }) : null
|
|
2340
|
+
] });
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
// src/admin/components/studio/AdminStudioMediaView.tsx
|
|
2344
|
+
import { SetStepNav as SetStepNav6 } from "@payloadcms/ui";
|
|
2345
|
+
import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2346
|
+
var getPropString7 = (props, key, fallback) => {
|
|
2347
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2348
|
+
const direct = props[key];
|
|
2349
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
2350
|
+
const clientProps = props.clientProps;
|
|
2351
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2352
|
+
const nested = clientProps[key];
|
|
2353
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
2354
|
+
}
|
|
2355
|
+
return fallback;
|
|
2356
|
+
};
|
|
1776
2357
|
function AdminStudioMediaView(props) {
|
|
1777
|
-
const mediaCollectionSlug =
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
/* @__PURE__ */
|
|
2358
|
+
const mediaCollectionSlug = getPropString7(props, "mediaCollectionSlug", "media");
|
|
2359
|
+
const adminBasePath = useAdminBasePath();
|
|
2360
|
+
const mediaPath = resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`);
|
|
2361
|
+
const mediaViewPath = resolveAdminPath(adminBasePath, "/media");
|
|
2362
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2363
|
+
/* @__PURE__ */ jsx16(SetStepNav6, { nav: [{ label: "Media", url: mediaViewPath }] }),
|
|
2364
|
+
/* @__PURE__ */ jsx16("h1", { style: { margin: 0 }, children: "Media" }),
|
|
2365
|
+
/* @__PURE__ */ jsx16("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Media management is currently using Payload's library." }),
|
|
2366
|
+
/* @__PURE__ */ jsx16("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: /* @__PURE__ */ jsxs15(
|
|
1783
2367
|
"a",
|
|
1784
2368
|
{
|
|
1785
|
-
href:
|
|
2369
|
+
href: mediaPath,
|
|
1786
2370
|
style: {
|
|
1787
2371
|
background: "var(--theme-elevation-0)",
|
|
1788
2372
|
border: "1px solid var(--theme-elevation-150)",
|
|
@@ -1792,11 +2376,8 @@ function AdminStudioMediaView(props) {
|
|
|
1792
2376
|
textDecoration: "none"
|
|
1793
2377
|
},
|
|
1794
2378
|
children: [
|
|
1795
|
-
/* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
"/admin/collections/",
|
|
1798
|
-
mediaCollectionSlug
|
|
1799
|
-
] })
|
|
2379
|
+
/* @__PURE__ */ jsx16("div", { style: { fontWeight: 900 }, children: "Open Media Library" }),
|
|
2380
|
+
/* @__PURE__ */ jsx16("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: mediaPath })
|
|
1800
2381
|
]
|
|
1801
2382
|
}
|
|
1802
2383
|
) })
|
|
@@ -1804,14 +2385,14 @@ function AdminStudioMediaView(props) {
|
|
|
1804
2385
|
}
|
|
1805
2386
|
|
|
1806
2387
|
// src/admin/components/studio/AdminStudioToolsView.tsx
|
|
1807
|
-
import { SetStepNav as
|
|
1808
|
-
import { Fragment as Fragment7, jsx as
|
|
2388
|
+
import { SetStepNav as SetStepNav7, useAuth as useAuth4 } from "@payloadcms/ui";
|
|
2389
|
+
import { Fragment as Fragment7, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1809
2390
|
var isAdmin4 = (user) => {
|
|
1810
2391
|
if (!user || typeof user !== "object") return false;
|
|
1811
2392
|
const role = user.role;
|
|
1812
2393
|
return typeof role === "string" && role === "admin";
|
|
1813
2394
|
};
|
|
1814
|
-
var
|
|
2395
|
+
var getPropString8 = (props, key, fallback) => {
|
|
1815
2396
|
if (!props || typeof props !== "object") return fallback;
|
|
1816
2397
|
const direct = props[key];
|
|
1817
2398
|
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
@@ -1824,28 +2405,30 @@ var getPropString7 = (props, key, fallback) => {
|
|
|
1824
2405
|
};
|
|
1825
2406
|
function AdminStudioToolsView(props) {
|
|
1826
2407
|
const { user } = useAuth4();
|
|
2408
|
+
const adminBasePath = useAdminBasePath();
|
|
2409
|
+
const toolsPath = resolveAdminPath(adminBasePath, "/tools");
|
|
1827
2410
|
if (!isAdmin4(user)) {
|
|
1828
|
-
return /* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
2411
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2412
|
+
/* @__PURE__ */ jsx17(SetStepNav7, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
2413
|
+
/* @__PURE__ */ jsx17("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
2414
|
+
/* @__PURE__ */ jsx17("p", { style: { color: "var(--theme-elevation-600)" }, children: "You do not have access to this page." })
|
|
1832
2415
|
] });
|
|
1833
2416
|
}
|
|
1834
|
-
const pagesCollectionSlug =
|
|
1835
|
-
const mediaCollectionSlug =
|
|
2417
|
+
const pagesCollectionSlug = getPropString8(props, "pagesCollectionSlug", "pages");
|
|
2418
|
+
const mediaCollectionSlug = getPropString8(props, "mediaCollectionSlug", "media");
|
|
1836
2419
|
const links = [
|
|
1837
|
-
{ href: `/
|
|
1838
|
-
{ href: `/
|
|
1839
|
-
{ href: "/
|
|
1840
|
-
{ href: "/
|
|
1841
|
-
{ href: "/
|
|
1842
|
-
{ href: "/
|
|
2420
|
+
{ href: resolveAdminPath(adminBasePath, `/collections/${pagesCollectionSlug}`), label: "Raw Pages Collection" },
|
|
2421
|
+
{ href: resolveAdminPath(adminBasePath, `/collections/${mediaCollectionSlug}`), label: "Raw Media Collection" },
|
|
2422
|
+
{ href: resolveAdminPath(adminBasePath, "/globals/site-settings"), label: "Raw Site Settings Global" },
|
|
2423
|
+
{ href: resolveAdminPath(adminBasePath, "/globals/header"), label: "Raw Header Global" },
|
|
2424
|
+
{ href: resolveAdminPath(adminBasePath, "/globals/footer"), label: "Raw Footer Global" },
|
|
2425
|
+
{ href: resolveAdminPath(adminBasePath, "/collections/users"), label: "Users / Roles" }
|
|
1843
2426
|
];
|
|
1844
|
-
return /* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
2427
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2428
|
+
/* @__PURE__ */ jsx17(SetStepNav7, { nav: [{ label: "Admin Tools", url: toolsPath }] }),
|
|
2429
|
+
/* @__PURE__ */ jsx17("h1", { style: { margin: 0 }, children: "Admin Tools" }),
|
|
2430
|
+
/* @__PURE__ */ jsx17("p", { style: { color: "var(--theme-elevation-600)", marginTop: "0.35rem" }, children: "Hidden fallback links for administrators." }),
|
|
2431
|
+
/* @__PURE__ */ jsx17("div", { style: { display: "grid", gap: "0.6rem", marginTop: "1rem" }, children: links.map((link) => /* @__PURE__ */ jsxs16(
|
|
1849
2432
|
"a",
|
|
1850
2433
|
{
|
|
1851
2434
|
href: link.href,
|
|
@@ -1858,8 +2441,8 @@ function AdminStudioToolsView(props) {
|
|
|
1858
2441
|
textDecoration: "none"
|
|
1859
2442
|
},
|
|
1860
2443
|
children: [
|
|
1861
|
-
/* @__PURE__ */
|
|
1862
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx17("div", { style: { fontWeight: 900 }, children: link.label }),
|
|
2445
|
+
/* @__PURE__ */ jsx17("div", { style: { color: "var(--theme-elevation-600)", fontSize: "0.9rem" }, children: link.href })
|
|
1863
2446
|
]
|
|
1864
2447
|
},
|
|
1865
2448
|
link.href
|
|
@@ -1869,14 +2452,14 @@ function AdminStudioToolsView(props) {
|
|
|
1869
2452
|
|
|
1870
2453
|
// src/admin/components/studio/OpenInStudioMenuItem.tsx
|
|
1871
2454
|
import { useDocumentInfo } from "@payloadcms/ui";
|
|
1872
|
-
import { jsx as
|
|
2455
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1873
2456
|
function OpenInStudioMenuItem({ pagesPathBase = "/studio/pages" }) {
|
|
1874
2457
|
const documentInfo = useDocumentInfo();
|
|
1875
2458
|
const id = documentInfo?.id;
|
|
1876
2459
|
if (!id) {
|
|
1877
2460
|
return null;
|
|
1878
2461
|
}
|
|
1879
|
-
return /* @__PURE__ */
|
|
2462
|
+
return /* @__PURE__ */ jsx18(
|
|
1880
2463
|
"a",
|
|
1881
2464
|
{
|
|
1882
2465
|
href: `${pagesPathBase}/${id}`,
|
|
@@ -1895,19 +2478,19 @@ function OpenInStudioMenuItem({ pagesPathBase = "/studio/pages" }) {
|
|
|
1895
2478
|
}
|
|
1896
2479
|
|
|
1897
2480
|
// src/admin/components/studio/PageEditRedirectToStudio.tsx
|
|
1898
|
-
import { useEffect as
|
|
2481
|
+
import { useEffect as useEffect11 } from "react";
|
|
1899
2482
|
import { useDocumentInfo as useDocumentInfo2 } from "@payloadcms/ui";
|
|
1900
|
-
import { jsx as
|
|
2483
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1901
2484
|
function PageEditRedirectToStudio({ pagesPathBase = "/studio/pages" }) {
|
|
1902
2485
|
const documentInfo = useDocumentInfo2();
|
|
1903
2486
|
const id = documentInfo?.id;
|
|
1904
|
-
|
|
2487
|
+
useEffect11(() => {
|
|
1905
2488
|
if (!id) {
|
|
1906
2489
|
return;
|
|
1907
2490
|
}
|
|
1908
2491
|
window.location.replace(`${pagesPathBase}/${id}`);
|
|
1909
2492
|
}, [id, pagesPathBase]);
|
|
1910
|
-
return /* @__PURE__ */
|
|
2493
|
+
return /* @__PURE__ */ jsxs17(
|
|
1911
2494
|
"div",
|
|
1912
2495
|
{
|
|
1913
2496
|
style: {
|
|
@@ -1919,55 +2502,111 @@ function PageEditRedirectToStudio({ pagesPathBase = "/studio/pages" }) {
|
|
|
1919
2502
|
minHeight: "50vh"
|
|
1920
2503
|
},
|
|
1921
2504
|
children: [
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1924
|
-
id ? /* @__PURE__ */
|
|
2505
|
+
/* @__PURE__ */ jsx19("h2", { style: { margin: 0 }, children: "Opening Editor..." }),
|
|
2506
|
+
/* @__PURE__ */ jsx19("p", { style: { color: "var(--theme-elevation-600)", margin: 0 }, children: "Redirecting to the custom page editor." }),
|
|
2507
|
+
id ? /* @__PURE__ */ jsx19("a", { href: `${pagesPathBase}/${id}`, children: "Continue to Editor" }) : /* @__PURE__ */ jsx19("a", { href: pagesPathBase, children: "Open Pages" })
|
|
1925
2508
|
]
|
|
1926
2509
|
}
|
|
1927
2510
|
);
|
|
1928
2511
|
}
|
|
1929
2512
|
|
|
1930
2513
|
// src/admin/components/studio/StudioBackBreadcrumb.tsx
|
|
1931
|
-
import {
|
|
1932
|
-
import {
|
|
1933
|
-
import { jsx as
|
|
2514
|
+
import { useEffect as useEffect12, useState as useState10 } from "react";
|
|
2515
|
+
import { SetStepNav as SetStepNav8 } from "@payloadcms/ui";
|
|
2516
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1934
2517
|
var toTitle = (slug) => slug.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
1935
|
-
var buildNav = (pathname) => {
|
|
2518
|
+
var buildNav = (pathname, adminBasePath) => {
|
|
1936
2519
|
if (pathname.includes("/globals/")) {
|
|
1937
2520
|
const slug = pathname.split("/globals/")[1]?.split("/")[0] || "";
|
|
1938
2521
|
const currentLabel = slug === "site-settings" ? "Website Settings" : toTitle(slug) || "Global";
|
|
1939
2522
|
return [
|
|
1940
|
-
{ label: "Globals", url: "/
|
|
2523
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/studio-globals") },
|
|
1941
2524
|
{ label: currentLabel }
|
|
1942
2525
|
];
|
|
1943
2526
|
}
|
|
1944
|
-
if (pathname.includes("/
|
|
2527
|
+
if (pathname.includes("/studio-contact-form")) {
|
|
1945
2528
|
return [
|
|
1946
|
-
{ label: "
|
|
2529
|
+
{ label: "Globals", url: resolveAdminPath(adminBasePath, "/studio-globals") },
|
|
2530
|
+
{ label: "Contact Form" }
|
|
2531
|
+
];
|
|
2532
|
+
}
|
|
2533
|
+
if (pathname.includes("/collections/pages") || pathname.includes("/pages/")) {
|
|
2534
|
+
return [
|
|
2535
|
+
{ label: "Pages", url: resolveAdminPath(adminBasePath, "/collections/pages") },
|
|
1947
2536
|
{ label: "Page" }
|
|
1948
2537
|
];
|
|
1949
2538
|
}
|
|
1950
2539
|
if (pathname.includes("/collections/media")) {
|
|
1951
2540
|
return [
|
|
1952
|
-
{ label: "Media", url: "/
|
|
2541
|
+
{ label: "Media", url: resolveAdminPath(adminBasePath, "/collections/media") },
|
|
1953
2542
|
{ label: "Media Item" }
|
|
1954
2543
|
];
|
|
1955
2544
|
}
|
|
1956
|
-
if (pathname.
|
|
2545
|
+
if (pathname.includes("/tools") || pathname.includes("/collections/users")) {
|
|
1957
2546
|
return [
|
|
1958
|
-
{ label: "Admin Tools", url: "/
|
|
2547
|
+
{ label: "Admin Tools", url: resolveAdminPath(adminBasePath, "/collections/users") },
|
|
1959
2548
|
{ label: "Tool" }
|
|
1960
2549
|
];
|
|
1961
2550
|
}
|
|
1962
2551
|
return null;
|
|
1963
2552
|
};
|
|
1964
2553
|
function StudioBackBreadcrumb() {
|
|
1965
|
-
const
|
|
1966
|
-
const
|
|
2554
|
+
const adminBasePath = useAdminBasePath();
|
|
2555
|
+
const [pathname, setPathname] = useState10("");
|
|
2556
|
+
useEffect12(() => {
|
|
2557
|
+
const update = () => setPathname(window.location.pathname);
|
|
2558
|
+
update();
|
|
2559
|
+
window.addEventListener("popstate", update);
|
|
2560
|
+
return () => window.removeEventListener("popstate", update);
|
|
2561
|
+
}, []);
|
|
2562
|
+
const nav = buildNav(pathname, adminBasePath);
|
|
1967
2563
|
if (!nav) return null;
|
|
1968
|
-
return /* @__PURE__ */
|
|
2564
|
+
return /* @__PURE__ */ jsx20(SetStepNav8, { nav });
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
// src/admin/components/studio/StudioContactFormRedirect.tsx
|
|
2568
|
+
import { useEffect as useEffect13 } from "react";
|
|
2569
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2570
|
+
var getPropString9 = (props, key, fallback) => {
|
|
2571
|
+
if (!props || typeof props !== "object") return fallback;
|
|
2572
|
+
const direct = props[key];
|
|
2573
|
+
if (typeof direct === "string" && direct.length > 0) return direct;
|
|
2574
|
+
const clientProps = props.clientProps;
|
|
2575
|
+
if (clientProps && typeof clientProps === "object") {
|
|
2576
|
+
const nested = clientProps[key];
|
|
2577
|
+
if (typeof nested === "string" && nested.length > 0) return nested;
|
|
2578
|
+
}
|
|
2579
|
+
return fallback;
|
|
2580
|
+
};
|
|
2581
|
+
function StudioContactFormRedirect(props) {
|
|
2582
|
+
const adminBasePath = useAdminBasePath();
|
|
2583
|
+
const studioContactFormPath = getPropString9(props, "studioContactFormPath", "/studio-contact-form");
|
|
2584
|
+
const targetPath = resolveAdminPath(adminBasePath, studioContactFormPath);
|
|
2585
|
+
useEffect13(() => {
|
|
2586
|
+
if (window.location.pathname === targetPath) return;
|
|
2587
|
+
window.location.replace(targetPath);
|
|
2588
|
+
}, [targetPath]);
|
|
2589
|
+
return /* @__PURE__ */ jsxs18(
|
|
2590
|
+
"div",
|
|
2591
|
+
{
|
|
2592
|
+
style: {
|
|
2593
|
+
alignItems: "center",
|
|
2594
|
+
color: "var(--theme-elevation-800)",
|
|
2595
|
+
display: "flex",
|
|
2596
|
+
flexDirection: "column",
|
|
2597
|
+
gap: "0.75rem",
|
|
2598
|
+
justifyContent: "center",
|
|
2599
|
+
minHeight: "40vh"
|
|
2600
|
+
},
|
|
2601
|
+
children: [
|
|
2602
|
+
/* @__PURE__ */ jsx21("h2", { style: { margin: 0 }, children: "Opening Contact Form Editor..." }),
|
|
2603
|
+
/* @__PURE__ */ jsx21("a", { href: targetPath, children: "Continue" })
|
|
2604
|
+
]
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
1969
2607
|
}
|
|
1970
2608
|
export {
|
|
2609
|
+
AdminStudioContactFormView,
|
|
1971
2610
|
AdminStudioDashboard,
|
|
1972
2611
|
AdminStudioGlobalsView,
|
|
1973
2612
|
AdminStudioMediaView,
|
|
@@ -1987,6 +2626,7 @@ export {
|
|
|
1987
2626
|
SectionTabs,
|
|
1988
2627
|
StatusBadge,
|
|
1989
2628
|
StudioBackBreadcrumb,
|
|
2629
|
+
StudioContactFormRedirect,
|
|
1990
2630
|
ThemeProvider,
|
|
1991
2631
|
ThemeSwitcher,
|
|
1992
2632
|
WelcomeHeader,
|