@strapi/content-manager 0.0.0-experimental.32c4b04580cc12400710050c8198e46b3644cfd4 → 0.0.0-experimental.36632203b17974c18103c138ffbef53a82e448c3

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 (193) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-5ukroXAh.js → ComponentConfigurationPage-Br8hp2Xt.js} +4 -4
  2. package/dist/_chunks/{ComponentConfigurationPage-5ukroXAh.js.map → ComponentConfigurationPage-Br8hp2Xt.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-BAgyHiMm.mjs → ComponentConfigurationPage-DhwMhiRn.mjs} +4 -4
  4. package/dist/_chunks/{ComponentConfigurationPage-BAgyHiMm.mjs.map → ComponentConfigurationPage-DhwMhiRn.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-Xp7lun0f.js → EditConfigurationPage-BG7rpPjL.js} +4 -4
  6. package/dist/_chunks/{EditConfigurationPage-Xp7lun0f.js.map → EditConfigurationPage-BG7rpPjL.js.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-DmoXawIh.mjs → EditConfigurationPage-CWao3CZ3.mjs} +4 -4
  8. package/dist/_chunks/{EditConfigurationPage-DmoXawIh.mjs.map → EditConfigurationPage-CWao3CZ3.mjs.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-C-ukDOB7.js → EditViewPage-BUtpHsMz.js} +38 -11
  10. package/dist/_chunks/EditViewPage-BUtpHsMz.js.map +1 -0
  11. package/dist/_chunks/{EditViewPage-BLsjc5F-.mjs → EditViewPage-hiwZg61J.mjs} +39 -12
  12. package/dist/_chunks/EditViewPage-hiwZg61J.mjs.map +1 -0
  13. package/dist/_chunks/{Field-Cs7duwWd.mjs → Field-BQQLwyUs.mjs} +174 -102
  14. package/dist/_chunks/Field-BQQLwyUs.mjs.map +1 -0
  15. package/dist/_chunks/{Field-Bfph5SOd.js → Field-DEdug-Ll.js} +176 -104
  16. package/dist/_chunks/Field-DEdug-Ll.js.map +1 -0
  17. package/dist/_chunks/{Form-Dg_GS5TQ.mjs → Form-DwJovCha.mjs} +36 -17
  18. package/dist/_chunks/Form-DwJovCha.mjs.map +1 -0
  19. package/dist/_chunks/{Form-CPYqIWDG.js → Form-v5pkY-X_.js} +36 -17
  20. package/dist/_chunks/Form-v5pkY-X_.js.map +1 -0
  21. package/dist/_chunks/{History-DNQkXANT.js → History-40apIShV.js} +37 -47
  22. package/dist/_chunks/History-40apIShV.js.map +1 -0
  23. package/dist/_chunks/{History-wrnHqf09.mjs → History-B9uJsxZl.mjs} +38 -48
  24. package/dist/_chunks/History-B9uJsxZl.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-DScmJVkW.mjs → ListConfigurationPage-CA4oi4Hj.mjs} +15 -5
  26. package/dist/_chunks/ListConfigurationPage-CA4oi4Hj.mjs.map +1 -0
  27. package/dist/_chunks/{ListConfigurationPage-CUQxfpjT.js → ListConfigurationPage-DAGbWDIL.js} +15 -5
  28. package/dist/_chunks/ListConfigurationPage-DAGbWDIL.js.map +1 -0
  29. package/dist/_chunks/{ListViewPage-C4IvrMgY.mjs → ListViewPage-Ca8F1NL-.mjs} +59 -39
  30. package/dist/_chunks/ListViewPage-Ca8F1NL-.mjs.map +1 -0
  31. package/dist/_chunks/{ListViewPage-BsLiH2-2.js → ListViewPage-CjaHQ2_V.js} +61 -41
  32. package/dist/_chunks/ListViewPage-CjaHQ2_V.js.map +1 -0
  33. package/dist/_chunks/{NoContentTypePage-BZ-PnGAf.js → NoContentTypePage-CGxqLI8j.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-BZ-PnGAf.js.map → NoContentTypePage-CGxqLI8j.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-Djg8nPlj.mjs → NoContentTypePage-CwfnU-aN.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-Djg8nPlj.mjs.map → NoContentTypePage-CwfnU-aN.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-_lUqjGW3.js → NoPermissionsPage-CY3_QduF.js} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-_lUqjGW3.js.map → NoPermissionsPage-CY3_QduF.js.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-DSP7R-hv.mjs → NoPermissionsPage-iPk2lFR6.mjs} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-DSP7R-hv.mjs.map → NoPermissionsPage-iPk2lFR6.mjs.map} +1 -1
  41. package/dist/_chunks/Preview-DRJhcaIO.mjs +267 -0
  42. package/dist/_chunks/Preview-DRJhcaIO.mjs.map +1 -0
  43. package/dist/_chunks/Preview-V8XOfrQf.js +286 -0
  44. package/dist/_chunks/Preview-V8XOfrQf.js.map +1 -0
  45. package/dist/_chunks/{Relations-CtELXYIK.js → Relations-CGerEwji.js} +72 -36
  46. package/dist/_chunks/Relations-CGerEwji.js.map +1 -0
  47. package/dist/_chunks/{Relations-BZr8tL0R.mjs → Relations-DGWa9W2j.mjs} +73 -37
  48. package/dist/_chunks/Relations-DGWa9W2j.mjs.map +1 -0
  49. package/dist/_chunks/{en-uOUIxfcQ.js → en-CHOp_xJv.js} +23 -13
  50. package/dist/_chunks/{en-uOUIxfcQ.js.map → en-CHOp_xJv.js.map} +1 -1
  51. package/dist/_chunks/{en-BrCTWlZv.mjs → en-D_BMf0hT.mjs} +23 -13
  52. package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-D_BMf0hT.mjs.map} +1 -1
  53. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  54. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  55. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  56. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  57. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  58. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  59. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  60. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  61. package/dist/_chunks/{index-c_5DdJi-.mjs → index-V8MWkDSd.mjs} +987 -727
  62. package/dist/_chunks/index-V8MWkDSd.mjs.map +1 -0
  63. package/dist/_chunks/{index-OerGjbAN.js → index-tN1hpOMN.js} +968 -707
  64. package/dist/_chunks/index-tN1hpOMN.js.map +1 -0
  65. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  66. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  67. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  68. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  69. package/dist/_chunks/{layout-oPBiO7RY.mjs → layout-Bue_C6ui.mjs} +22 -9
  70. package/dist/_chunks/layout-Bue_C6ui.mjs.map +1 -0
  71. package/dist/_chunks/{layout-Ci7qHlFb.js → layout-BzX903CL.js} +21 -8
  72. package/dist/_chunks/layout-BzX903CL.js.map +1 -0
  73. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  74. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  75. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  76. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  77. package/dist/_chunks/{relations-COBpStiF.js → relations-C4HcWYYJ.js} +6 -7
  78. package/dist/_chunks/relations-C4HcWYYJ.js.map +1 -0
  79. package/dist/_chunks/{relations-BIdWFjdq.mjs → relations-C8eyDiIO.mjs} +6 -7
  80. package/dist/_chunks/relations-C8eyDiIO.mjs.map +1 -0
  81. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  82. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  83. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  84. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  85. package/dist/admin/index.js +2 -1
  86. package/dist/admin/index.js.map +1 -1
  87. package/dist/admin/index.mjs +5 -4
  88. package/dist/admin/src/exports.d.ts +1 -1
  89. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  90. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  91. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  92. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  93. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  94. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  95. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  96. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  97. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  98. package/dist/admin/src/preview/constants.d.ts +1 -0
  99. package/dist/admin/src/preview/index.d.ts +4 -0
  100. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  101. package/dist/admin/src/preview/routes.d.ts +3 -0
  102. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  103. package/dist/admin/src/services/api.d.ts +1 -1
  104. package/dist/admin/src/services/components.d.ts +2 -2
  105. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  106. package/dist/admin/src/services/documents.d.ts +19 -17
  107. package/dist/admin/src/services/init.d.ts +1 -1
  108. package/dist/admin/src/services/relations.d.ts +2 -2
  109. package/dist/admin/src/services/uid.d.ts +3 -3
  110. package/dist/admin/src/utils/validation.d.ts +4 -1
  111. package/dist/server/index.js +513 -235
  112. package/dist/server/index.js.map +1 -1
  113. package/dist/server/index.mjs +514 -236
  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 +4 -4
  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/policies/hasPermissions.d.ts.map +1 -1
  127. package/dist/server/src/preview/constants.d.ts +2 -0
  128. package/dist/server/src/preview/constants.d.ts.map +1 -0
  129. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  130. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  131. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  132. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  133. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  134. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  135. package/dist/server/src/preview/index.d.ts +4 -0
  136. package/dist/server/src/preview/index.d.ts.map +1 -0
  137. package/dist/server/src/preview/routes/index.d.ts +8 -0
  138. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  139. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  140. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  141. package/dist/server/src/preview/services/index.d.ts +15 -0
  142. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  143. package/dist/server/src/preview/services/preview-config.d.ts +30 -0
  144. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  145. package/dist/server/src/preview/services/preview.d.ts +12 -0
  146. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  147. package/dist/server/src/preview/utils.d.ts +18 -0
  148. package/dist/server/src/preview/utils.d.ts.map +1 -0
  149. package/dist/server/src/routes/index.d.ts.map +1 -1
  150. package/dist/server/src/services/document-metadata.d.ts +8 -8
  151. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  152. package/dist/server/src/services/index.d.ts +4 -4
  153. package/dist/server/src/services/index.d.ts.map +1 -1
  154. package/dist/server/src/services/permission-checker.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/collection-types.d.ts +3 -1
  160. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  161. package/dist/shared/contracts/index.d.ts +1 -0
  162. package/dist/shared/contracts/index.d.ts.map +1 -1
  163. package/dist/shared/contracts/preview.d.ts +27 -0
  164. package/dist/shared/contracts/preview.d.ts.map +1 -0
  165. package/dist/shared/index.js +4 -0
  166. package/dist/shared/index.js.map +1 -1
  167. package/dist/shared/index.mjs +4 -0
  168. package/dist/shared/index.mjs.map +1 -1
  169. package/package.json +13 -13
  170. package/dist/_chunks/EditViewPage-BLsjc5F-.mjs.map +0 -1
  171. package/dist/_chunks/EditViewPage-C-ukDOB7.js.map +0 -1
  172. package/dist/_chunks/Field-Bfph5SOd.js.map +0 -1
  173. package/dist/_chunks/Field-Cs7duwWd.mjs.map +0 -1
  174. package/dist/_chunks/Form-CPYqIWDG.js.map +0 -1
  175. package/dist/_chunks/Form-Dg_GS5TQ.mjs.map +0 -1
  176. package/dist/_chunks/History-DNQkXANT.js.map +0 -1
  177. package/dist/_chunks/History-wrnHqf09.mjs.map +0 -1
  178. package/dist/_chunks/ListConfigurationPage-CUQxfpjT.js.map +0 -1
  179. package/dist/_chunks/ListConfigurationPage-DScmJVkW.mjs.map +0 -1
  180. package/dist/_chunks/ListViewPage-BsLiH2-2.js.map +0 -1
  181. package/dist/_chunks/ListViewPage-C4IvrMgY.mjs.map +0 -1
  182. package/dist/_chunks/Relations-BZr8tL0R.mjs.map +0 -1
  183. package/dist/_chunks/Relations-CtELXYIK.js.map +0 -1
  184. package/dist/_chunks/index-OerGjbAN.js.map +0 -1
  185. package/dist/_chunks/index-c_5DdJi-.mjs.map +0 -1
  186. package/dist/_chunks/layout-Ci7qHlFb.js.map +0 -1
  187. package/dist/_chunks/layout-oPBiO7RY.mjs.map +0 -1
  188. package/dist/_chunks/relations-BIdWFjdq.mjs.map +0 -1
  189. package/dist/_chunks/relations-COBpStiF.js.map +0 -1
  190. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  191. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  192. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  193. package/strapi-server.js +0 -3
@@ -4,12 +4,13 @@ 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
- const styledComponents = require("styled-components");
10
10
  const yup = require("yup");
11
11
  const pipe = require("lodash/fp/pipe");
12
12
  const dateFns = require("date-fns");
13
+ const styledComponents = require("styled-components");
13
14
  const qs = require("qs");
14
15
  const toolkit = require("@reduxjs/toolkit");
15
16
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -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) : [];
@@ -179,7 +189,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
179
189
  "Document",
180
190
  "InitialData",
181
191
  "HistoryVersion",
182
- "Relations"
192
+ "Relations",
193
+ "UidAvailability"
183
194
  ]
184
195
  });
185
196
  const documentApi = contentManagerApi.injectEndpoints({
@@ -209,7 +220,10 @@ const documentApi = contentManagerApi.injectEndpoints({
209
220
  params
210
221
  }
211
222
  }),
212
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
223
+ invalidatesTags: (_result, _error, { model }) => [
224
+ { type: "Document", id: `${model}_LIST` },
225
+ { type: "UidAvailability", id: model }
226
+ ]
213
227
  }),
214
228
  /**
215
229
  * Creates a new collection-type document. This should ONLY be used for collection-types.
@@ -226,7 +240,8 @@ const documentApi = contentManagerApi.injectEndpoints({
226
240
  }),
227
241
  invalidatesTags: (result, _error, { model }) => [
228
242
  { type: "Document", id: `${model}_LIST` },
229
- "Relations"
243
+ "Relations",
244
+ { type: "UidAvailability", id: model }
230
245
  ]
231
246
  }),
232
247
  deleteDocument: builder.mutation({
@@ -267,7 +282,8 @@ const documentApi = contentManagerApi.injectEndpoints({
267
282
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
268
283
  },
269
284
  { type: "Document", id: `${model}_LIST` },
270
- "Relations"
285
+ "Relations",
286
+ { type: "UidAvailability", id: model }
271
287
  ];
272
288
  }
273
289
  }),
@@ -285,6 +301,7 @@ const documentApi = contentManagerApi.injectEndpoints({
285
301
  }),
286
302
  providesTags: (result, _error, arg) => {
287
303
  return [
304
+ { type: "Document", id: `ALL_LIST` },
288
305
  { type: "Document", id: `${arg.model}_LIST` },
289
306
  ...result?.results.map(({ documentId }) => ({
290
307
  type: "Document",
@@ -323,6 +340,11 @@ const documentApi = contentManagerApi.injectEndpoints({
323
340
  {
324
341
  type: "Document",
325
342
  id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
343
+ },
344
+ // Make it easy to invalidate all individual documents queries for a model
345
+ {
346
+ type: "Document",
347
+ id: `${model}_ALL_ITEMS`
326
348
  }
327
349
  ];
328
350
  }
@@ -386,7 +408,8 @@ const documentApi = contentManagerApi.injectEndpoints({
386
408
  type: "Document",
387
409
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
388
410
  },
389
- "Relations"
411
+ "Relations",
412
+ { type: "UidAvailability", id: model }
390
413
  ];
391
414
  },
392
415
  async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
@@ -469,20 +492,39 @@ const buildValidParams = (query) => {
469
492
  const isBaseQueryError = (error) => {
470
493
  return error.name !== void 0;
471
494
  };
472
- const createYupSchema = (attributes = {}, components = {}) => {
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
+ });
513
+ const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
473
514
  const createModelSchema = (attributes2) => yup__namespace.object().shape(
474
515
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
475
516
  if (DOCUMENT_META_FIELDS.includes(name)) {
476
517
  return acc;
477
518
  }
478
519
  const validations = [
520
+ addNullableValidation,
479
521
  addRequiredValidation,
480
522
  addMinLengthValidation,
481
523
  addMaxLengthValidation,
482
524
  addMinValidation,
483
525
  addMaxValidation,
484
526
  addRegexValidation
485
- ].map((fn) => fn(attribute));
527
+ ].map((fn) => fn(attribute, options));
486
528
  const transformSchema = pipe__default.default(...validations);
487
529
  switch (attribute.type) {
488
530
  case "component": {
@@ -492,12 +534,12 @@ const createYupSchema = (attributes = {}, components = {}) => {
492
534
  ...acc,
493
535
  [name]: transformSchema(
494
536
  yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
495
- )
537
+ ).test(arrayValidator(attribute, options))
496
538
  };
497
539
  } else {
498
540
  return {
499
541
  ...acc,
500
- [name]: transformSchema(createModelSchema(attributes3))
542
+ [name]: transformSchema(createModelSchema(attributes3).nullable())
501
543
  };
502
544
  }
503
545
  }
@@ -519,7 +561,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
519
561
  }
520
562
  )
521
563
  )
522
- )
564
+ ).test(arrayValidator(attribute, options))
523
565
  };
524
566
  case "relation":
525
567
  return {
@@ -531,7 +573,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
531
573
  } else if (Array.isArray(value)) {
532
574
  return yup__namespace.array().of(
533
575
  yup__namespace.object().shape({
534
- id: yup__namespace.string().required()
576
+ id: yup__namespace.number().required()
535
577
  })
536
578
  );
537
579
  } else if (typeof value === "object") {
@@ -583,6 +625,14 @@ const createAttributeSchema = (attribute) => {
583
625
  if (!value || typeof value === "string" && value.length === 0) {
584
626
  return true;
585
627
  }
628
+ if (typeof value === "object") {
629
+ try {
630
+ JSON.stringify(value);
631
+ return true;
632
+ } catch (err) {
633
+ return false;
634
+ }
635
+ }
586
636
  try {
587
637
  JSON.parse(value);
588
638
  return true;
@@ -601,13 +651,7 @@ const createAttributeSchema = (attribute) => {
601
651
  return yup__namespace.mixed();
602
652
  }
603
653
  };
604
- const addRequiredValidation = (attribute) => (schema) => {
605
- if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
606
- return schema.min(1, strapiAdmin.translatedErrors.required);
607
- }
608
- if (attribute.required && attribute.type !== "relation") {
609
- return schema.required(strapiAdmin.translatedErrors.required);
610
- }
654
+ const nullableSchema = (schema) => {
611
655
  return schema?.nullable ? schema.nullable() : (
612
656
  // In some cases '.nullable' will not be available on the schema.
613
657
  // e.g. when the schema has been built using yup.lazy (e.g. for relations).
@@ -615,7 +659,22 @@ const addRequiredValidation = (attribute) => (schema) => {
615
659
  schema
616
660
  );
617
661
  };
618
- const addMinLengthValidation = (attribute) => (schema) => {
662
+ const addNullableValidation = () => (schema) => {
663
+ return nullableSchema(schema);
664
+ };
665
+ const addRequiredValidation = (attribute, options) => (schema) => {
666
+ if (options.status === "draft" || !attribute.required) {
667
+ return schema;
668
+ }
669
+ if (attribute.required && "required" in schema) {
670
+ return schema.required(strapiAdmin.translatedErrors.required);
671
+ }
672
+ return schema;
673
+ };
674
+ const addMinLengthValidation = (attribute, options) => (schema) => {
675
+ if (options.status === "draft") {
676
+ return schema;
677
+ }
619
678
  if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
620
679
  return schema.min(attribute.minLength, {
621
680
  ...strapiAdmin.translatedErrors.minLength,
@@ -637,32 +696,13 @@ const addMaxLengthValidation = (attribute) => (schema) => {
637
696
  }
638
697
  return schema;
639
698
  };
640
- const addMinValidation = (attribute) => (schema) => {
641
- if ("min" in attribute) {
699
+ const addMinValidation = (attribute, options) => (schema) => {
700
+ if (options.status === "draft") {
701
+ return schema;
702
+ }
703
+ if ("min" in attribute && "min" in schema) {
642
704
  const min = toInteger(attribute.min);
643
- if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
644
- if (!attribute.required && "test" in schema && min) {
645
- return schema.test(
646
- "custom-min",
647
- {
648
- ...strapiAdmin.translatedErrors.min,
649
- values: {
650
- min: attribute.min
651
- }
652
- },
653
- (value) => {
654
- if (!value) {
655
- return true;
656
- }
657
- if (Array.isArray(value) && value.length === 0) {
658
- return true;
659
- }
660
- return value.length >= min;
661
- }
662
- );
663
- }
664
- }
665
- if ("min" in schema && min) {
705
+ if (min) {
666
706
  return schema.min(min, {
667
707
  ...strapiAdmin.translatedErrors.min,
668
708
  values: {
@@ -780,19 +820,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
780
820
  }, {});
781
821
  return componentsByKey;
782
822
  };
783
- const useDocument = (args, opts) => {
823
+ const HOOKS = {
824
+ /**
825
+ * Hook that allows to mutate the displayed headers of the list view table
826
+ * @constant
827
+ * @type {string}
828
+ */
829
+ INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
830
+ /**
831
+ * Hook that allows to mutate the CM's collection types links pre-set filters
832
+ * @constant
833
+ * @type {string}
834
+ */
835
+ MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
836
+ /**
837
+ * Hook that allows to mutate the CM's edit view layout
838
+ * @constant
839
+ * @type {string}
840
+ */
841
+ MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
842
+ /**
843
+ * Hook that allows to mutate the CM's single types links pre-set filters
844
+ * @constant
845
+ * @type {string}
846
+ */
847
+ MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
848
+ };
849
+ const contentTypesApi = contentManagerApi.injectEndpoints({
850
+ endpoints: (builder) => ({
851
+ getContentTypeConfiguration: builder.query({
852
+ query: (uid) => ({
853
+ url: `/content-manager/content-types/${uid}/configuration`,
854
+ method: "GET"
855
+ }),
856
+ transformResponse: (response) => response.data,
857
+ providesTags: (_result, _error, uid) => [
858
+ { type: "ContentTypesConfiguration", id: uid },
859
+ { type: "ContentTypeSettings", id: "LIST" }
860
+ ]
861
+ }),
862
+ getAllContentTypeSettings: builder.query({
863
+ query: () => "/content-manager/content-types-settings",
864
+ transformResponse: (response) => response.data,
865
+ providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
866
+ }),
867
+ updateContentTypeConfiguration: builder.mutation({
868
+ query: ({ uid, ...body }) => ({
869
+ url: `/content-manager/content-types/${uid}/configuration`,
870
+ method: "PUT",
871
+ data: body
872
+ }),
873
+ transformResponse: (response) => response.data,
874
+ invalidatesTags: (_result, _error, { uid }) => [
875
+ { type: "ContentTypesConfiguration", id: uid },
876
+ { type: "ContentTypeSettings", id: "LIST" },
877
+ // Is this necessary?
878
+ { type: "InitialData" }
879
+ ]
880
+ })
881
+ })
882
+ });
883
+ const {
884
+ useGetContentTypeConfigurationQuery,
885
+ useGetAllContentTypeSettingsQuery,
886
+ useUpdateContentTypeConfigurationMutation
887
+ } = contentTypesApi;
888
+ const checkIfAttributeIsDisplayable = (attribute) => {
889
+ const { type } = attribute;
890
+ if (type === "relation") {
891
+ return !attribute.relation.toLowerCase().includes("morph");
892
+ }
893
+ return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
894
+ };
895
+ const getMainField = (attribute, mainFieldName, { schemas, components }) => {
896
+ if (!mainFieldName) {
897
+ return void 0;
898
+ }
899
+ const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
900
+ // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
901
+ schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
902
+ );
903
+ return {
904
+ name: mainFieldName,
905
+ type: mainFieldType ?? "string"
906
+ };
907
+ };
908
+ const DEFAULT_SETTINGS = {
909
+ bulkable: false,
910
+ filterable: false,
911
+ searchable: false,
912
+ pagination: false,
913
+ defaultSortBy: "",
914
+ defaultSortOrder: "asc",
915
+ mainField: "id",
916
+ pageSize: 10
917
+ };
918
+ const useDocumentLayout = (model) => {
919
+ const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
920
+ const [{ query }] = strapiAdmin.useQueryParams();
921
+ const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
784
922
  const { toggleNotification } = strapiAdmin.useNotification();
785
923
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
924
+ const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
786
925
  const {
787
- currentData: data,
788
- isLoading: isLoadingDocument,
789
- isFetching: isFetchingDocument,
790
- error
791
- } = useGetDocumentQuery(args, {
792
- ...opts,
793
- skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
794
- });
795
- const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
926
+ data,
927
+ isLoading: isLoadingConfigs,
928
+ error,
929
+ isFetching: isFetchingConfigs
930
+ } = useGetContentTypeConfigurationQuery(model);
931
+ const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
796
932
  React__namespace.useEffect(() => {
797
933
  if (error) {
798
934
  toggleNotification({
@@ -800,88 +936,344 @@ const useDocument = (args, opts) => {
800
936
  message: formatAPIError(error)
801
937
  });
802
938
  }
803
- }, [toggleNotification, error, formatAPIError, args.collectionType]);
804
- const validationSchema = React__namespace.useMemo(() => {
805
- if (!schema) {
806
- return null;
807
- }
808
- return createYupSchema(schema.attributes, components);
809
- }, [schema, components]);
810
- const validate = React__namespace.useCallback(
811
- (document) => {
812
- if (!validationSchema) {
813
- throw new Error(
814
- "There is no validation schema generated, this is likely due to the schema not being loaded yet."
815
- );
816
- }
817
- try {
818
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
819
- return null;
820
- } catch (error2) {
821
- if (error2 instanceof yup.ValidationError) {
822
- return strapiAdmin.getYupValidationErrors(error2);
823
- }
824
- throw error2;
825
- }
939
+ }, [error, formatAPIError, toggleNotification]);
940
+ const editLayout = React__namespace.useMemo(
941
+ () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
942
+ layout: [],
943
+ components: {},
944
+ metadatas: {},
945
+ options: {},
946
+ settings: DEFAULT_SETTINGS
826
947
  },
827
- [validationSchema]
948
+ [data, isLoading, schemas, schema, components]
949
+ );
950
+ const listLayout = React__namespace.useMemo(() => {
951
+ return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
952
+ layout: [],
953
+ metadatas: {},
954
+ options: {},
955
+ settings: DEFAULT_SETTINGS
956
+ };
957
+ }, [data, isLoading, schemas, schema, components]);
958
+ const { layout: edit } = React__namespace.useMemo(
959
+ () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
960
+ layout: editLayout,
961
+ query
962
+ }),
963
+ [editLayout, query, runHookWaterfall]
828
964
  );
829
- const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
830
965
  return {
831
- components,
832
- document: data?.data,
833
- meta: data?.meta,
966
+ error,
834
967
  isLoading,
835
- schema,
836
- validate
837
- };
838
- };
839
- const useDoc = () => {
840
- const { id, slug, collectionType, origin } = reactRouterDom.useParams();
841
- const [{ query }] = strapiAdmin.useQueryParams();
842
- const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
843
- if (!collectionType) {
844
- throw new Error("Could not find collectionType in url params");
845
- }
846
- if (!slug) {
847
- throw new Error("Could not find model in url params");
848
- }
849
- return {
850
- collectionType,
851
- model: slug,
852
- id: origin || id === "create" ? void 0 : id,
853
- ...useDocument(
854
- { documentId: origin || id, model: slug, collectionType, params },
855
- {
856
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
857
- }
858
- )
968
+ edit,
969
+ list: listLayout
859
970
  };
860
971
  };
861
- const prefixPluginTranslations = (trad, pluginId) => {
862
- if (!pluginId) {
863
- throw new TypeError("pluginId can't be empty");
864
- }
865
- return Object.keys(trad).reduce((acc, current) => {
866
- acc[`${pluginId}.${current}`] = trad[current];
867
- return acc;
868
- }, {});
869
- };
870
- const getTranslation = (id) => `content-manager.${id}`;
871
- const DEFAULT_UNEXPECTED_ERROR_MSG = {
872
- id: "notification.error",
873
- defaultMessage: "An error occurred, please try again"
972
+ const useDocLayout = () => {
973
+ const { model } = useDoc();
974
+ return useDocumentLayout(model);
874
975
  };
875
- const useDocumentActions = () => {
876
- const { toggleNotification } = strapiAdmin.useNotification();
877
- const { formatMessage } = reactIntl.useIntl();
878
- const { trackUsage } = strapiAdmin.useTracking();
879
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
880
- const [deleteDocument] = useDeleteDocumentMutation();
881
- const _delete = React__namespace.useCallback(
882
- async ({ collectionType, model, documentId, params }, trackerProperty) => {
883
- try {
884
- trackUsage("willDeleteEntry", trackerProperty);
976
+ const formatEditLayout = (data, {
977
+ schemas,
978
+ schema,
979
+ components
980
+ }) => {
981
+ let currentPanelIndex = 0;
982
+ const panelledEditAttributes = convertEditLayoutToFieldLayouts(
983
+ data.contentType.layouts.edit,
984
+ schema?.attributes,
985
+ data.contentType.metadatas,
986
+ { configurations: data.components, schemas: components },
987
+ schemas
988
+ ).reduce((panels, row) => {
989
+ if (row.some((field) => field.type === "dynamiczone")) {
990
+ panels.push([row]);
991
+ currentPanelIndex += 2;
992
+ } else {
993
+ if (!panels[currentPanelIndex]) {
994
+ panels.push([row]);
995
+ } else {
996
+ panels[currentPanelIndex].push(row);
997
+ }
998
+ }
999
+ return panels;
1000
+ }, []);
1001
+ const componentEditAttributes = Object.entries(data.components).reduce(
1002
+ (acc, [uid, configuration]) => {
1003
+ acc[uid] = {
1004
+ layout: convertEditLayoutToFieldLayouts(
1005
+ configuration.layouts.edit,
1006
+ components[uid].attributes,
1007
+ configuration.metadatas,
1008
+ { configurations: data.components, schemas: components }
1009
+ ),
1010
+ settings: {
1011
+ ...configuration.settings,
1012
+ icon: components[uid].info.icon,
1013
+ displayName: components[uid].info.displayName
1014
+ }
1015
+ };
1016
+ return acc;
1017
+ },
1018
+ {}
1019
+ );
1020
+ const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
1021
+ (acc, [attribute, metadata]) => {
1022
+ return {
1023
+ ...acc,
1024
+ [attribute]: metadata.edit
1025
+ };
1026
+ },
1027
+ {}
1028
+ );
1029
+ return {
1030
+ layout: panelledEditAttributes,
1031
+ components: componentEditAttributes,
1032
+ metadatas: editMetadatas,
1033
+ settings: {
1034
+ ...data.contentType.settings,
1035
+ displayName: schema?.info.displayName
1036
+ },
1037
+ options: {
1038
+ ...schema?.options,
1039
+ ...schema?.pluginOptions,
1040
+ ...data.contentType.options
1041
+ }
1042
+ };
1043
+ };
1044
+ const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
1045
+ return rows.map(
1046
+ (row) => row.map((field) => {
1047
+ const attribute = attributes[field.name];
1048
+ if (!attribute) {
1049
+ return null;
1050
+ }
1051
+ const { edit: metadata } = metadatas[field.name];
1052
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1053
+ return {
1054
+ attribute,
1055
+ disabled: !metadata.editable,
1056
+ hint: metadata.description,
1057
+ label: metadata.label ?? "",
1058
+ name: field.name,
1059
+ // @ts-expect-error – mainField does exist on the metadata for a relation.
1060
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1061
+ schemas,
1062
+ components: components?.schemas ?? {}
1063
+ }),
1064
+ placeholder: metadata.placeholder ?? "",
1065
+ required: attribute.required ?? false,
1066
+ size: field.size,
1067
+ unique: "unique" in attribute ? attribute.unique : false,
1068
+ visible: metadata.visible ?? true,
1069
+ type: attribute.type
1070
+ };
1071
+ }).filter((field) => field !== null)
1072
+ );
1073
+ };
1074
+ const formatListLayout = (data, {
1075
+ schemas,
1076
+ schema,
1077
+ components
1078
+ }) => {
1079
+ const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
1080
+ (acc, [attribute, metadata]) => {
1081
+ return {
1082
+ ...acc,
1083
+ [attribute]: metadata.list
1084
+ };
1085
+ },
1086
+ {}
1087
+ );
1088
+ const listAttributes = convertListLayoutToFieldLayouts(
1089
+ data.contentType.layouts.list,
1090
+ schema?.attributes,
1091
+ listMetadatas,
1092
+ { configurations: data.components, schemas: components },
1093
+ schemas
1094
+ );
1095
+ return {
1096
+ layout: listAttributes,
1097
+ settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
1098
+ metadatas: listMetadatas,
1099
+ options: {
1100
+ ...schema?.options,
1101
+ ...schema?.pluginOptions,
1102
+ ...data.contentType.options
1103
+ }
1104
+ };
1105
+ };
1106
+ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
1107
+ return columns.map((name) => {
1108
+ const attribute = attributes[name];
1109
+ if (!attribute) {
1110
+ return null;
1111
+ }
1112
+ const metadata = metadatas[name];
1113
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1114
+ return {
1115
+ attribute,
1116
+ label: metadata.label ?? "",
1117
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1118
+ schemas,
1119
+ components: components?.schemas ?? {}
1120
+ }),
1121
+ name,
1122
+ searchable: metadata.searchable ?? true,
1123
+ sortable: metadata.sortable ?? true
1124
+ };
1125
+ }).filter((field) => field !== null);
1126
+ };
1127
+ const useDocument = (args, opts) => {
1128
+ const { toggleNotification } = strapiAdmin.useNotification();
1129
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
1130
+ const {
1131
+ currentData: data,
1132
+ isLoading: isLoadingDocument,
1133
+ isFetching: isFetchingDocument,
1134
+ error
1135
+ } = useGetDocumentQuery(args, {
1136
+ ...opts,
1137
+ skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1138
+ });
1139
+ const {
1140
+ components,
1141
+ schema,
1142
+ schemas,
1143
+ isLoading: isLoadingSchema
1144
+ } = useContentTypeSchema(args.model);
1145
+ React__namespace.useEffect(() => {
1146
+ if (error) {
1147
+ toggleNotification({
1148
+ type: "danger",
1149
+ message: formatAPIError(error)
1150
+ });
1151
+ }
1152
+ }, [toggleNotification, error, formatAPIError, args.collectionType]);
1153
+ const validationSchema = React__namespace.useMemo(() => {
1154
+ if (!schema) {
1155
+ return null;
1156
+ }
1157
+ return createYupSchema(schema.attributes, components);
1158
+ }, [schema, components]);
1159
+ const validate = React__namespace.useCallback(
1160
+ (document) => {
1161
+ if (!validationSchema) {
1162
+ throw new Error(
1163
+ "There is no validation schema generated, this is likely due to the schema not being loaded yet."
1164
+ );
1165
+ }
1166
+ try {
1167
+ validationSchema.validateSync(document, { abortEarly: false, strict: true });
1168
+ return null;
1169
+ } catch (error2) {
1170
+ if (error2 instanceof yup.ValidationError) {
1171
+ return strapiAdmin.getYupValidationErrors(error2);
1172
+ }
1173
+ throw error2;
1174
+ }
1175
+ },
1176
+ [validationSchema]
1177
+ );
1178
+ const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1179
+ const hasError = !!error;
1180
+ return {
1181
+ components,
1182
+ document: data?.data,
1183
+ meta: data?.meta,
1184
+ isLoading,
1185
+ hasError,
1186
+ schema,
1187
+ schemas,
1188
+ validate
1189
+ };
1190
+ };
1191
+ const useDoc = () => {
1192
+ const { id, slug, collectionType, origin } = reactRouterDom.useParams();
1193
+ const [{ query }] = strapiAdmin.useQueryParams();
1194
+ const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
1195
+ if (!collectionType) {
1196
+ throw new Error("Could not find collectionType in url params");
1197
+ }
1198
+ if (!slug) {
1199
+ throw new Error("Could not find model in url params");
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;
1208
+ return {
1209
+ collectionType,
1210
+ model: slug,
1211
+ id: returnId,
1212
+ ...document
1213
+ };
1214
+ };
1215
+ const useContentManagerContext = () => {
1216
+ const {
1217
+ collectionType,
1218
+ model,
1219
+ id,
1220
+ components,
1221
+ isLoading: isLoadingDoc,
1222
+ schema,
1223
+ schemas
1224
+ } = useDoc();
1225
+ const layout = useDocumentLayout(model);
1226
+ const form = strapiAdmin.useForm("useContentManagerContext", (state) => state);
1227
+ const isSingleType = collectionType === SINGLE_TYPES;
1228
+ const slug = model;
1229
+ const isCreatingEntry = id === "create";
1230
+ useContentTypeSchema();
1231
+ const isLoading = isLoadingDoc || layout.isLoading;
1232
+ const error = layout.error;
1233
+ return {
1234
+ error,
1235
+ isLoading,
1236
+ // Base metadata
1237
+ model,
1238
+ collectionType,
1239
+ id,
1240
+ slug,
1241
+ isCreatingEntry,
1242
+ isSingleType,
1243
+ hasDraftAndPublish: schema?.options?.draftAndPublish ?? false,
1244
+ // All schema infos
1245
+ components,
1246
+ contentType: schema,
1247
+ contentTypes: schemas,
1248
+ // Form state
1249
+ form,
1250
+ // layout infos
1251
+ layout
1252
+ };
1253
+ };
1254
+ const prefixPluginTranslations = (trad, pluginId) => {
1255
+ return Object.keys(trad).reduce((acc, current) => {
1256
+ acc[`${pluginId}.${current}`] = trad[current];
1257
+ return acc;
1258
+ }, {});
1259
+ };
1260
+ const getTranslation = (id) => `content-manager.${id}`;
1261
+ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1262
+ id: "notification.error",
1263
+ defaultMessage: "An error occurred, please try again"
1264
+ };
1265
+ const useDocumentActions = () => {
1266
+ const { toggleNotification } = strapiAdmin.useNotification();
1267
+ const { formatMessage } = reactIntl.useIntl();
1268
+ const { trackUsage } = strapiAdmin.useTracking();
1269
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
1270
+ const navigate = reactRouterDom.useNavigate();
1271
+ const setCurrentStep = strapiAdmin.useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
1272
+ const [deleteDocument] = useDeleteDocumentMutation();
1273
+ const _delete = React__namespace.useCallback(
1274
+ async ({ collectionType, model, documentId, params }, trackerProperty) => {
1275
+ try {
1276
+ trackUsage("willDeleteEntry", trackerProperty);
885
1277
  const res = await deleteDocument({
886
1278
  collectionType,
887
1279
  model,
@@ -1191,6 +1583,7 @@ const useDocumentActions = () => {
1191
1583
  defaultMessage: "Saved document"
1192
1584
  })
1193
1585
  });
1586
+ setCurrentStep("contentManager.success");
1194
1587
  return res.data;
1195
1588
  } catch (err) {
1196
1589
  toggleNotification({
@@ -1230,7 +1623,7 @@ const useDocumentActions = () => {
1230
1623
  throw err;
1231
1624
  }
1232
1625
  },
1233
- [autoCloneDocument, formatAPIError, formatMessage, toggleNotification]
1626
+ [autoCloneDocument, formatMessage, toggleNotification]
1234
1627
  );
1235
1628
  const [cloneDocument] = useCloneDocumentMutation();
1236
1629
  const clone = React__namespace.useCallback(
@@ -1256,6 +1649,7 @@ const useDocumentActions = () => {
1256
1649
  defaultMessage: "Cloned document"
1257
1650
  })
1258
1651
  });
1652
+ navigate(`../../${res.data.data.documentId}`, { relative: "path" });
1259
1653
  return res.data;
1260
1654
  } catch (err) {
1261
1655
  toggleNotification({
@@ -1266,7 +1660,7 @@ const useDocumentActions = () => {
1266
1660
  throw err;
1267
1661
  }
1268
1662
  },
1269
- [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
1663
+ [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
1270
1664
  );
1271
1665
  const [getDoc] = useLazyGetDocumentQuery();
1272
1666
  const getDocument = React__namespace.useCallback(
@@ -1291,10 +1685,10 @@ const useDocumentActions = () => {
1291
1685
  update
1292
1686
  };
1293
1687
  };
1294
- const ProtectedHistoryPage = React.lazy(
1295
- () => Promise.resolve().then(() => require("./History-DNQkXANT.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1688
+ const ProtectedHistoryPage = React__namespace.lazy(
1689
+ () => Promise.resolve().then(() => require("./History-40apIShV.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1296
1690
  );
1297
- const routes$1 = [
1691
+ const routes$2 = [
1298
1692
  {
1299
1693
  path: ":collectionType/:slug/:id/history",
1300
1694
  Component: ProtectedHistoryPage
@@ -1304,32 +1698,45 @@ const routes$1 = [
1304
1698
  Component: ProtectedHistoryPage
1305
1699
  }
1306
1700
  ];
1701
+ const ProtectedPreviewPage = React__namespace.lazy(
1702
+ () => Promise.resolve().then(() => require("./Preview-V8XOfrQf.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
1703
+ );
1704
+ const routes$1 = [
1705
+ {
1706
+ path: ":collectionType/:slug/:id/preview",
1707
+ Component: ProtectedPreviewPage
1708
+ },
1709
+ {
1710
+ path: ":collectionType/:slug/preview",
1711
+ Component: ProtectedPreviewPage
1712
+ }
1713
+ ];
1307
1714
  const ProtectedEditViewPage = React.lazy(
1308
- () => Promise.resolve().then(() => require("./EditViewPage-C-ukDOB7.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1715
+ () => Promise.resolve().then(() => require("./EditViewPage-BUtpHsMz.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1309
1716
  );
1310
1717
  const ProtectedListViewPage = React.lazy(
1311
- () => Promise.resolve().then(() => require("./ListViewPage-BsLiH2-2.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1718
+ () => Promise.resolve().then(() => require("./ListViewPage-CjaHQ2_V.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1312
1719
  );
1313
1720
  const ProtectedListConfiguration = React.lazy(
1314
- () => Promise.resolve().then(() => require("./ListConfigurationPage-CUQxfpjT.js")).then((mod) => ({
1721
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-DAGbWDIL.js")).then((mod) => ({
1315
1722
  default: mod.ProtectedListConfiguration
1316
1723
  }))
1317
1724
  );
1318
1725
  const ProtectedEditConfigurationPage = React.lazy(
1319
- () => Promise.resolve().then(() => require("./EditConfigurationPage-Xp7lun0f.js")).then((mod) => ({
1726
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-BG7rpPjL.js")).then((mod) => ({
1320
1727
  default: mod.ProtectedEditConfigurationPage
1321
1728
  }))
1322
1729
  );
1323
1730
  const ProtectedComponentConfigurationPage = React.lazy(
1324
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-5ukroXAh.js")).then((mod) => ({
1731
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-Br8hp2Xt.js")).then((mod) => ({
1325
1732
  default: mod.ProtectedComponentConfigurationPage
1326
1733
  }))
1327
1734
  );
1328
1735
  const NoPermissions = React.lazy(
1329
- () => Promise.resolve().then(() => require("./NoPermissionsPage-_lUqjGW3.js")).then((mod) => ({ default: mod.NoPermissions }))
1736
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-CY3_QduF.js")).then((mod) => ({ default: mod.NoPermissions }))
1330
1737
  );
1331
1738
  const NoContentType = React.lazy(
1332
- () => Promise.resolve().then(() => require("./NoContentTypePage-BZ-PnGAf.js")).then((mod) => ({ default: mod.NoContentType }))
1739
+ () => Promise.resolve().then(() => require("./NoContentTypePage-CGxqLI8j.js")).then((mod) => ({ default: mod.NoContentType }))
1333
1740
  );
1334
1741
  const CollectionTypePages = () => {
1335
1742
  const { collectionType } = reactRouterDom.useParams();
@@ -1375,6 +1782,7 @@ const routes = [
1375
1782
  path: "no-content-types",
1376
1783
  Component: NoContentType
1377
1784
  },
1785
+ ...routes$2,
1378
1786
  ...routes$1
1379
1787
  ];
1380
1788
  const DocumentActions = ({ actions: actions2 }) => {
@@ -1443,12 +1851,14 @@ const DocumentActionButton = (action) => {
1443
1851
  /* @__PURE__ */ jsxRuntime.jsx(
1444
1852
  designSystem.Button,
1445
1853
  {
1446
- flex: 1,
1854
+ flex: "auto",
1447
1855
  startIcon: action.icon,
1448
1856
  disabled: action.disabled,
1449
1857
  onClick: handleClick(action),
1450
1858
  justifyContent: "center",
1451
1859
  variant: action.variant || "default",
1860
+ paddingTop: "7px",
1861
+ paddingBottom: "7px",
1452
1862
  children: action.label
1453
1863
  }
1454
1864
  ),
@@ -1513,9 +1923,9 @@ const DocumentActionsMenu = ({
1513
1923
  disabled: isDisabled,
1514
1924
  size: "S",
1515
1925
  endIcon: null,
1516
- paddingTop: "7px",
1517
- paddingLeft: "9px",
1518
- paddingRight: "9px",
1926
+ paddingTop: "4px",
1927
+ paddingLeft: "7px",
1928
+ paddingRight: "7px",
1519
1929
  variant,
1520
1930
  children: [
1521
1931
  /* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
@@ -1526,7 +1936,7 @@ const DocumentActionsMenu = ({
1526
1936
  ]
1527
1937
  }
1528
1938
  ),
1529
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: "4px", maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1939
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1530
1940
  actions2.map((action) => {
1531
1941
  return /* @__PURE__ */ jsxRuntime.jsx(
1532
1942
  designSystem.Menu.Item,
@@ -1535,10 +1945,25 @@ const DocumentActionsMenu = ({
1535
1945
  onSelect: handleClick(action),
1536
1946
  display: "block",
1537
1947
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
1538
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1539
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "span", color: convertActionVariantToIconColor(action.variant), children: action.icon }),
1540
- action.label
1541
- ] }),
1948
+ /* @__PURE__ */ jsxRuntime.jsxs(
1949
+ designSystem.Flex,
1950
+ {
1951
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1952
+ gap: 2,
1953
+ tag: "span",
1954
+ children: [
1955
+ /* @__PURE__ */ jsxRuntime.jsx(
1956
+ designSystem.Flex,
1957
+ {
1958
+ tag: "span",
1959
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1960
+ children: action.icon
1961
+ }
1962
+ ),
1963
+ action.label
1964
+ ]
1965
+ }
1966
+ ),
1542
1967
  action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
1543
1968
  designSystem.Flex,
1544
1969
  {
@@ -1635,11 +2060,11 @@ const DocumentActionConfirmDialog = ({
1635
2060
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
1636
2061
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
1637
2062
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
1638
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
2063
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
1639
2064
  id: "app.components.Button.cancel",
1640
2065
  defaultMessage: "Cancel"
1641
2066
  }) }) }),
1642
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
2067
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
1643
2068
  id: "app.components.Button.confirm",
1644
2069
  defaultMessage: "Confirm"
1645
2070
  }) })
@@ -1666,6 +2091,18 @@ const DocumentActionModal = ({
1666
2091
  typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
1667
2092
  ] }) });
1668
2093
  };
2094
+ const transformData = (data) => {
2095
+ if (Array.isArray(data)) {
2096
+ return data.map(transformData);
2097
+ }
2098
+ if (typeof data === "object" && data !== null) {
2099
+ if ("apiData" in data) {
2100
+ return data.apiData;
2101
+ }
2102
+ return mapValues__default.default(transformData)(data);
2103
+ }
2104
+ return data;
2105
+ };
1669
2106
  const PublishAction$1 = ({
1670
2107
  activeTab,
1671
2108
  documentId,
@@ -1678,12 +2115,10 @@ const PublishAction$1 = ({
1678
2115
  const navigate = reactRouterDom.useNavigate();
1679
2116
  const { toggleNotification } = strapiAdmin.useNotification();
1680
2117
  const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
2118
+ const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
1681
2119
  const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
1682
2120
  const { formatMessage } = reactIntl.useIntl();
1683
- const { canPublish, canCreate, canUpdate } = useDocumentRBAC(
1684
- "PublishAction",
1685
- ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1686
- );
2121
+ const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
1687
2122
  const { publish } = useDocumentActions();
1688
2123
  const [
1689
2124
  countDraftRelations,
@@ -1735,24 +2170,25 @@ const PublishAction$1 = ({
1735
2170
  }
1736
2171
  }, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
1737
2172
  React__namespace.useEffect(() => {
1738
- if (documentId) {
1739
- const fetchDraftRelationsCount = async () => {
1740
- const { data, error } = await countDraftRelations({
1741
- collectionType,
1742
- model,
1743
- documentId,
1744
- params
1745
- });
1746
- if (error) {
1747
- throw error;
1748
- }
1749
- if (data) {
1750
- setServerCountOfDraftRelations(data.data);
1751
- }
1752
- };
1753
- fetchDraftRelationsCount();
2173
+ if (!document || !document.documentId || isListView) {
2174
+ return;
1754
2175
  }
1755
- }, [documentId, countDraftRelations, collectionType, model, params]);
2176
+ const fetchDraftRelationsCount = async () => {
2177
+ const { data, error } = await countDraftRelations({
2178
+ collectionType,
2179
+ model,
2180
+ documentId,
2181
+ params
2182
+ });
2183
+ if (error) {
2184
+ throw error;
2185
+ }
2186
+ if (data) {
2187
+ setServerCountOfDraftRelations(data.data);
2188
+ }
2189
+ };
2190
+ fetchDraftRelationsCount();
2191
+ }, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
1756
2192
  const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1757
2193
  if (!schema?.options?.draftAndPublish) {
1758
2194
  return null;
@@ -1760,7 +2196,9 @@ const PublishAction$1 = ({
1760
2196
  const performPublish = async () => {
1761
2197
  setSubmitting(true);
1762
2198
  try {
1763
- const { errors } = await validate();
2199
+ const { errors } = await validate(true, {
2200
+ status: "published"
2201
+ });
1764
2202
  if (errors) {
1765
2203
  toggleNotification({
1766
2204
  type: "danger",
@@ -1778,7 +2216,7 @@ const PublishAction$1 = ({
1778
2216
  documentId,
1779
2217
  params
1780
2218
  },
1781
- formValues
2219
+ transformData(formValues)
1782
2220
  );
1783
2221
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1784
2222
  navigate({
@@ -1793,7 +2231,8 @@ const PublishAction$1 = ({
1793
2231
  }
1794
2232
  };
1795
2233
  const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
1796
- const hasDraftRelations = totalDraftRelations > 0;
2234
+ const enableDraftRelationsCount = false;
2235
+ const hasDraftRelations = enableDraftRelationsCount;
1797
2236
  return {
1798
2237
  /**
1799
2238
  * Disabled when:
@@ -1803,18 +2242,13 @@ const PublishAction$1 = ({
1803
2242
  * - the document is already published & not modified
1804
2243
  * - the document is being created & not modified
1805
2244
  * - the user doesn't have the permission to publish
1806
- * - the user doesn't have the permission to create a new document
1807
- * - the user doesn't have the permission to update the document
1808
2245
  */
1809
- disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
2246
+ disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
1810
2247
  label: formatMessage({
1811
2248
  id: "app.utils.publish",
1812
2249
  defaultMessage: "Publish"
1813
2250
  }),
1814
2251
  onClick: async () => {
1815
- if (hasDraftRelations) {
1816
- return;
1817
- }
1818
2252
  await performPublish();
1819
2253
  },
1820
2254
  dialog: hasDraftRelations ? {
@@ -1853,10 +2287,6 @@ const UpdateAction = ({
1853
2287
  const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
1854
2288
  const isCloning = cloneMatch !== null;
1855
2289
  const { formatMessage } = reactIntl.useIntl();
1856
- const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1857
- canCreate: canCreate2,
1858
- canUpdate: canUpdate2
1859
- }));
1860
2290
  const { create, update, clone } = useDocumentActions();
1861
2291
  const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
1862
2292
  const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
@@ -1873,10 +2303,8 @@ const UpdateAction = ({
1873
2303
  * - the form is submitting
1874
2304
  * - the document is not modified & we're not cloning (you can save a clone entity straight away)
1875
2305
  * - the active tab is the published tab
1876
- * - the user doesn't have the permission to create a new document
1877
- * - the user doesn't have the permission to update the document
1878
2306
  */
1879
- disabled: isSubmitting || !modified && !isCloning || activeTab === "published" || Boolean(!documentId && !canCreate || documentId && !canUpdate),
2307
+ disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
1880
2308
  label: formatMessage({
1881
2309
  id: "content-manager.containers.Edit.save",
1882
2310
  defaultMessage: "Save"
@@ -1884,7 +2312,9 @@ const UpdateAction = ({
1884
2312
  onClick: async () => {
1885
2313
  setSubmitting(true);
1886
2314
  try {
1887
- const { errors } = await validate();
2315
+ const { errors } = await validate(true, {
2316
+ status: "draft"
2317
+ });
1888
2318
  if (errors) {
1889
2319
  toggleNotification({
1890
2320
  type: "danger",
@@ -1902,7 +2332,7 @@ const UpdateAction = ({
1902
2332
  documentId: cloneMatch.params.origin,
1903
2333
  params
1904
2334
  },
1905
- document
2335
+ transformData(document)
1906
2336
  );
1907
2337
  if ("data" in res) {
1908
2338
  navigate(
@@ -1923,7 +2353,7 @@ const UpdateAction = ({
1923
2353
  documentId,
1924
2354
  params
1925
2355
  },
1926
- document
2356
+ transformData(document)
1927
2357
  );
1928
2358
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1929
2359
  setErrors(formatValidationErrors(res.error));
@@ -1936,7 +2366,7 @@ const UpdateAction = ({
1936
2366
  model,
1937
2367
  params
1938
2368
  },
1939
- document
2369
+ transformData(document)
1940
2370
  );
1941
2371
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1942
2372
  navigate(
@@ -1989,7 +2419,7 @@ const UnpublishAction$1 = ({
1989
2419
  id: "app.utils.unpublish",
1990
2420
  defaultMessage: "Unpublish"
1991
2421
  }),
1992
- icon: /* @__PURE__ */ jsxRuntime.jsx(StyledCrossCircle, {}),
2422
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
1993
2423
  onClick: async () => {
1994
2424
  if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
1995
2425
  if (!documentId) {
@@ -2101,7 +2531,7 @@ const DiscardAction = ({
2101
2531
  id: "content-manager.actions.discard.label",
2102
2532
  defaultMessage: "Discard changes"
2103
2533
  }),
2104
- icon: /* @__PURE__ */ jsxRuntime.jsx(StyledCrossCircle, {}),
2534
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
2105
2535
  position: ["panel", "table-row"],
2106
2536
  variant: "danger",
2107
2537
  dialog: {
@@ -2129,11 +2559,6 @@ const DiscardAction = ({
2129
2559
  };
2130
2560
  };
2131
2561
  DiscardAction.type = "discard";
2132
- const StyledCrossCircle = styledComponents.styled(Icons.CrossCircle)`
2133
- path {
2134
- fill: currentColor;
2135
- }
2136
- `;
2137
2562
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2138
2563
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2139
2564
  const RelativeTime = React__namespace.forwardRef(
@@ -2181,8 +2606,12 @@ const getDisplayName = ({
2181
2606
  };
2182
2607
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2183
2608
  const DocumentStatus = ({ status = "draft", ...restProps }) => {
2184
- const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
2185
- 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) }) });
2609
+ const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2610
+ const { formatMessage } = reactIntl.useIntl();
2611
+ 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: formatMessage({
2612
+ id: `content-manager.containers.List.${status}`,
2613
+ defaultMessage: capitalise(status)
2614
+ }) }) });
2186
2615
  };
2187
2616
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2188
2617
  const { formatMessage } = reactIntl.useIntl();
@@ -2280,12 +2709,12 @@ const Information = ({ activeTab }) => {
2280
2709
  isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2281
2710
  label: formatMessage({
2282
2711
  id: "content-manager.containers.edit.information.last-published.label",
2283
- defaultMessage: "Last published"
2712
+ defaultMessage: "Published"
2284
2713
  }),
2285
2714
  value: formatMessage(
2286
2715
  {
2287
2716
  id: "content-manager.containers.edit.information.last-published.value",
2288
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2717
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2289
2718
  },
2290
2719
  {
2291
2720
  time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
@@ -2298,12 +2727,12 @@ const Information = ({ activeTab }) => {
2298
2727
  isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2299
2728
  label: formatMessage({
2300
2729
  id: "content-manager.containers.edit.information.last-draft.label",
2301
- defaultMessage: "Last draft"
2730
+ defaultMessage: "Updated"
2302
2731
  }),
2303
2732
  value: formatMessage(
2304
2733
  {
2305
2734
  id: "content-manager.containers.edit.information.last-draft.value",
2306
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2735
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2307
2736
  },
2308
2737
  {
2309
2738
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2321,12 +2750,12 @@ const Information = ({ activeTab }) => {
2321
2750
  isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2322
2751
  label: formatMessage({
2323
2752
  id: "content-manager.containers.edit.information.document.label",
2324
- defaultMessage: "Document"
2753
+ defaultMessage: "Created"
2325
2754
  }),
2326
2755
  value: formatMessage(
2327
2756
  {
2328
2757
  id: "content-manager.containers.edit.information.document.value",
2329
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2758
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2330
2759
  },
2331
2760
  {
2332
2761
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2364,523 +2793,277 @@ const Information = ({ activeTab }) => {
2364
2793
  );
2365
2794
  };
2366
2795
  const HeaderActions = ({ actions: actions2 }) => {
2367
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: actions2.map((action) => {
2368
- if ("options" in action) {
2796
+ const [dialogId, setDialogId] = React__namespace.useState(null);
2797
+ const handleClick = (action) => async (e) => {
2798
+ if (!("options" in action)) {
2799
+ const { onClick = () => false, dialog, id } = action;
2800
+ const muteDialog = await onClick(e);
2801
+ if (dialog && !muteDialog) {
2802
+ e.preventDefault();
2803
+ setDialogId(id);
2804
+ }
2805
+ }
2806
+ };
2807
+ const handleClose = () => {
2808
+ setDialogId(null);
2809
+ };
2810
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, children: actions2.map((action) => {
2811
+ if (action.options) {
2369
2812
  return /* @__PURE__ */ jsxRuntime.jsx(
2370
2813
  designSystem.SingleSelect,
2371
2814
  {
2372
2815
  size: "S",
2373
- disabled: action.disabled,
2374
- "aria-label": action.label,
2375
2816
  onChange: action.onSelect,
2376
- value: action.value,
2817
+ "aria-label": action.label,
2818
+ ...action,
2377
2819
  children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
2378
2820
  },
2379
2821
  action.id
2380
2822
  );
2381
2823
  } else {
2382
- return null;
2383
- }
2384
- }) });
2385
- };
2386
- const ConfigureTheViewAction = ({ collectionType, model }) => {
2387
- const navigate = reactRouterDom.useNavigate();
2388
- const { formatMessage } = reactIntl.useIntl();
2389
- return {
2390
- label: formatMessage({
2391
- id: "app.links.configure-view",
2392
- defaultMessage: "Configure the view"
2393
- }),
2394
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ListPlus, {}),
2395
- onClick: () => {
2396
- navigate(`../${collectionType}/${model}/configurations/edit`);
2397
- },
2398
- position: "header"
2399
- };
2400
- };
2401
- ConfigureTheViewAction.type = "configure-the-view";
2402
- const EditTheModelAction = ({ model }) => {
2403
- const navigate = reactRouterDom.useNavigate();
2404
- const { formatMessage } = reactIntl.useIntl();
2405
- return {
2406
- label: formatMessage({
2407
- id: "content-manager.link-to-ctb",
2408
- defaultMessage: "Edit the model"
2409
- }),
2410
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {}),
2411
- onClick: () => {
2412
- navigate(`/plugins/content-type-builder/content-types/${model}`);
2413
- },
2414
- position: "header"
2415
- };
2416
- };
2417
- EditTheModelAction.type = "edit-the-model";
2418
- const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2419
- const navigate = reactRouterDom.useNavigate();
2420
- const { formatMessage } = reactIntl.useIntl();
2421
- const listViewPathMatch = reactRouterDom.useMatch(LIST_PATH);
2422
- const canDelete = useDocumentRBAC("DeleteAction", (state) => state.canDelete);
2423
- const { delete: deleteAction } = useDocumentActions();
2424
- const { toggleNotification } = strapiAdmin.useNotification();
2425
- const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
2426
- return {
2427
- disabled: !canDelete || !document,
2428
- label: formatMessage({
2429
- id: "content-manager.actions.delete.label",
2430
- defaultMessage: "Delete document"
2431
- }),
2432
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
2433
- dialog: {
2434
- type: "dialog",
2435
- title: formatMessage({
2436
- id: "app.components.ConfirmDialog.title",
2437
- defaultMessage: "Confirmation"
2438
- }),
2439
- content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
2440
- /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
2441
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
2442
- id: "content-manager.actions.delete.dialog.body",
2443
- defaultMessage: "Are you sure?"
2444
- }) })
2445
- ] }),
2446
- onConfirm: async () => {
2447
- if (!listViewPathMatch) {
2448
- setSubmitting(true);
2449
- }
2450
- try {
2451
- if (!documentId && collectionType !== SINGLE_TYPES) {
2452
- console.error(
2453
- "You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue."
2454
- );
2455
- toggleNotification({
2456
- message: formatMessage({
2457
- id: "content-manager.actions.delete.error",
2458
- defaultMessage: "An error occurred while trying to delete the document."
2459
- }),
2460
- type: "danger"
2461
- });
2462
- return;
2463
- }
2464
- const res = await deleteAction({
2465
- documentId,
2466
- model,
2467
- collectionType,
2468
- params: {
2469
- locale: "*"
2824
+ if (action.type === "icon") {
2825
+ return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
2826
+ /* @__PURE__ */ jsxRuntime.jsx(
2827
+ designSystem.IconButton,
2828
+ {
2829
+ disabled: action.disabled,
2830
+ label: action.label,
2831
+ size: "S",
2832
+ onClick: handleClick(action),
2833
+ children: action.icon
2470
2834
  }
2471
- });
2472
- if (!("error" in res)) {
2473
- navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2474
- }
2475
- } finally {
2476
- if (!listViewPathMatch) {
2477
- setSubmitting(false);
2478
- }
2479
- }
2480
- }
2481
- },
2482
- variant: "danger",
2483
- position: ["header", "table-row"]
2484
- };
2485
- };
2486
- DeleteAction$1.type = "delete";
2487
- const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2488
- const Panels = () => {
2489
- const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2490
- const [
2491
- {
2492
- query: { status }
2493
- }
2494
- ] = strapiAdmin.useQueryParams({
2495
- status: "draft"
2496
- });
2497
- const { model, id, document, meta, collectionType } = useDoc();
2498
- const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
2499
- const props = {
2500
- activeTab: status,
2501
- model,
2502
- documentId: id,
2503
- document: isCloning ? void 0 : document,
2504
- meta: isCloning ? void 0 : meta,
2505
- collectionType
2506
- };
2507
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2508
- strapiAdmin.DescriptionComponentRenderer,
2509
- {
2510
- props,
2511
- descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2512
- children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
2513
- }
2514
- ) });
2515
- };
2516
- const ActionsPanel = () => {
2517
- const { formatMessage } = reactIntl.useIntl();
2518
- return {
2519
- title: formatMessage({
2520
- id: "content-manager.containers.edit.panels.default.title",
2521
- defaultMessage: "Document"
2522
- }),
2523
- content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
2524
- };
2525
- };
2526
- ActionsPanel.type = "actions";
2527
- const ActionsPanelContent = () => {
2528
- const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2529
- const [
2530
- {
2531
- query: { status = "draft" }
2532
- }
2533
- ] = strapiAdmin.useQueryParams();
2534
- const { model, id, document, meta, collectionType } = useDoc();
2535
- const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
2536
- const props = {
2537
- activeTab: status,
2538
- model,
2539
- documentId: id,
2540
- document: isCloning ? void 0 : document,
2541
- meta: isCloning ? void 0 : meta,
2542
- collectionType
2543
- };
2544
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
2545
- /* @__PURE__ */ jsxRuntime.jsx(
2546
- strapiAdmin.DescriptionComponentRenderer,
2547
- {
2548
- props,
2549
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2550
- children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
2551
- }
2552
- ),
2553
- /* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
2554
- ] });
2555
- };
2556
- const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
2557
- return /* @__PURE__ */ jsxRuntime.jsxs(
2558
- designSystem.Flex,
2559
- {
2560
- ref,
2561
- tag: "aside",
2562
- "aria-labelledby": "additional-information",
2563
- background: "neutral0",
2564
- borderColor: "neutral150",
2565
- hasRadius: true,
2566
- paddingBottom: 4,
2567
- paddingLeft: 4,
2568
- paddingRight: 4,
2569
- paddingTop: 4,
2570
- shadow: "tableShadow",
2571
- gap: 3,
2572
- direction: "column",
2573
- justifyContent: "stretch",
2574
- alignItems: "flex-start",
2575
- children: [
2576
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2577
- children
2578
- ]
2835
+ ),
2836
+ action.dialog ? /* @__PURE__ */ jsxRuntime.jsx(
2837
+ HeaderActionDialog,
2838
+ {
2839
+ ...action.dialog,
2840
+ isOpen: dialogId === action.id,
2841
+ onClose: handleClose
2842
+ }
2843
+ ) : null
2844
+ ] }, action.id);
2845
+ }
2579
2846
  }
2580
- );
2581
- });
2582
- const HOOKS = {
2583
- /**
2584
- * Hook that allows to mutate the displayed headers of the list view table
2585
- * @constant
2586
- * @type {string}
2587
- */
2588
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2589
- /**
2590
- * Hook that allows to mutate the CM's collection types links pre-set filters
2591
- * @constant
2592
- * @type {string}
2593
- */
2594
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2595
- /**
2596
- * Hook that allows to mutate the CM's edit view layout
2597
- * @constant
2598
- * @type {string}
2599
- */
2600
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2601
- /**
2602
- * Hook that allows to mutate the CM's single types links pre-set filters
2603
- * @constant
2604
- * @type {string}
2605
- */
2606
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2847
+ }) });
2607
2848
  };
2608
- const contentTypesApi = contentManagerApi.injectEndpoints({
2609
- endpoints: (builder) => ({
2610
- getContentTypeConfiguration: builder.query({
2611
- query: (uid) => ({
2612
- url: `/content-manager/content-types/${uid}/configuration`,
2613
- method: "GET"
2614
- }),
2615
- transformResponse: (response) => response.data,
2616
- providesTags: (_result, _error, uid) => [
2617
- { type: "ContentTypesConfiguration", id: uid },
2618
- { type: "ContentTypeSettings", id: "LIST" }
2619
- ]
2620
- }),
2621
- getAllContentTypeSettings: builder.query({
2622
- query: () => "/content-manager/content-types-settings",
2623
- transformResponse: (response) => response.data,
2624
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2625
- }),
2626
- updateContentTypeConfiguration: builder.mutation({
2627
- query: ({ uid, ...body }) => ({
2628
- url: `/content-manager/content-types/${uid}/configuration`,
2629
- method: "PUT",
2630
- data: body
2631
- }),
2632
- transformResponse: (response) => response.data,
2633
- invalidatesTags: (_result, _error, { uid }) => [
2634
- { type: "ContentTypesConfiguration", id: uid },
2635
- { type: "ContentTypeSettings", id: "LIST" },
2636
- // Is this necessary?
2637
- { type: "InitialData" }
2638
- ]
2639
- })
2640
- })
2641
- });
2642
- const {
2643
- useGetContentTypeConfigurationQuery,
2644
- useGetAllContentTypeSettingsQuery,
2645
- useUpdateContentTypeConfigurationMutation
2646
- } = contentTypesApi;
2647
- const checkIfAttributeIsDisplayable = (attribute) => {
2648
- const { type } = attribute;
2649
- if (type === "relation") {
2650
- return !attribute.relation.toLowerCase().includes("morph");
2651
- }
2652
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2849
+ const HeaderActionDialog = ({
2850
+ onClose,
2851
+ onCancel,
2852
+ title,
2853
+ content: Content,
2854
+ isOpen
2855
+ }) => {
2856
+ const handleClose = async () => {
2857
+ if (onCancel) {
2858
+ await onCancel();
2859
+ }
2860
+ onClose();
2861
+ };
2862
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2863
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
2864
+ typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
2865
+ ] }) });
2653
2866
  };
2654
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2655
- if (!mainFieldName) {
2656
- return void 0;
2657
- }
2658
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2659
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2660
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2661
- );
2867
+ const ConfigureTheViewAction = ({ collectionType, model }) => {
2868
+ const navigate = reactRouterDom.useNavigate();
2869
+ const { formatMessage } = reactIntl.useIntl();
2662
2870
  return {
2663
- name: mainFieldName,
2664
- type: mainFieldType ?? "string"
2871
+ label: formatMessage({
2872
+ id: "app.links.configure-view",
2873
+ defaultMessage: "Configure the view"
2874
+ }),
2875
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ListPlus, {}),
2876
+ onClick: () => {
2877
+ navigate(`../${collectionType}/${model}/configurations/edit`);
2878
+ },
2879
+ position: "header"
2665
2880
  };
2666
2881
  };
2667
- const DEFAULT_SETTINGS = {
2668
- bulkable: false,
2669
- filterable: false,
2670
- searchable: false,
2671
- pagination: false,
2672
- defaultSortBy: "",
2673
- defaultSortOrder: "asc",
2674
- mainField: "id",
2675
- pageSize: 10
2676
- };
2677
- const useDocumentLayout = (model) => {
2678
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2679
- const [{ query }] = strapiAdmin.useQueryParams();
2680
- const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2681
- const { toggleNotification } = strapiAdmin.useNotification();
2682
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
2683
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2684
- const {
2685
- data,
2686
- isLoading: isLoadingConfigs,
2687
- error,
2688
- isFetching: isFetchingConfigs
2689
- } = useGetContentTypeConfigurationQuery(model);
2690
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2691
- React__namespace.useEffect(() => {
2692
- if (error) {
2693
- toggleNotification({
2694
- type: "danger",
2695
- message: formatAPIError(error)
2696
- });
2697
- }
2698
- }, [error, formatAPIError, toggleNotification]);
2699
- const editLayout = React__namespace.useMemo(
2700
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2701
- layout: [],
2702
- components: {},
2703
- metadatas: {},
2704
- options: {},
2705
- settings: DEFAULT_SETTINGS
2706
- },
2707
- [data, isLoading, schemas, schema, components]
2708
- );
2709
- const listLayout = React__namespace.useMemo(() => {
2710
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2711
- layout: [],
2712
- metadatas: {},
2713
- options: {},
2714
- settings: DEFAULT_SETTINGS
2715
- };
2716
- }, [data, isLoading, schemas, schema, components]);
2717
- const { layout: edit } = React__namespace.useMemo(
2718
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2719
- layout: editLayout,
2720
- query
2721
- }),
2722
- [editLayout, query, runHookWaterfall]
2723
- );
2882
+ ConfigureTheViewAction.type = "configure-the-view";
2883
+ const EditTheModelAction = ({ model }) => {
2884
+ const navigate = reactRouterDom.useNavigate();
2885
+ const { formatMessage } = reactIntl.useIntl();
2724
2886
  return {
2725
- error,
2726
- isLoading,
2727
- edit,
2728
- list: listLayout
2887
+ label: formatMessage({
2888
+ id: "content-manager.link-to-ctb",
2889
+ defaultMessage: "Edit the model"
2890
+ }),
2891
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {}),
2892
+ onClick: () => {
2893
+ navigate(`/plugins/content-type-builder/content-types/${model}`);
2894
+ },
2895
+ position: "header"
2729
2896
  };
2730
2897
  };
2731
- const useDocLayout = () => {
2732
- const { model } = useDoc();
2733
- return useDocumentLayout(model);
2734
- };
2735
- const formatEditLayout = (data, {
2736
- schemas,
2737
- schema,
2738
- components
2739
- }) => {
2740
- let currentPanelIndex = 0;
2741
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2742
- data.contentType.layouts.edit,
2743
- schema?.attributes,
2744
- data.contentType.metadatas,
2745
- { configurations: data.components, schemas: components },
2746
- schemas
2747
- ).reduce((panels, row) => {
2748
- if (row.some((field) => field.type === "dynamiczone")) {
2749
- panels.push([row]);
2750
- currentPanelIndex += 2;
2751
- } else {
2752
- if (!panels[currentPanelIndex]) {
2753
- panels.push([]);
2754
- }
2755
- panels[currentPanelIndex].push(row);
2756
- }
2757
- return panels;
2758
- }, []);
2759
- const componentEditAttributes = Object.entries(data.components).reduce(
2760
- (acc, [uid, configuration]) => {
2761
- acc[uid] = {
2762
- layout: convertEditLayoutToFieldLayouts(
2763
- configuration.layouts.edit,
2764
- components[uid].attributes,
2765
- configuration.metadatas
2766
- ),
2767
- settings: {
2768
- ...configuration.settings,
2769
- icon: components[uid].info.icon,
2770
- displayName: components[uid].info.displayName
2898
+ EditTheModelAction.type = "edit-the-model";
2899
+ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2900
+ const navigate = reactRouterDom.useNavigate();
2901
+ const { formatMessage } = reactIntl.useIntl();
2902
+ const listViewPathMatch = reactRouterDom.useMatch(LIST_PATH);
2903
+ const canDelete = useDocumentRBAC("DeleteAction", (state) => state.canDelete);
2904
+ const { delete: deleteAction } = useDocumentActions();
2905
+ const { toggleNotification } = strapiAdmin.useNotification();
2906
+ const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
2907
+ const isLocalized = document?.locale != null;
2908
+ return {
2909
+ disabled: !canDelete || !document,
2910
+ label: formatMessage(
2911
+ {
2912
+ id: "content-manager.actions.delete.label",
2913
+ defaultMessage: "Delete entry{isLocalized, select, true { (all locales)} other {}}"
2914
+ },
2915
+ { isLocalized }
2916
+ ),
2917
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
2918
+ dialog: {
2919
+ type: "dialog",
2920
+ title: formatMessage({
2921
+ id: "app.components.ConfirmDialog.title",
2922
+ defaultMessage: "Confirmation"
2923
+ }),
2924
+ content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
2925
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
2926
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
2927
+ id: "content-manager.actions.delete.dialog.body",
2928
+ defaultMessage: "Are you sure?"
2929
+ }) })
2930
+ ] }),
2931
+ onConfirm: async () => {
2932
+ if (!listViewPathMatch) {
2933
+ setSubmitting(true);
2934
+ }
2935
+ try {
2936
+ if (!documentId && collectionType !== SINGLE_TYPES) {
2937
+ console.error(
2938
+ "You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue."
2939
+ );
2940
+ toggleNotification({
2941
+ message: formatMessage({
2942
+ id: "content-manager.actions.delete.error",
2943
+ defaultMessage: "An error occurred while trying to delete the document."
2944
+ }),
2945
+ type: "danger"
2946
+ });
2947
+ return;
2948
+ }
2949
+ const res = await deleteAction({
2950
+ documentId,
2951
+ model,
2952
+ collectionType,
2953
+ params: {
2954
+ locale: "*"
2955
+ }
2956
+ });
2957
+ if (!("error" in res)) {
2958
+ navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2959
+ }
2960
+ } finally {
2961
+ if (!listViewPathMatch) {
2962
+ setSubmitting(false);
2963
+ }
2771
2964
  }
2772
- };
2773
- return acc;
2774
- },
2775
- {}
2776
- );
2777
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2778
- (acc, [attribute, metadata]) => {
2779
- return {
2780
- ...acc,
2781
- [attribute]: metadata.edit
2782
- };
2783
- },
2784
- {}
2785
- );
2786
- return {
2787
- layout: panelledEditAttributes,
2788
- components: componentEditAttributes,
2789
- metadatas: editMetadatas,
2790
- settings: {
2791
- ...data.contentType.settings,
2792
- displayName: schema?.info.displayName
2965
+ }
2793
2966
  },
2794
- options: {
2795
- ...schema?.options,
2796
- ...schema?.pluginOptions,
2797
- ...data.contentType.options
2798
- }
2967
+ variant: "danger",
2968
+ position: ["header", "table-row"]
2799
2969
  };
2800
2970
  };
2801
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2802
- return rows.map(
2803
- (row) => row.map((field) => {
2804
- const attribute = attributes[field.name];
2805
- if (!attribute) {
2806
- return null;
2807
- }
2808
- const { edit: metadata } = metadatas[field.name];
2809
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2810
- return {
2811
- attribute,
2812
- disabled: !metadata.editable,
2813
- hint: metadata.description,
2814
- label: metadata.label ?? "",
2815
- name: field.name,
2816
- // @ts-expect-error – mainField does exist on the metadata for a relation.
2817
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2818
- schemas,
2819
- components: components?.schemas ?? {}
2820
- }),
2821
- placeholder: metadata.placeholder ?? "",
2822
- required: attribute.required ?? false,
2823
- size: field.size,
2824
- unique: "unique" in attribute ? attribute.unique : false,
2825
- visible: metadata.visible ?? true,
2826
- type: attribute.type
2827
- };
2828
- }).filter((field) => field !== null)
2829
- );
2971
+ DeleteAction$1.type = "delete";
2972
+ const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2973
+ const Panels = () => {
2974
+ const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2975
+ const [
2976
+ {
2977
+ query: { status }
2978
+ }
2979
+ ] = strapiAdmin.useQueryParams({
2980
+ status: "draft"
2981
+ });
2982
+ const { model, id, document, meta, collectionType } = useDoc();
2983
+ const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
2984
+ const props = {
2985
+ activeTab: status,
2986
+ model,
2987
+ documentId: id,
2988
+ document: isCloning ? void 0 : document,
2989
+ meta: isCloning ? void 0 : meta,
2990
+ collectionType
2991
+ };
2992
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2993
+ strapiAdmin.DescriptionComponentRenderer,
2994
+ {
2995
+ props,
2996
+ descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2997
+ children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
2998
+ }
2999
+ ) });
2830
3000
  };
2831
- const formatListLayout = (data, {
2832
- schemas,
2833
- schema,
2834
- components
2835
- }) => {
2836
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2837
- (acc, [attribute, metadata]) => {
2838
- return {
2839
- ...acc,
2840
- [attribute]: metadata.list
2841
- };
2842
- },
2843
- {}
2844
- );
2845
- const listAttributes = convertListLayoutToFieldLayouts(
2846
- data.contentType.layouts.list,
2847
- schema?.attributes,
2848
- listMetadatas,
2849
- { configurations: data.components, schemas: components },
2850
- schemas
2851
- );
3001
+ const ActionsPanel = () => {
3002
+ const { formatMessage } = reactIntl.useIntl();
2852
3003
  return {
2853
- layout: listAttributes,
2854
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2855
- metadatas: listMetadatas,
2856
- options: {
2857
- ...schema?.options,
2858
- ...schema?.pluginOptions,
2859
- ...data.contentType.options
2860
- }
3004
+ title: formatMessage({
3005
+ id: "content-manager.containers.edit.panels.default.title",
3006
+ defaultMessage: "Entry"
3007
+ }),
3008
+ content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
2861
3009
  };
2862
3010
  };
2863
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2864
- return columns.map((name) => {
2865
- const attribute = attributes[name];
2866
- if (!attribute) {
2867
- return null;
3011
+ ActionsPanel.type = "actions";
3012
+ const ActionsPanelContent = () => {
3013
+ const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
3014
+ const [
3015
+ {
3016
+ query: { status = "draft" }
2868
3017
  }
2869
- const metadata = metadatas[name];
2870
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2871
- return {
2872
- attribute,
2873
- label: metadata.label ?? "",
2874
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2875
- schemas,
2876
- components: components?.schemas ?? {}
2877
- }),
2878
- name,
2879
- searchable: metadata.searchable ?? true,
2880
- sortable: metadata.sortable ?? true
2881
- };
2882
- }).filter((field) => field !== null);
3018
+ ] = strapiAdmin.useQueryParams();
3019
+ const { model, id, document, meta, collectionType } = useDoc();
3020
+ const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
3021
+ const props = {
3022
+ activeTab: status,
3023
+ model,
3024
+ documentId: id,
3025
+ document: isCloning ? void 0 : document,
3026
+ meta: isCloning ? void 0 : meta,
3027
+ collectionType
3028
+ };
3029
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
3030
+ /* @__PURE__ */ jsxRuntime.jsx(
3031
+ strapiAdmin.DescriptionComponentRenderer,
3032
+ {
3033
+ props,
3034
+ descriptions: plugins["content-manager"].apis.getDocumentActions(),
3035
+ children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
3036
+ }
3037
+ ),
3038
+ /* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
3039
+ ] });
2883
3040
  };
3041
+ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
3042
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3043
+ designSystem.Flex,
3044
+ {
3045
+ ref,
3046
+ tag: "aside",
3047
+ "aria-labelledby": "additional-information",
3048
+ background: "neutral0",
3049
+ borderColor: "neutral150",
3050
+ hasRadius: true,
3051
+ paddingBottom: 4,
3052
+ paddingLeft: 4,
3053
+ paddingRight: 4,
3054
+ paddingTop: 4,
3055
+ shadow: "tableShadow",
3056
+ gap: 3,
3057
+ direction: "column",
3058
+ justifyContent: "stretch",
3059
+ alignItems: "flex-start",
3060
+ children: [
3061
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3062
+ children
3063
+ ]
3064
+ }
3065
+ );
3066
+ });
2884
3067
  const ConfirmBulkActionDialog = ({
2885
3068
  onToggleDialog,
2886
3069
  isOpen = false,
@@ -2919,6 +3102,7 @@ const ConfirmDialogPublishAll = ({
2919
3102
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler(getTranslation);
2920
3103
  const { model, schema } = useDoc();
2921
3104
  const [{ query }] = strapiAdmin.useQueryParams();
3105
+ const enableDraftRelationsCount = false;
2922
3106
  const {
2923
3107
  data: countDraftRelations = 0,
2924
3108
  isLoading,
@@ -2930,7 +3114,7 @@ const ConfirmDialogPublishAll = ({
2930
3114
  locale: query?.plugins?.i18n?.locale
2931
3115
  },
2932
3116
  {
2933
- skip: selectedEntries.length === 0
3117
+ skip: !enableDraftRelationsCount
2934
3118
  }
2935
3119
  );
2936
3120
  React__namespace.useEffect(() => {
@@ -3115,7 +3299,7 @@ const SelectedEntriesTableContent = ({
3115
3299
  status: row.status
3116
3300
  }
3117
3301
  ) }),
3118
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
3302
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
3119
3303
  designSystem.IconButton,
3120
3304
  {
3121
3305
  tag: reactRouterDom.Link,
@@ -3138,9 +3322,10 @@ const SelectedEntriesTableContent = ({
3138
3322
  ),
3139
3323
  target: "_blank",
3140
3324
  marginLeft: "auto",
3141
- children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {})
3325
+ variant: "ghost",
3326
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, { width: "1.6rem", height: "1.6rem" })
3142
3327
  }
3143
- ) })
3328
+ ) }) })
3144
3329
  ] }, row.id)) })
3145
3330
  ] });
3146
3331
  };
@@ -3177,7 +3362,13 @@ const SelectedEntriesModalContent = ({
3177
3362
  );
3178
3363
  const { rows, validationErrors } = React__namespace.useMemo(() => {
3179
3364
  if (data.length > 0 && schema) {
3180
- const validate = createYupSchema(schema.attributes, components);
3365
+ const validate = createYupSchema(
3366
+ schema.attributes,
3367
+ components,
3368
+ // Since this is the "Publish" action, the validation
3369
+ // schema must enforce the rules for published entities
3370
+ { status: "published" }
3371
+ );
3181
3372
  const validationErrors2 = {};
3182
3373
  const rows2 = data.map((entry) => {
3183
3374
  try {
@@ -3527,7 +3718,7 @@ const TableActions = ({ document }) => {
3527
3718
  strapiAdmin.DescriptionComponentRenderer,
3528
3719
  {
3529
3720
  props,
3530
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3721
+ descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3531
3722
  children: (actions2) => {
3532
3723
  const tableRowActions = actions2.filter((action) => {
3533
3724
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3638,7 +3829,7 @@ const CloneAction = ({ model, documentId }) => {
3638
3829
  }),
3639
3830
  content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3640
3831
  footer: ({ onClose }) => {
3641
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
3832
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
3642
3833
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3643
3834
  id: "cancel",
3644
3835
  defaultMessage: "Cancel"
@@ -3850,6 +4041,70 @@ const { setInitialData } = actions;
3850
4041
  const reducer = toolkit.combineReducers({
3851
4042
  app: reducer$1
3852
4043
  });
4044
+ const previewApi = contentManagerApi.injectEndpoints({
4045
+ endpoints: (builder) => ({
4046
+ getPreviewUrl: builder.query({
4047
+ query({ query, params }) {
4048
+ return {
4049
+ url: `/content-manager/preview/url/${params.contentType}`,
4050
+ method: "GET",
4051
+ config: {
4052
+ params: query
4053
+ }
4054
+ };
4055
+ }
4056
+ })
4057
+ })
4058
+ });
4059
+ const { useGetPreviewUrlQuery } = previewApi;
4060
+ const PreviewSidePanel = ({ model, documentId, document }) => {
4061
+ const { formatMessage } = reactIntl.useIntl();
4062
+ const { trackUsage } = strapiAdmin.useTracking();
4063
+ const [{ query }] = strapiAdmin.useQueryParams();
4064
+ const { data, error } = useGetPreviewUrlQuery({
4065
+ params: {
4066
+ contentType: model
4067
+ },
4068
+ query: {
4069
+ documentId,
4070
+ locale: document?.locale,
4071
+ status: document?.status
4072
+ }
4073
+ });
4074
+ if (!data?.data?.url || error) {
4075
+ return null;
4076
+ }
4077
+ const handleClick = () => {
4078
+ trackUsage("willOpenPreview");
4079
+ };
4080
+ return {
4081
+ title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4082
+ content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
4083
+ designSystem.Button,
4084
+ {
4085
+ variant: "tertiary",
4086
+ tag: reactRouterDom.Link,
4087
+ to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
4088
+ onClick: handleClick,
4089
+ flex: "auto",
4090
+ children: formatMessage({
4091
+ id: "content-manager.preview.panel.button",
4092
+ defaultMessage: "Open preview"
4093
+ })
4094
+ }
4095
+ ) })
4096
+ };
4097
+ };
4098
+ const FEATURE_ID = "preview";
4099
+ const previewAdmin = {
4100
+ bootstrap(app) {
4101
+ if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4102
+ return;
4103
+ }
4104
+ const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4105
+ contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4106
+ }
4107
+ };
3853
4108
  const index = {
3854
4109
  register(app) {
3855
4110
  const cm = new ContentManagerPlugin();
@@ -3869,7 +4124,7 @@ const index = {
3869
4124
  app.router.addRoute({
3870
4125
  path: "content-manager/*",
3871
4126
  lazy: async () => {
3872
- const { Layout } = await Promise.resolve().then(() => require("./layout-Ci7qHlFb.js"));
4127
+ const { Layout } = await Promise.resolve().then(() => require("./layout-BzX903CL.js"));
3873
4128
  return {
3874
4129
  Component: Layout
3875
4130
  };
@@ -3882,11 +4137,14 @@ const index = {
3882
4137
  if (typeof historyAdmin.bootstrap === "function") {
3883
4138
  historyAdmin.bootstrap(app);
3884
4139
  }
4140
+ if (typeof previewAdmin.bootstrap === "function") {
4141
+ previewAdmin.bootstrap(app);
4142
+ }
3885
4143
  },
3886
4144
  async registerTrads({ locales }) {
3887
4145
  const importedTrads = await Promise.all(
3888
4146
  locales.map((locale) => {
3889
- 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-uOUIxfcQ.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 }) => {
4147
+ 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-CHOp_xJv.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`).then(({ default: data }) => {
3890
4148
  return {
3891
4149
  data: prefixPluginTranslations(data, PLUGIN_ID),
3892
4150
  locale
@@ -3904,6 +4162,7 @@ const index = {
3904
4162
  };
3905
4163
  exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
3906
4164
  exports.BulkActionsRenderer = BulkActionsRenderer;
4165
+ exports.CLONE_PATH = CLONE_PATH;
3907
4166
  exports.COLLECTION_TYPES = COLLECTION_TYPES;
3908
4167
  exports.CREATOR_FIELDS = CREATOR_FIELDS;
3909
4168
  exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
@@ -3931,6 +4190,7 @@ exports.getMainField = getMainField;
3931
4190
  exports.getTranslation = getTranslation;
3932
4191
  exports.index = index;
3933
4192
  exports.setInitialData = setInitialData;
4193
+ exports.useContentManagerContext = useContentManagerContext;
3934
4194
  exports.useContentTypeSchema = useContentTypeSchema;
3935
4195
  exports.useDoc = useDoc;
3936
4196
  exports.useDocLayout = useDocLayout;
@@ -3942,5 +4202,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
3942
4202
  exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
3943
4203
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
3944
4204
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
4205
+ exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
3945
4206
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
3946
- //# sourceMappingURL=index-OerGjbAN.js.map
4207
+ //# sourceMappingURL=index-tN1hpOMN.js.map