@strapi/content-manager 5.0.0-beta.8 → 5.0.0-rc.0

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 (100) hide show
  1. package/LICENSE +18 -3
  2. package/dist/_chunks/{ComponentConfigurationPage-by0e_kNd.js → ComponentConfigurationPage-DVY3LwHo.js} +3 -3
  3. package/dist/_chunks/{ComponentConfigurationPage-by0e_kNd.js.map → ComponentConfigurationPage-DVY3LwHo.js.map} +1 -1
  4. package/dist/_chunks/{ComponentConfigurationPage-CuWgXugY.mjs → ComponentConfigurationPage-Dy9BQQ2V.mjs} +3 -3
  5. package/dist/_chunks/{ComponentConfigurationPage-CuWgXugY.mjs.map → ComponentConfigurationPage-Dy9BQQ2V.mjs.map} +1 -1
  6. package/dist/_chunks/{EditConfigurationPage-DbI4KMyz.mjs → EditConfigurationPage-DbR8mWH5.mjs} +3 -3
  7. package/dist/_chunks/{EditConfigurationPage-DbI4KMyz.mjs.map → EditConfigurationPage-DbR8mWH5.mjs.map} +1 -1
  8. package/dist/_chunks/{EditConfigurationPage-CqBeCPGH.js → EditConfigurationPage-b6V7YHfo.js} +3 -3
  9. package/dist/_chunks/{EditConfigurationPage-CqBeCPGH.js.map → EditConfigurationPage-b6V7YHfo.js.map} +1 -1
  10. package/dist/_chunks/{EditViewPage-dFPBya9U.mjs → EditViewPage-CPrukwtO.mjs} +46 -46
  11. package/dist/_chunks/EditViewPage-CPrukwtO.mjs.map +1 -0
  12. package/dist/_chunks/{EditViewPage-ChgloMyO.js → EditViewPage-DhttErmY.js} +45 -45
  13. package/dist/_chunks/EditViewPage-DhttErmY.js.map +1 -0
  14. package/dist/_chunks/{Field-dLk-vgLL.js → Field-CBRV4uan.js} +416 -136
  15. package/dist/_chunks/Field-CBRV4uan.js.map +1 -0
  16. package/dist/_chunks/{Field-C1nUKcdS.mjs → Field-DrgIgQPw.mjs} +417 -137
  17. package/dist/_chunks/Field-DrgIgQPw.mjs.map +1 -0
  18. package/dist/_chunks/{Form-CbXtmHC_.js → Form-Bk3v7Frl.js} +25 -26
  19. package/dist/_chunks/Form-Bk3v7Frl.js.map +1 -0
  20. package/dist/_chunks/{Form-DOlpi7Js.mjs → Form-Dxk4txLJ.mjs} +27 -28
  21. package/dist/_chunks/Form-Dxk4txLJ.mjs.map +1 -0
  22. package/dist/_chunks/{History-BFNUAiGc.mjs → History-DSU-y4Hg.mjs} +126 -31
  23. package/dist/_chunks/History-DSU-y4Hg.mjs.map +1 -0
  24. package/dist/_chunks/{History-BjDfohBr.js → History-xNH_9UuV.js} +125 -30
  25. package/dist/_chunks/History-xNH_9UuV.js.map +1 -0
  26. package/dist/_chunks/{ListConfigurationPage-IQBgWTaa.js → ListConfigurationPage-BCPzXk5W.js} +48 -47
  27. package/dist/_chunks/ListConfigurationPage-BCPzXk5W.js.map +1 -0
  28. package/dist/_chunks/{ListConfigurationPage-DDi0KqFm.mjs → ListConfigurationPage-BWwZ-uMJ.mjs} +49 -49
  29. package/dist/_chunks/ListConfigurationPage-BWwZ-uMJ.mjs.map +1 -0
  30. package/dist/_chunks/{ListViewPage-BPjljUsH.mjs → ListViewPage-D9UmehuA.mjs} +74 -70
  31. package/dist/_chunks/ListViewPage-D9UmehuA.mjs.map +1 -0
  32. package/dist/_chunks/{ListViewPage-CZYGqlvF.js → ListViewPage-ZIvstfvl.js} +72 -68
  33. package/dist/_chunks/ListViewPage-ZIvstfvl.js.map +1 -0
  34. package/dist/_chunks/{NoContentTypePage-DaWw67K-.mjs → NoContentTypePage-CstnyWv2.mjs} +2 -2
  35. package/dist/_chunks/{NoContentTypePage-DaWw67K-.mjs.map → NoContentTypePage-CstnyWv2.mjs.map} +1 -1
  36. package/dist/_chunks/{NoContentTypePage-BOAI6VZ1.js → NoContentTypePage-h7FcuMjI.js} +2 -2
  37. package/dist/_chunks/{NoContentTypePage-BOAI6VZ1.js.map → NoContentTypePage-h7FcuMjI.js.map} +1 -1
  38. package/dist/_chunks/{NoPermissionsPage-cYEtLc_e.js → NoPermissionsPage-DofU68cO.js} +2 -2
  39. package/dist/_chunks/{NoPermissionsPage-cYEtLc_e.js.map → NoPermissionsPage-DofU68cO.js.map} +1 -1
  40. package/dist/_chunks/{NoPermissionsPage-CZrJH00p.mjs → NoPermissionsPage-aFCCLbsf.mjs} +2 -2
  41. package/dist/_chunks/{NoPermissionsPage-CZrJH00p.mjs.map → NoPermissionsPage-aFCCLbsf.mjs.map} +1 -1
  42. package/dist/_chunks/{Relations-DTowyge2.mjs → Relations-7v66IP7b.mjs} +4 -4
  43. package/dist/_chunks/Relations-7v66IP7b.mjs.map +1 -0
  44. package/dist/_chunks/{Relations-DU6B7irU.js → Relations-DAS_DKG5.js} +4 -4
  45. package/dist/_chunks/Relations-DAS_DKG5.js.map +1 -0
  46. package/dist/_chunks/{en-GCOTL6jR.mjs → en-BrCTWlZv.mjs} +9 -4
  47. package/dist/_chunks/{en-GCOTL6jR.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
  48. package/dist/_chunks/{en-DTULi5-d.js → en-uOUIxfcQ.js} +9 -4
  49. package/dist/_chunks/{en-DTULi5-d.js.map → en-uOUIxfcQ.js.map} +1 -1
  50. package/dist/_chunks/{index-CCJeB7Rw.js → index-CAlLHIrI.js} +1198 -784
  51. package/dist/_chunks/index-CAlLHIrI.js.map +1 -0
  52. package/dist/_chunks/{index-BaGHmIir.mjs → index-DIQ7Io-l.mjs} +1229 -815
  53. package/dist/_chunks/index-DIQ7Io-l.mjs.map +1 -0
  54. package/dist/_chunks/{layout-ni_L9kT1.js → layout-B1ZS-usI.js} +21 -16
  55. package/dist/_chunks/layout-B1ZS-usI.js.map +1 -0
  56. package/dist/_chunks/{layout-BinjszSQ.mjs → layout-DHe2GdT4.mjs} +22 -17
  57. package/dist/_chunks/layout-DHe2GdT4.mjs.map +1 -0
  58. package/dist/_chunks/{relations-c91ji5eR.mjs → relations-BUieBWhT.mjs} +2 -2
  59. package/dist/_chunks/{relations-c91ji5eR.mjs.map → relations-BUieBWhT.mjs.map} +1 -1
  60. package/dist/_chunks/{relations-CeJAJc5I.js → relations-yXHkSG1Z.js} +2 -2
  61. package/dist/_chunks/{relations-CeJAJc5I.js.map → relations-yXHkSG1Z.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/hooks/useDocumentActions.d.ts +1 -1
  66. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
  67. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
  68. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
  69. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +2 -10
  70. package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
  71. package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
  72. package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +14 -0
  73. package/dist/server/index.js +26 -17
  74. package/dist/server/index.js.map +1 -1
  75. package/dist/server/index.mjs +26 -17
  76. package/dist/server/index.mjs.map +1 -1
  77. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  78. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  79. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  80. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  81. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  82. package/package.json +8 -8
  83. package/dist/_chunks/EditViewPage-ChgloMyO.js.map +0 -1
  84. package/dist/_chunks/EditViewPage-dFPBya9U.mjs.map +0 -1
  85. package/dist/_chunks/Field-C1nUKcdS.mjs.map +0 -1
  86. package/dist/_chunks/Field-dLk-vgLL.js.map +0 -1
  87. package/dist/_chunks/Form-CbXtmHC_.js.map +0 -1
  88. package/dist/_chunks/Form-DOlpi7Js.mjs.map +0 -1
  89. package/dist/_chunks/History-BFNUAiGc.mjs.map +0 -1
  90. package/dist/_chunks/History-BjDfohBr.js.map +0 -1
  91. package/dist/_chunks/ListConfigurationPage-DDi0KqFm.mjs.map +0 -1
  92. package/dist/_chunks/ListConfigurationPage-IQBgWTaa.js.map +0 -1
  93. package/dist/_chunks/ListViewPage-BPjljUsH.mjs.map +0 -1
  94. package/dist/_chunks/ListViewPage-CZYGqlvF.js.map +0 -1
  95. package/dist/_chunks/Relations-DTowyge2.mjs.map +0 -1
  96. package/dist/_chunks/Relations-DU6B7irU.js.map +0 -1
  97. package/dist/_chunks/index-BaGHmIir.mjs.map +0 -1
  98. package/dist/_chunks/index-CCJeB7Rw.js.map +0 -1
  99. package/dist/_chunks/layout-BinjszSQ.mjs.map +0 -1
  100. package/dist/_chunks/layout-ni_L9kT1.js.map +0 -1
@@ -219,6 +219,7 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
219
219
  ]
220
220
  });
221
221
  const documentApi = contentManagerApi.injectEndpoints({
222
+ overrideExisting: true,
222
223
  endpoints: (builder) => ({
223
224
  autoCloneDocument: builder.mutation({
224
225
  query: ({ model, sourceId, query }) => ({
@@ -620,11 +621,11 @@ const createAttributeSchema = (attribute) => {
620
621
  }
621
622
  };
622
623
  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
- });
624
+ if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
625
+ return schema.min(1, strapiAdmin.translatedErrors.required);
626
+ }
627
+ if (attribute.required && attribute.type !== "relation") {
628
+ return schema.required(strapiAdmin.translatedErrors.required);
628
629
  }
629
630
  return schema?.nullable ? schema.nullable() : (
630
631
  // In some cases '.nullable' will not be available on the schema.
@@ -658,6 +659,28 @@ const addMaxLengthValidation = (attribute) => (schema) => {
658
659
  const addMinValidation = (attribute) => (schema) => {
659
660
  if ("min" in attribute) {
660
661
  const min = toInteger(attribute.min);
662
+ if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
663
+ if (!attribute.required && "test" in schema && min) {
664
+ return schema.test(
665
+ "custom-min",
666
+ {
667
+ ...strapiAdmin.translatedErrors.min,
668
+ values: {
669
+ min: attribute.min
670
+ }
671
+ },
672
+ (value) => {
673
+ if (!value) {
674
+ return true;
675
+ }
676
+ if (Array.isArray(value) && value.length === 0) {
677
+ return true;
678
+ }
679
+ return value.length >= min;
680
+ }
681
+ );
682
+ }
683
+ }
661
684
  if ("min" in schema && min) {
662
685
  return schema.min(min, {
663
686
  ...strapiAdmin.translatedErrors.min,
@@ -784,7 +807,10 @@ const useDocument = (args, opts) => {
784
807
  isLoading: isLoadingDocument,
785
808
  isFetching: isFetchingDocument,
786
809
  error
787
- } = useGetDocumentQuery(args, opts);
810
+ } = useGetDocumentQuery(args, {
811
+ ...opts,
812
+ skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
813
+ });
788
814
  const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
789
815
  React__namespace.useEffect(() => {
790
816
  if (error) {
@@ -948,12 +974,13 @@ const useDocumentActions = () => {
948
974
  );
949
975
  const [discardDocument] = useDiscardDocumentMutation();
950
976
  const discard = React__namespace.useCallback(
951
- async ({ collectionType, model, documentId }) => {
977
+ async ({ collectionType, model, documentId, params }) => {
952
978
  try {
953
979
  const res = await discardDocument({
954
980
  collectionType,
955
981
  model,
956
- documentId
982
+ documentId,
983
+ params
957
984
  });
958
985
  if ("error" in res) {
959
986
  toggleNotification({
@@ -1285,7 +1312,7 @@ const useDocumentActions = () => {
1285
1312
  };
1286
1313
  };
1287
1314
  const ProtectedHistoryPage = React.lazy(
1288
- () => Promise.resolve().then(() => require("./History-BjDfohBr.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1315
+ () => Promise.resolve().then(() => require("./History-xNH_9UuV.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1289
1316
  );
1290
1317
  const routes$1 = [
1291
1318
  {
@@ -1298,31 +1325,31 @@ const routes$1 = [
1298
1325
  }
1299
1326
  ];
1300
1327
  const ProtectedEditViewPage = React.lazy(
1301
- () => Promise.resolve().then(() => require("./EditViewPage-ChgloMyO.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1328
+ () => Promise.resolve().then(() => require("./EditViewPage-DhttErmY.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1302
1329
  );
1303
1330
  const ProtectedListViewPage = React.lazy(
1304
- () => Promise.resolve().then(() => require("./ListViewPage-CZYGqlvF.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1331
+ () => Promise.resolve().then(() => require("./ListViewPage-ZIvstfvl.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1305
1332
  );
1306
1333
  const ProtectedListConfiguration = React.lazy(
1307
- () => Promise.resolve().then(() => require("./ListConfigurationPage-IQBgWTaa.js")).then((mod) => ({
1334
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-BCPzXk5W.js")).then((mod) => ({
1308
1335
  default: mod.ProtectedListConfiguration
1309
1336
  }))
1310
1337
  );
1311
1338
  const ProtectedEditConfigurationPage = React.lazy(
1312
- () => Promise.resolve().then(() => require("./EditConfigurationPage-CqBeCPGH.js")).then((mod) => ({
1339
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-b6V7YHfo.js")).then((mod) => ({
1313
1340
  default: mod.ProtectedEditConfigurationPage
1314
1341
  }))
1315
1342
  );
1316
1343
  const ProtectedComponentConfigurationPage = React.lazy(
1317
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-by0e_kNd.js")).then((mod) => ({
1344
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-DVY3LwHo.js")).then((mod) => ({
1318
1345
  default: mod.ProtectedComponentConfigurationPage
1319
1346
  }))
1320
1347
  );
1321
1348
  const NoPermissions = React.lazy(
1322
- () => Promise.resolve().then(() => require("./NoPermissionsPage-cYEtLc_e.js")).then((mod) => ({ default: mod.NoPermissions }))
1349
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-DofU68cO.js")).then((mod) => ({ default: mod.NoPermissions }))
1323
1350
  );
1324
1351
  const NoContentType = React.lazy(
1325
- () => Promise.resolve().then(() => require("./NoContentTypePage-BOAI6VZ1.js")).then((mod) => ({ default: mod.NoContentType }))
1352
+ () => Promise.resolve().then(() => require("./NoContentTypePage-h7FcuMjI.js")).then((mod) => ({ default: mod.NoContentType }))
1326
1353
  );
1327
1354
  const CollectionTypePages = () => {
1328
1355
  const { collectionType } = reactRouterDom.useParams();
@@ -1449,7 +1476,7 @@ const DocumentActionButton = (action) => {
1449
1476
  DocumentActionConfirmDialog,
1450
1477
  {
1451
1478
  ...action.dialog,
1452
- variant: action.variant,
1479
+ variant: action.dialog?.variant ?? action.variant,
1453
1480
  isOpen: dialogId === action.id,
1454
1481
  onClose: handleClose
1455
1482
  }
@@ -1529,7 +1556,7 @@ const DocumentActionsMenu = ({
1529
1556
  display: "block",
1530
1557
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
1531
1558
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1532
- action.icon,
1559
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "span", color: convertActionVariantToIconColor(action.variant), children: action.icon }),
1533
1560
  action.label
1534
1561
  ] }),
1535
1562
  action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
@@ -1590,6 +1617,18 @@ const convertActionVariantToColor = (variant = "secondary") => {
1590
1617
  return "primary600";
1591
1618
  }
1592
1619
  };
1620
+ const convertActionVariantToIconColor = (variant = "secondary") => {
1621
+ switch (variant) {
1622
+ case "danger":
1623
+ return "danger600";
1624
+ case "secondary":
1625
+ return "neutral500";
1626
+ case "success":
1627
+ return "success600";
1628
+ default:
1629
+ return "primary600";
1630
+ }
1631
+ };
1593
1632
  const DocumentActionConfirmDialog = ({
1594
1633
  onClose,
1595
1634
  onCancel,
@@ -1612,22 +1651,20 @@ const DocumentActionConfirmDialog = ({
1612
1651
  }
1613
1652
  onClose();
1614
1653
  };
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
- ] });
1654
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
1655
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
1656
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
1657
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
1658
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
1659
+ id: "app.components.Button.cancel",
1660
+ defaultMessage: "Cancel"
1661
+ }) }) }),
1662
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
1663
+ id: "app.components.Button.confirm",
1664
+ defaultMessage: "Confirm"
1665
+ }) })
1666
+ ] })
1667
+ ] }) });
1631
1668
  };
1632
1669
  const DocumentActionModal = ({
1633
1670
  isOpen,
@@ -1637,36 +1674,19 @@ const DocumentActionModal = ({
1637
1674
  content: Content,
1638
1675
  onModalClose
1639
1676
  }) => {
1640
- const id = React__namespace.useId();
1641
- if (!isOpen) {
1642
- return null;
1643
- }
1644
1677
  const handleClose = () => {
1645
1678
  if (onClose) {
1646
1679
  onClose();
1647
1680
  }
1648
1681
  onModalClose();
1649
1682
  };
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
- ] });
1683
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
1684
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: title }) }),
1685
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content }),
1686
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { children: typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer })
1687
+ ] }) });
1668
1688
  };
1669
- const PublishAction = ({
1689
+ const PublishAction$1 = ({
1670
1690
  activeTab,
1671
1691
  documentId,
1672
1692
  model,
@@ -1685,6 +1705,12 @@ const PublishAction = ({
1685
1705
  ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1686
1706
  );
1687
1707
  const { publish } = useDocumentActions();
1708
+ const [
1709
+ countDraftRelations,
1710
+ { isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
1711
+ ] = useLazyGetDraftRelationCountQuery();
1712
+ const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
1713
+ const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
1688
1714
  const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
1689
1715
  const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
1690
1716
  const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
@@ -1693,10 +1719,101 @@ const PublishAction = ({
1693
1719
  const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
1694
1720
  const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
1695
1721
  const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
1722
+ React__namespace.useEffect(() => {
1723
+ if (isErrorDraftRelations) {
1724
+ toggleNotification({
1725
+ type: "danger",
1726
+ message: formatMessage({
1727
+ id: getTranslation("error.records.fetch-draft-relatons"),
1728
+ defaultMessage: "An error occurred while fetching draft relations on this document."
1729
+ })
1730
+ });
1731
+ }
1732
+ }, [isErrorDraftRelations, toggleNotification, formatMessage]);
1733
+ React__namespace.useEffect(() => {
1734
+ const localDraftRelations = /* @__PURE__ */ new Set();
1735
+ const extractDraftRelations = (data) => {
1736
+ const relations = data.connect || [];
1737
+ relations.forEach((relation) => {
1738
+ if (relation.status === "draft") {
1739
+ localDraftRelations.add(relation.id);
1740
+ }
1741
+ });
1742
+ };
1743
+ const traverseAndExtract = (data) => {
1744
+ Object.entries(data).forEach(([key, value]) => {
1745
+ if (key === "connect" && Array.isArray(value)) {
1746
+ extractDraftRelations({ connect: value });
1747
+ } else if (typeof value === "object" && value !== null) {
1748
+ traverseAndExtract(value);
1749
+ }
1750
+ });
1751
+ };
1752
+ if (!documentId || modified) {
1753
+ traverseAndExtract(formValues);
1754
+ setLocalCountOfDraftRelations(localDraftRelations.size);
1755
+ }
1756
+ }, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
1757
+ React__namespace.useEffect(() => {
1758
+ if (documentId) {
1759
+ const fetchDraftRelationsCount = async () => {
1760
+ const { data, error } = await countDraftRelations({
1761
+ collectionType,
1762
+ model,
1763
+ documentId,
1764
+ params
1765
+ });
1766
+ if (error) {
1767
+ throw error;
1768
+ }
1769
+ if (data) {
1770
+ setServerCountOfDraftRelations(data.data);
1771
+ }
1772
+ };
1773
+ fetchDraftRelationsCount();
1774
+ }
1775
+ }, [documentId, countDraftRelations, collectionType, model, params]);
1696
1776
  const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1697
1777
  if (!schema?.options?.draftAndPublish) {
1698
1778
  return null;
1699
1779
  }
1780
+ const performPublish = async () => {
1781
+ setSubmitting(true);
1782
+ try {
1783
+ const { errors } = await validate();
1784
+ if (errors) {
1785
+ toggleNotification({
1786
+ type: "danger",
1787
+ message: formatMessage({
1788
+ id: "content-manager.validation.error",
1789
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
1790
+ })
1791
+ });
1792
+ return;
1793
+ }
1794
+ const res = await publish(
1795
+ {
1796
+ collectionType,
1797
+ model,
1798
+ documentId,
1799
+ params
1800
+ },
1801
+ formValues
1802
+ );
1803
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
1804
+ navigate({
1805
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1806
+ search: rawQuery
1807
+ });
1808
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1809
+ setErrors(formatValidationErrors(res.error));
1810
+ }
1811
+ } finally {
1812
+ setSubmitting(false);
1813
+ }
1814
+ };
1815
+ const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
1816
+ const hasDraftRelations = totalDraftRelations > 0;
1700
1817
  return {
1701
1818
  /**
1702
1819
  * Disabled when:
@@ -1709,49 +1826,41 @@ const PublishAction = ({
1709
1826
  * - the user doesn't have the permission to create a new document
1710
1827
  * - the user doesn't have the permission to update the document
1711
1828
  */
1712
- disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
1829
+ disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
1713
1830
  label: formatMessage({
1714
1831
  id: "app.utils.publish",
1715
1832
  defaultMessage: "Publish"
1716
1833
  }),
1717
1834
  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));
1835
+ if (hasDraftRelations) {
1836
+ return;
1837
+ }
1838
+ await performPublish();
1839
+ },
1840
+ dialog: hasDraftRelations ? {
1841
+ type: "dialog",
1842
+ variant: "danger",
1843
+ footer: null,
1844
+ title: formatMessage({
1845
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
1846
+ defaultMessage: "Confirmation"
1847
+ }),
1848
+ content: formatMessage(
1849
+ {
1850
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
1851
+ defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
1852
+ },
1853
+ {
1854
+ count: totalDraftRelations
1747
1855
  }
1748
- } finally {
1749
- setSubmitting(false);
1856
+ ),
1857
+ onConfirm: async () => {
1858
+ await performPublish();
1750
1859
  }
1751
- }
1860
+ } : void 0
1752
1861
  };
1753
1862
  };
1754
- PublishAction.type = "publish";
1863
+ PublishAction$1.type = "publish";
1755
1864
  const UpdateAction = ({
1756
1865
  activeTab,
1757
1866
  documentId,
@@ -1847,10 +1956,13 @@ const UpdateAction = ({
1847
1956
  document
1848
1957
  );
1849
1958
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1850
- navigate({
1851
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1852
- search: rawQuery
1853
- });
1959
+ navigate(
1960
+ {
1961
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1962
+ search: rawQuery
1963
+ },
1964
+ { replace: true }
1965
+ );
1854
1966
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1855
1967
  setErrors(formatValidationErrors(res.error));
1856
1968
  }
@@ -1882,10 +1994,8 @@ const UnpublishAction$1 = ({
1882
1994
  const { toggleNotification } = strapiAdmin.useNotification();
1883
1995
  const [shouldKeepDraft, setShouldKeepDraft] = React__namespace.useState(true);
1884
1996
  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
- }
1997
+ const handleChange = (value) => {
1998
+ setShouldKeepDraft(value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
1889
1999
  };
1890
2000
  if (!schema?.options?.draftAndPublish) {
1891
2001
  return null;
@@ -1935,40 +2045,24 @@ const UnpublishAction$1 = ({
1935
2045
  }) })
1936
2046
  ] }),
1937
2047
  /* @__PURE__ */ jsxRuntime.jsxs(
1938
- designSystem.Flex,
2048
+ designSystem.Radio.Group,
1939
2049
  {
1940
- onChange: handleChange,
1941
- direction: "column",
1942
- alignItems: "flex-start",
1943
- tag: "fieldset",
1944
- borderWidth: 0,
1945
- gap: 3,
2050
+ defaultValue: UNPUBLISH_DRAFT_OPTIONS.KEEP,
2051
+ name: "discard-options",
2052
+ "aria-label": formatMessage({
2053
+ id: "content-manager.actions.unpublish.dialog.radio-label",
2054
+ defaultMessage: "Choose an option to unpublish the document."
2055
+ }),
2056
+ onValueChange: handleChange,
1946
2057
  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
- )
2058
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { checked: shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.KEEP, children: formatMessage({
2059
+ id: "content-manager.actions.unpublish.dialog.option.keep-draft",
2060
+ defaultMessage: "Keep draft"
2061
+ }) }),
2062
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { checked: !shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.DISCARD, children: formatMessage({
2063
+ id: "content-manager.actions.unpublish.dialog.option.replace-draft",
2064
+ defaultMessage: "Replace draft"
2065
+ }) })
1972
2066
  ]
1973
2067
  }
1974
2068
  )
@@ -2057,7 +2151,7 @@ const StyledCrossCircle = styledComponents.styled(Icons.CrossCircle)`
2057
2151
  fill: currentColor;
2058
2152
  }
2059
2153
  `;
2060
- const DEFAULT_ACTIONS = [PublishAction, UpdateAction, UnpublishAction$1, DiscardAction];
2154
+ const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2061
2155
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2062
2156
  const RelativeTime = React__namespace.forwardRef(
2063
2157
  ({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
@@ -2114,23 +2208,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2114
2208
  id: "content-manager.containers.edit.title.new",
2115
2209
  defaultMessage: "Create an entry"
2116
2210
  }) : documentTitle;
2117
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 8, paddingBottom: 4, gap: 3, children: [
2211
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2118
2212
  /* @__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
2213
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2214
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
2215
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
2216
+ ] }),
2217
+ status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
2134
2218
  ] });
2135
2219
  };
2136
2220
  const HeaderToolbar = () => {
@@ -2512,163 +2596,785 @@ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
2512
2596
  }
2513
2597
  );
2514
2598
  });
2515
- const BulkActionsRenderer = () => {
2516
- const plugins = strapiAdmin.useStrapiApp("BulkActionsRenderer", (state) => state.plugins);
2517
- const { model, collectionType } = useDoc();
2518
- const { selectedRows } = strapiAdmin.useTable("BulkActionsRenderer", (state) => state);
2519
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2520
- strapiAdmin.DescriptionComponentRenderer,
2521
- {
2522
- props: {
2523
- model,
2524
- collectionType,
2525
- documents: selectedRows
2526
- },
2527
- descriptions: plugins["content-manager"].apis.getBulkActions(),
2528
- children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsxRuntime.jsx(BulkActionAction, { ...action }, action.id))
2529
- }
2530
- ) });
2599
+ const HOOKS = {
2600
+ /**
2601
+ * Hook that allows to mutate the displayed headers of the list view table
2602
+ * @constant
2603
+ * @type {string}
2604
+ */
2605
+ INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2606
+ /**
2607
+ * Hook that allows to mutate the CM's collection types links pre-set filters
2608
+ * @constant
2609
+ * @type {string}
2610
+ */
2611
+ MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2612
+ /**
2613
+ * Hook that allows to mutate the CM's edit view layout
2614
+ * @constant
2615
+ * @type {string}
2616
+ */
2617
+ MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2618
+ /**
2619
+ * Hook that allows to mutate the CM's single types links pre-set filters
2620
+ * @constant
2621
+ * @type {string}
2622
+ */
2623
+ MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2531
2624
  };
2532
- const BulkActionAction = (action) => {
2533
- const [dialogId, setDialogId] = React__namespace.useState(null);
2534
- const { toggleNotification } = strapiAdmin.useNotification();
2535
- const handleClick = (action2) => (e) => {
2536
- const { onClick, dialog, id } = action2;
2537
- if (onClick) {
2538
- onClick(e);
2539
- }
2540
- if (dialog) {
2541
- switch (dialog.type) {
2542
- case "notification":
2543
- toggleNotification({
2544
- title: dialog.title,
2545
- message: dialog.content,
2546
- type: dialog.status,
2547
- timeout: dialog.timeout,
2548
- onClose: dialog.onClose
2549
- });
2550
- break;
2551
- case "dialog":
2552
- case "modal": {
2553
- e.preventDefault();
2554
- setDialogId(id);
2555
- }
2556
- }
2557
- }
2625
+ const contentTypesApi = contentManagerApi.injectEndpoints({
2626
+ endpoints: (builder) => ({
2627
+ getContentTypeConfiguration: builder.query({
2628
+ query: (uid) => ({
2629
+ url: `/content-manager/content-types/${uid}/configuration`,
2630
+ method: "GET"
2631
+ }),
2632
+ transformResponse: (response) => response.data,
2633
+ providesTags: (_result, _error, uid) => [
2634
+ { type: "ContentTypesConfiguration", id: uid },
2635
+ { type: "ContentTypeSettings", id: "LIST" }
2636
+ ]
2637
+ }),
2638
+ getAllContentTypeSettings: builder.query({
2639
+ query: () => "/content-manager/content-types-settings",
2640
+ transformResponse: (response) => response.data,
2641
+ providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2642
+ }),
2643
+ updateContentTypeConfiguration: builder.mutation({
2644
+ query: ({ uid, ...body }) => ({
2645
+ url: `/content-manager/content-types/${uid}/configuration`,
2646
+ method: "PUT",
2647
+ data: body
2648
+ }),
2649
+ transformResponse: (response) => response.data,
2650
+ invalidatesTags: (_result, _error, { uid }) => [
2651
+ { type: "ContentTypesConfiguration", id: uid },
2652
+ { type: "ContentTypeSettings", id: "LIST" },
2653
+ // Is this necessary?
2654
+ { type: "InitialData" }
2655
+ ]
2656
+ })
2657
+ })
2658
+ });
2659
+ const {
2660
+ useGetContentTypeConfigurationQuery,
2661
+ useGetAllContentTypeSettingsQuery,
2662
+ useUpdateContentTypeConfigurationMutation
2663
+ } = contentTypesApi;
2664
+ const checkIfAttributeIsDisplayable = (attribute) => {
2665
+ const { type } = attribute;
2666
+ if (type === "relation") {
2667
+ return !attribute.relation.toLowerCase().includes("morph");
2668
+ }
2669
+ return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2670
+ };
2671
+ const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2672
+ if (!mainFieldName) {
2673
+ return void 0;
2674
+ }
2675
+ const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2676
+ // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2677
+ schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2678
+ );
2679
+ return {
2680
+ name: mainFieldName,
2681
+ type: mainFieldType ?? "string"
2558
2682
  };
2559
- const handleClose = () => {
2560
- setDialogId(null);
2561
- if (action.dialog?.type === "modal" && action.dialog?.onClose) {
2562
- action.dialog.onClose();
2683
+ };
2684
+ const DEFAULT_SETTINGS = {
2685
+ bulkable: false,
2686
+ filterable: false,
2687
+ searchable: false,
2688
+ pagination: false,
2689
+ defaultSortBy: "",
2690
+ defaultSortOrder: "asc",
2691
+ mainField: "id",
2692
+ pageSize: 10
2693
+ };
2694
+ const useDocumentLayout = (model) => {
2695
+ const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2696
+ const [{ query }] = strapiAdmin.useQueryParams();
2697
+ const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2698
+ const { toggleNotification } = strapiAdmin.useNotification();
2699
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
2700
+ const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2701
+ const {
2702
+ data,
2703
+ isLoading: isLoadingConfigs,
2704
+ error,
2705
+ isFetching: isFetchingConfigs
2706
+ } = useGetContentTypeConfigurationQuery(model);
2707
+ const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2708
+ React__namespace.useEffect(() => {
2709
+ if (error) {
2710
+ toggleNotification({
2711
+ type: "danger",
2712
+ message: formatAPIError(error)
2713
+ });
2563
2714
  }
2715
+ }, [error, formatAPIError, toggleNotification]);
2716
+ const editLayout = React__namespace.useMemo(
2717
+ () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2718
+ layout: [],
2719
+ components: {},
2720
+ metadatas: {},
2721
+ options: {},
2722
+ settings: DEFAULT_SETTINGS
2723
+ },
2724
+ [data, isLoading, schemas, schema, components]
2725
+ );
2726
+ const listLayout = React__namespace.useMemo(() => {
2727
+ return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2728
+ layout: [],
2729
+ metadatas: {},
2730
+ options: {},
2731
+ settings: DEFAULT_SETTINGS
2732
+ };
2733
+ }, [data, isLoading, schemas, schema, components]);
2734
+ const { layout: edit } = React__namespace.useMemo(
2735
+ () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2736
+ layout: editLayout,
2737
+ query
2738
+ }),
2739
+ [editLayout, query, runHookWaterfall]
2740
+ );
2741
+ return {
2742
+ error,
2743
+ isLoading,
2744
+ edit,
2745
+ list: listLayout
2564
2746
  };
2565
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2566
- /* @__PURE__ */ jsxRuntime.jsx(
2567
- designSystem.Button,
2568
- {
2569
- disabled: action.disabled,
2570
- startIcon: action.icon,
2571
- variant: action.variant,
2572
- onClick: handleClick(action),
2573
- children: action.label
2574
- }
2575
- ),
2576
- action.dialog?.type === "dialog" ? /* @__PURE__ */ jsxRuntime.jsx(
2577
- BulkActionConfirmDialog,
2578
- {
2579
- ...action.dialog,
2580
- variant: action.variant,
2581
- isOpen: dialogId === action.id,
2582
- onClose: handleClose
2583
- }
2584
- ) : null,
2585
- action.dialog?.type === "modal" ? /* @__PURE__ */ jsxRuntime.jsx(
2586
- BulkActionModal,
2587
- {
2588
- ...action.dialog,
2589
- onModalClose: handleClose,
2590
- isOpen: dialogId === action.id
2591
- }
2592
- ) : null
2593
- ] });
2594
2747
  };
2595
- const BulkActionConfirmDialog = ({
2596
- onClose,
2597
- onCancel,
2598
- onConfirm,
2599
- title,
2600
- content,
2601
- confirmButton,
2602
- isOpen,
2603
- variant = "secondary"
2748
+ const useDocLayout = () => {
2749
+ const { model } = useDoc();
2750
+ return useDocumentLayout(model);
2751
+ };
2752
+ const formatEditLayout = (data, {
2753
+ schemas,
2754
+ schema,
2755
+ components
2604
2756
  }) => {
2605
- const { formatMessage } = reactIntl.useIntl();
2606
- const handleClose = async () => {
2607
- if (onCancel) {
2608
- await onCancel();
2757
+ let currentPanelIndex = 0;
2758
+ const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2759
+ data.contentType.layouts.edit,
2760
+ schema?.attributes,
2761
+ data.contentType.metadatas,
2762
+ { configurations: data.components, schemas: components },
2763
+ schemas
2764
+ ).reduce((panels, row) => {
2765
+ if (row.some((field) => field.type === "dynamiczone")) {
2766
+ panels.push([row]);
2767
+ currentPanelIndex += 2;
2768
+ } else {
2769
+ if (!panels[currentPanelIndex]) {
2770
+ panels.push([]);
2771
+ }
2772
+ panels[currentPanelIndex].push(row);
2609
2773
  }
2610
- onClose();
2611
- };
2612
- const handleConfirm = async () => {
2613
- if (onConfirm) {
2614
- await onConfirm();
2774
+ return panels;
2775
+ }, []);
2776
+ const componentEditAttributes = Object.entries(data.components).reduce(
2777
+ (acc, [uid, configuration]) => {
2778
+ acc[uid] = {
2779
+ layout: convertEditLayoutToFieldLayouts(
2780
+ configuration.layouts.edit,
2781
+ components[uid].attributes,
2782
+ configuration.metadatas
2783
+ ),
2784
+ settings: {
2785
+ ...configuration.settings,
2786
+ icon: components[uid].info.icon,
2787
+ displayName: components[uid].info.displayName
2788
+ }
2789
+ };
2790
+ return acc;
2791
+ },
2792
+ {}
2793
+ );
2794
+ const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2795
+ (acc, [attribute, metadata]) => {
2796
+ return {
2797
+ ...acc,
2798
+ [attribute]: metadata.edit
2799
+ };
2800
+ },
2801
+ {}
2802
+ );
2803
+ return {
2804
+ layout: panelledEditAttributes,
2805
+ components: componentEditAttributes,
2806
+ metadatas: editMetadatas,
2807
+ settings: {
2808
+ ...data.contentType.settings,
2809
+ displayName: schema?.info.displayName
2810
+ },
2811
+ options: {
2812
+ ...schema?.options,
2813
+ ...schema?.pluginOptions,
2814
+ ...data.contentType.options
2615
2815
  }
2616
- onClose();
2617
2816
  };
2618
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog, { isOpen, title, onClose: handleClose, children: [
2619
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.DialogBody, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}), children: content }),
2620
- /* @__PURE__ */ jsxRuntime.jsx(
2621
- designSystem.DialogFooter,
2622
- {
2623
- startAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
2624
- id: "app.components.Button.cancel",
2625
- defaultMessage: "Cancel"
2626
- }) }),
2627
- endAction: /* @__PURE__ */ jsxRuntime.jsx(
2628
- designSystem.Button,
2629
- {
2630
- onClick: handleConfirm,
2631
- variant: variant === "danger-light" ? variant : "secondary",
2632
- startIcon: variant === "danger-light" ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
2633
- children: confirmButton ? confirmButton : formatMessage({
2634
- id: "app.components.Button.confirm",
2635
- defaultMessage: "Confirm"
2636
- })
2637
- }
2638
- )
2817
+ };
2818
+ const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2819
+ return rows.map(
2820
+ (row) => row.map((field) => {
2821
+ const attribute = attributes[field.name];
2822
+ if (!attribute) {
2823
+ return null;
2639
2824
  }
2640
- )
2641
- ] });
2825
+ const { edit: metadata } = metadatas[field.name];
2826
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2827
+ return {
2828
+ attribute,
2829
+ disabled: !metadata.editable,
2830
+ hint: metadata.description,
2831
+ label: metadata.label ?? "",
2832
+ name: field.name,
2833
+ // @ts-expect-error – mainField does exist on the metadata for a relation.
2834
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2835
+ schemas,
2836
+ components: components?.schemas ?? {}
2837
+ }),
2838
+ placeholder: metadata.placeholder ?? "",
2839
+ required: attribute.required ?? false,
2840
+ size: field.size,
2841
+ unique: "unique" in attribute ? attribute.unique : false,
2842
+ visible: metadata.visible ?? true,
2843
+ type: attribute.type
2844
+ };
2845
+ }).filter((field) => field !== null)
2846
+ );
2642
2847
  };
2643
- const BulkActionModal = ({
2644
- isOpen,
2645
- title,
2646
- onClose,
2647
- content: Content,
2648
- onModalClose
2848
+ const formatListLayout = (data, {
2849
+ schemas,
2850
+ schema,
2851
+ components
2649
2852
  }) => {
2650
- const id = React__namespace.useId();
2651
- if (!isOpen) {
2652
- return null;
2653
- }
2654
- const handleClose = () => {
2655
- if (onClose) {
2656
- onClose();
2853
+ const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2854
+ (acc, [attribute, metadata]) => {
2855
+ return {
2856
+ ...acc,
2857
+ [attribute]: metadata.list
2858
+ };
2859
+ },
2860
+ {}
2861
+ );
2862
+ const listAttributes = convertListLayoutToFieldLayouts(
2863
+ data.contentType.layouts.list,
2864
+ schema?.attributes,
2865
+ listMetadatas,
2866
+ { configurations: data.components, schemas: components },
2867
+ schemas
2868
+ );
2869
+ return {
2870
+ layout: listAttributes,
2871
+ settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2872
+ metadatas: listMetadatas,
2873
+ options: {
2874
+ ...schema?.options,
2875
+ ...schema?.pluginOptions,
2876
+ ...data.contentType.options
2657
2877
  }
2658
- onModalClose();
2659
2878
  };
2660
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
2661
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
2662
- /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose })
2663
- ] });
2664
2879
  };
2665
- const DeleteAction = ({ documents, model }) => {
2666
- const { formatMessage } = reactIntl.useIntl();
2667
- const { schema: contentType } = useDoc();
2668
- const selectRow = strapiAdmin.useTable("DeleteAction", (state) => state.selectRow);
2669
- const hasI18nEnabled = Boolean(contentType?.pluginOptions?.i18n);
2670
- const [{ query }] = strapiAdmin.useQueryParams();
2671
- const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
2880
+ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2881
+ return columns.map((name) => {
2882
+ const attribute = attributes[name];
2883
+ if (!attribute) {
2884
+ return null;
2885
+ }
2886
+ const metadata = metadatas[name];
2887
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2888
+ return {
2889
+ attribute,
2890
+ label: metadata.label ?? "",
2891
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2892
+ schemas,
2893
+ components: components?.schemas ?? {}
2894
+ }),
2895
+ name,
2896
+ searchable: metadata.searchable ?? true,
2897
+ sortable: metadata.sortable ?? true
2898
+ };
2899
+ }).filter((field) => field !== null);
2900
+ };
2901
+ const ConfirmBulkActionDialog = ({
2902
+ onToggleDialog,
2903
+ isOpen = false,
2904
+ dialogBody,
2905
+ endAction
2906
+ }) => {
2907
+ const { formatMessage } = reactIntl.useIntl();
2908
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2909
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
2910
+ id: "app.components.ConfirmDialog.title",
2911
+ defaultMessage: "Confirmation"
2912
+ }) }),
2913
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
2914
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
2915
+ dialogBody
2916
+ ] }) }),
2917
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
2918
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
2919
+ id: "app.components.Button.cancel",
2920
+ defaultMessage: "Cancel"
2921
+ }) }) }),
2922
+ endAction
2923
+ ] })
2924
+ ] }) });
2925
+ };
2926
+ const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
2927
+ const ConfirmDialogPublishAll = ({
2928
+ isOpen,
2929
+ onToggleDialog,
2930
+ isConfirmButtonLoading = false,
2931
+ onConfirm
2932
+ }) => {
2933
+ const { formatMessage } = reactIntl.useIntl();
2934
+ const selectedEntries = strapiAdmin.useTable("ConfirmDialogPublishAll", (state) => state.selectedRows);
2935
+ const { toggleNotification } = strapiAdmin.useNotification();
2936
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler(getTranslation);
2937
+ const { model, schema } = useDoc();
2938
+ const [{ query }] = strapiAdmin.useQueryParams();
2939
+ const {
2940
+ data: countDraftRelations = 0,
2941
+ isLoading,
2942
+ error
2943
+ } = useGetManyDraftRelationCountQuery(
2944
+ {
2945
+ model,
2946
+ documentIds: selectedEntries.map((entry) => entry.documentId),
2947
+ locale: query?.plugins?.i18n?.locale
2948
+ },
2949
+ {
2950
+ skip: selectedEntries.length === 0
2951
+ }
2952
+ );
2953
+ React__namespace.useEffect(() => {
2954
+ if (error) {
2955
+ toggleNotification({ type: "danger", message: formatAPIError(error) });
2956
+ }
2957
+ }, [error, formatAPIError, toggleNotification]);
2958
+ if (error) {
2959
+ return null;
2960
+ }
2961
+ return /* @__PURE__ */ jsxRuntime.jsx(
2962
+ ConfirmBulkActionDialog,
2963
+ {
2964
+ isOpen: isOpen && !isLoading,
2965
+ onToggleDialog,
2966
+ dialogBody: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2967
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: [
2968
+ countDraftRelations > 0 && formatMessage(
2969
+ {
2970
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
2971
+ defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
2972
+ },
2973
+ {
2974
+ b: BoldChunk$1,
2975
+ count: countDraftRelations,
2976
+ entities: selectedEntries.length
2977
+ }
2978
+ ),
2979
+ formatMessage({
2980
+ id: getTranslation("popUpWarning.bodyMessage.contentType.publish.all"),
2981
+ defaultMessage: "Are you sure you want to publish these entries?"
2982
+ })
2983
+ ] }),
2984
+ schema?.pluginOptions && "i18n" in schema.pluginOptions && schema?.pluginOptions.i18n && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger500", textAlign: "center", children: formatMessage(
2985
+ {
2986
+ id: getTranslation("Settings.list.actions.publishAdditionalInfos"),
2987
+ defaultMessage: "This will publish the active locale versions <em>(from Internationalization)</em>"
2988
+ },
2989
+ {
2990
+ em: Emphasis
2991
+ }
2992
+ ) })
2993
+ ] }),
2994
+ endAction: /* @__PURE__ */ jsxRuntime.jsx(
2995
+ designSystem.Button,
2996
+ {
2997
+ onClick: onConfirm,
2998
+ variant: "secondary",
2999
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
3000
+ loading: isConfirmButtonLoading,
3001
+ children: formatMessage({
3002
+ id: "app.utils.publish",
3003
+ defaultMessage: "Publish"
3004
+ })
3005
+ }
3006
+ )
3007
+ }
3008
+ );
3009
+ };
3010
+ const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
3011
+ max-width: 300px;
3012
+ `;
3013
+ const formatErrorMessages = (errors, parentKey, formatMessage) => {
3014
+ const messages = [];
3015
+ Object.entries(errors).forEach(([key, value]) => {
3016
+ const currentKey = parentKey ? `${parentKey}.${key}` : key;
3017
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
3018
+ if ("id" in value && "defaultMessage" in value) {
3019
+ messages.push(
3020
+ formatMessage(
3021
+ {
3022
+ id: `${value.id}.withField`,
3023
+ defaultMessage: value.defaultMessage
3024
+ },
3025
+ { field: currentKey }
3026
+ )
3027
+ );
3028
+ } else {
3029
+ messages.push(
3030
+ ...formatErrorMessages(
3031
+ // @ts-expect-error TODO: check why value is not compatible with FormErrors
3032
+ value,
3033
+ currentKey,
3034
+ formatMessage
3035
+ )
3036
+ );
3037
+ }
3038
+ } else {
3039
+ messages.push(
3040
+ formatMessage(
3041
+ {
3042
+ id: `${value}.withField`,
3043
+ defaultMessage: value
3044
+ },
3045
+ { field: currentKey }
3046
+ )
3047
+ );
3048
+ }
3049
+ });
3050
+ return messages;
3051
+ };
3052
+ const EntryValidationText = ({ validationErrors, status }) => {
3053
+ const { formatMessage } = reactIntl.useIntl();
3054
+ if (validationErrors) {
3055
+ const validationErrorsMessages = formatErrorMessages(validationErrors, "", formatMessage).join(
3056
+ " "
3057
+ );
3058
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3059
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.CrossCircle, { fill: "danger600" }),
3060
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
3061
+ ] });
3062
+ }
3063
+ if (status === "published") {
3064
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3065
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
3066
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
3067
+ id: "content-manager.bulk-publish.already-published",
3068
+ defaultMessage: "Already Published"
3069
+ }) })
3070
+ ] });
3071
+ }
3072
+ if (status === "modified") {
3073
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3074
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowsCounterClockwise, { fill: "alternative600" }),
3075
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
3076
+ id: "content-manager.bulk-publish.modified",
3077
+ defaultMessage: "Ready to publish changes"
3078
+ }) })
3079
+ ] });
3080
+ }
3081
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3082
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
3083
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
3084
+ id: "app.utils.ready-to-publish",
3085
+ defaultMessage: "Ready to publish"
3086
+ }) })
3087
+ ] });
3088
+ };
3089
+ const TABLE_HEADERS = [
3090
+ { name: "id", label: "id" },
3091
+ { name: "name", label: "name" },
3092
+ { name: "status", label: "status" },
3093
+ { name: "publicationStatus", label: "Publication status" }
3094
+ ];
3095
+ const SelectedEntriesTableContent = ({
3096
+ isPublishing,
3097
+ rowsToDisplay = [],
3098
+ entriesToPublish = [],
3099
+ validationErrors = {}
3100
+ }) => {
3101
+ const { pathname } = reactRouterDom.useLocation();
3102
+ const { formatMessage } = reactIntl.useIntl();
3103
+ const {
3104
+ list: {
3105
+ settings: { mainField }
3106
+ }
3107
+ } = useDocLayout();
3108
+ const shouldDisplayMainField = mainField != null && mainField !== "id";
3109
+ return /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
3110
+ /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Head, { children: [
3111
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCheckboxCell, {}),
3112
+ TABLE_HEADERS.filter((head) => head.name !== "name" || shouldDisplayMainField).map(
3113
+ (head) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...head }, head.name)
3114
+ )
3115
+ ] }),
3116
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
3117
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: rowsToDisplay.map((row, index2) => /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Row, { children: [
3118
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, { id: row.id }),
3119
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.id }) }),
3120
+ shouldDisplayMainField && /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row[mainField] }) }),
3121
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: row.status, maxWidth: "min-content" }) }),
3122
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: isPublishing && entriesToPublish.includes(row.documentId) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3123
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
3124
+ id: "content-manager.success.record.publishing",
3125
+ defaultMessage: "Publishing..."
3126
+ }) }),
3127
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true })
3128
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
3129
+ EntryValidationText,
3130
+ {
3131
+ validationErrors: validationErrors[row.documentId],
3132
+ status: row.status
3133
+ }
3134
+ ) }),
3135
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
3136
+ designSystem.IconButton,
3137
+ {
3138
+ tag: reactRouterDom.Link,
3139
+ to: {
3140
+ pathname: `${pathname}/${row.documentId}`,
3141
+ search: row.locale && `?plugins[i18n][locale]=${row.locale}`
3142
+ },
3143
+ state: { from: pathname },
3144
+ label: formatMessage(
3145
+ { id: "app.component.HelperPluginTable.edit", defaultMessage: "Edit {target}" },
3146
+ {
3147
+ target: formatMessage(
3148
+ {
3149
+ id: "content-manager.components.ListViewHelperPluginTable.row-line",
3150
+ defaultMessage: "item line {number}"
3151
+ },
3152
+ { number: index2 + 1 }
3153
+ )
3154
+ }
3155
+ ),
3156
+ target: "_blank",
3157
+ marginLeft: "auto",
3158
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {})
3159
+ }
3160
+ ) })
3161
+ ] }, row.id)) })
3162
+ ] });
3163
+ };
3164
+ const BoldChunk = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
3165
+ const SelectedEntriesModalContent = ({
3166
+ listViewSelectedEntries,
3167
+ toggleModal,
3168
+ setListViewSelectedDocuments,
3169
+ model
3170
+ }) => {
3171
+ const { formatMessage } = reactIntl.useIntl();
3172
+ const { schema, components } = useContentTypeSchema(model);
3173
+ const documentIds = listViewSelectedEntries.map(({ documentId }) => documentId);
3174
+ const [{ query }] = strapiAdmin.useQueryParams();
3175
+ const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
3176
+ const { data, isLoading, isFetching, refetch } = useGetAllDocumentsQuery(
3177
+ {
3178
+ model,
3179
+ params: {
3180
+ page: "1",
3181
+ pageSize: documentIds.length.toString(),
3182
+ sort: query.sort,
3183
+ filters: {
3184
+ documentId: {
3185
+ $in: documentIds
3186
+ }
3187
+ },
3188
+ locale: query.plugins?.i18n?.locale
3189
+ }
3190
+ },
3191
+ {
3192
+ selectFromResult: ({ data: data2, ...restRes }) => ({ data: data2?.results ?? [], ...restRes })
3193
+ }
3194
+ );
3195
+ const { rows, validationErrors } = React__namespace.useMemo(() => {
3196
+ if (data.length > 0 && schema) {
3197
+ const validate = createYupSchema(schema.attributes, components);
3198
+ const validationErrors2 = {};
3199
+ const rows2 = data.map((entry) => {
3200
+ try {
3201
+ validate.validateSync(entry, { abortEarly: false });
3202
+ return entry;
3203
+ } catch (e) {
3204
+ if (e instanceof yup.ValidationError) {
3205
+ validationErrors2[entry.documentId] = strapiAdmin.getYupValidationErrors(e);
3206
+ }
3207
+ return entry;
3208
+ }
3209
+ });
3210
+ return { rows: rows2, validationErrors: validationErrors2 };
3211
+ }
3212
+ return {
3213
+ rows: [],
3214
+ validationErrors: {}
3215
+ };
3216
+ }, [components, data, schema]);
3217
+ const [publishedCount, setPublishedCount] = React__namespace.useState(0);
3218
+ const [isDialogOpen, setIsDialogOpen] = React__namespace.useState(false);
3219
+ const { publishMany: bulkPublishAction } = useDocumentActions();
3220
+ const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
3221
+ const selectedRows = strapiAdmin.useTable("publishAction", (state) => state.selectedRows);
3222
+ const selectedEntries = rows.filter(
3223
+ (entry) => selectedRows.some((selectedEntry) => selectedEntry.documentId === entry.documentId)
3224
+ );
3225
+ const entriesToPublish = selectedEntries.filter((entry) => !validationErrors[entry.documentId]).map((entry) => entry.documentId);
3226
+ const selectedEntriesWithErrorsCount = selectedEntries.filter(
3227
+ ({ documentId }) => validationErrors[documentId]
3228
+ ).length;
3229
+ const selectedEntriesPublished = selectedEntries.filter(
3230
+ ({ status }) => status === "published"
3231
+ ).length;
3232
+ const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublished;
3233
+ const toggleDialog = () => setIsDialogOpen((prev) => !prev);
3234
+ const handleConfirmBulkPublish = async () => {
3235
+ toggleDialog();
3236
+ const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
3237
+ if (!("error" in res)) {
3238
+ setPublishedCount(res.count);
3239
+ const unpublishedEntries = rows.filter((row) => {
3240
+ return !entriesToPublish.includes(row.documentId);
3241
+ });
3242
+ setListViewSelectedDocuments(unpublishedEntries);
3243
+ }
3244
+ };
3245
+ const getFormattedCountMessage = () => {
3246
+ if (publishedCount) {
3247
+ return formatMessage(
3248
+ {
3249
+ id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
3250
+ defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3251
+ },
3252
+ {
3253
+ publishedCount,
3254
+ withErrorsCount: selectedEntriesWithErrorsCount,
3255
+ b: BoldChunk
3256
+ }
3257
+ );
3258
+ }
3259
+ return formatMessage(
3260
+ {
3261
+ id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
3262
+ defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3263
+ },
3264
+ {
3265
+ readyToPublishCount: selectedEntriesWithNoErrorsCount,
3266
+ withErrorsCount: selectedEntriesWithErrorsCount,
3267
+ alreadyPublishedCount: selectedEntriesPublished,
3268
+ b: BoldChunk
3269
+ }
3270
+ );
3271
+ };
3272
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3273
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
3274
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getFormattedCountMessage() }),
3275
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
3276
+ SelectedEntriesTableContent,
3277
+ {
3278
+ isPublishing: isSubmittingForm,
3279
+ rowsToDisplay: rows,
3280
+ entriesToPublish,
3281
+ validationErrors
3282
+ }
3283
+ ) })
3284
+ ] }),
3285
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
3286
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
3287
+ id: "app.components.Button.cancel",
3288
+ defaultMessage: "Cancel"
3289
+ }) }),
3290
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
3291
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
3292
+ /* @__PURE__ */ jsxRuntime.jsx(
3293
+ designSystem.Button,
3294
+ {
3295
+ onClick: toggleDialog,
3296
+ disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3297
+ loading: isSubmittingForm,
3298
+ children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3299
+ }
3300
+ )
3301
+ ] })
3302
+ ] }),
3303
+ /* @__PURE__ */ jsxRuntime.jsx(
3304
+ ConfirmDialogPublishAll,
3305
+ {
3306
+ isOpen: isDialogOpen,
3307
+ onToggleDialog: toggleDialog,
3308
+ isConfirmButtonLoading: isSubmittingForm,
3309
+ onConfirm: handleConfirmBulkPublish
3310
+ }
3311
+ )
3312
+ ] });
3313
+ };
3314
+ const PublishAction = ({ documents, model }) => {
3315
+ const { formatMessage } = reactIntl.useIntl();
3316
+ const hasPublishPermission = useDocumentRBAC("unpublishAction", (state) => state.canPublish);
3317
+ const showPublishButton = hasPublishPermission && documents.some(({ status }) => status !== "published");
3318
+ const setListViewSelectedDocuments = strapiAdmin.useTable("publishAction", (state) => state.selectRow);
3319
+ const refetchList = () => {
3320
+ contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3321
+ };
3322
+ if (!showPublishButton)
3323
+ return null;
3324
+ return {
3325
+ actionType: "publish",
3326
+ variant: "tertiary",
3327
+ label: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" }),
3328
+ dialog: {
3329
+ type: "modal",
3330
+ title: formatMessage({
3331
+ id: getTranslation("containers.ListPage.selectedEntriesModal.title"),
3332
+ defaultMessage: "Publish entries"
3333
+ }),
3334
+ content: ({ onClose }) => {
3335
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Root, { rows: documents, defaultSelectedRows: documents, headers: TABLE_HEADERS, children: /* @__PURE__ */ jsxRuntime.jsx(
3336
+ SelectedEntriesModalContent,
3337
+ {
3338
+ listViewSelectedEntries: documents,
3339
+ toggleModal: () => {
3340
+ onClose();
3341
+ refetchList();
3342
+ },
3343
+ setListViewSelectedDocuments,
3344
+ model
3345
+ }
3346
+ ) });
3347
+ },
3348
+ onClose: () => {
3349
+ refetchList();
3350
+ }
3351
+ }
3352
+ };
3353
+ };
3354
+ const BulkActionsRenderer = () => {
3355
+ const plugins = strapiAdmin.useStrapiApp("BulkActionsRenderer", (state) => state.plugins);
3356
+ const { model, collectionType } = useDoc();
3357
+ const { selectedRows } = strapiAdmin.useTable("BulkActionsRenderer", (state) => state);
3358
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
3359
+ strapiAdmin.DescriptionComponentRenderer,
3360
+ {
3361
+ props: {
3362
+ model,
3363
+ collectionType,
3364
+ documents: selectedRows
3365
+ },
3366
+ descriptions: plugins["content-manager"].apis.getBulkActions(),
3367
+ children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActionButton, { ...action }, action.id))
3368
+ }
3369
+ ) });
3370
+ };
3371
+ const DeleteAction = ({ documents, model }) => {
3372
+ const { formatMessage } = reactIntl.useIntl();
3373
+ const { schema: contentType } = useDoc();
3374
+ const selectRow = strapiAdmin.useTable("DeleteAction", (state) => state.selectRow);
3375
+ const hasI18nEnabled = Boolean(contentType?.pluginOptions?.i18n);
3376
+ const [{ query }] = strapiAdmin.useQueryParams();
3377
+ const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
2672
3378
  const hasDeletePermission = useDocumentRBAC("deleteAction", (state) => state.canDelete);
2673
3379
  const { deleteMany: bulkDeleteAction } = useDocumentActions();
2674
3380
  const documentIds = documents.map(({ documentId }) => documentId);
@@ -2694,6 +3400,7 @@ const DeleteAction = ({ documents, model }) => {
2694
3400
  defaultMessage: "Confirmation"
2695
3401
  }),
2696
3402
  content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3403
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
2697
3404
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
2698
3405
  id: "popUpWarning.bodyMessage.contentType.delete.all",
2699
3406
  defaultMessage: "Are you sure you want to delete these entries?"
@@ -2730,7 +3437,7 @@ const UnpublishAction = ({ documents, model }) => {
2730
3437
  selectRow([]);
2731
3438
  }
2732
3439
  };
2733
- const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published");
3440
+ const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
2734
3441
  if (!showUnpublishButton)
2735
3442
  return null;
2736
3443
  return {
@@ -2743,6 +3450,7 @@ const UnpublishAction = ({ documents, model }) => {
2743
3450
  defaultMessage: "Confirmation"
2744
3451
  }),
2745
3452
  content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3453
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
2746
3454
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
2747
3455
  id: "popUpWarning.bodyMessage.contentType.unpublish.all",
2748
3456
  defaultMessage: "Are you sure you want to unpublish these entries?"
@@ -2767,7 +3475,7 @@ const UnpublishAction = ({ documents, model }) => {
2767
3475
  };
2768
3476
  UnpublishAction.type = "unpublish";
2769
3477
  const Emphasis = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", textColor: "danger500", children: chunks });
2770
- const DEFAULT_BULK_ACTIONS = [UnpublishAction, DeleteAction];
3478
+ const DEFAULT_BULK_ACTIONS = [PublishAction, UnpublishAction, DeleteAction];
2771
3479
  const AutoCloneFailureModalBody = ({ prohibitedFields }) => {
2772
3480
  const { formatMessage } = reactIntl.useIntl();
2773
3481
  const getDefaultErrorMessage = (reason) => {
@@ -2919,503 +3627,201 @@ const CloneAction = ({ model, documentId }) => {
2919
3627
  if (!documentId) {
2920
3628
  console.error(
2921
3629
  "You're trying to clone a document in the table without an id, this is likely a bug with Strapi. Please open an issue."
2922
- );
2923
- toggleNotification({
2924
- message: formatMessage({
2925
- id: "content-manager.actions.clone.error",
2926
- defaultMessage: "An error occurred while trying to clone the document."
2927
- }),
2928
- type: "danger"
2929
- });
2930
- return;
2931
- }
2932
- const res = await autoClone({ model, sourceId: documentId });
2933
- if ("data" in res) {
2934
- navigate(res.data.documentId);
2935
- return true;
2936
- }
2937
- if (isBaseQueryError(res.error) && res.error.details && typeof res.error.details === "object" && "prohibitedFields" in res.error.details && Array.isArray(res.error.details.prohibitedFields)) {
2938
- const prohibitedFields2 = res.error.details.prohibitedFields;
2939
- setProhibitedFields(prohibitedFields2);
2940
- }
2941
- },
2942
- dialog: {
2943
- type: "modal",
2944
- title: formatMessage({
2945
- id: "content-manager.containers.list.autoCloneModal.header",
2946
- defaultMessage: "Duplicate"
2947
- }),
2948
- content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
2949
- footer: ({ onClose }) => {
2950
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
2951
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
2952
- id: "cancel",
2953
- defaultMessage: "Cancel"
2954
- }) }),
2955
- /* @__PURE__ */ jsxRuntime.jsx(
2956
- designSystem.LinkButton,
2957
- {
2958
- tag: reactRouterDom.NavLink,
2959
- to: {
2960
- pathname: `clone/${documentId}`
2961
- },
2962
- children: formatMessage({
2963
- id: "content-manager.containers.list.autoCloneModal.create",
2964
- defaultMessage: "Create"
2965
- })
2966
- }
2967
- )
2968
- ] });
2969
- }
2970
- }
2971
- };
2972
- };
2973
- CloneAction.type = "clone";
2974
- const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
2975
- path {
2976
- fill: currentColor;
2977
- }
2978
- `;
2979
- const DEFAULT_TABLE_ROW_ACTIONS = [EditAction, CloneAction];
2980
- class ContentManagerPlugin {
2981
- /**
2982
- * The following properties are the stored ones provided by any plugins registering with
2983
- * the content-manager. The function calls however, need to be called at runtime in the
2984
- * application, so instead we collate them and run them later with the complete list incl.
2985
- * ones already registered & the context of the view.
2986
- */
2987
- bulkActions = [...DEFAULT_BULK_ACTIONS];
2988
- documentActions = [
2989
- ...DEFAULT_ACTIONS,
2990
- ...DEFAULT_TABLE_ROW_ACTIONS,
2991
- ...DEFAULT_HEADER_ACTIONS,
2992
- HistoryAction
2993
- ];
2994
- editViewSidePanels = [ActionsPanel];
2995
- headerActions = [];
2996
- constructor() {
2997
- }
2998
- addEditViewSidePanel(panels) {
2999
- if (Array.isArray(panels)) {
3000
- this.editViewSidePanels = [...this.editViewSidePanels, ...panels];
3001
- } else if (typeof panels === "function") {
3002
- this.editViewSidePanels = panels(this.editViewSidePanels);
3003
- } else {
3004
- throw new Error(
3005
- `Expected the \`panels\` passed to \`addEditViewSidePanel\` to be an array or a function, but received ${getPrintableType(
3006
- panels
3007
- )}`
3008
- );
3009
- }
3010
- }
3011
- addDocumentAction(actions2) {
3012
- if (Array.isArray(actions2)) {
3013
- this.documentActions = [...this.documentActions, ...actions2];
3014
- } else if (typeof actions2 === "function") {
3015
- this.documentActions = actions2(this.documentActions);
3016
- } else {
3017
- throw new Error(
3018
- `Expected the \`actions\` passed to \`addDocumentAction\` to be an array or a function, but received ${getPrintableType(
3019
- actions2
3020
- )}`
3021
- );
3022
- }
3023
- }
3024
- addDocumentHeaderAction(actions2) {
3025
- if (Array.isArray(actions2)) {
3026
- this.headerActions = [...this.headerActions, ...actions2];
3027
- } else if (typeof actions2 === "function") {
3028
- this.headerActions = actions2(this.headerActions);
3029
- } else {
3030
- throw new Error(
3031
- `Expected the \`actions\` passed to \`addDocumentHeaderAction\` to be an array or a function, but received ${getPrintableType(
3032
- actions2
3033
- )}`
3034
- );
3035
- }
3036
- }
3037
- addBulkAction(actions2) {
3038
- if (Array.isArray(actions2)) {
3039
- this.bulkActions = [...this.bulkActions, ...actions2];
3040
- } else if (typeof actions2 === "function") {
3041
- this.bulkActions = actions2(this.bulkActions);
3042
- } else {
3043
- throw new Error(
3044
- `Expected the \`actions\` passed to \`addBulkAction\` to be an array or a function, but received ${getPrintableType(
3045
- actions2
3046
- )}`
3047
- );
3048
- }
3049
- }
3050
- get config() {
3051
- return {
3052
- id: PLUGIN_ID,
3053
- name: "Content Manager",
3054
- injectionZones: INJECTION_ZONES,
3055
- apis: {
3056
- addBulkAction: this.addBulkAction.bind(this),
3057
- addDocumentAction: this.addDocumentAction.bind(this),
3058
- addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3059
- addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3060
- getBulkActions: () => this.bulkActions,
3061
- getDocumentActions: () => this.documentActions,
3062
- getEditViewSidePanels: () => this.editViewSidePanels,
3063
- getHeaderActions: () => this.headerActions
3064
- }
3065
- };
3066
- }
3067
- }
3068
- const getPrintableType = (value) => {
3069
- const nativeType = typeof value;
3070
- if (nativeType === "object") {
3071
- if (value === null)
3072
- return "null";
3073
- if (Array.isArray(value))
3074
- return "array";
3075
- if (value instanceof Object && value.constructor.name !== "Object") {
3076
- return value.constructor.name;
3077
- }
3078
- }
3079
- return nativeType;
3080
- };
3081
- const initialState = {
3082
- collectionTypeLinks: [],
3083
- components: [],
3084
- fieldSizes: {},
3085
- models: [],
3086
- singleTypeLinks: [],
3087
- isLoading: true
3088
- };
3089
- const appSlice = toolkit.createSlice({
3090
- name: "app",
3091
- initialState,
3092
- reducers: {
3093
- setInitialData(state, action) {
3094
- const {
3095
- authorizedCollectionTypeLinks,
3096
- authorizedSingleTypeLinks,
3097
- components,
3098
- contentTypeSchemas,
3099
- fieldSizes
3100
- } = action.payload;
3101
- state.collectionTypeLinks = authorizedCollectionTypeLinks.filter(
3102
- ({ isDisplayed }) => isDisplayed
3103
- );
3104
- state.singleTypeLinks = authorizedSingleTypeLinks.filter(({ isDisplayed }) => isDisplayed);
3105
- state.components = components;
3106
- state.models = contentTypeSchemas;
3107
- state.fieldSizes = fieldSizes;
3108
- state.isLoading = false;
3109
- }
3110
- }
3111
- });
3112
- const { actions, reducer: reducer$1 } = appSlice;
3113
- const { setInitialData } = actions;
3114
- const reducer = toolkit.combineReducers({
3115
- app: reducer$1
3116
- });
3117
- const HOOKS = {
3118
- /**
3119
- * Hook that allows to mutate the displayed headers of the list view table
3120
- * @constant
3121
- * @type {string}
3122
- */
3123
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
3124
- /**
3125
- * Hook that allows to mutate the CM's collection types links pre-set filters
3126
- * @constant
3127
- * @type {string}
3128
- */
3129
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
3130
- /**
3131
- * Hook that allows to mutate the CM's edit view layout
3132
- * @constant
3133
- * @type {string}
3134
- */
3135
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
3136
- /**
3137
- * Hook that allows to mutate the CM's single types links pre-set filters
3138
- * @constant
3139
- * @type {string}
3140
- */
3141
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
3142
- };
3143
- const contentTypesApi = contentManagerApi.injectEndpoints({
3144
- endpoints: (builder) => ({
3145
- getContentTypeConfiguration: builder.query({
3146
- query: (uid) => ({
3147
- url: `/content-manager/content-types/${uid}/configuration`,
3148
- method: "GET"
3149
- }),
3150
- transformResponse: (response) => response.data,
3151
- providesTags: (_result, _error, uid) => [
3152
- { type: "ContentTypesConfiguration", id: uid },
3153
- { type: "ContentTypeSettings", id: "LIST" }
3154
- ]
3155
- }),
3156
- getAllContentTypeSettings: builder.query({
3157
- query: () => "/content-manager/content-types-settings",
3158
- transformResponse: (response) => response.data,
3159
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
3160
- }),
3161
- updateContentTypeConfiguration: builder.mutation({
3162
- query: ({ uid, ...body }) => ({
3163
- url: `/content-manager/content-types/${uid}/configuration`,
3164
- method: "PUT",
3165
- data: body
3166
- }),
3167
- transformResponse: (response) => response.data,
3168
- invalidatesTags: (_result, _error, { uid }) => [
3169
- { type: "ContentTypesConfiguration", id: uid },
3170
- { type: "ContentTypeSettings", id: "LIST" },
3171
- // Is this necessary?
3172
- { type: "InitialData" }
3173
- ]
3174
- })
3175
- })
3176
- });
3177
- const {
3178
- useGetContentTypeConfigurationQuery,
3179
- useGetAllContentTypeSettingsQuery,
3180
- useUpdateContentTypeConfigurationMutation
3181
- } = contentTypesApi;
3182
- const checkIfAttributeIsDisplayable = (attribute) => {
3183
- const { type } = attribute;
3184
- if (type === "relation") {
3185
- return !attribute.relation.toLowerCase().includes("morph");
3186
- }
3187
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
3188
- };
3189
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
3190
- if (!mainFieldName) {
3191
- return void 0;
3192
- }
3193
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
3194
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
3195
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
3196
- );
3197
- return {
3198
- name: mainFieldName,
3199
- type: mainFieldType ?? "string"
3200
- };
3201
- };
3202
- const DEFAULT_SETTINGS = {
3203
- bulkable: false,
3204
- filterable: false,
3205
- searchable: false,
3206
- pagination: false,
3207
- defaultSortBy: "",
3208
- defaultSortOrder: "asc",
3209
- mainField: "id",
3210
- pageSize: 10
3211
- };
3212
- const useDocumentLayout = (model) => {
3213
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
3214
- const [{ query }] = strapiAdmin.useQueryParams();
3215
- const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
3216
- const { toggleNotification } = strapiAdmin.useNotification();
3217
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
3218
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
3219
- const {
3220
- data,
3221
- isLoading: isLoadingConfigs,
3222
- error,
3223
- isFetching: isFetchingConfigs
3224
- } = useGetContentTypeConfigurationQuery(model);
3225
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
3226
- React__namespace.useEffect(() => {
3227
- if (error) {
3228
- toggleNotification({
3229
- type: "danger",
3230
- message: formatAPIError(error)
3231
- });
3232
- }
3233
- }, [error, formatAPIError, toggleNotification]);
3234
- const editLayout = React__namespace.useMemo(
3235
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
3236
- layout: [],
3237
- components: {},
3238
- metadatas: {},
3239
- options: {},
3240
- settings: DEFAULT_SETTINGS
3241
- },
3242
- [data, isLoading, schemas, schema, components]
3243
- );
3244
- const listLayout = React__namespace.useMemo(() => {
3245
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
3246
- layout: [],
3247
- metadatas: {},
3248
- options: {},
3249
- settings: DEFAULT_SETTINGS
3250
- };
3251
- }, [data, isLoading, schemas, schema, components]);
3252
- const { layout: edit } = React__namespace.useMemo(
3253
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
3254
- layout: editLayout,
3255
- query
3256
- }),
3257
- [editLayout, query, runHookWaterfall]
3258
- );
3259
- return {
3260
- error,
3261
- isLoading,
3262
- edit,
3263
- list: listLayout
3264
- };
3265
- };
3266
- const useDocLayout = () => {
3267
- const { model } = useDoc();
3268
- return useDocumentLayout(model);
3269
- };
3270
- const formatEditLayout = (data, {
3271
- schemas,
3272
- schema,
3273
- components
3274
- }) => {
3275
- let currentPanelIndex = 0;
3276
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
3277
- data.contentType.layouts.edit,
3278
- schema?.attributes,
3279
- data.contentType.metadatas,
3280
- { configurations: data.components, schemas: components },
3281
- schemas
3282
- ).reduce((panels, row) => {
3283
- if (row.some((field) => field.type === "dynamiczone")) {
3284
- panels.push([row]);
3285
- currentPanelIndex += 2;
3286
- } else {
3287
- if (!panels[currentPanelIndex]) {
3288
- panels.push([]);
3289
- }
3290
- panels[currentPanelIndex].push(row);
3291
- }
3292
- return panels;
3293
- }, []);
3294
- const componentEditAttributes = Object.entries(data.components).reduce(
3295
- (acc, [uid, configuration]) => {
3296
- acc[uid] = {
3297
- layout: convertEditLayoutToFieldLayouts(
3298
- configuration.layouts.edit,
3299
- components[uid].attributes,
3300
- configuration.metadatas
3301
- ),
3302
- settings: {
3303
- ...configuration.settings,
3304
- icon: components[uid].info.icon,
3305
- displayName: components[uid].info.displayName
3306
- }
3307
- };
3308
- return acc;
3309
- },
3310
- {}
3311
- );
3312
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
3313
- (acc, [attribute, metadata]) => {
3314
- return {
3315
- ...acc,
3316
- [attribute]: metadata.edit
3317
- };
3318
- },
3319
- {}
3320
- );
3321
- return {
3322
- layout: panelledEditAttributes,
3323
- components: componentEditAttributes,
3324
- metadatas: editMetadatas,
3325
- settings: {
3326
- ...data.contentType.settings,
3327
- displayName: schema?.info.displayName
3328
- },
3329
- options: {
3330
- ...schema?.options,
3331
- ...schema?.pluginOptions,
3332
- ...data.contentType.options
3333
- }
3334
- };
3335
- };
3336
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
3337
- return rows.map(
3338
- (row) => row.map((field) => {
3339
- const attribute = attributes[field.name];
3340
- if (!attribute) {
3341
- return null;
3630
+ );
3631
+ toggleNotification({
3632
+ message: formatMessage({
3633
+ id: "content-manager.actions.clone.error",
3634
+ defaultMessage: "An error occurred while trying to clone the document."
3635
+ }),
3636
+ type: "danger"
3637
+ });
3638
+ return;
3639
+ }
3640
+ const res = await autoClone({ model, sourceId: documentId });
3641
+ if ("data" in res) {
3642
+ navigate(res.data.documentId);
3643
+ return true;
3644
+ }
3645
+ if (isBaseQueryError(res.error) && res.error.details && typeof res.error.details === "object" && "prohibitedFields" in res.error.details && Array.isArray(res.error.details.prohibitedFields)) {
3646
+ const prohibitedFields2 = res.error.details.prohibitedFields;
3647
+ setProhibitedFields(prohibitedFields2);
3342
3648
  }
3343
- const { edit: metadata } = metadatas[field.name];
3344
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
3345
- return {
3346
- attribute,
3347
- disabled: !metadata.editable,
3348
- hint: metadata.description,
3349
- label: metadata.label ?? "",
3350
- name: field.name,
3351
- // @ts-expect-error – mainField does exist on the metadata for a relation.
3352
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
3353
- schemas,
3354
- components: components?.schemas ?? {}
3355
- }),
3356
- placeholder: metadata.placeholder ?? "",
3357
- required: attribute.required ?? false,
3358
- size: field.size,
3359
- unique: "unique" in attribute ? attribute.unique : false,
3360
- visible: metadata.visible ?? true,
3361
- type: attribute.type
3362
- };
3363
- }).filter((field) => field !== null)
3364
- );
3365
- };
3366
- const formatListLayout = (data, {
3367
- schemas,
3368
- schema,
3369
- components
3370
- }) => {
3371
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
3372
- (acc, [attribute, metadata]) => {
3373
- return {
3374
- ...acc,
3375
- [attribute]: metadata.list
3376
- };
3377
3649
  },
3378
- {}
3379
- );
3380
- const listAttributes = convertListLayoutToFieldLayouts(
3381
- data.contentType.layouts.list,
3382
- schema?.attributes,
3383
- listMetadatas,
3384
- { configurations: data.components, schemas: components },
3385
- schemas
3386
- );
3387
- return {
3388
- layout: listAttributes,
3389
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
3390
- metadatas: listMetadatas,
3391
- options: {
3392
- ...schema?.options,
3393
- ...schema?.pluginOptions,
3394
- ...data.contentType.options
3650
+ dialog: {
3651
+ type: "modal",
3652
+ title: formatMessage({
3653
+ id: "content-manager.containers.list.autoCloneModal.header",
3654
+ defaultMessage: "Duplicate"
3655
+ }),
3656
+ content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3657
+ footer: ({ onClose }) => {
3658
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
3659
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3660
+ id: "cancel",
3661
+ defaultMessage: "Cancel"
3662
+ }) }),
3663
+ /* @__PURE__ */ jsxRuntime.jsx(
3664
+ designSystem.LinkButton,
3665
+ {
3666
+ tag: reactRouterDom.NavLink,
3667
+ to: {
3668
+ pathname: `clone/${documentId}`
3669
+ },
3670
+ children: formatMessage({
3671
+ id: "content-manager.containers.list.autoCloneModal.create",
3672
+ defaultMessage: "Create"
3673
+ })
3674
+ }
3675
+ )
3676
+ ] });
3677
+ }
3395
3678
  }
3396
3679
  };
3397
3680
  };
3398
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
3399
- return columns.map((name) => {
3400
- const attribute = attributes[name];
3401
- if (!attribute) {
3402
- return null;
3681
+ CloneAction.type = "clone";
3682
+ const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
3683
+ path {
3684
+ fill: currentColor;
3685
+ }
3686
+ `;
3687
+ const DEFAULT_TABLE_ROW_ACTIONS = [EditAction, CloneAction];
3688
+ class ContentManagerPlugin {
3689
+ /**
3690
+ * The following properties are the stored ones provided by any plugins registering with
3691
+ * the content-manager. The function calls however, need to be called at runtime in the
3692
+ * application, so instead we collate them and run them later with the complete list incl.
3693
+ * ones already registered & the context of the view.
3694
+ */
3695
+ bulkActions = [...DEFAULT_BULK_ACTIONS];
3696
+ documentActions = [
3697
+ ...DEFAULT_ACTIONS,
3698
+ ...DEFAULT_TABLE_ROW_ACTIONS,
3699
+ ...DEFAULT_HEADER_ACTIONS,
3700
+ HistoryAction
3701
+ ];
3702
+ editViewSidePanels = [ActionsPanel];
3703
+ headerActions = [];
3704
+ constructor() {
3705
+ }
3706
+ addEditViewSidePanel(panels) {
3707
+ if (Array.isArray(panels)) {
3708
+ this.editViewSidePanels = [...this.editViewSidePanels, ...panels];
3709
+ } else if (typeof panels === "function") {
3710
+ this.editViewSidePanels = panels(this.editViewSidePanels);
3711
+ } else {
3712
+ throw new Error(
3713
+ `Expected the \`panels\` passed to \`addEditViewSidePanel\` to be an array or a function, but received ${getPrintableType(
3714
+ panels
3715
+ )}`
3716
+ );
3403
3717
  }
3404
- const metadata = metadatas[name];
3405
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
3718
+ }
3719
+ addDocumentAction(actions2) {
3720
+ if (Array.isArray(actions2)) {
3721
+ this.documentActions = [...this.documentActions, ...actions2];
3722
+ } else if (typeof actions2 === "function") {
3723
+ this.documentActions = actions2(this.documentActions);
3724
+ } else {
3725
+ throw new Error(
3726
+ `Expected the \`actions\` passed to \`addDocumentAction\` to be an array or a function, but received ${getPrintableType(
3727
+ actions2
3728
+ )}`
3729
+ );
3730
+ }
3731
+ }
3732
+ addDocumentHeaderAction(actions2) {
3733
+ if (Array.isArray(actions2)) {
3734
+ this.headerActions = [...this.headerActions, ...actions2];
3735
+ } else if (typeof actions2 === "function") {
3736
+ this.headerActions = actions2(this.headerActions);
3737
+ } else {
3738
+ throw new Error(
3739
+ `Expected the \`actions\` passed to \`addDocumentHeaderAction\` to be an array or a function, but received ${getPrintableType(
3740
+ actions2
3741
+ )}`
3742
+ );
3743
+ }
3744
+ }
3745
+ addBulkAction(actions2) {
3746
+ if (Array.isArray(actions2)) {
3747
+ this.bulkActions = [...this.bulkActions, ...actions2];
3748
+ } else if (typeof actions2 === "function") {
3749
+ this.bulkActions = actions2(this.bulkActions);
3750
+ } else {
3751
+ throw new Error(
3752
+ `Expected the \`actions\` passed to \`addBulkAction\` to be an array or a function, but received ${getPrintableType(
3753
+ actions2
3754
+ )}`
3755
+ );
3756
+ }
3757
+ }
3758
+ get config() {
3406
3759
  return {
3407
- attribute,
3408
- label: metadata.label ?? "",
3409
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
3410
- schemas,
3411
- components: components?.schemas ?? {}
3412
- }),
3413
- name,
3414
- searchable: metadata.searchable ?? true,
3415
- sortable: metadata.sortable ?? true
3760
+ id: PLUGIN_ID,
3761
+ name: "Content Manager",
3762
+ injectionZones: INJECTION_ZONES,
3763
+ apis: {
3764
+ addBulkAction: this.addBulkAction.bind(this),
3765
+ addDocumentAction: this.addDocumentAction.bind(this),
3766
+ addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3767
+ addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3768
+ getBulkActions: () => this.bulkActions,
3769
+ getDocumentActions: () => this.documentActions,
3770
+ getEditViewSidePanels: () => this.editViewSidePanels,
3771
+ getHeaderActions: () => this.headerActions
3772
+ }
3416
3773
  };
3417
- }).filter((field) => field !== null);
3774
+ }
3775
+ }
3776
+ const getPrintableType = (value) => {
3777
+ const nativeType = typeof value;
3778
+ if (nativeType === "object") {
3779
+ if (value === null)
3780
+ return "null";
3781
+ if (Array.isArray(value))
3782
+ return "array";
3783
+ if (value instanceof Object && value.constructor.name !== "Object") {
3784
+ return value.constructor.name;
3785
+ }
3786
+ }
3787
+ return nativeType;
3788
+ };
3789
+ const initialState = {
3790
+ collectionTypeLinks: [],
3791
+ components: [],
3792
+ fieldSizes: {},
3793
+ models: [],
3794
+ singleTypeLinks: [],
3795
+ isLoading: true
3418
3796
  };
3797
+ const appSlice = toolkit.createSlice({
3798
+ name: "app",
3799
+ initialState,
3800
+ reducers: {
3801
+ setInitialData(state, action) {
3802
+ const {
3803
+ authorizedCollectionTypeLinks,
3804
+ authorizedSingleTypeLinks,
3805
+ components,
3806
+ contentTypeSchemas,
3807
+ fieldSizes
3808
+ } = action.payload;
3809
+ state.collectionTypeLinks = authorizedCollectionTypeLinks.filter(
3810
+ ({ isDisplayed }) => isDisplayed
3811
+ );
3812
+ state.singleTypeLinks = authorizedSingleTypeLinks.filter(({ isDisplayed }) => isDisplayed);
3813
+ state.components = components;
3814
+ state.models = contentTypeSchemas;
3815
+ state.fieldSizes = fieldSizes;
3816
+ state.isLoading = false;
3817
+ }
3818
+ }
3819
+ });
3820
+ const { actions, reducer: reducer$1 } = appSlice;
3821
+ const { setInitialData } = actions;
3822
+ const reducer = toolkit.combineReducers({
3823
+ app: reducer$1
3824
+ });
3419
3825
  const index = {
3420
3826
  register(app) {
3421
3827
  const cm = new ContentManagerPlugin();
@@ -3430,15 +3836,24 @@ const index = {
3430
3836
  defaultMessage: "Content Manager"
3431
3837
  },
3432
3838
  permissions: [],
3433
- Component: () => Promise.resolve().then(() => require("./layout-ni_L9kT1.js")).then((mod) => ({ default: mod.Layout })),
3434
3839
  position: 1
3435
3840
  });
3841
+ app.router.addRoute({
3842
+ path: "content-manager/*",
3843
+ lazy: async () => {
3844
+ const { Layout } = await Promise.resolve().then(() => require("./layout-B1ZS-usI.js"));
3845
+ return {
3846
+ Component: Layout
3847
+ };
3848
+ },
3849
+ children: routes
3850
+ });
3436
3851
  app.registerPlugin(cm.config);
3437
3852
  },
3438
3853
  async registerTrads({ locales }) {
3439
3854
  const importedTrads = await Promise.all(
3440
3855
  locales.map((locale) => {
3441
- 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-DTULi5-d.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 }) => {
3856
+ 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 }) => {
3442
3857
  return {
3443
3858
  data: prefixPluginTranslations(data, PLUGIN_ID),
3444
3859
  locale
@@ -3482,7 +3897,6 @@ exports.getDisplayName = getDisplayName;
3482
3897
  exports.getMainField = getMainField;
3483
3898
  exports.getTranslation = getTranslation;
3484
3899
  exports.index = index;
3485
- exports.routes = routes;
3486
3900
  exports.setInitialData = setInitialData;
3487
3901
  exports.useContentTypeSchema = useContentTypeSchema;
3488
3902
  exports.useDoc = useDoc;
@@ -3496,4 +3910,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
3496
3910
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
3497
3911
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
3498
3912
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
3499
- //# sourceMappingURL=index-CCJeB7Rw.js.map
3913
+ //# sourceMappingURL=index-CAlLHIrI.js.map