@strapi/content-manager 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb → 0.0.0-experimental.d74a8e5e655230b243e2d61ab5bec2fcdb426993

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 (169) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs → ComponentConfigurationPage-CIjXcRAB.mjs} +4 -4
  3. package/dist/_chunks/{ComponentConfigurationPage-DmwmiFQy.mjs.map → ComponentConfigurationPage-CIjXcRAB.mjs.map} +1 -1
  4. package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js → ComponentConfigurationPage-gsCd80MU.js} +4 -4
  5. package/dist/_chunks/{ComponentConfigurationPage-C-49MccQ.js.map → ComponentConfigurationPage-gsCd80MU.js.map} +1 -1
  6. package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs → EditConfigurationPage-BglmD_BF.mjs} +4 -4
  7. package/dist/_chunks/{EditConfigurationPage-JT3E7NZy.mjs.map → EditConfigurationPage-BglmD_BF.mjs.map} +1 -1
  8. package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js → EditConfigurationPage-DHDQKBzw.js} +4 -4
  9. package/dist/_chunks/{EditConfigurationPage-DjFJw56M.js.map → EditConfigurationPage-DHDQKBzw.js.map} +1 -1
  10. package/dist/_chunks/{EditViewPage-zT3fBr4Y.js → EditViewPage-C4iTxUPU.js} +30 -9
  11. package/dist/_chunks/EditViewPage-C4iTxUPU.js.map +1 -0
  12. package/dist/_chunks/{EditViewPage-CPj61RMh.mjs → EditViewPage-CiwVPMaK.mjs} +30 -9
  13. package/dist/_chunks/EditViewPage-CiwVPMaK.mjs.map +1 -0
  14. package/dist/_chunks/{Field-dha5VnIQ.mjs → Field-DIjL1b5d.mjs} +249 -152
  15. package/dist/_chunks/Field-DIjL1b5d.mjs.map +1 -0
  16. package/dist/_chunks/{Field-Boxf9Ajp.js → Field-DhXEK8y1.js} +251 -154
  17. package/dist/_chunks/Field-DhXEK8y1.js.map +1 -0
  18. package/dist/_chunks/{Form-DHrru2AV.mjs → Form-CmNesrvR.mjs} +36 -17
  19. package/dist/_chunks/Form-CmNesrvR.mjs.map +1 -0
  20. package/dist/_chunks/{Form-y5g1SRsh.js → Form-CwmJ4sWe.js} +36 -17
  21. package/dist/_chunks/Form-CwmJ4sWe.js.map +1 -0
  22. package/dist/_chunks/{History-CqN6K7SX.js → History-BLCCNgCt.js} +64 -26
  23. package/dist/_chunks/History-BLCCNgCt.js.map +1 -0
  24. package/dist/_chunks/{History-Bru_KoeP.mjs → History-D-99Wh30.mjs} +65 -27
  25. package/dist/_chunks/History-D-99Wh30.mjs.map +1 -0
  26. package/dist/_chunks/{ListConfigurationPage-R_p-SbHZ.js → ListConfigurationPage-DxWpeZrO.js} +21 -9
  27. package/dist/_chunks/ListConfigurationPage-DxWpeZrO.js.map +1 -0
  28. package/dist/_chunks/{ListConfigurationPage-D8wGABj0.mjs → ListConfigurationPage-JPWZz7Kg.mjs} +21 -9
  29. package/dist/_chunks/ListConfigurationPage-JPWZz7Kg.mjs.map +1 -0
  30. package/dist/_chunks/{ListViewPage-pEw_zug9.js → ListViewPage-CIQekSFz.js} +73 -44
  31. package/dist/_chunks/ListViewPage-CIQekSFz.js.map +1 -0
  32. package/dist/_chunks/{ListViewPage-SID6TRb9.mjs → ListViewPage-DSK3f0ST.mjs} +71 -42
  33. package/dist/_chunks/ListViewPage-DSK3f0ST.mjs.map +1 -0
  34. package/dist/_chunks/{NoContentTypePage-C5dcQojD.js → NoContentTypePage-C5cxKvC2.js} +2 -2
  35. package/dist/_chunks/{NoContentTypePage-C5dcQojD.js.map → NoContentTypePage-C5cxKvC2.js.map} +1 -1
  36. package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs → NoContentTypePage-D99LU1YP.mjs} +2 -2
  37. package/dist/_chunks/{NoContentTypePage-CJ7UXwrQ.mjs.map → NoContentTypePage-D99LU1YP.mjs.map} +1 -1
  38. package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs → NoPermissionsPage-DBrBw-0y.mjs} +2 -2
  39. package/dist/_chunks/{NoPermissionsPage-B7syEq5E.mjs.map → NoPermissionsPage-DBrBw-0y.mjs.map} +1 -1
  40. package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js → NoPermissionsPage-Oy4tmUrW.js} +2 -2
  41. package/dist/_chunks/{NoPermissionsPage-BtPrImPP.js.map → NoPermissionsPage-Oy4tmUrW.js.map} +1 -1
  42. package/dist/_chunks/{Relations-B9Crnhnn.mjs → Relations-BBmhcWFV.mjs} +70 -37
  43. package/dist/_chunks/Relations-BBmhcWFV.mjs.map +1 -0
  44. package/dist/_chunks/{Relations-DjTQ5kGB.js → Relations-eG-9p_qS.js} +69 -36
  45. package/dist/_chunks/Relations-eG-9p_qS.js.map +1 -0
  46. package/dist/_chunks/{en-fbKQxLGn.js → en-Bm0D0IWz.js} +17 -15
  47. package/dist/_chunks/{en-fbKQxLGn.js.map → en-Bm0D0IWz.js.map} +1 -1
  48. package/dist/_chunks/{en-Ux26r5pl.mjs → en-DKV44jRb.mjs} +17 -15
  49. package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-DKV44jRb.mjs.map} +1 -1
  50. package/dist/_chunks/{index-DVPWZkbS.js → index-BIWDoFLK.js} +1003 -669
  51. package/dist/_chunks/index-BIWDoFLK.js.map +1 -0
  52. package/dist/_chunks/{index-DJXJw9V5.mjs → index-BrUzbQ30.mjs} +1021 -688
  53. package/dist/_chunks/index-BrUzbQ30.mjs.map +1 -0
  54. package/dist/_chunks/{layout-Bau7ZfLV.mjs → layout-_5-cXs34.mjs} +25 -12
  55. package/dist/_chunks/layout-_5-cXs34.mjs.map +1 -0
  56. package/dist/_chunks/{layout-Dm6fbiQj.js → layout-lMc9i1-Z.js} +24 -11
  57. package/dist/_chunks/layout-lMc9i1-Z.js.map +1 -0
  58. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  59. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  60. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  61. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  62. package/dist/_chunks/{relations-CKnpRgrN.js → relations-BRHithi8.js} +3 -7
  63. package/dist/_chunks/relations-BRHithi8.js.map +1 -0
  64. package/dist/_chunks/{relations-BH_kBSJ0.mjs → relations-B_VLk-DD.mjs} +3 -7
  65. package/dist/_chunks/relations-B_VLk-DD.mjs.map +1 -0
  66. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  67. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  68. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  69. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  70. package/dist/admin/index.js +2 -1
  71. package/dist/admin/index.js.map +1 -1
  72. package/dist/admin/index.mjs +5 -4
  73. package/dist/admin/src/exports.d.ts +1 -1
  74. package/dist/admin/src/history/index.d.ts +3 -0
  75. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  76. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  77. package/dist/admin/src/index.d.ts +1 -0
  78. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -0
  79. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  80. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  81. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  82. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  83. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  84. package/dist/admin/src/preview/constants.d.ts +1 -0
  85. package/dist/admin/src/preview/index.d.ts +4 -0
  86. package/dist/admin/src/services/api.d.ts +1 -1
  87. package/dist/admin/src/services/components.d.ts +2 -2
  88. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  89. package/dist/admin/src/services/documents.d.ts +19 -17
  90. package/dist/admin/src/services/init.d.ts +1 -1
  91. package/dist/admin/src/services/relations.d.ts +2 -2
  92. package/dist/admin/src/services/uid.d.ts +3 -3
  93. package/dist/admin/src/utils/validation.d.ts +4 -1
  94. package/dist/server/index.js +321 -148
  95. package/dist/server/index.js.map +1 -1
  96. package/dist/server/index.mjs +322 -149
  97. package/dist/server/index.mjs.map +1 -1
  98. package/dist/server/src/bootstrap.d.ts.map +1 -1
  99. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  100. package/dist/server/src/controllers/index.d.ts.map +1 -1
  101. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  102. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  103. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  104. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  105. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  106. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  107. package/dist/server/src/history/services/history.d.ts.map +1 -1
  108. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  109. package/dist/server/src/history/services/utils.d.ts +4 -4
  110. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  111. package/dist/server/src/index.d.ts +4 -4
  112. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  113. package/dist/server/src/preview/constants.d.ts +2 -0
  114. package/dist/server/src/preview/constants.d.ts.map +1 -0
  115. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  116. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  117. package/dist/server/src/preview/controllers/preview.d.ts +9 -0
  118. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  119. package/dist/server/src/preview/index.d.ts +4 -0
  120. package/dist/server/src/preview/index.d.ts.map +1 -0
  121. package/dist/server/src/preview/routes/index.d.ts +8 -0
  122. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  123. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  124. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  125. package/dist/server/src/preview/services/index.d.ts +4 -0
  126. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  127. package/dist/server/src/preview/services/preview.d.ts +6 -0
  128. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  129. package/dist/server/src/preview/utils.d.ts +7 -0
  130. package/dist/server/src/preview/utils.d.ts.map +1 -0
  131. package/dist/server/src/routes/index.d.ts.map +1 -1
  132. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  133. package/dist/server/src/services/document-metadata.d.ts +8 -8
  134. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  135. package/dist/server/src/services/index.d.ts +4 -4
  136. package/dist/server/src/services/index.d.ts.map +1 -1
  137. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  138. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  139. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  140. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  141. package/dist/server/src/utils/index.d.ts +2 -0
  142. package/dist/server/src/utils/index.d.ts.map +1 -1
  143. package/dist/shared/contracts/collection-types.d.ts +3 -1
  144. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  145. package/package.json +12 -12
  146. package/dist/_chunks/EditViewPage-CPj61RMh.mjs.map +0 -1
  147. package/dist/_chunks/EditViewPage-zT3fBr4Y.js.map +0 -1
  148. package/dist/_chunks/Field-Boxf9Ajp.js.map +0 -1
  149. package/dist/_chunks/Field-dha5VnIQ.mjs.map +0 -1
  150. package/dist/_chunks/Form-DHrru2AV.mjs.map +0 -1
  151. package/dist/_chunks/Form-y5g1SRsh.js.map +0 -1
  152. package/dist/_chunks/History-Bru_KoeP.mjs.map +0 -1
  153. package/dist/_chunks/History-CqN6K7SX.js.map +0 -1
  154. package/dist/_chunks/ListConfigurationPage-D8wGABj0.mjs.map +0 -1
  155. package/dist/_chunks/ListConfigurationPage-R_p-SbHZ.js.map +0 -1
  156. package/dist/_chunks/ListViewPage-SID6TRb9.mjs.map +0 -1
  157. package/dist/_chunks/ListViewPage-pEw_zug9.js.map +0 -1
  158. package/dist/_chunks/Relations-B9Crnhnn.mjs.map +0 -1
  159. package/dist/_chunks/Relations-DjTQ5kGB.js.map +0 -1
  160. package/dist/_chunks/index-DJXJw9V5.mjs.map +0 -1
  161. package/dist/_chunks/index-DVPWZkbS.js.map +0 -1
  162. package/dist/_chunks/layout-Bau7ZfLV.mjs.map +0 -1
  163. package/dist/_chunks/layout-Dm6fbiQj.js.map +0 -1
  164. package/dist/_chunks/relations-BH_kBSJ0.mjs.map +0 -1
  165. package/dist/_chunks/relations-CKnpRgrN.js.map +0 -1
  166. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  167. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  168. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  169. package/strapi-server.js +0 -3
@@ -1,17 +1,18 @@
1
- import { ClockCounterClockwise, CrossCircle, More, WarningCircle, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, Feather } from "@strapi/icons";
1
+ import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CrossCircle, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
- import { useStrapiApp, useQueryParams, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useTracking, useForm, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
4
- import { stringify } from "qs";
5
- import { useIntl } from "react-intl";
6
- import { useNavigate, useParams, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
3
+ import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
7
4
  import * as React from "react";
8
5
  import { lazy } from "react";
9
- import { Button, Menu, VisuallyHidden, Flex, Box, Typography, Dialog, Modal, Radio, Status, SingleSelect, SingleSelectOption, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
10
- import { styled } from "styled-components";
6
+ import { Button, Menu, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
7
+ import mapValues from "lodash/fp/mapValues";
8
+ import { useIntl } from "react-intl";
9
+ import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
11
10
  import * as yup from "yup";
12
11
  import { ValidationError } from "yup";
13
12
  import pipe from "lodash/fp/pipe";
14
13
  import { intervalToDuration, isPast } from "date-fns";
14
+ import { styled } from "styled-components";
15
+ import { stringify } from "qs";
15
16
  import { createSlice, combineReducers } from "@reduxjs/toolkit";
16
17
  const __variableDynamicImportRuntimeHelper = (glob, path) => {
17
18
  const v = glob[path];
@@ -49,42 +50,6 @@ const useInjectionZone = (area) => {
49
50
  const [page, position] = area.split(".");
50
51
  return contentManagerPlugin.getInjectedComponents(page, position);
51
52
  };
52
- const HistoryAction = ({ model, document }) => {
53
- const { formatMessage } = useIntl();
54
- const [{ query }] = useQueryParams();
55
- const navigate = useNavigate();
56
- const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
57
- if (!window.strapi.features.isEnabled("cms-content-history")) {
58
- return null;
59
- }
60
- return {
61
- icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
62
- label: formatMessage({
63
- id: "content-manager.history.document-action",
64
- defaultMessage: "Content History"
65
- }),
66
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
67
- disabled: (
68
- /**
69
- * The user is creating a new document.
70
- * It hasn't been saved yet, so there's no history to go to
71
- */
72
- !document || /**
73
- * The document has been created but the current dimension has never been saved.
74
- * For example, the user is creating a new locale in an existing document,
75
- * so there's no history for the document in that locale
76
- */
77
- !document.id || /**
78
- * History is only available for content types created by the user.
79
- * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
80
- * which start with `admin::` or `plugin::`
81
- */
82
- !model.startsWith("api::")
83
- ),
84
- position: "header"
85
- };
86
- };
87
- HistoryAction.type = "history";
88
53
  const ID = "id";
89
54
  const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
90
55
  const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
@@ -136,6 +101,7 @@ const DocumentRBAC = ({ children, permissions }) => {
136
101
  if (!slug) {
137
102
  throw new Error("Cannot find the slug param in the URL");
138
103
  }
104
+ const [{ rawQuery }] = useQueryParams();
139
105
  const userPermissions = useAuth("DocumentRBAC", (state) => state.permissions);
140
106
  const contentTypePermissions = React.useMemo(() => {
141
107
  const contentTypePermissions2 = userPermissions.filter(
@@ -146,7 +112,14 @@ const DocumentRBAC = ({ children, permissions }) => {
146
112
  return { ...acc, [action]: [permission] };
147
113
  }, {});
148
114
  }, [slug, userPermissions]);
149
- const { isLoading, allowedActions } = useRBAC(contentTypePermissions, permissions ?? void 0);
115
+ const { isLoading, allowedActions } = useRBAC(
116
+ contentTypePermissions,
117
+ permissions ?? void 0,
118
+ // TODO: useRBAC context should be typed and built differently
119
+ // We are passing raw query as context to the hook so that it can
120
+ // rely on the locale provided from DocumentRBAC for its permission calculations.
121
+ rawQuery
122
+ );
150
123
  const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
151
124
  const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
152
125
  const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
@@ -194,7 +167,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
194
167
  "Document",
195
168
  "InitialData",
196
169
  "HistoryVersion",
197
- "Relations"
170
+ "Relations",
171
+ "UidAvailability"
198
172
  ]
199
173
  });
200
174
  const documentApi = contentManagerApi.injectEndpoints({
@@ -208,7 +182,12 @@ const documentApi = contentManagerApi.injectEndpoints({
208
182
  params: query
209
183
  }
210
184
  }),
211
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
185
+ invalidatesTags: (_result, error, { model }) => {
186
+ if (error) {
187
+ return [];
188
+ }
189
+ return [{ type: "Document", id: `${model}_LIST` }];
190
+ }
212
191
  }),
213
192
  cloneDocument: builder.mutation({
214
193
  query: ({ model, sourceId, data, params }) => ({
@@ -219,7 +198,10 @@ const documentApi = contentManagerApi.injectEndpoints({
219
198
  params
220
199
  }
221
200
  }),
222
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
201
+ invalidatesTags: (_result, _error, { model }) => [
202
+ { type: "Document", id: `${model}_LIST` },
203
+ { type: "UidAvailability", id: model }
204
+ ]
223
205
  }),
224
206
  /**
225
207
  * Creates a new collection-type document. This should ONLY be used for collection-types.
@@ -236,7 +218,8 @@ const documentApi = contentManagerApi.injectEndpoints({
236
218
  }),
237
219
  invalidatesTags: (result, _error, { model }) => [
238
220
  { type: "Document", id: `${model}_LIST` },
239
- "Relations"
221
+ "Relations",
222
+ { type: "UidAvailability", id: model }
240
223
  ]
241
224
  }),
242
225
  deleteDocument: builder.mutation({
@@ -277,7 +260,8 @@ const documentApi = contentManagerApi.injectEndpoints({
277
260
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
278
261
  },
279
262
  { type: "Document", id: `${model}_LIST` },
280
- "Relations"
263
+ "Relations",
264
+ { type: "UidAvailability", id: model }
281
265
  ];
282
266
  }
283
267
  }),
@@ -287,7 +271,7 @@ const documentApi = contentManagerApi.injectEndpoints({
287
271
  */
288
272
  getAllDocuments: builder.query({
289
273
  query: ({ model, params }) => ({
290
- url: `/content-manager/collection-types/${model}`,
274
+ url: `/content-manager/collection-types/${model}${params ? `?${params}` : ""}`,
291
275
  method: "GET",
292
276
  config: {
293
277
  params
@@ -295,6 +279,7 @@ const documentApi = contentManagerApi.injectEndpoints({
295
279
  }),
296
280
  providesTags: (result, _error, arg) => {
297
281
  return [
282
+ { type: "Document", id: `ALL_LIST` },
298
283
  { type: "Document", id: `${arg.model}_LIST` },
299
284
  ...result?.results.map(({ documentId }) => ({
300
285
  type: "Document",
@@ -333,6 +318,11 @@ const documentApi = contentManagerApi.injectEndpoints({
333
318
  {
334
319
  type: "Document",
335
320
  id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
321
+ },
322
+ // Make it easy to invalidate all individual documents queries for a model
323
+ {
324
+ type: "Document",
325
+ id: `${model}_ALL_ITEMS`
336
326
  }
337
327
  ];
338
328
  }
@@ -396,8 +386,21 @@ const documentApi = contentManagerApi.injectEndpoints({
396
386
  type: "Document",
397
387
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
398
388
  },
399
- "Relations"
389
+ "Relations",
390
+ { type: "UidAvailability", id: model }
400
391
  ];
392
+ },
393
+ async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
394
+ const patchResult = dispatch(
395
+ documentApi.util.updateQueryData("getDocument", patch, (draft) => {
396
+ Object.assign(draft.data, data);
397
+ })
398
+ );
399
+ try {
400
+ await queryFulfilled;
401
+ } catch {
402
+ patchResult.undo();
403
+ }
401
404
  }
402
405
  }),
403
406
  unpublishDocument: builder.mutation({
@@ -467,20 +470,39 @@ const buildValidParams = (query) => {
467
470
  const isBaseQueryError = (error) => {
468
471
  return error.name !== void 0;
469
472
  };
470
- const createYupSchema = (attributes = {}, components = {}) => {
473
+ const arrayValidator = (attribute, options) => ({
474
+ message: translatedErrors.required,
475
+ test(value) {
476
+ if (options.status === "draft") {
477
+ return true;
478
+ }
479
+ if (!attribute.required) {
480
+ return true;
481
+ }
482
+ if (!value) {
483
+ return false;
484
+ }
485
+ if (Array.isArray(value) && value.length === 0) {
486
+ return false;
487
+ }
488
+ return true;
489
+ }
490
+ });
491
+ const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
471
492
  const createModelSchema = (attributes2) => yup.object().shape(
472
493
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
473
494
  if (DOCUMENT_META_FIELDS.includes(name)) {
474
495
  return acc;
475
496
  }
476
497
  const validations = [
498
+ addNullableValidation,
477
499
  addRequiredValidation,
478
500
  addMinLengthValidation,
479
501
  addMaxLengthValidation,
480
502
  addMinValidation,
481
503
  addMaxValidation,
482
504
  addRegexValidation
483
- ].map((fn) => fn(attribute));
505
+ ].map((fn) => fn(attribute, options));
484
506
  const transformSchema = pipe(...validations);
485
507
  switch (attribute.type) {
486
508
  case "component": {
@@ -490,12 +512,12 @@ const createYupSchema = (attributes = {}, components = {}) => {
490
512
  ...acc,
491
513
  [name]: transformSchema(
492
514
  yup.array().of(createModelSchema(attributes3).nullable(false))
493
- )
515
+ ).test(arrayValidator(attribute, options))
494
516
  };
495
517
  } else {
496
518
  return {
497
519
  ...acc,
498
- [name]: transformSchema(createModelSchema(attributes3))
520
+ [name]: transformSchema(createModelSchema(attributes3).nullable())
499
521
  };
500
522
  }
501
523
  }
@@ -517,7 +539,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
517
539
  }
518
540
  )
519
541
  )
520
- )
542
+ ).test(arrayValidator(attribute, options))
521
543
  };
522
544
  case "relation":
523
545
  return {
@@ -529,7 +551,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
529
551
  } else if (Array.isArray(value)) {
530
552
  return yup.array().of(
531
553
  yup.object().shape({
532
- id: yup.string().required()
554
+ id: yup.number().required()
533
555
  })
534
556
  );
535
557
  } else if (typeof value === "object") {
@@ -581,6 +603,14 @@ const createAttributeSchema = (attribute) => {
581
603
  if (!value || typeof value === "string" && value.length === 0) {
582
604
  return true;
583
605
  }
606
+ if (typeof value === "object") {
607
+ try {
608
+ JSON.stringify(value);
609
+ return true;
610
+ } catch (err) {
611
+ return false;
612
+ }
613
+ }
584
614
  try {
585
615
  JSON.parse(value);
586
616
  return true;
@@ -599,13 +629,7 @@ const createAttributeSchema = (attribute) => {
599
629
  return yup.mixed();
600
630
  }
601
631
  };
602
- const addRequiredValidation = (attribute) => (schema) => {
603
- if (attribute.required) {
604
- return schema.required({
605
- id: translatedErrors.required.id,
606
- defaultMessage: "This field is required."
607
- });
608
- }
632
+ const nullableSchema = (schema) => {
609
633
  return schema?.nullable ? schema.nullable() : (
610
634
  // In some cases '.nullable' will not be available on the schema.
611
635
  // e.g. when the schema has been built using yup.lazy (e.g. for relations).
@@ -613,7 +637,22 @@ const addRequiredValidation = (attribute) => (schema) => {
613
637
  schema
614
638
  );
615
639
  };
616
- const addMinLengthValidation = (attribute) => (schema) => {
640
+ const addNullableValidation = () => (schema) => {
641
+ return nullableSchema(schema);
642
+ };
643
+ const addRequiredValidation = (attribute, options) => (schema) => {
644
+ if (options.status === "draft" || !attribute.required) {
645
+ return schema;
646
+ }
647
+ if (attribute.required && "required" in schema) {
648
+ return schema.required(translatedErrors.required);
649
+ }
650
+ return schema;
651
+ };
652
+ const addMinLengthValidation = (attribute, options) => (schema) => {
653
+ if (options.status === "draft") {
654
+ return schema;
655
+ }
617
656
  if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
618
657
  return schema.min(attribute.minLength, {
619
658
  ...translatedErrors.minLength,
@@ -635,10 +674,13 @@ const addMaxLengthValidation = (attribute) => (schema) => {
635
674
  }
636
675
  return schema;
637
676
  };
638
- const addMinValidation = (attribute) => (schema) => {
639
- if ("min" in attribute) {
677
+ const addMinValidation = (attribute, options) => (schema) => {
678
+ if (options.status === "draft") {
679
+ return schema;
680
+ }
681
+ if ("min" in attribute && "min" in schema) {
640
682
  const min = toInteger(attribute.min);
641
- if ("min" in schema && min) {
683
+ if (min) {
642
684
  return schema.min(min, {
643
685
  ...translatedErrors.min,
644
686
  values: {
@@ -756,16 +798,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
756
798
  }, {});
757
799
  return componentsByKey;
758
800
  };
759
- const useDocument = (args, opts) => {
801
+ const HOOKS = {
802
+ /**
803
+ * Hook that allows to mutate the displayed headers of the list view table
804
+ * @constant
805
+ * @type {string}
806
+ */
807
+ INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
808
+ /**
809
+ * Hook that allows to mutate the CM's collection types links pre-set filters
810
+ * @constant
811
+ * @type {string}
812
+ */
813
+ MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
814
+ /**
815
+ * Hook that allows to mutate the CM's edit view layout
816
+ * @constant
817
+ * @type {string}
818
+ */
819
+ MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
820
+ /**
821
+ * Hook that allows to mutate the CM's single types links pre-set filters
822
+ * @constant
823
+ * @type {string}
824
+ */
825
+ MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
826
+ };
827
+ const contentTypesApi = contentManagerApi.injectEndpoints({
828
+ endpoints: (builder) => ({
829
+ getContentTypeConfiguration: builder.query({
830
+ query: (uid) => ({
831
+ url: `/content-manager/content-types/${uid}/configuration`,
832
+ method: "GET"
833
+ }),
834
+ transformResponse: (response) => response.data,
835
+ providesTags: (_result, _error, uid) => [
836
+ { type: "ContentTypesConfiguration", id: uid },
837
+ { type: "ContentTypeSettings", id: "LIST" }
838
+ ]
839
+ }),
840
+ getAllContentTypeSettings: builder.query({
841
+ query: () => "/content-manager/content-types-settings",
842
+ transformResponse: (response) => response.data,
843
+ providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
844
+ }),
845
+ updateContentTypeConfiguration: builder.mutation({
846
+ query: ({ uid, ...body }) => ({
847
+ url: `/content-manager/content-types/${uid}/configuration`,
848
+ method: "PUT",
849
+ data: body
850
+ }),
851
+ transformResponse: (response) => response.data,
852
+ invalidatesTags: (_result, _error, { uid }) => [
853
+ { type: "ContentTypesConfiguration", id: uid },
854
+ { type: "ContentTypeSettings", id: "LIST" },
855
+ // Is this necessary?
856
+ { type: "InitialData" }
857
+ ]
858
+ })
859
+ })
860
+ });
861
+ const {
862
+ useGetContentTypeConfigurationQuery,
863
+ useGetAllContentTypeSettingsQuery,
864
+ useUpdateContentTypeConfigurationMutation
865
+ } = contentTypesApi;
866
+ const checkIfAttributeIsDisplayable = (attribute) => {
867
+ const { type } = attribute;
868
+ if (type === "relation") {
869
+ return !attribute.relation.toLowerCase().includes("morph");
870
+ }
871
+ return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
872
+ };
873
+ const getMainField = (attribute, mainFieldName, { schemas, components }) => {
874
+ if (!mainFieldName) {
875
+ return void 0;
876
+ }
877
+ const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
878
+ // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
879
+ schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
880
+ );
881
+ return {
882
+ name: mainFieldName,
883
+ type: mainFieldType ?? "string"
884
+ };
885
+ };
886
+ const DEFAULT_SETTINGS = {
887
+ bulkable: false,
888
+ filterable: false,
889
+ searchable: false,
890
+ pagination: false,
891
+ defaultSortBy: "",
892
+ defaultSortOrder: "asc",
893
+ mainField: "id",
894
+ pageSize: 10
895
+ };
896
+ const useDocumentLayout = (model) => {
897
+ const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
898
+ const [{ query }] = useQueryParams();
899
+ const runHookWaterfall = useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
760
900
  const { toggleNotification } = useNotification();
761
901
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
902
+ const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
762
903
  const {
763
- currentData: data,
764
- isLoading: isLoadingDocument,
765
- isFetching: isFetchingDocument,
766
- error
767
- } = useGetDocumentQuery(args, opts);
768
- const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
904
+ data,
905
+ isLoading: isLoadingConfigs,
906
+ error,
907
+ isFetching: isFetchingConfigs
908
+ } = useGetContentTypeConfigurationQuery(model);
909
+ const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
769
910
  React.useEffect(() => {
770
911
  if (error) {
771
912
  toggleNotification({
@@ -773,68 +914,322 @@ const useDocument = (args, opts) => {
773
914
  message: formatAPIError(error)
774
915
  });
775
916
  }
776
- }, [toggleNotification, error, formatAPIError, args.collectionType]);
777
- const validationSchema = React.useMemo(() => {
778
- if (!schema) {
779
- return null;
780
- }
781
- return createYupSchema(schema.attributes, components);
782
- }, [schema, components]);
783
- const validate = React.useCallback(
784
- (document) => {
785
- if (!validationSchema) {
786
- throw new Error(
787
- "There is no validation schema generated, this is likely due to the schema not being loaded yet."
788
- );
789
- }
790
- try {
791
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
792
- return null;
793
- } catch (error2) {
794
- if (error2 instanceof ValidationError) {
795
- return getYupValidationErrors(error2);
796
- }
797
- throw error2;
798
- }
917
+ }, [error, formatAPIError, toggleNotification]);
918
+ const editLayout = React.useMemo(
919
+ () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
920
+ layout: [],
921
+ components: {},
922
+ metadatas: {},
923
+ options: {},
924
+ settings: DEFAULT_SETTINGS
799
925
  },
800
- [validationSchema]
926
+ [data, isLoading, schemas, schema, components]
927
+ );
928
+ const listLayout = React.useMemo(() => {
929
+ return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
930
+ layout: [],
931
+ metadatas: {},
932
+ options: {},
933
+ settings: DEFAULT_SETTINGS
934
+ };
935
+ }, [data, isLoading, schemas, schema, components]);
936
+ const { layout: edit } = React.useMemo(
937
+ () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
938
+ layout: editLayout,
939
+ query
940
+ }),
941
+ [editLayout, query, runHookWaterfall]
801
942
  );
802
- const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
803
943
  return {
804
- components,
805
- document: data?.data,
806
- meta: data?.meta,
944
+ error,
807
945
  isLoading,
808
- schema,
809
- validate
946
+ edit,
947
+ list: listLayout
810
948
  };
811
949
  };
812
- const useDoc = () => {
813
- const { id, slug, collectionType, origin } = useParams();
814
- const [{ query }] = useQueryParams();
815
- const params = React.useMemo(() => buildValidParams(query), [query]);
816
- if (!collectionType) {
817
- throw new Error("Could not find collectionType in url params");
818
- }
819
- if (!slug) {
820
- throw new Error("Could not find model in url params");
950
+ const useDocLayout = () => {
951
+ const { model } = useDoc();
952
+ return useDocumentLayout(model);
953
+ };
954
+ const formatEditLayout = (data, {
955
+ schemas,
956
+ schema,
957
+ components
958
+ }) => {
959
+ let currentPanelIndex = 0;
960
+ const panelledEditAttributes = convertEditLayoutToFieldLayouts(
961
+ data.contentType.layouts.edit,
962
+ schema?.attributes,
963
+ data.contentType.metadatas,
964
+ { configurations: data.components, schemas: components },
965
+ schemas
966
+ ).reduce((panels, row) => {
967
+ if (row.some((field) => field.type === "dynamiczone")) {
968
+ panels.push([row]);
969
+ currentPanelIndex += 2;
970
+ } else {
971
+ if (!panels[currentPanelIndex]) {
972
+ panels.push([row]);
973
+ } else {
974
+ panels[currentPanelIndex].push(row);
975
+ }
976
+ }
977
+ return panels;
978
+ }, []);
979
+ const componentEditAttributes = Object.entries(data.components).reduce(
980
+ (acc, [uid, configuration]) => {
981
+ acc[uid] = {
982
+ layout: convertEditLayoutToFieldLayouts(
983
+ configuration.layouts.edit,
984
+ components[uid].attributes,
985
+ configuration.metadatas,
986
+ { configurations: data.components, schemas: components }
987
+ ),
988
+ settings: {
989
+ ...configuration.settings,
990
+ icon: components[uid].info.icon,
991
+ displayName: components[uid].info.displayName
992
+ }
993
+ };
994
+ return acc;
995
+ },
996
+ {}
997
+ );
998
+ const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
999
+ (acc, [attribute, metadata]) => {
1000
+ return {
1001
+ ...acc,
1002
+ [attribute]: metadata.edit
1003
+ };
1004
+ },
1005
+ {}
1006
+ );
1007
+ return {
1008
+ layout: panelledEditAttributes,
1009
+ components: componentEditAttributes,
1010
+ metadatas: editMetadatas,
1011
+ settings: {
1012
+ ...data.contentType.settings,
1013
+ displayName: schema?.info.displayName
1014
+ },
1015
+ options: {
1016
+ ...schema?.options,
1017
+ ...schema?.pluginOptions,
1018
+ ...data.contentType.options
1019
+ }
1020
+ };
1021
+ };
1022
+ const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
1023
+ return rows.map(
1024
+ (row) => row.map((field) => {
1025
+ const attribute = attributes[field.name];
1026
+ if (!attribute) {
1027
+ return null;
1028
+ }
1029
+ const { edit: metadata } = metadatas[field.name];
1030
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1031
+ return {
1032
+ attribute,
1033
+ disabled: !metadata.editable,
1034
+ hint: metadata.description,
1035
+ label: metadata.label ?? "",
1036
+ name: field.name,
1037
+ // @ts-expect-error – mainField does exist on the metadata for a relation.
1038
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1039
+ schemas,
1040
+ components: components?.schemas ?? {}
1041
+ }),
1042
+ placeholder: metadata.placeholder ?? "",
1043
+ required: attribute.required ?? false,
1044
+ size: field.size,
1045
+ unique: "unique" in attribute ? attribute.unique : false,
1046
+ visible: metadata.visible ?? true,
1047
+ type: attribute.type
1048
+ };
1049
+ }).filter((field) => field !== null)
1050
+ );
1051
+ };
1052
+ const formatListLayout = (data, {
1053
+ schemas,
1054
+ schema,
1055
+ components
1056
+ }) => {
1057
+ const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
1058
+ (acc, [attribute, metadata]) => {
1059
+ return {
1060
+ ...acc,
1061
+ [attribute]: metadata.list
1062
+ };
1063
+ },
1064
+ {}
1065
+ );
1066
+ const listAttributes = convertListLayoutToFieldLayouts(
1067
+ data.contentType.layouts.list,
1068
+ schema?.attributes,
1069
+ listMetadatas,
1070
+ { configurations: data.components, schemas: components },
1071
+ schemas
1072
+ );
1073
+ return {
1074
+ layout: listAttributes,
1075
+ settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
1076
+ metadatas: listMetadatas,
1077
+ options: {
1078
+ ...schema?.options,
1079
+ ...schema?.pluginOptions,
1080
+ ...data.contentType.options
1081
+ }
1082
+ };
1083
+ };
1084
+ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
1085
+ return columns.map((name) => {
1086
+ const attribute = attributes[name];
1087
+ if (!attribute) {
1088
+ return null;
1089
+ }
1090
+ const metadata = metadatas[name];
1091
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1092
+ return {
1093
+ attribute,
1094
+ label: metadata.label ?? "",
1095
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1096
+ schemas,
1097
+ components: components?.schemas ?? {}
1098
+ }),
1099
+ name,
1100
+ searchable: metadata.searchable ?? true,
1101
+ sortable: metadata.sortable ?? true
1102
+ };
1103
+ }).filter((field) => field !== null);
1104
+ };
1105
+ const useDocument = (args, opts) => {
1106
+ const { toggleNotification } = useNotification();
1107
+ const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
1108
+ const {
1109
+ currentData: data,
1110
+ isLoading: isLoadingDocument,
1111
+ isFetching: isFetchingDocument,
1112
+ error
1113
+ } = useGetDocumentQuery(args, {
1114
+ ...opts,
1115
+ skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1116
+ });
1117
+ const {
1118
+ components,
1119
+ schema,
1120
+ schemas,
1121
+ isLoading: isLoadingSchema
1122
+ } = useContentTypeSchema(args.model);
1123
+ React.useEffect(() => {
1124
+ if (error) {
1125
+ toggleNotification({
1126
+ type: "danger",
1127
+ message: formatAPIError(error)
1128
+ });
1129
+ }
1130
+ }, [toggleNotification, error, formatAPIError, args.collectionType]);
1131
+ const validationSchema = React.useMemo(() => {
1132
+ if (!schema) {
1133
+ return null;
1134
+ }
1135
+ return createYupSchema(schema.attributes, components);
1136
+ }, [schema, components]);
1137
+ const validate = React.useCallback(
1138
+ (document) => {
1139
+ if (!validationSchema) {
1140
+ throw new Error(
1141
+ "There is no validation schema generated, this is likely due to the schema not being loaded yet."
1142
+ );
1143
+ }
1144
+ try {
1145
+ validationSchema.validateSync(document, { abortEarly: false, strict: true });
1146
+ return null;
1147
+ } catch (error2) {
1148
+ if (error2 instanceof ValidationError) {
1149
+ return getYupValidationErrors(error2);
1150
+ }
1151
+ throw error2;
1152
+ }
1153
+ },
1154
+ [validationSchema]
1155
+ );
1156
+ const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1157
+ const hasError = !!error;
1158
+ return {
1159
+ components,
1160
+ document: data?.data,
1161
+ meta: data?.meta,
1162
+ isLoading,
1163
+ hasError,
1164
+ schema,
1165
+ schemas,
1166
+ validate
1167
+ };
1168
+ };
1169
+ const useDoc = () => {
1170
+ const { id, slug, collectionType, origin } = useParams();
1171
+ const [{ query }] = useQueryParams();
1172
+ const params = React.useMemo(() => buildValidParams(query), [query]);
1173
+ if (!collectionType) {
1174
+ throw new Error("Could not find collectionType in url params");
821
1175
  }
1176
+ if (!slug) {
1177
+ throw new Error("Could not find model in url params");
1178
+ }
1179
+ const document = useDocument(
1180
+ { documentId: origin || id, model: slug, collectionType, params },
1181
+ {
1182
+ skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1183
+ }
1184
+ );
1185
+ const returnId = origin || id === "create" ? void 0 : id;
822
1186
  return {
823
1187
  collectionType,
824
1188
  model: slug,
825
- id: origin || id === "create" ? void 0 : id,
826
- ...useDocument(
827
- { documentId: origin || id, model: slug, collectionType, params },
828
- {
829
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
830
- }
831
- )
1189
+ id: returnId,
1190
+ ...document
1191
+ };
1192
+ };
1193
+ const useContentManagerContext = () => {
1194
+ const {
1195
+ collectionType,
1196
+ model,
1197
+ id,
1198
+ components,
1199
+ isLoading: isLoadingDoc,
1200
+ schema,
1201
+ schemas
1202
+ } = useDoc();
1203
+ const layout = useDocumentLayout(model);
1204
+ const form = useForm("useContentManagerContext", (state) => state);
1205
+ const isSingleType = collectionType === SINGLE_TYPES;
1206
+ const slug = model;
1207
+ const isCreatingEntry = id === "create";
1208
+ useContentTypeSchema();
1209
+ const isLoading = isLoadingDoc || layout.isLoading;
1210
+ const error = layout.error;
1211
+ return {
1212
+ error,
1213
+ isLoading,
1214
+ // Base metadata
1215
+ model,
1216
+ collectionType,
1217
+ id,
1218
+ slug,
1219
+ isCreatingEntry,
1220
+ isSingleType,
1221
+ hasDraftAndPublish: schema?.options?.draftAndPublish ?? false,
1222
+ // All schema infos
1223
+ components,
1224
+ contentType: schema,
1225
+ contentTypes: schemas,
1226
+ // Form state
1227
+ form,
1228
+ // layout infos
1229
+ layout
832
1230
  };
833
1231
  };
834
1232
  const prefixPluginTranslations = (trad, pluginId) => {
835
- if (!pluginId) {
836
- throw new TypeError("pluginId can't be empty");
837
- }
838
1233
  return Object.keys(trad).reduce((acc, current) => {
839
1234
  acc[`${pluginId}.${current}`] = trad[current];
840
1235
  return acc;
@@ -850,6 +1245,8 @@ const useDocumentActions = () => {
850
1245
  const { formatMessage } = useIntl();
851
1246
  const { trackUsage } = useTracking();
852
1247
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
1248
+ const navigate = useNavigate();
1249
+ const setCurrentStep = useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
853
1250
  const [deleteDocument] = useDeleteDocumentMutation();
854
1251
  const _delete = React.useCallback(
855
1252
  async ({ collectionType, model, documentId, params }, trackerProperty) => {
@@ -1164,6 +1561,7 @@ const useDocumentActions = () => {
1164
1561
  defaultMessage: "Saved document"
1165
1562
  })
1166
1563
  });
1564
+ setCurrentStep("contentManager.success");
1167
1565
  return res.data;
1168
1566
  } catch (err) {
1169
1567
  toggleNotification({
@@ -1185,7 +1583,6 @@ const useDocumentActions = () => {
1185
1583
  sourceId
1186
1584
  });
1187
1585
  if ("error" in res) {
1188
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1189
1586
  return { error: res.error };
1190
1587
  }
1191
1588
  toggleNotification({
@@ -1204,7 +1601,7 @@ const useDocumentActions = () => {
1204
1601
  throw err;
1205
1602
  }
1206
1603
  },
1207
- [autoCloneDocument, formatAPIError, formatMessage, toggleNotification]
1604
+ [autoCloneDocument, formatMessage, toggleNotification]
1208
1605
  );
1209
1606
  const [cloneDocument] = useCloneDocumentMutation();
1210
1607
  const clone = React.useCallback(
@@ -1230,6 +1627,7 @@ const useDocumentActions = () => {
1230
1627
  defaultMessage: "Cloned document"
1231
1628
  })
1232
1629
  });
1630
+ navigate(`../../${res.data.data.documentId}`, { relative: "path" });
1233
1631
  return res.data;
1234
1632
  } catch (err) {
1235
1633
  toggleNotification({
@@ -1240,7 +1638,7 @@ const useDocumentActions = () => {
1240
1638
  throw err;
1241
1639
  }
1242
1640
  },
1243
- [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
1641
+ [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
1244
1642
  );
1245
1643
  const [getDoc] = useLazyGetDocumentQuery();
1246
1644
  const getDocument = React.useCallback(
@@ -1266,7 +1664,7 @@ const useDocumentActions = () => {
1266
1664
  };
1267
1665
  };
1268
1666
  const ProtectedHistoryPage = lazy(
1269
- () => import("./History-Bru_KoeP.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1667
+ () => import("./History-D-99Wh30.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1270
1668
  );
1271
1669
  const routes$1 = [
1272
1670
  {
@@ -1279,31 +1677,31 @@ const routes$1 = [
1279
1677
  }
1280
1678
  ];
1281
1679
  const ProtectedEditViewPage = lazy(
1282
- () => import("./EditViewPage-CPj61RMh.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1680
+ () => import("./EditViewPage-CiwVPMaK.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1283
1681
  );
1284
1682
  const ProtectedListViewPage = lazy(
1285
- () => import("./ListViewPage-SID6TRb9.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1683
+ () => import("./ListViewPage-DSK3f0ST.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1286
1684
  );
1287
1685
  const ProtectedListConfiguration = lazy(
1288
- () => import("./ListConfigurationPage-D8wGABj0.mjs").then((mod) => ({
1686
+ () => import("./ListConfigurationPage-JPWZz7Kg.mjs").then((mod) => ({
1289
1687
  default: mod.ProtectedListConfiguration
1290
1688
  }))
1291
1689
  );
1292
1690
  const ProtectedEditConfigurationPage = lazy(
1293
- () => import("./EditConfigurationPage-JT3E7NZy.mjs").then((mod) => ({
1691
+ () => import("./EditConfigurationPage-BglmD_BF.mjs").then((mod) => ({
1294
1692
  default: mod.ProtectedEditConfigurationPage
1295
1693
  }))
1296
1694
  );
1297
1695
  const ProtectedComponentConfigurationPage = lazy(
1298
- () => import("./ComponentConfigurationPage-DmwmiFQy.mjs").then((mod) => ({
1696
+ () => import("./ComponentConfigurationPage-CIjXcRAB.mjs").then((mod) => ({
1299
1697
  default: mod.ProtectedComponentConfigurationPage
1300
1698
  }))
1301
1699
  );
1302
1700
  const NoPermissions = lazy(
1303
- () => import("./NoPermissionsPage-B7syEq5E.mjs").then((mod) => ({ default: mod.NoPermissions }))
1701
+ () => import("./NoPermissionsPage-DBrBw-0y.mjs").then((mod) => ({ default: mod.NoPermissions }))
1304
1702
  );
1305
1703
  const NoContentType = lazy(
1306
- () => import("./NoContentTypePage-CJ7UXwrQ.mjs").then((mod) => ({ default: mod.NoContentType }))
1704
+ () => import("./NoContentTypePage-D99LU1YP.mjs").then((mod) => ({ default: mod.NoContentType }))
1307
1705
  );
1308
1706
  const CollectionTypePages = () => {
1309
1707
  const { collectionType } = useParams();
@@ -1417,12 +1815,14 @@ const DocumentActionButton = (action) => {
1417
1815
  /* @__PURE__ */ jsx(
1418
1816
  Button,
1419
1817
  {
1420
- flex: 1,
1818
+ flex: "auto",
1421
1819
  startIcon: action.icon,
1422
1820
  disabled: action.disabled,
1423
1821
  onClick: handleClick(action),
1424
1822
  justifyContent: "center",
1425
1823
  variant: action.variant || "default",
1824
+ paddingTop: "7px",
1825
+ paddingBottom: "7px",
1426
1826
  children: action.label
1427
1827
  }
1428
1828
  ),
@@ -1430,7 +1830,7 @@ const DocumentActionButton = (action) => {
1430
1830
  DocumentActionConfirmDialog,
1431
1831
  {
1432
1832
  ...action.dialog,
1433
- variant: action.variant,
1833
+ variant: action.dialog?.variant ?? action.variant,
1434
1834
  isOpen: dialogId === action.id,
1435
1835
  onClose: handleClose
1436
1836
  }
@@ -1487,9 +1887,9 @@ const DocumentActionsMenu = ({
1487
1887
  disabled: isDisabled,
1488
1888
  size: "S",
1489
1889
  endIcon: null,
1490
- paddingTop: "7px",
1491
- paddingLeft: "9px",
1492
- paddingRight: "9px",
1890
+ paddingTop: "4px",
1891
+ paddingLeft: "7px",
1892
+ paddingRight: "7px",
1493
1893
  variant,
1494
1894
  children: [
1495
1895
  /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
@@ -1500,7 +1900,7 @@ const DocumentActionsMenu = ({
1500
1900
  ]
1501
1901
  }
1502
1902
  ),
1503
- /* @__PURE__ */ jsxs(Menu.Content, { top: "4px", maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1903
+ /* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1504
1904
  actions2.map((action) => {
1505
1905
  return /* @__PURE__ */ jsx(
1506
1906
  Menu.Item,
@@ -1509,10 +1909,25 @@ const DocumentActionsMenu = ({
1509
1909
  onSelect: handleClick(action),
1510
1910
  display: "block",
1511
1911
  children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
1512
- /* @__PURE__ */ jsxs(Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1513
- /* @__PURE__ */ jsx(Box, { tag: "span", color: convertActionVariantToIconColor(action.variant), children: action.icon }),
1514
- action.label
1515
- ] }),
1912
+ /* @__PURE__ */ jsxs(
1913
+ Flex,
1914
+ {
1915
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1916
+ gap: 2,
1917
+ tag: "span",
1918
+ children: [
1919
+ /* @__PURE__ */ jsx(
1920
+ Flex,
1921
+ {
1922
+ tag: "span",
1923
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1924
+ children: action.icon
1925
+ }
1926
+ ),
1927
+ action.label
1928
+ ]
1929
+ }
1930
+ ),
1516
1931
  action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
1517
1932
  Flex,
1518
1933
  {
@@ -1609,11 +2024,11 @@ const DocumentActionConfirmDialog = ({
1609
2024
  /* @__PURE__ */ jsx(Dialog.Header, { children: title }),
1610
2025
  /* @__PURE__ */ jsx(Dialog.Body, { children: content }),
1611
2026
  /* @__PURE__ */ jsxs(Dialog.Footer, { children: [
1612
- /* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
2027
+ /* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
1613
2028
  id: "app.components.Button.cancel",
1614
2029
  defaultMessage: "Cancel"
1615
2030
  }) }) }),
1616
- /* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, children: formatMessage({
2031
+ /* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
1617
2032
  id: "app.components.Button.confirm",
1618
2033
  defaultMessage: "Confirm"
1619
2034
  }) })
@@ -1640,6 +2055,18 @@ const DocumentActionModal = ({
1640
2055
  typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
1641
2056
  ] }) });
1642
2057
  };
2058
+ const transformData = (data) => {
2059
+ if (Array.isArray(data)) {
2060
+ return data.map(transformData);
2061
+ }
2062
+ if (typeof data === "object" && data !== null) {
2063
+ if ("apiData" in data) {
2064
+ return data.apiData;
2065
+ }
2066
+ return mapValues(transformData)(data);
2067
+ }
2068
+ return data;
2069
+ };
1643
2070
  const PublishAction$1 = ({
1644
2071
  activeTab,
1645
2072
  documentId,
@@ -1652,13 +2079,17 @@ const PublishAction$1 = ({
1652
2079
  const navigate = useNavigate();
1653
2080
  const { toggleNotification } = useNotification();
1654
2081
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
2082
+ const isListView = useMatch(LIST_PATH) !== null;
1655
2083
  const isCloning = useMatch(CLONE_PATH) !== null;
1656
2084
  const { formatMessage } = useIntl();
1657
- const { canPublish, canCreate, canUpdate } = useDocumentRBAC(
1658
- "PublishAction",
1659
- ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1660
- );
2085
+ const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
1661
2086
  const { publish } = useDocumentActions();
2087
+ const [
2088
+ countDraftRelations,
2089
+ { isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
2090
+ ] = useLazyGetDraftRelationCountQuery();
2091
+ const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React.useState(0);
2092
+ const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React.useState(0);
1662
2093
  const [{ query, rawQuery }] = useQueryParams();
1663
2094
  const params = React.useMemo(() => buildValidParams(query), [query]);
1664
2095
  const modified = useForm("PublishAction", ({ modified: modified2 }) => modified2);
@@ -1667,62 +2098,144 @@ const PublishAction$1 = ({
1667
2098
  const validate = useForm("PublishAction", (state) => state.validate);
1668
2099
  const setErrors = useForm("PublishAction", (state) => state.setErrors);
1669
2100
  const formValues = useForm("PublishAction", ({ values }) => values);
1670
- const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1671
- if (!schema?.options?.draftAndPublish) {
1672
- return null;
1673
- }
1674
- return {
1675
- /**
1676
- * Disabled when:
2101
+ React.useEffect(() => {
2102
+ if (isErrorDraftRelations) {
2103
+ toggleNotification({
2104
+ type: "danger",
2105
+ message: formatMessage({
2106
+ id: getTranslation("error.records.fetch-draft-relatons"),
2107
+ defaultMessage: "An error occurred while fetching draft relations on this document."
2108
+ })
2109
+ });
2110
+ }
2111
+ }, [isErrorDraftRelations, toggleNotification, formatMessage]);
2112
+ React.useEffect(() => {
2113
+ const localDraftRelations = /* @__PURE__ */ new Set();
2114
+ const extractDraftRelations = (data) => {
2115
+ const relations = data.connect || [];
2116
+ relations.forEach((relation) => {
2117
+ if (relation.status === "draft") {
2118
+ localDraftRelations.add(relation.id);
2119
+ }
2120
+ });
2121
+ };
2122
+ const traverseAndExtract = (data) => {
2123
+ Object.entries(data).forEach(([key, value]) => {
2124
+ if (key === "connect" && Array.isArray(value)) {
2125
+ extractDraftRelations({ connect: value });
2126
+ } else if (typeof value === "object" && value !== null) {
2127
+ traverseAndExtract(value);
2128
+ }
2129
+ });
2130
+ };
2131
+ if (!documentId || modified) {
2132
+ traverseAndExtract(formValues);
2133
+ setLocalCountOfDraftRelations(localDraftRelations.size);
2134
+ }
2135
+ }, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
2136
+ React.useEffect(() => {
2137
+ if (!document || !document.documentId || isListView) {
2138
+ return;
2139
+ }
2140
+ const fetchDraftRelationsCount = async () => {
2141
+ const { data, error } = await countDraftRelations({
2142
+ collectionType,
2143
+ model,
2144
+ documentId,
2145
+ params
2146
+ });
2147
+ if (error) {
2148
+ throw error;
2149
+ }
2150
+ if (data) {
2151
+ setServerCountOfDraftRelations(data.data);
2152
+ }
2153
+ };
2154
+ fetchDraftRelationsCount();
2155
+ }, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
2156
+ const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
2157
+ if (!schema?.options?.draftAndPublish) {
2158
+ return null;
2159
+ }
2160
+ const performPublish = async () => {
2161
+ setSubmitting(true);
2162
+ try {
2163
+ const { errors } = await validate(true, {
2164
+ status: "published"
2165
+ });
2166
+ if (errors) {
2167
+ toggleNotification({
2168
+ type: "danger",
2169
+ message: formatMessage({
2170
+ id: "content-manager.validation.error",
2171
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2172
+ })
2173
+ });
2174
+ return;
2175
+ }
2176
+ const res = await publish(
2177
+ {
2178
+ collectionType,
2179
+ model,
2180
+ documentId,
2181
+ params
2182
+ },
2183
+ transformData(formValues)
2184
+ );
2185
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2186
+ navigate({
2187
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2188
+ search: rawQuery
2189
+ });
2190
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2191
+ setErrors(formatValidationErrors(res.error));
2192
+ }
2193
+ } finally {
2194
+ setSubmitting(false);
2195
+ }
2196
+ };
2197
+ const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
2198
+ const enableDraftRelationsCount = false;
2199
+ const hasDraftRelations = enableDraftRelationsCount;
2200
+ return {
2201
+ /**
2202
+ * Disabled when:
1677
2203
  * - currently if you're cloning a document we don't support publish & clone at the same time.
1678
2204
  * - the form is submitting
1679
2205
  * - the active tab is the published tab
1680
2206
  * - the document is already published & not modified
1681
2207
  * - the document is being created & not modified
1682
2208
  * - the user doesn't have the permission to publish
1683
- * - the user doesn't have the permission to create a new document
1684
- * - the user doesn't have the permission to update the document
1685
2209
  */
1686
- disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
2210
+ disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
1687
2211
  label: formatMessage({
1688
2212
  id: "app.utils.publish",
1689
2213
  defaultMessage: "Publish"
1690
2214
  }),
1691
2215
  onClick: async () => {
1692
- setSubmitting(true);
1693
- try {
1694
- const { errors } = await validate();
1695
- if (errors) {
1696
- toggleNotification({
1697
- type: "danger",
1698
- message: formatMessage({
1699
- id: "content-manager.validation.error",
1700
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1701
- })
1702
- });
1703
- return;
1704
- }
1705
- const res = await publish(
1706
- {
1707
- collectionType,
1708
- model,
1709
- documentId,
1710
- params
1711
- },
1712
- formValues
1713
- );
1714
- if ("data" in res && collectionType !== SINGLE_TYPES) {
1715
- navigate({
1716
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1717
- search: rawQuery
1718
- });
1719
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1720
- setErrors(formatValidationErrors(res.error));
2216
+ await performPublish();
2217
+ },
2218
+ dialog: hasDraftRelations ? {
2219
+ type: "dialog",
2220
+ variant: "danger",
2221
+ footer: null,
2222
+ title: formatMessage({
2223
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
2224
+ defaultMessage: "Confirmation"
2225
+ }),
2226
+ content: formatMessage(
2227
+ {
2228
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
2229
+ defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
2230
+ },
2231
+ {
2232
+ count: totalDraftRelations
1721
2233
  }
1722
- } finally {
1723
- setSubmitting(false);
2234
+ ),
2235
+ onConfirm: async () => {
2236
+ await performPublish();
1724
2237
  }
1725
- }
2238
+ } : void 0
1726
2239
  };
1727
2240
  };
1728
2241
  PublishAction$1.type = "publish";
@@ -1738,10 +2251,6 @@ const UpdateAction = ({
1738
2251
  const cloneMatch = useMatch(CLONE_PATH);
1739
2252
  const isCloning = cloneMatch !== null;
1740
2253
  const { formatMessage } = useIntl();
1741
- const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1742
- canCreate: canCreate2,
1743
- canUpdate: canUpdate2
1744
- }));
1745
2254
  const { create, update, clone } = useDocumentActions();
1746
2255
  const [{ query, rawQuery }] = useQueryParams();
1747
2256
  const params = React.useMemo(() => buildValidParams(query), [query]);
@@ -1758,10 +2267,8 @@ const UpdateAction = ({
1758
2267
  * - the form is submitting
1759
2268
  * - the document is not modified & we're not cloning (you can save a clone entity straight away)
1760
2269
  * - the active tab is the published tab
1761
- * - the user doesn't have the permission to create a new document
1762
- * - the user doesn't have the permission to update the document
1763
2270
  */
1764
- disabled: isSubmitting || !modified && !isCloning || activeTab === "published" || Boolean(!documentId && !canCreate || documentId && !canUpdate),
2271
+ disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
1765
2272
  label: formatMessage({
1766
2273
  id: "content-manager.containers.Edit.save",
1767
2274
  defaultMessage: "Save"
@@ -1769,7 +2276,9 @@ const UpdateAction = ({
1769
2276
  onClick: async () => {
1770
2277
  setSubmitting(true);
1771
2278
  try {
1772
- const { errors } = await validate();
2279
+ const { errors } = await validate(true, {
2280
+ status: "draft"
2281
+ });
1773
2282
  if (errors) {
1774
2283
  toggleNotification({
1775
2284
  type: "danger",
@@ -1787,13 +2296,16 @@ const UpdateAction = ({
1787
2296
  documentId: cloneMatch.params.origin,
1788
2297
  params
1789
2298
  },
1790
- document
2299
+ transformData(document)
1791
2300
  );
1792
2301
  if ("data" in res) {
1793
- navigate({
1794
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1795
- search: rawQuery
1796
- });
2302
+ navigate(
2303
+ {
2304
+ pathname: `../${res.data.documentId}`,
2305
+ search: rawQuery
2306
+ },
2307
+ { relative: "path" }
2308
+ );
1797
2309
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1798
2310
  setErrors(formatValidationErrors(res.error));
1799
2311
  }
@@ -1805,7 +2317,7 @@ const UpdateAction = ({
1805
2317
  documentId,
1806
2318
  params
1807
2319
  },
1808
- document
2320
+ transformData(document)
1809
2321
  );
1810
2322
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1811
2323
  setErrors(formatValidationErrors(res.error));
@@ -1818,13 +2330,16 @@ const UpdateAction = ({
1818
2330
  model,
1819
2331
  params
1820
2332
  },
1821
- document
2333
+ transformData(document)
1822
2334
  );
1823
2335
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1824
- navigate({
1825
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1826
- search: rawQuery
1827
- });
2336
+ navigate(
2337
+ {
2338
+ pathname: `../${res.data.documentId}`,
2339
+ search: rawQuery
2340
+ },
2341
+ { replace: true, relative: "path" }
2342
+ );
1828
2343
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1829
2344
  setErrors(formatValidationErrors(res.error));
1830
2345
  }
@@ -1868,7 +2383,7 @@ const UnpublishAction$1 = ({
1868
2383
  id: "app.utils.unpublish",
1869
2384
  defaultMessage: "Unpublish"
1870
2385
  }),
1871
- icon: /* @__PURE__ */ jsx(StyledCrossCircle, {}),
2386
+ icon: /* @__PURE__ */ jsx(Cross, {}),
1872
2387
  onClick: async () => {
1873
2388
  if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
1874
2389
  if (!documentId) {
@@ -1980,7 +2495,7 @@ const DiscardAction = ({
1980
2495
  id: "content-manager.actions.discard.label",
1981
2496
  defaultMessage: "Discard changes"
1982
2497
  }),
1983
- icon: /* @__PURE__ */ jsx(StyledCrossCircle, {}),
2498
+ icon: /* @__PURE__ */ jsx(Cross, {}),
1984
2499
  position: ["panel", "table-row"],
1985
2500
  variant: "danger",
1986
2501
  dialog: {
@@ -2008,11 +2523,6 @@ const DiscardAction = ({
2008
2523
  };
2009
2524
  };
2010
2525
  DiscardAction.type = "discard";
2011
- const StyledCrossCircle = styled(CrossCircle)`
2012
- path {
2013
- fill: currentColor;
2014
- }
2015
- `;
2016
2526
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2017
2527
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2018
2528
  const RelativeTime = React.forwardRef(
@@ -2060,7 +2570,7 @@ const getDisplayName = ({
2060
2570
  };
2061
2571
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2062
2572
  const DocumentStatus = ({ status = "draft", ...restProps }) => {
2063
- const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
2573
+ const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2064
2574
  return /* @__PURE__ */ jsx(Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2065
2575
  };
2066
2576
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
@@ -2070,23 +2580,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2070
2580
  id: "content-manager.containers.edit.title.new",
2071
2581
  defaultMessage: "Create an entry"
2072
2582
  }) : documentTitle;
2073
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 8, paddingBottom: 4, gap: 3, children: [
2583
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2074
2584
  /* @__PURE__ */ jsx(BackButton, {}),
2075
- /* @__PURE__ */ jsxs(
2076
- Flex,
2077
- {
2078
- width: "100%",
2079
- justifyContent: "space-between",
2080
- paddingTop: 1,
2081
- gap: "80px",
2082
- alignItems: "flex-start",
2083
- children: [
2084
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
2085
- /* @__PURE__ */ jsx(HeaderToolbar, {})
2086
- ]
2087
- }
2088
- ),
2089
- status ? /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
2585
+ /* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2586
+ /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
2587
+ /* @__PURE__ */ jsx(HeaderToolbar, {})
2588
+ ] }),
2589
+ status ? /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
2090
2590
  ] });
2091
2591
  };
2092
2592
  const HeaderToolbar = () => {
@@ -2169,12 +2669,12 @@ const Information = ({ activeTab }) => {
2169
2669
  isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2170
2670
  label: formatMessage({
2171
2671
  id: "content-manager.containers.edit.information.last-published.label",
2172
- defaultMessage: "Last published"
2672
+ defaultMessage: "Published"
2173
2673
  }),
2174
2674
  value: formatMessage(
2175
2675
  {
2176
2676
  id: "content-manager.containers.edit.information.last-published.value",
2177
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2677
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2178
2678
  },
2179
2679
  {
2180
2680
  time: /* @__PURE__ */ jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
@@ -2187,12 +2687,12 @@ const Information = ({ activeTab }) => {
2187
2687
  isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2188
2688
  label: formatMessage({
2189
2689
  id: "content-manager.containers.edit.information.last-draft.label",
2190
- defaultMessage: "Last draft"
2690
+ defaultMessage: "Updated"
2191
2691
  }),
2192
2692
  value: formatMessage(
2193
2693
  {
2194
2694
  id: "content-manager.containers.edit.information.last-draft.value",
2195
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2695
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2196
2696
  },
2197
2697
  {
2198
2698
  time: /* @__PURE__ */ jsx(
@@ -2210,12 +2710,12 @@ const Information = ({ activeTab }) => {
2210
2710
  isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2211
2711
  label: formatMessage({
2212
2712
  id: "content-manager.containers.edit.information.document.label",
2213
- defaultMessage: "Document"
2713
+ defaultMessage: "Created"
2214
2714
  }),
2215
2715
  value: formatMessage(
2216
2716
  {
2217
2717
  id: "content-manager.containers.edit.information.document.value",
2218
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2718
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2219
2719
  },
2220
2720
  {
2221
2721
  time: /* @__PURE__ */ jsx(
@@ -2253,25 +2753,77 @@ const Information = ({ activeTab }) => {
2253
2753
  );
2254
2754
  };
2255
2755
  const HeaderActions = ({ actions: actions2 }) => {
2256
- return /* @__PURE__ */ jsx(Flex, { children: actions2.map((action) => {
2257
- if ("options" in action) {
2756
+ const [dialogId, setDialogId] = React.useState(null);
2757
+ const handleClick = (action) => async (e) => {
2758
+ if (!("options" in action)) {
2759
+ const { onClick = () => false, dialog, id } = action;
2760
+ const muteDialog = await onClick(e);
2761
+ if (dialog && !muteDialog) {
2762
+ e.preventDefault();
2763
+ setDialogId(id);
2764
+ }
2765
+ }
2766
+ };
2767
+ const handleClose = () => {
2768
+ setDialogId(null);
2769
+ };
2770
+ return /* @__PURE__ */ jsx(Flex, { gap: 1, children: actions2.map((action) => {
2771
+ if (action.options) {
2258
2772
  return /* @__PURE__ */ jsx(
2259
2773
  SingleSelect,
2260
2774
  {
2261
2775
  size: "S",
2262
- disabled: action.disabled,
2263
- "aria-label": action.label,
2264
2776
  onChange: action.onSelect,
2265
- value: action.value,
2777
+ "aria-label": action.label,
2778
+ ...action,
2266
2779
  children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsx(SingleSelectOption, { ...option, children: label }, option.value))
2267
2780
  },
2268
2781
  action.id
2269
2782
  );
2270
2783
  } else {
2271
- return null;
2784
+ if (action.type === "icon") {
2785
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [
2786
+ /* @__PURE__ */ jsx(
2787
+ IconButton,
2788
+ {
2789
+ disabled: action.disabled,
2790
+ label: action.label,
2791
+ size: "S",
2792
+ onClick: handleClick(action),
2793
+ children: action.icon
2794
+ }
2795
+ ),
2796
+ action.dialog ? /* @__PURE__ */ jsx(
2797
+ HeaderActionDialog,
2798
+ {
2799
+ ...action.dialog,
2800
+ isOpen: dialogId === action.id,
2801
+ onClose: handleClose
2802
+ }
2803
+ ) : null
2804
+ ] }, action.id);
2805
+ }
2272
2806
  }
2273
2807
  }) });
2274
2808
  };
2809
+ const HeaderActionDialog = ({
2810
+ onClose,
2811
+ onCancel,
2812
+ title,
2813
+ content: Content,
2814
+ isOpen
2815
+ }) => {
2816
+ const handleClose = async () => {
2817
+ if (onCancel) {
2818
+ await onCancel();
2819
+ }
2820
+ onClose();
2821
+ };
2822
+ return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
2823
+ /* @__PURE__ */ jsx(Dialog.Header, { children: title }),
2824
+ typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : Content
2825
+ ] }) });
2826
+ };
2275
2827
  const ConfigureTheViewAction = ({ collectionType, model }) => {
2276
2828
  const navigate = useNavigate();
2277
2829
  const { formatMessage } = useIntl();
@@ -2312,12 +2864,16 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2312
2864
  const { delete: deleteAction } = useDocumentActions();
2313
2865
  const { toggleNotification } = useNotification();
2314
2866
  const setSubmitting = useForm("DeleteAction", (state) => state.setSubmitting);
2867
+ const isLocalized = document?.locale != null;
2315
2868
  return {
2316
2869
  disabled: !canDelete || !document,
2317
- label: formatMessage({
2318
- id: "content-manager.actions.delete.label",
2319
- defaultMessage: "Delete document"
2320
- }),
2870
+ label: formatMessage(
2871
+ {
2872
+ id: "content-manager.actions.delete.label",
2873
+ defaultMessage: "Delete entry{isLocalized, select, true { (all locales)} other {}}"
2874
+ },
2875
+ { isLocalized }
2876
+ ),
2321
2877
  icon: /* @__PURE__ */ jsx(Trash, {}),
2322
2878
  dialog: {
2323
2879
  type: "dialog",
@@ -2354,422 +2910,120 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2354
2910
  documentId,
2355
2911
  model,
2356
2912
  collectionType,
2357
- params: {
2358
- locale: "*"
2359
- }
2360
- });
2361
- if (!("error" in res)) {
2362
- navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2363
- }
2364
- } finally {
2365
- if (!listViewPathMatch) {
2366
- setSubmitting(false);
2367
- }
2368
- }
2369
- }
2370
- },
2371
- variant: "danger",
2372
- position: ["header", "table-row"]
2373
- };
2374
- };
2375
- DeleteAction$1.type = "delete";
2376
- const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2377
- const Panels = () => {
2378
- const isCloning = useMatch(CLONE_PATH) !== null;
2379
- const [
2380
- {
2381
- query: { status }
2382
- }
2383
- ] = useQueryParams({
2384
- status: "draft"
2385
- });
2386
- const { model, id, document, meta, collectionType } = useDoc();
2387
- const plugins = useStrapiApp("Panels", (state) => state.plugins);
2388
- const props = {
2389
- activeTab: status,
2390
- model,
2391
- documentId: id,
2392
- document: isCloning ? void 0 : document,
2393
- meta: isCloning ? void 0 : meta,
2394
- collectionType
2395
- };
2396
- return /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsx(
2397
- DescriptionComponentRenderer,
2398
- {
2399
- props,
2400
- descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2401
- children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsx(Panel, { ...description, children: content }, id2))
2402
- }
2403
- ) });
2404
- };
2405
- const ActionsPanel = () => {
2406
- const { formatMessage } = useIntl();
2407
- return {
2408
- title: formatMessage({
2409
- id: "content-manager.containers.edit.panels.default.title",
2410
- defaultMessage: "Document"
2411
- }),
2412
- content: /* @__PURE__ */ jsx(ActionsPanelContent, {})
2413
- };
2414
- };
2415
- ActionsPanel.type = "actions";
2416
- const ActionsPanelContent = () => {
2417
- const isCloning = useMatch(CLONE_PATH) !== null;
2418
- const [
2419
- {
2420
- query: { status = "draft" }
2421
- }
2422
- ] = useQueryParams();
2423
- const { model, id, document, meta, collectionType } = useDoc();
2424
- const plugins = useStrapiApp("ActionsPanel", (state) => state.plugins);
2425
- const props = {
2426
- activeTab: status,
2427
- model,
2428
- documentId: id,
2429
- document: isCloning ? void 0 : document,
2430
- meta: isCloning ? void 0 : meta,
2431
- collectionType
2432
- };
2433
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, width: "100%", children: [
2434
- /* @__PURE__ */ jsx(
2435
- DescriptionComponentRenderer,
2436
- {
2437
- props,
2438
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2439
- children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
2440
- }
2441
- ),
2442
- /* @__PURE__ */ jsx(InjectionZone, { area: "editView.right-links", slug: model })
2443
- ] });
2444
- };
2445
- const Panel = React.forwardRef(({ children, title }, ref) => {
2446
- return /* @__PURE__ */ jsxs(
2447
- Flex,
2448
- {
2449
- ref,
2450
- tag: "aside",
2451
- "aria-labelledby": "additional-information",
2452
- background: "neutral0",
2453
- borderColor: "neutral150",
2454
- hasRadius: true,
2455
- paddingBottom: 4,
2456
- paddingLeft: 4,
2457
- paddingRight: 4,
2458
- paddingTop: 4,
2459
- shadow: "tableShadow",
2460
- gap: 3,
2461
- direction: "column",
2462
- justifyContent: "stretch",
2463
- alignItems: "flex-start",
2464
- children: [
2465
- /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2466
- children
2467
- ]
2468
- }
2469
- );
2470
- });
2471
- const HOOKS = {
2472
- /**
2473
- * Hook that allows to mutate the displayed headers of the list view table
2474
- * @constant
2475
- * @type {string}
2476
- */
2477
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2478
- /**
2479
- * Hook that allows to mutate the CM's collection types links pre-set filters
2480
- * @constant
2481
- * @type {string}
2482
- */
2483
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2484
- /**
2485
- * Hook that allows to mutate the CM's edit view layout
2486
- * @constant
2487
- * @type {string}
2488
- */
2489
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2490
- /**
2491
- * Hook that allows to mutate the CM's single types links pre-set filters
2492
- * @constant
2493
- * @type {string}
2494
- */
2495
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2496
- };
2497
- const contentTypesApi = contentManagerApi.injectEndpoints({
2498
- endpoints: (builder) => ({
2499
- getContentTypeConfiguration: builder.query({
2500
- query: (uid) => ({
2501
- url: `/content-manager/content-types/${uid}/configuration`,
2502
- method: "GET"
2503
- }),
2504
- transformResponse: (response) => response.data,
2505
- providesTags: (_result, _error, uid) => [
2506
- { type: "ContentTypesConfiguration", id: uid },
2507
- { type: "ContentTypeSettings", id: "LIST" }
2508
- ]
2509
- }),
2510
- getAllContentTypeSettings: builder.query({
2511
- query: () => "/content-manager/content-types-settings",
2512
- transformResponse: (response) => response.data,
2513
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2514
- }),
2515
- updateContentTypeConfiguration: builder.mutation({
2516
- query: ({ uid, ...body }) => ({
2517
- url: `/content-manager/content-types/${uid}/configuration`,
2518
- method: "PUT",
2519
- data: body
2520
- }),
2521
- transformResponse: (response) => response.data,
2522
- invalidatesTags: (_result, _error, { uid }) => [
2523
- { type: "ContentTypesConfiguration", id: uid },
2524
- { type: "ContentTypeSettings", id: "LIST" },
2525
- // Is this necessary?
2526
- { type: "InitialData" }
2527
- ]
2528
- })
2529
- })
2530
- });
2531
- const {
2532
- useGetContentTypeConfigurationQuery,
2533
- useGetAllContentTypeSettingsQuery,
2534
- useUpdateContentTypeConfigurationMutation
2535
- } = contentTypesApi;
2536
- const checkIfAttributeIsDisplayable = (attribute) => {
2537
- const { type } = attribute;
2538
- if (type === "relation") {
2539
- return !attribute.relation.toLowerCase().includes("morph");
2540
- }
2541
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2542
- };
2543
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2544
- if (!mainFieldName) {
2545
- return void 0;
2546
- }
2547
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2548
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2549
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2550
- );
2551
- return {
2552
- name: mainFieldName,
2553
- type: mainFieldType ?? "string"
2554
- };
2555
- };
2556
- const DEFAULT_SETTINGS = {
2557
- bulkable: false,
2558
- filterable: false,
2559
- searchable: false,
2560
- pagination: false,
2561
- defaultSortBy: "",
2562
- defaultSortOrder: "asc",
2563
- mainField: "id",
2564
- pageSize: 10
2565
- };
2566
- const useDocumentLayout = (model) => {
2567
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2568
- const [{ query }] = useQueryParams();
2569
- const runHookWaterfall = useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2570
- const { toggleNotification } = useNotification();
2571
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
2572
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2573
- const {
2574
- data,
2575
- isLoading: isLoadingConfigs,
2576
- error,
2577
- isFetching: isFetchingConfigs
2578
- } = useGetContentTypeConfigurationQuery(model);
2579
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2580
- React.useEffect(() => {
2581
- if (error) {
2582
- toggleNotification({
2583
- type: "danger",
2584
- message: formatAPIError(error)
2585
- });
2586
- }
2587
- }, [error, formatAPIError, toggleNotification]);
2588
- const editLayout = React.useMemo(
2589
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2590
- layout: [],
2591
- components: {},
2592
- metadatas: {},
2593
- options: {},
2594
- settings: DEFAULT_SETTINGS
2595
- },
2596
- [data, isLoading, schemas, schema, components]
2597
- );
2598
- const listLayout = React.useMemo(() => {
2599
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2600
- layout: [],
2601
- metadatas: {},
2602
- options: {},
2603
- settings: DEFAULT_SETTINGS
2604
- };
2605
- }, [data, isLoading, schemas, schema, components]);
2606
- const { layout: edit } = React.useMemo(
2607
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2608
- layout: editLayout,
2609
- query
2610
- }),
2611
- [editLayout, query, runHookWaterfall]
2612
- );
2613
- return {
2614
- error,
2615
- isLoading,
2616
- edit,
2617
- list: listLayout
2618
- };
2619
- };
2620
- const useDocLayout = () => {
2621
- const { model } = useDoc();
2622
- return useDocumentLayout(model);
2623
- };
2624
- const formatEditLayout = (data, {
2625
- schemas,
2626
- schema,
2627
- components
2628
- }) => {
2629
- let currentPanelIndex = 0;
2630
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2631
- data.contentType.layouts.edit,
2632
- schema?.attributes,
2633
- data.contentType.metadatas,
2634
- { configurations: data.components, schemas: components },
2635
- schemas
2636
- ).reduce((panels, row) => {
2637
- if (row.some((field) => field.type === "dynamiczone")) {
2638
- panels.push([row]);
2639
- currentPanelIndex += 2;
2640
- } else {
2641
- if (!panels[currentPanelIndex]) {
2642
- panels.push([]);
2643
- }
2644
- panels[currentPanelIndex].push(row);
2645
- }
2646
- return panels;
2647
- }, []);
2648
- const componentEditAttributes = Object.entries(data.components).reduce(
2649
- (acc, [uid, configuration]) => {
2650
- acc[uid] = {
2651
- layout: convertEditLayoutToFieldLayouts(
2652
- configuration.layouts.edit,
2653
- components[uid].attributes,
2654
- configuration.metadatas
2655
- ),
2656
- settings: {
2657
- ...configuration.settings,
2658
- icon: components[uid].info.icon,
2659
- displayName: components[uid].info.displayName
2913
+ params: {
2914
+ locale: "*"
2915
+ }
2916
+ });
2917
+ if (!("error" in res)) {
2918
+ navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2919
+ }
2920
+ } finally {
2921
+ if (!listViewPathMatch) {
2922
+ setSubmitting(false);
2923
+ }
2660
2924
  }
2661
- };
2662
- return acc;
2663
- },
2664
- {}
2665
- );
2666
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2667
- (acc, [attribute, metadata]) => {
2668
- return {
2669
- ...acc,
2670
- [attribute]: metadata.edit
2671
- };
2672
- },
2673
- {}
2674
- );
2675
- return {
2676
- layout: panelledEditAttributes,
2677
- components: componentEditAttributes,
2678
- metadatas: editMetadatas,
2679
- settings: {
2680
- ...data.contentType.settings,
2681
- displayName: schema?.info.displayName
2925
+ }
2682
2926
  },
2683
- options: {
2684
- ...schema?.options,
2685
- ...schema?.pluginOptions,
2686
- ...data.contentType.options
2687
- }
2927
+ variant: "danger",
2928
+ position: ["header", "table-row"]
2688
2929
  };
2689
2930
  };
2690
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2691
- return rows.map(
2692
- (row) => row.map((field) => {
2693
- const attribute = attributes[field.name];
2694
- if (!attribute) {
2695
- return null;
2696
- }
2697
- const { edit: metadata } = metadatas[field.name];
2698
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2699
- return {
2700
- attribute,
2701
- disabled: !metadata.editable,
2702
- hint: metadata.description,
2703
- label: metadata.label ?? "",
2704
- name: field.name,
2705
- // @ts-expect-error – mainField does exist on the metadata for a relation.
2706
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2707
- schemas,
2708
- components: components?.schemas ?? {}
2709
- }),
2710
- placeholder: metadata.placeholder ?? "",
2711
- required: attribute.required ?? false,
2712
- size: field.size,
2713
- unique: "unique" in attribute ? attribute.unique : false,
2714
- visible: metadata.visible ?? true,
2715
- type: attribute.type
2716
- };
2717
- }).filter((field) => field !== null)
2718
- );
2931
+ DeleteAction$1.type = "delete";
2932
+ const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2933
+ const Panels = () => {
2934
+ const isCloning = useMatch(CLONE_PATH) !== null;
2935
+ const [
2936
+ {
2937
+ query: { status }
2938
+ }
2939
+ ] = useQueryParams({
2940
+ status: "draft"
2941
+ });
2942
+ const { model, id, document, meta, collectionType } = useDoc();
2943
+ const plugins = useStrapiApp("Panels", (state) => state.plugins);
2944
+ const props = {
2945
+ activeTab: status,
2946
+ model,
2947
+ documentId: id,
2948
+ document: isCloning ? void 0 : document,
2949
+ meta: isCloning ? void 0 : meta,
2950
+ collectionType
2951
+ };
2952
+ return /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsx(
2953
+ DescriptionComponentRenderer,
2954
+ {
2955
+ props,
2956
+ descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2957
+ children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsx(Panel, { ...description, children: content }, id2))
2958
+ }
2959
+ ) });
2719
2960
  };
2720
- const formatListLayout = (data, {
2721
- schemas,
2722
- schema,
2723
- components
2724
- }) => {
2725
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2726
- (acc, [attribute, metadata]) => {
2727
- return {
2728
- ...acc,
2729
- [attribute]: metadata.list
2730
- };
2731
- },
2732
- {}
2733
- );
2734
- const listAttributes = convertListLayoutToFieldLayouts(
2735
- data.contentType.layouts.list,
2736
- schema?.attributes,
2737
- listMetadatas,
2738
- { configurations: data.components, schemas: components },
2739
- schemas
2740
- );
2961
+ const ActionsPanel = () => {
2962
+ const { formatMessage } = useIntl();
2741
2963
  return {
2742
- layout: listAttributes,
2743
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2744
- metadatas: listMetadatas,
2745
- options: {
2746
- ...schema?.options,
2747
- ...schema?.pluginOptions,
2748
- ...data.contentType.options
2749
- }
2964
+ title: formatMessage({
2965
+ id: "content-manager.containers.edit.panels.default.title",
2966
+ defaultMessage: "Entry"
2967
+ }),
2968
+ content: /* @__PURE__ */ jsx(ActionsPanelContent, {})
2750
2969
  };
2751
2970
  };
2752
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2753
- return columns.map((name) => {
2754
- const attribute = attributes[name];
2755
- if (!attribute) {
2756
- return null;
2971
+ ActionsPanel.type = "actions";
2972
+ const ActionsPanelContent = () => {
2973
+ const isCloning = useMatch(CLONE_PATH) !== null;
2974
+ const [
2975
+ {
2976
+ query: { status = "draft" }
2757
2977
  }
2758
- const metadata = metadatas[name];
2759
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2760
- return {
2761
- attribute,
2762
- label: metadata.label ?? "",
2763
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2764
- schemas,
2765
- components: components?.schemas ?? {}
2766
- }),
2767
- name,
2768
- searchable: metadata.searchable ?? true,
2769
- sortable: metadata.sortable ?? true
2770
- };
2771
- }).filter((field) => field !== null);
2978
+ ] = useQueryParams();
2979
+ const { model, id, document, meta, collectionType } = useDoc();
2980
+ const plugins = useStrapiApp("ActionsPanel", (state) => state.plugins);
2981
+ const props = {
2982
+ activeTab: status,
2983
+ model,
2984
+ documentId: id,
2985
+ document: isCloning ? void 0 : document,
2986
+ meta: isCloning ? void 0 : meta,
2987
+ collectionType
2988
+ };
2989
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, width: "100%", children: [
2990
+ /* @__PURE__ */ jsx(
2991
+ DescriptionComponentRenderer,
2992
+ {
2993
+ props,
2994
+ descriptions: plugins["content-manager"].apis.getDocumentActions(),
2995
+ children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
2996
+ }
2997
+ ),
2998
+ /* @__PURE__ */ jsx(InjectionZone, { area: "editView.right-links", slug: model })
2999
+ ] });
2772
3000
  };
3001
+ const Panel = React.forwardRef(({ children, title }, ref) => {
3002
+ return /* @__PURE__ */ jsxs(
3003
+ Flex,
3004
+ {
3005
+ ref,
3006
+ tag: "aside",
3007
+ "aria-labelledby": "additional-information",
3008
+ background: "neutral0",
3009
+ borderColor: "neutral150",
3010
+ hasRadius: true,
3011
+ paddingBottom: 4,
3012
+ paddingLeft: 4,
3013
+ paddingRight: 4,
3014
+ paddingTop: 4,
3015
+ shadow: "tableShadow",
3016
+ gap: 3,
3017
+ direction: "column",
3018
+ justifyContent: "stretch",
3019
+ alignItems: "flex-start",
3020
+ children: [
3021
+ /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3022
+ children
3023
+ ]
3024
+ }
3025
+ );
3026
+ });
2773
3027
  const ConfirmBulkActionDialog = ({
2774
3028
  onToggleDialog,
2775
3029
  isOpen = false,
@@ -2777,7 +3031,7 @@ const ConfirmBulkActionDialog = ({
2777
3031
  endAction
2778
3032
  }) => {
2779
3033
  const { formatMessage } = useIntl();
2780
- return /* @__PURE__ */ jsx(Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
3034
+ return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
2781
3035
  /* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage({
2782
3036
  id: "app.components.ConfirmDialog.title",
2783
3037
  defaultMessage: "Confirmation"
@@ -2808,6 +3062,7 @@ const ConfirmDialogPublishAll = ({
2808
3062
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler(getTranslation);
2809
3063
  const { model, schema } = useDoc();
2810
3064
  const [{ query }] = useQueryParams();
3065
+ const enableDraftRelationsCount = false;
2811
3066
  const {
2812
3067
  data: countDraftRelations = 0,
2813
3068
  isLoading,
@@ -2819,7 +3074,7 @@ const ConfirmDialogPublishAll = ({
2819
3074
  locale: query?.plugins?.i18n?.locale
2820
3075
  },
2821
3076
  {
2822
- skip: selectedEntries.length === 0
3077
+ skip: !enableDraftRelationsCount
2823
3078
  }
2824
3079
  );
2825
3080
  React.useEffect(() => {
@@ -2898,7 +3153,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
2898
3153
  )
2899
3154
  );
2900
3155
  } else {
2901
- messages.push(...formatErrorMessages(value, currentKey, formatMessage));
3156
+ messages.push(
3157
+ ...formatErrorMessages(
3158
+ // @ts-expect-error TODO: check why value is not compatible with FormErrors
3159
+ value,
3160
+ currentKey,
3161
+ formatMessage
3162
+ )
3163
+ );
2902
3164
  }
2903
3165
  } else {
2904
3166
  messages.push(
@@ -2997,7 +3259,7 @@ const SelectedEntriesTableContent = ({
2997
3259
  status: row.status
2998
3260
  }
2999
3261
  ) }),
3000
- /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
3262
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
3001
3263
  IconButton,
3002
3264
  {
3003
3265
  tag: Link,
@@ -3020,9 +3282,10 @@ const SelectedEntriesTableContent = ({
3020
3282
  ),
3021
3283
  target: "_blank",
3022
3284
  marginLeft: "auto",
3023
- children: /* @__PURE__ */ jsx(Pencil, {})
3285
+ variant: "ghost",
3286
+ children: /* @__PURE__ */ jsx(Pencil, { width: "1.6rem", height: "1.6rem" })
3024
3287
  }
3025
- ) })
3288
+ ) }) })
3026
3289
  ] }, row.id)) })
3027
3290
  ] });
3028
3291
  };
@@ -3059,7 +3322,13 @@ const SelectedEntriesModalContent = ({
3059
3322
  );
3060
3323
  const { rows, validationErrors } = React.useMemo(() => {
3061
3324
  if (data.length > 0 && schema) {
3062
- const validate = createYupSchema(schema.attributes, components);
3325
+ const validate = createYupSchema(
3326
+ schema.attributes,
3327
+ components,
3328
+ // Since this is the "Publish" action, the validation
3329
+ // schema must enforce the rules for published entities
3330
+ { status: "published" }
3331
+ );
3063
3332
  const validationErrors2 = {};
3064
3333
  const rows2 = data.map((entry) => {
3065
3334
  try {
@@ -3409,7 +3678,7 @@ const TableActions = ({ document }) => {
3409
3678
  DescriptionComponentRenderer,
3410
3679
  {
3411
3680
  props,
3412
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3681
+ descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3413
3682
  children: (actions2) => {
3414
3683
  const tableRowActions = actions2.filter((action) => {
3415
3684
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3520,7 +3789,7 @@ const CloneAction = ({ model, documentId }) => {
3520
3789
  }),
3521
3790
  content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3522
3791
  footer: ({ onClose }) => {
3523
- return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
3792
+ return /* @__PURE__ */ jsxs(Modal.Footer, { children: [
3524
3793
  /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3525
3794
  id: "cancel",
3526
3795
  defaultMessage: "Cancel"
@@ -3561,8 +3830,7 @@ class ContentManagerPlugin {
3561
3830
  documentActions = [
3562
3831
  ...DEFAULT_ACTIONS,
3563
3832
  ...DEFAULT_TABLE_ROW_ACTIONS,
3564
- ...DEFAULT_HEADER_ACTIONS,
3565
- HistoryAction
3833
+ ...DEFAULT_HEADER_ACTIONS
3566
3834
  ];
3567
3835
  editViewSidePanels = [ActionsPanel];
3568
3836
  headerActions = [];
@@ -3651,6 +3919,52 @@ const getPrintableType = (value) => {
3651
3919
  }
3652
3920
  return nativeType;
3653
3921
  };
3922
+ const HistoryAction = ({ model, document }) => {
3923
+ const { formatMessage } = useIntl();
3924
+ const [{ query }] = useQueryParams();
3925
+ const navigate = useNavigate();
3926
+ const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
3927
+ if (!window.strapi.features.isEnabled("cms-content-history")) {
3928
+ return null;
3929
+ }
3930
+ return {
3931
+ icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
3932
+ label: formatMessage({
3933
+ id: "content-manager.history.document-action",
3934
+ defaultMessage: "Content History"
3935
+ }),
3936
+ onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
3937
+ disabled: (
3938
+ /**
3939
+ * The user is creating a new document.
3940
+ * It hasn't been saved yet, so there's no history to go to
3941
+ */
3942
+ !document || /**
3943
+ * The document has been created but the current dimension has never been saved.
3944
+ * For example, the user is creating a new locale in an existing document,
3945
+ * so there's no history for the document in that locale
3946
+ */
3947
+ !document.id || /**
3948
+ * History is only available for content types created by the user.
3949
+ * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
3950
+ * which start with `admin::` or `plugin::`
3951
+ */
3952
+ !model.startsWith("api::")
3953
+ ),
3954
+ position: "header"
3955
+ };
3956
+ };
3957
+ HistoryAction.type = "history";
3958
+ const historyAdmin = {
3959
+ bootstrap(app) {
3960
+ const { addDocumentAction } = app.getPlugin("content-manager").apis;
3961
+ addDocumentAction((actions2) => {
3962
+ const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
3963
+ actions2.splice(indexOfDeleteAction, 0, HistoryAction);
3964
+ return actions2;
3965
+ });
3966
+ }
3967
+ };
3654
3968
  const initialState = {
3655
3969
  collectionTypeLinks: [],
3656
3970
  components: [],
@@ -3687,6 +4001,15 @@ const { setInitialData } = actions;
3687
4001
  const reducer = combineReducers({
3688
4002
  app: reducer$1
3689
4003
  });
4004
+ const FEATURE_ID = "preview";
4005
+ const previewAdmin = {
4006
+ bootstrap(app) {
4007
+ if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4008
+ return {};
4009
+ }
4010
+ console.log("Bootstrapping preview admin");
4011
+ }
4012
+ };
3690
4013
  const index = {
3691
4014
  register(app) {
3692
4015
  const cm = new ContentManagerPlugin();
@@ -3706,7 +4029,7 @@ const index = {
3706
4029
  app.router.addRoute({
3707
4030
  path: "content-manager/*",
3708
4031
  lazy: async () => {
3709
- const { Layout } = await import("./layout-Bau7ZfLV.mjs");
4032
+ const { Layout } = await import("./layout-_5-cXs34.mjs");
3710
4033
  return {
3711
4034
  Component: Layout
3712
4035
  };
@@ -3715,10 +4038,18 @@ const index = {
3715
4038
  });
3716
4039
  app.registerPlugin(cm.config);
3717
4040
  },
4041
+ bootstrap(app) {
4042
+ if (typeof historyAdmin.bootstrap === "function") {
4043
+ historyAdmin.bootstrap(app);
4044
+ }
4045
+ if (typeof previewAdmin.bootstrap === "function") {
4046
+ previewAdmin.bootstrap(app);
4047
+ }
4048
+ },
3718
4049
  async registerTrads({ locales }) {
3719
4050
  const importedTrads = await Promise.all(
3720
4051
  locales.map((locale) => {
3721
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Ux26r5pl.mjs"), "./translations/es.json": () => import("./es-CeXiYflN.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-CD9VFbPM.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-CtsUxOvk.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
4052
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-DKV44jRb.mjs"), "./translations/es.json": () => import("./es-CeXiYflN.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-CD9VFbPM.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-CtsUxOvk.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
3722
4053
  return {
3723
4054
  data: prefixPluginTranslations(data, PLUGIN_ID),
3724
4055
  locale
@@ -3739,13 +4070,15 @@ export {
3739
4070
  BulkActionsRenderer as B,
3740
4071
  COLLECTION_TYPES as C,
3741
4072
  DocumentStatus as D,
3742
- DEFAULT_SETTINGS as E,
3743
- convertEditLayoutToFieldLayouts as F,
3744
- useDocument as G,
4073
+ extractContentTypeComponents as E,
4074
+ DEFAULT_SETTINGS as F,
4075
+ convertEditLayoutToFieldLayouts as G,
3745
4076
  HOOKS as H,
3746
4077
  InjectionZone as I,
3747
- index as J,
3748
- useDocumentActions as K,
4078
+ useDocument as J,
4079
+ index as K,
4080
+ useContentManagerContext as L,
4081
+ useDocumentActions as M,
3749
4082
  Panels as P,
3750
4083
  RelativeTime as R,
3751
4084
  SINGLE_TYPES as S,
@@ -3763,18 +4096,18 @@ export {
3763
4096
  PERMISSIONS as k,
3764
4097
  DocumentRBAC as l,
3765
4098
  DOCUMENT_META_FIELDS as m,
3766
- useDocLayout as n,
3767
- useGetContentTypeConfigurationQuery as o,
3768
- CREATOR_FIELDS as p,
3769
- getMainField as q,
3770
- getDisplayName as r,
4099
+ CLONE_PATH as n,
4100
+ useDocLayout as o,
4101
+ useGetContentTypeConfigurationQuery as p,
4102
+ CREATOR_FIELDS as q,
4103
+ getMainField as r,
3771
4104
  setInitialData as s,
3772
- checkIfAttributeIsDisplayable as t,
4105
+ getDisplayName as t,
3773
4106
  useContentTypeSchema as u,
3774
- useGetAllDocumentsQuery as v,
3775
- convertListLayoutToFieldLayouts as w,
3776
- capitalise as x,
3777
- useUpdateContentTypeConfigurationMutation as y,
3778
- extractContentTypeComponents as z
4107
+ checkIfAttributeIsDisplayable as v,
4108
+ useGetAllDocumentsQuery as w,
4109
+ convertListLayoutToFieldLayouts as x,
4110
+ capitalise as y,
4111
+ useUpdateContentTypeConfigurationMutation as z
3779
4112
  };
3780
- //# sourceMappingURL=index-DJXJw9V5.mjs.map
4113
+ //# sourceMappingURL=index-BrUzbQ30.mjs.map