@strapi/content-manager 0.0.0-experimental.7afdc9b682bc83a53ce599c4fb7c9e4506b31fff → 0.0.0-experimental.93a73ca8c7b85667fe8e46c0cb6627506570a02f

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 (107) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-CR5XdR33.mjs → ComponentConfigurationPage-B3yDbeU1.mjs} +3 -3
  3. package/dist/_chunks/{ComponentConfigurationPage-CR5XdR33.mjs.map → ComponentConfigurationPage-B3yDbeU1.mjs.map} +1 -1
  4. package/dist/_chunks/{ComponentConfigurationPage-DJcn1DrO.js → ComponentConfigurationPage-KXSuLnQD.js} +3 -3
  5. package/dist/_chunks/{ComponentConfigurationPage-DJcn1DrO.js.map → ComponentConfigurationPage-KXSuLnQD.js.map} +1 -1
  6. package/dist/_chunks/{EditConfigurationPage-tDtWj7R2.js → EditConfigurationPage-BQ17--5R.js} +3 -3
  7. package/dist/_chunks/{EditConfigurationPage-tDtWj7R2.js.map → EditConfigurationPage-BQ17--5R.js.map} +1 -1
  8. package/dist/_chunks/{EditConfigurationPage-DmCIb4kD.mjs → EditConfigurationPage-D7PrLO8j.mjs} +3 -3
  9. package/dist/_chunks/{EditConfigurationPage-DmCIb4kD.mjs.map → EditConfigurationPage-D7PrLO8j.mjs.map} +1 -1
  10. package/dist/_chunks/{EditViewPage-DvaV7U9b.mjs → EditViewPage-B7VgwJaG.mjs} +57 -46
  11. package/dist/_chunks/EditViewPage-B7VgwJaG.mjs.map +1 -0
  12. package/dist/_chunks/{EditViewPage-CoQEnFlC.js → EditViewPage-BgjdnGz2.js} +56 -45
  13. package/dist/_chunks/EditViewPage-BgjdnGz2.js.map +1 -0
  14. package/dist/_chunks/{Field-ZdrmmQ4Y.js → Field-CdK7ZLmv.js} +504 -165
  15. package/dist/_chunks/Field-CdK7ZLmv.js.map +1 -0
  16. package/dist/_chunks/{Field-Cz_J9551.mjs → Field-tHCw4lGA.mjs} +505 -166
  17. package/dist/_chunks/Field-tHCw4lGA.mjs.map +1 -0
  18. package/dist/_chunks/{Form-Dxmihyw8.mjs → Form-BJxdTv3Q.mjs} +40 -30
  19. package/dist/_chunks/Form-BJxdTv3Q.mjs.map +1 -0
  20. package/dist/_chunks/{Form-Bpig5rch.js → Form-C_0KTVvV.js} +38 -28
  21. package/dist/_chunks/Form-C_0KTVvV.js.map +1 -0
  22. package/dist/_chunks/{History-BZP8n7KT.mjs → History-DR2txJLE.mjs} +141 -37
  23. package/dist/_chunks/History-DR2txJLE.mjs.map +1 -0
  24. package/dist/_chunks/{History-BfX6XmZK.js → History-nuEzM5qm.js} +140 -36
  25. package/dist/_chunks/History-nuEzM5qm.js.map +1 -0
  26. package/dist/_chunks/{ListConfigurationPage-B3CXj8PY.js → ListConfigurationPage-CnB86Psm.js} +57 -46
  27. package/dist/_chunks/ListConfigurationPage-CnB86Psm.js.map +1 -0
  28. package/dist/_chunks/{ListConfigurationPage-DxKuVkKz.mjs → ListConfigurationPage-voFVtXu6.mjs} +58 -48
  29. package/dist/_chunks/ListConfigurationPage-voFVtXu6.mjs.map +1 -0
  30. package/dist/_chunks/{ListViewPage-D5D3tVPq.mjs → ListViewPage-B_GaWgRH.mjs} +67 -70
  31. package/dist/_chunks/ListViewPage-B_GaWgRH.mjs.map +1 -0
  32. package/dist/_chunks/{ListViewPage-Bk9VO__I.js → ListViewPage-SXIXm-RM.js} +65 -68
  33. package/dist/_chunks/ListViewPage-SXIXm-RM.js.map +1 -0
  34. package/dist/_chunks/{NoContentTypePage-DsB2F7Z1.js → NoContentTypePage-BzsQ3hLZ.js} +2 -2
  35. package/dist/_chunks/{NoContentTypePage-DsB2F7Z1.js.map → NoContentTypePage-BzsQ3hLZ.js.map} +1 -1
  36. package/dist/_chunks/{NoContentTypePage-DnMeuQCj.mjs → NoContentTypePage-CYiGpsbj.mjs} +2 -2
  37. package/dist/_chunks/{NoContentTypePage-DnMeuQCj.mjs.map → NoContentTypePage-CYiGpsbj.mjs.map} +1 -1
  38. package/dist/_chunks/{NoPermissionsPage-OyoME_Tf.mjs → NoPermissionsPage-B5baIHal.mjs} +2 -2
  39. package/dist/_chunks/{NoPermissionsPage-OyoME_Tf.mjs.map → NoPermissionsPage-B5baIHal.mjs.map} +1 -1
  40. package/dist/_chunks/{NoPermissionsPage-BQDM64_b.js → NoPermissionsPage-IGkId4C5.js} +2 -2
  41. package/dist/_chunks/{NoPermissionsPage-BQDM64_b.js.map → NoPermissionsPage-IGkId4C5.js.map} +1 -1
  42. package/dist/_chunks/{Relations-BOYZmuWy.mjs → Relations-CIYDdKU-.mjs} +4 -4
  43. package/dist/_chunks/Relations-CIYDdKU-.mjs.map +1 -0
  44. package/dist/_chunks/{Relations-B6B3A3mb.js → Relations-Dhuurpx2.js} +4 -4
  45. package/dist/_chunks/Relations-Dhuurpx2.js.map +1 -0
  46. package/dist/_chunks/{en-Dzv55oQw.mjs → en-BrCTWlZv.mjs} +8 -4
  47. package/dist/_chunks/{en-Dzv55oQw.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
  48. package/dist/_chunks/{en-BN1bvFK7.js → en-uOUIxfcQ.js} +8 -4
  49. package/dist/_chunks/{en-BN1bvFK7.js.map → en-uOUIxfcQ.js.map} +1 -1
  50. package/dist/_chunks/{index-VHviNMeW.mjs → index-C9TJPyni.mjs} +467 -428
  51. package/dist/_chunks/index-C9TJPyni.mjs.map +1 -0
  52. package/dist/_chunks/{index-DzN3kBgx.js → index-CdT0kHZ8.js} +437 -398
  53. package/dist/_chunks/index-CdT0kHZ8.js.map +1 -0
  54. package/dist/_chunks/{layout-CPn1PM6x.mjs → layout-BNqvLR_b.mjs} +39 -22
  55. package/dist/_chunks/layout-BNqvLR_b.mjs.map +1 -0
  56. package/dist/_chunks/{layout-b91XRlD2.js → layout-C6dxWYT7.js} +37 -20
  57. package/dist/_chunks/layout-C6dxWYT7.js.map +1 -0
  58. package/dist/_chunks/{relations-BsqxS6tR.mjs → relations-CkKqKw65.mjs} +2 -2
  59. package/dist/_chunks/{relations-BsqxS6tR.mjs.map → relations-CkKqKw65.mjs.map} +1 -1
  60. package/dist/_chunks/{relations-CA7IYmcP.js → relations-DtFaDnP1.js} +2 -2
  61. package/dist/_chunks/{relations-CA7IYmcP.js.map → relations-DtFaDnP1.js.map} +1 -1
  62. package/dist/admin/index.js +1 -1
  63. package/dist/admin/index.mjs +8 -8
  64. package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
  65. package/dist/admin/src/history/index.d.ts +3 -0
  66. package/dist/admin/src/index.d.ts +1 -0
  67. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
  68. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
  69. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  70. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  71. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  72. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +12 -32
  73. package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
  74. package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
  75. package/dist/server/index.js +135 -85
  76. package/dist/server/index.js.map +1 -1
  77. package/dist/server/index.mjs +136 -86
  78. package/dist/server/index.mjs.map +1 -1
  79. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  80. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  81. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  82. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  83. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  84. package/dist/server/src/history/services/utils.d.ts +1 -1
  85. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  86. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  87. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  88. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  89. package/package.json +8 -8
  90. package/dist/_chunks/EditViewPage-CoQEnFlC.js.map +0 -1
  91. package/dist/_chunks/EditViewPage-DvaV7U9b.mjs.map +0 -1
  92. package/dist/_chunks/Field-Cz_J9551.mjs.map +0 -1
  93. package/dist/_chunks/Field-ZdrmmQ4Y.js.map +0 -1
  94. package/dist/_chunks/Form-Bpig5rch.js.map +0 -1
  95. package/dist/_chunks/Form-Dxmihyw8.mjs.map +0 -1
  96. package/dist/_chunks/History-BZP8n7KT.mjs.map +0 -1
  97. package/dist/_chunks/History-BfX6XmZK.js.map +0 -1
  98. package/dist/_chunks/ListConfigurationPage-B3CXj8PY.js.map +0 -1
  99. package/dist/_chunks/ListConfigurationPage-DxKuVkKz.mjs.map +0 -1
  100. package/dist/_chunks/ListViewPage-Bk9VO__I.js.map +0 -1
  101. package/dist/_chunks/ListViewPage-D5D3tVPq.mjs.map +0 -1
  102. package/dist/_chunks/Relations-B6B3A3mb.js.map +0 -1
  103. package/dist/_chunks/Relations-BOYZmuWy.mjs.map +0 -1
  104. package/dist/_chunks/index-DzN3kBgx.js.map +0 -1
  105. package/dist/_chunks/index-VHviNMeW.mjs.map +0 -1
  106. package/dist/_chunks/layout-CPn1PM6x.mjs.map +0 -1
  107. package/dist/_chunks/layout-b91XRlD2.js.map +0 -1
@@ -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");
7
+ const reactIntl = require("react-intl");
8
+ const reactRouterDom = require("react-router-dom");
10
9
  const styledComponents = require("styled-components");
11
10
  const yup = require("yup");
12
11
  const pipe = require("lodash/fp/pipe");
13
12
  const dateFns = require("date-fns");
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";
@@ -219,6 +183,7 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
219
183
  ]
220
184
  });
221
185
  const documentApi = contentManagerApi.injectEndpoints({
186
+ overrideExisting: true,
222
187
  endpoints: (builder) => ({
223
188
  autoCloneDocument: builder.mutation({
224
189
  query: ({ model, sourceId, query }) => ({
@@ -228,7 +193,12 @@ const documentApi = contentManagerApi.injectEndpoints({
228
193
  params: query
229
194
  }
230
195
  }),
231
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
196
+ invalidatesTags: (_result, error, { model }) => {
197
+ if (error) {
198
+ return [];
199
+ }
200
+ return [{ type: "Document", id: `${model}_LIST` }];
201
+ }
232
202
  }),
233
203
  cloneDocument: builder.mutation({
234
204
  query: ({ model, sourceId, data, params }) => ({
@@ -315,6 +285,7 @@ const documentApi = contentManagerApi.injectEndpoints({
315
285
  }),
316
286
  providesTags: (result, _error, arg) => {
317
287
  return [
288
+ { type: "Document", id: `ALL_LIST` },
318
289
  { type: "Document", id: `${arg.model}_LIST` },
319
290
  ...result?.results.map(({ documentId }) => ({
320
291
  type: "Document",
@@ -353,6 +324,11 @@ const documentApi = contentManagerApi.injectEndpoints({
353
324
  {
354
325
  type: "Document",
355
326
  id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
327
+ },
328
+ // Make it easy to invalidate all individual documents queries for a model
329
+ {
330
+ type: "Document",
331
+ id: `${model}_ALL_ITEMS`
356
332
  }
357
333
  ];
358
334
  }
@@ -418,6 +394,18 @@ const documentApi = contentManagerApi.injectEndpoints({
418
394
  },
419
395
  "Relations"
420
396
  ];
397
+ },
398
+ async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
399
+ const patchResult = dispatch(
400
+ documentApi.util.updateQueryData("getDocument", patch, (draft) => {
401
+ Object.assign(draft.data, data);
402
+ })
403
+ );
404
+ try {
405
+ await queryFulfilled;
406
+ } catch {
407
+ patchResult.undo();
408
+ }
421
409
  }
422
410
  }),
423
411
  unpublishDocument: builder.mutation({
@@ -601,6 +589,14 @@ const createAttributeSchema = (attribute) => {
601
589
  if (!value || typeof value === "string" && value.length === 0) {
602
590
  return true;
603
591
  }
592
+ if (typeof value === "object") {
593
+ try {
594
+ JSON.stringify(value);
595
+ return true;
596
+ } catch (err) {
597
+ return false;
598
+ }
599
+ }
604
600
  try {
605
601
  JSON.parse(value);
606
602
  return true;
@@ -620,11 +616,11 @@ const createAttributeSchema = (attribute) => {
620
616
  }
621
617
  };
622
618
  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
- });
619
+ if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
620
+ return schema.min(1, strapiAdmin.translatedErrors.required);
621
+ }
622
+ if (attribute.required && attribute.type !== "relation") {
623
+ return schema.required(strapiAdmin.translatedErrors.required);
628
624
  }
629
625
  return schema?.nullable ? schema.nullable() : (
630
626
  // In some cases '.nullable' will not be available on the schema.
@@ -658,6 +654,28 @@ const addMaxLengthValidation = (attribute) => (schema) => {
658
654
  const addMinValidation = (attribute) => (schema) => {
659
655
  if ("min" in attribute) {
660
656
  const min = toInteger(attribute.min);
657
+ if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
658
+ if (!attribute.required && "test" in schema && min) {
659
+ return schema.test(
660
+ "custom-min",
661
+ {
662
+ ...strapiAdmin.translatedErrors.min,
663
+ values: {
664
+ min: attribute.min
665
+ }
666
+ },
667
+ (value) => {
668
+ if (!value) {
669
+ return true;
670
+ }
671
+ if (Array.isArray(value) && value.length === 0) {
672
+ return true;
673
+ }
674
+ return value.length >= min;
675
+ }
676
+ );
677
+ }
678
+ }
661
679
  if ("min" in schema && min) {
662
680
  return schema.min(min, {
663
681
  ...strapiAdmin.translatedErrors.min,
@@ -784,7 +802,10 @@ const useDocument = (args, opts) => {
784
802
  isLoading: isLoadingDocument,
785
803
  isFetching: isFetchingDocument,
786
804
  error
787
- } = useGetDocumentQuery(args, opts);
805
+ } = useGetDocumentQuery(args, {
806
+ ...opts,
807
+ skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
808
+ });
788
809
  const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
789
810
  React__namespace.useEffect(() => {
790
811
  if (error) {
@@ -948,12 +969,13 @@ const useDocumentActions = () => {
948
969
  );
949
970
  const [discardDocument] = useDiscardDocumentMutation();
950
971
  const discard = React__namespace.useCallback(
951
- async ({ collectionType, model, documentId }) => {
972
+ async ({ collectionType, model, documentId, params }) => {
952
973
  try {
953
974
  const res = await discardDocument({
954
975
  collectionType,
955
976
  model,
956
- documentId
977
+ documentId,
978
+ params
957
979
  });
958
980
  if ("error" in res) {
959
981
  toggleNotification({
@@ -1204,7 +1226,6 @@ const useDocumentActions = () => {
1204
1226
  sourceId
1205
1227
  });
1206
1228
  if ("error" in res) {
1207
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1208
1229
  return { error: res.error };
1209
1230
  }
1210
1231
  toggleNotification({
@@ -1285,7 +1306,7 @@ const useDocumentActions = () => {
1285
1306
  };
1286
1307
  };
1287
1308
  const ProtectedHistoryPage = React.lazy(
1288
- () => Promise.resolve().then(() => require("./History-BfX6XmZK.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1309
+ () => Promise.resolve().then(() => require("./History-nuEzM5qm.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1289
1310
  );
1290
1311
  const routes$1 = [
1291
1312
  {
@@ -1298,31 +1319,31 @@ const routes$1 = [
1298
1319
  }
1299
1320
  ];
1300
1321
  const ProtectedEditViewPage = React.lazy(
1301
- () => Promise.resolve().then(() => require("./EditViewPage-CoQEnFlC.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1322
+ () => Promise.resolve().then(() => require("./EditViewPage-BgjdnGz2.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1302
1323
  );
1303
1324
  const ProtectedListViewPage = React.lazy(
1304
- () => Promise.resolve().then(() => require("./ListViewPage-Bk9VO__I.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1325
+ () => Promise.resolve().then(() => require("./ListViewPage-SXIXm-RM.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1305
1326
  );
1306
1327
  const ProtectedListConfiguration = React.lazy(
1307
- () => Promise.resolve().then(() => require("./ListConfigurationPage-B3CXj8PY.js")).then((mod) => ({
1328
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-CnB86Psm.js")).then((mod) => ({
1308
1329
  default: mod.ProtectedListConfiguration
1309
1330
  }))
1310
1331
  );
1311
1332
  const ProtectedEditConfigurationPage = React.lazy(
1312
- () => Promise.resolve().then(() => require("./EditConfigurationPage-tDtWj7R2.js")).then((mod) => ({
1333
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-BQ17--5R.js")).then((mod) => ({
1313
1334
  default: mod.ProtectedEditConfigurationPage
1314
1335
  }))
1315
1336
  );
1316
1337
  const ProtectedComponentConfigurationPage = React.lazy(
1317
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-DJcn1DrO.js")).then((mod) => ({
1338
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-KXSuLnQD.js")).then((mod) => ({
1318
1339
  default: mod.ProtectedComponentConfigurationPage
1319
1340
  }))
1320
1341
  );
1321
1342
  const NoPermissions = React.lazy(
1322
- () => Promise.resolve().then(() => require("./NoPermissionsPage-BQDM64_b.js")).then((mod) => ({ default: mod.NoPermissions }))
1343
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-IGkId4C5.js")).then((mod) => ({ default: mod.NoPermissions }))
1323
1344
  );
1324
1345
  const NoContentType = React.lazy(
1325
- () => Promise.resolve().then(() => require("./NoContentTypePage-DsB2F7Z1.js")).then((mod) => ({ default: mod.NoContentType }))
1346
+ () => Promise.resolve().then(() => require("./NoContentTypePage-BzsQ3hLZ.js")).then((mod) => ({ default: mod.NoContentType }))
1326
1347
  );
1327
1348
  const CollectionTypePages = () => {
1328
1349
  const { collectionType } = reactRouterDom.useParams();
@@ -1436,12 +1457,14 @@ const DocumentActionButton = (action) => {
1436
1457
  /* @__PURE__ */ jsxRuntime.jsx(
1437
1458
  designSystem.Button,
1438
1459
  {
1439
- flex: 1,
1460
+ flex: "auto",
1440
1461
  startIcon: action.icon,
1441
1462
  disabled: action.disabled,
1442
1463
  onClick: handleClick(action),
1443
1464
  justifyContent: "center",
1444
1465
  variant: action.variant || "default",
1466
+ paddingTop: "7px",
1467
+ paddingBottom: "7px",
1445
1468
  children: action.label
1446
1469
  }
1447
1470
  ),
@@ -1449,7 +1472,7 @@ const DocumentActionButton = (action) => {
1449
1472
  DocumentActionConfirmDialog,
1450
1473
  {
1451
1474
  ...action.dialog,
1452
- variant: action.variant,
1475
+ variant: action.dialog?.variant ?? action.variant,
1453
1476
  isOpen: dialogId === action.id,
1454
1477
  onClose: handleClose
1455
1478
  }
@@ -1501,14 +1524,14 @@ const DocumentActionsMenu = ({
1501
1524
  };
1502
1525
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
1503
1526
  /* @__PURE__ */ jsxRuntime.jsxs(
1504
- designSystem.Menu.Trigger,
1527
+ StyledMoreButton,
1505
1528
  {
1506
1529
  disabled: isDisabled,
1507
1530
  size: "S",
1508
1531
  endIcon: null,
1509
- paddingTop: "7px",
1510
- paddingLeft: "9px",
1511
- paddingRight: "9px",
1532
+ paddingTop: "4px",
1533
+ paddingLeft: "7px",
1534
+ paddingRight: "7px",
1512
1535
  variant,
1513
1536
  children: [
1514
1537
  /* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
@@ -1528,10 +1551,25 @@ const DocumentActionsMenu = ({
1528
1551
  onSelect: handleClick(action),
1529
1552
  display: "block",
1530
1553
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
1531
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1532
- action.icon,
1533
- action.label
1534
- ] }),
1554
+ /* @__PURE__ */ jsxRuntime.jsxs(
1555
+ designSystem.Flex,
1556
+ {
1557
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1558
+ gap: 2,
1559
+ tag: "span",
1560
+ children: [
1561
+ /* @__PURE__ */ jsxRuntime.jsx(
1562
+ designSystem.Flex,
1563
+ {
1564
+ tag: "span",
1565
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1566
+ children: action.icon
1567
+ }
1568
+ ),
1569
+ action.label
1570
+ ]
1571
+ }
1572
+ ),
1535
1573
  action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
1536
1574
  designSystem.Flex,
1537
1575
  {
@@ -1590,6 +1628,23 @@ const convertActionVariantToColor = (variant = "secondary") => {
1590
1628
  return "primary600";
1591
1629
  }
1592
1630
  };
1631
+ const convertActionVariantToIconColor = (variant = "secondary") => {
1632
+ switch (variant) {
1633
+ case "danger":
1634
+ return "danger600";
1635
+ case "secondary":
1636
+ return "neutral500";
1637
+ case "success":
1638
+ return "success600";
1639
+ default:
1640
+ return "primary600";
1641
+ }
1642
+ };
1643
+ const StyledMoreButton = styledComponents.styled(designSystem.Menu.Trigger)`
1644
+ & > span {
1645
+ display: flex;
1646
+ }
1647
+ `;
1593
1648
  const DocumentActionConfirmDialog = ({
1594
1649
  onClose,
1595
1650
  onCancel,
@@ -1612,22 +1667,20 @@ const DocumentActionConfirmDialog = ({
1612
1667
  }
1613
1668
  onClose();
1614
1669
  };
1615
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog, { isOpen, title, onClose: handleClose, children: [
1616
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.DialogBody, { children: content }),
1617
- /* @__PURE__ */ jsxRuntime.jsx(
1618
- designSystem.DialogFooter,
1619
- {
1620
- startAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
1621
- id: "app.components.Button.cancel",
1622
- defaultMessage: "Cancel"
1623
- }) }),
1624
- endAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
1625
- id: "app.components.Button.confirm",
1626
- defaultMessage: "Confirm"
1627
- }) })
1628
- }
1629
- )
1630
- ] });
1670
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
1671
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
1672
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
1673
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
1674
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
1675
+ id: "app.components.Button.cancel",
1676
+ defaultMessage: "Cancel"
1677
+ }) }) }),
1678
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
1679
+ id: "app.components.Button.confirm",
1680
+ defaultMessage: "Confirm"
1681
+ }) })
1682
+ ] })
1683
+ ] }) });
1631
1684
  };
1632
1685
  const DocumentActionModal = ({
1633
1686
  isOpen,
@@ -1637,34 +1690,17 @@ const DocumentActionModal = ({
1637
1690
  content: Content,
1638
1691
  onModalClose
1639
1692
  }) => {
1640
- const id = React__namespace.useId();
1641
- if (!isOpen) {
1642
- return null;
1643
- }
1644
1693
  const handleClose = () => {
1645
1694
  if (onClose) {
1646
1695
  onClose();
1647
1696
  }
1648
1697
  onModalClose();
1649
1698
  };
1650
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
1651
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
1652
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content }),
1653
- /* @__PURE__ */ jsxRuntime.jsx(
1654
- designSystem.Box,
1655
- {
1656
- paddingTop: 4,
1657
- paddingBottom: 4,
1658
- paddingLeft: 5,
1659
- paddingRight: 5,
1660
- borderWidth: "1px 0 0 0",
1661
- borderStyle: "solid",
1662
- borderColor: "neutral150",
1663
- background: "neutral100",
1664
- children: typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
1665
- }
1666
- )
1667
- ] });
1699
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
1700
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: title }) }),
1701
+ typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: Content }),
1702
+ typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
1703
+ ] }) });
1668
1704
  };
1669
1705
  const PublishAction$1 = ({
1670
1706
  activeTab,
@@ -1685,6 +1721,12 @@ const PublishAction$1 = ({
1685
1721
  ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1686
1722
  );
1687
1723
  const { publish } = useDocumentActions();
1724
+ const [
1725
+ countDraftRelations,
1726
+ { isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
1727
+ ] = useLazyGetDraftRelationCountQuery();
1728
+ const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
1729
+ const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
1688
1730
  const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
1689
1731
  const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
1690
1732
  const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
@@ -1693,10 +1735,101 @@ const PublishAction$1 = ({
1693
1735
  const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
1694
1736
  const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
1695
1737
  const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
1738
+ React__namespace.useEffect(() => {
1739
+ if (isErrorDraftRelations) {
1740
+ toggleNotification({
1741
+ type: "danger",
1742
+ message: formatMessage({
1743
+ id: getTranslation("error.records.fetch-draft-relatons"),
1744
+ defaultMessage: "An error occurred while fetching draft relations on this document."
1745
+ })
1746
+ });
1747
+ }
1748
+ }, [isErrorDraftRelations, toggleNotification, formatMessage]);
1749
+ React__namespace.useEffect(() => {
1750
+ const localDraftRelations = /* @__PURE__ */ new Set();
1751
+ const extractDraftRelations = (data) => {
1752
+ const relations = data.connect || [];
1753
+ relations.forEach((relation) => {
1754
+ if (relation.status === "draft") {
1755
+ localDraftRelations.add(relation.id);
1756
+ }
1757
+ });
1758
+ };
1759
+ const traverseAndExtract = (data) => {
1760
+ Object.entries(data).forEach(([key, value]) => {
1761
+ if (key === "connect" && Array.isArray(value)) {
1762
+ extractDraftRelations({ connect: value });
1763
+ } else if (typeof value === "object" && value !== null) {
1764
+ traverseAndExtract(value);
1765
+ }
1766
+ });
1767
+ };
1768
+ if (!documentId || modified) {
1769
+ traverseAndExtract(formValues);
1770
+ setLocalCountOfDraftRelations(localDraftRelations.size);
1771
+ }
1772
+ }, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
1773
+ React__namespace.useEffect(() => {
1774
+ if (documentId) {
1775
+ const fetchDraftRelationsCount = async () => {
1776
+ const { data, error } = await countDraftRelations({
1777
+ collectionType,
1778
+ model,
1779
+ documentId,
1780
+ params
1781
+ });
1782
+ if (error) {
1783
+ throw error;
1784
+ }
1785
+ if (data) {
1786
+ setServerCountOfDraftRelations(data.data);
1787
+ }
1788
+ };
1789
+ fetchDraftRelationsCount();
1790
+ }
1791
+ }, [documentId, countDraftRelations, collectionType, model, params]);
1696
1792
  const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1697
1793
  if (!schema?.options?.draftAndPublish) {
1698
1794
  return null;
1699
1795
  }
1796
+ const performPublish = async () => {
1797
+ setSubmitting(true);
1798
+ try {
1799
+ const { errors } = await validate();
1800
+ if (errors) {
1801
+ toggleNotification({
1802
+ type: "danger",
1803
+ message: formatMessage({
1804
+ id: "content-manager.validation.error",
1805
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
1806
+ })
1807
+ });
1808
+ return;
1809
+ }
1810
+ const res = await publish(
1811
+ {
1812
+ collectionType,
1813
+ model,
1814
+ documentId,
1815
+ params
1816
+ },
1817
+ formValues
1818
+ );
1819
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
1820
+ navigate({
1821
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1822
+ search: rawQuery
1823
+ });
1824
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1825
+ setErrors(formatValidationErrors(res.error));
1826
+ }
1827
+ } finally {
1828
+ setSubmitting(false);
1829
+ }
1830
+ };
1831
+ const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
1832
+ const hasDraftRelations = totalDraftRelations > 0;
1700
1833
  return {
1701
1834
  /**
1702
1835
  * Disabled when:
@@ -1706,49 +1839,39 @@ const PublishAction$1 = ({
1706
1839
  * - the document is already published & not modified
1707
1840
  * - the document is being created & not modified
1708
1841
  * - the user doesn't have the permission to publish
1709
- * - the user doesn't have the permission to create a new document
1710
- * - the user doesn't have the permission to update the document
1711
1842
  */
1712
- disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
1843
+ disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
1713
1844
  label: formatMessage({
1714
1845
  id: "app.utils.publish",
1715
1846
  defaultMessage: "Publish"
1716
1847
  }),
1717
1848
  onClick: async () => {
1718
- setSubmitting(true);
1719
- try {
1720
- const { errors } = await validate();
1721
- if (errors) {
1722
- toggleNotification({
1723
- type: "danger",
1724
- message: formatMessage({
1725
- id: "content-manager.validation.error",
1726
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1727
- })
1728
- });
1729
- return;
1730
- }
1731
- const res = await publish(
1732
- {
1733
- collectionType,
1734
- model,
1735
- documentId,
1736
- params
1737
- },
1738
- formValues
1739
- );
1740
- if ("data" in res && collectionType !== SINGLE_TYPES) {
1741
- navigate({
1742
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1743
- search: rawQuery
1744
- });
1745
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1746
- setErrors(formatValidationErrors(res.error));
1849
+ if (hasDraftRelations) {
1850
+ return;
1851
+ }
1852
+ await performPublish();
1853
+ },
1854
+ dialog: hasDraftRelations ? {
1855
+ type: "dialog",
1856
+ variant: "danger",
1857
+ footer: null,
1858
+ title: formatMessage({
1859
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
1860
+ defaultMessage: "Confirmation"
1861
+ }),
1862
+ content: formatMessage(
1863
+ {
1864
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
1865
+ defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
1866
+ },
1867
+ {
1868
+ count: totalDraftRelations
1747
1869
  }
1748
- } finally {
1749
- setSubmitting(false);
1870
+ ),
1871
+ onConfirm: async () => {
1872
+ await performPublish();
1750
1873
  }
1751
- }
1874
+ } : void 0
1752
1875
  };
1753
1876
  };
1754
1877
  PublishAction$1.type = "publish";
@@ -1764,7 +1887,7 @@ const UpdateAction = ({
1764
1887
  const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
1765
1888
  const isCloning = cloneMatch !== null;
1766
1889
  const { formatMessage } = reactIntl.useIntl();
1767
- const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1890
+ useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1768
1891
  canCreate: canCreate2,
1769
1892
  canUpdate: canUpdate2
1770
1893
  }));
@@ -1784,10 +1907,8 @@ const UpdateAction = ({
1784
1907
  * - the form is submitting
1785
1908
  * - the document is not modified & we're not cloning (you can save a clone entity straight away)
1786
1909
  * - the active tab is the published tab
1787
- * - the user doesn't have the permission to create a new document
1788
- * - the user doesn't have the permission to update the document
1789
1910
  */
1790
- disabled: isSubmitting || !modified && !isCloning || activeTab === "published" || Boolean(!documentId && !canCreate || documentId && !canUpdate),
1911
+ disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
1791
1912
  label: formatMessage({
1792
1913
  id: "content-manager.containers.Edit.save",
1793
1914
  defaultMessage: "Save"
@@ -1816,10 +1937,13 @@ const UpdateAction = ({
1816
1937
  document
1817
1938
  );
1818
1939
  if ("data" in res) {
1819
- navigate({
1820
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1821
- search: rawQuery
1822
- });
1940
+ navigate(
1941
+ {
1942
+ pathname: `../${res.data.documentId}`,
1943
+ search: rawQuery
1944
+ },
1945
+ { relative: "path" }
1946
+ );
1823
1947
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1824
1948
  setErrors(formatValidationErrors(res.error));
1825
1949
  }
@@ -1847,10 +1971,13 @@ const UpdateAction = ({
1847
1971
  document
1848
1972
  );
1849
1973
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1850
- navigate({
1851
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1852
- search: rawQuery
1853
- });
1974
+ navigate(
1975
+ {
1976
+ pathname: `../${res.data.documentId}`,
1977
+ search: rawQuery
1978
+ },
1979
+ { replace: true, relative: "path" }
1980
+ );
1854
1981
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1855
1982
  setErrors(formatValidationErrors(res.error));
1856
1983
  }
@@ -1882,10 +2009,8 @@ const UnpublishAction$1 = ({
1882
2009
  const { toggleNotification } = strapiAdmin.useNotification();
1883
2010
  const [shouldKeepDraft, setShouldKeepDraft] = React__namespace.useState(true);
1884
2011
  const isDocumentModified = document?.status === "modified";
1885
- const handleChange = (e) => {
1886
- if ("value" in e.target) {
1887
- setShouldKeepDraft(e.target.value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
1888
- }
2012
+ const handleChange = (value) => {
2013
+ setShouldKeepDraft(value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
1889
2014
  };
1890
2015
  if (!schema?.options?.draftAndPublish) {
1891
2016
  return null;
@@ -1935,40 +2060,24 @@ const UnpublishAction$1 = ({
1935
2060
  }) })
1936
2061
  ] }),
1937
2062
  /* @__PURE__ */ jsxRuntime.jsxs(
1938
- designSystem.Flex,
2063
+ designSystem.Radio.Group,
1939
2064
  {
1940
- onChange: handleChange,
1941
- direction: "column",
1942
- alignItems: "flex-start",
1943
- tag: "fieldset",
1944
- borderWidth: 0,
1945
- gap: 3,
2065
+ defaultValue: UNPUBLISH_DRAFT_OPTIONS.KEEP,
2066
+ name: "discard-options",
2067
+ "aria-label": formatMessage({
2068
+ id: "content-manager.actions.unpublish.dialog.radio-label",
2069
+ defaultMessage: "Choose an option to unpublish the document."
2070
+ }),
2071
+ onValueChange: handleChange,
1946
2072
  children: [
1947
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "legend" }),
1948
- /* @__PURE__ */ jsxRuntime.jsx(
1949
- designSystem.Radio,
1950
- {
1951
- checked: shouldKeepDraft,
1952
- value: UNPUBLISH_DRAFT_OPTIONS.KEEP,
1953
- name: "discard-options",
1954
- children: formatMessage({
1955
- id: "content-manager.actions.unpublish.dialog.option.keep-draft",
1956
- defaultMessage: "Keep draft"
1957
- })
1958
- }
1959
- ),
1960
- /* @__PURE__ */ jsxRuntime.jsx(
1961
- designSystem.Radio,
1962
- {
1963
- checked: !shouldKeepDraft,
1964
- value: UNPUBLISH_DRAFT_OPTIONS.DISCARD,
1965
- name: "discard-options",
1966
- children: formatMessage({
1967
- id: "content-manager.actions.unpublish.dialog.option.replace-draft",
1968
- defaultMessage: "Replace draft"
1969
- })
1970
- }
1971
- )
2073
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { checked: shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.KEEP, children: formatMessage({
2074
+ id: "content-manager.actions.unpublish.dialog.option.keep-draft",
2075
+ defaultMessage: "Keep draft"
2076
+ }) }),
2077
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { checked: !shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.DISCARD, children: formatMessage({
2078
+ id: "content-manager.actions.unpublish.dialog.option.replace-draft",
2079
+ defaultMessage: "Replace draft"
2080
+ }) })
1972
2081
  ]
1973
2082
  }
1974
2083
  )
@@ -2114,23 +2223,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2114
2223
  id: "content-manager.containers.edit.title.new",
2115
2224
  defaultMessage: "Create an entry"
2116
2225
  }) : documentTitle;
2117
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 8, paddingBottom: 4, gap: 3, children: [
2226
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2118
2227
  /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
2119
- /* @__PURE__ */ jsxRuntime.jsxs(
2120
- designSystem.Flex,
2121
- {
2122
- width: "100%",
2123
- justifyContent: "space-between",
2124
- paddingTop: 1,
2125
- gap: "80px",
2126
- alignItems: "flex-start",
2127
- children: [
2128
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
2129
- /* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
2130
- ]
2131
- }
2132
- ),
2133
- status ? /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
2228
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2229
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
2230
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
2231
+ ] }),
2232
+ status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
2134
2233
  ] });
2135
2234
  };
2136
2235
  const HeaderToolbar = () => {
@@ -2821,30 +2920,23 @@ const ConfirmBulkActionDialog = ({
2821
2920
  endAction
2822
2921
  }) => {
2823
2922
  const { formatMessage } = reactIntl.useIntl();
2824
- return /* @__PURE__ */ jsxRuntime.jsxs(
2825
- designSystem.Dialog,
2826
- {
2827
- onClose: onToggleDialog,
2828
- title: formatMessage({
2829
- id: "app.components.ConfirmDialog.title",
2830
- defaultMessage: "Confirmation"
2831
- }),
2832
- isOpen,
2833
- children: [
2834
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.DialogBody, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: dialogBody }) }),
2835
- /* @__PURE__ */ jsxRuntime.jsx(
2836
- designSystem.DialogFooter,
2837
- {
2838
- startAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
2839
- id: "app.components.Button.cancel",
2840
- defaultMessage: "Cancel"
2841
- }) }),
2842
- endAction
2843
- }
2844
- )
2845
- ]
2846
- }
2847
- );
2923
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2924
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
2925
+ id: "app.components.ConfirmDialog.title",
2926
+ defaultMessage: "Confirmation"
2927
+ }) }),
2928
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
2929
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
2930
+ dialogBody
2931
+ ] }) }),
2932
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
2933
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
2934
+ id: "app.components.Button.cancel",
2935
+ defaultMessage: "Cancel"
2936
+ }) }) }),
2937
+ endAction
2938
+ ] })
2939
+ ] }) });
2848
2940
  };
2849
2941
  const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
2850
2942
  const ConfirmDialogPublishAll = ({
@@ -2949,16 +3041,30 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
2949
3041
  )
2950
3042
  );
2951
3043
  } else {
2952
- messages.push(...formatErrorMessages(value, currentKey, formatMessage));
3044
+ messages.push(
3045
+ ...formatErrorMessages(
3046
+ // @ts-expect-error TODO: check why value is not compatible with FormErrors
3047
+ value,
3048
+ currentKey,
3049
+ formatMessage
3050
+ )
3051
+ );
2953
3052
  }
3053
+ } else {
3054
+ messages.push(
3055
+ formatMessage(
3056
+ {
3057
+ id: `${value}.withField`,
3058
+ defaultMessage: value
3059
+ },
3060
+ { field: currentKey }
3061
+ )
3062
+ );
2954
3063
  }
2955
3064
  });
2956
3065
  return messages;
2957
3066
  };
2958
- const EntryValidationText = ({
2959
- validationErrors,
2960
- isPublished = false
2961
- }) => {
3067
+ const EntryValidationText = ({ validationErrors, status }) => {
2962
3068
  const { formatMessage } = reactIntl.useIntl();
2963
3069
  if (validationErrors) {
2964
3070
  const validationErrorsMessages = formatErrorMessages(validationErrors, "", formatMessage).join(
@@ -2969,7 +3075,7 @@ const EntryValidationText = ({
2969
3075
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
2970
3076
  ] });
2971
3077
  }
2972
- if (isPublished) {
3078
+ if (status === "published") {
2973
3079
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
2974
3080
  /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
2975
3081
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
@@ -2978,6 +3084,15 @@ const EntryValidationText = ({
2978
3084
  }) })
2979
3085
  ] });
2980
3086
  }
3087
+ if (status === "modified") {
3088
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3089
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowsCounterClockwise, { fill: "alternative600" }),
3090
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
3091
+ id: "content-manager.bulk-publish.modified",
3092
+ defaultMessage: "Ready to publish changes"
3093
+ }) })
3094
+ ] });
3095
+ }
2981
3096
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
2982
3097
  /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
2983
3098
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
@@ -3029,7 +3144,7 @@ const SelectedEntriesTableContent = ({
3029
3144
  EntryValidationText,
3030
3145
  {
3031
3146
  validationErrors: validationErrors[row.documentId],
3032
- isPublished: row.status === "published"
3147
+ status: row.status
3033
3148
  }
3034
3149
  ) }),
3035
3150
  /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3170,7 +3285,7 @@ const SelectedEntriesModalContent = ({
3170
3285
  );
3171
3286
  };
3172
3287
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3173
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalBody, { children: [
3288
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
3174
3289
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getFormattedCountMessage() }),
3175
3290
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
3176
3291
  SelectedEntriesTableContent,
@@ -3182,27 +3297,24 @@ const SelectedEntriesModalContent = ({
3182
3297
  }
3183
3298
  ) })
3184
3299
  ] }),
3185
- /* @__PURE__ */ jsxRuntime.jsx(
3186
- designSystem.ModalFooter,
3187
- {
3188
- startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
3189
- id: "app.components.Button.cancel",
3190
- defaultMessage: "Cancel"
3191
- }) }),
3192
- endActions: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3193
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
3194
- /* @__PURE__ */ jsxRuntime.jsx(
3195
- designSystem.Button,
3196
- {
3197
- onClick: toggleDialog,
3198
- disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3199
- loading: isSubmittingForm,
3200
- children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3201
- }
3202
- )
3203
- ] })
3204
- }
3205
- ),
3300
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
3301
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
3302
+ id: "app.components.Button.cancel",
3303
+ defaultMessage: "Cancel"
3304
+ }) }),
3305
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3306
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
3307
+ /* @__PURE__ */ jsxRuntime.jsx(
3308
+ designSystem.Button,
3309
+ {
3310
+ onClick: toggleDialog,
3311
+ disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3312
+ loading: isSubmittingForm,
3313
+ children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3314
+ }
3315
+ )
3316
+ ] })
3317
+ ] }),
3206
3318
  /* @__PURE__ */ jsxRuntime.jsx(
3207
3319
  ConfirmDialogPublishAll,
3208
3320
  {
@@ -3267,143 +3379,10 @@ const BulkActionsRenderer = () => {
3267
3379
  documents: selectedRows
3268
3380
  },
3269
3381
  descriptions: plugins["content-manager"].apis.getBulkActions(),
3270
- children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsxRuntime.jsx(BulkActionAction, { ...action }, action.id))
3382
+ children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActionButton, { ...action }, action.id))
3271
3383
  }
3272
3384
  ) });
3273
3385
  };
3274
- const BulkActionAction = (action) => {
3275
- const [dialogId, setDialogId] = React__namespace.useState(null);
3276
- const { toggleNotification } = strapiAdmin.useNotification();
3277
- const handleClick = (action2) => (e) => {
3278
- const { onClick, dialog, id } = action2;
3279
- if (onClick) {
3280
- onClick(e);
3281
- }
3282
- if (dialog) {
3283
- switch (dialog.type) {
3284
- case "notification":
3285
- toggleNotification({
3286
- title: dialog.title,
3287
- message: dialog.content,
3288
- type: dialog.status,
3289
- timeout: dialog.timeout,
3290
- onClose: dialog.onClose
3291
- });
3292
- break;
3293
- case "dialog":
3294
- case "modal": {
3295
- e.preventDefault();
3296
- setDialogId(id);
3297
- }
3298
- }
3299
- }
3300
- };
3301
- const handleClose = () => {
3302
- setDialogId(null);
3303
- if (action.dialog?.type === "modal" && action.dialog?.onClose) {
3304
- action.dialog.onClose();
3305
- }
3306
- };
3307
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3308
- /* @__PURE__ */ jsxRuntime.jsx(
3309
- designSystem.Button,
3310
- {
3311
- disabled: action.disabled,
3312
- startIcon: action.icon,
3313
- variant: action.variant,
3314
- onClick: handleClick(action),
3315
- children: action.label
3316
- }
3317
- ),
3318
- action.dialog?.type === "dialog" ? /* @__PURE__ */ jsxRuntime.jsx(
3319
- BulkActionConfirmDialog,
3320
- {
3321
- ...action.dialog,
3322
- variant: action.variant,
3323
- isOpen: dialogId === action.id,
3324
- onClose: handleClose
3325
- }
3326
- ) : null,
3327
- action.dialog?.type === "modal" ? /* @__PURE__ */ jsxRuntime.jsx(
3328
- BulkActionModal,
3329
- {
3330
- ...action.dialog,
3331
- onModalClose: handleClose,
3332
- isOpen: dialogId === action.id
3333
- }
3334
- ) : null
3335
- ] });
3336
- };
3337
- const BulkActionConfirmDialog = ({
3338
- onClose,
3339
- onCancel,
3340
- onConfirm,
3341
- title,
3342
- content,
3343
- confirmButton,
3344
- isOpen,
3345
- variant = "secondary"
3346
- }) => {
3347
- const { formatMessage } = reactIntl.useIntl();
3348
- const handleClose = async () => {
3349
- if (onCancel) {
3350
- await onCancel();
3351
- }
3352
- onClose();
3353
- };
3354
- const handleConfirm = async () => {
3355
- if (onConfirm) {
3356
- await onConfirm();
3357
- }
3358
- onClose();
3359
- };
3360
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog, { isOpen, title, onClose: handleClose, children: [
3361
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.DialogBody, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}), children: content }),
3362
- /* @__PURE__ */ jsxRuntime.jsx(
3363
- designSystem.DialogFooter,
3364
- {
3365
- startAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
3366
- id: "app.components.Button.cancel",
3367
- defaultMessage: "Cancel"
3368
- }) }),
3369
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
3370
- designSystem.Button,
3371
- {
3372
- onClick: handleConfirm,
3373
- variant: variant === "danger-light" ? variant : "secondary",
3374
- startIcon: variant === "danger-light" ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
3375
- children: confirmButton ? confirmButton : formatMessage({
3376
- id: "app.components.Button.confirm",
3377
- defaultMessage: "Confirm"
3378
- })
3379
- }
3380
- )
3381
- }
3382
- )
3383
- ] });
3384
- };
3385
- const BulkActionModal = ({
3386
- isOpen,
3387
- title,
3388
- onClose,
3389
- content: Content,
3390
- onModalClose
3391
- }) => {
3392
- const id = React__namespace.useId();
3393
- if (!isOpen) {
3394
- return null;
3395
- }
3396
- const handleClose = () => {
3397
- if (onClose) {
3398
- onClose();
3399
- }
3400
- onModalClose();
3401
- };
3402
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
3403
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
3404
- /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose })
3405
- ] });
3406
- };
3407
3386
  const DeleteAction = ({ documents, model }) => {
3408
3387
  const { formatMessage } = reactIntl.useIntl();
3409
3388
  const { schema: contentType } = useDoc();
@@ -3436,6 +3415,7 @@ const DeleteAction = ({ documents, model }) => {
3436
3415
  defaultMessage: "Confirmation"
3437
3416
  }),
3438
3417
  content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3418
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
3439
3419
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
3440
3420
  id: "popUpWarning.bodyMessage.contentType.delete.all",
3441
3421
  defaultMessage: "Are you sure you want to delete these entries?"
@@ -3472,7 +3452,7 @@ const UnpublishAction = ({ documents, model }) => {
3472
3452
  selectRow([]);
3473
3453
  }
3474
3454
  };
3475
- const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published");
3455
+ const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3476
3456
  if (!showUnpublishButton)
3477
3457
  return null;
3478
3458
  return {
@@ -3485,6 +3465,7 @@ const UnpublishAction = ({ documents, model }) => {
3485
3465
  defaultMessage: "Confirmation"
3486
3466
  }),
3487
3467
  content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3468
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
3488
3469
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
3489
3470
  id: "popUpWarning.bodyMessage.contentType.unpublish.all",
3490
3471
  defaultMessage: "Are you sure you want to unpublish these entries?"
@@ -3730,8 +3711,7 @@ class ContentManagerPlugin {
3730
3711
  documentActions = [
3731
3712
  ...DEFAULT_ACTIONS,
3732
3713
  ...DEFAULT_TABLE_ROW_ACTIONS,
3733
- ...DEFAULT_HEADER_ACTIONS,
3734
- HistoryAction
3714
+ ...DEFAULT_HEADER_ACTIONS
3735
3715
  ];
3736
3716
  editViewSidePanels = [ActionsPanel];
3737
3717
  headerActions = [];
@@ -3820,6 +3800,52 @@ const getPrintableType = (value) => {
3820
3800
  }
3821
3801
  return nativeType;
3822
3802
  };
3803
+ const HistoryAction = ({ model, document }) => {
3804
+ const { formatMessage } = reactIntl.useIntl();
3805
+ const [{ query }] = strapiAdmin.useQueryParams();
3806
+ const navigate = reactRouterDom.useNavigate();
3807
+ const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
3808
+ if (!window.strapi.features.isEnabled("cms-content-history")) {
3809
+ return null;
3810
+ }
3811
+ return {
3812
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
3813
+ label: formatMessage({
3814
+ id: "content-manager.history.document-action",
3815
+ defaultMessage: "Content History"
3816
+ }),
3817
+ onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
3818
+ disabled: (
3819
+ /**
3820
+ * The user is creating a new document.
3821
+ * It hasn't been saved yet, so there's no history to go to
3822
+ */
3823
+ !document || /**
3824
+ * The document has been created but the current dimension has never been saved.
3825
+ * For example, the user is creating a new locale in an existing document,
3826
+ * so there's no history for the document in that locale
3827
+ */
3828
+ !document.id || /**
3829
+ * History is only available for content types created by the user.
3830
+ * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
3831
+ * which start with `admin::` or `plugin::`
3832
+ */
3833
+ !model.startsWith("api::")
3834
+ ),
3835
+ position: "header"
3836
+ };
3837
+ };
3838
+ HistoryAction.type = "history";
3839
+ const historyAdmin = {
3840
+ bootstrap(app) {
3841
+ const { addDocumentAction } = app.getPlugin("content-manager").apis;
3842
+ addDocumentAction((actions2) => {
3843
+ const indexOfDeleteAction = actions2.findIndex((action) => action.type === "delete");
3844
+ actions2.splice(indexOfDeleteAction, 0, HistoryAction);
3845
+ return actions2;
3846
+ });
3847
+ }
3848
+ };
3823
3849
  const initialState = {
3824
3850
  collectionTypeLinks: [],
3825
3851
  components: [],
@@ -3870,15 +3896,29 @@ const index = {
3870
3896
  defaultMessage: "Content Manager"
3871
3897
  },
3872
3898
  permissions: [],
3873
- Component: () => Promise.resolve().then(() => require("./layout-b91XRlD2.js")).then((mod) => ({ default: mod.Layout })),
3874
3899
  position: 1
3875
3900
  });
3901
+ app.router.addRoute({
3902
+ path: "content-manager/*",
3903
+ lazy: async () => {
3904
+ const { Layout } = await Promise.resolve().then(() => require("./layout-C6dxWYT7.js"));
3905
+ return {
3906
+ Component: Layout
3907
+ };
3908
+ },
3909
+ children: routes
3910
+ });
3876
3911
  app.registerPlugin(cm.config);
3877
3912
  },
3913
+ bootstrap(app) {
3914
+ if (typeof historyAdmin.bootstrap === "function") {
3915
+ historyAdmin.bootstrap(app);
3916
+ }
3917
+ },
3878
3918
  async registerTrads({ locales }) {
3879
3919
  const importedTrads = await Promise.all(
3880
3920
  locales.map((locale) => {
3881
- 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-BN1bvFK7.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 }) => {
3921
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-uOUIxfcQ.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
3882
3922
  return {
3883
3923
  data: prefixPluginTranslations(data, PLUGIN_ID),
3884
3924
  locale
@@ -3922,7 +3962,6 @@ exports.getDisplayName = getDisplayName;
3922
3962
  exports.getMainField = getMainField;
3923
3963
  exports.getTranslation = getTranslation;
3924
3964
  exports.index = index;
3925
- exports.routes = routes;
3926
3965
  exports.setInitialData = setInitialData;
3927
3966
  exports.useContentTypeSchema = useContentTypeSchema;
3928
3967
  exports.useDoc = useDoc;
@@ -3936,4 +3975,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
3936
3975
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
3937
3976
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
3938
3977
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
3939
- //# sourceMappingURL=index-DzN3kBgx.js.map
3978
+ //# sourceMappingURL=index-CdT0kHZ8.js.map