@strapi/content-manager 0.0.0-experimental.fed75ee8e64c57dbed0b670b25ef026b69baab10 → 0.0.0-next.0af49f5c5ec496b0fad61ac9bfd4d0127b89d8d3

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 (197) 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-BLWQy8ru.js} +5 -6
  4. package/dist/_chunks/{ComponentConfigurationPage-DNRPa10q.js.map → ComponentConfigurationPage-BLWQy8ru.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-BVM7LScS.mjs → ComponentConfigurationPage-CtIa3aa2.mjs} +4 -4
  6. package/dist/_chunks/{ComponentConfigurationPage-BVM7LScS.mjs.map → ComponentConfigurationPage-CtIa3aa2.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-DsPR2DVk.mjs} +4 -4
  11. package/dist/_chunks/{EditConfigurationPage-BWq-9Zhk.mjs.map → EditConfigurationPage-DsPR2DVk.mjs.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-BrG0mEfF.js → EditConfigurationPage-RQkymxCy.js} +5 -6
  13. package/dist/_chunks/{EditConfigurationPage-BrG0mEfF.js.map → EditConfigurationPage-RQkymxCy.js.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-BbY0bNNE.js → EditViewPage-B-kExt8C.js} +38 -9
  15. package/dist/_chunks/EditViewPage-B-kExt8C.js.map +1 -0
  16. package/dist/_chunks/{EditViewPage-Dx0QnTxn.mjs → EditViewPage-BPyVuPfM.mjs} +38 -8
  17. package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +1 -0
  18. package/dist/_chunks/{Field-CglKum3X.js → Field-DPIsQRre.js} +178 -123
  19. package/dist/_chunks/Field-DPIsQRre.js.map +1 -0
  20. package/dist/_chunks/{Field-DVZSGAon.mjs → Field-Dltnt1km.mjs} +176 -121
  21. package/dist/_chunks/Field-Dltnt1km.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-B7nYNIUm.js → Form-BFi4MXMT.js} +5 -6
  25. package/dist/_chunks/{Form-B7nYNIUm.js.map → Form-BFi4MXMT.js.map} +1 -1
  26. package/dist/_chunks/{Form-BQwxPqu3.mjs → Form-C1IcWm1u.mjs} +3 -3
  27. package/dist/_chunks/{Form-BQwxPqu3.mjs.map → Form-C1IcWm1u.mjs.map} +1 -1
  28. package/dist/_chunks/{History-Bmu6tx6s.mjs → History-04ChQ4pl.mjs} +51 -97
  29. package/dist/_chunks/History-04ChQ4pl.mjs.map +1 -0
  30. package/dist/_chunks/{History-3JN4BIS1.js → History-wjcK4L0C.js} +51 -98
  31. package/dist/_chunks/History-wjcK4L0C.js.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-DwijcJ17.mjs → ListConfigurationPage-BYqPYLSU.mjs} +7 -6
  33. package/dist/_chunks/ListConfigurationPage-BYqPYLSU.mjs.map +1 -0
  34. package/dist/_chunks/{ListConfigurationPage-BcC28SV0.js → ListConfigurationPage-CRbxIC3J.js} +7 -7
  35. package/dist/_chunks/ListConfigurationPage-CRbxIC3J.js.map +1 -0
  36. package/dist/_chunks/{ListViewPage-ZPNQ6jWC.js → ListViewPage-D5NY9183.js} +63 -41
  37. package/dist/_chunks/ListViewPage-D5NY9183.js.map +1 -0
  38. package/dist/_chunks/{ListViewPage-DzhuS3CW.mjs → ListViewPage-FU2LBuhl.mjs} +62 -39
  39. package/dist/_chunks/ListViewPage-FU2LBuhl.mjs.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-DzwJNXvn.js → NoContentTypePage-BgQVE_Qb.js} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-DzwJNXvn.js.map → NoContentTypePage-BgQVE_Qb.js.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-BKMgOyd3.mjs → NoContentTypePage-DCKUkwb8.mjs} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-BKMgOyd3.mjs.map → NoContentTypePage-DCKUkwb8.mjs.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-GaweP-NG.js → NoPermissionsPage-C5jwn70o.js} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-GaweP-NG.js.map → NoPermissionsPage-C5jwn70o.js.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-DBbGJqL9.mjs → NoPermissionsPage-jqve7C8l.mjs} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-DBbGJqL9.mjs.map → NoPermissionsPage-jqve7C8l.mjs.map} +1 -1
  48. package/dist/_chunks/Preview-BMYN548c.mjs +294 -0
  49. package/dist/_chunks/Preview-BMYN548c.mjs.map +1 -0
  50. package/dist/_chunks/Preview-DaOihysv.js +312 -0
  51. package/dist/_chunks/Preview-DaOihysv.js.map +1 -0
  52. package/dist/_chunks/{Relations-BHXq_cKF.js → Relations-CTGM7Hv5.js} +47 -24
  53. package/dist/_chunks/Relations-CTGM7Hv5.js.map +1 -0
  54. package/dist/_chunks/{Relations-B7VtRA3g.mjs → Relations-gscPkxjF.mjs} +47 -23
  55. package/dist/_chunks/Relations-gscPkxjF.mjs.map +1 -0
  56. package/dist/_chunks/{en-Bm0D0IWz.js → en-BzQmavmK.js} +21 -4
  57. package/dist/_chunks/{en-Bm0D0IWz.js.map → en-BzQmavmK.js.map} +1 -1
  58. package/dist/_chunks/{en-DKV44jRb.mjs → en-CSxLmrh1.mjs} +21 -4
  59. package/dist/_chunks/{en-DKV44jRb.mjs.map → en-CSxLmrh1.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-Ca7YWlAA.js} +388 -224
  70. package/dist/_chunks/index-Ca7YWlAA.js.map +1 -0
  71. package/dist/_chunks/{index-TaRzG09p.mjs → index-DqasUQ6Q.mjs} +390 -226
  72. package/dist/_chunks/index-DqasUQ6Q.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-CrgXpOxT.js → layout-BW80JSCd.js} +5 -6
  78. package/dist/_chunks/{layout-CrgXpOxT.js.map → layout-BW80JSCd.js.map} +1 -1
  79. package/dist/_chunks/{layout-aX-RJhd5.mjs → layout-W3clJSCy.mjs} +4 -4
  80. package/dist/_chunks/{layout-aX-RJhd5.mjs.map → layout-W3clJSCy.mjs.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-D3Hlx6QX.mjs → relations-BlDkoeWh.mjs} +6 -7
  86. package/dist/_chunks/relations-BlDkoeWh.mjs.map +1 -0
  87. package/dist/_chunks/{relations-Z6RA1sBS.js → relations-C9Usz9k5.js} +6 -7
  88. package/dist/_chunks/relations-C9Usz9k5.js.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 +2 -1
  96. package/dist/admin/index.js.map +1 -1
  97. package/dist/admin/index.mjs +5 -4
  98. package/dist/admin/src/content-manager.d.ts +3 -2
  99. package/dist/admin/src/exports.d.ts +1 -0
  100. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  101. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  102. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  103. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
  104. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  105. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  106. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  107. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  108. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  109. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  110. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  111. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  112. package/dist/admin/src/preview/index.d.ts +4 -0
  113. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  114. package/dist/admin/src/preview/routes.d.ts +3 -0
  115. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  116. package/dist/admin/src/router.d.ts +1 -1
  117. package/dist/admin/src/services/api.d.ts +1 -1
  118. package/dist/admin/src/services/components.d.ts +2 -2
  119. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  120. package/dist/admin/src/services/documents.d.ts +16 -19
  121. package/dist/admin/src/services/init.d.ts +1 -1
  122. package/dist/admin/src/services/relations.d.ts +2 -2
  123. package/dist/admin/src/services/uid.d.ts +3 -3
  124. package/dist/server/index.js +560 -317
  125. package/dist/server/index.js.map +1 -1
  126. package/dist/server/index.mjs +561 -317
  127. package/dist/server/index.mjs.map +1 -1
  128. package/dist/server/src/bootstrap.d.ts.map +1 -1
  129. package/dist/server/src/controllers/index.d.ts.map +1 -1
  130. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  131. package/dist/server/src/controllers/utils/metadata.d.ts +16 -1
  132. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  133. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  134. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  135. package/dist/server/src/history/services/history.d.ts +3 -3
  136. package/dist/server/src/history/services/history.d.ts.map +1 -1
  137. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  138. package/dist/server/src/history/services/utils.d.ts +6 -11
  139. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  140. package/dist/server/src/index.d.ts +7 -6
  141. package/dist/server/src/index.d.ts.map +1 -1
  142. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  143. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  144. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  145. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  146. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  147. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  148. package/dist/server/src/preview/index.d.ts +4 -0
  149. package/dist/server/src/preview/index.d.ts.map +1 -0
  150. package/dist/server/src/preview/routes/index.d.ts +8 -0
  151. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  152. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  153. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  154. package/dist/server/src/preview/services/index.d.ts +16 -0
  155. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  156. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  157. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  158. package/dist/server/src/preview/services/preview.d.ts +12 -0
  159. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  160. package/dist/server/src/preview/utils.d.ts +19 -0
  161. package/dist/server/src/preview/utils.d.ts.map +1 -0
  162. package/dist/server/src/register.d.ts.map +1 -1
  163. package/dist/server/src/routes/index.d.ts.map +1 -1
  164. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  165. package/dist/server/src/services/document-metadata.d.ts +12 -10
  166. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  167. package/dist/server/src/services/index.d.ts +7 -6
  168. package/dist/server/src/services/index.d.ts.map +1 -1
  169. package/dist/server/src/services/utils/populate.d.ts +2 -2
  170. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  171. package/dist/server/src/utils/index.d.ts +2 -0
  172. package/dist/server/src/utils/index.d.ts.map +1 -1
  173. package/dist/shared/contracts/index.d.ts +1 -0
  174. package/dist/shared/contracts/index.d.ts.map +1 -1
  175. package/dist/shared/contracts/preview.d.ts +27 -0
  176. package/dist/shared/contracts/preview.d.ts.map +1 -0
  177. package/dist/shared/index.js +4 -0
  178. package/dist/shared/index.js.map +1 -1
  179. package/dist/shared/index.mjs +4 -0
  180. package/dist/shared/index.mjs.map +1 -1
  181. package/package.json +13 -11
  182. package/dist/_chunks/EditViewPage-BbY0bNNE.js.map +0 -1
  183. package/dist/_chunks/EditViewPage-Dx0QnTxn.mjs.map +0 -1
  184. package/dist/_chunks/Field-CglKum3X.js.map +0 -1
  185. package/dist/_chunks/Field-DVZSGAon.mjs.map +0 -1
  186. package/dist/_chunks/History-3JN4BIS1.js.map +0 -1
  187. package/dist/_chunks/History-Bmu6tx6s.mjs.map +0 -1
  188. package/dist/_chunks/ListConfigurationPage-BcC28SV0.js.map +0 -1
  189. package/dist/_chunks/ListConfigurationPage-DwijcJ17.mjs.map +0 -1
  190. package/dist/_chunks/ListViewPage-DzhuS3CW.mjs.map +0 -1
  191. package/dist/_chunks/ListViewPage-ZPNQ6jWC.js.map +0 -1
  192. package/dist/_chunks/Relations-B7VtRA3g.mjs.map +0 -1
  193. package/dist/_chunks/Relations-BHXq_cKF.js.map +0 -1
  194. package/dist/_chunks/index-DcA8_tJw.js.map +0 -1
  195. package/dist/_chunks/index-TaRzG09p.mjs.map +0 -1
  196. package/dist/_chunks/relations-D3Hlx6QX.mjs.map +0 -1
  197. 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";
@@ -167,7 +175,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
167
175
  "InitialData",
168
176
  "HistoryVersion",
169
177
  "Relations",
170
- "UidAvailability"
178
+ "UidAvailability",
179
+ "RecentDocumentList"
171
180
  ]
172
181
  });
173
182
  const documentApi = contentManagerApi.injectEndpoints({
@@ -185,7 +194,7 @@ const documentApi = contentManagerApi.injectEndpoints({
185
194
  if (error) {
186
195
  return [];
187
196
  }
188
- return [{ type: "Document", id: `${model}_LIST` }];
197
+ return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
189
198
  }
190
199
  }),
191
200
  cloneDocument: builder.mutation({
@@ -199,7 +208,8 @@ const documentApi = contentManagerApi.injectEndpoints({
199
208
  }),
200
209
  invalidatesTags: (_result, _error, { model }) => [
201
210
  { type: "Document", id: `${model}_LIST` },
202
- { type: "UidAvailability", id: model }
211
+ { type: "UidAvailability", id: model },
212
+ "RecentDocumentList"
203
213
  ]
204
214
  }),
205
215
  /**
@@ -218,8 +228,21 @@ const documentApi = contentManagerApi.injectEndpoints({
218
228
  invalidatesTags: (result, _error, { model }) => [
219
229
  { type: "Document", id: `${model}_LIST` },
220
230
  "Relations",
221
- { type: "UidAvailability", id: model }
222
- ]
231
+ { type: "UidAvailability", id: model },
232
+ "RecentDocumentList"
233
+ ],
234
+ transformResponse: (response, meta, arg) => {
235
+ if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
236
+ return {
237
+ data: response,
238
+ meta: {
239
+ availableStatus: [],
240
+ availableLocales: []
241
+ }
242
+ };
243
+ }
244
+ return response;
245
+ }
223
246
  }),
224
247
  deleteDocument: builder.mutation({
225
248
  query: ({ collectionType, model, documentId, params }) => ({
@@ -230,7 +253,8 @@ const documentApi = contentManagerApi.injectEndpoints({
230
253
  }
231
254
  }),
232
255
  invalidatesTags: (_result, _error, { collectionType, model }) => [
233
- { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
256
+ { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
257
+ "RecentDocumentList"
234
258
  ]
235
259
  }),
236
260
  deleteManyDocuments: builder.mutation({
@@ -242,7 +266,10 @@ const documentApi = contentManagerApi.injectEndpoints({
242
266
  params
243
267
  }
244
268
  }),
245
- invalidatesTags: (_res, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
269
+ invalidatesTags: (_res, _error, { model }) => [
270
+ { type: "Document", id: `${model}_LIST` },
271
+ "RecentDocumentList"
272
+ ]
246
273
  }),
247
274
  discardDocument: builder.mutation({
248
275
  query: ({ collectionType, model, documentId, params }) => ({
@@ -260,7 +287,8 @@ const documentApi = contentManagerApi.injectEndpoints({
260
287
  },
261
288
  { type: "Document", id: `${model}_LIST` },
262
289
  "Relations",
263
- { type: "UidAvailability", id: model }
290
+ { type: "UidAvailability", id: model },
291
+ "RecentDocumentList"
264
292
  ];
265
293
  }
266
294
  }),
@@ -273,7 +301,7 @@ const documentApi = contentManagerApi.injectEndpoints({
273
301
  url: `/content-manager/collection-types/${model}`,
274
302
  method: "GET",
275
303
  config: {
276
- params
304
+ params: stringify(params, { encode: true })
277
305
  }
278
306
  }),
279
307
  providesTags: (result, _error, arg) => {
@@ -355,7 +383,8 @@ const documentApi = contentManagerApi.injectEndpoints({
355
383
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
356
384
  },
357
385
  { type: "Document", id: `${model}_LIST` },
358
- "Relations"
386
+ "Relations",
387
+ "RecentDocumentList"
359
388
  ];
360
389
  }
361
390
  }),
@@ -386,7 +415,9 @@ const documentApi = contentManagerApi.injectEndpoints({
386
415
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
387
416
  },
388
417
  "Relations",
389
- { type: "UidAvailability", id: model }
418
+ { type: "UidAvailability", id: model },
419
+ "RecentDocumentList",
420
+ "RecentDocumentList"
390
421
  ];
391
422
  },
392
423
  async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
@@ -416,7 +447,8 @@ const documentApi = contentManagerApi.injectEndpoints({
416
447
  {
417
448
  type: "Document",
418
449
  id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
419
- }
450
+ },
451
+ "RecentDocumentList"
420
452
  ];
421
453
  }
422
454
  }),
@@ -429,7 +461,10 @@ const documentApi = contentManagerApi.injectEndpoints({
429
461
  params
430
462
  }
431
463
  }),
432
- invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
464
+ invalidatesTags: (_res, _error, { model, documentIds }) => [
465
+ ...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
466
+ "RecentDocumentList"
467
+ ]
433
468
  })
434
469
  })
435
470
  });
@@ -452,8 +487,7 @@ const {
452
487
  useUnpublishManyDocumentsMutation
453
488
  } = documentApi;
454
489
  const buildValidParams = (query) => {
455
- if (!query)
456
- return query;
490
+ if (!query) return query;
457
491
  const { plugins: _, ...validQueryParams } = {
458
492
  ...query,
459
493
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -461,9 +495,6 @@ const buildValidParams = (query) => {
461
495
  {}
462
496
  )
463
497
  };
464
- if ("_q" in validQueryParams) {
465
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
466
- }
467
498
  return validQueryParams;
468
499
  };
469
500
  const isBaseQueryError = (error) => {
@@ -968,9 +999,10 @@ const formatEditLayout = (data, {
968
999
  currentPanelIndex += 2;
969
1000
  } else {
970
1001
  if (!panels[currentPanelIndex]) {
971
- panels.push([]);
1002
+ panels.push([row]);
1003
+ } else {
1004
+ panels[currentPanelIndex].push(row);
972
1005
  }
973
- panels[currentPanelIndex].push(row);
974
1006
  }
975
1007
  return panels;
976
1008
  }, []);
@@ -1228,9 +1260,6 @@ const useContentManagerContext = () => {
1228
1260
  };
1229
1261
  };
1230
1262
  const prefixPluginTranslations = (trad, pluginId) => {
1231
- if (!pluginId) {
1232
- throw new TypeError("pluginId can't be empty");
1233
- }
1234
1263
  return Object.keys(trad).reduce((acc, current) => {
1235
1264
  acc[`${pluginId}.${current}`] = trad[current];
1236
1265
  return acc;
@@ -1664,10 +1693,10 @@ const useDocumentActions = () => {
1664
1693
  update
1665
1694
  };
1666
1695
  };
1667
- const ProtectedHistoryPage = lazy(
1668
- () => import("./History-Bmu6tx6s.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1696
+ const ProtectedHistoryPage = React.lazy(
1697
+ () => import("./History-04ChQ4pl.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1669
1698
  );
1670
- const routes$1 = [
1699
+ const routes$2 = [
1671
1700
  {
1672
1701
  path: ":collectionType/:slug/:id/history",
1673
1702
  Component: ProtectedHistoryPage
@@ -1677,32 +1706,45 @@ const routes$1 = [
1677
1706
  Component: ProtectedHistoryPage
1678
1707
  }
1679
1708
  ];
1709
+ const ProtectedPreviewPage = React.lazy(
1710
+ () => import("./Preview-BMYN548c.mjs").then((mod) => ({ default: mod.ProtectedPreviewPage }))
1711
+ );
1712
+ const routes$1 = [
1713
+ {
1714
+ path: ":collectionType/:slug/:id/preview",
1715
+ Component: ProtectedPreviewPage
1716
+ },
1717
+ {
1718
+ path: ":collectionType/:slug/preview",
1719
+ Component: ProtectedPreviewPage
1720
+ }
1721
+ ];
1680
1722
  const ProtectedEditViewPage = lazy(
1681
- () => import("./EditViewPage-Dx0QnTxn.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1723
+ () => import("./EditViewPage-BPyVuPfM.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1682
1724
  );
1683
1725
  const ProtectedListViewPage = lazy(
1684
- () => import("./ListViewPage-DzhuS3CW.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1726
+ () => import("./ListViewPage-FU2LBuhl.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1685
1727
  );
1686
1728
  const ProtectedListConfiguration = lazy(
1687
- () => import("./ListConfigurationPage-DwijcJ17.mjs").then((mod) => ({
1729
+ () => import("./ListConfigurationPage-BYqPYLSU.mjs").then((mod) => ({
1688
1730
  default: mod.ProtectedListConfiguration
1689
1731
  }))
1690
1732
  );
1691
1733
  const ProtectedEditConfigurationPage = lazy(
1692
- () => import("./EditConfigurationPage-BWq-9Zhk.mjs").then((mod) => ({
1734
+ () => import("./EditConfigurationPage-DsPR2DVk.mjs").then((mod) => ({
1693
1735
  default: mod.ProtectedEditConfigurationPage
1694
1736
  }))
1695
1737
  );
1696
1738
  const ProtectedComponentConfigurationPage = lazy(
1697
- () => import("./ComponentConfigurationPage-BVM7LScS.mjs").then((mod) => ({
1739
+ () => import("./ComponentConfigurationPage-CtIa3aa2.mjs").then((mod) => ({
1698
1740
  default: mod.ProtectedComponentConfigurationPage
1699
1741
  }))
1700
1742
  );
1701
1743
  const NoPermissions = lazy(
1702
- () => import("./NoPermissionsPage-DBbGJqL9.mjs").then((mod) => ({ default: mod.NoPermissions }))
1744
+ () => import("./NoPermissionsPage-jqve7C8l.mjs").then((mod) => ({ default: mod.NoPermissions }))
1703
1745
  );
1704
1746
  const NoContentType = lazy(
1705
- () => import("./NoContentTypePage-BKMgOyd3.mjs").then((mod) => ({ default: mod.NoContentType }))
1747
+ () => import("./NoContentTypePage-DCKUkwb8.mjs").then((mod) => ({ default: mod.NoContentType }))
1706
1748
  );
1707
1749
  const CollectionTypePages = () => {
1708
1750
  const { collectionType } = useParams();
@@ -1714,7 +1756,7 @@ const CollectionTypePages = () => {
1714
1756
  const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
1715
1757
  const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
1716
1758
  const LIST_RELATIVE_PATH = ":collectionType/:slug";
1717
- const LIST_PATH = `/content-manager/${LIST_RELATIVE_PATH}`;
1759
+ const LIST_PATH = `/content-manager/collection-types/:slug`;
1718
1760
  const routes = [
1719
1761
  {
1720
1762
  path: LIST_RELATIVE_PATH,
@@ -1748,6 +1790,7 @@ const routes = [
1748
1790
  path: "no-content-types",
1749
1791
  Component: NoContentType
1750
1792
  },
1793
+ ...routes$2,
1751
1794
  ...routes$1
1752
1795
  ];
1753
1796
  const DocumentActions = ({ actions: actions2 }) => {
@@ -1846,6 +1889,11 @@ const DocumentActionButton = (action) => {
1846
1889
  ) : null
1847
1890
  ] });
1848
1891
  };
1892
+ const MenuItem = styled(Menu.Item)`
1893
+ &:hover {
1894
+ background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
1895
+ }
1896
+ `;
1849
1897
  const DocumentActionsMenu = ({
1850
1898
  actions: actions2,
1851
1899
  children,
@@ -1904,48 +1952,32 @@ const DocumentActionsMenu = ({
1904
1952
  /* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1905
1953
  actions2.map((action) => {
1906
1954
  return /* @__PURE__ */ jsx(
1907
- Menu.Item,
1955
+ MenuItem,
1908
1956
  {
1909
1957
  disabled: action.disabled,
1910
1958
  onSelect: handleClick(action),
1911
1959
  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
- ] })
1960
+ isVariantDanger: action.variant === "danger",
1961
+ isDisabled: action.disabled,
1962
+ children: /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxs(
1963
+ Flex,
1964
+ {
1965
+ color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
1966
+ gap: 2,
1967
+ tag: "span",
1968
+ children: [
1969
+ /* @__PURE__ */ jsx(
1970
+ Flex,
1971
+ {
1972
+ tag: "span",
1973
+ color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
1974
+ children: action.icon
1975
+ }
1976
+ ),
1977
+ action.label
1978
+ ]
1979
+ }
1980
+ ) })
1949
1981
  },
1950
1982
  action.id
1951
1983
  );
@@ -2056,6 +2088,18 @@ const DocumentActionModal = ({
2056
2088
  typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
2057
2089
  ] }) });
2058
2090
  };
2091
+ const transformData = (data) => {
2092
+ if (Array.isArray(data)) {
2093
+ return data.map(transformData);
2094
+ }
2095
+ if (typeof data === "object" && data !== null) {
2096
+ if ("apiData" in data) {
2097
+ return data.apiData;
2098
+ }
2099
+ return mapValues(transformData)(data);
2100
+ }
2101
+ return data;
2102
+ };
2059
2103
  const PublishAction$1 = ({
2060
2104
  activeTab,
2061
2105
  documentId,
@@ -2070,6 +2114,7 @@ const PublishAction$1 = ({
2070
2114
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
2071
2115
  const isListView = useMatch(LIST_PATH) !== null;
2072
2116
  const isCloning = useMatch(CLONE_PATH) !== null;
2117
+ const { id } = useParams();
2073
2118
  const { formatMessage } = useIntl();
2074
2119
  const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
2075
2120
  const { publish } = useDocumentActions();
@@ -2169,13 +2214,15 @@ const PublishAction$1 = ({
2169
2214
  documentId,
2170
2215
  params
2171
2216
  },
2172
- formDocumentToData(formValues)
2217
+ transformData(formValues)
2173
2218
  );
2174
2219
  if ("data" in res && collectionType !== SINGLE_TYPES) {
2175
- navigate({
2176
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2177
- search: rawQuery
2178
- });
2220
+ if (id === "create") {
2221
+ navigate({
2222
+ pathname: `../${collectionType}/${model}/${res.data.documentId}`,
2223
+ search: rawQuery
2224
+ });
2225
+ }
2179
2226
  } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2180
2227
  setErrors(formatValidationErrors(res.error));
2181
2228
  }
@@ -2228,36 +2275,7 @@ const PublishAction$1 = ({
2228
2275
  };
2229
2276
  };
2230
2277
  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
- };
2278
+ PublishAction$1.position = "panel";
2261
2279
  const UpdateAction = ({
2262
2280
  activeTab,
2263
2281
  documentId,
@@ -2280,96 +2298,134 @@ const UpdateAction = ({
2280
2298
  const validate = useForm("UpdateAction", (state) => state.validate);
2281
2299
  const setErrors = useForm("UpdateAction", (state) => state.setErrors);
2282
2300
  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"
2301
+ const handleUpdate = React.useCallback(async () => {
2302
+ setSubmitting(true);
2303
+ try {
2304
+ if (!modified) {
2305
+ return;
2306
+ }
2307
+ const { errors } = await validate(true, {
2308
+ status: "draft"
2309
+ });
2310
+ if (errors) {
2311
+ toggleNotification({
2312
+ type: "danger",
2313
+ message: formatMessage({
2314
+ id: "content-manager.validation.error",
2315
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2316
+ })
2300
2317
  });
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(
2318
+ return;
2319
+ }
2320
+ if (isCloning) {
2321
+ const res = await clone(
2322
+ {
2323
+ model,
2324
+ documentId: cloneMatch.params.origin,
2325
+ params
2326
+ },
2327
+ transformData(document)
2328
+ );
2329
+ if ("data" in res) {
2330
+ navigate(
2333
2331
  {
2334
- collectionType,
2335
- model,
2336
- documentId,
2337
- params
2332
+ pathname: `../${res.data.documentId}`,
2333
+ search: rawQuery
2338
2334
  },
2339
- formDocumentToData(document)
2335
+ { relative: "path" }
2340
2336
  );
2341
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2342
- setErrors(formatValidationErrors(res.error));
2343
- } else {
2344
- resetForm();
2345
- }
2337
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2338
+ setErrors(formatValidationErrors(res.error));
2339
+ }
2340
+ } else if (documentId || collectionType === SINGLE_TYPES) {
2341
+ const res = await update(
2342
+ {
2343
+ collectionType,
2344
+ model,
2345
+ documentId,
2346
+ params
2347
+ },
2348
+ transformData(document)
2349
+ );
2350
+ if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2351
+ setErrors(formatValidationErrors(res.error));
2346
2352
  } else {
2347
- const res = await create(
2353
+ resetForm();
2354
+ }
2355
+ } else {
2356
+ const res = await create(
2357
+ {
2358
+ model,
2359
+ params
2360
+ },
2361
+ transformData(document)
2362
+ );
2363
+ if ("data" in res && collectionType !== SINGLE_TYPES) {
2364
+ navigate(
2348
2365
  {
2349
- model,
2350
- params
2366
+ pathname: `../${res.data.documentId}`,
2367
+ search: rawQuery
2351
2368
  },
2352
- formDocumentToData(document)
2369
+ { replace: true, relative: "path" }
2353
2370
  );
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
- }
2371
+ } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
2372
+ setErrors(formatValidationErrors(res.error));
2365
2373
  }
2366
- } finally {
2367
- setSubmitting(false);
2368
2374
  }
2375
+ } finally {
2376
+ setSubmitting(false);
2369
2377
  }
2378
+ }, [
2379
+ clone,
2380
+ cloneMatch?.params.origin,
2381
+ collectionType,
2382
+ create,
2383
+ document,
2384
+ documentId,
2385
+ formatMessage,
2386
+ formatValidationErrors,
2387
+ isCloning,
2388
+ model,
2389
+ modified,
2390
+ navigate,
2391
+ params,
2392
+ rawQuery,
2393
+ resetForm,
2394
+ setErrors,
2395
+ setSubmitting,
2396
+ toggleNotification,
2397
+ update,
2398
+ validate
2399
+ ]);
2400
+ React.useEffect(() => {
2401
+ const handleKeyDown = (e) => {
2402
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
2403
+ e.preventDefault();
2404
+ handleUpdate();
2405
+ }
2406
+ };
2407
+ window.addEventListener("keydown", handleKeyDown);
2408
+ return () => {
2409
+ window.removeEventListener("keydown", handleKeyDown);
2410
+ };
2411
+ }, [handleUpdate]);
2412
+ return {
2413
+ /**
2414
+ * Disabled when:
2415
+ * - the form is submitting
2416
+ * - the document is not modified & we're not cloning (you can save a clone entity straight away)
2417
+ * - the active tab is the published tab
2418
+ */
2419
+ disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
2420
+ label: formatMessage({
2421
+ id: "global.save",
2422
+ defaultMessage: "Save"
2423
+ }),
2424
+ onClick: handleUpdate
2370
2425
  };
2371
2426
  };
2372
2427
  UpdateAction.type = "update";
2428
+ UpdateAction.position = "panel";
2373
2429
  const UNPUBLISH_DRAFT_OPTIONS = {
2374
2430
  KEEP: "keep",
2375
2431
  DISCARD: "discard"
@@ -2492,6 +2548,7 @@ const UnpublishAction$1 = ({
2492
2548
  };
2493
2549
  };
2494
2550
  UnpublishAction$1.type = "unpublish";
2551
+ UnpublishAction$1.position = "panel";
2495
2552
  const DiscardAction = ({
2496
2553
  activeTab,
2497
2554
  documentId,
@@ -2542,6 +2599,7 @@ const DiscardAction = ({
2542
2599
  };
2543
2600
  };
2544
2601
  DiscardAction.type = "discard";
2602
+ DiscardAction.position = "panel";
2545
2603
  const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2546
2604
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2547
2605
  const RelativeTime = React.forwardRef(
@@ -2554,7 +2612,7 @@ const RelativeTime = React.forwardRef(
2554
2612
  });
2555
2613
  const unit = intervals.find((intervalUnit) => {
2556
2614
  return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
2557
- });
2615
+ }) ?? "seconds";
2558
2616
  const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
2559
2617
  const customInterval = customIntervals.find(
2560
2618
  (custom) => interval[custom.unit] < custom.threshold
@@ -2588,19 +2646,29 @@ const getDisplayName = ({
2588
2646
  return email ?? "";
2589
2647
  };
2590
2648
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2591
- const DocumentStatus = ({ status = "draft", ...restProps }) => {
2649
+ const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
2592
2650
  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) }) });
2651
+ const { formatMessage } = useIntl();
2652
+ return /* @__PURE__ */ jsx(Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
2653
+ id: `content-manager.containers.List.${status}`,
2654
+ defaultMessage: capitalise(status)
2655
+ }) }) });
2594
2656
  };
2595
2657
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2596
2658
  const { formatMessage } = useIntl();
2597
2659
  const isCloning = useMatch(CLONE_PATH) !== null;
2660
+ const params = useParams();
2598
2661
  const title = isCreating ? formatMessage({
2599
2662
  id: "content-manager.containers.edit.title.new",
2600
2663
  defaultMessage: "Create an entry"
2601
2664
  }) : documentTitle;
2602
2665
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
2603
- /* @__PURE__ */ jsx(BackButton, {}),
2666
+ /* @__PURE__ */ jsx(
2667
+ BackButton,
2668
+ {
2669
+ fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
2670
+ }
2671
+ ),
2604
2672
  /* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
2605
2673
  /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
2606
2674
  /* @__PURE__ */ jsx(HeaderToolbar, {})
@@ -2651,7 +2719,7 @@ const HeaderToolbar = () => {
2651
2719
  meta: isCloning ? void 0 : meta,
2652
2720
  collectionType
2653
2721
  },
2654
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2722
+ descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
2655
2723
  children: (actions2) => {
2656
2724
  const headerActions = actions2.filter((action) => {
2657
2725
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -2859,6 +2927,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2859
2927
  };
2860
2928
  };
2861
2929
  ConfigureTheViewAction.type = "configure-the-view";
2930
+ ConfigureTheViewAction.position = "header";
2862
2931
  const EditTheModelAction = ({ model }) => {
2863
2932
  const navigate = useNavigate();
2864
2933
  const { formatMessage } = useIntl();
@@ -2875,6 +2944,7 @@ const EditTheModelAction = ({ model }) => {
2875
2944
  };
2876
2945
  };
2877
2946
  EditTheModelAction.type = "edit-the-model";
2947
+ EditTheModelAction.position = "header";
2878
2948
  const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2879
2949
  const navigate = useNavigate();
2880
2950
  const { formatMessage } = useIntl();
@@ -2948,6 +3018,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2948
3018
  };
2949
3019
  };
2950
3020
  DeleteAction$1.type = "delete";
3021
+ DeleteAction$1.position = ["header", "table-row"];
2951
3022
  const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2952
3023
  const Panels = () => {
2953
3024
  const isCloning = useMatch(CLONE_PATH) !== null;
@@ -3010,7 +3081,7 @@ const ActionsPanelContent = () => {
3010
3081
  DescriptionComponentRenderer,
3011
3082
  {
3012
3083
  props,
3013
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3084
+ descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
3014
3085
  children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
3015
3086
  }
3016
3087
  ),
@@ -3037,7 +3108,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
3037
3108
  justifyContent: "stretch",
3038
3109
  alignItems: "flex-start",
3039
3110
  children: [
3040
- /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
3111
+ /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3041
3112
  children
3042
3113
  ]
3043
3114
  }
@@ -3287,18 +3358,10 @@ const SelectedEntriesTableContent = ({
3287
3358
  search: row.locale && `?plugins[i18n][locale]=${row.locale}`
3288
3359
  },
3289
3360
  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
- ),
3361
+ label: formatMessage({
3362
+ id: "content-manager.bulk-publish.edit",
3363
+ defaultMessage: "Edit"
3364
+ }),
3302
3365
  target: "_blank",
3303
3366
  marginLeft: "auto",
3304
3367
  variant: "ghost",
@@ -3472,8 +3535,7 @@ const PublishAction = ({ documents, model }) => {
3472
3535
  const refetchList = () => {
3473
3536
  contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3474
3537
  };
3475
- if (!showPublishButton)
3476
- return null;
3538
+ if (!showPublishButton) return null;
3477
3539
  return {
3478
3540
  actionType: "publish",
3479
3541
  variant: "tertiary",
@@ -3541,8 +3603,7 @@ const DeleteAction = ({ documents, model }) => {
3541
3603
  selectRow([]);
3542
3604
  }
3543
3605
  };
3544
- if (!hasDeletePermission)
3545
- return null;
3606
+ if (!hasDeletePermission) return null;
3546
3607
  return {
3547
3608
  variant: "danger-light",
3548
3609
  label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
@@ -3591,8 +3652,7 @@ const UnpublishAction = ({ documents, model }) => {
3591
3652
  }
3592
3653
  };
3593
3654
  const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3594
- if (!showUnpublishButton)
3595
- return null;
3655
+ if (!showUnpublishButton) return null;
3596
3656
  return {
3597
3657
  variant: "tertiary",
3598
3658
  label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
@@ -3697,7 +3757,7 @@ const TableActions = ({ document }) => {
3697
3757
  DescriptionComponentRenderer,
3698
3758
  {
3699
3759
  props,
3700
- descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
3760
+ descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
3701
3761
  children: (actions2) => {
3702
3762
  const tableRowActions = actions2.filter((action) => {
3703
3763
  const positions = Array.isArray(action.position) ? action.position : [action.position];
@@ -3756,6 +3816,7 @@ const EditAction = ({ documentId }) => {
3756
3816
  };
3757
3817
  };
3758
3818
  EditAction.type = "edit";
3819
+ EditAction.position = "table-row";
3759
3820
  const StyledPencil = styled(Pencil)`
3760
3821
  path {
3761
3822
  fill: currentColor;
@@ -3832,6 +3893,7 @@ const CloneAction = ({ model, documentId }) => {
3832
3893
  };
3833
3894
  };
3834
3895
  CloneAction.type = "clone";
3896
+ CloneAction.position = "table-row";
3835
3897
  const StyledDuplicate = styled(Duplicate)`
3836
3898
  path {
3837
3899
  fill: currentColor;
@@ -3918,7 +3980,14 @@ class ContentManagerPlugin {
3918
3980
  addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3919
3981
  addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3920
3982
  getBulkActions: () => this.bulkActions,
3921
- getDocumentActions: () => this.documentActions,
3983
+ getDocumentActions: (position) => {
3984
+ if (position) {
3985
+ return this.documentActions.filter(
3986
+ (action) => action.position == void 0 || [action.position].flat().includes(position)
3987
+ );
3988
+ }
3989
+ return this.documentActions;
3990
+ },
3922
3991
  getEditViewSidePanels: () => this.editViewSidePanels,
3923
3992
  getHeaderActions: () => this.headerActions
3924
3993
  }
@@ -3928,10 +3997,8 @@ class ContentManagerPlugin {
3928
3997
  const getPrintableType = (value) => {
3929
3998
  const nativeType = typeof value;
3930
3999
  if (nativeType === "object") {
3931
- if (value === null)
3932
- return "null";
3933
- if (Array.isArray(value))
3934
- return "array";
4000
+ if (value === null) return "null";
4001
+ if (Array.isArray(value)) return "array";
3935
4002
  if (value instanceof Object && value.constructor.name !== "Object") {
3936
4003
  return value.constructor.name;
3937
4004
  }
@@ -3942,17 +4009,27 @@ const HistoryAction = ({ model, document }) => {
3942
4009
  const { formatMessage } = useIntl();
3943
4010
  const [{ query }] = useQueryParams();
3944
4011
  const navigate = useNavigate();
4012
+ const { trackUsage } = useTracking();
4013
+ const { pathname } = useLocation();
3945
4014
  const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
3946
4015
  if (!window.strapi.features.isEnabled("cms-content-history")) {
3947
4016
  return null;
3948
4017
  }
4018
+ const handleOnClick = () => {
4019
+ const destination = { pathname: "history", search: pluginsQueryParams };
4020
+ trackUsage("willNavigate", {
4021
+ from: pathname,
4022
+ to: `${pathname}/${destination.pathname}`
4023
+ });
4024
+ navigate(destination);
4025
+ };
3949
4026
  return {
3950
4027
  icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
3951
4028
  label: formatMessage({
3952
4029
  id: "content-manager.history.document-action",
3953
4030
  defaultMessage: "Content History"
3954
4031
  }),
3955
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
4032
+ onClick: handleOnClick,
3956
4033
  disabled: (
3957
4034
  /**
3958
4035
  * The user is creating a new document.
@@ -3974,6 +4051,7 @@ const HistoryAction = ({ model, document }) => {
3974
4051
  };
3975
4052
  };
3976
4053
  HistoryAction.type = "history";
4054
+ HistoryAction.position = "header";
3977
4055
  const historyAdmin = {
3978
4056
  bootstrap(app) {
3979
4057
  const { addDocumentAction } = app.getPlugin("content-manager").apis;
@@ -4020,6 +4098,88 @@ const { setInitialData } = actions;
4020
4098
  const reducer = combineReducers({
4021
4099
  app: reducer$1
4022
4100
  });
4101
+ const previewApi = contentManagerApi.injectEndpoints({
4102
+ endpoints: (builder) => ({
4103
+ getPreviewUrl: builder.query({
4104
+ query({ query, params }) {
4105
+ return {
4106
+ url: `/content-manager/preview/url/${params.contentType}`,
4107
+ method: "GET",
4108
+ config: {
4109
+ params: query
4110
+ }
4111
+ };
4112
+ }
4113
+ })
4114
+ })
4115
+ });
4116
+ const { useGetPreviewUrlQuery } = previewApi;
4117
+ const ConditionalTooltip = ({ isShown, label, children }) => {
4118
+ if (isShown) {
4119
+ return /* @__PURE__ */ jsx(Tooltip, { label, children });
4120
+ }
4121
+ return children;
4122
+ };
4123
+ const PreviewSidePanel = ({ model, documentId, document }) => {
4124
+ const { formatMessage } = useIntl();
4125
+ const { trackUsage } = useTracking();
4126
+ const { pathname } = useLocation();
4127
+ const [{ query }] = useQueryParams();
4128
+ const isModified = useForm("PreviewSidePanel", (state) => state.modified);
4129
+ const { data, error } = useGetPreviewUrlQuery({
4130
+ params: {
4131
+ contentType: model
4132
+ },
4133
+ query: {
4134
+ documentId,
4135
+ locale: document?.locale,
4136
+ status: document?.status
4137
+ }
4138
+ });
4139
+ if (!data?.data?.url || error) {
4140
+ return null;
4141
+ }
4142
+ const trackNavigation = () => {
4143
+ const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
4144
+ trackUsage("willNavigate", { from: pathname, to: destinationPathname });
4145
+ };
4146
+ return {
4147
+ title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4148
+ content: /* @__PURE__ */ jsx(
4149
+ ConditionalTooltip,
4150
+ {
4151
+ label: formatMessage({
4152
+ id: "content-manager.preview.panel.button-disabled-tooltip",
4153
+ defaultMessage: "Please save to open the preview"
4154
+ }),
4155
+ isShown: isModified,
4156
+ children: /* @__PURE__ */ jsx(Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsx(
4157
+ Button,
4158
+ {
4159
+ variant: "tertiary",
4160
+ tag: Link,
4161
+ to: { pathname: "preview", search: stringify(query, { encode: false }) },
4162
+ onClick: trackNavigation,
4163
+ width: "100%",
4164
+ disabled: isModified,
4165
+ pointerEvents: isModified ? "none" : void 0,
4166
+ tabIndex: isModified ? -1 : void 0,
4167
+ children: formatMessage({
4168
+ id: "content-manager.preview.panel.button",
4169
+ defaultMessage: "Open preview"
4170
+ })
4171
+ }
4172
+ ) })
4173
+ }
4174
+ )
4175
+ };
4176
+ };
4177
+ const previewAdmin = {
4178
+ bootstrap(app) {
4179
+ const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4180
+ contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4181
+ }
4182
+ };
4023
4183
  const index = {
4024
4184
  register(app) {
4025
4185
  const cm = new ContentManagerPlugin();
@@ -4039,7 +4199,7 @@ const index = {
4039
4199
  app.router.addRoute({
4040
4200
  path: "content-manager/*",
4041
4201
  lazy: async () => {
4042
- const { Layout } = await import("./layout-aX-RJhd5.mjs");
4202
+ const { Layout } = await import("./layout-W3clJSCy.mjs");
4043
4203
  return {
4044
4204
  Component: Layout
4045
4205
  };
@@ -4052,11 +4212,14 @@ const index = {
4052
4212
  if (typeof historyAdmin.bootstrap === "function") {
4053
4213
  historyAdmin.bootstrap(app);
4054
4214
  }
4215
+ if (typeof previewAdmin.bootstrap === "function") {
4216
+ previewAdmin.bootstrap(app);
4217
+ }
4055
4218
  },
4056
4219
  async registerTrads({ locales }) {
4057
4220
  const importedTrads = await Promise.all(
4058
4221
  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 }) => {
4222
+ 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-CSxLmrh1.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
4223
  return {
4061
4224
  data: prefixPluginTranslations(data, PLUGIN_ID),
4062
4225
  locale
@@ -4083,9 +4246,10 @@ export {
4083
4246
  HOOKS as H,
4084
4247
  InjectionZone as I,
4085
4248
  useDocument as J,
4086
- index as K,
4087
- useContentManagerContext as L,
4088
- useDocumentActions as M,
4249
+ useGetPreviewUrlQuery as K,
4250
+ index as L,
4251
+ useContentManagerContext as M,
4252
+ useDocumentActions as N,
4089
4253
  Panels as P,
4090
4254
  RelativeTime as R,
4091
4255
  SINGLE_TYPES as S,
@@ -4117,4 +4281,4 @@ export {
4117
4281
  capitalise as y,
4118
4282
  useUpdateContentTypeConfigurationMutation as z
4119
4283
  };
4120
- //# sourceMappingURL=index-TaRzG09p.mjs.map
4284
+ //# sourceMappingURL=index-DqasUQ6Q.mjs.map