@strapi/content-manager 0.0.0-experimental.fed75ee8e64c57dbed0b670b25ef026b69baab10 → 0.0.0-next.16399698bd270e78290e5afc9cd317bd05bb0c6e

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 (181) hide show
  1. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  2. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-DNRPa10q.js → ComponentConfigurationPage-BTR_hQow.js} +5 -6
  4. package/dist/_chunks/{ComponentConfigurationPage-DNRPa10q.js.map → ComponentConfigurationPage-BTR_hQow.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-BVM7LScS.mjs → ComponentConfigurationPage-bLQr82ce.mjs} +4 -4
  6. package/dist/_chunks/{ComponentConfigurationPage-BVM7LScS.mjs.map → ComponentConfigurationPage-bLQr82ce.mjs.map} +1 -1
  7. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  9. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  10. package/dist/_chunks/{EditConfigurationPage-BWq-9Zhk.mjs → EditConfigurationPage-BhRSnUsL.mjs} +4 -4
  11. package/dist/_chunks/{EditConfigurationPage-BWq-9Zhk.mjs.map → EditConfigurationPage-BhRSnUsL.mjs.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-BrG0mEfF.js → EditConfigurationPage-z39Wv3E6.js} +5 -6
  13. package/dist/_chunks/{EditConfigurationPage-BrG0mEfF.js.map → EditConfigurationPage-z39Wv3E6.js.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-Dx0QnTxn.mjs → EditViewPage-BCjNxNlY.mjs} +38 -8
  15. package/dist/_chunks/EditViewPage-BCjNxNlY.mjs.map +1 -0
  16. package/dist/_chunks/{EditViewPage-BbY0bNNE.js → EditViewPage-wujOq90c.js} +38 -9
  17. package/dist/_chunks/EditViewPage-wujOq90c.js.map +1 -0
  18. package/dist/_chunks/{Field-CglKum3X.js → Field-B5QXnctJ.js} +152 -73
  19. package/dist/_chunks/Field-B5QXnctJ.js.map +1 -0
  20. package/dist/_chunks/{Field-DVZSGAon.mjs → Field-Byr3mPTl.mjs} +150 -71
  21. package/dist/_chunks/Field-Byr3mPTl.mjs.map +1 -0
  22. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  23. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  24. package/dist/_chunks/{Form-BQwxPqu3.mjs → Form-BZgvE8C8.mjs} +3 -3
  25. package/dist/_chunks/{Form-BQwxPqu3.mjs.map → Form-BZgvE8C8.mjs.map} +1 -1
  26. package/dist/_chunks/{Form-B7nYNIUm.js → Form-D7mexvm3.js} +5 -6
  27. package/dist/_chunks/{Form-B7nYNIUm.js.map → Form-D7mexvm3.js.map} +1 -1
  28. package/dist/_chunks/{History-Bmu6tx6s.mjs → History-CqNgxkqK.mjs} +23 -93
  29. package/dist/_chunks/History-CqNgxkqK.mjs.map +1 -0
  30. package/dist/_chunks/{History-3JN4BIS1.js → History-DYl2A8Z_.js} +23 -94
  31. package/dist/_chunks/History-DYl2A8Z_.js.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-BcC28SV0.js → ListConfigurationPage-BXnu_OoY.js} +7 -7
  33. package/dist/_chunks/ListConfigurationPage-BXnu_OoY.js.map +1 -0
  34. package/dist/_chunks/{ListConfigurationPage-DwijcJ17.mjs → ListConfigurationPage-BbQjzKkQ.mjs} +7 -6
  35. package/dist/_chunks/ListConfigurationPage-BbQjzKkQ.mjs.map +1 -0
  36. package/dist/_chunks/{ListViewPage-ZPNQ6jWC.js → ListViewPage-BtSi8C1l.js} +63 -41
  37. package/dist/_chunks/ListViewPage-BtSi8C1l.js.map +1 -0
  38. package/dist/_chunks/{ListViewPage-DzhuS3CW.mjs → ListViewPage-D4ofkbjR.mjs} +62 -39
  39. package/dist/_chunks/ListViewPage-D4ofkbjR.mjs.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-DzwJNXvn.js → NoContentTypePage-CitJeOq4.js} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-DzwJNXvn.js.map → NoContentTypePage-CitJeOq4.js.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-BKMgOyd3.mjs → NoContentTypePage-DyUx5mXh.mjs} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-BKMgOyd3.mjs.map → NoContentTypePage-DyUx5mXh.mjs.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-DBbGJqL9.mjs → NoPermissionsPage-DhIiyWkk.mjs} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-DBbGJqL9.mjs.map → NoPermissionsPage-DhIiyWkk.mjs.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-GaweP-NG.js → NoPermissionsPage-DzgWz0M-.js} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-GaweP-NG.js.map → NoPermissionsPage-DzgWz0M-.js.map} +1 -1
  48. package/dist/_chunks/Preview-BaYGJ0nb.mjs +293 -0
  49. package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +1 -0
  50. package/dist/_chunks/Preview-DfNx8Ke-.js +311 -0
  51. package/dist/_chunks/Preview-DfNx8Ke-.js.map +1 -0
  52. package/dist/_chunks/{Relations-B7VtRA3g.mjs → Relations-DM2yUTST.mjs} +47 -23
  53. package/dist/_chunks/Relations-DM2yUTST.mjs.map +1 -0
  54. package/dist/_chunks/{Relations-BHXq_cKF.js → Relations-DuKCaXrv.js} +47 -24
  55. package/dist/_chunks/Relations-DuKCaXrv.js.map +1 -0
  56. package/dist/_chunks/{en-Bm0D0IWz.js → en-BK8Xyl5I.js} +16 -4
  57. package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BK8Xyl5I.js.map} +1 -1
  58. package/dist/_chunks/{en-DKV44jRb.mjs → en-Dtk_ot79.mjs} +16 -4
  59. package/dist/_chunks/{en-DKV44jRb.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
  60. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  61. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  62. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  63. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  64. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  65. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  66. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  67. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  68. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  69. package/dist/_chunks/{index-DcA8_tJw.js → index-BUWEmX8m.js} +349 -212
  70. package/dist/_chunks/index-BUWEmX8m.js.map +1 -0
  71. package/dist/_chunks/{index-TaRzG09p.mjs → index-DVAIIsOs.mjs} +351 -214
  72. package/dist/_chunks/index-DVAIIsOs.mjs.map +1 -0
  73. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  74. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  75. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  76. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  77. package/dist/_chunks/{layout-aX-RJhd5.mjs → layout-Bxsv5mP7.mjs} +4 -4
  78. package/dist/_chunks/{layout-aX-RJhd5.mjs.map → layout-Bxsv5mP7.mjs.map} +1 -1
  79. package/dist/_chunks/{layout-CrgXpOxT.js → layout-C3fN7Ejz.js} +5 -6
  80. package/dist/_chunks/{layout-CrgXpOxT.js.map → layout-C3fN7Ejz.js.map} +1 -1
  81. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  82. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  83. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  84. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  85. package/dist/_chunks/{relations-Z6RA1sBS.js → relations-BPZKAoEY.js} +6 -7
  86. package/dist/_chunks/relations-BPZKAoEY.js.map +1 -0
  87. package/dist/_chunks/{relations-D3Hlx6QX.mjs → relations-o3pPhzY4.mjs} +6 -7
  88. package/dist/_chunks/relations-o3pPhzY4.mjs.map +1 -0
  89. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
  90. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
  91. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  92. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  93. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  94. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  95. package/dist/admin/index.js +1 -1
  96. package/dist/admin/index.mjs +4 -4
  97. package/dist/admin/src/content-manager.d.ts +3 -2
  98. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  99. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  100. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
  101. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  102. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  103. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  104. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  105. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  106. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  107. package/dist/admin/src/preview/index.d.ts +4 -0
  108. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  109. package/dist/admin/src/preview/routes.d.ts +3 -0
  110. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  111. package/dist/admin/src/router.d.ts +1 -1
  112. package/dist/admin/src/services/documents.d.ts +0 -3
  113. package/dist/server/index.js +405 -180
  114. package/dist/server/index.js.map +1 -1
  115. package/dist/server/index.mjs +405 -179
  116. package/dist/server/index.mjs.map +1 -1
  117. package/dist/server/src/bootstrap.d.ts.map +1 -1
  118. package/dist/server/src/controllers/index.d.ts.map +1 -1
  119. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  120. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  121. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  122. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  123. package/dist/server/src/history/services/utils.d.ts +2 -3
  124. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  125. package/dist/server/src/index.d.ts +4 -4
  126. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  127. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  128. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  129. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  130. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  131. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  132. package/dist/server/src/preview/index.d.ts +4 -0
  133. package/dist/server/src/preview/index.d.ts.map +1 -0
  134. package/dist/server/src/preview/routes/index.d.ts +8 -0
  135. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  136. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  137. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  138. package/dist/server/src/preview/services/index.d.ts +16 -0
  139. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  140. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  141. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  142. package/dist/server/src/preview/services/preview.d.ts +12 -0
  143. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  144. package/dist/server/src/preview/utils.d.ts +19 -0
  145. package/dist/server/src/preview/utils.d.ts.map +1 -0
  146. package/dist/server/src/register.d.ts.map +1 -1
  147. package/dist/server/src/routes/index.d.ts.map +1 -1
  148. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  149. package/dist/server/src/services/document-metadata.d.ts +8 -8
  150. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  151. package/dist/server/src/services/index.d.ts +4 -4
  152. package/dist/server/src/services/index.d.ts.map +1 -1
  153. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  154. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  155. package/dist/server/src/utils/index.d.ts +2 -0
  156. package/dist/server/src/utils/index.d.ts.map +1 -1
  157. package/dist/shared/contracts/index.d.ts +1 -0
  158. package/dist/shared/contracts/index.d.ts.map +1 -1
  159. package/dist/shared/contracts/preview.d.ts +27 -0
  160. package/dist/shared/contracts/preview.d.ts.map +1 -0
  161. package/dist/shared/index.js +4 -0
  162. package/dist/shared/index.js.map +1 -1
  163. package/dist/shared/index.mjs +4 -0
  164. package/dist/shared/index.mjs.map +1 -1
  165. package/package.json +13 -11
  166. package/dist/_chunks/EditViewPage-BbY0bNNE.js.map +0 -1
  167. package/dist/_chunks/EditViewPage-Dx0QnTxn.mjs.map +0 -1
  168. package/dist/_chunks/Field-CglKum3X.js.map +0 -1
  169. package/dist/_chunks/Field-DVZSGAon.mjs.map +0 -1
  170. package/dist/_chunks/History-3JN4BIS1.js.map +0 -1
  171. package/dist/_chunks/History-Bmu6tx6s.mjs.map +0 -1
  172. package/dist/_chunks/ListConfigurationPage-BcC28SV0.js.map +0 -1
  173. package/dist/_chunks/ListConfigurationPage-DwijcJ17.mjs.map +0 -1
  174. package/dist/_chunks/ListViewPage-DzhuS3CW.mjs.map +0 -1
  175. package/dist/_chunks/ListViewPage-ZPNQ6jWC.js.map +0 -1
  176. package/dist/_chunks/Relations-B7VtRA3g.mjs.map +0 -1
  177. package/dist/_chunks/Relations-BHXq_cKF.js.map +0 -1
  178. package/dist/_chunks/index-DcA8_tJw.js.map +0 -1
  179. package/dist/_chunks/index-TaRzG09p.mjs.map +0 -1
  180. package/dist/_chunks/relations-D3Hlx6QX.mjs.map +0 -1
  181. package/dist/_chunks/relations-Z6RA1sBS.js.map +0 -1
@@ -3,23 +3,31 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
3
  import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
4
4
  import * as React from "react";
5
5
  import { lazy } from "react";
6
- import { Button, Menu, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
6
+ import { Menu, Button, VisuallyHidden, Flex, Dialog, Modal, Typography, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
7
+ import mapValues from "lodash/fp/mapValues";
7
8
  import { useIntl } from "react-intl";
8
9
  import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
10
+ import { styled } from "styled-components";
9
11
  import * as yup from "yup";
10
12
  import { ValidationError } from "yup";
13
+ import { stringify } from "qs";
11
14
  import pipe from "lodash/fp/pipe";
12
15
  import { intervalToDuration, isPast } from "date-fns";
13
- import { styled } from "styled-components";
14
- import { stringify } from "qs";
15
16
  import { createSlice, combineReducers } from "@reduxjs/toolkit";
16
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
17
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
17
18
  const v = glob[path];
18
19
  if (v) {
19
20
  return typeof v === "function" ? v() : Promise.resolve(v);
20
21
  }
21
22
  return new Promise((_, reject) => {
22
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
23
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
24
+ reject.bind(
25
+ null,
26
+ new Error(
27
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
28
+ )
29
+ )
30
+ );
23
31
  });
24
32
  };
25
33
  const PLUGIN_ID = "content-manager";
@@ -273,7 +281,7 @@ const documentApi = contentManagerApi.injectEndpoints({
273
281
  url: `/content-manager/collection-types/${model}`,
274
282
  method: "GET",
275
283
  config: {
276
- params
284
+ params: stringify(params, { encode: true })
277
285
  }
278
286
  }),
279
287
  providesTags: (result, _error, arg) => {
@@ -452,8 +460,7 @@ const {
452
460
  useUnpublishManyDocumentsMutation
453
461
  } = documentApi;
454
462
  const buildValidParams = (query) => {
455
- if (!query)
456
- return query;
463
+ if (!query) return query;
457
464
  const { plugins: _, ...validQueryParams } = {
458
465
  ...query,
459
466
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -461,9 +468,6 @@ const buildValidParams = (query) => {
461
468
  {}
462
469
  )
463
470
  };
464
- if ("_q" in validQueryParams) {
465
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
466
- }
467
471
  return validQueryParams;
468
472
  };
469
473
  const isBaseQueryError = (error) => {
@@ -968,9 +972,10 @@ const formatEditLayout = (data, {
968
972
  currentPanelIndex += 2;
969
973
  } else {
970
974
  if (!panels[currentPanelIndex]) {
971
- panels.push([]);
975
+ panels.push([row]);
976
+ } else {
977
+ panels[currentPanelIndex].push(row);
972
978
  }
973
- panels[currentPanelIndex].push(row);
974
979
  }
975
980
  return panels;
976
981
  }, []);
@@ -1228,9 +1233,6 @@ const useContentManagerContext = () => {
1228
1233
  };
1229
1234
  };
1230
1235
  const prefixPluginTranslations = (trad, pluginId) => {
1231
- if (!pluginId) {
1232
- throw new TypeError("pluginId can't be empty");
1233
- }
1234
1236
  return Object.keys(trad).reduce((acc, current) => {
1235
1237
  acc[`${pluginId}.${current}`] = trad[current];
1236
1238
  return acc;
@@ -1664,10 +1666,10 @@ const useDocumentActions = () => {
1664
1666
  update
1665
1667
  };
1666
1668
  };
1667
- const ProtectedHistoryPage = lazy(
1668
- () => import("./History-Bmu6tx6s.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1669
+ const ProtectedHistoryPage = React.lazy(
1670
+ () => import("./History-CqNgxkqK.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1669
1671
  );
1670
- const routes$1 = [
1672
+ const routes$2 = [
1671
1673
  {
1672
1674
  path: ":collectionType/:slug/:id/history",
1673
1675
  Component: ProtectedHistoryPage
@@ -1677,32 +1679,45 @@ const routes$1 = [
1677
1679
  Component: ProtectedHistoryPage
1678
1680
  }
1679
1681
  ];
1682
+ const ProtectedPreviewPage = React.lazy(
1683
+ () => import("./Preview-BaYGJ0nb.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1684
+ );
1685
+ const routes$1 = [
1686
+ {
1687
+ path: ":collectionType/:slug/:id/preview",
1688
+ Component: ProtectedPreviewPage
1689
+ },
1690
+ {
1691
+ path: ":collectionType/:slug/preview",
1692
+ Component: ProtectedPreviewPage
1693
+ }
1694
+ ];
1680
1695
  const ProtectedEditViewPage = lazy(
1681
- () => import("./EditViewPage-Dx0QnTxn.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1696
+ () => import("./EditViewPage-BCjNxNlY.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1682
1697
  );
1683
1698
  const ProtectedListViewPage = lazy(
1684
- () => import("./ListViewPage-DzhuS3CW.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1699
+ () => import("./ListViewPage-D4ofkbjR.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1685
1700
  );
1686
1701
  const ProtectedListConfiguration = lazy(
1687
- () => import("./ListConfigurationPage-DwijcJ17.mjs").then((mod) => ({
1702
+ () => import("./ListConfigurationPage-BbQjzKkQ.mjs").then((mod) => ({
1688
1703
  default: mod.ProtectedListConfiguration
1689
1704
  }))
1690
1705
  );
1691
1706
  const ProtectedEditConfigurationPage = lazy(
1692
- () => import("./EditConfigurationPage-BWq-9Zhk.mjs").then((mod) => ({
1707
+ () => import("./EditConfigurationPage-BhRSnUsL.mjs").then((mod) => ({
1693
1708
  default: mod.ProtectedEditConfigurationPage
1694
1709
  }))
1695
1710
  );
1696
1711
  const ProtectedComponentConfigurationPage = lazy(
1697
- () => import("./ComponentConfigurationPage-BVM7LScS.mjs").then((mod) => ({
1712
+ () => import("./ComponentConfigurationPage-bLQr82ce.mjs").then((mod) => ({
1698
1713
  default: mod.ProtectedComponentConfigurationPage
1699
1714
  }))
1700
1715
  );
1701
1716
  const NoPermissions = lazy(
1702
- () => import("./NoPermissionsPage-DBbGJqL9.mjs").then((mod) => ({ default: mod.NoPermissions }))
1717
+ () => import("./NoPermissionsPage-DhIiyWkk.mjs").then((mod) => ({ default: mod.NoPermissions }))
1703
1718
  );
1704
1719
  const NoContentType = lazy(
1705
- () => import("./NoContentTypePage-BKMgOyd3.mjs").then((mod) => ({ default: mod.NoContentType }))
1720
+ () => import("./NoContentTypePage-DyUx5mXh.mjs").then((mod) => ({ default: mod.NoContentType }))
1706
1721
  );
1707
1722
  const CollectionTypePages = () => {
1708
1723
  const { collectionType } = useParams();
@@ -1714,7 +1729,7 @@ const CollectionTypePages = () => {
1714
1729
  const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
1715
1730
  const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
1716
1731
  const LIST_RELATIVE_PATH = ":collectionType/:slug";
1717
- const LIST_PATH = `/content-manager/${LIST_RELATIVE_PATH}`;
1732
+ const LIST_PATH = `/content-manager/collection-types/:slug`;
1718
1733
  const routes = [
1719
1734
  {
1720
1735
  path: LIST_RELATIVE_PATH,
@@ -1748,6 +1763,7 @@ const routes = [
1748
1763
  path: "no-content-types",
1749
1764
  Component: NoContentType
1750
1765
  },
1766
+ ...routes$2,
1751
1767
  ...routes$1
1752
1768
  ];
1753
1769
  const DocumentActions = ({ actions: actions2 }) => {
@@ -1846,6 +1862,11 @@ const DocumentActionButton = (action) => {
1846
1862
  ) : null
1847
1863
  ] });
1848
1864
  };
1865
+ const MenuItem = styled(Menu.Item)`
1866
+ &:hover {
1867
+ background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
1868
+ }
1869
+ `;
1849
1870
  const DocumentActionsMenu = ({
1850
1871
  actions: actions2,
1851
1872
  children,
@@ -1904,48 +1925,32 @@ const DocumentActionsMenu = ({
1904
1925
  /* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1905
1926
  actions2.map((action) => {
1906
1927
  return /* @__PURE__ */ jsx(
1907
- Menu.Item,
1928
+ MenuItem,
1908
1929
  {
1909
1930
  disabled: action.disabled,
1910
1931
  onSelect: handleClick(action),
1911
1932
  display: "block",
1912
- children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
1913
- /* @__PURE__ */ jsxs(
1914
- Flex,
1915
- {
1916
- color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1917
- gap: 2,
1918
- tag: "span",
1919
- children: [
1920
- /* @__PURE__ */ jsx(
1921
- Flex,
1922
- {
1923
- tag: "span",
1924
- color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1925
- children: action.icon
1926
- }
1927
- ),
1928
- action.label
1929
- ]
1930
- }
1931
- ),
1932
- action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
1933
- Flex,
1934
- {
1935
- alignItems: "center",
1936
- background: "alternative100",
1937
- borderStyle: "solid",
1938
- borderColor: "alternative200",
1939
- borderWidth: "1px",
1940
- height: 5,
1941
- paddingLeft: 2,
1942
- paddingRight: 2,
1943
- hasRadius: true,
1944
- color: "alternative600",
1945
- children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
1946
- }
1947
- )
1948
- ] })
1933
+ isVariantDanger: action.variant === "danger",
1934
+ isDisabled: action.disabled,
1935
+ children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
1936
+ Flex,
1937
+ {
1938
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1939
+ gap: 2,
1940
+ tag: "span",
1941
+ children: [
1942
+ /* @__PURE__ */ jsx(
1943
+ Flex,
1944
+ {
1945
+ tag: "span",
1946
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1947
+ children: action.icon
1948
+ }
1949
+ ),
1950
+ action.label
1951
+ ]
1952
+ }
1953
+ ) })
1949
1954
  },
1950
1955
  action.id
1951
1956
  );
@@ -2056,6 +2061,18 @@ const DocumentActionModal = ({
2056
2061
  typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
2057
2062
  ] }) });
2058
2063
  };
2064
+ const transformData = (data) => {
2065
+ if (Array.isArray(data)) {
2066
+ return data.map(transformData);
2067
+ }
2068
+ if (typeof data === "object" && data !== null) {
2069
+ if ("apiData" in data) {
2070
+ return data.apiData;
2071
+ }
2072
+ return mapValues(transformData)(data);
2073
+ }
2074
+ return data;
2075
+ };
2059
2076
  const PublishAction$1 = ({
2060
2077
  activeTab,
2061
2078
  documentId,
@@ -2070,6 +2087,7 @@ const PublishAction$1 = ({
2070
2087
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
2071
2088
  const isListView = useMatch(LIST_PATH) !== null;
2072
2089
  const isCloning = useMatch(CLONE_PATH) !== null;
2090
+ const { id } = useParams();
2073
2091
  const { formatMessage } = useIntl();
2074
2092
  const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
2075
2093
  const { publish } = useDocumentActions();
@@ -2169,13 +2187,15 @@ const PublishAction$1 = ({
2169
2187
  documentId,
2170
2188
  params
2171
2189
  },
2172
- formDocumentToData(formValues)
2190
+ transformData(formValues)
2173
2191
  );
2174
2192
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2175
- navigate({
2176
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2177
- search: rawQuery
2178
- });
2193
+ if (id === "create") {
2194
+ navigate({
2195
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2196
+ search: rawQuery
2197
+ });
2198
+ }
2179
2199
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2180
2200
  setErrors(formatValidationErrors(res.error));
2181
2201
  }
@@ -2228,36 +2248,7 @@ const PublishAction$1 = ({
2228
2248
  };
2229
2249
  };
2230
2250
  PublishAction$1.type = "publish";
2231
- const formDocumentToData = (document) => {
2232
- return Object.keys(document).reduce((acc, key) => {
2233
- if (document[key] !== void 0) {
2234
- acc[key] = document[key];
2235
- }
2236
- if (typeof document[key] === "object" && document[key] !== null) {
2237
- if ("connect" in document[key] && document[key].connect !== null) {
2238
- acc[key] = {
2239
- ...acc[key],
2240
- connect: document[key].connect.map((item) => {
2241
- return {
2242
- documentId: item.documentId
2243
- };
2244
- })
2245
- };
2246
- }
2247
- if ("disconnect" in document[key] && document[key].disconnect !== null) {
2248
- acc[key] = {
2249
- ...acc[key],
2250
- disconnect: document[key].disconnect.map((item) => {
2251
- return {
2252
- documentId: item.documentId
2253
- };
2254
- })
2255
- };
2256
- }
2257
- }
2258
- return acc;
2259
- }, {});
2260
- };
2251
+ PublishAction$1.position = "panel";
2261
2252
  const UpdateAction = ({
2262
2253
  activeTab,
2263
2254
  documentId,
@@ -2280,96 +2271,134 @@ const UpdateAction = ({
2280
2271
  const validate = useForm("UpdateAction", (state) => state.validate);
2281
2272
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2282
2273
  const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
2283
- return {
2284
- /**
2285
- * Disabled when:
2286
- * - the form is submitting
2287
- * - the document is not modified & we're not cloning (you can save a clone entity straight away)
2288
- * - the active tab is the published tab
2289
- */
2290
- disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
2291
- label: formatMessage({
2292
- id: "content-manager.containers.Edit.save",
2293
- defaultMessage: "Save"
2294
- }),
2295
- onClick: async () => {
2296
- setSubmitting(true);
2297
- try {
2298
- const { errors } = await validate(true, {
2299
- status: "draft"
2274
+ const handleUpdate = React.useCallback(async () => {
2275
+ setSubmitting(true);
2276
+ try {
2277
+ if (!modified) {
2278
+ return;
2279
+ }
2280
+ const { errors } = await validate(true, {
2281
+ status: "draft"
2282
+ });
2283
+ if (errors) {
2284
+ toggleNotification({
2285
+ type: "danger",
2286
+ message: formatMessage({
2287
+ id: "content-manager.validation.error",
2288
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2289
+ })
2300
2290
  });
2301
- if (errors) {
2302
- toggleNotification({
2303
- type: "danger",
2304
- message: formatMessage({
2305
- id: "content-manager.validation.error",
2306
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
2307
- })
2308
- });
2309
- return;
2310
- }
2311
- if (isCloning) {
2312
- const res = await clone(
2313
- {
2314
- model,
2315
- documentId: cloneMatch.params.origin,
2316
- params
2317
- },
2318
- formDocumentToData(document)
2319
- );
2320
- if ("data" in res) {
2321
- navigate(
2322
- {
2323
- pathname: `../${res.data.documentId}`,
2324
- search: rawQuery
2325
- },
2326
- { relative: "path" }
2327
- );
2328
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2329
- setErrors(formatValidationErrors(res.error));
2330
- }
2331
- } else if (documentId || collectionType === SINGLE_TYPES) {
2332
- const res = await update(
2291
+ return;
2292
+ }
2293
+ if (isCloning) {
2294
+ const res = await clone(
2295
+ {
2296
+ model,
2297
+ documentId: cloneMatch.params.origin,
2298
+ params
2299
+ },
2300
+ transformData(document)
2301
+ );
2302
+ if ("data" in res) {
2303
+ navigate(
2333
2304
  {
2334
- collectionType,
2335
- model,
2336
- documentId,
2337
- params
2305
+ pathname: `../${res.data.documentId}`,
2306
+ search: rawQuery
2338
2307
  },
2339
- formDocumentToData(document)
2308
+ { relative: "path" }
2340
2309
  );
2341
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2342
- setErrors(formatValidationErrors(res.error));
2343
- } else {
2344
- resetForm();
2345
- }
2310
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2311
+ setErrors(formatValidationErrors(res.error));
2312
+ }
2313
+ } else if (documentId || collectionType === SINGLE_TYPES) {
2314
+ const res = await update(
2315
+ {
2316
+ collectionType,
2317
+ model,
2318
+ documentId,
2319
+ params
2320
+ },
2321
+ transformData(document)
2322
+ );
2323
+ if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2324
+ setErrors(formatValidationErrors(res.error));
2346
2325
  } else {
2347
- const res = await create(
2326
+ resetForm();
2327
+ }
2328
+ } else {
2329
+ const res = await create(
2330
+ {
2331
+ model,
2332
+ params
2333
+ },
2334
+ transformData(document)
2335
+ );
2336
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2337
+ navigate(
2348
2338
  {
2349
- model,
2350
- params
2339
+ pathname: `../${res.data.documentId}`,
2340
+ search: rawQuery
2351
2341
  },
2352
- formDocumentToData(document)
2342
+ { replace: true, relative: "path" }
2353
2343
  );
2354
- if ("data" in res && collectionType !== SINGLE_TYPES) {
2355
- navigate(
2356
- {
2357
- pathname: `../${res.data.documentId}`,
2358
- search: rawQuery
2359
- },
2360
- { replace: true, relative: "path" }
2361
- );
2362
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2363
- setErrors(formatValidationErrors(res.error));
2364
- }
2344
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2345
+ setErrors(formatValidationErrors(res.error));
2365
2346
  }
2366
- } finally {
2367
- setSubmitting(false);
2368
2347
  }
2348
+ } finally {
2349
+ setSubmitting(false);
2369
2350
  }
2351
+ }, [
2352
+ clone,
2353
+ cloneMatch?.params.origin,
2354
+ collectionType,
2355
+ create,
2356
+ document,
2357
+ documentId,
2358
+ formatMessage,
2359
+ formatValidationErrors,
2360
+ isCloning,
2361
+ model,
2362
+ modified,
2363
+ navigate,
2364
+ params,
2365
+ rawQuery,
2366
+ resetForm,
2367
+ setErrors,
2368
+ setSubmitting,
2369
+ toggleNotification,
2370
+ update,
2371
+ validate
2372
+ ]);
2373
+ React.useEffect(() => {
2374
+ const handleKeyDown = (e) => {
2375
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
2376
+ e.preventDefault();
2377
+ handleUpdate();
2378
+ }
2379
+ };
2380
+ window.addEventListener("keydown", handleKeyDown);
2381
+ return () => {
2382
+ window.removeEventListener("keydown", handleKeyDown);
2383
+ };
2384
+ }, [handleUpdate]);
2385
+ return {
2386
+ /**
2387
+ * Disabled when:
2388
+ * - the form is submitting
2389
+ * - the document is not modified & we're not cloning (you can save a clone entity straight away)
2390
+ * - the active tab is the published tab
2391
+ */
2392
+ disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
2393
+ label: formatMessage({
2394
+ id: "global.save",
2395
+ defaultMessage: "Save"
2396
+ }),
2397
+ onClick: handleUpdate
2370
2398
  };
2371
2399
  };
2372
2400
  UpdateAction.type = "update";
2401
+ UpdateAction.position = "panel";
2373
2402
  const UNPUBLISH_DRAFT_OPTIONS = {
2374
2403
  KEEP: "keep",
2375
2404
  DISCARD: "discard"
@@ -2492,6 +2521,7 @@ const UnpublishAction$1 = ({
2492
2521
  };
2493
2522
  };
2494
2523
  UnpublishAction$1.type = "unpublish";
2524
+ UnpublishAction$1.position = "panel";
2495
2525
  const DiscardAction = ({
2496
2526
  activeTab,
2497
2527
  documentId,
@@ -2542,6 +2572,7 @@ const DiscardAction = ({
2542
2572
  };
2543
2573
  };
2544
2574
  DiscardAction.type = "discard";
2575
+ DiscardAction.position = "panel";
2545
2576
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2546
2577
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2547
2578
  const RelativeTime = React.forwardRef(
@@ -2554,7 +2585,7 @@ const RelativeTime = React.forwardRef(
2554
2585
  });
2555
2586
  const unit = intervals.find((intervalUnit) => {
2556
2587
  return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
2557
- });
2588
+ }) ?? "seconds";
2558
2589
  const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
2559
2590
  const customInterval = customIntervals.find(
2560
2591
  (custom) => interval[custom.unit] < custom.threshold
@@ -2588,19 +2619,29 @@ const getDisplayName = ({
2588
2619
  return email ?? "";
2589
2620
  };
2590
2621
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2591
- const DocumentStatus = ({ status = "draft", ...restProps }) => {
2622
+ const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
2592
2623
  const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2593
- return /* @__PURE__ */ jsx(Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2624
+ const { formatMessage } = useIntl();
2625
+ return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
2626
+ id: `content-manager.containers.List.${status}`,
2627
+ defaultMessage: capitalise(status)
2628
+ }) }) });
2594
2629
  };
2595
2630
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2596
2631
  const { formatMessage } = useIntl();
2597
2632
  const isCloning = useMatch(CLONE_PATH) !== null;
2633
+ const params = useParams();
2598
2634
  const title = isCreating ? formatMessage({
2599
2635
  id: "content-manager.containers.edit.title.new",
2600
2636
  defaultMessage: "Create an entry"
2601
2637
  }) : documentTitle;
2602
2638
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2603
- /* @__PURE__ */ jsx(BackButton, {}),
2639
+ /* @__PURE__ */ jsx(
2640
+ BackButton,
2641
+ {
2642
+ fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
2643
+ }
2644
+ ),
2604
2645
  /* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2605
2646
  /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
2606
2647
  /* @__PURE__ */ jsx(HeaderToolbar, {})
@@ -2651,7 +2692,7 @@ const HeaderToolbar = () => {
2651
2692
  meta: isCloning ? void 0 : meta,
2652
2693
  collectionType
2653
2694
  },
2654
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2695
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2655
2696
  children: (actions2) => {
2656
2697
  const headerActions = actions2.filter((action) => {
2657
2698
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2859,6 +2900,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2859
2900
  };
2860
2901
  };
2861
2902
  ConfigureTheViewAction.type = "configure-the-view";
2903
+ ConfigureTheViewAction.position = "header";
2862
2904
  const EditTheModelAction = ({ model }) => {
2863
2905
  const navigate = useNavigate();
2864
2906
  const { formatMessage } = useIntl();
@@ -2875,6 +2917,7 @@ const EditTheModelAction = ({ model }) => {
2875
2917
  };
2876
2918
  };
2877
2919
  EditTheModelAction.type = "edit-the-model";
2920
+ EditTheModelAction.position = "header";
2878
2921
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2879
2922
  const navigate = useNavigate();
2880
2923
  const { formatMessage } = useIntl();
@@ -2948,6 +2991,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2948
2991
  };
2949
2992
  };
2950
2993
  DeleteAction$1.type = "delete";
2994
+ DeleteAction$1.position = ["header", "table-row"];
2951
2995
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2952
2996
  const Panels = () => {
2953
2997
  const isCloning = useMatch(CLONE_PATH) !== null;
@@ -3010,7 +3054,7 @@ const ActionsPanelContent = () => {
3010
3054
  DescriptionComponentRenderer,
3011
3055
  {
3012
3056
  props,
3013
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3057
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3014
3058
  children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
3015
3059
  }
3016
3060
  ),
@@ -3037,7 +3081,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
3037
3081
  justifyContent: "stretch",
3038
3082
  alignItems: "flex-start",
3039
3083
  children: [
3040
- /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
3084
+ /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3041
3085
  children
3042
3086
  ]
3043
3087
  }
@@ -3287,18 +3331,10 @@ const SelectedEntriesTableContent = ({
3287
3331
  search: row.locale && `?plugins[i18n][locale]=${row.locale}`
3288
3332
  },
3289
3333
  state: { from: pathname },
3290
- label: formatMessage(
3291
- { id: "app.component.HelperPluginTable.edit", defaultMessage: "Edit {target}" },
3292
- {
3293
- target: formatMessage(
3294
- {
3295
- id: "content-manager.components.ListViewHelperPluginTable.row-line",
3296
- defaultMessage: "item line {number}"
3297
- },
3298
- { number: index2 + 1 }
3299
- )
3300
- }
3301
- ),
3334
+ label: formatMessage({
3335
+ id: "content-manager.bulk-publish.edit",
3336
+ defaultMessage: "Edit"
3337
+ }),
3302
3338
  target: "_blank",
3303
3339
  marginLeft: "auto",
3304
3340
  variant: "ghost",
@@ -3472,8 +3508,7 @@ const PublishAction = ({ documents, model }) => {
3472
3508
  const refetchList = () => {
3473
3509
  contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3474
3510
  };
3475
- if (!showPublishButton)
3476
- return null;
3511
+ if (!showPublishButton) return null;
3477
3512
  return {
3478
3513
  actionType: "publish",
3479
3514
  variant: "tertiary",
@@ -3541,8 +3576,7 @@ const DeleteAction = ({ documents, model }) => {
3541
3576
  selectRow([]);
3542
3577
  }
3543
3578
  };
3544
- if (!hasDeletePermission)
3545
- return null;
3579
+ if (!hasDeletePermission) return null;
3546
3580
  return {
3547
3581
  variant: "danger-light",
3548
3582
  label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
@@ -3591,8 +3625,7 @@ const UnpublishAction = ({ documents, model }) => {
3591
3625
  }
3592
3626
  };
3593
3627
  const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3594
- if (!showUnpublishButton)
3595
- return null;
3628
+ if (!showUnpublishButton) return null;
3596
3629
  return {
3597
3630
  variant: "tertiary",
3598
3631
  label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
@@ -3697,7 +3730,7 @@ const TableActions = ({ document }) => {
3697
3730
  DescriptionComponentRenderer,
3698
3731
  {
3699
3732
  props,
3700
- descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3733
+ descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
3701
3734
  children: (actions2) => {
3702
3735
  const tableRowActions = actions2.filter((action) => {
3703
3736
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3756,6 +3789,7 @@ const EditAction = ({ documentId }) => {
3756
3789
  };
3757
3790
  };
3758
3791
  EditAction.type = "edit";
3792
+ EditAction.position = "table-row";
3759
3793
  const StyledPencil = styled(Pencil)`
3760
3794
  path {
3761
3795
  fill: currentColor;
@@ -3832,6 +3866,7 @@ const CloneAction = ({ model, documentId }) => {
3832
3866
  };
3833
3867
  };
3834
3868
  CloneAction.type = "clone";
3869
+ CloneAction.position = "table-row";
3835
3870
  const StyledDuplicate = styled(Duplicate)`
3836
3871
  path {
3837
3872
  fill: currentColor;
@@ -3918,7 +3953,14 @@ class ContentManagerPlugin {
3918
3953
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3919
3954
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3920
3955
  getBulkActions: () => this.bulkActions,
3921
- getDocumentActions: () => this.documentActions,
3956
+ getDocumentActions: (position) => {
3957
+ if (position) {
3958
+ return this.documentActions.filter(
3959
+ (action) => action.position == void 0 || [action.position].flat().includes(position)
3960
+ );
3961
+ }
3962
+ return this.documentActions;
3963
+ },
3922
3964
  getEditViewSidePanels: () => this.editViewSidePanels,
3923
3965
  getHeaderActions: () => this.headerActions
3924
3966
  }
@@ -3928,10 +3970,8 @@ class ContentManagerPlugin {
3928
3970
  const getPrintableType = (value) => {
3929
3971
  const nativeType = typeof value;
3930
3972
  if (nativeType === "object") {
3931
- if (value === null)
3932
- return "null";
3933
- if (Array.isArray(value))
3934
- return "array";
3973
+ if (value === null) return "null";
3974
+ if (Array.isArray(value)) return "array";
3935
3975
  if (value instanceof Object && value.constructor.name !== "Object") {
3936
3976
  return value.constructor.name;
3937
3977
  }
@@ -3942,17 +3982,27 @@ const HistoryAction = ({ model, document }) => {
3942
3982
  const { formatMessage } = useIntl();
3943
3983
  const [{ query }] = useQueryParams();
3944
3984
  const navigate = useNavigate();
3985
+ const { trackUsage } = useTracking();
3986
+ const { pathname } = useLocation();
3945
3987
  const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
3946
3988
  if (!window.strapi.features.isEnabled("cms-content-history")) {
3947
3989
  return null;
3948
3990
  }
3991
+ const handleOnClick = () => {
3992
+ const destination = { pathname: "history", search: pluginsQueryParams };
3993
+ trackUsage("willNavigate", {
3994
+ from: pathname,
3995
+ to: `${pathname}/${destination.pathname}`
3996
+ });
3997
+ navigate(destination);
3998
+ };
3949
3999
  return {
3950
4000
  icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
3951
4001
  label: formatMessage({
3952
4002
  id: "content-manager.history.document-action",
3953
4003
  defaultMessage: "Content History"
3954
4004
  }),
3955
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
4005
+ onClick: handleOnClick,
3956
4006
  disabled: (
3957
4007
  /**
3958
4008
  * The user is creating a new document.
@@ -3974,6 +4024,7 @@ const HistoryAction = ({ model, document }) => {
3974
4024
  };
3975
4025
  };
3976
4026
  HistoryAction.type = "history";
4027
+ HistoryAction.position = "header";
3977
4028
  const historyAdmin = {
3978
4029
  bootstrap(app) {
3979
4030
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4020,6 +4071,88 @@ const { setInitialData } = actions;
4020
4071
  const reducer = combineReducers({
4021
4072
  app: reducer$1
4022
4073
  });
4074
+ const previewApi = contentManagerApi.injectEndpoints({
4075
+ endpoints: (builder) => ({
4076
+ getPreviewUrl: builder.query({
4077
+ query({ query, params }) {
4078
+ return {
4079
+ url: `/content-manager/preview/url/${params.contentType}`,
4080
+ method: "GET",
4081
+ config: {
4082
+ params: query
4083
+ }
4084
+ };
4085
+ }
4086
+ })
4087
+ })
4088
+ });
4089
+ const { useGetPreviewUrlQuery } = previewApi;
4090
+ const ConditionalTooltip = ({ isShown, label, children }) => {
4091
+ if (isShown) {
4092
+ return /* @__PURE__ */ jsx(Tooltip, { label, children });
4093
+ }
4094
+ return children;
4095
+ };
4096
+ const PreviewSidePanel = ({ model, documentId, document }) => {
4097
+ const { formatMessage } = useIntl();
4098
+ const { trackUsage } = useTracking();
4099
+ const { pathname } = useLocation();
4100
+ const [{ query }] = useQueryParams();
4101
+ const isModified = useForm("PreviewSidePanel", (state) => state.modified);
4102
+ const { data, error } = useGetPreviewUrlQuery({
4103
+ params: {
4104
+ contentType: model
4105
+ },
4106
+ query: {
4107
+ documentId,
4108
+ locale: document?.locale,
4109
+ status: document?.status
4110
+ }
4111
+ });
4112
+ if (!data?.data?.url || error) {
4113
+ return null;
4114
+ }
4115
+ const trackNavigation = () => {
4116
+ const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
4117
+ trackUsage("willNavigate", { from: pathname, to: destinationPathname });
4118
+ };
4119
+ return {
4120
+ title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4121
+ content: /* @__PURE__ */ jsx(
4122
+ ConditionalTooltip,
4123
+ {
4124
+ label: formatMessage({
4125
+ id: "content-manager.preview.panel.button-disabled-tooltip",
4126
+ defaultMessage: "Please save to open the preview"
4127
+ }),
4128
+ isShown: isModified,
4129
+ children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
4130
+ Button,
4131
+ {
4132
+ variant: "tertiary",
4133
+ tag: Link,
4134
+ to: { pathname: "preview", search: stringify(query, { encode: false }) },
4135
+ onClick: trackNavigation,
4136
+ width: "100%",
4137
+ disabled: isModified,
4138
+ pointerEvents: isModified ? "none" : void 0,
4139
+ tabIndex: isModified ? -1 : void 0,
4140
+ children: formatMessage({
4141
+ id: "content-manager.preview.panel.button",
4142
+ defaultMessage: "Open preview"
4143
+ })
4144
+ }
4145
+ ) })
4146
+ }
4147
+ )
4148
+ };
4149
+ };
4150
+ const previewAdmin = {
4151
+ bootstrap(app) {
4152
+ const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4153
+ contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4154
+ }
4155
+ };
4023
4156
  const index = {
4024
4157
  register(app) {
4025
4158
  const cm = new ContentManagerPlugin();
@@ -4039,7 +4172,7 @@ const index = {
4039
4172
  app.router.addRoute({
4040
4173
  path: "content-manager/*",
4041
4174
  lazy: async () => {
4042
- const { Layout } = await import("./layout-aX-RJhd5.mjs");
4175
+ const { Layout } = await import("./layout-Bxsv5mP7.mjs");
4043
4176
  return {
4044
4177
  Component: Layout
4045
4178
  };
@@ -4052,11 +4185,14 @@ const index = {
4052
4185
  if (typeof historyAdmin.bootstrap === "function") {
4053
4186
  historyAdmin.bootstrap(app);
4054
4187
  }
4188
+ if (typeof previewAdmin.bootstrap === "function") {
4189
+ previewAdmin.bootstrap(app);
4190
+ }
4055
4191
  },
4056
4192
  async registerTrads({ locales }) {
4057
4193
  const importedTrads = await Promise.all(
4058
4194
  locales.map((locale) => {
4059
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-DKV44jRb.mjs"), "./translations/es.json": () => import("./es-CeXiYflN.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-CD9VFbPM.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-CtsUxOvk.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
4195
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Dtk_ot79.mjs"), "./translations/es.json": () => import("./es-D34tqjMw.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr--pg5jUbt.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-BHqhDq4V.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
4060
4196
  return {
4061
4197
  data: prefixPluginTranslations(data, PLUGIN_ID),
4062
4198
  locale
@@ -4083,9 +4219,10 @@ export {
4083
4219
  HOOKS as H,
4084
4220
  InjectionZone as I,
4085
4221
  useDocument as J,
4086
- index as K,
4087
- useContentManagerContext as L,
4088
- useDocumentActions as M,
4222
+ useGetPreviewUrlQuery as K,
4223
+ index as L,
4224
+ useContentManagerContext as M,
4225
+ useDocumentActions as N,
4089
4226
  Panels as P,
4090
4227
  RelativeTime as R,
4091
4228
  SINGLE_TYPES as S,
@@ -4117,4 +4254,4 @@ export {
4117
4254
  capitalise as y,
4118
4255
  useUpdateContentTypeConfigurationMutation as z
4119
4256
  };
4120
- //# sourceMappingURL=index-TaRzG09p.mjs.map
4257
+ //# sourceMappingURL=index-DVAIIsOs.mjs.map