@orion-studios/payload-studio 0.6.0-beta.31 → 0.6.0-beta.33
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
CHANGED
|
@@ -3059,7 +3059,13 @@ function AdminShellClient({
|
|
|
3059
3059
|
onLogout,
|
|
3060
3060
|
storageKey = "orion-admin-shell-collapsed"
|
|
3061
3061
|
}) {
|
|
3062
|
-
const [collapsed, setCollapsed] = (0, import_react14.useState)(
|
|
3062
|
+
const [collapsed, setCollapsed] = (0, import_react14.useState)(() => {
|
|
3063
|
+
try {
|
|
3064
|
+
return typeof window !== "undefined" && window.localStorage.getItem(storageKey) === "1";
|
|
3065
|
+
} catch {
|
|
3066
|
+
return false;
|
|
3067
|
+
}
|
|
3068
|
+
});
|
|
3063
3069
|
const [loggingOut, setLoggingOut] = (0, import_react14.useState)(false);
|
|
3064
3070
|
(0, import_react14.useEffect)(() => {
|
|
3065
3071
|
try {
|
|
@@ -8264,6 +8270,17 @@ var normalizeSteps = (value) => {
|
|
|
8264
8270
|
}
|
|
8265
8271
|
return value.map((step) => step && typeof step === "object" && !Array.isArray(step) ? step : {});
|
|
8266
8272
|
};
|
|
8273
|
+
var normalizeFormResponse = (value) => {
|
|
8274
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8275
|
+
return {};
|
|
8276
|
+
}
|
|
8277
|
+
const record = value;
|
|
8278
|
+
const nestedDoc = record.doc;
|
|
8279
|
+
if (nestedDoc && typeof nestedDoc === "object" && !Array.isArray(nestedDoc)) {
|
|
8280
|
+
return nestedDoc;
|
|
8281
|
+
}
|
|
8282
|
+
return record;
|
|
8283
|
+
};
|
|
8267
8284
|
var toEditorState = (doc) => {
|
|
8268
8285
|
const emails = doc.emails && typeof doc.emails === "object" ? doc.emails : null;
|
|
8269
8286
|
const adminRecipients = Array.isArray(emails?.adminRecipients) ? emails?.adminRecipients.map(
|
|
@@ -8417,7 +8434,7 @@ function AdminStudioFormDetailView(props) {
|
|
|
8417
8434
|
if (!submissionsResponse.ok) {
|
|
8418
8435
|
throw new Error(`Failed to load submissions (${submissionsResponse.status}).`);
|
|
8419
8436
|
}
|
|
8420
|
-
const nextDoc = await formResponse.json();
|
|
8437
|
+
const nextDoc = normalizeFormResponse(await formResponse.json());
|
|
8421
8438
|
const submissionsPayload = await submissionsResponse.json();
|
|
8422
8439
|
const nextSubmissions = Array.isArray(submissionsPayload.docs) ? submissionsPayload.docs : [];
|
|
8423
8440
|
setDoc(nextDoc);
|
|
@@ -8474,7 +8491,7 @@ function AdminStudioFormDetailView(props) {
|
|
|
8474
8491
|
if (!response.ok) {
|
|
8475
8492
|
throw new Error(`Failed to save form (${response.status}).`);
|
|
8476
8493
|
}
|
|
8477
|
-
const nextDoc = await response.json();
|
|
8494
|
+
const nextDoc = normalizeFormResponse(await response.json());
|
|
8478
8495
|
setDoc(nextDoc);
|
|
8479
8496
|
setEditorState(toEditorState(nextDoc));
|
|
8480
8497
|
setSavedMessage("Saved.");
|
package/dist/admin/client.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
SiteFooterPreview,
|
|
10
10
|
adminNavIcons,
|
|
11
11
|
buildAdminPageLinkOptions
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-KHFD24JL.mjs";
|
|
13
13
|
import "../chunk-ROTPP5CU.mjs";
|
|
14
14
|
import {
|
|
15
15
|
BlockPicker,
|
|
@@ -5934,6 +5934,17 @@ var normalizeSteps = (value) => {
|
|
|
5934
5934
|
}
|
|
5935
5935
|
return value.map((step) => step && typeof step === "object" && !Array.isArray(step) ? step : {});
|
|
5936
5936
|
};
|
|
5937
|
+
var normalizeFormResponse = (value) => {
|
|
5938
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
5939
|
+
return {};
|
|
5940
|
+
}
|
|
5941
|
+
const record = value;
|
|
5942
|
+
const nestedDoc = record.doc;
|
|
5943
|
+
if (nestedDoc && typeof nestedDoc === "object" && !Array.isArray(nestedDoc)) {
|
|
5944
|
+
return nestedDoc;
|
|
5945
|
+
}
|
|
5946
|
+
return record;
|
|
5947
|
+
};
|
|
5937
5948
|
var toEditorState = (doc) => {
|
|
5938
5949
|
const emails = doc.emails && typeof doc.emails === "object" ? doc.emails : null;
|
|
5939
5950
|
const adminRecipients = Array.isArray(emails?.adminRecipients) ? emails?.adminRecipients.map(
|
|
@@ -6087,7 +6098,7 @@ function AdminStudioFormDetailView(props) {
|
|
|
6087
6098
|
if (!submissionsResponse.ok) {
|
|
6088
6099
|
throw new Error(`Failed to load submissions (${submissionsResponse.status}).`);
|
|
6089
6100
|
}
|
|
6090
|
-
const nextDoc = await formResponse.json();
|
|
6101
|
+
const nextDoc = normalizeFormResponse(await formResponse.json());
|
|
6091
6102
|
const submissionsPayload = await submissionsResponse.json();
|
|
6092
6103
|
const nextSubmissions = Array.isArray(submissionsPayload.docs) ? submissionsPayload.docs : [];
|
|
6093
6104
|
setDoc(nextDoc);
|
|
@@ -6144,7 +6155,7 @@ function AdminStudioFormDetailView(props) {
|
|
|
6144
6155
|
if (!response.ok) {
|
|
6145
6156
|
throw new Error(`Failed to save form (${response.status}).`);
|
|
6146
6157
|
}
|
|
6147
|
-
const nextDoc = await response.json();
|
|
6158
|
+
const nextDoc = normalizeFormResponse(await response.json());
|
|
6148
6159
|
setDoc(nextDoc);
|
|
6149
6160
|
setEditorState(toEditorState(nextDoc));
|
|
6150
6161
|
setSavedMessage("Saved.");
|
package/dist/admin-app/client.js
CHANGED
|
@@ -122,7 +122,13 @@ function AdminShellClient({
|
|
|
122
122
|
onLogout,
|
|
123
123
|
storageKey = "orion-admin-shell-collapsed"
|
|
124
124
|
}) {
|
|
125
|
-
const [collapsed, setCollapsed] = (0, import_react.useState)(
|
|
125
|
+
const [collapsed, setCollapsed] = (0, import_react.useState)(() => {
|
|
126
|
+
try {
|
|
127
|
+
return typeof window !== "undefined" && window.localStorage.getItem(storageKey) === "1";
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
126
132
|
const [loggingOut, setLoggingOut] = (0, import_react.useState)(false);
|
|
127
133
|
(0, import_react.useEffect)(() => {
|
|
128
134
|
try {
|
|
@@ -103,7 +103,13 @@ function AdminShellClient({
|
|
|
103
103
|
onLogout,
|
|
104
104
|
storageKey = "orion-admin-shell-collapsed"
|
|
105
105
|
}) {
|
|
106
|
-
const [collapsed, setCollapsed] = useState(
|
|
106
|
+
const [collapsed, setCollapsed] = useState(() => {
|
|
107
|
+
try {
|
|
108
|
+
return typeof window !== "undefined" && window.localStorage.getItem(storageKey) === "1";
|
|
109
|
+
} catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
107
113
|
const [loggingOut, setLoggingOut] = useState(false);
|
|
108
114
|
useEffect(() => {
|
|
109
115
|
try {
|
package/package.json
CHANGED