@strapi/content-manager 0.0.0-experimental.59ce88771272039a9d868fba2f7b503edf715c6a → 0.0.0-experimental.5a6cf698f4104d2c95bb57a4c7beaca233d26e5a

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 (131) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs → ComponentConfigurationPage-DfFSZQxe.mjs} +3 -3
  3. package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs.map → ComponentConfigurationPage-DfFSZQxe.mjs.map} +1 -1
  4. package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-FqfsxQ1j.js} +3 -3
  5. package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-FqfsxQ1j.js.map} +1 -1
  6. package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-Cn0e8t3I.js} +3 -3
  7. package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-Cn0e8t3I.js.map} +1 -1
  8. package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs → EditConfigurationPage-DdPNAbl3.mjs} +3 -3
  9. package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-DdPNAbl3.mjs.map} +1 -1
  10. package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-B82x_x1b.mjs} +30 -9
  11. package/dist/_chunks/EditViewPage-B82x_x1b.mjs.map +1 -0
  12. package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-DlxEHhUt.js} +30 -9
  13. package/dist/_chunks/EditViewPage-DlxEHhUt.js.map +1 -0
  14. package/dist/_chunks/{Field-BG1xu38N.js → Field-COL25JiC.js} +519 -155
  15. package/dist/_chunks/Field-COL25JiC.js.map +1 -0
  16. package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-DufHXW17.mjs} +517 -153
  17. package/dist/_chunks/Field-DufHXW17.mjs.map +1 -0
  18. package/dist/_chunks/{Form-9BnFyUjy.js → Form-BssUwrTO.js} +40 -18
  19. package/dist/_chunks/Form-BssUwrTO.js.map +1 -0
  20. package/dist/_chunks/{Form-CPVWavB8.mjs → Form-u_kAOhwB.mjs} +40 -18
  21. package/dist/_chunks/Form-u_kAOhwB.mjs.map +1 -0
  22. package/dist/_chunks/{History-BWWxLt2Z.js → History-C9t9UqpO.js} +63 -25
  23. package/dist/_chunks/History-C9t9UqpO.js.map +1 -0
  24. package/dist/_chunks/{History-BVpd8LP3.mjs → History-DRwA3oMM.mjs} +64 -26
  25. package/dist/_chunks/History-DRwA3oMM.mjs.map +1 -0
  26. package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-BXYPohh-.js} +20 -8
  27. package/dist/_chunks/ListConfigurationPage-BXYPohh-.js.map +1 -0
  28. package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-BxfQJzPk.mjs} +20 -8
  29. package/dist/_chunks/ListConfigurationPage-BxfQJzPk.mjs.map +1 -0
  30. package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-CELx2ysp.mjs} +59 -41
  31. package/dist/_chunks/ListViewPage-CELx2ysp.mjs.map +1 -0
  32. package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-D2VD8Szg.js} +61 -43
  33. package/dist/_chunks/ListViewPage-D2VD8Szg.js.map +1 -0
  34. package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-BV9IjJSM.js} +2 -2
  35. package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-BV9IjJSM.js.map} +1 -1
  36. package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-DtJ9jcfk.mjs} +2 -2
  37. package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-DtJ9jcfk.mjs.map} +1 -1
  38. package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-DWleVYK7.mjs} +2 -2
  39. package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs.map → NoPermissionsPage-DWleVYK7.mjs.map} +1 -1
  40. package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-Dp8NpF9I.js} +2 -2
  41. package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-Dp8NpF9I.js.map} +1 -1
  42. package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-BTcf5xaw.mjs} +33 -24
  43. package/dist/_chunks/Relations-BTcf5xaw.mjs.map +1 -0
  44. package/dist/_chunks/{Relations-CcgFTcWo.js → Relations-DR7EUgyC.js} +33 -24
  45. package/dist/_chunks/Relations-DR7EUgyC.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-CWpLBSt0.js → index-BdMf2lfT.js} +989 -658
  51. package/dist/_chunks/index-BdMf2lfT.js.map +1 -0
  52. package/dist/_chunks/{index-JNNNKUHs.mjs → index-wnqzm4Q8.mjs} +997 -666
  53. package/dist/_chunks/index-wnqzm4Q8.mjs.map +1 -0
  54. package/dist/_chunks/{layout-DC503LnF.mjs → layout-2CfjL0T9.mjs} +27 -14
  55. package/dist/_chunks/layout-2CfjL0T9.mjs.map +1 -0
  56. package/dist/_chunks/{layout--iHdZzRk.js → layout-B2MyZU-_.js} +25 -12
  57. package/dist/_chunks/layout-B2MyZU-_.js.map +1 -0
  58. package/dist/_chunks/{relations-BbHizA5K.js → relations-BH7JJGGe.js} +2 -2
  59. package/dist/_chunks/{relations-BbHizA5K.js.map → relations-BH7JJGGe.js.map} +1 -1
  60. package/dist/_chunks/{relations-CTje5t-a.mjs → relations-C0w0GcXi.mjs} +2 -2
  61. package/dist/_chunks/{relations-CTje5t-a.mjs.map → relations-C0w0GcXi.mjs.map} +1 -1
  62. package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
  63. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
  64. package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
  65. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
  66. package/dist/admin/index.js +2 -1
  67. package/dist/admin/index.js.map +1 -1
  68. package/dist/admin/index.mjs +3 -2
  69. package/dist/admin/src/exports.d.ts +1 -1
  70. package/dist/admin/src/history/index.d.ts +3 -0
  71. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  72. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  73. package/dist/admin/src/index.d.ts +1 -0
  74. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -0
  75. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
  76. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  77. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  78. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  79. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  80. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  81. package/dist/admin/src/services/api.d.ts +1 -1
  82. package/dist/admin/src/services/components.d.ts +2 -2
  83. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  84. package/dist/admin/src/services/documents.d.ts +19 -17
  85. package/dist/admin/src/services/init.d.ts +1 -1
  86. package/dist/admin/src/services/relations.d.ts +2 -2
  87. package/dist/admin/src/services/uid.d.ts +3 -3
  88. package/dist/admin/src/utils/validation.d.ts +4 -1
  89. package/dist/server/index.js +208 -123
  90. package/dist/server/index.js.map +1 -1
  91. package/dist/server/index.mjs +209 -124
  92. package/dist/server/index.mjs.map +1 -1
  93. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  94. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  95. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  96. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  97. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  98. package/dist/server/src/history/services/history.d.ts.map +1 -1
  99. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  100. package/dist/server/src/history/services/utils.d.ts +2 -1
  101. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  102. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  103. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  104. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  105. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  106. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  107. package/dist/shared/contracts/collection-types.d.ts +3 -1
  108. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  109. package/package.json +12 -12
  110. package/dist/_chunks/EditViewPage-0MiFkXa8.mjs.map +0 -1
  111. package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
  112. package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
  113. package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
  114. package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
  115. package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
  116. package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
  117. package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
  118. package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
  119. package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
  120. package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
  121. package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
  122. package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
  123. package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
  124. package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
  125. package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
  126. package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
  127. package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
  128. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  129. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  130. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  131. package/strapi-server.js +0 -3
@@ -2,15 +2,15 @@
2
2
  const Icons = require("@strapi/icons");
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const strapiAdmin = require("@strapi/admin/strapi-admin");
5
- const qs = require("qs");
6
- const reactIntl = require("react-intl");
7
- const reactRouterDom = require("react-router-dom");
8
5
  const React = require("react");
9
6
  const designSystem = require("@strapi/design-system");
10
- const styledComponents = require("styled-components");
7
+ const reactIntl = require("react-intl");
8
+ const reactRouterDom = require("react-router-dom");
11
9
  const yup = require("yup");
12
10
  const pipe = require("lodash/fp/pipe");
13
11
  const dateFns = require("date-fns");
12
+ const styledComponents = require("styled-components");
13
+ const qs = require("qs");
14
14
  const toolkit = require("@reduxjs/toolkit");
15
15
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
16
  function _interopNamespace(e) {
@@ -70,42 +70,6 @@ const useInjectionZone = (area) => {
70
70
  const [page, position] = area.split(".");
71
71
  return contentManagerPlugin.getInjectedComponents(page, position);
72
72
  };
73
- const HistoryAction = ({ model, document }) => {
74
- const { formatMessage } = reactIntl.useIntl();
75
- const [{ query }] = strapiAdmin.useQueryParams();
76
- const navigate = reactRouterDom.useNavigate();
77
- const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
78
- if (!window.strapi.features.isEnabled("cms-content-history")) {
79
- return null;
80
- }
81
- return {
82
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
83
- label: formatMessage({
84
- id: "content-manager.history.document-action",
85
- defaultMessage: "Content History"
86
- }),
87
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
88
- disabled: (
89
- /**
90
- * The user is creating a new document.
91
- * It hasn't been saved yet, so there's no history to go to
92
- */
93
- !document || /**
94
- * The document has been created but the current dimension has never been saved.
95
- * For example, the user is creating a new locale in an existing document,
96
- * so there's no history for the document in that locale
97
- */
98
- !document.id || /**
99
- * History is only available for content types created by the user.
100
- * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
101
- * which start with `admin::` or `plugin::`
102
- */
103
- !model.startsWith("api::")
104
- ),
105
- position: "header"
106
- };
107
- };
108
- HistoryAction.type = "history";
109
73
  const ID = "id";
110
74
  const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
111
75
  const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
@@ -157,6 +121,7 @@ const DocumentRBAC = ({ children, permissions }) => {
157
121
  if (!slug) {
158
122
  throw new Error("Cannot find the slug param in the URL");
159
123
  }
124
+ const [{ rawQuery }] = strapiAdmin.useQueryParams();
160
125
  const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
161
126
  const contentTypePermissions = React__namespace.useMemo(() => {
162
127
  const contentTypePermissions2 = userPermissions.filter(
@@ -167,7 +132,14 @@ const DocumentRBAC = ({ children, permissions }) => {
167
132
  return { ...acc, [action]: [permission] };
168
133
  }, {});
169
134
  }, [slug, userPermissions]);
170
- const { isLoading, allowedActions } = strapiAdmin.useRBAC(contentTypePermissions, permissions ?? void 0);
135
+ const { isLoading, allowedActions } = strapiAdmin.useRBAC(
136
+ contentTypePermissions,
137
+ permissions ?? void 0,
138
+ // TODO: useRBAC context should be typed and built differently
139
+ // We are passing raw query as context to the hook so that it can
140
+ // rely on the locale provided from DocumentRBAC for its permission calculations.
141
+ rawQuery
142
+ );
171
143
  const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
172
144
  const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
173
145
  const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
@@ -215,10 +187,12 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
215
187
  "Document",
216
188
  "InitialData",
217
189
  "HistoryVersion",
218
- "Relations"
190
+ "Relations",
191
+ "UidAvailability"
219
192
  ]
220
193
  });
221
194
  const documentApi = contentManagerApi.injectEndpoints({
195
+ overrideExisting: true,
222
196
  endpoints: (builder) => ({
223
197
  autoCloneDocument: builder.mutation({
224
198
  query: ({ model, sourceId, query }) => ({
@@ -228,7 +202,12 @@ const documentApi = contentManagerApi.injectEndpoints({
228
202
  params: query
229
203
  }
230
204
  }),
231
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
205
+ invalidatesTags: (_result, error, { model }) => {
206
+ if (error) {
207
+ return [];
208
+ }
209
+ return [{ type: "Document", id: `${model}_LIST` }];
210
+ }
232
211
  }),
233
212
  cloneDocument: builder.mutation({
234
213
  query: ({ model, sourceId, data, params }) => ({
@@ -239,7 +218,10 @@ const documentApi = contentManagerApi.injectEndpoints({
239
218
  params
240
219
  }
241
220
  }),
242
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
221
+ invalidatesTags: (_result, _error, { model }) => [
222
+ { type: "Document", id: `${model}_LIST` },
223
+ { type: "UidAvailability", id: model }
224
+ ]
243
225
  }),
244
226
  /**
245
227
  * Creates a new collection-type document. This should ONLY be used for collection-types.
@@ -256,7 +238,8 @@ const documentApi = contentManagerApi.injectEndpoints({
256
238
  }),
257
239
  invalidatesTags: (result, _error, { model }) => [
258
240
  { type: "Document", id: `${model}_LIST` },
259
- "Relations"
241
+ "Relations",
242
+ { type: "UidAvailability", id: model }
260
243
  ]
261
244
  }),
262
245
  deleteDocument: builder.mutation({
@@ -297,7 +280,8 @@ const documentApi = contentManagerApi.injectEndpoints({
297
280
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
298
281
  },
299
282
  { type: "Document", id: `${model}_LIST` },
300
- "Relations"
283
+ "Relations",
284
+ { type: "UidAvailability", id: model }
301
285
  ];
302
286
  }
303
287
  }),
@@ -315,6 +299,7 @@ const documentApi = contentManagerApi.injectEndpoints({
315
299
  }),
316
300
  providesTags: (result, _error, arg) => {
317
301
  return [
302
+ { type: "Document", id: `ALL_LIST` },
318
303
  { type: "Document", id: `${arg.model}_LIST` },
319
304
  ...result?.results.map(({ documentId }) => ({
320
305
  type: "Document",
@@ -353,6 +338,11 @@ const documentApi = contentManagerApi.injectEndpoints({
353
338
  {
354
339
  type: "Document",
355
340
  id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
341
+ },
342
+ // Make it easy to invalidate all individual documents queries for a model
343
+ {
344
+ type: "Document",
345
+ id: `${model}_ALL_ITEMS`
356
346
  }
357
347
  ];
358
348
  }
@@ -416,8 +406,21 @@ const documentApi = contentManagerApi.injectEndpoints({
416
406
  type: "Document",
417
407
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
418
408
  },
419
- "Relations"
409
+ "Relations",
410
+ { type: "UidAvailability", id: model }
420
411
  ];
412
+ },
413
+ async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
414
+ const patchResult = dispatch(
415
+ documentApi.util.updateQueryData("getDocument", patch, (draft) => {
416
+ Object.assign(draft.data, data);
417
+ })
418
+ );
419
+ try {
420
+ await queryFulfilled;
421
+ } catch {
422
+ patchResult.undo();
423
+ }
421
424
  }
422
425
  }),
423
426
  unpublishDocument: builder.mutation({
@@ -487,20 +490,39 @@ const buildValidParams = (query) => {
487
490
  const isBaseQueryError = (error) => {
488
491
  return error.name !== void 0;
489
492
  };
490
- const createYupSchema = (attributes = {}, components = {}) => {
493
+ const arrayValidator = (attribute, options) => ({
494
+ message: strapiAdmin.translatedErrors.required,
495
+ test(value) {
496
+ if (options.status === "draft") {
497
+ return true;
498
+ }
499
+ if (!attribute.required) {
500
+ return true;
501
+ }
502
+ if (!value) {
503
+ return false;
504
+ }
505
+ if (Array.isArray(value) && value.length === 0) {
506
+ return false;
507
+ }
508
+ return true;
509
+ }
510
+ });
511
+ const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
491
512
  const createModelSchema = (attributes2) => yup__namespace.object().shape(
492
513
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
493
514
  if (DOCUMENT_META_FIELDS.includes(name)) {
494
515
  return acc;
495
516
  }
496
517
  const validations = [
518
+ addNullableValidation,
497
519
  addRequiredValidation,
498
520
  addMinLengthValidation,
499
521
  addMaxLengthValidation,
500
522
  addMinValidation,
501
523
  addMaxValidation,
502
524
  addRegexValidation
503
- ].map((fn) => fn(attribute));
525
+ ].map((fn) => fn(attribute, options));
504
526
  const transformSchema = pipe__default.default(...validations);
505
527
  switch (attribute.type) {
506
528
  case "component": {
@@ -510,12 +532,12 @@ const createYupSchema = (attributes = {}, components = {}) => {
510
532
  ...acc,
511
533
  [name]: transformSchema(
512
534
  yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
513
- )
535
+ ).test(arrayValidator(attribute, options))
514
536
  };
515
537
  } else {
516
538
  return {
517
539
  ...acc,
518
- [name]: transformSchema(createModelSchema(attributes3))
540
+ [name]: transformSchema(createModelSchema(attributes3).nullable())
519
541
  };
520
542
  }
521
543
  }
@@ -537,7 +559,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
537
559
  }
538
560
  )
539
561
  )
540
- )
562
+ ).test(arrayValidator(attribute, options))
541
563
  };
542
564
  case "relation":
543
565
  return {
@@ -549,7 +571,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
549
571
  } else if (Array.isArray(value)) {
550
572
  return yup__namespace.array().of(
551
573
  yup__namespace.object().shape({
552
- id: yup__namespace.string().required()
574
+ id: yup__namespace.number().required()
553
575
  })
554
576
  );
555
577
  } else if (typeof value === "object") {
@@ -601,6 +623,14 @@ const createAttributeSchema = (attribute) => {
601
623
  if (!value || typeof value === "string" && value.length === 0) {
602
624
  return true;
603
625
  }
626
+ if (typeof value === "object") {
627
+ try {
628
+ JSON.stringify(value);
629
+ return true;
630
+ } catch (err) {
631
+ return false;
632
+ }
633
+ }
604
634
  try {
605
635
  JSON.parse(value);
606
636
  return true;
@@ -619,13 +649,7 @@ const createAttributeSchema = (attribute) => {
619
649
  return yup__namespace.mixed();
620
650
  }
621
651
  };
622
- const addRequiredValidation = (attribute) => (schema) => {
623
- if (attribute.required) {
624
- return schema.required({
625
- id: strapiAdmin.translatedErrors.required.id,
626
- defaultMessage: "This field is required."
627
- });
628
- }
652
+ const nullableSchema = (schema) => {
629
653
  return schema?.nullable ? schema.nullable() : (
630
654
  // In some cases '.nullable' will not be available on the schema.
631
655
  // e.g. when the schema has been built using yup.lazy (e.g. for relations).
@@ -633,7 +657,22 @@ const addRequiredValidation = (attribute) => (schema) => {
633
657
  schema
634
658
  );
635
659
  };
636
- const addMinLengthValidation = (attribute) => (schema) => {
660
+ const addNullableValidation = () => (schema) => {
661
+ return nullableSchema(schema);
662
+ };
663
+ const addRequiredValidation = (attribute, options) => (schema) => {
664
+ if (options.status === "draft" || !attribute.required) {
665
+ return schema;
666
+ }
667
+ if (attribute.required && "required" in schema) {
668
+ return schema.required(strapiAdmin.translatedErrors.required);
669
+ }
670
+ return schema;
671
+ };
672
+ const addMinLengthValidation = (attribute, options) => (schema) => {
673
+ if (options.status === "draft") {
674
+ return schema;
675
+ }
637
676
  if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
638
677
  return schema.min(attribute.minLength, {
639
678
  ...strapiAdmin.translatedErrors.minLength,
@@ -655,10 +694,13 @@ const addMaxLengthValidation = (attribute) => (schema) => {
655
694
  }
656
695
  return schema;
657
696
  };
658
- const addMinValidation = (attribute) => (schema) => {
659
- if ("min" in attribute) {
697
+ const addMinValidation = (attribute, options) => (schema) => {
698
+ if (options.status === "draft") {
699
+ return schema;
700
+ }
701
+ if ("min" in attribute && "min" in schema) {
660
702
  const min = toInteger(attribute.min);
661
- if ("min" in schema && min) {
703
+ if (min) {
662
704
  return schema.min(min, {
663
705
  ...strapiAdmin.translatedErrors.min,
664
706
  values: {
@@ -776,16 +818,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
776
818
  }, {});
777
819
  return componentsByKey;
778
820
  };
779
- const useDocument = (args, opts) => {
821
+ const HOOKS = {
822
+ /**
823
+ * Hook that allows to mutate the displayed headers of the list view table
824
+ * @constant
825
+ * @type {string}
826
+ */
827
+ INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
828
+ /**
829
+ * Hook that allows to mutate the CM's collection types links pre-set filters
830
+ * @constant
831
+ * @type {string}
832
+ */
833
+ MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
834
+ /**
835
+ * Hook that allows to mutate the CM's edit view layout
836
+ * @constant
837
+ * @type {string}
838
+ */
839
+ MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
840
+ /**
841
+ * Hook that allows to mutate the CM's single types links pre-set filters
842
+ * @constant
843
+ * @type {string}
844
+ */
845
+ MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
846
+ };
847
+ const contentTypesApi = contentManagerApi.injectEndpoints({
848
+ endpoints: (builder) => ({
849
+ getContentTypeConfiguration: builder.query({
850
+ query: (uid) => ({
851
+ url: `/content-manager/content-types/${uid}/configuration`,
852
+ method: "GET"
853
+ }),
854
+ transformResponse: (response) => response.data,
855
+ providesTags: (_result, _error, uid) => [
856
+ { type: "ContentTypesConfiguration", id: uid },
857
+ { type: "ContentTypeSettings", id: "LIST" }
858
+ ]
859
+ }),
860
+ getAllContentTypeSettings: builder.query({
861
+ query: () => "/content-manager/content-types-settings",
862
+ transformResponse: (response) => response.data,
863
+ providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
864
+ }),
865
+ updateContentTypeConfiguration: builder.mutation({
866
+ query: ({ uid, ...body }) => ({
867
+ url: `/content-manager/content-types/${uid}/configuration`,
868
+ method: "PUT",
869
+ data: body
870
+ }),
871
+ transformResponse: (response) => response.data,
872
+ invalidatesTags: (_result, _error, { uid }) => [
873
+ { type: "ContentTypesConfiguration", id: uid },
874
+ { type: "ContentTypeSettings", id: "LIST" },
875
+ // Is this necessary?
876
+ { type: "InitialData" }
877
+ ]
878
+ })
879
+ })
880
+ });
881
+ const {
882
+ useGetContentTypeConfigurationQuery,
883
+ useGetAllContentTypeSettingsQuery,
884
+ useUpdateContentTypeConfigurationMutation
885
+ } = contentTypesApi;
886
+ const checkIfAttributeIsDisplayable = (attribute) => {
887
+ const { type } = attribute;
888
+ if (type === "relation") {
889
+ return !attribute.relation.toLowerCase().includes("morph");
890
+ }
891
+ return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
892
+ };
893
+ const getMainField = (attribute, mainFieldName, { schemas, components }) => {
894
+ if (!mainFieldName) {
895
+ return void 0;
896
+ }
897
+ const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
898
+ // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
899
+ schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
900
+ );
901
+ return {
902
+ name: mainFieldName,
903
+ type: mainFieldType ?? "string"
904
+ };
905
+ };
906
+ const DEFAULT_SETTINGS = {
907
+ bulkable: false,
908
+ filterable: false,
909
+ searchable: false,
910
+ pagination: false,
911
+ defaultSortBy: "",
912
+ defaultSortOrder: "asc",
913
+ mainField: "id",
914
+ pageSize: 10
915
+ };
916
+ const useDocumentLayout = (model) => {
917
+ const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
918
+ const [{ query }] = strapiAdmin.useQueryParams();
919
+ const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
780
920
  const { toggleNotification } = strapiAdmin.useNotification();
781
921
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
922
+ const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
782
923
  const {
783
- currentData: data,
784
- isLoading: isLoadingDocument,
785
- isFetching: isFetchingDocument,
786
- error
787
- } = useGetDocumentQuery(args, opts);
788
- const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
924
+ data,
925
+ isLoading: isLoadingConfigs,
926
+ error,
927
+ isFetching: isFetchingConfigs
928
+ } = useGetContentTypeConfigurationQuery(model);
929
+ const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
789
930
  React__namespace.useEffect(() => {
790
931
  if (error) {
791
932
  toggleNotification({
@@ -793,62 +934,318 @@ const useDocument = (args, opts) => {
793
934
  message: formatAPIError(error)
794
935
  });
795
936
  }
796
- }, [toggleNotification, error, formatAPIError, args.collectionType]);
797
- const validationSchema = React__namespace.useMemo(() => {
798
- if (!schema) {
799
- return null;
800
- }
801
- return createYupSchema(schema.attributes, components);
802
- }, [schema, components]);
803
- const validate = React__namespace.useCallback(
804
- (document) => {
805
- if (!validationSchema) {
806
- throw new Error(
807
- "There is no validation schema generated, this is likely due to the schema not being loaded yet."
808
- );
809
- }
810
- try {
811
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
812
- return null;
813
- } catch (error2) {
814
- if (error2 instanceof yup.ValidationError) {
815
- return strapiAdmin.getYupValidationErrors(error2);
816
- }
817
- throw error2;
818
- }
937
+ }, [error, formatAPIError, toggleNotification]);
938
+ const editLayout = React__namespace.useMemo(
939
+ () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
940
+ layout: [],
941
+ components: {},
942
+ metadatas: {},
943
+ options: {},
944
+ settings: DEFAULT_SETTINGS
819
945
  },
820
- [validationSchema]
946
+ [data, isLoading, schemas, schema, components]
947
+ );
948
+ const listLayout = React__namespace.useMemo(() => {
949
+ return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
950
+ layout: [],
951
+ metadatas: {},
952
+ options: {},
953
+ settings: DEFAULT_SETTINGS
954
+ };
955
+ }, [data, isLoading, schemas, schema, components]);
956
+ const { layout: edit } = React__namespace.useMemo(
957
+ () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
958
+ layout: editLayout,
959
+ query
960
+ }),
961
+ [editLayout, query, runHookWaterfall]
821
962
  );
822
- const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
823
963
  return {
824
- components,
825
- document: data?.data,
826
- meta: data?.meta,
964
+ error,
827
965
  isLoading,
828
- schema,
829
- validate
966
+ edit,
967
+ list: listLayout
830
968
  };
831
969
  };
832
- const useDoc = () => {
833
- const { id, slug, collectionType, origin } = reactRouterDom.useParams();
834
- const [{ query }] = strapiAdmin.useQueryParams();
835
- const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
836
- if (!collectionType) {
837
- throw new Error("Could not find collectionType in url params");
838
- }
839
- if (!slug) {
970
+ const useDocLayout = () => {
971
+ const { model } = useDoc();
972
+ return useDocumentLayout(model);
973
+ };
974
+ const formatEditLayout = (data, {
975
+ schemas,
976
+ schema,
977
+ components
978
+ }) => {
979
+ let currentPanelIndex = 0;
980
+ const panelledEditAttributes = convertEditLayoutToFieldLayouts(
981
+ data.contentType.layouts.edit,
982
+ schema?.attributes,
983
+ data.contentType.metadatas,
984
+ { configurations: data.components, schemas: components },
985
+ schemas
986
+ ).reduce((panels, row) => {
987
+ if (row.some((field) => field.type === "dynamiczone")) {
988
+ panels.push([row]);
989
+ currentPanelIndex += 2;
990
+ } else {
991
+ if (!panels[currentPanelIndex]) {
992
+ panels.push([]);
993
+ }
994
+ panels[currentPanelIndex].push(row);
995
+ }
996
+ return panels;
997
+ }, []);
998
+ const componentEditAttributes = Object.entries(data.components).reduce(
999
+ (acc, [uid, configuration]) => {
1000
+ acc[uid] = {
1001
+ layout: convertEditLayoutToFieldLayouts(
1002
+ configuration.layouts.edit,
1003
+ components[uid].attributes,
1004
+ configuration.metadatas,
1005
+ { configurations: data.components, schemas: components }
1006
+ ),
1007
+ settings: {
1008
+ ...configuration.settings,
1009
+ icon: components[uid].info.icon,
1010
+ displayName: components[uid].info.displayName
1011
+ }
1012
+ };
1013
+ return acc;
1014
+ },
1015
+ {}
1016
+ );
1017
+ const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
1018
+ (acc, [attribute, metadata]) => {
1019
+ return {
1020
+ ...acc,
1021
+ [attribute]: metadata.edit
1022
+ };
1023
+ },
1024
+ {}
1025
+ );
1026
+ return {
1027
+ layout: panelledEditAttributes,
1028
+ components: componentEditAttributes,
1029
+ metadatas: editMetadatas,
1030
+ settings: {
1031
+ ...data.contentType.settings,
1032
+ displayName: schema?.info.displayName
1033
+ },
1034
+ options: {
1035
+ ...schema?.options,
1036
+ ...schema?.pluginOptions,
1037
+ ...data.contentType.options
1038
+ }
1039
+ };
1040
+ };
1041
+ const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
1042
+ return rows.map(
1043
+ (row) => row.map((field) => {
1044
+ const attribute = attributes[field.name];
1045
+ if (!attribute) {
1046
+ return null;
1047
+ }
1048
+ const { edit: metadata } = metadatas[field.name];
1049
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1050
+ return {
1051
+ attribute,
1052
+ disabled: !metadata.editable,
1053
+ hint: metadata.description,
1054
+ label: metadata.label ?? "",
1055
+ name: field.name,
1056
+ // @ts-expect-error – mainField does exist on the metadata for a relation.
1057
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1058
+ schemas,
1059
+ components: components?.schemas ?? {}
1060
+ }),
1061
+ placeholder: metadata.placeholder ?? "",
1062
+ required: attribute.required ?? false,
1063
+ size: field.size,
1064
+ unique: "unique" in attribute ? attribute.unique : false,
1065
+ visible: metadata.visible ?? true,
1066
+ type: attribute.type
1067
+ };
1068
+ }).filter((field) => field !== null)
1069
+ );
1070
+ };
1071
+ const formatListLayout = (data, {
1072
+ schemas,
1073
+ schema,
1074
+ components
1075
+ }) => {
1076
+ const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
1077
+ (acc, [attribute, metadata]) => {
1078
+ return {
1079
+ ...acc,
1080
+ [attribute]: metadata.list
1081
+ };
1082
+ },
1083
+ {}
1084
+ );
1085
+ const listAttributes = convertListLayoutToFieldLayouts(
1086
+ data.contentType.layouts.list,
1087
+ schema?.attributes,
1088
+ listMetadatas,
1089
+ { configurations: data.components, schemas: components },
1090
+ schemas
1091
+ );
1092
+ return {
1093
+ layout: listAttributes,
1094
+ settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
1095
+ metadatas: listMetadatas,
1096
+ options: {
1097
+ ...schema?.options,
1098
+ ...schema?.pluginOptions,
1099
+ ...data.contentType.options
1100
+ }
1101
+ };
1102
+ };
1103
+ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
1104
+ return columns.map((name) => {
1105
+ const attribute = attributes[name];
1106
+ if (!attribute) {
1107
+ return null;
1108
+ }
1109
+ const metadata = metadatas[name];
1110
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1111
+ return {
1112
+ attribute,
1113
+ label: metadata.label ?? "",
1114
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1115
+ schemas,
1116
+ components: components?.schemas ?? {}
1117
+ }),
1118
+ name,
1119
+ searchable: metadata.searchable ?? true,
1120
+ sortable: metadata.sortable ?? true
1121
+ };
1122
+ }).filter((field) => field !== null);
1123
+ };
1124
+ const useDocument = (args, opts) => {
1125
+ const { toggleNotification } = strapiAdmin.useNotification();
1126
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
1127
+ const {
1128
+ currentData: data,
1129
+ isLoading: isLoadingDocument,
1130
+ isFetching: isFetchingDocument,
1131
+ error
1132
+ } = useGetDocumentQuery(args, {
1133
+ ...opts,
1134
+ skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1135
+ });
1136
+ const {
1137
+ components,
1138
+ schema,
1139
+ schemas,
1140
+ isLoading: isLoadingSchema
1141
+ } = useContentTypeSchema(args.model);
1142
+ React__namespace.useEffect(() => {
1143
+ if (error) {
1144
+ toggleNotification({
1145
+ type: "danger",
1146
+ message: formatAPIError(error)
1147
+ });
1148
+ }
1149
+ }, [toggleNotification, error, formatAPIError, args.collectionType]);
1150
+ const validationSchema = React__namespace.useMemo(() => {
1151
+ if (!schema) {
1152
+ return null;
1153
+ }
1154
+ return createYupSchema(schema.attributes, components);
1155
+ }, [schema, components]);
1156
+ const validate = React__namespace.useCallback(
1157
+ (document) => {
1158
+ if (!validationSchema) {
1159
+ throw new Error(
1160
+ "There is no validation schema generated, this is likely due to the schema not being loaded yet."
1161
+ );
1162
+ }
1163
+ try {
1164
+ validationSchema.validateSync(document, { abortEarly: false, strict: true });
1165
+ return null;
1166
+ } catch (error2) {
1167
+ if (error2 instanceof yup.ValidationError) {
1168
+ return strapiAdmin.getYupValidationErrors(error2);
1169
+ }
1170
+ throw error2;
1171
+ }
1172
+ },
1173
+ [validationSchema]
1174
+ );
1175
+ const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1176
+ const hasError = !!error;
1177
+ return {
1178
+ components,
1179
+ document: data?.data,
1180
+ meta: data?.meta,
1181
+ isLoading,
1182
+ hasError,
1183
+ schema,
1184
+ schemas,
1185
+ validate
1186
+ };
1187
+ };
1188
+ const useDoc = () => {
1189
+ const { id, slug, collectionType, origin } = reactRouterDom.useParams();
1190
+ const [{ query }] = strapiAdmin.useQueryParams();
1191
+ const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
1192
+ if (!collectionType) {
1193
+ throw new Error("Could not find collectionType in url params");
1194
+ }
1195
+ if (!slug) {
840
1196
  throw new Error("Could not find model in url params");
841
1197
  }
1198
+ const document = useDocument(
1199
+ { documentId: origin || id, model: slug, collectionType, params },
1200
+ {
1201
+ skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1202
+ }
1203
+ );
1204
+ const returnId = origin || id === "create" ? void 0 : id;
842
1205
  return {
843
1206
  collectionType,
844
1207
  model: slug,
845
- id: origin || id === "create" ? void 0 : id,
846
- ...useDocument(
847
- { documentId: origin || id, model: slug, collectionType, params },
848
- {
849
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
850
- }
851
- )
1208
+ id: returnId,
1209
+ ...document
1210
+ };
1211
+ };
1212
+ const useContentManagerContext = () => {
1213
+ const {
1214
+ collectionType,
1215
+ model,
1216
+ id,
1217
+ components,
1218
+ isLoading: isLoadingDoc,
1219
+ schema,
1220
+ schemas
1221
+ } = useDoc();
1222
+ const layout = useDocumentLayout(model);
1223
+ const form = strapiAdmin.useForm("useContentManagerContext", (state) => state);
1224
+ const isSingleType = collectionType === SINGLE_TYPES;
1225
+ const slug = model;
1226
+ const isCreatingEntry = id === "create";
1227
+ useContentTypeSchema();
1228
+ const isLoading = isLoadingDoc || layout.isLoading;
1229
+ const error = layout.error;
1230
+ return {
1231
+ error,
1232
+ isLoading,
1233
+ // Base metadata
1234
+ model,
1235
+ collectionType,
1236
+ id,
1237
+ slug,
1238
+ isCreatingEntry,
1239
+ isSingleType,
1240
+ hasDraftAndPublish: schema?.options?.draftAndPublish ?? false,
1241
+ // All schema infos
1242
+ components,
1243
+ contentType: schema,
1244
+ contentTypes: schemas,
1245
+ // Form state
1246
+ form,
1247
+ // layout infos
1248
+ layout
852
1249
  };
853
1250
  };
854
1251
  const prefixPluginTranslations = (trad, pluginId) => {
@@ -870,6 +1267,8 @@ const useDocumentActions = () => {
870
1267
  const { formatMessage } = reactIntl.useIntl();
871
1268
  const { trackUsage } = strapiAdmin.useTracking();
872
1269
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
1270
+ const navigate = reactRouterDom.useNavigate();
1271
+ const setCurrentStep = strapiAdmin.useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
873
1272
  const [deleteDocument] = useDeleteDocumentMutation();
874
1273
  const _delete = React__namespace.useCallback(
875
1274
  async ({ collectionType, model, documentId, params }, trackerProperty) => {
@@ -1184,6 +1583,7 @@ const useDocumentActions = () => {
1184
1583
  defaultMessage: "Saved document"
1185
1584
  })
1186
1585
  });
1586
+ setCurrentStep("contentManager.success");
1187
1587
  return res.data;
1188
1588
  } catch (err) {
1189
1589
  toggleNotification({
@@ -1205,7 +1605,6 @@ const useDocumentActions = () => {
1205
1605
  sourceId
1206
1606
  });
1207
1607
  if ("error" in res) {
1208
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1209
1608
  return { error: res.error };
1210
1609
  }
1211
1610
  toggleNotification({
@@ -1224,7 +1623,7 @@ const useDocumentActions = () => {
1224
1623
  throw err;
1225
1624
  }
1226
1625
  },
1227
- [autoCloneDocument, formatAPIError, formatMessage, toggleNotification]
1626
+ [autoCloneDocument, formatMessage, toggleNotification]
1228
1627
  );
1229
1628
  const [cloneDocument] = useCloneDocumentMutation();
1230
1629
  const clone = React__namespace.useCallback(
@@ -1250,6 +1649,7 @@ const useDocumentActions = () => {
1250
1649
  defaultMessage: "Cloned document"
1251
1650
  })
1252
1651
  });
1652
+ navigate(`../../${res.data.data.documentId}`, { relative: "path" });
1253
1653
  return res.data;
1254
1654
  } catch (err) {
1255
1655
  toggleNotification({
@@ -1260,7 +1660,7 @@ const useDocumentActions = () => {
1260
1660
  throw err;
1261
1661
  }
1262
1662
  },
1263
- [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
1663
+ [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
1264
1664
  );
1265
1665
  const [getDoc] = useLazyGetDocumentQuery();
1266
1666
  const getDocument = React__namespace.useCallback(
@@ -1286,7 +1686,7 @@ const useDocumentActions = () => {
1286
1686
  };
1287
1687
  };
1288
1688
  const ProtectedHistoryPage = React.lazy(
1289
- () => Promise.resolve().then(() => require("./History-BWWxLt2Z.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1689
+ () => Promise.resolve().then(() => require("./History-C9t9UqpO.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1290
1690
  );
1291
1691
  const routes$1 = [
1292
1692
  {
@@ -1299,31 +1699,31 @@ const routes$1 = [
1299
1699
  }
1300
1700
  ];
1301
1701
  const ProtectedEditViewPage = React.lazy(
1302
- () => Promise.resolve().then(() => require("./EditViewPage-DbcGfyqK.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1702
+ () => Promise.resolve().then(() => require("./EditViewPage-DlxEHhUt.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1303
1703
  );
1304
1704
  const ProtectedListViewPage = React.lazy(
1305
- () => Promise.resolve().then(() => require("./ListViewPage-BlzfjS2Q.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1705
+ () => Promise.resolve().then(() => require("./ListViewPage-D2VD8Szg.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1306
1706
  );
1307
1707
  const ProtectedListConfiguration = React.lazy(
1308
- () => Promise.resolve().then(() => require("./ListConfigurationPage-6swzjdAZ.js")).then((mod) => ({
1708
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-BXYPohh-.js")).then((mod) => ({
1309
1709
  default: mod.ProtectedListConfiguration
1310
1710
  }))
1311
1711
  );
1312
1712
  const ProtectedEditConfigurationPage = React.lazy(
1313
- () => Promise.resolve().then(() => require("./EditConfigurationPage-C1vjMBgy.js")).then((mod) => ({
1713
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-Cn0e8t3I.js")).then((mod) => ({
1314
1714
  default: mod.ProtectedEditConfigurationPage
1315
1715
  }))
1316
1716
  );
1317
1717
  const ProtectedComponentConfigurationPage = React.lazy(
1318
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-WRPUXGd6.js")).then((mod) => ({
1718
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-FqfsxQ1j.js")).then((mod) => ({
1319
1719
  default: mod.ProtectedComponentConfigurationPage
1320
1720
  }))
1321
1721
  );
1322
1722
  const NoPermissions = React.lazy(
1323
- () => Promise.resolve().then(() => require("./NoPermissionsPage-DN_JlsU2.js")).then((mod) => ({ default: mod.NoPermissions }))
1723
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-Dp8NpF9I.js")).then((mod) => ({ default: mod.NoPermissions }))
1324
1724
  );
1325
1725
  const NoContentType = React.lazy(
1326
- () => Promise.resolve().then(() => require("./NoContentTypePage-D2nCCWEl.js")).then((mod) => ({ default: mod.NoContentType }))
1726
+ () => Promise.resolve().then(() => require("./NoContentTypePage-BV9IjJSM.js")).then((mod) => ({ default: mod.NoContentType }))
1327
1727
  );
1328
1728
  const CollectionTypePages = () => {
1329
1729
  const { collectionType } = reactRouterDom.useParams();
@@ -1437,12 +1837,14 @@ const DocumentActionButton = (action) => {
1437
1837
  /* @__PURE__ */ jsxRuntime.jsx(
1438
1838
  designSystem.Button,
1439
1839
  {
1440
- flex: 1,
1840
+ flex: "auto",
1441
1841
  startIcon: action.icon,
1442
1842
  disabled: action.disabled,
1443
1843
  onClick: handleClick(action),
1444
1844
  justifyContent: "center",
1445
1845
  variant: action.variant || "default",
1846
+ paddingTop: "7px",
1847
+ paddingBottom: "7px",
1446
1848
  children: action.label
1447
1849
  }
1448
1850
  ),
@@ -1450,7 +1852,7 @@ const DocumentActionButton = (action) => {
1450
1852
  DocumentActionConfirmDialog,
1451
1853
  {
1452
1854
  ...action.dialog,
1453
- variant: action.variant,
1855
+ variant: action.dialog?.variant ?? action.variant,
1454
1856
  isOpen: dialogId === action.id,
1455
1857
  onClose: handleClose
1456
1858
  }
@@ -1507,9 +1909,9 @@ const DocumentActionsMenu = ({
1507
1909
  disabled: isDisabled,
1508
1910
  size: "S",
1509
1911
  endIcon: null,
1510
- paddingTop: "7px",
1511
- paddingLeft: "9px",
1512
- paddingRight: "9px",
1912
+ paddingTop: "4px",
1913
+ paddingLeft: "7px",
1914
+ paddingRight: "7px",
1513
1915
  variant,
1514
1916
  children: [
1515
1917
  /* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
@@ -1520,7 +1922,7 @@ const DocumentActionsMenu = ({
1520
1922
  ]
1521
1923
  }
1522
1924
  ),
1523
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: "4px", maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1925
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1524
1926
  actions2.map((action) => {
1525
1927
  return /* @__PURE__ */ jsxRuntime.jsx(
1526
1928
  designSystem.Menu.Item,
@@ -1529,10 +1931,25 @@ const DocumentActionsMenu = ({
1529
1931
  onSelect: handleClick(action),
1530
1932
  display: "block",
1531
1933
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
1532
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1533
- action.icon,
1534
- action.label
1535
- ] }),
1934
+ /* @__PURE__ */ jsxRuntime.jsxs(
1935
+ designSystem.Flex,
1936
+ {
1937
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1938
+ gap: 2,
1939
+ tag: "span",
1940
+ children: [
1941
+ /* @__PURE__ */ jsxRuntime.jsx(
1942
+ designSystem.Flex,
1943
+ {
1944
+ tag: "span",
1945
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1946
+ children: action.icon
1947
+ }
1948
+ ),
1949
+ action.label
1950
+ ]
1951
+ }
1952
+ ),
1536
1953
  action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
1537
1954
  designSystem.Flex,
1538
1955
  {
@@ -1591,6 +2008,18 @@ const convertActionVariantToColor = (variant = "secondary") => {
1591
2008
  return "primary600";
1592
2009
  }
1593
2010
  };
2011
+ const convertActionVariantToIconColor = (variant = "secondary") => {
2012
+ switch (variant) {
2013
+ case "danger":
2014
+ return "danger600";
2015
+ case "secondary":
2016
+ return "neutral500";
2017
+ case "success":
2018
+ return "success600";
2019
+ default:
2020
+ return "primary600";
2021
+ }
2022
+ };
1594
2023
  const DocumentActionConfirmDialog = ({
1595
2024
  onClose,
1596
2025
  onCancel,
@@ -1617,11 +2046,11 @@ const DocumentActionConfirmDialog = ({
1617
2046
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
1618
2047
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
1619
2048
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
1620
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
2049
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
1621
2050
  id: "app.components.Button.cancel",
1622
2051
  defaultMessage: "Cancel"
1623
2052
  }) }) }),
1624
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
2053
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
1625
2054
  id: "app.components.Button.confirm",
1626
2055
  defaultMessage: "Confirm"
1627
2056
  }) })
@@ -1660,13 +2089,17 @@ const PublishAction$1 = ({
1660
2089
  const navigate = reactRouterDom.useNavigate();
1661
2090
  const { toggleNotification } = strapiAdmin.useNotification();
1662
2091
  const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
2092
+ const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
1663
2093
  const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
1664
2094
  const { formatMessage } = reactIntl.useIntl();
1665
- const { canPublish, canCreate, canUpdate } = useDocumentRBAC(
1666
- "PublishAction",
1667
- ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1668
- );
2095
+ const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
1669
2096
  const { publish } = useDocumentActions();
2097
+ const [
2098
+ countDraftRelations,
2099
+ { isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
2100
+ ] = useLazyGetDraftRelationCountQuery();
2101
+ const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
2102
+ const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
1670
2103
  const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
1671
2104
  const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
1672
2105
  const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
@@ -1675,10 +2108,105 @@ const PublishAction$1 = ({
1675
2108
  const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
1676
2109
  const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
1677
2110
  const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
1678
- const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1679
- if (!schema?.options?.draftAndPublish) {
2111
+ React__namespace.useEffect(() => {
2112
+ if (isErrorDraftRelations) {
2113
+ toggleNotification({
2114
+ type: "danger",
2115
+ message: formatMessage({
2116
+ id: getTranslation("error.records.fetch-draft-relatons"),
2117
+ defaultMessage: "An error occurred while fetching draft relations on this document."
2118
+ })
2119
+ });
2120
+ }
2121
+ }, [isErrorDraftRelations, toggleNotification, formatMessage]);
2122
+ React__namespace.useEffect(() => {
2123
+ const localDraftRelations = /* @__PURE__ */ new Set();
2124
+ const extractDraftRelations = (data) => {
2125
+ const relations = data.connect || [];
2126
+ relations.forEach((relation) => {
2127
+ if (relation.status === "draft") {
2128
+ localDraftRelations.add(relation.id);
2129
+ }
2130
+ });
2131
+ };
2132
+ const traverseAndExtract = (data) => {
2133
+ Object.entries(data).forEach(([key, value]) => {
2134
+ if (key === "connect" && Array.isArray(value)) {
2135
+ extractDraftRelations({ connect: value });
2136
+ } else if (typeof value === "object" && value !== null) {
2137
+ traverseAndExtract(value);
2138
+ }
2139
+ });
2140
+ };
2141
+ if (!documentId || modified) {
2142
+ traverseAndExtract(formValues);
2143
+ setLocalCountOfDraftRelations(localDraftRelations.size);
2144
+ }
2145
+ }, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
2146
+ React__namespace.useEffect(() => {
2147
+ if (!document || !document.documentId || isListView) {
2148
+ return;
2149
+ }
2150
+ const fetchDraftRelationsCount = async () => {
2151
+ const { data, error } = await countDraftRelations({
2152
+ collectionType,
2153
+ model,
2154
+ documentId,
2155
+ params
2156
+ });
2157
+ if (error) {
2158
+ throw error;
2159
+ }
2160
+ if (data) {
2161
+ setServerCountOfDraftRelations(data.data);
2162
+ }
2163
+ };
2164
+ fetchDraftRelationsCount();
2165
+ }, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
2166
+ const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
2167
+ if (!schema?.options?.draftAndPublish) {
1680
2168
  return null;
1681
2169
  }
2170
+ const performPublish = async () => {
2171
+ setSubmitting(true);
2172
+ try {
2173
+ const { errors } = await validate(true, {
2174
+ status: "published"
2175
+ });
2176
+ if (errors) {
2177
+ toggleNotification({
2178
+ type: "danger",
2179
+ message: formatMessage({
2180
+ id: "content-manager.validation.error",
2181
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2182
+ })
2183
+ });
2184
+ return;
2185
+ }
2186
+ const res = await publish(
2187
+ {
2188
+ collectionType,
2189
+ model,
2190
+ documentId,
2191
+ params
2192
+ },
2193
+ formValues
2194
+ );
2195
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2196
+ navigate({
2197
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2198
+ search: rawQuery
2199
+ });
2200
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2201
+ setErrors(formatValidationErrors(res.error));
2202
+ }
2203
+ } finally {
2204
+ setSubmitting(false);
2205
+ }
2206
+ };
2207
+ const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
2208
+ const enableDraftRelationsCount = false;
2209
+ const hasDraftRelations = enableDraftRelationsCount;
1682
2210
  return {
1683
2211
  /**
1684
2212
  * Disabled when:
@@ -1688,49 +2216,36 @@ const PublishAction$1 = ({
1688
2216
  * - the document is already published & not modified
1689
2217
  * - the document is being created & not modified
1690
2218
  * - the user doesn't have the permission to publish
1691
- * - the user doesn't have the permission to create a new document
1692
- * - the user doesn't have the permission to update the document
1693
2219
  */
1694
- disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
2220
+ disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
1695
2221
  label: formatMessage({
1696
2222
  id: "app.utils.publish",
1697
2223
  defaultMessage: "Publish"
1698
2224
  }),
1699
2225
  onClick: async () => {
1700
- setSubmitting(true);
1701
- try {
1702
- const { errors } = await validate();
1703
- if (errors) {
1704
- toggleNotification({
1705
- type: "danger",
1706
- message: formatMessage({
1707
- id: "content-manager.validation.error",
1708
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1709
- })
1710
- });
1711
- return;
1712
- }
1713
- const res = await publish(
1714
- {
1715
- collectionType,
1716
- model,
1717
- documentId,
1718
- params
1719
- },
1720
- formValues
1721
- );
1722
- if ("data" in res && collectionType !== SINGLE_TYPES) {
1723
- navigate({
1724
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1725
- search: rawQuery
1726
- });
1727
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1728
- setErrors(formatValidationErrors(res.error));
2226
+ await performPublish();
2227
+ },
2228
+ dialog: hasDraftRelations ? {
2229
+ type: "dialog",
2230
+ variant: "danger",
2231
+ footer: null,
2232
+ title: formatMessage({
2233
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
2234
+ defaultMessage: "Confirmation"
2235
+ }),
2236
+ content: formatMessage(
2237
+ {
2238
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
2239
+ defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
2240
+ },
2241
+ {
2242
+ count: totalDraftRelations
1729
2243
  }
1730
- } finally {
1731
- setSubmitting(false);
2244
+ ),
2245
+ onConfirm: async () => {
2246
+ await performPublish();
1732
2247
  }
1733
- }
2248
+ } : void 0
1734
2249
  };
1735
2250
  };
1736
2251
  PublishAction$1.type = "publish";
@@ -1746,10 +2261,6 @@ const UpdateAction = ({
1746
2261
  const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
1747
2262
  const isCloning = cloneMatch !== null;
1748
2263
  const { formatMessage } = reactIntl.useIntl();
1749
- const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1750
- canCreate: canCreate2,
1751
- canUpdate: canUpdate2
1752
- }));
1753
2264
  const { create, update, clone } = useDocumentActions();
1754
2265
  const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
1755
2266
  const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
@@ -1766,10 +2277,8 @@ const UpdateAction = ({
1766
2277
  * - the form is submitting
1767
2278
  * - the document is not modified & we're not cloning (you can save a clone entity straight away)
1768
2279
  * - the active tab is the published tab
1769
- * - the user doesn't have the permission to create a new document
1770
- * - the user doesn't have the permission to update the document
1771
2280
  */
1772
- disabled: isSubmitting || !modified && !isCloning || activeTab === "published" || Boolean(!documentId && !canCreate || documentId && !canUpdate),
2281
+ disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
1773
2282
  label: formatMessage({
1774
2283
  id: "content-manager.containers.Edit.save",
1775
2284
  defaultMessage: "Save"
@@ -1777,7 +2286,9 @@ const UpdateAction = ({
1777
2286
  onClick: async () => {
1778
2287
  setSubmitting(true);
1779
2288
  try {
1780
- const { errors } = await validate();
2289
+ const { errors } = await validate(true, {
2290
+ status: "draft"
2291
+ });
1781
2292
  if (errors) {
1782
2293
  toggleNotification({
1783
2294
  type: "danger",
@@ -1798,10 +2309,13 @@ const UpdateAction = ({
1798
2309
  document
1799
2310
  );
1800
2311
  if ("data" in res) {
1801
- navigate({
1802
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1803
- search: rawQuery
1804
- });
2312
+ navigate(
2313
+ {
2314
+ pathname: `../${res.data.documentId}`,
2315
+ search: rawQuery
2316
+ },
2317
+ { relative: "path" }
2318
+ );
1805
2319
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1806
2320
  setErrors(formatValidationErrors(res.error));
1807
2321
  }
@@ -1829,10 +2343,13 @@ const UpdateAction = ({
1829
2343
  document
1830
2344
  );
1831
2345
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1832
- navigate({
1833
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1834
- search: rawQuery
1835
- });
2346
+ navigate(
2347
+ {
2348
+ pathname: `../${res.data.documentId}`,
2349
+ search: rawQuery
2350
+ },
2351
+ { replace: true, relative: "path" }
2352
+ );
1836
2353
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1837
2354
  setErrors(formatValidationErrors(res.error));
1838
2355
  }
@@ -1876,7 +2393,7 @@ const UnpublishAction$1 = ({
1876
2393
  id: "app.utils.unpublish",
1877
2394
  defaultMessage: "Unpublish"
1878
2395
  }),
1879
- icon: /* @__PURE__ */ jsxRuntime.jsx(StyledCrossCircle, {}),
2396
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
1880
2397
  onClick: async () => {
1881
2398
  if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
1882
2399
  if (!documentId) {
@@ -1988,7 +2505,7 @@ const DiscardAction = ({
1988
2505
  id: "content-manager.actions.discard.label",
1989
2506
  defaultMessage: "Discard changes"
1990
2507
  }),
1991
- icon: /* @__PURE__ */ jsxRuntime.jsx(StyledCrossCircle, {}),
2508
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
1992
2509
  position: ["panel", "table-row"],
1993
2510
  variant: "danger",
1994
2511
  dialog: {
@@ -2016,11 +2533,6 @@ const DiscardAction = ({
2016
2533
  };
2017
2534
  };
2018
2535
  DiscardAction.type = "discard";
2019
- const StyledCrossCircle = styledComponents.styled(Icons.CrossCircle)`
2020
- path {
2021
- fill: currentColor;
2022
- }
2023
- `;
2024
2536
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2025
2537
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2026
2538
  const RelativeTime = React__namespace.forwardRef(
@@ -2068,7 +2580,7 @@ const getDisplayName = ({
2068
2580
  };
2069
2581
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2070
2582
  const DocumentStatus = ({ status = "draft", ...restProps }) => {
2071
- const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
2583
+ const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2072
2584
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2073
2585
  };
2074
2586
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
@@ -2078,23 +2590,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2078
2590
  id: "content-manager.containers.edit.title.new",
2079
2591
  defaultMessage: "Create an entry"
2080
2592
  }) : documentTitle;
2081
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 8, paddingBottom: 4, gap: 3, children: [
2593
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2082
2594
  /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
2083
- /* @__PURE__ */ jsxRuntime.jsxs(
2084
- designSystem.Flex,
2085
- {
2086
- width: "100%",
2087
- justifyContent: "space-between",
2088
- paddingTop: 1,
2089
- gap: "80px",
2090
- alignItems: "flex-start",
2091
- children: [
2092
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
2093
- /* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
2094
- ]
2095
- }
2096
- ),
2097
- status ? /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
2595
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2596
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
2597
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
2598
+ ] }),
2599
+ status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
2098
2600
  ] });
2099
2601
  };
2100
2602
  const HeaderToolbar = () => {
@@ -2177,12 +2679,12 @@ const Information = ({ activeTab }) => {
2177
2679
  isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2178
2680
  label: formatMessage({
2179
2681
  id: "content-manager.containers.edit.information.last-published.label",
2180
- defaultMessage: "Last published"
2682
+ defaultMessage: "Published"
2181
2683
  }),
2182
2684
  value: formatMessage(
2183
2685
  {
2184
2686
  id: "content-manager.containers.edit.information.last-published.value",
2185
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2687
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2186
2688
  },
2187
2689
  {
2188
2690
  time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
@@ -2195,12 +2697,12 @@ const Information = ({ activeTab }) => {
2195
2697
  isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2196
2698
  label: formatMessage({
2197
2699
  id: "content-manager.containers.edit.information.last-draft.label",
2198
- defaultMessage: "Last draft"
2700
+ defaultMessage: "Updated"
2199
2701
  }),
2200
2702
  value: formatMessage(
2201
2703
  {
2202
2704
  id: "content-manager.containers.edit.information.last-draft.value",
2203
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2705
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2204
2706
  },
2205
2707
  {
2206
2708
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2218,12 +2720,12 @@ const Information = ({ activeTab }) => {
2218
2720
  isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2219
2721
  label: formatMessage({
2220
2722
  id: "content-manager.containers.edit.information.document.label",
2221
- defaultMessage: "Document"
2723
+ defaultMessage: "Created"
2222
2724
  }),
2223
2725
  value: formatMessage(
2224
2726
  {
2225
2727
  id: "content-manager.containers.edit.information.document.value",
2226
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2728
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2227
2729
  },
2228
2730
  {
2229
2731
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2261,25 +2763,77 @@ const Information = ({ activeTab }) => {
2261
2763
  );
2262
2764
  };
2263
2765
  const HeaderActions = ({ actions: actions2 }) => {
2264
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: actions2.map((action) => {
2265
- if ("options" in action) {
2766
+ const [dialogId, setDialogId] = React__namespace.useState(null);
2767
+ const handleClick = (action) => async (e) => {
2768
+ if (!("options" in action)) {
2769
+ const { onClick = () => false, dialog, id } = action;
2770
+ const muteDialog = await onClick(e);
2771
+ if (dialog && !muteDialog) {
2772
+ e.preventDefault();
2773
+ setDialogId(id);
2774
+ }
2775
+ }
2776
+ };
2777
+ const handleClose = () => {
2778
+ setDialogId(null);
2779
+ };
2780
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, children: actions2.map((action) => {
2781
+ if (action.options) {
2266
2782
  return /* @__PURE__ */ jsxRuntime.jsx(
2267
2783
  designSystem.SingleSelect,
2268
2784
  {
2269
2785
  size: "S",
2270
- disabled: action.disabled,
2271
- "aria-label": action.label,
2272
2786
  onChange: action.onSelect,
2273
- value: action.value,
2787
+ "aria-label": action.label,
2788
+ ...action,
2274
2789
  children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
2275
2790
  },
2276
2791
  action.id
2277
2792
  );
2278
2793
  } else {
2279
- return null;
2794
+ if (action.type === "icon") {
2795
+ return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
2796
+ /* @__PURE__ */ jsxRuntime.jsx(
2797
+ designSystem.IconButton,
2798
+ {
2799
+ disabled: action.disabled,
2800
+ label: action.label,
2801
+ size: "S",
2802
+ onClick: handleClick(action),
2803
+ children: action.icon
2804
+ }
2805
+ ),
2806
+ action.dialog ? /* @__PURE__ */ jsxRuntime.jsx(
2807
+ HeaderActionDialog,
2808
+ {
2809
+ ...action.dialog,
2810
+ isOpen: dialogId === action.id,
2811
+ onClose: handleClose
2812
+ }
2813
+ ) : null
2814
+ ] }, action.id);
2815
+ }
2280
2816
  }
2281
2817
  }) });
2282
2818
  };
2819
+ const HeaderActionDialog = ({
2820
+ onClose,
2821
+ onCancel,
2822
+ title,
2823
+ content: Content,
2824
+ isOpen
2825
+ }) => {
2826
+ const handleClose = async () => {
2827
+ if (onCancel) {
2828
+ await onCancel();
2829
+ }
2830
+ onClose();
2831
+ };
2832
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2833
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
2834
+ typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
2835
+ ] }) });
2836
+ };
2283
2837
  const ConfigureTheViewAction = ({ collectionType, model }) => {
2284
2838
  const navigate = reactRouterDom.useNavigate();
2285
2839
  const { formatMessage } = reactIntl.useIntl();
@@ -2320,12 +2874,16 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2320
2874
  const { delete: deleteAction } = useDocumentActions();
2321
2875
  const { toggleNotification } = strapiAdmin.useNotification();
2322
2876
  const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
2877
+ const isLocalized = document?.locale != null;
2323
2878
  return {
2324
2879
  disabled: !canDelete || !document,
2325
- label: formatMessage({
2326
- id: "content-manager.actions.delete.label",
2327
- defaultMessage: "Delete document"
2328
- }),
2880
+ label: formatMessage(
2881
+ {
2882
+ id: "content-manager.actions.delete.label",
2883
+ defaultMessage: "Delete entry{isLocalized, select, true { (all locales)} other {}}"
2884
+ },
2885
+ { isLocalized }
2886
+ ),
2329
2887
  icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
2330
2888
  dialog: {
2331
2889
  type: "dialog",
@@ -2361,423 +2919,121 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2361
2919
  const res = await deleteAction({
2362
2920
  documentId,
2363
2921
  model,
2364
- collectionType,
2365
- params: {
2366
- locale: "*"
2367
- }
2368
- });
2369
- if (!("error" in res)) {
2370
- navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2371
- }
2372
- } finally {
2373
- if (!listViewPathMatch) {
2374
- setSubmitting(false);
2375
- }
2376
- }
2377
- }
2378
- },
2379
- variant: "danger",
2380
- position: ["header", "table-row"]
2381
- };
2382
- };
2383
- DeleteAction$1.type = "delete";
2384
- const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2385
- const Panels = () => {
2386
- const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2387
- const [
2388
- {
2389
- query: { status }
2390
- }
2391
- ] = strapiAdmin.useQueryParams({
2392
- status: "draft"
2393
- });
2394
- const { model, id, document, meta, collectionType } = useDoc();
2395
- const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
2396
- const props = {
2397
- activeTab: status,
2398
- model,
2399
- documentId: id,
2400
- document: isCloning ? void 0 : document,
2401
- meta: isCloning ? void 0 : meta,
2402
- collectionType
2403
- };
2404
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2405
- strapiAdmin.DescriptionComponentRenderer,
2406
- {
2407
- props,
2408
- descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2409
- children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
2410
- }
2411
- ) });
2412
- };
2413
- const ActionsPanel = () => {
2414
- const { formatMessage } = reactIntl.useIntl();
2415
- return {
2416
- title: formatMessage({
2417
- id: "content-manager.containers.edit.panels.default.title",
2418
- defaultMessage: "Document"
2419
- }),
2420
- content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
2421
- };
2422
- };
2423
- ActionsPanel.type = "actions";
2424
- const ActionsPanelContent = () => {
2425
- const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2426
- const [
2427
- {
2428
- query: { status = "draft" }
2429
- }
2430
- ] = strapiAdmin.useQueryParams();
2431
- const { model, id, document, meta, collectionType } = useDoc();
2432
- const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
2433
- const props = {
2434
- activeTab: status,
2435
- model,
2436
- documentId: id,
2437
- document: isCloning ? void 0 : document,
2438
- meta: isCloning ? void 0 : meta,
2439
- collectionType
2440
- };
2441
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
2442
- /* @__PURE__ */ jsxRuntime.jsx(
2443
- strapiAdmin.DescriptionComponentRenderer,
2444
- {
2445
- props,
2446
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2447
- children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
2448
- }
2449
- ),
2450
- /* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
2451
- ] });
2452
- };
2453
- const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
2454
- return /* @__PURE__ */ jsxRuntime.jsxs(
2455
- designSystem.Flex,
2456
- {
2457
- ref,
2458
- tag: "aside",
2459
- "aria-labelledby": "additional-information",
2460
- background: "neutral0",
2461
- borderColor: "neutral150",
2462
- hasRadius: true,
2463
- paddingBottom: 4,
2464
- paddingLeft: 4,
2465
- paddingRight: 4,
2466
- paddingTop: 4,
2467
- shadow: "tableShadow",
2468
- gap: 3,
2469
- direction: "column",
2470
- justifyContent: "stretch",
2471
- alignItems: "flex-start",
2472
- children: [
2473
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2474
- children
2475
- ]
2476
- }
2477
- );
2478
- });
2479
- const HOOKS = {
2480
- /**
2481
- * Hook that allows to mutate the displayed headers of the list view table
2482
- * @constant
2483
- * @type {string}
2484
- */
2485
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2486
- /**
2487
- * Hook that allows to mutate the CM's collection types links pre-set filters
2488
- * @constant
2489
- * @type {string}
2490
- */
2491
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2492
- /**
2493
- * Hook that allows to mutate the CM's edit view layout
2494
- * @constant
2495
- * @type {string}
2496
- */
2497
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2498
- /**
2499
- * Hook that allows to mutate the CM's single types links pre-set filters
2500
- * @constant
2501
- * @type {string}
2502
- */
2503
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2504
- };
2505
- const contentTypesApi = contentManagerApi.injectEndpoints({
2506
- endpoints: (builder) => ({
2507
- getContentTypeConfiguration: builder.query({
2508
- query: (uid) => ({
2509
- url: `/content-manager/content-types/${uid}/configuration`,
2510
- method: "GET"
2511
- }),
2512
- transformResponse: (response) => response.data,
2513
- providesTags: (_result, _error, uid) => [
2514
- { type: "ContentTypesConfiguration", id: uid },
2515
- { type: "ContentTypeSettings", id: "LIST" }
2516
- ]
2517
- }),
2518
- getAllContentTypeSettings: builder.query({
2519
- query: () => "/content-manager/content-types-settings",
2520
- transformResponse: (response) => response.data,
2521
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2522
- }),
2523
- updateContentTypeConfiguration: builder.mutation({
2524
- query: ({ uid, ...body }) => ({
2525
- url: `/content-manager/content-types/${uid}/configuration`,
2526
- method: "PUT",
2527
- data: body
2528
- }),
2529
- transformResponse: (response) => response.data,
2530
- invalidatesTags: (_result, _error, { uid }) => [
2531
- { type: "ContentTypesConfiguration", id: uid },
2532
- { type: "ContentTypeSettings", id: "LIST" },
2533
- // Is this necessary?
2534
- { type: "InitialData" }
2535
- ]
2536
- })
2537
- })
2538
- });
2539
- const {
2540
- useGetContentTypeConfigurationQuery,
2541
- useGetAllContentTypeSettingsQuery,
2542
- useUpdateContentTypeConfigurationMutation
2543
- } = contentTypesApi;
2544
- const checkIfAttributeIsDisplayable = (attribute) => {
2545
- const { type } = attribute;
2546
- if (type === "relation") {
2547
- return !attribute.relation.toLowerCase().includes("morph");
2548
- }
2549
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2550
- };
2551
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2552
- if (!mainFieldName) {
2553
- return void 0;
2554
- }
2555
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2556
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2557
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2558
- );
2559
- return {
2560
- name: mainFieldName,
2561
- type: mainFieldType ?? "string"
2562
- };
2563
- };
2564
- const DEFAULT_SETTINGS = {
2565
- bulkable: false,
2566
- filterable: false,
2567
- searchable: false,
2568
- pagination: false,
2569
- defaultSortBy: "",
2570
- defaultSortOrder: "asc",
2571
- mainField: "id",
2572
- pageSize: 10
2573
- };
2574
- const useDocumentLayout = (model) => {
2575
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2576
- const [{ query }] = strapiAdmin.useQueryParams();
2577
- const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2578
- const { toggleNotification } = strapiAdmin.useNotification();
2579
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
2580
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2581
- const {
2582
- data,
2583
- isLoading: isLoadingConfigs,
2584
- error,
2585
- isFetching: isFetchingConfigs
2586
- } = useGetContentTypeConfigurationQuery(model);
2587
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2588
- React__namespace.useEffect(() => {
2589
- if (error) {
2590
- toggleNotification({
2591
- type: "danger",
2592
- message: formatAPIError(error)
2593
- });
2594
- }
2595
- }, [error, formatAPIError, toggleNotification]);
2596
- const editLayout = React__namespace.useMemo(
2597
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2598
- layout: [],
2599
- components: {},
2600
- metadatas: {},
2601
- options: {},
2602
- settings: DEFAULT_SETTINGS
2603
- },
2604
- [data, isLoading, schemas, schema, components]
2605
- );
2606
- const listLayout = React__namespace.useMemo(() => {
2607
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2608
- layout: [],
2609
- metadatas: {},
2610
- options: {},
2611
- settings: DEFAULT_SETTINGS
2612
- };
2613
- }, [data, isLoading, schemas, schema, components]);
2614
- const { layout: edit } = React__namespace.useMemo(
2615
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2616
- layout: editLayout,
2617
- query
2618
- }),
2619
- [editLayout, query, runHookWaterfall]
2620
- );
2621
- return {
2622
- error,
2623
- isLoading,
2624
- edit,
2625
- list: listLayout
2626
- };
2627
- };
2628
- const useDocLayout = () => {
2629
- const { model } = useDoc();
2630
- return useDocumentLayout(model);
2631
- };
2632
- const formatEditLayout = (data, {
2633
- schemas,
2634
- schema,
2635
- components
2636
- }) => {
2637
- let currentPanelIndex = 0;
2638
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2639
- data.contentType.layouts.edit,
2640
- schema?.attributes,
2641
- data.contentType.metadatas,
2642
- { configurations: data.components, schemas: components },
2643
- schemas
2644
- ).reduce((panels, row) => {
2645
- if (row.some((field) => field.type === "dynamiczone")) {
2646
- panels.push([row]);
2647
- currentPanelIndex += 2;
2648
- } else {
2649
- if (!panels[currentPanelIndex]) {
2650
- panels.push([]);
2651
- }
2652
- panels[currentPanelIndex].push(row);
2653
- }
2654
- return panels;
2655
- }, []);
2656
- const componentEditAttributes = Object.entries(data.components).reduce(
2657
- (acc, [uid, configuration]) => {
2658
- acc[uid] = {
2659
- layout: convertEditLayoutToFieldLayouts(
2660
- configuration.layouts.edit,
2661
- components[uid].attributes,
2662
- configuration.metadatas
2663
- ),
2664
- settings: {
2665
- ...configuration.settings,
2666
- icon: components[uid].info.icon,
2667
- displayName: components[uid].info.displayName
2922
+ collectionType,
2923
+ params: {
2924
+ locale: "*"
2925
+ }
2926
+ });
2927
+ if (!("error" in res)) {
2928
+ navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2929
+ }
2930
+ } finally {
2931
+ if (!listViewPathMatch) {
2932
+ setSubmitting(false);
2933
+ }
2668
2934
  }
2669
- };
2670
- return acc;
2671
- },
2672
- {}
2673
- );
2674
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2675
- (acc, [attribute, metadata]) => {
2676
- return {
2677
- ...acc,
2678
- [attribute]: metadata.edit
2679
- };
2680
- },
2681
- {}
2682
- );
2683
- return {
2684
- layout: panelledEditAttributes,
2685
- components: componentEditAttributes,
2686
- metadatas: editMetadatas,
2687
- settings: {
2688
- ...data.contentType.settings,
2689
- displayName: schema?.info.displayName
2935
+ }
2690
2936
  },
2691
- options: {
2692
- ...schema?.options,
2693
- ...schema?.pluginOptions,
2694
- ...data.contentType.options
2695
- }
2937
+ variant: "danger",
2938
+ position: ["header", "table-row"]
2696
2939
  };
2697
2940
  };
2698
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2699
- return rows.map(
2700
- (row) => row.map((field) => {
2701
- const attribute = attributes[field.name];
2702
- if (!attribute) {
2703
- return null;
2704
- }
2705
- const { edit: metadata } = metadatas[field.name];
2706
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2707
- return {
2708
- attribute,
2709
- disabled: !metadata.editable,
2710
- hint: metadata.description,
2711
- label: metadata.label ?? "",
2712
- name: field.name,
2713
- // @ts-expect-error – mainField does exist on the metadata for a relation.
2714
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2715
- schemas,
2716
- components: components?.schemas ?? {}
2717
- }),
2718
- placeholder: metadata.placeholder ?? "",
2719
- required: attribute.required ?? false,
2720
- size: field.size,
2721
- unique: "unique" in attribute ? attribute.unique : false,
2722
- visible: metadata.visible ?? true,
2723
- type: attribute.type
2724
- };
2725
- }).filter((field) => field !== null)
2726
- );
2941
+ DeleteAction$1.type = "delete";
2942
+ const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2943
+ const Panels = () => {
2944
+ const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2945
+ const [
2946
+ {
2947
+ query: { status }
2948
+ }
2949
+ ] = strapiAdmin.useQueryParams({
2950
+ status: "draft"
2951
+ });
2952
+ const { model, id, document, meta, collectionType } = useDoc();
2953
+ const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
2954
+ const props = {
2955
+ activeTab: status,
2956
+ model,
2957
+ documentId: id,
2958
+ document: isCloning ? void 0 : document,
2959
+ meta: isCloning ? void 0 : meta,
2960
+ collectionType
2961
+ };
2962
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2963
+ strapiAdmin.DescriptionComponentRenderer,
2964
+ {
2965
+ props,
2966
+ descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2967
+ children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
2968
+ }
2969
+ ) });
2727
2970
  };
2728
- const formatListLayout = (data, {
2729
- schemas,
2730
- schema,
2731
- components
2732
- }) => {
2733
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2734
- (acc, [attribute, metadata]) => {
2735
- return {
2736
- ...acc,
2737
- [attribute]: metadata.list
2738
- };
2739
- },
2740
- {}
2741
- );
2742
- const listAttributes = convertListLayoutToFieldLayouts(
2743
- data.contentType.layouts.list,
2744
- schema?.attributes,
2745
- listMetadatas,
2746
- { configurations: data.components, schemas: components },
2747
- schemas
2748
- );
2971
+ const ActionsPanel = () => {
2972
+ const { formatMessage } = reactIntl.useIntl();
2749
2973
  return {
2750
- layout: listAttributes,
2751
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2752
- metadatas: listMetadatas,
2753
- options: {
2754
- ...schema?.options,
2755
- ...schema?.pluginOptions,
2756
- ...data.contentType.options
2757
- }
2974
+ title: formatMessage({
2975
+ id: "content-manager.containers.edit.panels.default.title",
2976
+ defaultMessage: "Entry"
2977
+ }),
2978
+ content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
2758
2979
  };
2759
2980
  };
2760
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2761
- return columns.map((name) => {
2762
- const attribute = attributes[name];
2763
- if (!attribute) {
2764
- return null;
2981
+ ActionsPanel.type = "actions";
2982
+ const ActionsPanelContent = () => {
2983
+ const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2984
+ const [
2985
+ {
2986
+ query: { status = "draft" }
2765
2987
  }
2766
- const metadata = metadatas[name];
2767
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2768
- return {
2769
- attribute,
2770
- label: metadata.label ?? "",
2771
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2772
- schemas,
2773
- components: components?.schemas ?? {}
2774
- }),
2775
- name,
2776
- searchable: metadata.searchable ?? true,
2777
- sortable: metadata.sortable ?? true
2778
- };
2779
- }).filter((field) => field !== null);
2988
+ ] = strapiAdmin.useQueryParams();
2989
+ const { model, id, document, meta, collectionType } = useDoc();
2990
+ const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
2991
+ const props = {
2992
+ activeTab: status,
2993
+ model,
2994
+ documentId: id,
2995
+ document: isCloning ? void 0 : document,
2996
+ meta: isCloning ? void 0 : meta,
2997
+ collectionType
2998
+ };
2999
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
3000
+ /* @__PURE__ */ jsxRuntime.jsx(
3001
+ strapiAdmin.DescriptionComponentRenderer,
3002
+ {
3003
+ props,
3004
+ descriptions: plugins["content-manager"].apis.getDocumentActions(),
3005
+ children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
3006
+ }
3007
+ ),
3008
+ /* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
3009
+ ] });
2780
3010
  };
3011
+ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
3012
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3013
+ designSystem.Flex,
3014
+ {
3015
+ ref,
3016
+ tag: "aside",
3017
+ "aria-labelledby": "additional-information",
3018
+ background: "neutral0",
3019
+ borderColor: "neutral150",
3020
+ hasRadius: true,
3021
+ paddingBottom: 4,
3022
+ paddingLeft: 4,
3023
+ paddingRight: 4,
3024
+ paddingTop: 4,
3025
+ shadow: "tableShadow",
3026
+ gap: 3,
3027
+ direction: "column",
3028
+ justifyContent: "stretch",
3029
+ alignItems: "flex-start",
3030
+ children: [
3031
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
3032
+ children
3033
+ ]
3034
+ }
3035
+ );
3036
+ });
2781
3037
  const ConfirmBulkActionDialog = ({
2782
3038
  onToggleDialog,
2783
3039
  isOpen = false,
@@ -2785,7 +3041,7 @@ const ConfirmBulkActionDialog = ({
2785
3041
  endAction
2786
3042
  }) => {
2787
3043
  const { formatMessage } = reactIntl.useIntl();
2788
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
3044
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2789
3045
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
2790
3046
  id: "app.components.ConfirmDialog.title",
2791
3047
  defaultMessage: "Confirmation"
@@ -2816,6 +3072,7 @@ const ConfirmDialogPublishAll = ({
2816
3072
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler(getTranslation);
2817
3073
  const { model, schema } = useDoc();
2818
3074
  const [{ query }] = strapiAdmin.useQueryParams();
3075
+ const enableDraftRelationsCount = false;
2819
3076
  const {
2820
3077
  data: countDraftRelations = 0,
2821
3078
  isLoading,
@@ -2827,7 +3084,7 @@ const ConfirmDialogPublishAll = ({
2827
3084
  locale: query?.plugins?.i18n?.locale
2828
3085
  },
2829
3086
  {
2830
- skip: selectedEntries.length === 0
3087
+ skip: !enableDraftRelationsCount
2831
3088
  }
2832
3089
  );
2833
3090
  React__namespace.useEffect(() => {
@@ -2906,7 +3163,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
2906
3163
  )
2907
3164
  );
2908
3165
  } else {
2909
- messages.push(...formatErrorMessages(value, currentKey, formatMessage));
3166
+ messages.push(
3167
+ ...formatErrorMessages(
3168
+ // @ts-expect-error TODO: check why value is not compatible with FormErrors
3169
+ value,
3170
+ currentKey,
3171
+ formatMessage
3172
+ )
3173
+ );
2910
3174
  }
2911
3175
  } else {
2912
3176
  messages.push(
@@ -3005,7 +3269,7 @@ const SelectedEntriesTableContent = ({
3005
3269
  status: row.status
3006
3270
  }
3007
3271
  ) }),
3008
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
3272
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
3009
3273
  designSystem.IconButton,
3010
3274
  {
3011
3275
  tag: reactRouterDom.Link,
@@ -3028,9 +3292,10 @@ const SelectedEntriesTableContent = ({
3028
3292
  ),
3029
3293
  target: "_blank",
3030
3294
  marginLeft: "auto",
3031
- children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {})
3295
+ variant: "ghost",
3296
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, { width: "1.6rem", height: "1.6rem" })
3032
3297
  }
3033
- ) })
3298
+ ) }) })
3034
3299
  ] }, row.id)) })
3035
3300
  ] });
3036
3301
  };
@@ -3067,7 +3332,13 @@ const SelectedEntriesModalContent = ({
3067
3332
  );
3068
3333
  const { rows, validationErrors } = React__namespace.useMemo(() => {
3069
3334
  if (data.length > 0 && schema) {
3070
- const validate = createYupSchema(schema.attributes, components);
3335
+ const validate = createYupSchema(
3336
+ schema.attributes,
3337
+ components,
3338
+ // Since this is the "Publish" action, the validation
3339
+ // schema must enforce the rules for published entities
3340
+ { status: "published" }
3341
+ );
3071
3342
  const validationErrors2 = {};
3072
3343
  const rows2 = data.map((entry) => {
3073
3344
  try {
@@ -3417,7 +3688,7 @@ const TableActions = ({ document }) => {
3417
3688
  strapiAdmin.DescriptionComponentRenderer,
3418
3689
  {
3419
3690
  props,
3420
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3691
+ descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3421
3692
  children: (actions2) => {
3422
3693
  const tableRowActions = actions2.filter((action) => {
3423
3694
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3528,7 +3799,7 @@ const CloneAction = ({ model, documentId }) => {
3528
3799
  }),
3529
3800
  content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3530
3801
  footer: ({ onClose }) => {
3531
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
3802
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
3532
3803
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3533
3804
  id: "cancel",
3534
3805
  defaultMessage: "Cancel"
@@ -3569,8 +3840,7 @@ class ContentManagerPlugin {
3569
3840
  documentActions = [
3570
3841
  ...DEFAULT_ACTIONS,
3571
3842
  ...DEFAULT_TABLE_ROW_ACTIONS,
3572
- ...DEFAULT_HEADER_ACTIONS,
3573
- HistoryAction
3843
+ ...DEFAULT_HEADER_ACTIONS
3574
3844
  ];
3575
3845
  editViewSidePanels = [ActionsPanel];
3576
3846
  headerActions = [];
@@ -3659,6 +3929,52 @@ const getPrintableType = (value) => {
3659
3929
  }
3660
3930
  return nativeType;
3661
3931
  };
3932
+ const HistoryAction = ({ model, document }) => {
3933
+ const { formatMessage } = reactIntl.useIntl();
3934
+ const [{ query }] = strapiAdmin.useQueryParams();
3935
+ const navigate = reactRouterDom.useNavigate();
3936
+ const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
3937
+ if (!window.strapi.features.isEnabled("cms-content-history")) {
3938
+ return null;
3939
+ }
3940
+ return {
3941
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
3942
+ label: formatMessage({
3943
+ id: "content-manager.history.document-action",
3944
+ defaultMessage: "Content History"
3945
+ }),
3946
+ onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
3947
+ disabled: (
3948
+ /**
3949
+ * The user is creating a new document.
3950
+ * It hasn't been saved yet, so there's no history to go to
3951
+ */
3952
+ !document || /**
3953
+ * The document has been created but the current dimension has never been saved.
3954
+ * For example, the user is creating a new locale in an existing document,
3955
+ * so there's no history for the document in that locale
3956
+ */
3957
+ !document.id || /**
3958
+ * History is only available for content types created by the user.
3959
+ * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
3960
+ * which start with `admin::` or `plugin::`
3961
+ */
3962
+ !model.startsWith("api::")
3963
+ ),
3964
+ position: "header"
3965
+ };
3966
+ };
3967
+ HistoryAction.type = "history";
3968
+ const historyAdmin = {
3969
+ bootstrap(app) {
3970
+ const { addDocumentAction } = app.getPlugin("content-manager").apis;
3971
+ addDocumentAction((actions2) => {
3972
+ const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
3973
+ actions2.splice(indexOfDeleteAction, 0, HistoryAction);
3974
+ return actions2;
3975
+ });
3976
+ }
3977
+ };
3662
3978
  const initialState = {
3663
3979
  collectionTypeLinks: [],
3664
3980
  components: [],
@@ -3709,15 +4025,29 @@ const index = {
3709
4025
  defaultMessage: "Content Manager"
3710
4026
  },
3711
4027
  permissions: [],
3712
- Component: () => Promise.resolve().then(() => require("./layout--iHdZzRk.js")).then((mod) => ({ default: mod.Layout })),
3713
4028
  position: 1
3714
4029
  });
4030
+ app.router.addRoute({
4031
+ path: "content-manager/*",
4032
+ lazy: async () => {
4033
+ const { Layout } = await Promise.resolve().then(() => require("./layout-B2MyZU-_.js"));
4034
+ return {
4035
+ Component: Layout
4036
+ };
4037
+ },
4038
+ children: routes
4039
+ });
3715
4040
  app.registerPlugin(cm.config);
3716
4041
  },
4042
+ bootstrap(app) {
4043
+ if (typeof historyAdmin.bootstrap === "function") {
4044
+ historyAdmin.bootstrap(app);
4045
+ }
4046
+ },
3717
4047
  async registerTrads({ locales }) {
3718
4048
  const importedTrads = await Promise.all(
3719
4049
  locales.map((locale) => {
3720
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-fbKQxLGn.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4050
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Bm0D0IWz.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
3721
4051
  return {
3722
4052
  data: prefixPluginTranslations(data, PLUGIN_ID),
3723
4053
  locale
@@ -3735,6 +4065,7 @@ const index = {
3735
4065
  };
3736
4066
  exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
3737
4067
  exports.BulkActionsRenderer = BulkActionsRenderer;
4068
+ exports.CLONE_PATH = CLONE_PATH;
3738
4069
  exports.COLLECTION_TYPES = COLLECTION_TYPES;
3739
4070
  exports.CREATOR_FIELDS = CREATOR_FIELDS;
3740
4071
  exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
@@ -3761,8 +4092,8 @@ exports.getDisplayName = getDisplayName;
3761
4092
  exports.getMainField = getMainField;
3762
4093
  exports.getTranslation = getTranslation;
3763
4094
  exports.index = index;
3764
- exports.routes = routes;
3765
4095
  exports.setInitialData = setInitialData;
4096
+ exports.useContentManagerContext = useContentManagerContext;
3766
4097
  exports.useContentTypeSchema = useContentTypeSchema;
3767
4098
  exports.useDoc = useDoc;
3768
4099
  exports.useDocLayout = useDocLayout;
@@ -3775,4 +4106,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
3775
4106
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
3776
4107
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
3777
4108
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
3778
- //# sourceMappingURL=index-CWpLBSt0.js.map
4109
+ //# sourceMappingURL=index-BdMf2lfT.js.map