@strapi/content-manager 0.0.0-experimental.71ed910bd859c7e558bd1c1042eaadb7d26fd22a → 0.0.0-experimental.7273fc63f5c2c8aa9e100655b1776f3e0621e61a

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.
Files changed (142) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-DP7AC0UU.js → ComponentConfigurationPage-D2_cVxXK.js} +4 -4
  2. package/dist/_chunks/{ComponentConfigurationPage-DP7AC0UU.js.map → ComponentConfigurationPage-D2_cVxXK.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-7-qB29e7.mjs → ComponentConfigurationPage-suSMW3KC.mjs} +4 -4
  4. package/dist/_chunks/{ComponentConfigurationPage-7-qB29e7.mjs.map → ComponentConfigurationPage-suSMW3KC.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-CI4XoymK.mjs → EditConfigurationPage-CBscKbxt.mjs} +4 -4
  6. package/dist/_chunks/{EditConfigurationPage-CI4XoymK.mjs.map → EditConfigurationPage-CBscKbxt.mjs.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-DITVliEI.js → EditConfigurationPage-Z_VzHVH4.js} +4 -4
  8. package/dist/_chunks/{EditConfigurationPage-DITVliEI.js.map → EditConfigurationPage-Z_VzHVH4.js.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-Dzpno8xI.mjs → EditViewPage-D5Zhyw_q.mjs} +10 -4
  10. package/dist/_chunks/EditViewPage-D5Zhyw_q.mjs.map +1 -0
  11. package/dist/_chunks/{EditViewPage-CUS2EAhB.js → EditViewPage-DzDDKiF5.js} +10 -4
  12. package/dist/_chunks/EditViewPage-DzDDKiF5.js.map +1 -0
  13. package/dist/_chunks/{Field-CtUU1Fg8.js → Field-CZHNLm_m.js} +42 -10
  14. package/dist/_chunks/Field-CZHNLm_m.js.map +1 -0
  15. package/dist/_chunks/{Field-B_jG_EV9.mjs → Field-FNlyAbcI.mjs} +42 -10
  16. package/dist/_chunks/Field-FNlyAbcI.mjs.map +1 -0
  17. package/dist/_chunks/{Form-DTqO0ymI.js → Form-DqPHDLuK.js} +3 -3
  18. package/dist/_chunks/Form-DqPHDLuK.js.map +1 -0
  19. package/dist/_chunks/{Form-BXHao2mZ.mjs → Form-Sq_OVNv-.mjs} +3 -3
  20. package/dist/_chunks/Form-Sq_OVNv-.mjs.map +1 -0
  21. package/dist/_chunks/{History-C_uSGzO5.js → History-B-ZiOAEg.js} +37 -40
  22. package/dist/_chunks/History-B-ZiOAEg.js.map +1 -0
  23. package/dist/_chunks/{History-2Ah2CQ4T.mjs → History-DlL3k_OW.mjs} +38 -41
  24. package/dist/_chunks/History-DlL3k_OW.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-nyuP7OSy.js → ListConfigurationPage-Cc0hLAoS.js} +3 -3
  26. package/dist/_chunks/{ListConfigurationPage-nyuP7OSy.js.map → ListConfigurationPage-Cc0hLAoS.js.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-BjSJlaoC.mjs → ListConfigurationPage-xj3cSF5M.mjs} +3 -3
  28. package/dist/_chunks/{ListConfigurationPage-BjSJlaoC.mjs.map → ListConfigurationPage-xj3cSF5M.mjs.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-B75x3nz2.mjs → ListViewPage-C9STpcYd.mjs} +15 -4
  30. package/dist/_chunks/{ListViewPage-B75x3nz2.mjs.map → ListViewPage-C9STpcYd.mjs.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-DHgHD8Xg.js → ListViewPage-D48T84aT.js} +15 -4
  32. package/dist/_chunks/ListViewPage-D48T84aT.js.map +1 -0
  33. package/dist/_chunks/{NoContentTypePage-CDUKdZ7d.js → NoContentTypePage-BnUmUnXQ.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-CDUKdZ7d.js.map → NoContentTypePage-BnUmUnXQ.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-DUacQSyF.mjs → NoContentTypePage-DpV_ouD6.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-DUacQSyF.mjs.map → NoContentTypePage-DpV_ouD6.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-SFllMekk.mjs → NoPermissionsPage-BeDixsE9.mjs} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-SFllMekk.mjs.map → NoPermissionsPage-BeDixsE9.mjs.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-zwIZydDI.js → NoPermissionsPage-z-CpOFfh.js} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-zwIZydDI.js.map → NoPermissionsPage-z-CpOFfh.js.map} +1 -1
  41. package/dist/_chunks/{Relations-D2NRW8fC.mjs → Relations-CTiimSAg.mjs} +65 -33
  42. package/dist/_chunks/Relations-CTiimSAg.mjs.map +1 -0
  43. package/dist/_chunks/{Relations-NFLaRNPr.js → Relations-Cs5vJLAp.js} +64 -32
  44. package/dist/_chunks/Relations-Cs5vJLAp.js.map +1 -0
  45. package/dist/_chunks/{en-BlhnxQfj.js → en-Bm0D0IWz.js} +7 -7
  46. package/dist/_chunks/{en-BlhnxQfj.js.map → en-Bm0D0IWz.js.map} +1 -1
  47. package/dist/_chunks/{en-C8YBvRrK.mjs → en-DKV44jRb.mjs} +7 -7
  48. package/dist/_chunks/{en-C8YBvRrK.mjs.map → en-DKV44jRb.mjs.map} +1 -1
  49. package/dist/_chunks/{fr-B7kGGg3E.js → fr-C6t7ywEg.js} +12 -2
  50. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-C6t7ywEg.js.map} +1 -1
  51. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr-DxrTDLl6.mjs} +12 -2
  52. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr-DxrTDLl6.mjs.map} +1 -1
  53. package/dist/_chunks/{index-C9HxCo5R.mjs → index-DUZzV11o.mjs} +119 -84
  54. package/dist/_chunks/index-DUZzV11o.mjs.map +1 -0
  55. package/dist/_chunks/{index-ovJRE1FM.js → index-dFQ_8EM3.js} +119 -83
  56. package/dist/_chunks/index-dFQ_8EM3.js.map +1 -0
  57. package/dist/_chunks/{layout-UNWstw_s.js → layout-Bu-ET7w6.js} +3 -3
  58. package/dist/_chunks/{layout-UNWstw_s.js.map → layout-Bu-ET7w6.js.map} +1 -1
  59. package/dist/_chunks/{layout-DaUjDiWQ.mjs → layout-C-eg7m9Y.mjs} +3 -3
  60. package/dist/_chunks/{layout-DaUjDiWQ.mjs.map → layout-C-eg7m9Y.mjs.map} +1 -1
  61. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  62. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  63. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  64. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  65. package/dist/_chunks/{relations-D8iFAeRu.mjs → relations-Cj61Oyt2.mjs} +3 -7
  66. package/dist/_chunks/relations-Cj61Oyt2.mjs.map +1 -0
  67. package/dist/_chunks/{relations-NN3coOG5.js → relations-isLeDaA0.js} +3 -7
  68. package/dist/_chunks/relations-isLeDaA0.js.map +1 -0
  69. package/dist/admin/index.js +1 -1
  70. package/dist/admin/index.mjs +1 -1
  71. package/dist/admin/src/preview/constants.d.ts +1 -0
  72. package/dist/admin/src/preview/index.d.ts +4 -0
  73. package/dist/server/index.js +351 -146
  74. package/dist/server/index.js.map +1 -1
  75. package/dist/server/index.mjs +351 -146
  76. package/dist/server/index.mjs.map +1 -1
  77. package/dist/server/src/bootstrap.d.ts.map +1 -1
  78. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  79. package/dist/server/src/controllers/index.d.ts.map +1 -1
  80. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  81. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  82. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  83. package/dist/server/src/history/services/history.d.ts.map +1 -1
  84. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  85. package/dist/server/src/history/services/utils.d.ts +2 -3
  86. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  87. package/dist/server/src/index.d.ts +4 -4
  88. package/dist/server/src/preview/constants.d.ts +2 -0
  89. package/dist/server/src/preview/constants.d.ts.map +1 -0
  90. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  91. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  92. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  93. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  94. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  95. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  96. package/dist/server/src/preview/index.d.ts +4 -0
  97. package/dist/server/src/preview/index.d.ts.map +1 -0
  98. package/dist/server/src/preview/routes/index.d.ts +8 -0
  99. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  100. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  101. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  102. package/dist/server/src/preview/services/index.d.ts +15 -0
  103. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  104. package/dist/server/src/preview/services/preview-config.d.ts +30 -0
  105. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  106. package/dist/server/src/preview/services/preview.d.ts +12 -0
  107. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  108. package/dist/server/src/preview/utils.d.ts +18 -0
  109. package/dist/server/src/preview/utils.d.ts.map +1 -0
  110. package/dist/server/src/routes/index.d.ts.map +1 -1
  111. package/dist/server/src/services/document-metadata.d.ts +8 -8
  112. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  113. package/dist/server/src/services/index.d.ts +4 -4
  114. package/dist/server/src/services/index.d.ts.map +1 -1
  115. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  116. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  117. package/dist/server/src/utils/index.d.ts +2 -0
  118. package/dist/server/src/utils/index.d.ts.map +1 -1
  119. package/dist/shared/contracts/index.d.ts +1 -0
  120. package/dist/shared/contracts/index.d.ts.map +1 -1
  121. package/dist/shared/contracts/preview.d.ts +27 -0
  122. package/dist/shared/contracts/preview.d.ts.map +1 -0
  123. package/dist/shared/index.js +4 -0
  124. package/dist/shared/index.js.map +1 -1
  125. package/dist/shared/index.mjs +4 -0
  126. package/dist/shared/index.mjs.map +1 -1
  127. package/package.json +8 -8
  128. package/dist/_chunks/EditViewPage-CUS2EAhB.js.map +0 -1
  129. package/dist/_chunks/EditViewPage-Dzpno8xI.mjs.map +0 -1
  130. package/dist/_chunks/Field-B_jG_EV9.mjs.map +0 -1
  131. package/dist/_chunks/Field-CtUU1Fg8.js.map +0 -1
  132. package/dist/_chunks/Form-BXHao2mZ.mjs.map +0 -1
  133. package/dist/_chunks/Form-DTqO0ymI.js.map +0 -1
  134. package/dist/_chunks/History-2Ah2CQ4T.mjs.map +0 -1
  135. package/dist/_chunks/History-C_uSGzO5.js.map +0 -1
  136. package/dist/_chunks/ListViewPage-DHgHD8Xg.js.map +0 -1
  137. package/dist/_chunks/Relations-D2NRW8fC.mjs.map +0 -1
  138. package/dist/_chunks/Relations-NFLaRNPr.js.map +0 -1
  139. package/dist/_chunks/index-C9HxCo5R.mjs.map +0 -1
  140. package/dist/_chunks/index-ovJRE1FM.js.map +0 -1
  141. package/dist/_chunks/relations-D8iFAeRu.mjs.map +0 -1
  142. package/dist/_chunks/relations-NN3coOG5.js.map +0 -1
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const strapiAdmin = require("@strapi/admin/strapi-admin");
5
5
  const React = require("react");
6
6
  const designSystem = require("@strapi/design-system");
7
+ const mapValues = require("lodash/fp/mapValues");
7
8
  const reactIntl = require("react-intl");
8
9
  const reactRouterDom = require("react-router-dom");
9
10
  const yup = require("yup");
@@ -32,6 +33,7 @@ function _interopNamespace(e) {
32
33
  return Object.freeze(n);
33
34
  }
34
35
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
36
+ const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
35
37
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
36
38
  const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
37
39
  const __variableDynamicImportRuntimeHelper = (glob, path) => {
@@ -121,6 +123,7 @@ const DocumentRBAC = ({ children, permissions }) => {
121
123
  if (!slug) {
122
124
  throw new Error("Cannot find the slug param in the URL");
123
125
  }
126
+ const [{ rawQuery }] = strapiAdmin.useQueryParams();
124
127
  const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
125
128
  const contentTypePermissions = React__namespace.useMemo(() => {
126
129
  const contentTypePermissions2 = userPermissions.filter(
@@ -131,7 +134,14 @@ const DocumentRBAC = ({ children, permissions }) => {
131
134
  return { ...acc, [action]: [permission] };
132
135
  }, {});
133
136
  }, [slug, userPermissions]);
134
- const { isLoading, allowedActions } = strapiAdmin.useRBAC(contentTypePermissions, permissions ?? void 0);
137
+ const { isLoading, allowedActions } = strapiAdmin.useRBAC(
138
+ contentTypePermissions,
139
+ permissions ?? void 0,
140
+ // TODO: useRBAC context should be typed and built differently
141
+ // We are passing raw query as context to the hook so that it can
142
+ // rely on the locale provided from DocumentRBAC for its permission calculations.
143
+ rawQuery
144
+ );
135
145
  const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
136
146
  const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
137
147
  const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
@@ -283,7 +293,7 @@ const documentApi = contentManagerApi.injectEndpoints({
283
293
  */
284
294
  getAllDocuments: builder.query({
285
295
  query: ({ model, params }) => ({
286
- url: `/content-manager/collection-types/${model}`,
296
+ url: `/content-manager/collection-types/${model}${params ? `?${params}` : ""}`,
287
297
  method: "GET",
288
298
  config: {
289
299
  params
@@ -482,6 +492,24 @@ const buildValidParams = (query) => {
482
492
  const isBaseQueryError = (error) => {
483
493
  return error.name !== void 0;
484
494
  };
495
+ const arrayValidator = (attribute, options) => ({
496
+ message: strapiAdmin.translatedErrors.required,
497
+ test(value) {
498
+ if (options.status === "draft") {
499
+ return true;
500
+ }
501
+ if (!attribute.required) {
502
+ return true;
503
+ }
504
+ if (!value) {
505
+ return false;
506
+ }
507
+ if (Array.isArray(value) && value.length === 0) {
508
+ return false;
509
+ }
510
+ return true;
511
+ }
512
+ });
485
513
  const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
486
514
  const createModelSchema = (attributes2) => yup__namespace.object().shape(
487
515
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
@@ -489,6 +517,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
489
517
  return acc;
490
518
  }
491
519
  const validations = [
520
+ addNullableValidation,
492
521
  addRequiredValidation,
493
522
  addMinLengthValidation,
494
523
  addMaxLengthValidation,
@@ -505,12 +534,12 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
505
534
  ...acc,
506
535
  [name]: transformSchema(
507
536
  yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
508
- )
537
+ ).test(arrayValidator(attribute, options))
509
538
  };
510
539
  } else {
511
540
  return {
512
541
  ...acc,
513
- [name]: transformSchema(createModelSchema(attributes3))
542
+ [name]: transformSchema(createModelSchema(attributes3).nullable())
514
543
  };
515
544
  }
516
545
  }
@@ -532,7 +561,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
532
561
  }
533
562
  )
534
563
  )
535
- )
564
+ ).test(arrayValidator(attribute, options))
536
565
  };
537
566
  case "relation":
538
567
  return {
@@ -630,17 +659,17 @@ const nullableSchema = (schema) => {
630
659
  schema
631
660
  );
632
661
  };
662
+ const addNullableValidation = () => (schema) => {
663
+ return nullableSchema(schema);
664
+ };
633
665
  const addRequiredValidation = (attribute, options) => (schema) => {
634
- if (options.status === "draft") {
635
- return nullableSchema(schema);
636
- }
637
- if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
638
- return schema.min(1, strapiAdmin.translatedErrors.required);
666
+ if (options.status === "draft" || !attribute.required) {
667
+ return schema;
639
668
  }
640
- if (attribute.required && attribute.type !== "relation") {
669
+ if (attribute.required && "required" in schema) {
641
670
  return schema.required(strapiAdmin.translatedErrors.required);
642
671
  }
643
- return nullableSchema(schema);
672
+ return schema;
644
673
  };
645
674
  const addMinLengthValidation = (attribute, options) => (schema) => {
646
675
  if (options.status === "draft") {
@@ -668,31 +697,12 @@ const addMaxLengthValidation = (attribute) => (schema) => {
668
697
  return schema;
669
698
  };
670
699
  const addMinValidation = (attribute, options) => (schema) => {
671
- if ("min" in attribute) {
700
+ if (options.status === "draft") {
701
+ return schema;
702
+ }
703
+ if ("min" in attribute && "min" in schema) {
672
704
  const min = toInteger(attribute.min);
673
- if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
674
- if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
675
- return schema.test(
676
- "custom-min",
677
- {
678
- ...strapiAdmin.translatedErrors.min,
679
- values: {
680
- min: attribute.min
681
- }
682
- },
683
- (value) => {
684
- if (!value) {
685
- return true;
686
- }
687
- if (Array.isArray(value) && value.length === 0) {
688
- return true;
689
- }
690
- return value.length >= min;
691
- }
692
- );
693
- }
694
- }
695
- if ("min" in schema && min) {
705
+ if (min) {
696
706
  return schema.min(min, {
697
707
  ...strapiAdmin.translatedErrors.min,
698
708
  values: {
@@ -981,9 +991,10 @@ const formatEditLayout = (data, {
981
991
  currentPanelIndex += 2;
982
992
  } else {
983
993
  if (!panels[currentPanelIndex]) {
984
- panels.push([]);
994
+ panels.push([row]);
995
+ } else {
996
+ panels[currentPanelIndex].push(row);
985
997
  }
986
- panels[currentPanelIndex].push(row);
987
998
  }
988
999
  return panels;
989
1000
  }, []);
@@ -1187,16 +1198,18 @@ const useDoc = () => {
1187
1198
  if (!slug) {
1188
1199
  throw new Error("Could not find model in url params");
1189
1200
  }
1201
+ const document = useDocument(
1202
+ { documentId: origin || id, model: slug, collectionType, params },
1203
+ {
1204
+ skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1205
+ }
1206
+ );
1207
+ const returnId = origin || id === "create" ? void 0 : id;
1190
1208
  return {
1191
1209
  collectionType,
1192
1210
  model: slug,
1193
- id: origin || id === "create" ? void 0 : id,
1194
- ...useDocument(
1195
- { documentId: origin || id, model: slug, collectionType, params },
1196
- {
1197
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1198
- }
1199
- )
1211
+ id: returnId,
1212
+ ...document
1200
1213
  };
1201
1214
  };
1202
1215
  const useContentManagerContext = () => {
@@ -1239,9 +1252,6 @@ const useContentManagerContext = () => {
1239
1252
  };
1240
1253
  };
1241
1254
  const prefixPluginTranslations = (trad, pluginId) => {
1242
- if (!pluginId) {
1243
- throw new TypeError("pluginId can't be empty");
1244
- }
1245
1255
  return Object.keys(trad).reduce((acc, current) => {
1246
1256
  acc[`${pluginId}.${current}`] = trad[current];
1247
1257
  return acc;
@@ -1676,7 +1686,7 @@ const useDocumentActions = () => {
1676
1686
  };
1677
1687
  };
1678
1688
  const ProtectedHistoryPage = React.lazy(
1679
- () => Promise.resolve().then(() => require("./History-C_uSGzO5.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1689
+ () => Promise.resolve().then(() => require("./History-B-ZiOAEg.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1680
1690
  );
1681
1691
  const routes$1 = [
1682
1692
  {
@@ -1689,31 +1699,31 @@ const routes$1 = [
1689
1699
  }
1690
1700
  ];
1691
1701
  const ProtectedEditViewPage = React.lazy(
1692
- () => Promise.resolve().then(() => require("./EditViewPage-CUS2EAhB.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1702
+ () => Promise.resolve().then(() => require("./EditViewPage-DzDDKiF5.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1693
1703
  );
1694
1704
  const ProtectedListViewPage = React.lazy(
1695
- () => Promise.resolve().then(() => require("./ListViewPage-DHgHD8Xg.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1705
+ () => Promise.resolve().then(() => require("./ListViewPage-D48T84aT.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1696
1706
  );
1697
1707
  const ProtectedListConfiguration = React.lazy(
1698
- () => Promise.resolve().then(() => require("./ListConfigurationPage-nyuP7OSy.js")).then((mod) => ({
1708
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-Cc0hLAoS.js")).then((mod) => ({
1699
1709
  default: mod.ProtectedListConfiguration
1700
1710
  }))
1701
1711
  );
1702
1712
  const ProtectedEditConfigurationPage = React.lazy(
1703
- () => Promise.resolve().then(() => require("./EditConfigurationPage-DITVliEI.js")).then((mod) => ({
1713
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-Z_VzHVH4.js")).then((mod) => ({
1704
1714
  default: mod.ProtectedEditConfigurationPage
1705
1715
  }))
1706
1716
  );
1707
1717
  const ProtectedComponentConfigurationPage = React.lazy(
1708
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-DP7AC0UU.js")).then((mod) => ({
1718
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-D2_cVxXK.js")).then((mod) => ({
1709
1719
  default: mod.ProtectedComponentConfigurationPage
1710
1720
  }))
1711
1721
  );
1712
1722
  const NoPermissions = React.lazy(
1713
- () => Promise.resolve().then(() => require("./NoPermissionsPage-zwIZydDI.js")).then((mod) => ({ default: mod.NoPermissions }))
1723
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-z-CpOFfh.js")).then((mod) => ({ default: mod.NoPermissions }))
1714
1724
  );
1715
1725
  const NoContentType = React.lazy(
1716
- () => Promise.resolve().then(() => require("./NoContentTypePage-CDUKdZ7d.js")).then((mod) => ({ default: mod.NoContentType }))
1726
+ () => Promise.resolve().then(() => require("./NoContentTypePage-BnUmUnXQ.js")).then((mod) => ({ default: mod.NoContentType }))
1717
1727
  );
1718
1728
  const CollectionTypePages = () => {
1719
1729
  const { collectionType } = reactRouterDom.useParams();
@@ -2067,6 +2077,18 @@ const DocumentActionModal = ({
2067
2077
  typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
2068
2078
  ] }) });
2069
2079
  };
2080
+ const transformData = (data) => {
2081
+ if (Array.isArray(data)) {
2082
+ return data.map(transformData);
2083
+ }
2084
+ if (typeof data === "object" && data !== null) {
2085
+ if ("apiData" in data) {
2086
+ return data.apiData;
2087
+ }
2088
+ return mapValues__default.default(transformData)(data);
2089
+ }
2090
+ return data;
2091
+ };
2070
2092
  const PublishAction$1 = ({
2071
2093
  activeTab,
2072
2094
  documentId,
@@ -2160,7 +2182,9 @@ const PublishAction$1 = ({
2160
2182
  const performPublish = async () => {
2161
2183
  setSubmitting(true);
2162
2184
  try {
2163
- const { errors } = await validate();
2185
+ const { errors } = await validate(true, {
2186
+ status: "published"
2187
+ });
2164
2188
  if (errors) {
2165
2189
  toggleNotification({
2166
2190
  type: "danger",
@@ -2178,7 +2202,7 @@ const PublishAction$1 = ({
2178
2202
  documentId,
2179
2203
  params
2180
2204
  },
2181
- formValues
2205
+ transformData(formValues)
2182
2206
  );
2183
2207
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2184
2208
  navigate({
@@ -2274,18 +2298,18 @@ const UpdateAction = ({
2274
2298
  onClick: async () => {
2275
2299
  setSubmitting(true);
2276
2300
  try {
2277
- if (activeTab !== "draft") {
2278
- const { errors } = await validate();
2279
- if (errors) {
2280
- toggleNotification({
2281
- type: "danger",
2282
- message: formatMessage({
2283
- id: "content-manager.validation.error",
2284
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2285
- })
2286
- });
2287
- return;
2288
- }
2301
+ const { errors } = await validate(true, {
2302
+ status: "draft"
2303
+ });
2304
+ if (errors) {
2305
+ toggleNotification({
2306
+ type: "danger",
2307
+ message: formatMessage({
2308
+ id: "content-manager.validation.error",
2309
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2310
+ })
2311
+ });
2312
+ return;
2289
2313
  }
2290
2314
  if (isCloning) {
2291
2315
  const res = await clone(
@@ -2294,7 +2318,7 @@ const UpdateAction = ({
2294
2318
  documentId: cloneMatch.params.origin,
2295
2319
  params
2296
2320
  },
2297
- document
2321
+ transformData(document)
2298
2322
  );
2299
2323
  if ("data" in res) {
2300
2324
  navigate(
@@ -2315,7 +2339,7 @@ const UpdateAction = ({
2315
2339
  documentId,
2316
2340
  params
2317
2341
  },
2318
- document
2342
+ transformData(document)
2319
2343
  );
2320
2344
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2321
2345
  setErrors(formatValidationErrors(res.error));
@@ -2328,7 +2352,7 @@ const UpdateAction = ({
2328
2352
  model,
2329
2353
  params
2330
2354
  },
2331
- document
2355
+ transformData(document)
2332
2356
  );
2333
2357
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2334
2358
  navigate(
@@ -2667,12 +2691,12 @@ const Information = ({ activeTab }) => {
2667
2691
  isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2668
2692
  label: formatMessage({
2669
2693
  id: "content-manager.containers.edit.information.last-published.label",
2670
- defaultMessage: "Last published"
2694
+ defaultMessage: "Published"
2671
2695
  }),
2672
2696
  value: formatMessage(
2673
2697
  {
2674
2698
  id: "content-manager.containers.edit.information.last-published.value",
2675
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2699
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2676
2700
  },
2677
2701
  {
2678
2702
  time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
@@ -2685,12 +2709,12 @@ const Information = ({ activeTab }) => {
2685
2709
  isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2686
2710
  label: formatMessage({
2687
2711
  id: "content-manager.containers.edit.information.last-draft.label",
2688
- defaultMessage: "Last draft"
2712
+ defaultMessage: "Updated"
2689
2713
  }),
2690
2714
  value: formatMessage(
2691
2715
  {
2692
2716
  id: "content-manager.containers.edit.information.last-draft.value",
2693
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2717
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2694
2718
  },
2695
2719
  {
2696
2720
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2708,12 +2732,12 @@ const Information = ({ activeTab }) => {
2708
2732
  isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2709
2733
  label: formatMessage({
2710
2734
  id: "content-manager.containers.edit.information.document.label",
2711
- defaultMessage: "Document"
2735
+ defaultMessage: "Created"
2712
2736
  }),
2713
2737
  value: formatMessage(
2714
2738
  {
2715
2739
  id: "content-manager.containers.edit.information.document.value",
2716
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2740
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2717
2741
  },
2718
2742
  {
2719
2743
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3016,7 +3040,7 @@ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
3016
3040
  justifyContent: "stretch",
3017
3041
  alignItems: "flex-start",
3018
3042
  children: [
3019
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
3043
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3020
3044
  children
3021
3045
  ]
3022
3046
  }
@@ -3999,6 +4023,15 @@ const { setInitialData } = actions;
3999
4023
  const reducer = toolkit.combineReducers({
4000
4024
  app: reducer$1
4001
4025
  });
4026
+ const FEATURE_ID = "preview";
4027
+ const previewAdmin = {
4028
+ bootstrap(app) {
4029
+ if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4030
+ return {};
4031
+ }
4032
+ console.log("Bootstrapping preview admin");
4033
+ }
4034
+ };
4002
4035
  const index = {
4003
4036
  register(app) {
4004
4037
  const cm = new ContentManagerPlugin();
@@ -4018,7 +4051,7 @@ const index = {
4018
4051
  app.router.addRoute({
4019
4052
  path: "content-manager/*",
4020
4053
  lazy: async () => {
4021
- const { Layout } = await Promise.resolve().then(() => require("./layout-UNWstw_s.js"));
4054
+ const { Layout } = await Promise.resolve().then(() => require("./layout-Bu-ET7w6.js"));
4022
4055
  return {
4023
4056
  Component: Layout
4024
4057
  };
@@ -4031,11 +4064,14 @@ const index = {
4031
4064
  if (typeof historyAdmin.bootstrap === "function") {
4032
4065
  historyAdmin.bootstrap(app);
4033
4066
  }
4067
+ if (typeof previewAdmin.bootstrap === "function") {
4068
+ previewAdmin.bootstrap(app);
4069
+ }
4034
4070
  },
4035
4071
  async registerTrads({ locales }) {
4036
4072
  const importedTrads = await Promise.all(
4037
4073
  locales.map((locale) => {
4038
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BlhnxQfj.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4074
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Bm0D0IWz.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-C6t7ywEg.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4039
4075
  return {
4040
4076
  data: prefixPluginTranslations(data, PLUGIN_ID),
4041
4077
  locale
@@ -4094,4 +4130,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
4094
4130
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
4095
4131
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
4096
4132
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
4097
- //# sourceMappingURL=index-ovJRE1FM.js.map
4133
+ //# sourceMappingURL=index-dFQ_8EM3.js.map