@strapi/content-manager 0.0.0-experimental.7b750d18de359d0a42233cb8707e3c31c5983345 → 0.0.0-experimental.7bd770909ce799cf6fc76b7ebccd6d3ce2e377b5

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 (185) hide show
  1. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  2. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-hLMNf7KI.mjs → ComponentConfigurationPage-BgCLcjXO.mjs} +4 -4
  4. package/dist/_chunks/{ComponentConfigurationPage-hLMNf7KI.mjs.map → ComponentConfigurationPage-BgCLcjXO.mjs.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-DnnZJc1F.js → ComponentConfigurationPage-DywpTZeV.js} +5 -6
  6. package/dist/_chunks/{ComponentConfigurationPage-DnnZJc1F.js.map → ComponentConfigurationPage-DywpTZeV.js.map} +1 -1
  7. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  9. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  10. package/dist/_chunks/{EditConfigurationPage-Dh6sq-G4.mjs → EditConfigurationPage-BNjOAHNS.mjs} +4 -4
  11. package/dist/_chunks/{EditConfigurationPage-Dh6sq-G4.mjs.map → EditConfigurationPage-BNjOAHNS.mjs.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-CpLj5gYZ.js → EditConfigurationPage-CxRlP5if.js} +5 -6
  13. package/dist/_chunks/{EditConfigurationPage-CpLj5gYZ.js.map → EditConfigurationPage-CxRlP5if.js.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-D2QVRr_2.js → EditViewPage-BRewdTqE.js} +50 -11
  15. package/dist/_chunks/EditViewPage-BRewdTqE.js.map +1 -0
  16. package/dist/_chunks/{EditViewPage-BU1ugeVi.mjs → EditViewPage-CD_hqc1J.mjs} +50 -10
  17. package/dist/_chunks/EditViewPage-CD_hqc1J.mjs.map +1 -0
  18. package/dist/_chunks/{Field-VSPY6uzs.mjs → Field-BPkQ-3Ku.mjs} +129 -85
  19. package/dist/_chunks/Field-BPkQ-3Ku.mjs.map +1 -0
  20. package/dist/_chunks/{Field-BEDX9i_V.js → Field-DwvmENVf.js} +130 -87
  21. package/dist/_chunks/Field-DwvmENVf.js.map +1 -0
  22. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  23. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  24. package/dist/_chunks/{Form-DCaY8xBX.js → Form-C_Gwv8P_.js} +6 -7
  25. package/dist/_chunks/Form-C_Gwv8P_.js.map +1 -0
  26. package/dist/_chunks/{Form-05Oaes1N.mjs → Form-Czi0cf_2.mjs} +4 -4
  27. package/dist/_chunks/Form-Czi0cf_2.mjs.map +1 -0
  28. package/dist/_chunks/{History-BrJ1tUvt.js → History-C1TKAig-.js} +42 -100
  29. package/dist/_chunks/History-C1TKAig-.js.map +1 -0
  30. package/dist/_chunks/{History-BqO2G3MV.mjs → History-CIQHyi4T.mjs} +43 -100
  31. package/dist/_chunks/History-CIQHyi4T.mjs.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-Eane5LKE.js → ListConfigurationPage-D-NGRLYu.js} +7 -7
  33. package/dist/_chunks/ListConfigurationPage-D-NGRLYu.js.map +1 -0
  34. package/dist/_chunks/{ListConfigurationPage-C6rsFlme.mjs → ListConfigurationPage-DcZsfyEL.mjs} +7 -6
  35. package/dist/_chunks/ListConfigurationPage-DcZsfyEL.mjs.map +1 -0
  36. package/dist/_chunks/{ListViewPage-yE_zYhcI.mjs → ListViewPage-C10McTK1.mjs} +62 -39
  37. package/dist/_chunks/ListViewPage-C10McTK1.mjs.map +1 -0
  38. package/dist/_chunks/{ListViewPage-Coj-RPsx.js → ListViewPage-xv5IQoZp.js} +63 -41
  39. package/dist/_chunks/ListViewPage-xv5IQoZp.js.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-NW_FSVdY.mjs → NoContentTypePage-CPc0Cd3S.mjs} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-NW_FSVdY.mjs.map → NoContentTypePage-CPc0Cd3S.mjs.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-BDJ0dshy.js → NoContentTypePage-Dzw5Yj5u.js} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-BDJ0dshy.js.map → NoContentTypePage-Dzw5Yj5u.js.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-BOtb5FTM.js → NoPermissionsPage-DAe5CDCC.js} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-BOtb5FTM.js.map → NoPermissionsPage-DAe5CDCC.js.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-h0I3ImsX.mjs → NoPermissionsPage-wfPBh2_0.mjs} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-h0I3ImsX.mjs.map → NoPermissionsPage-wfPBh2_0.mjs.map} +1 -1
  48. package/dist/_chunks/Preview-B7LyGT_b.js +290 -0
  49. package/dist/_chunks/Preview-B7LyGT_b.js.map +1 -0
  50. package/dist/_chunks/Preview-BVFFm7uB.mjs +272 -0
  51. package/dist/_chunks/Preview-BVFFm7uB.mjs.map +1 -0
  52. package/dist/_chunks/{Relations-CVh0DOKv.js → Relations-BmYR1AjY.js} +75 -42
  53. package/dist/_chunks/Relations-BmYR1AjY.js.map +1 -0
  54. package/dist/_chunks/{Relations-FP0uWpBz.mjs → Relations-JPhWxk-s.mjs} +75 -41
  55. package/dist/_chunks/Relations-JPhWxk-s.mjs.map +1 -0
  56. package/dist/_chunks/{en-BlhnxQfj.js → en-BK8Xyl5I.js} +22 -10
  57. package/dist/_chunks/{en-BlhnxQfj.js.map → en-BK8Xyl5I.js.map} +1 -1
  58. package/dist/_chunks/{en-C8YBvRrK.mjs → en-Dtk_ot79.mjs} +22 -10
  59. package/dist/_chunks/{en-C8YBvRrK.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  60. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  61. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  62. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  63. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  64. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  65. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  66. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  67. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  68. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  69. package/dist/_chunks/{index-DTKVhcla.js → index-C2Q_PLWj.js} +299 -171
  70. package/dist/_chunks/index-C2Q_PLWj.js.map +1 -0
  71. package/dist/_chunks/{index-CPCHQ3X_.mjs → index-DLIkNVnQ.mjs} +302 -174
  72. package/dist/_chunks/index-DLIkNVnQ.mjs.map +1 -0
  73. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  74. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  75. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  76. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  77. package/dist/_chunks/{layout-CWgZzMYf.js → layout-7AsWJzZJ.js} +5 -6
  78. package/dist/_chunks/{layout-CWgZzMYf.js.map → layout-7AsWJzZJ.js.map} +1 -1
  79. package/dist/_chunks/{layout-B4UhJ8MJ.mjs → layout-qE8qkNH_.mjs} +4 -4
  80. package/dist/_chunks/{layout-B4UhJ8MJ.mjs.map → layout-qE8qkNH_.mjs.map} +1 -1
  81. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  82. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  83. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  84. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  85. package/dist/_chunks/{relations-B83Ge9a7.mjs → relations-BjHH_1Am.mjs} +6 -7
  86. package/dist/_chunks/relations-BjHH_1Am.mjs.map +1 -0
  87. package/dist/_chunks/{relations-D81a_2zw.js → relations-EifVzf_2.js} +6 -7
  88. package/dist/_chunks/relations-EifVzf_2.js.map +1 -0
  89. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
  90. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
  91. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  92. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  93. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  94. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  95. package/dist/admin/index.js +1 -1
  96. package/dist/admin/index.mjs +4 -4
  97. package/dist/admin/src/hooks/useDocument.d.ts +2 -0
  98. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  99. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
  100. package/dist/admin/src/pages/EditView/components/Header.d.ts +1 -0
  101. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  102. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  103. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  104. package/dist/admin/src/preview/constants.d.ts +1 -0
  105. package/dist/admin/src/preview/index.d.ts +4 -0
  106. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  107. package/dist/admin/src/preview/routes.d.ts +3 -0
  108. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  109. package/dist/admin/src/router.d.ts +1 -1
  110. package/dist/admin/src/services/documents.d.ts +0 -3
  111. package/dist/server/index.js +435 -193
  112. package/dist/server/index.js.map +1 -1
  113. package/dist/server/index.mjs +435 -192
  114. package/dist/server/index.mjs.map +1 -1
  115. package/dist/server/src/bootstrap.d.ts.map +1 -1
  116. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  117. package/dist/server/src/controllers/index.d.ts.map +1 -1
  118. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  119. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  120. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  121. package/dist/server/src/history/services/history.d.ts.map +1 -1
  122. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  123. package/dist/server/src/history/services/utils.d.ts +2 -3
  124. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  125. package/dist/server/src/index.d.ts +4 -4
  126. package/dist/server/src/preview/constants.d.ts +2 -0
  127. package/dist/server/src/preview/constants.d.ts.map +1 -0
  128. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  129. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  130. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  131. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  132. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  133. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  134. package/dist/server/src/preview/index.d.ts +4 -0
  135. package/dist/server/src/preview/index.d.ts.map +1 -0
  136. package/dist/server/src/preview/routes/index.d.ts +8 -0
  137. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  138. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  139. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  140. package/dist/server/src/preview/services/index.d.ts +16 -0
  141. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  142. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  143. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  144. package/dist/server/src/preview/services/preview.d.ts +12 -0
  145. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  146. package/dist/server/src/preview/utils.d.ts +19 -0
  147. package/dist/server/src/preview/utils.d.ts.map +1 -0
  148. package/dist/server/src/register.d.ts.map +1 -1
  149. package/dist/server/src/routes/index.d.ts.map +1 -1
  150. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  151. package/dist/server/src/services/document-metadata.d.ts +8 -8
  152. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  153. package/dist/server/src/services/index.d.ts +4 -4
  154. package/dist/server/src/services/index.d.ts.map +1 -1
  155. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  156. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  157. package/dist/server/src/utils/index.d.ts +2 -0
  158. package/dist/server/src/utils/index.d.ts.map +1 -1
  159. package/dist/shared/contracts/index.d.ts +1 -0
  160. package/dist/shared/contracts/index.d.ts.map +1 -1
  161. package/dist/shared/contracts/preview.d.ts +27 -0
  162. package/dist/shared/contracts/preview.d.ts.map +1 -0
  163. package/dist/shared/index.js +4 -0
  164. package/dist/shared/index.js.map +1 -1
  165. package/dist/shared/index.mjs +4 -0
  166. package/dist/shared/index.mjs.map +1 -1
  167. package/package.json +12 -12
  168. package/dist/_chunks/EditViewPage-BU1ugeVi.mjs.map +0 -1
  169. package/dist/_chunks/EditViewPage-D2QVRr_2.js.map +0 -1
  170. package/dist/_chunks/Field-BEDX9i_V.js.map +0 -1
  171. package/dist/_chunks/Field-VSPY6uzs.mjs.map +0 -1
  172. package/dist/_chunks/Form-05Oaes1N.mjs.map +0 -1
  173. package/dist/_chunks/Form-DCaY8xBX.js.map +0 -1
  174. package/dist/_chunks/History-BqO2G3MV.mjs.map +0 -1
  175. package/dist/_chunks/History-BrJ1tUvt.js.map +0 -1
  176. package/dist/_chunks/ListConfigurationPage-C6rsFlme.mjs.map +0 -1
  177. package/dist/_chunks/ListConfigurationPage-Eane5LKE.js.map +0 -1
  178. package/dist/_chunks/ListViewPage-Coj-RPsx.js.map +0 -1
  179. package/dist/_chunks/ListViewPage-yE_zYhcI.mjs.map +0 -1
  180. package/dist/_chunks/Relations-CVh0DOKv.js.map +0 -1
  181. package/dist/_chunks/Relations-FP0uWpBz.mjs.map +0 -1
  182. package/dist/_chunks/index-CPCHQ3X_.mjs.map +0 -1
  183. package/dist/_chunks/index-DTKVhcla.js.map +0 -1
  184. package/dist/_chunks/relations-B83Ge9a7.mjs.map +0 -1
  185. package/dist/_chunks/relations-D81a_2zw.js.map +0 -1
@@ -4,18 +4,18 @@ 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");
10
+ const styledComponents = require("styled-components");
9
11
  const yup = require("yup");
12
+ const qs = require("qs");
10
13
  const pipe = require("lodash/fp/pipe");
11
14
  const dateFns = require("date-fns");
12
- const styledComponents = require("styled-components");
13
- const qs = require("qs");
14
15
  const toolkit = require("@reduxjs/toolkit");
15
16
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
17
  function _interopNamespace(e) {
17
- if (e && e.__esModule)
18
- return e;
18
+ if (e && e.__esModule) return e;
19
19
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
20
20
  if (e) {
21
21
  for (const k in e) {
@@ -32,15 +32,23 @@ function _interopNamespace(e) {
32
32
  return Object.freeze(n);
33
33
  }
34
34
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
35
+ const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
35
36
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
36
37
  const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
37
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
38
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
38
39
  const v = glob[path];
39
40
  if (v) {
40
41
  return typeof v === "function" ? v() : Promise.resolve(v);
41
42
  }
42
43
  return new Promise((_, reject) => {
43
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
44
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
45
+ reject.bind(
46
+ null,
47
+ new Error(
48
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
49
+ )
50
+ )
51
+ );
44
52
  });
45
53
  };
46
54
  const PLUGIN_ID = "content-manager";
@@ -121,6 +129,7 @@ const DocumentRBAC = ({ children, permissions }) => {
121
129
  if (!slug) {
122
130
  throw new Error("Cannot find the slug param in the URL");
123
131
  }
132
+ const [{ rawQuery }] = strapiAdmin.useQueryParams();
124
133
  const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
125
134
  const contentTypePermissions = React__namespace.useMemo(() => {
126
135
  const contentTypePermissions2 = userPermissions.filter(
@@ -131,7 +140,14 @@ const DocumentRBAC = ({ children, permissions }) => {
131
140
  return { ...acc, [action]: [permission] };
132
141
  }, {});
133
142
  }, [slug, userPermissions]);
134
- const { isLoading, allowedActions } = strapiAdmin.useRBAC(contentTypePermissions, permissions ?? void 0);
143
+ const { isLoading, allowedActions } = strapiAdmin.useRBAC(
144
+ contentTypePermissions,
145
+ permissions ?? void 0,
146
+ // TODO: useRBAC context should be typed and built differently
147
+ // We are passing raw query as context to the hook so that it can
148
+ // rely on the locale provided from DocumentRBAC for its permission calculations.
149
+ rawQuery
150
+ );
135
151
  const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
136
152
  const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
137
153
  const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
@@ -286,7 +302,7 @@ const documentApi = contentManagerApi.injectEndpoints({
286
302
  url: `/content-manager/collection-types/${model}`,
287
303
  method: "GET",
288
304
  config: {
289
- params
305
+ params: qs.stringify(params, { encode: true })
290
306
  }
291
307
  }),
292
308
  providesTags: (result, _error, arg) => {
@@ -465,8 +481,7 @@ const {
465
481
  useUnpublishManyDocumentsMutation
466
482
  } = documentApi;
467
483
  const buildValidParams = (query) => {
468
- if (!query)
469
- return query;
484
+ if (!query) return query;
470
485
  const { plugins: _, ...validQueryParams } = {
471
486
  ...query,
472
487
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -474,14 +489,29 @@ const buildValidParams = (query) => {
474
489
  {}
475
490
  )
476
491
  };
477
- if ("_q" in validQueryParams) {
478
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
479
- }
480
492
  return validQueryParams;
481
493
  };
482
494
  const isBaseQueryError = (error) => {
483
495
  return error.name !== void 0;
484
496
  };
497
+ const arrayValidator = (attribute, options) => ({
498
+ message: strapiAdmin.translatedErrors.required,
499
+ test(value) {
500
+ if (options.status === "draft") {
501
+ return true;
502
+ }
503
+ if (!attribute.required) {
504
+ return true;
505
+ }
506
+ if (!value) {
507
+ return false;
508
+ }
509
+ if (Array.isArray(value) && value.length === 0) {
510
+ return false;
511
+ }
512
+ return true;
513
+ }
514
+ });
485
515
  const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
486
516
  const createModelSchema = (attributes2) => yup__namespace.object().shape(
487
517
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
@@ -489,6 +519,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
489
519
  return acc;
490
520
  }
491
521
  const validations = [
522
+ addNullableValidation,
492
523
  addRequiredValidation,
493
524
  addMinLengthValidation,
494
525
  addMaxLengthValidation,
@@ -505,12 +536,12 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
505
536
  ...acc,
506
537
  [name]: transformSchema(
507
538
  yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
508
- )
539
+ ).test(arrayValidator(attribute, options))
509
540
  };
510
541
  } else {
511
542
  return {
512
543
  ...acc,
513
- [name]: transformSchema(createModelSchema(attributes3))
544
+ [name]: transformSchema(createModelSchema(attributes3).nullable())
514
545
  };
515
546
  }
516
547
  }
@@ -532,7 +563,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
532
563
  }
533
564
  )
534
565
  )
535
- )
566
+ ).test(arrayValidator(attribute, options))
536
567
  };
537
568
  case "relation":
538
569
  return {
@@ -544,7 +575,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
544
575
  } else if (Array.isArray(value)) {
545
576
  return yup__namespace.array().of(
546
577
  yup__namespace.object().shape({
547
- id: yup__namespace.string().required()
578
+ id: yup__namespace.number().required()
548
579
  })
549
580
  );
550
581
  } else if (typeof value === "object") {
@@ -630,17 +661,17 @@ const nullableSchema = (schema) => {
630
661
  schema
631
662
  );
632
663
  };
664
+ const addNullableValidation = () => (schema) => {
665
+ return nullableSchema(schema);
666
+ };
633
667
  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);
668
+ if (options.status === "draft" || !attribute.required) {
669
+ return schema;
639
670
  }
640
- if (attribute.required && attribute.type !== "relation") {
671
+ if (attribute.required && "required" in schema) {
641
672
  return schema.required(strapiAdmin.translatedErrors.required);
642
673
  }
643
- return nullableSchema(schema);
674
+ return schema;
644
675
  };
645
676
  const addMinLengthValidation = (attribute, options) => (schema) => {
646
677
  if (options.status === "draft") {
@@ -668,31 +699,12 @@ const addMaxLengthValidation = (attribute) => (schema) => {
668
699
  return schema;
669
700
  };
670
701
  const addMinValidation = (attribute, options) => (schema) => {
671
- if ("min" in attribute) {
702
+ if (options.status === "draft") {
703
+ return schema;
704
+ }
705
+ if ("min" in attribute && "min" in schema) {
672
706
  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) {
707
+ if (min) {
696
708
  return schema.min(min, {
697
709
  ...strapiAdmin.translatedErrors.min,
698
710
  values: {
@@ -981,9 +993,10 @@ const formatEditLayout = (data, {
981
993
  currentPanelIndex += 2;
982
994
  } else {
983
995
  if (!panels[currentPanelIndex]) {
984
- panels.push([]);
996
+ panels.push([row]);
997
+ } else {
998
+ panels[currentPanelIndex].push(row);
985
999
  }
986
- panels[currentPanelIndex].push(row);
987
1000
  }
988
1001
  return panels;
989
1002
  }, []);
@@ -1165,11 +1178,13 @@ const useDocument = (args, opts) => {
1165
1178
  [validationSchema]
1166
1179
  );
1167
1180
  const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1181
+ const hasError = !!error;
1168
1182
  return {
1169
1183
  components,
1170
1184
  document: data?.data,
1171
1185
  meta: data?.meta,
1172
1186
  isLoading,
1187
+ hasError,
1173
1188
  schema,
1174
1189
  schemas,
1175
1190
  validate
@@ -1185,16 +1200,18 @@ const useDoc = () => {
1185
1200
  if (!slug) {
1186
1201
  throw new Error("Could not find model in url params");
1187
1202
  }
1203
+ const document = useDocument(
1204
+ { documentId: origin || id, model: slug, collectionType, params },
1205
+ {
1206
+ skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1207
+ }
1208
+ );
1209
+ const returnId = origin || id === "create" ? void 0 : id;
1188
1210
  return {
1189
1211
  collectionType,
1190
1212
  model: slug,
1191
- id: origin || id === "create" ? void 0 : id,
1192
- ...useDocument(
1193
- { documentId: origin || id, model: slug, collectionType, params },
1194
- {
1195
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1196
- }
1197
- )
1213
+ id: returnId,
1214
+ ...document
1198
1215
  };
1199
1216
  };
1200
1217
  const useContentManagerContext = () => {
@@ -1237,9 +1254,6 @@ const useContentManagerContext = () => {
1237
1254
  };
1238
1255
  };
1239
1256
  const prefixPluginTranslations = (trad, pluginId) => {
1240
- if (!pluginId) {
1241
- throw new TypeError("pluginId can't be empty");
1242
- }
1243
1257
  return Object.keys(trad).reduce((acc, current) => {
1244
1258
  acc[`${pluginId}.${current}`] = trad[current];
1245
1259
  return acc;
@@ -1673,10 +1687,10 @@ const useDocumentActions = () => {
1673
1687
  update
1674
1688
  };
1675
1689
  };
1676
- const ProtectedHistoryPage = React.lazy(
1677
- () => Promise.resolve().then(() => require("./History-BrJ1tUvt.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1690
+ const ProtectedHistoryPage = React__namespace.lazy(
1691
+ () => Promise.resolve().then(() => require("./History-C1TKAig-.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1678
1692
  );
1679
- const routes$1 = [
1693
+ const routes$2 = [
1680
1694
  {
1681
1695
  path: ":collectionType/:slug/:id/history",
1682
1696
  Component: ProtectedHistoryPage
@@ -1686,32 +1700,45 @@ const routes$1 = [
1686
1700
  Component: ProtectedHistoryPage
1687
1701
  }
1688
1702
  ];
1703
+ const ProtectedPreviewPage = React__namespace.lazy(
1704
+ () => Promise.resolve().then(() => require("./Preview-B7LyGT_b.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
1705
+ );
1706
+ const routes$1 = [
1707
+ {
1708
+ path: ":collectionType/:slug/:id/preview",
1709
+ Component: ProtectedPreviewPage
1710
+ },
1711
+ {
1712
+ path: ":collectionType/:slug/preview",
1713
+ Component: ProtectedPreviewPage
1714
+ }
1715
+ ];
1689
1716
  const ProtectedEditViewPage = React.lazy(
1690
- () => Promise.resolve().then(() => require("./EditViewPage-D2QVRr_2.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1717
+ () => Promise.resolve().then(() => require("./EditViewPage-BRewdTqE.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1691
1718
  );
1692
1719
  const ProtectedListViewPage = React.lazy(
1693
- () => Promise.resolve().then(() => require("./ListViewPage-Coj-RPsx.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1720
+ () => Promise.resolve().then(() => require("./ListViewPage-xv5IQoZp.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1694
1721
  );
1695
1722
  const ProtectedListConfiguration = React.lazy(
1696
- () => Promise.resolve().then(() => require("./ListConfigurationPage-Eane5LKE.js")).then((mod) => ({
1723
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-D-NGRLYu.js")).then((mod) => ({
1697
1724
  default: mod.ProtectedListConfiguration
1698
1725
  }))
1699
1726
  );
1700
1727
  const ProtectedEditConfigurationPage = React.lazy(
1701
- () => Promise.resolve().then(() => require("./EditConfigurationPage-CpLj5gYZ.js")).then((mod) => ({
1728
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-CxRlP5if.js")).then((mod) => ({
1702
1729
  default: mod.ProtectedEditConfigurationPage
1703
1730
  }))
1704
1731
  );
1705
1732
  const ProtectedComponentConfigurationPage = React.lazy(
1706
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-DnnZJc1F.js")).then((mod) => ({
1733
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-DywpTZeV.js")).then((mod) => ({
1707
1734
  default: mod.ProtectedComponentConfigurationPage
1708
1735
  }))
1709
1736
  );
1710
1737
  const NoPermissions = React.lazy(
1711
- () => Promise.resolve().then(() => require("./NoPermissionsPage-BOtb5FTM.js")).then((mod) => ({ default: mod.NoPermissions }))
1738
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-DAe5CDCC.js")).then((mod) => ({ default: mod.NoPermissions }))
1712
1739
  );
1713
1740
  const NoContentType = React.lazy(
1714
- () => Promise.resolve().then(() => require("./NoContentTypePage-BDJ0dshy.js")).then((mod) => ({ default: mod.NoContentType }))
1741
+ () => Promise.resolve().then(() => require("./NoContentTypePage-Dzw5Yj5u.js")).then((mod) => ({ default: mod.NoContentType }))
1715
1742
  );
1716
1743
  const CollectionTypePages = () => {
1717
1744
  const { collectionType } = reactRouterDom.useParams();
@@ -1723,7 +1750,7 @@ const CollectionTypePages = () => {
1723
1750
  const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
1724
1751
  const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
1725
1752
  const LIST_RELATIVE_PATH = ":collectionType/:slug";
1726
- const LIST_PATH = `/content-manager/${LIST_RELATIVE_PATH}`;
1753
+ const LIST_PATH = `/content-manager/collection-types/:slug`;
1727
1754
  const routes = [
1728
1755
  {
1729
1756
  path: LIST_RELATIVE_PATH,
@@ -1757,6 +1784,7 @@ const routes = [
1757
1784
  path: "no-content-types",
1758
1785
  Component: NoContentType
1759
1786
  },
1787
+ ...routes$2,
1760
1788
  ...routes$1
1761
1789
  ];
1762
1790
  const DocumentActions = ({ actions: actions2 }) => {
@@ -1855,6 +1883,11 @@ const DocumentActionButton = (action) => {
1855
1883
  ) : null
1856
1884
  ] });
1857
1885
  };
1886
+ const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
1887
+ &:hover {
1888
+ background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
1889
+ }
1890
+ `;
1858
1891
  const DocumentActionsMenu = ({
1859
1892
  actions: actions2,
1860
1893
  children,
@@ -1913,48 +1946,32 @@ const DocumentActionsMenu = ({
1913
1946
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1914
1947
  actions2.map((action) => {
1915
1948
  return /* @__PURE__ */ jsxRuntime.jsx(
1916
- designSystem.Menu.Item,
1949
+ MenuItem,
1917
1950
  {
1918
1951
  disabled: action.disabled,
1919
1952
  onSelect: handleClick(action),
1920
1953
  display: "block",
1921
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
1922
- /* @__PURE__ */ jsxRuntime.jsxs(
1923
- designSystem.Flex,
1924
- {
1925
- color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1926
- gap: 2,
1927
- tag: "span",
1928
- children: [
1929
- /* @__PURE__ */ jsxRuntime.jsx(
1930
- designSystem.Flex,
1931
- {
1932
- tag: "span",
1933
- color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1934
- children: action.icon
1935
- }
1936
- ),
1937
- action.label
1938
- ]
1939
- }
1940
- ),
1941
- action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
1942
- designSystem.Flex,
1943
- {
1944
- alignItems: "center",
1945
- background: "alternative100",
1946
- borderStyle: "solid",
1947
- borderColor: "alternative200",
1948
- borderWidth: "1px",
1949
- height: 5,
1950
- paddingLeft: 2,
1951
- paddingRight: 2,
1952
- hasRadius: true,
1953
- color: "alternative600",
1954
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
1955
- }
1956
- )
1957
- ] })
1954
+ isVariantDanger: action.variant === "danger",
1955
+ isDisabled: action.disabled,
1956
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
1957
+ designSystem.Flex,
1958
+ {
1959
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1960
+ gap: 2,
1961
+ tag: "span",
1962
+ children: [
1963
+ /* @__PURE__ */ jsxRuntime.jsx(
1964
+ designSystem.Flex,
1965
+ {
1966
+ tag: "span",
1967
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1968
+ children: action.icon
1969
+ }
1970
+ ),
1971
+ action.label
1972
+ ]
1973
+ }
1974
+ ) })
1958
1975
  },
1959
1976
  action.id
1960
1977
  );
@@ -2065,6 +2082,18 @@ const DocumentActionModal = ({
2065
2082
  typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
2066
2083
  ] }) });
2067
2084
  };
2085
+ const transformData = (data) => {
2086
+ if (Array.isArray(data)) {
2087
+ return data.map(transformData);
2088
+ }
2089
+ if (typeof data === "object" && data !== null) {
2090
+ if ("apiData" in data) {
2091
+ return data.apiData;
2092
+ }
2093
+ return mapValues__default.default(transformData)(data);
2094
+ }
2095
+ return data;
2096
+ };
2068
2097
  const PublishAction$1 = ({
2069
2098
  activeTab,
2070
2099
  documentId,
@@ -2079,6 +2108,7 @@ const PublishAction$1 = ({
2079
2108
  const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
2080
2109
  const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
2081
2110
  const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2111
+ const { id } = reactRouterDom.useParams();
2082
2112
  const { formatMessage } = reactIntl.useIntl();
2083
2113
  const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
2084
2114
  const { publish } = useDocumentActions();
@@ -2158,7 +2188,9 @@ const PublishAction$1 = ({
2158
2188
  const performPublish = async () => {
2159
2189
  setSubmitting(true);
2160
2190
  try {
2161
- const { errors } = await validate();
2191
+ const { errors } = await validate(true, {
2192
+ status: "published"
2193
+ });
2162
2194
  if (errors) {
2163
2195
  toggleNotification({
2164
2196
  type: "danger",
@@ -2176,13 +2208,15 @@ const PublishAction$1 = ({
2176
2208
  documentId,
2177
2209
  params
2178
2210
  },
2179
- formValues
2211
+ transformData(formValues)
2180
2212
  );
2181
2213
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2182
- navigate({
2183
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2184
- search: rawQuery
2185
- });
2214
+ if (id === "create") {
2215
+ navigate({
2216
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2217
+ search: rawQuery
2218
+ });
2219
+ }
2186
2220
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2187
2221
  setErrors(formatValidationErrors(res.error));
2188
2222
  }
@@ -2266,24 +2300,24 @@ const UpdateAction = ({
2266
2300
  */
2267
2301
  disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
2268
2302
  label: formatMessage({
2269
- id: "content-manager.containers.Edit.save",
2303
+ id: "global.save",
2270
2304
  defaultMessage: "Save"
2271
2305
  }),
2272
2306
  onClick: async () => {
2273
2307
  setSubmitting(true);
2274
2308
  try {
2275
- if (activeTab !== "draft") {
2276
- const { errors } = await validate();
2277
- if (errors) {
2278
- toggleNotification({
2279
- type: "danger",
2280
- message: formatMessage({
2281
- id: "content-manager.validation.error",
2282
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2283
- })
2284
- });
2285
- return;
2286
- }
2309
+ const { errors } = await validate(true, {
2310
+ status: "draft"
2311
+ });
2312
+ if (errors) {
2313
+ toggleNotification({
2314
+ type: "danger",
2315
+ message: formatMessage({
2316
+ id: "content-manager.validation.error",
2317
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2318
+ })
2319
+ });
2320
+ return;
2287
2321
  }
2288
2322
  if (isCloning) {
2289
2323
  const res = await clone(
@@ -2292,7 +2326,7 @@ const UpdateAction = ({
2292
2326
  documentId: cloneMatch.params.origin,
2293
2327
  params
2294
2328
  },
2295
- document
2329
+ transformData(document)
2296
2330
  );
2297
2331
  if ("data" in res) {
2298
2332
  navigate(
@@ -2313,7 +2347,7 @@ const UpdateAction = ({
2313
2347
  documentId,
2314
2348
  params
2315
2349
  },
2316
- document
2350
+ transformData(document)
2317
2351
  );
2318
2352
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2319
2353
  setErrors(formatValidationErrors(res.error));
@@ -2326,7 +2360,7 @@ const UpdateAction = ({
2326
2360
  model,
2327
2361
  params
2328
2362
  },
2329
- document
2363
+ transformData(document)
2330
2364
  );
2331
2365
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2332
2366
  navigate(
@@ -2531,7 +2565,7 @@ const RelativeTime = React__namespace.forwardRef(
2531
2565
  });
2532
2566
  const unit = intervals.find((intervalUnit) => {
2533
2567
  return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
2534
- });
2568
+ }) ?? "seconds";
2535
2569
  const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
2536
2570
  const customInterval = customIntervals.find(
2537
2571
  (custom) => interval[custom.unit] < custom.threshold
@@ -2565,19 +2599,29 @@ const getDisplayName = ({
2565
2599
  return email ?? "";
2566
2600
  };
2567
2601
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2568
- const DocumentStatus = ({ status = "draft", ...restProps }) => {
2602
+ const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
2569
2603
  const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2570
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2604
+ const { formatMessage } = reactIntl.useIntl();
2605
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
2606
+ id: `content-manager.containers.List.${status}`,
2607
+ defaultMessage: capitalise(status)
2608
+ }) }) });
2571
2609
  };
2572
2610
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2573
2611
  const { formatMessage } = reactIntl.useIntl();
2574
2612
  const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2613
+ const params = reactRouterDom.useParams();
2575
2614
  const title = isCreating ? formatMessage({
2576
2615
  id: "content-manager.containers.edit.title.new",
2577
2616
  defaultMessage: "Create an entry"
2578
2617
  }) : documentTitle;
2579
2618
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2580
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
2619
+ /* @__PURE__ */ jsxRuntime.jsx(
2620
+ strapiAdmin.BackButton,
2621
+ {
2622
+ fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
2623
+ }
2624
+ ),
2581
2625
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2582
2626
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
2583
2627
  /* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
@@ -2665,12 +2709,12 @@ const Information = ({ activeTab }) => {
2665
2709
  isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2666
2710
  label: formatMessage({
2667
2711
  id: "content-manager.containers.edit.information.last-published.label",
2668
- defaultMessage: "Last published"
2712
+ defaultMessage: "Published"
2669
2713
  }),
2670
2714
  value: formatMessage(
2671
2715
  {
2672
2716
  id: "content-manager.containers.edit.information.last-published.value",
2673
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2717
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2674
2718
  },
2675
2719
  {
2676
2720
  time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
@@ -2683,12 +2727,12 @@ const Information = ({ activeTab }) => {
2683
2727
  isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2684
2728
  label: formatMessage({
2685
2729
  id: "content-manager.containers.edit.information.last-draft.label",
2686
- defaultMessage: "Last draft"
2730
+ defaultMessage: "Updated"
2687
2731
  }),
2688
2732
  value: formatMessage(
2689
2733
  {
2690
2734
  id: "content-manager.containers.edit.information.last-draft.value",
2691
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2735
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2692
2736
  },
2693
2737
  {
2694
2738
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2706,12 +2750,12 @@ const Information = ({ activeTab }) => {
2706
2750
  isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2707
2751
  label: formatMessage({
2708
2752
  id: "content-manager.containers.edit.information.document.label",
2709
- defaultMessage: "Document"
2753
+ defaultMessage: "Created"
2710
2754
  }),
2711
2755
  value: formatMessage(
2712
2756
  {
2713
2757
  id: "content-manager.containers.edit.information.document.value",
2714
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2758
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2715
2759
  },
2716
2760
  {
2717
2761
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2769,10 +2813,9 @@ const HeaderActions = ({ actions: actions2 }) => {
2769
2813
  designSystem.SingleSelect,
2770
2814
  {
2771
2815
  size: "S",
2772
- disabled: action.disabled,
2773
- "aria-label": action.label,
2774
2816
  onChange: action.onSelect,
2775
- value: action.value,
2817
+ "aria-label": action.label,
2818
+ ...action,
2776
2819
  children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
2777
2820
  },
2778
2821
  action.id
@@ -3015,7 +3058,7 @@ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
3015
3058
  justifyContent: "stretch",
3016
3059
  alignItems: "flex-start",
3017
3060
  children: [
3018
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
3061
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3019
3062
  children
3020
3063
  ]
3021
3064
  }
@@ -3265,18 +3308,10 @@ const SelectedEntriesTableContent = ({
3265
3308
  search: row.locale && `?plugins[i18n][locale]=${row.locale}`
3266
3309
  },
3267
3310
  state: { from: pathname },
3268
- label: formatMessage(
3269
- { id: "app.component.HelperPluginTable.edit", defaultMessage: "Edit {target}" },
3270
- {
3271
- target: formatMessage(
3272
- {
3273
- id: "content-manager.components.ListViewHelperPluginTable.row-line",
3274
- defaultMessage: "item line {number}"
3275
- },
3276
- { number: index2 + 1 }
3277
- )
3278
- }
3279
- ),
3311
+ label: formatMessage({
3312
+ id: "content-manager.bulk-publish.edit",
3313
+ defaultMessage: "Edit"
3314
+ }),
3280
3315
  target: "_blank",
3281
3316
  marginLeft: "auto",
3282
3317
  variant: "ghost",
@@ -3450,8 +3485,7 @@ const PublishAction = ({ documents, model }) => {
3450
3485
  const refetchList = () => {
3451
3486
  contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3452
3487
  };
3453
- if (!showPublishButton)
3454
- return null;
3488
+ if (!showPublishButton) return null;
3455
3489
  return {
3456
3490
  actionType: "publish",
3457
3491
  variant: "tertiary",
@@ -3519,8 +3553,7 @@ const DeleteAction = ({ documents, model }) => {
3519
3553
  selectRow([]);
3520
3554
  }
3521
3555
  };
3522
- if (!hasDeletePermission)
3523
- return null;
3556
+ if (!hasDeletePermission) return null;
3524
3557
  return {
3525
3558
  variant: "danger-light",
3526
3559
  label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
@@ -3569,8 +3602,7 @@ const UnpublishAction = ({ documents, model }) => {
3569
3602
  }
3570
3603
  };
3571
3604
  const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3572
- if (!showUnpublishButton)
3573
- return null;
3605
+ if (!showUnpublishButton) return null;
3574
3606
  return {
3575
3607
  variant: "tertiary",
3576
3608
  label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
@@ -3906,10 +3938,8 @@ class ContentManagerPlugin {
3906
3938
  const getPrintableType = (value) => {
3907
3939
  const nativeType = typeof value;
3908
3940
  if (nativeType === "object") {
3909
- if (value === null)
3910
- return "null";
3911
- if (Array.isArray(value))
3912
- return "array";
3941
+ if (value === null) return "null";
3942
+ if (Array.isArray(value)) return "array";
3913
3943
  if (value instanceof Object && value.constructor.name !== "Object") {
3914
3944
  return value.constructor.name;
3915
3945
  }
@@ -3920,17 +3950,27 @@ const HistoryAction = ({ model, document }) => {
3920
3950
  const { formatMessage } = reactIntl.useIntl();
3921
3951
  const [{ query }] = strapiAdmin.useQueryParams();
3922
3952
  const navigate = reactRouterDom.useNavigate();
3953
+ const { trackUsage } = strapiAdmin.useTracking();
3954
+ const { pathname } = reactRouterDom.useLocation();
3923
3955
  const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
3924
3956
  if (!window.strapi.features.isEnabled("cms-content-history")) {
3925
3957
  return null;
3926
3958
  }
3959
+ const handleOnClick = () => {
3960
+ const destination = { pathname: "history", search: pluginsQueryParams };
3961
+ trackUsage("willNavigate", {
3962
+ from: pathname,
3963
+ to: `${pathname}/${destination.pathname}`
3964
+ });
3965
+ navigate(destination);
3966
+ };
3927
3967
  return {
3928
3968
  icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
3929
3969
  label: formatMessage({
3930
3970
  id: "content-manager.history.document-action",
3931
3971
  defaultMessage: "Content History"
3932
3972
  }),
3933
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
3973
+ onClick: handleOnClick,
3934
3974
  disabled: (
3935
3975
  /**
3936
3976
  * The user is creating a new document.
@@ -3998,6 +4038,90 @@ const { setInitialData } = actions;
3998
4038
  const reducer = toolkit.combineReducers({
3999
4039
  app: reducer$1
4000
4040
  });
4041
+ const previewApi = contentManagerApi.injectEndpoints({
4042
+ endpoints: (builder) => ({
4043
+ getPreviewUrl: builder.query({
4044
+ query({ query, params }) {
4045
+ return {
4046
+ url: `/content-manager/preview/url/${params.contentType}`,
4047
+ method: "GET",
4048
+ config: {
4049
+ params: query
4050
+ }
4051
+ };
4052
+ }
4053
+ })
4054
+ })
4055
+ });
4056
+ const { useGetPreviewUrlQuery } = previewApi;
4057
+ const ConditionalTooltip = ({ isShown, label, children }) => {
4058
+ if (isShown) {
4059
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
4060
+ }
4061
+ return children;
4062
+ };
4063
+ const PreviewSidePanel = ({ model, documentId, document }) => {
4064
+ const { formatMessage } = reactIntl.useIntl();
4065
+ const { trackUsage } = strapiAdmin.useTracking();
4066
+ const { pathname } = reactRouterDom.useLocation();
4067
+ const [{ query }] = strapiAdmin.useQueryParams();
4068
+ const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
4069
+ const { data, error } = useGetPreviewUrlQuery({
4070
+ params: {
4071
+ contentType: model
4072
+ },
4073
+ query: {
4074
+ documentId,
4075
+ locale: document?.locale,
4076
+ status: document?.status
4077
+ }
4078
+ });
4079
+ if (!data?.data?.url || error) {
4080
+ return null;
4081
+ }
4082
+ const trackNavigation = () => {
4083
+ const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
4084
+ trackUsage("willNavigate", { from: pathname, to: destinationPathname });
4085
+ };
4086
+ return {
4087
+ title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4088
+ content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
4089
+ ConditionalTooltip,
4090
+ {
4091
+ label: formatMessage({
4092
+ id: "content-manager.preview.panel.button-disabled-tooltip",
4093
+ defaultMessage: "Please save to open the preview"
4094
+ }),
4095
+ isShown: isModified,
4096
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4097
+ designSystem.Button,
4098
+ {
4099
+ variant: "tertiary",
4100
+ tag: reactRouterDom.Link,
4101
+ to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
4102
+ onClick: trackNavigation,
4103
+ flex: "auto",
4104
+ disabled: isModified,
4105
+ children: formatMessage({
4106
+ id: "content-manager.preview.panel.button",
4107
+ defaultMessage: "Open preview"
4108
+ })
4109
+ }
4110
+ )
4111
+ }
4112
+ ) })
4113
+ };
4114
+ };
4115
+ const FEATURE_ID = "preview";
4116
+ const previewAdmin = {
4117
+ bootstrap(app) {
4118
+ if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4119
+ return;
4120
+ }
4121
+ const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4122
+ contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4123
+ }
4124
+ };
4001
4125
  const index = {
4002
4126
  register(app) {
4003
4127
  const cm = new ContentManagerPlugin();
@@ -4017,7 +4141,7 @@ const index = {
4017
4141
  app.router.addRoute({
4018
4142
  path: "content-manager/*",
4019
4143
  lazy: async () => {
4020
- const { Layout } = await Promise.resolve().then(() => require("./layout-CWgZzMYf.js"));
4144
+ const { Layout } = await Promise.resolve().then(() => require("./layout-7AsWJzZJ.js"));
4021
4145
  return {
4022
4146
  Component: Layout
4023
4147
  };
@@ -4030,11 +4154,14 @@ const index = {
4030
4154
  if (typeof historyAdmin.bootstrap === "function") {
4031
4155
  historyAdmin.bootstrap(app);
4032
4156
  }
4157
+ if (typeof previewAdmin.bootstrap === "function") {
4158
+ previewAdmin.bootstrap(app);
4159
+ }
4033
4160
  },
4034
4161
  async registerTrads({ locales }) {
4035
4162
  const importedTrads = await Promise.all(
4036
4163
  locales.map((locale) => {
4037
- 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 }) => {
4164
+ 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-BK8Xyl5I.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.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-7sfIbjxE.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`, 3).then(({ default: data }) => {
4038
4165
  return {
4039
4166
  data: prefixPluginTranslations(data, PLUGIN_ID),
4040
4167
  locale
@@ -4092,5 +4219,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
4092
4219
  exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
4093
4220
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
4094
4221
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
4222
+ exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
4095
4223
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
4096
- //# sourceMappingURL=index-DTKVhcla.js.map
4224
+ //# sourceMappingURL=index-C2Q_PLWj.js.map