@orion-studios/payload-studio 0.6.0-beta.30 → 0.6.0-beta.32

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.
@@ -8264,6 +8264,17 @@ var normalizeSteps = (value) => {
8264
8264
  }
8265
8265
  return value.map((step) => step && typeof step === "object" && !Array.isArray(step) ? step : {});
8266
8266
  };
8267
+ var normalizeFormResponse = (value) => {
8268
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
8269
+ return {};
8270
+ }
8271
+ const record = value;
8272
+ const nestedDoc = record.doc;
8273
+ if (nestedDoc && typeof nestedDoc === "object" && !Array.isArray(nestedDoc)) {
8274
+ return nestedDoc;
8275
+ }
8276
+ return record;
8277
+ };
8267
8278
  var toEditorState = (doc) => {
8268
8279
  const emails = doc.emails && typeof doc.emails === "object" ? doc.emails : null;
8269
8280
  const adminRecipients = Array.isArray(emails?.adminRecipients) ? emails?.adminRecipients.map(
@@ -8417,7 +8428,7 @@ function AdminStudioFormDetailView(props) {
8417
8428
  if (!submissionsResponse.ok) {
8418
8429
  throw new Error(`Failed to load submissions (${submissionsResponse.status}).`);
8419
8430
  }
8420
- const nextDoc = await formResponse.json();
8431
+ const nextDoc = normalizeFormResponse(await formResponse.json());
8421
8432
  const submissionsPayload = await submissionsResponse.json();
8422
8433
  const nextSubmissions = Array.isArray(submissionsPayload.docs) ? submissionsPayload.docs : [];
8423
8434
  setDoc(nextDoc);
@@ -8474,7 +8485,7 @@ function AdminStudioFormDetailView(props) {
8474
8485
  if (!response.ok) {
8475
8486
  throw new Error(`Failed to save form (${response.status}).`);
8476
8487
  }
8477
- const nextDoc = await response.json();
8488
+ const nextDoc = normalizeFormResponse(await response.json());
8478
8489
  setDoc(nextDoc);
8479
8490
  setEditorState(toEditorState(nextDoc));
8480
8491
  setSavedMessage("Saved.");
@@ -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.");
@@ -1684,7 +1684,7 @@
1684
1684
  .orion-admin-workflow-node-number {
1685
1685
  box-sizing: border-box;
1686
1686
  height: 2rem;
1687
- padding-top: 2px;
1687
+ padding-top: 5px;
1688
1688
  width: 2rem;
1689
1689
  }
1690
1690
 
@@ -1802,7 +1802,7 @@
1802
1802
  .orion-admin-field-order {
1803
1803
  box-sizing: border-box;
1804
1804
  height: 1.75rem;
1805
- padding-top: 2px;
1805
+ padding-top: 5px;
1806
1806
  width: 1.75rem;
1807
1807
  }
1808
1808
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.30",
3
+ "version": "0.6.0-beta.32",
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",