@strapi/content-manager 0.0.0-experimental.a65a85fdea97faae8679d3ffc5f9d79af61abd26 → 0.0.0-experimental.c3e9d4b26f9fd3d9eb530b5c11f9baa1d09b13ad

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 (176) hide show
  1. package/dist/_chunks/{CardDragPreview-DSVYodBX.js → CardDragPreview-C0QyJgRA.js} +10 -14
  2. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -0
  3. package/dist/_chunks/{CardDragPreview-ikSG4M46.mjs → CardDragPreview-DOxamsuj.mjs} +7 -9
  4. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -0
  5. package/dist/_chunks/{ComponentConfigurationPage--2aLCv-G.mjs → ComponentConfigurationPage-BMajAl1u.mjs} +3 -3
  6. package/dist/_chunks/{ComponentConfigurationPage--2aLCv-G.mjs.map → ComponentConfigurationPage-BMajAl1u.mjs.map} +1 -1
  7. package/dist/_chunks/{ComponentConfigurationPage-43KmCNQE.js → ComponentConfigurationPage-y_7iLdmB.js} +3 -3
  8. package/dist/_chunks/{ComponentConfigurationPage-43KmCNQE.js.map → ComponentConfigurationPage-y_7iLdmB.js.map} +1 -1
  9. package/dist/_chunks/{ComponentIcon-BBQsYCVn.js → ComponentIcon-BXdiCGQp.js} +8 -2
  10. package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +1 -0
  11. package/dist/_chunks/{ComponentIcon-BOFnK76n.mjs → ComponentIcon-u4bIXTFY.mjs} +9 -3
  12. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -0
  13. package/dist/_chunks/{EditConfigurationPage-BfFzJ4Br.js → EditConfigurationPage-CPVB8Uqc.js} +3 -3
  14. package/dist/_chunks/{EditConfigurationPage-BfFzJ4Br.js.map → EditConfigurationPage-CPVB8Uqc.js.map} +1 -1
  15. package/dist/_chunks/{EditConfigurationPage-CUcGHHvQ.mjs → EditConfigurationPage-CcOoD26O.mjs} +3 -3
  16. package/dist/_chunks/{EditConfigurationPage-CUcGHHvQ.mjs.map → EditConfigurationPage-CcOoD26O.mjs.map} +1 -1
  17. package/dist/_chunks/{EditViewPage-CzOT5Kpj.js → EditViewPage-CTTDHKkQ.js} +7 -9
  18. package/dist/_chunks/EditViewPage-CTTDHKkQ.js.map +1 -0
  19. package/dist/_chunks/{EditViewPage-Bm8lgcm6.mjs → EditViewPage-DWb0DE7R.mjs} +6 -6
  20. package/dist/_chunks/EditViewPage-DWb0DE7R.mjs.map +1 -0
  21. package/dist/_chunks/{Field-Caef4JjM.js → Field-C5Z1Ivdv.js} +552 -661
  22. package/dist/_chunks/Field-C5Z1Ivdv.js.map +1 -0
  23. package/dist/_chunks/{Field-Dlh0uGnL.mjs → Field-DnStdvQw.mjs} +500 -608
  24. package/dist/_chunks/Field-DnStdvQw.mjs.map +1 -0
  25. package/dist/_chunks/{Form-BzuAjtRq.js → Form-B81OtW-k.js} +21 -19
  26. package/dist/_chunks/Form-B81OtW-k.js.map +1 -0
  27. package/dist/_chunks/{Form-EnaQL_6L.mjs → Form-DqGgE55Q.mjs} +21 -18
  28. package/dist/_chunks/Form-DqGgE55Q.mjs.map +1 -0
  29. package/dist/_chunks/{History-C17LiyRg.js → History-4NbOq2dX.js} +119 -49
  30. package/dist/_chunks/History-4NbOq2dX.js.map +1 -0
  31. package/dist/_chunks/{History-D6sbCJvo.mjs → History-DS6-HCYX.mjs} +119 -48
  32. package/dist/_chunks/History-DS6-HCYX.mjs.map +1 -0
  33. package/dist/_chunks/{ListConfigurationPage-Dks5SX6f.js → ListConfigurationPage-CpfstlYY.js} +17 -19
  34. package/dist/_chunks/ListConfigurationPage-CpfstlYY.js.map +1 -0
  35. package/dist/_chunks/{ListConfigurationPage-Ce4qs7qE.mjs → ListConfigurationPage-DQJJltko.mjs} +14 -14
  36. package/dist/_chunks/ListConfigurationPage-DQJJltko.mjs.map +1 -0
  37. package/dist/_chunks/{ListViewPage-BwrZrPsh.js → ListViewPage-CA3I75m5.js} +43 -51
  38. package/dist/_chunks/ListViewPage-CA3I75m5.js.map +1 -0
  39. package/dist/_chunks/{ListViewPage-Be7S5aKL.mjs → ListViewPage-nQrOQuVo.mjs} +37 -45
  40. package/dist/_chunks/ListViewPage-nQrOQuVo.mjs.map +1 -0
  41. package/dist/_chunks/{NoContentTypePage-CIPmYQMm.mjs → NoContentTypePage-DbnHE22g.mjs} +7 -7
  42. package/dist/_chunks/NoContentTypePage-DbnHE22g.mjs.map +1 -0
  43. package/dist/_chunks/{NoContentTypePage-Cu5r1-JT.js → NoContentTypePage-Dldu-_Mx.js} +5 -5
  44. package/dist/_chunks/NoContentTypePage-Dldu-_Mx.js.map +1 -0
  45. package/dist/_chunks/{NoPermissionsPage-C-j6TEUF.js → NoPermissionsPage-CO2MK200.js} +4 -5
  46. package/dist/_chunks/NoPermissionsPage-CO2MK200.js.map +1 -0
  47. package/dist/_chunks/{NoPermissionsPage-DhJ7LYrr.mjs → NoPermissionsPage-fOIkQM0v.mjs} +5 -6
  48. package/dist/_chunks/NoPermissionsPage-fOIkQM0v.mjs.map +1 -0
  49. package/dist/_chunks/{Relations-CY7AtkDA.mjs → Relations-BDRl99Ux.mjs} +66 -56
  50. package/dist/_chunks/Relations-BDRl99Ux.mjs.map +1 -0
  51. package/dist/_chunks/{Relations-Czs-uZ-s.js → Relations-DG2jnOcr.js} +70 -61
  52. package/dist/_chunks/Relations-DG2jnOcr.js.map +1 -0
  53. package/dist/_chunks/{en-MBPul9Su.mjs → en-Ux26r5pl.mjs} +7 -1
  54. package/dist/_chunks/{en-MBPul9Su.mjs.map → en-Ux26r5pl.mjs.map} +1 -1
  55. package/dist/_chunks/{en-C-V1_90f.js → en-fbKQxLGn.js} +7 -1
  56. package/dist/_chunks/{en-C-V1_90f.js.map → en-fbKQxLGn.js.map} +1 -1
  57. package/dist/_chunks/{index-X_2tafck.js → index-BZoNZMXL.js} +1556 -795
  58. package/dist/_chunks/index-BZoNZMXL.js.map +1 -0
  59. package/dist/_chunks/{index-DNVx8ssZ.mjs → index-Drt2DN7v.mjs} +1569 -807
  60. package/dist/_chunks/index-Drt2DN7v.mjs.map +1 -0
  61. package/dist/_chunks/{layout-Dnh0PNp9.mjs → layout-BzAbmoO6.mjs} +27 -22
  62. package/dist/_chunks/layout-BzAbmoO6.mjs.map +1 -0
  63. package/dist/_chunks/{layout-dBc7wN7L.js → layout-DEYBqgF1.js} +28 -25
  64. package/dist/_chunks/layout-DEYBqgF1.js.map +1 -0
  65. package/dist/_chunks/{relations-4pHtBrHJ.js → relations-D0eZ4VWw.js} +2 -2
  66. package/dist/_chunks/{relations-4pHtBrHJ.js.map → relations-D0eZ4VWw.js.map} +1 -1
  67. package/dist/_chunks/{relations-Dx7tMKJN.mjs → relations-D26zVRdi.mjs} +2 -2
  68. package/dist/_chunks/{relations-Dx7tMKJN.mjs.map → relations-D26zVRdi.mjs.map} +1 -1
  69. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +1 -1
  70. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +1 -1
  71. package/dist/_chunks/usePrev-B9w_-eYc.js +15 -0
  72. package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
  73. package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
  74. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
  75. package/dist/admin/index.js +2 -1
  76. package/dist/admin/index.js.map +1 -1
  77. package/dist/admin/index.mjs +8 -7
  78. package/dist/admin/src/components/ComponentIcon.d.ts +6 -3
  79. package/dist/admin/src/content-manager.d.ts +3 -3
  80. package/dist/admin/src/exports.d.ts +1 -0
  81. package/dist/admin/src/history/components/VersionInputRenderer.d.ts +1 -1
  82. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  83. package/dist/admin/src/hooks/useDocument.d.ts +5 -8
  84. package/dist/admin/src/hooks/useDocumentActions.d.ts +24 -3
  85. package/dist/admin/src/hooks/useDocumentLayout.d.ts +2 -2
  86. package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
  87. package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  88. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +3 -1
  89. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.d.ts +3 -3
  90. package/dist/admin/src/pages/EditView/components/FormInputs/Component/Input.d.ts +2 -2
  91. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.d.ts +3 -5
  92. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +1 -1
  93. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +10 -18
  94. package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +2 -2
  95. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +3 -49
  96. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.d.ts +2 -2
  97. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +67 -52
  98. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +2 -10
  99. package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +9 -26
  100. package/dist/admin/src/services/api.d.ts +2 -3
  101. package/dist/admin/src/services/components.d.ts +2 -2
  102. package/dist/admin/src/services/contentTypes.d.ts +5 -5
  103. package/dist/admin/src/services/documents.d.ts +29 -17
  104. package/dist/admin/src/services/init.d.ts +2 -2
  105. package/dist/admin/src/services/relations.d.ts +3 -3
  106. package/dist/admin/src/services/uid.d.ts +3 -3
  107. package/dist/admin/src/utils/api.d.ts +4 -18
  108. package/dist/admin/src/utils/validation.d.ts +1 -6
  109. package/dist/server/index.js +540 -414
  110. package/dist/server/index.js.map +1 -1
  111. package/dist/server/index.mjs +548 -422
  112. package/dist/server/index.mjs.map +1 -1
  113. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  114. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  115. package/dist/server/src/controllers/utils/metadata.d.ts +8 -0
  116. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -0
  117. package/dist/server/src/controllers/validation/dimensions.d.ts +9 -0
  118. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -0
  119. package/dist/server/src/controllers/validation/index.d.ts +1 -1
  120. package/dist/server/src/history/services/history.d.ts +2 -4
  121. package/dist/server/src/history/services/history.d.ts.map +1 -1
  122. package/dist/server/src/history/services/index.d.ts +6 -2
  123. package/dist/server/src/history/services/index.d.ts.map +1 -1
  124. package/dist/server/src/history/services/lifecycles.d.ts +9 -0
  125. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -0
  126. package/dist/server/src/history/services/utils.d.ts +41 -9
  127. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  128. package/dist/server/src/history/utils.d.ts +6 -2
  129. package/dist/server/src/history/utils.d.ts.map +1 -1
  130. package/dist/server/src/index.d.ts +18 -39
  131. package/dist/server/src/index.d.ts.map +1 -1
  132. package/dist/server/src/services/document-manager.d.ts +13 -12
  133. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  134. package/dist/server/src/services/document-metadata.d.ts +8 -29
  135. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  136. package/dist/server/src/services/index.d.ts +18 -39
  137. package/dist/server/src/services/index.d.ts.map +1 -1
  138. package/dist/server/src/services/utils/populate.d.ts +8 -1
  139. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  140. package/dist/shared/contracts/collection-types.d.ts +14 -6
  141. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  142. package/dist/shared/contracts/relations.d.ts +2 -2
  143. package/dist/shared/contracts/relations.d.ts.map +1 -1
  144. package/package.json +13 -14
  145. package/dist/_chunks/CardDragPreview-DSVYodBX.js.map +0 -1
  146. package/dist/_chunks/CardDragPreview-ikSG4M46.mjs.map +0 -1
  147. package/dist/_chunks/ComponentIcon-BBQsYCVn.js.map +0 -1
  148. package/dist/_chunks/ComponentIcon-BOFnK76n.mjs.map +0 -1
  149. package/dist/_chunks/EditViewPage-Bm8lgcm6.mjs.map +0 -1
  150. package/dist/_chunks/EditViewPage-CzOT5Kpj.js.map +0 -1
  151. package/dist/_chunks/Field-Caef4JjM.js.map +0 -1
  152. package/dist/_chunks/Field-Dlh0uGnL.mjs.map +0 -1
  153. package/dist/_chunks/Form-BzuAjtRq.js.map +0 -1
  154. package/dist/_chunks/Form-EnaQL_6L.mjs.map +0 -1
  155. package/dist/_chunks/History-C17LiyRg.js.map +0 -1
  156. package/dist/_chunks/History-D6sbCJvo.mjs.map +0 -1
  157. package/dist/_chunks/ListConfigurationPage-Ce4qs7qE.mjs.map +0 -1
  158. package/dist/_chunks/ListConfigurationPage-Dks5SX6f.js.map +0 -1
  159. package/dist/_chunks/ListViewPage-Be7S5aKL.mjs.map +0 -1
  160. package/dist/_chunks/ListViewPage-BwrZrPsh.js.map +0 -1
  161. package/dist/_chunks/NoContentTypePage-CIPmYQMm.mjs.map +0 -1
  162. package/dist/_chunks/NoContentTypePage-Cu5r1-JT.js.map +0 -1
  163. package/dist/_chunks/NoPermissionsPage-C-j6TEUF.js.map +0 -1
  164. package/dist/_chunks/NoPermissionsPage-DhJ7LYrr.mjs.map +0 -1
  165. package/dist/_chunks/Relations-CY7AtkDA.mjs.map +0 -1
  166. package/dist/_chunks/Relations-Czs-uZ-s.js.map +0 -1
  167. package/dist/_chunks/index-DNVx8ssZ.mjs.map +0 -1
  168. package/dist/_chunks/index-X_2tafck.js.map +0 -1
  169. package/dist/_chunks/layout-Dnh0PNp9.mjs.map +0 -1
  170. package/dist/_chunks/layout-dBc7wN7L.js.map +0 -1
  171. package/dist/_chunks/urls-CbOsUOoW.mjs +0 -7
  172. package/dist/_chunks/urls-CbOsUOoW.mjs.map +0 -1
  173. package/dist/_chunks/urls-DzZya_gm.js +0 -6
  174. package/dist/_chunks/urls-DzZya_gm.js.map +0 -1
  175. package/dist/server/src/controllers/utils/dimensions.d.ts +0 -5
  176. package/dist/server/src/controllers/utils/dimensions.d.ts.map +0 -1
@@ -1,17 +1,15 @@
1
- import { ClockCounterClockwise, CrossCircle, More, WarningCircle, Cog, Pencil, Trash, ChevronRight, Duplicate, Feather } from "@strapi/icons";
1
+ import { ClockCounterClockwise, CrossCircle, More, WarningCircle, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, Feather } from "@strapi/icons";
2
2
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
- import { useStrapiApp, useQueryParams, createContext, useAuth, useRBAC, Page, getFetchClient, translatedErrors, useNotification, useAPIErrorHandler, useTracking, useForm, BackButton, DescriptionComponentRenderer } from "@strapi/admin/strapi-admin";
3
+ import { useStrapiApp, useQueryParams, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useTracking, useForm, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
4
4
  import { stringify } from "qs";
5
5
  import { useIntl } from "react-intl";
6
- import { useNavigate, useParams, Navigate, useMatch, NavLink } from "react-router-dom";
6
+ import { useNavigate, useParams, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
7
7
  import * as React from "react";
8
8
  import { lazy } from "react";
9
- import { Menu, VisuallyHidden, Flex, Typography, Dialog, DialogBody, DialogFooter, Button, ModalLayout, ModalHeader, ModalBody, Box, Radio, Status, SingleSelect, SingleSelectOption, LinkButton } from "@strapi/design-system";
10
- import styled from "styled-components";
9
+ import { Menu, VisuallyHidden, Flex, Typography, Dialog, DialogBody, DialogFooter, Button, ModalLayout, ModalHeader, ModalBody, Box, Radio, Status, SingleSelect, SingleSelectOption, ModalFooter, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
10
+ import { styled } from "styled-components";
11
11
  import * as yup from "yup";
12
12
  import { ValidationError } from "yup";
13
- import { createApi } from "@reduxjs/toolkit/query/react";
14
- import { isAxiosError } from "axios";
15
13
  import pipe from "lodash/fp/pipe";
16
14
  import { intervalToDuration, isPast } from "date-fns";
17
15
  import { createSlice, combineReducers } from "@reduxjs/toolkit";
@@ -157,9 +155,8 @@ const DocumentRBAC = ({ children, permissions }) => {
157
155
  const name = removeNumericalStrings(fieldName.split("."));
158
156
  const componentFieldNames = fieldsUserCanAction.filter((field) => field.split(".").length > 1);
159
157
  if (fieldType === "component") {
160
- const componentOrDynamicZoneFields = componentFieldNames.map((field) => field.split("."));
161
- return componentOrDynamicZoneFields.some((field) => {
162
- return field.includes(fieldName);
158
+ return componentFieldNames.some((field) => {
159
+ return field.includes(name.join("."));
163
160
  });
164
161
  }
165
162
  if (name.length > 1) {
@@ -189,78 +186,8 @@ const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permis
189
186
  (field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
190
187
  );
191
188
  const removeNumericalStrings = (arr) => arr.filter((item) => isNaN(Number(item)));
192
- const buildValidParams = (query) => {
193
- if (!query)
194
- return query;
195
- const { plugins: _, ...validQueryParams } = {
196
- ...query,
197
- ...Object.values(query?.plugins ?? {}).reduce(
198
- (acc, current) => Object.assign(acc, current),
199
- {}
200
- )
201
- };
202
- if ("_q" in validQueryParams) {
203
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
204
- }
205
- return validQueryParams;
206
- };
207
- const axiosBaseQuery = () => async (query, { signal }) => {
208
- try {
209
- const { get, post, del, put } = getFetchClient();
210
- if (typeof query === "string") {
211
- const result = await get(query, { signal });
212
- return { data: result.data };
213
- } else {
214
- const { url, method = "GET", data, config } = query;
215
- if (method === "POST") {
216
- const result2 = await post(url, data, { ...config, signal });
217
- return { data: result2.data };
218
- }
219
- if (method === "DELETE") {
220
- const result2 = await del(url, { ...config, signal });
221
- return { data: result2.data };
222
- }
223
- if (method === "PUT") {
224
- const result2 = await put(url, data, { ...config, signal });
225
- return { data: result2.data };
226
- }
227
- const result = await get(url, { ...config, signal });
228
- return { data: result.data };
229
- }
230
- } catch (err) {
231
- if (isAxiosError(err)) {
232
- if (typeof err.response?.data === "object" && err.response?.data !== null && "error" in err.response?.data) {
233
- return { data: void 0, error: err.response?.data.error };
234
- } else {
235
- return {
236
- data: void 0,
237
- error: {
238
- name: "UnknownError",
239
- message: "There was an unknown error response from the API",
240
- details: err.response?.data,
241
- status: err.response?.status
242
- }
243
- };
244
- }
245
- }
246
- const error = err;
247
- return {
248
- data: void 0,
249
- error: {
250
- name: error.name,
251
- message: error.message,
252
- stack: error.stack
253
- }
254
- };
255
- }
256
- };
257
- const isBaseQueryError = (error) => {
258
- return error.name !== void 0;
259
- };
260
- const contentManagerApi = createApi({
261
- reducerPath: "contentManagerApi",
262
- baseQuery: axiosBaseQuery(),
263
- tagTypes: [
189
+ const contentManagerApi = adminApi.enhanceEndpoints({
190
+ addTagTypes: [
264
191
  "ComponentConfiguration",
265
192
  "ContentTypesConfiguration",
266
193
  "ContentTypeSettings",
@@ -268,8 +195,7 @@ const contentManagerApi = createApi({
268
195
  "InitialData",
269
196
  "HistoryVersion",
270
197
  "Relations"
271
- ],
272
- endpoints: () => ({})
198
+ ]
273
199
  });
274
200
  const documentApi = contentManagerApi.injectEndpoints({
275
201
  endpoints: (builder) => ({
@@ -325,12 +251,15 @@ const documentApi = contentManagerApi.injectEndpoints({
325
251
  ]
326
252
  }),
327
253
  deleteManyDocuments: builder.mutation({
328
- query: ({ model, ...body }) => ({
254
+ query: ({ model, params, ...body }) => ({
329
255
  url: `/content-manager/collection-types/${model}/actions/bulkDelete`,
330
256
  method: "POST",
331
- data: body
257
+ data: body,
258
+ config: {
259
+ params
260
+ }
332
261
  }),
333
- invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
262
+ invalidatesTags: (_res, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
334
263
  }),
335
264
  discardDocument: builder.mutation({
336
265
  query: ({ collectionType, model, documentId, params }) => ({
@@ -441,10 +370,13 @@ const documentApi = contentManagerApi.injectEndpoints({
441
370
  }
442
371
  }),
443
372
  publishManyDocuments: builder.mutation({
444
- query: ({ model, ...body }) => ({
373
+ query: ({ model, params, ...body }) => ({
445
374
  url: `/content-manager/collection-types/${model}/actions/bulkPublish`,
446
375
  method: "POST",
447
- data: body
376
+ data: body,
377
+ config: {
378
+ params
379
+ }
448
380
  }),
449
381
  invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
450
382
  }),
@@ -486,10 +418,13 @@ const documentApi = contentManagerApi.injectEndpoints({
486
418
  }
487
419
  }),
488
420
  unpublishManyDocuments: builder.mutation({
489
- query: ({ model, ...body }) => ({
421
+ query: ({ model, params, ...body }) => ({
490
422
  url: `/content-manager/collection-types/${model}/actions/bulkUnpublish`,
491
423
  method: "POST",
492
- data: body
424
+ data: body,
425
+ config: {
426
+ params
427
+ }
493
428
  }),
494
429
  invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
495
430
  })
@@ -513,6 +448,24 @@ const {
513
448
  useUnpublishDocumentMutation,
514
449
  useUnpublishManyDocumentsMutation
515
450
  } = documentApi;
451
+ const buildValidParams = (query) => {
452
+ if (!query)
453
+ return query;
454
+ const { plugins: _, ...validQueryParams } = {
455
+ ...query,
456
+ ...Object.values(query?.plugins ?? {}).reduce(
457
+ (acc, current) => Object.assign(acc, current),
458
+ {}
459
+ )
460
+ };
461
+ if ("_q" in validQueryParams) {
462
+ validQueryParams._q = encodeURIComponent(validQueryParams._q);
463
+ }
464
+ return validQueryParams;
465
+ };
466
+ const isBaseQueryError = (error) => {
467
+ return error.name !== void 0;
468
+ };
516
469
  const createYupSchema = (attributes = {}, components = {}) => {
517
470
  const createModelSchema = (attributes2) => yup.object().shape(
518
471
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
@@ -552,10 +505,14 @@ const createYupSchema = (attributes = {}, components = {}) => {
552
505
  yup.array().of(
553
506
  yup.lazy(
554
507
  (data) => {
555
- const { attributes: attributes3 } = components[data.__component];
556
- return yup.object().shape({
508
+ const attributes3 = components?.[data?.__component]?.attributes;
509
+ const validation = yup.object().shape({
557
510
  __component: yup.string().required().oneOf(Object.keys(components))
558
- }).nullable(false).concat(createModelSchema(attributes3));
511
+ }).nullable(false);
512
+ if (!attributes3) {
513
+ return validation;
514
+ }
515
+ return validation.concat(createModelSchema(attributes3));
559
516
  }
560
517
  )
561
518
  )
@@ -565,11 +522,25 @@ const createYupSchema = (attributes = {}, components = {}) => {
565
522
  return {
566
523
  ...acc,
567
524
  [name]: transformSchema(
568
- yup.array().of(
569
- yup.object().shape({
570
- id: yup.string().required()
571
- })
572
- )
525
+ yup.lazy((value) => {
526
+ if (!value) {
527
+ return yup.mixed().nullable(true);
528
+ } else if (Array.isArray(value)) {
529
+ return yup.array().of(
530
+ yup.object().shape({
531
+ id: yup.string().required()
532
+ })
533
+ );
534
+ } else if (typeof value === "object") {
535
+ return yup.object();
536
+ } else {
537
+ return yup.mixed().test(
538
+ "type-error",
539
+ "Relation values must be either null, an array of objects with {id} or an object.",
540
+ () => false
541
+ );
542
+ }
543
+ })
573
544
  )
574
545
  };
575
546
  default:
@@ -634,7 +605,12 @@ const addRequiredValidation = (attribute) => (schema) => {
634
605
  defaultMessage: "This field is required."
635
606
  });
636
607
  }
637
- return schema.nullable();
608
+ return schema?.nullable ? schema.nullable() : (
609
+ // In some cases '.nullable' will not be available on the schema.
610
+ // e.g. when the schema has been built using yup.lazy (e.g. for relations).
611
+ // In these cases we should just return the schema as it is.
612
+ schema
613
+ );
638
614
  };
639
615
  const addMinLengthValidation = (attribute) => (schema) => {
640
616
  if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
@@ -706,24 +682,6 @@ const addRegexValidation = (attribute) => (schema) => {
706
682
  }
707
683
  return schema;
708
684
  };
709
- const extractValuesFromYupError = (errorType, errorParams) => {
710
- if (!errorType || !errorParams) {
711
- return {};
712
- }
713
- return {
714
- [errorType]: errorParams[errorType]
715
- };
716
- };
717
- const getInnerErrors = (error) => (error?.inner || []).reduce((acc, currentError) => {
718
- if (currentError.path) {
719
- acc[currentError.path.split("[").join(".").split("]").join("")] = {
720
- id: currentError.message,
721
- defaultMessage: currentError.message,
722
- values: extractValuesFromYupError(currentError?.type, currentError?.params)
723
- };
724
- }
725
- return acc;
726
- }, {});
727
685
  const initApi = contentManagerApi.injectEndpoints({
728
686
  endpoints: (builder) => ({
729
687
  getInitialData: builder.query({
@@ -737,27 +695,20 @@ const { useGetInitialDataQuery } = initApi;
737
695
  const useContentTypeSchema = (model) => {
738
696
  const { toggleNotification } = useNotification();
739
697
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
740
- const { components, contentType, contentTypes, error, isLoading, isFetching } = useGetInitialDataQuery(void 0, {
741
- selectFromResult: (res) => {
742
- const contentType2 = res.data?.contentTypes.find((ct) => ct.uid === model);
743
- const componentsByKey = res.data?.components.reduce(
744
- (acc, component) => {
745
- acc[component.uid] = component;
746
- return acc;
747
- },
748
- {}
749
- );
750
- const components2 = extractContentTypeComponents(contentType2?.attributes, componentsByKey);
751
- return {
752
- isLoading: res.isLoading,
753
- isFetching: res.isFetching,
754
- error: res.error,
755
- components: Object.keys(components2).length === 0 ? void 0 : components2,
756
- contentType: contentType2,
757
- contentTypes: res.data?.contentTypes ?? []
758
- };
759
- }
760
- });
698
+ const { data, error, isLoading, isFetching } = useGetInitialDataQuery(void 0);
699
+ const { components, contentType, contentTypes } = React.useMemo(() => {
700
+ const contentType2 = data?.contentTypes.find((ct) => ct.uid === model);
701
+ const componentsByKey = data?.components.reduce((acc, component) => {
702
+ acc[component.uid] = component;
703
+ return acc;
704
+ }, {});
705
+ const components2 = extractContentTypeComponents(contentType2?.attributes, componentsByKey);
706
+ return {
707
+ components: Object.keys(components2).length === 0 ? void 0 : components2,
708
+ contentType: contentType2,
709
+ contentTypes: data?.contentTypes ?? []
710
+ };
711
+ }, [model, data]);
761
712
  React.useEffect(() => {
762
713
  if (error) {
763
714
  toggleNotification({
@@ -840,7 +791,7 @@ const useDocument = (args, opts) => {
840
791
  return null;
841
792
  } catch (error2) {
842
793
  if (error2 instanceof ValidationError) {
843
- return getInnerErrors(error2);
794
+ return getYupValidationErrors(error2);
844
795
  }
845
796
  throw error2;
846
797
  }
@@ -936,14 +887,53 @@ const useDocumentActions = () => {
936
887
  },
937
888
  [trackUsage, deleteDocument, toggleNotification, formatMessage, formatAPIError]
938
889
  );
890
+ const [deleteManyDocuments] = useDeleteManyDocumentsMutation();
891
+ const deleteMany = React.useCallback(
892
+ async ({ model, documentIds, params }) => {
893
+ try {
894
+ trackUsage("willBulkDeleteEntries");
895
+ const res = await deleteManyDocuments({
896
+ model,
897
+ documentIds,
898
+ params
899
+ });
900
+ if ("error" in res) {
901
+ toggleNotification({
902
+ type: "danger",
903
+ message: formatAPIError(res.error)
904
+ });
905
+ return { error: res.error };
906
+ }
907
+ toggleNotification({
908
+ type: "success",
909
+ title: formatMessage({
910
+ id: getTranslation("success.records.delete"),
911
+ defaultMessage: "Successfully deleted."
912
+ }),
913
+ message: ""
914
+ });
915
+ trackUsage("didBulkDeleteEntries");
916
+ return res.data;
917
+ } catch (err) {
918
+ toggleNotification({
919
+ type: "danger",
920
+ message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
921
+ });
922
+ trackUsage("didNotBulkDeleteEntries");
923
+ throw err;
924
+ }
925
+ },
926
+ [trackUsage, deleteManyDocuments, toggleNotification, formatMessage, formatAPIError]
927
+ );
939
928
  const [discardDocument] = useDiscardDocumentMutation();
940
929
  const discard = React.useCallback(
941
- async ({ collectionType, model, documentId }) => {
930
+ async ({ collectionType, model, documentId, params }) => {
942
931
  try {
943
932
  const res = await discardDocument({
944
933
  collectionType,
945
934
  model,
946
- documentId
935
+ documentId,
936
+ params
947
937
  });
948
938
  if ("error" in res) {
949
939
  toggleNotification({
@@ -1005,6 +995,43 @@ const useDocumentActions = () => {
1005
995
  },
1006
996
  [trackUsage, publishDocument, toggleNotification, formatMessage, formatAPIError]
1007
997
  );
998
+ const [publishManyDocuments] = usePublishManyDocumentsMutation();
999
+ const publishMany = React.useCallback(
1000
+ async ({ model, documentIds, params }) => {
1001
+ try {
1002
+ const res = await publishManyDocuments({
1003
+ model,
1004
+ documentIds,
1005
+ params
1006
+ });
1007
+ if ("error" in res) {
1008
+ toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1009
+ return { error: res.error };
1010
+ }
1011
+ toggleNotification({
1012
+ type: "success",
1013
+ message: formatMessage({
1014
+ id: getTranslation("success.record.publish"),
1015
+ defaultMessage: "Published document"
1016
+ })
1017
+ });
1018
+ return res.data;
1019
+ } catch (err) {
1020
+ toggleNotification({
1021
+ type: "danger",
1022
+ message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1023
+ });
1024
+ throw err;
1025
+ }
1026
+ },
1027
+ [
1028
+ // trackUsage,
1029
+ publishManyDocuments,
1030
+ toggleNotification,
1031
+ formatMessage,
1032
+ formatAPIError
1033
+ ]
1034
+ );
1008
1035
  const [updateDocument] = useUpdateDocumentMutation();
1009
1036
  const update = React.useCallback(
1010
1037
  async ({ collectionType, model, documentId, params }, data, trackerProperty) => {
@@ -1079,6 +1106,41 @@ const useDocumentActions = () => {
1079
1106
  },
1080
1107
  [trackUsage, unpublishDocument, toggleNotification, formatMessage, formatAPIError]
1081
1108
  );
1109
+ const [unpublishManyDocuments] = useUnpublishManyDocumentsMutation();
1110
+ const unpublishMany = React.useCallback(
1111
+ async ({ model, documentIds, params }) => {
1112
+ try {
1113
+ trackUsage("willBulkUnpublishEntries");
1114
+ const res = await unpublishManyDocuments({
1115
+ model,
1116
+ documentIds,
1117
+ params
1118
+ });
1119
+ if ("error" in res) {
1120
+ toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1121
+ return { error: res.error };
1122
+ }
1123
+ trackUsage("didBulkUnpublishEntries");
1124
+ toggleNotification({
1125
+ type: "success",
1126
+ title: formatMessage({
1127
+ id: getTranslation("success.records.unpublish"),
1128
+ defaultMessage: "Successfully unpublished."
1129
+ }),
1130
+ message: ""
1131
+ });
1132
+ return res.data;
1133
+ } catch (err) {
1134
+ toggleNotification({
1135
+ type: "danger",
1136
+ message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1137
+ });
1138
+ trackUsage("didNotBulkUnpublishEntries");
1139
+ throw err;
1140
+ }
1141
+ },
1142
+ [trackUsage, unpublishManyDocuments, toggleNotification, formatMessage, formatAPIError]
1143
+ );
1082
1144
  const [createDocument] = useCreateDocumentMutation();
1083
1145
  const create = React.useCallback(
1084
1146
  async ({ model, params }, data, trackerProperty) => {
@@ -1192,15 +1254,18 @@ const useDocumentActions = () => {
1192
1254
  clone,
1193
1255
  create,
1194
1256
  delete: _delete,
1257
+ deleteMany,
1195
1258
  discard,
1196
1259
  getDocument,
1197
1260
  publish,
1261
+ publishMany,
1198
1262
  unpublish,
1263
+ unpublishMany,
1199
1264
  update
1200
1265
  };
1201
1266
  };
1202
1267
  const ProtectedHistoryPage = lazy(
1203
- () => import("./History-D6sbCJvo.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1268
+ () => import("./History-DS6-HCYX.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1204
1269
  );
1205
1270
  const routes$1 = [
1206
1271
  {
@@ -1213,31 +1278,31 @@ const routes$1 = [
1213
1278
  }
1214
1279
  ];
1215
1280
  const ProtectedEditViewPage = lazy(
1216
- () => import("./EditViewPage-Bm8lgcm6.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1281
+ () => import("./EditViewPage-DWb0DE7R.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1217
1282
  );
1218
1283
  const ProtectedListViewPage = lazy(
1219
- () => import("./ListViewPage-Be7S5aKL.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1284
+ () => import("./ListViewPage-nQrOQuVo.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1220
1285
  );
1221
1286
  const ProtectedListConfiguration = lazy(
1222
- () => import("./ListConfigurationPage-Ce4qs7qE.mjs").then((mod) => ({
1287
+ () => import("./ListConfigurationPage-DQJJltko.mjs").then((mod) => ({
1223
1288
  default: mod.ProtectedListConfiguration
1224
1289
  }))
1225
1290
  );
1226
1291
  const ProtectedEditConfigurationPage = lazy(
1227
- () => import("./EditConfigurationPage-CUcGHHvQ.mjs").then((mod) => ({
1292
+ () => import("./EditConfigurationPage-CcOoD26O.mjs").then((mod) => ({
1228
1293
  default: mod.ProtectedEditConfigurationPage
1229
1294
  }))
1230
1295
  );
1231
1296
  const ProtectedComponentConfigurationPage = lazy(
1232
- () => import("./ComponentConfigurationPage--2aLCv-G.mjs").then((mod) => ({
1297
+ () => import("./ComponentConfigurationPage-BMajAl1u.mjs").then((mod) => ({
1233
1298
  default: mod.ProtectedComponentConfigurationPage
1234
1299
  }))
1235
1300
  );
1236
1301
  const NoPermissions = lazy(
1237
- () => import("./NoPermissionsPage-DhJ7LYrr.mjs").then((mod) => ({ default: mod.NoPermissions }))
1302
+ () => import("./NoPermissionsPage-fOIkQM0v.mjs").then((mod) => ({ default: mod.NoPermissions }))
1238
1303
  );
1239
1304
  const NoContentType = lazy(
1240
- () => import("./NoContentTypePage-CIPmYQMm.mjs").then((mod) => ({ default: mod.NoContentType }))
1305
+ () => import("./NoContentTypePage-DbnHE22g.mjs").then((mod) => ({ default: mod.NoContentType }))
1241
1306
  );
1242
1307
  const CollectionTypePages = () => {
1243
1308
  const { collectionType } = useParams();
@@ -1427,7 +1492,7 @@ const DocumentActionsMenu = ({
1427
1492
  variant,
1428
1493
  children: [
1429
1494
  /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
1430
- /* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: label || formatMessage({
1495
+ /* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: label || formatMessage({
1431
1496
  id: "content-manager.containers.edit.panels.default.more-actions",
1432
1497
  defaultMessage: "More document actions"
1433
1498
  }) })
@@ -1443,7 +1508,7 @@ const DocumentActionsMenu = ({
1443
1508
  onSelect: handleClick(action),
1444
1509
  display: "block",
1445
1510
  children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
1446
- /* @__PURE__ */ jsxs(Flex, { color: convertActionVariantToColor(action.variant), gap: 2, as: "span", children: [
1511
+ /* @__PURE__ */ jsxs(Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1447
1512
  action.icon,
1448
1513
  action.label
1449
1514
  ] }),
@@ -1549,7 +1614,7 @@ const DocumentActionModal = ({
1549
1614
  title,
1550
1615
  onClose,
1551
1616
  footer: Footer,
1552
- content,
1617
+ content: Content,
1553
1618
  onModalClose
1554
1619
  }) => {
1555
1620
  const id = React.useId();
@@ -1563,8 +1628,8 @@ const DocumentActionModal = ({
1563
1628
  onModalClose();
1564
1629
  };
1565
1630
  return /* @__PURE__ */ jsxs(ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
1566
- /* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", as: "h2", id, children: title }) }),
1567
- /* @__PURE__ */ jsx(ModalBody, { children: content }),
1631
+ /* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
1632
+ /* @__PURE__ */ jsx(ModalBody, { children: typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : Content }),
1568
1633
  /* @__PURE__ */ jsx(
1569
1634
  Box,
1570
1635
  {
@@ -1581,7 +1646,7 @@ const DocumentActionModal = ({
1581
1646
  )
1582
1647
  ] });
1583
1648
  };
1584
- const PublishAction = ({
1649
+ const PublishAction$1 = ({
1585
1650
  activeTab,
1586
1651
  documentId,
1587
1652
  model,
@@ -1666,7 +1731,7 @@ const PublishAction = ({
1666
1731
  }
1667
1732
  };
1668
1733
  };
1669
- PublishAction.type = "publish";
1734
+ PublishAction$1.type = "publish";
1670
1735
  const UpdateAction = ({
1671
1736
  activeTab,
1672
1737
  documentId,
@@ -1781,7 +1846,7 @@ const UNPUBLISH_DRAFT_OPTIONS = {
1781
1846
  KEEP: "keep",
1782
1847
  DISCARD: "discard"
1783
1848
  };
1784
- const UnpublishAction = ({
1849
+ const UnpublishAction$1 = ({
1785
1850
  activeTab,
1786
1851
  documentId,
1787
1852
  model,
@@ -1844,7 +1909,7 @@ const UnpublishAction = ({
1844
1909
  content: /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-start", direction: "column", gap: 6, children: [
1845
1910
  /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", gap: 2, children: [
1846
1911
  /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
1847
- /* @__PURE__ */ jsx(Typography, { as: "p", variant: "omega", textAlign: "center", children: formatMessage({
1912
+ /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
1848
1913
  id: "content-manager.actions.unpublish.dialog.body",
1849
1914
  defaultMessage: "Are you sure?"
1850
1915
  }) })
@@ -1855,10 +1920,11 @@ const UnpublishAction = ({
1855
1920
  onChange: handleChange,
1856
1921
  direction: "column",
1857
1922
  alignItems: "flex-start",
1858
- as: "fieldset",
1923
+ tag: "fieldset",
1924
+ borderWidth: 0,
1859
1925
  gap: 3,
1860
1926
  children: [
1861
- /* @__PURE__ */ jsx(VisuallyHidden, { as: "legend" }),
1927
+ /* @__PURE__ */ jsx(VisuallyHidden, { tag: "legend" }),
1862
1928
  /* @__PURE__ */ jsx(
1863
1929
  Radio,
1864
1930
  {
@@ -1915,7 +1981,7 @@ const UnpublishAction = ({
1915
1981
  position: ["panel", "table-row"]
1916
1982
  };
1917
1983
  };
1918
- UnpublishAction.type = "unpublish";
1984
+ UnpublishAction$1.type = "unpublish";
1919
1985
  const DiscardAction = ({
1920
1986
  activeTab,
1921
1987
  documentId,
@@ -1949,7 +2015,7 @@ const DiscardAction = ({
1949
2015
  }),
1950
2016
  content: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
1951
2017
  /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
1952
- /* @__PURE__ */ jsx(Typography, { as: "p", variant: "omega", textAlign: "center", children: formatMessage({
2018
+ /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
1953
2019
  id: "content-manager.actions.discard.dialog.body",
1954
2020
  defaultMessage: "Are you sure?"
1955
2021
  }) })
@@ -1971,7 +2037,7 @@ const StyledCrossCircle = styled(CrossCircle)`
1971
2037
  fill: currentColor;
1972
2038
  }
1973
2039
  `;
1974
- const DEFAULT_ACTIONS = [PublishAction, UpdateAction, UnpublishAction, DiscardAction];
2040
+ const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
1975
2041
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
1976
2042
  const RelativeTime = React.forwardRef(
1977
2043
  ({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
@@ -2019,7 +2085,7 @@ const getDisplayName = ({
2019
2085
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2020
2086
  const DocumentStatus = ({ status = "draft", ...restProps }) => {
2021
2087
  const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
2022
- return /* @__PURE__ */ jsx(Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { as: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2088
+ return /* @__PURE__ */ jsx(Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2023
2089
  };
2024
2090
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2025
2091
  const { formatMessage } = useIntl();
@@ -2039,7 +2105,7 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2039
2105
  gap: "80px",
2040
2106
  alignItems: "flex-start",
2041
2107
  children: [
2042
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", as: "h1", children: title }),
2108
+ /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
2043
2109
  /* @__PURE__ */ jsx(HeaderToolbar, {})
2044
2110
  ]
2045
2111
  }
@@ -2196,7 +2262,7 @@ const Information = ({ activeTab }) => {
2196
2262
  borderColor: "neutral150",
2197
2263
  direction: "column",
2198
2264
  marginTop: 2,
2199
- as: "dl",
2265
+ tag: "dl",
2200
2266
  padding: 5,
2201
2267
  gap: 3,
2202
2268
  alignItems: "flex-start",
@@ -2204,8 +2270,8 @@ const Information = ({ activeTab }) => {
2204
2270
  marginRight: "-0.4rem",
2205
2271
  width: "calc(100% + 8px)",
2206
2272
  children: information.map((info) => /* @__PURE__ */ jsxs(Flex, { gap: 1, direction: "column", alignItems: "flex-start", children: [
2207
- /* @__PURE__ */ jsx(Typography, { as: "dt", variant: "pi", fontWeight: "bold", children: info.label }),
2208
- /* @__PURE__ */ jsx(Typography, { as: "dd", variant: "pi", textColor: "neutral600", children: info.value })
2273
+ /* @__PURE__ */ jsx(Typography, { tag: "dt", variant: "pi", fontWeight: "bold", children: info.label }),
2274
+ /* @__PURE__ */ jsx(Typography, { tag: "dd", variant: "pi", textColor: "neutral600", children: info.value })
2209
2275
  ] }, info.label))
2210
2276
  }
2211
2277
  );
@@ -2238,7 +2304,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2238
2304
  id: "app.links.configure-view",
2239
2305
  defaultMessage: "Configure the view"
2240
2306
  }),
2241
- icon: /* @__PURE__ */ jsx(StyledCog, {}),
2307
+ icon: /* @__PURE__ */ jsx(ListPlus, {}),
2242
2308
  onClick: () => {
2243
2309
  navigate(`../${collectionType}/${model}/configurations/edit`);
2244
2310
  },
@@ -2246,11 +2312,6 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
2246
2312
  };
2247
2313
  };
2248
2314
  ConfigureTheViewAction.type = "configure-the-view";
2249
- const StyledCog = styled(Cog)`
2250
- path {
2251
- fill: currentColor;
2252
- }
2253
- `;
2254
2315
  const EditTheModelAction = ({ model }) => {
2255
2316
  const navigate = useNavigate();
2256
2317
  const { formatMessage } = useIntl();
@@ -2259,7 +2320,7 @@ const EditTheModelAction = ({ model }) => {
2259
2320
  id: "content-manager.link-to-ctb",
2260
2321
  defaultMessage: "Edit the model"
2261
2322
  }),
2262
- icon: /* @__PURE__ */ jsx(StyledPencil$1, {}),
2323
+ icon: /* @__PURE__ */ jsx(Pencil, {}),
2263
2324
  onClick: () => {
2264
2325
  navigate(`/plugins/content-type-builder/content-types/${model}`);
2265
2326
  },
@@ -2267,12 +2328,7 @@ const EditTheModelAction = ({ model }) => {
2267
2328
  };
2268
2329
  };
2269
2330
  EditTheModelAction.type = "edit-the-model";
2270
- const StyledPencil$1 = styled(Pencil)`
2271
- path {
2272
- fill: currentColor;
2273
- }
2274
- `;
2275
- const DeleteAction = ({ documentId, model, collectionType, document }) => {
2331
+ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2276
2332
  const navigate = useNavigate();
2277
2333
  const { formatMessage } = useIntl();
2278
2334
  const listViewPathMatch = useMatch(LIST_PATH);
@@ -2286,7 +2342,7 @@ const DeleteAction = ({ documentId, model, collectionType, document }) => {
2286
2342
  id: "content-manager.actions.delete.label",
2287
2343
  defaultMessage: "Delete document"
2288
2344
  }),
2289
- icon: /* @__PURE__ */ jsx(StyledTrash, {}),
2345
+ icon: /* @__PURE__ */ jsx(Trash, {}),
2290
2346
  dialog: {
2291
2347
  type: "dialog",
2292
2348
  title: formatMessage({
@@ -2295,7 +2351,7 @@ const DeleteAction = ({ documentId, model, collectionType, document }) => {
2295
2351
  }),
2296
2352
  content: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2297
2353
  /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
2298
- /* @__PURE__ */ jsx(Typography, { as: "p", variant: "omega", textAlign: "center", children: formatMessage({
2354
+ /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
2299
2355
  id: "content-manager.actions.delete.dialog.body",
2300
2356
  defaultMessage: "Are you sure?"
2301
2357
  }) })
@@ -2340,13 +2396,8 @@ const DeleteAction = ({ documentId, model, collectionType, document }) => {
2340
2396
  position: ["header", "table-row"]
2341
2397
  };
2342
2398
  };
2343
- DeleteAction.type = "delete";
2344
- const StyledTrash = styled(Trash)`
2345
- path {
2346
- fill: currentColor;
2347
- }
2348
- `;
2349
- const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction];
2399
+ DeleteAction$1.type = "delete";
2400
+ const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2350
2401
  const Panels = () => {
2351
2402
  const isCloning = useMatch(CLONE_PATH) !== null;
2352
2403
  const [
@@ -2420,7 +2471,7 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
2420
2471
  Flex,
2421
2472
  {
2422
2473
  ref,
2423
- as: "aside",
2474
+ tag: "aside",
2424
2475
  "aria-labelledby": "additional-information",
2425
2476
  background: "neutral0",
2426
2477
  borderColor: "neutral150",
@@ -2435,669 +2486,1378 @@ const Panel = React.forwardRef(({ children, title }, ref) => {
2435
2486
  justifyContent: "stretch",
2436
2487
  alignItems: "flex-start",
2437
2488
  children: [
2438
- /* @__PURE__ */ jsx(Typography, { as: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2489
+ /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2439
2490
  children
2440
2491
  ]
2441
2492
  }
2442
2493
  );
2443
2494
  });
2444
- const DEFAULT_BULK_ACTIONS = [];
2445
- const AutoCloneFailureModalBody = ({ prohibitedFields }) => {
2446
- const { formatMessage } = useIntl();
2447
- const getDefaultErrorMessage = (reason) => {
2448
- switch (reason) {
2449
- case "relation":
2450
- return "Duplicating the relation could remove it from the original entry.";
2451
- case "unique":
2452
- return "Identical values in a unique field are not allowed";
2453
- default:
2454
- return reason;
2455
- }
2456
- };
2457
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2458
- /* @__PURE__ */ jsx(Typography, { variant: "beta", children: formatMessage({
2459
- id: getTranslation("containers.list.autoCloneModal.title"),
2460
- defaultMessage: "This entry can't be duplicated directly."
2461
- }) }),
2462
- /* @__PURE__ */ jsx(Box, { marginTop: 2, children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
2463
- id: getTranslation("containers.list.autoCloneModal.description"),
2464
- defaultMessage: "A new entry will be created with the same content, but you'll have to change the following fields to save it."
2465
- }) }) }),
2466
- /* @__PURE__ */ jsx(Flex, { marginTop: 6, gap: 2, direction: "column", alignItems: "stretch", children: prohibitedFields.map(([fieldPath, reason]) => /* @__PURE__ */ jsxs(
2467
- Flex,
2468
- {
2469
- direction: "column",
2470
- gap: 2,
2471
- alignItems: "flex-start",
2472
- borderColor: "neutral200",
2473
- hasRadius: true,
2474
- padding: 6,
2475
- children: [
2476
- /* @__PURE__ */ jsx(Flex, { direction: "row", as: "ol", children: fieldPath.map((pathSegment, index2) => /* @__PURE__ */ jsxs(Typography, { fontWeight: "semiBold", as: "li", children: [
2477
- pathSegment,
2478
- index2 !== fieldPath.length - 1 && /* @__PURE__ */ jsx(
2479
- ChevronRight,
2480
- {
2481
- fill: "neutral500",
2482
- height: "0.8rem",
2483
- width: "0.8rem",
2484
- style: { margin: "0 0.8rem" }
2485
- }
2486
- )
2487
- ] }, index2)) }),
2488
- /* @__PURE__ */ jsx(Typography, { as: "p", textColor: "neutral600", children: formatMessage({
2489
- id: getTranslation(`containers.list.autoCloneModal.error.${reason}`),
2490
- defaultMessage: getDefaultErrorMessage(reason)
2491
- }) })
2492
- ]
2493
- },
2494
- fieldPath.join()
2495
- )) })
2496
- ] });
2495
+ const HOOKS = {
2496
+ /**
2497
+ * Hook that allows to mutate the displayed headers of the list view table
2498
+ * @constant
2499
+ * @type {string}
2500
+ */
2501
+ INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2502
+ /**
2503
+ * Hook that allows to mutate the CM's collection types links pre-set filters
2504
+ * @constant
2505
+ * @type {string}
2506
+ */
2507
+ MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2508
+ /**
2509
+ * Hook that allows to mutate the CM's edit view layout
2510
+ * @constant
2511
+ * @type {string}
2512
+ */
2513
+ MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2514
+ /**
2515
+ * Hook that allows to mutate the CM's single types links pre-set filters
2516
+ * @constant
2517
+ * @type {string}
2518
+ */
2519
+ MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2497
2520
  };
2498
- const TableActions = ({ document }) => {
2499
- const { formatMessage } = useIntl();
2500
- const { model, collectionType } = useDoc();
2501
- const plugins = useStrapiApp("TableActions", (state) => state.plugins);
2502
- const props = {
2503
- activeTab: null,
2504
- model,
2505
- documentId: document.documentId,
2506
- collectionType,
2507
- document
2521
+ const contentTypesApi = contentManagerApi.injectEndpoints({
2522
+ endpoints: (builder) => ({
2523
+ getContentTypeConfiguration: builder.query({
2524
+ query: (uid) => ({
2525
+ url: `/content-manager/content-types/${uid}/configuration`,
2526
+ method: "GET"
2527
+ }),
2528
+ transformResponse: (response) => response.data,
2529
+ providesTags: (_result, _error, uid) => [
2530
+ { type: "ContentTypesConfiguration", id: uid },
2531
+ { type: "ContentTypeSettings", id: "LIST" }
2532
+ ]
2533
+ }),
2534
+ getAllContentTypeSettings: builder.query({
2535
+ query: () => "/content-manager/content-types-settings",
2536
+ transformResponse: (response) => response.data,
2537
+ providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2538
+ }),
2539
+ updateContentTypeConfiguration: builder.mutation({
2540
+ query: ({ uid, ...body }) => ({
2541
+ url: `/content-manager/content-types/${uid}/configuration`,
2542
+ method: "PUT",
2543
+ data: body
2544
+ }),
2545
+ transformResponse: (response) => response.data,
2546
+ invalidatesTags: (_result, _error, { uid }) => [
2547
+ { type: "ContentTypesConfiguration", id: uid },
2548
+ { type: "ContentTypeSettings", id: "LIST" },
2549
+ // Is this necessary?
2550
+ { type: "InitialData" }
2551
+ ]
2552
+ })
2553
+ })
2554
+ });
2555
+ const {
2556
+ useGetContentTypeConfigurationQuery,
2557
+ useGetAllContentTypeSettingsQuery,
2558
+ useUpdateContentTypeConfigurationMutation
2559
+ } = contentTypesApi;
2560
+ const checkIfAttributeIsDisplayable = (attribute) => {
2561
+ const { type } = attribute;
2562
+ if (type === "relation") {
2563
+ return !attribute.relation.toLowerCase().includes("morph");
2564
+ }
2565
+ return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2566
+ };
2567
+ const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2568
+ if (!mainFieldName) {
2569
+ return void 0;
2570
+ }
2571
+ const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2572
+ // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2573
+ schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2574
+ );
2575
+ return {
2576
+ name: mainFieldName,
2577
+ type: mainFieldType ?? "string"
2508
2578
  };
2509
- return /* @__PURE__ */ jsx(
2510
- DescriptionComponentRenderer,
2579
+ };
2580
+ const DEFAULT_SETTINGS = {
2581
+ bulkable: false,
2582
+ filterable: false,
2583
+ searchable: false,
2584
+ pagination: false,
2585
+ defaultSortBy: "",
2586
+ defaultSortOrder: "asc",
2587
+ mainField: "id",
2588
+ pageSize: 10
2589
+ };
2590
+ const useDocumentLayout = (model) => {
2591
+ const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2592
+ const [{ query }] = useQueryParams();
2593
+ const runHookWaterfall = useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2594
+ const { toggleNotification } = useNotification();
2595
+ const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
2596
+ const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2597
+ const {
2598
+ data,
2599
+ isLoading: isLoadingConfigs,
2600
+ error,
2601
+ isFetching: isFetchingConfigs
2602
+ } = useGetContentTypeConfigurationQuery(model);
2603
+ const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2604
+ React.useEffect(() => {
2605
+ if (error) {
2606
+ toggleNotification({
2607
+ type: "danger",
2608
+ message: formatAPIError(error)
2609
+ });
2610
+ }
2611
+ }, [error, formatAPIError, toggleNotification]);
2612
+ const editLayout = React.useMemo(
2613
+ () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2614
+ layout: [],
2615
+ components: {},
2616
+ metadatas: {},
2617
+ options: {},
2618
+ settings: DEFAULT_SETTINGS
2619
+ },
2620
+ [data, isLoading, schemas, schema, components]
2621
+ );
2622
+ const listLayout = React.useMemo(() => {
2623
+ return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2624
+ layout: [],
2625
+ metadatas: {},
2626
+ options: {},
2627
+ settings: DEFAULT_SETTINGS
2628
+ };
2629
+ }, [data, isLoading, schemas, schema, components]);
2630
+ const { layout: edit } = React.useMemo(
2631
+ () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2632
+ layout: editLayout,
2633
+ query
2634
+ }),
2635
+ [editLayout, query, runHookWaterfall]
2636
+ );
2637
+ return {
2638
+ error,
2639
+ isLoading,
2640
+ edit,
2641
+ list: listLayout
2642
+ };
2643
+ };
2644
+ const useDocLayout = () => {
2645
+ const { model } = useDoc();
2646
+ return useDocumentLayout(model);
2647
+ };
2648
+ const formatEditLayout = (data, {
2649
+ schemas,
2650
+ schema,
2651
+ components
2652
+ }) => {
2653
+ let currentPanelIndex = 0;
2654
+ const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2655
+ data.contentType.layouts.edit,
2656
+ schema?.attributes,
2657
+ data.contentType.metadatas,
2658
+ { configurations: data.components, schemas: components },
2659
+ schemas
2660
+ ).reduce((panels, row) => {
2661
+ if (row.some((field) => field.type === "dynamiczone")) {
2662
+ panels.push([row]);
2663
+ currentPanelIndex += 2;
2664
+ } else {
2665
+ if (!panels[currentPanelIndex]) {
2666
+ panels.push([]);
2667
+ }
2668
+ panels[currentPanelIndex].push(row);
2669
+ }
2670
+ return panels;
2671
+ }, []);
2672
+ const componentEditAttributes = Object.entries(data.components).reduce(
2673
+ (acc, [uid, configuration]) => {
2674
+ acc[uid] = {
2675
+ layout: convertEditLayoutToFieldLayouts(
2676
+ configuration.layouts.edit,
2677
+ components[uid].attributes,
2678
+ configuration.metadatas
2679
+ ),
2680
+ settings: {
2681
+ ...configuration.settings,
2682
+ icon: components[uid].info.icon,
2683
+ displayName: components[uid].info.displayName
2684
+ }
2685
+ };
2686
+ return acc;
2687
+ },
2688
+ {}
2689
+ );
2690
+ const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2691
+ (acc, [attribute, metadata]) => {
2692
+ return {
2693
+ ...acc,
2694
+ [attribute]: metadata.edit
2695
+ };
2696
+ },
2697
+ {}
2698
+ );
2699
+ return {
2700
+ layout: panelledEditAttributes,
2701
+ components: componentEditAttributes,
2702
+ metadatas: editMetadatas,
2703
+ settings: {
2704
+ ...data.contentType.settings,
2705
+ displayName: schema?.info.displayName
2706
+ },
2707
+ options: {
2708
+ ...schema?.options,
2709
+ ...schema?.pluginOptions,
2710
+ ...data.contentType.options
2711
+ }
2712
+ };
2713
+ };
2714
+ const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2715
+ return rows.map(
2716
+ (row) => row.map((field) => {
2717
+ const attribute = attributes[field.name];
2718
+ if (!attribute) {
2719
+ return null;
2720
+ }
2721
+ const { edit: metadata } = metadatas[field.name];
2722
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2723
+ return {
2724
+ attribute,
2725
+ disabled: !metadata.editable,
2726
+ hint: metadata.description,
2727
+ label: metadata.label ?? "",
2728
+ name: field.name,
2729
+ // @ts-expect-error – mainField does exist on the metadata for a relation.
2730
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2731
+ schemas,
2732
+ components: components?.schemas ?? {}
2733
+ }),
2734
+ placeholder: metadata.placeholder ?? "",
2735
+ required: attribute.required ?? false,
2736
+ size: field.size,
2737
+ unique: "unique" in attribute ? attribute.unique : false,
2738
+ visible: metadata.visible ?? true,
2739
+ type: attribute.type
2740
+ };
2741
+ }).filter((field) => field !== null)
2742
+ );
2743
+ };
2744
+ const formatListLayout = (data, {
2745
+ schemas,
2746
+ schema,
2747
+ components
2748
+ }) => {
2749
+ const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2750
+ (acc, [attribute, metadata]) => {
2751
+ return {
2752
+ ...acc,
2753
+ [attribute]: metadata.list
2754
+ };
2755
+ },
2756
+ {}
2757
+ );
2758
+ const listAttributes = convertListLayoutToFieldLayouts(
2759
+ data.contentType.layouts.list,
2760
+ schema?.attributes,
2761
+ listMetadatas,
2762
+ { configurations: data.components, schemas: components },
2763
+ schemas
2764
+ );
2765
+ return {
2766
+ layout: listAttributes,
2767
+ settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2768
+ metadatas: listMetadatas,
2769
+ options: {
2770
+ ...schema?.options,
2771
+ ...schema?.pluginOptions,
2772
+ ...data.contentType.options
2773
+ }
2774
+ };
2775
+ };
2776
+ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2777
+ return columns.map((name) => {
2778
+ const attribute = attributes[name];
2779
+ if (!attribute) {
2780
+ return null;
2781
+ }
2782
+ const metadata = metadatas[name];
2783
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2784
+ return {
2785
+ attribute,
2786
+ label: metadata.label ?? "",
2787
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2788
+ schemas,
2789
+ components: components?.schemas ?? {}
2790
+ }),
2791
+ name,
2792
+ searchable: metadata.searchable ?? true,
2793
+ sortable: metadata.sortable ?? true
2794
+ };
2795
+ }).filter((field) => field !== null);
2796
+ };
2797
+ const ConfirmBulkActionDialog = ({
2798
+ onToggleDialog,
2799
+ isOpen = false,
2800
+ dialogBody,
2801
+ endAction
2802
+ }) => {
2803
+ const { formatMessage } = useIntl();
2804
+ return /* @__PURE__ */ jsxs(
2805
+ Dialog,
2511
2806
  {
2512
- props,
2513
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2514
- children: (actions2) => {
2515
- const tableRowActions = actions2.filter((action) => {
2516
- const positions = Array.isArray(action.position) ? action.position : [action.position];
2517
- return positions.includes("table-row");
2518
- });
2519
- return /* @__PURE__ */ jsx(
2520
- DocumentActionsMenu,
2807
+ onClose: onToggleDialog,
2808
+ title: formatMessage({
2809
+ id: "app.components.ConfirmDialog.title",
2810
+ defaultMessage: "Confirmation"
2811
+ }),
2812
+ isOpen,
2813
+ children: [
2814
+ /* @__PURE__ */ jsx(DialogBody, { icon: /* @__PURE__ */ jsx(WarningCircle, {}), children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: dialogBody }) }),
2815
+ /* @__PURE__ */ jsx(
2816
+ DialogFooter,
2521
2817
  {
2522
- actions: tableRowActions,
2523
- label: formatMessage({
2524
- id: "content-manager.containers.list.table.row-actions",
2525
- defaultMessage: "Row action"
2526
- }),
2527
- variant: "ghost"
2818
+ startAction: /* @__PURE__ */ jsx(Button, { onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
2819
+ id: "app.components.Button.cancel",
2820
+ defaultMessage: "Cancel"
2821
+ }) }),
2822
+ endAction
2528
2823
  }
2529
- );
2530
- }
2824
+ )
2825
+ ]
2531
2826
  }
2532
2827
  );
2533
2828
  };
2534
- const EditAction = ({ documentId }) => {
2535
- const navigate = useNavigate();
2829
+ const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
2830
+ const ConfirmDialogPublishAll = ({
2831
+ isOpen,
2832
+ onToggleDialog,
2833
+ isConfirmButtonLoading = false,
2834
+ onConfirm
2835
+ }) => {
2536
2836
  const { formatMessage } = useIntl();
2537
- const { canRead } = useDocumentRBAC("EditAction", ({ canRead: canRead2 }) => ({ canRead: canRead2 }));
2837
+ const selectedEntries = useTable("ConfirmDialogPublishAll", (state) => state.selectedRows);
2538
2838
  const { toggleNotification } = useNotification();
2839
+ const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler(getTranslation);
2840
+ const { model, schema } = useDoc();
2539
2841
  const [{ query }] = useQueryParams();
2540
- return {
2541
- disabled: !canRead,
2542
- icon: /* @__PURE__ */ jsx(StyledPencil, {}),
2543
- label: formatMessage({
2544
- id: "content-manager.actions.edit.label",
2545
- defaultMessage: "Edit"
2546
- }),
2547
- position: "table-row",
2548
- onClick: async () => {
2549
- if (!documentId) {
2550
- console.error(
2551
- "You're trying to edit a document without an id, this is likely a bug with Strapi. Please open an issue."
2842
+ const {
2843
+ data: countDraftRelations = 0,
2844
+ isLoading,
2845
+ error
2846
+ } = useGetManyDraftRelationCountQuery(
2847
+ {
2848
+ model,
2849
+ documentIds: selectedEntries.map((entry) => entry.documentId),
2850
+ locale: query?.plugins?.i18n?.locale
2851
+ },
2852
+ {
2853
+ skip: selectedEntries.length === 0
2854
+ }
2855
+ );
2856
+ React.useEffect(() => {
2857
+ if (error) {
2858
+ toggleNotification({ type: "danger", message: formatAPIError(error) });
2859
+ }
2860
+ }, [error, formatAPIError, toggleNotification]);
2861
+ if (error) {
2862
+ return null;
2863
+ }
2864
+ return /* @__PURE__ */ jsx(
2865
+ ConfirmBulkActionDialog,
2866
+ {
2867
+ isOpen: isOpen && !isLoading,
2868
+ onToggleDialog,
2869
+ dialogBody: /* @__PURE__ */ jsxs(Fragment, { children: [
2870
+ /* @__PURE__ */ jsxs(Typography, { id: "confirm-description", textAlign: "center", children: [
2871
+ countDraftRelations > 0 && formatMessage(
2872
+ {
2873
+ id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
2874
+ defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
2875
+ },
2876
+ {
2877
+ b: BoldChunk$1,
2878
+ count: countDraftRelations,
2879
+ entities: selectedEntries.length
2880
+ }
2881
+ ),
2882
+ formatMessage({
2883
+ id: getTranslation("popUpWarning.bodyMessage.contentType.publish.all"),
2884
+ defaultMessage: "Are you sure you want to publish these entries?"
2885
+ })
2886
+ ] }),
2887
+ schema?.pluginOptions && "i18n" in schema.pluginOptions && schema?.pluginOptions.i18n && /* @__PURE__ */ jsx(Typography, { textColor: "danger500", textAlign: "center", children: formatMessage(
2888
+ {
2889
+ id: getTranslation("Settings.list.actions.publishAdditionalInfos"),
2890
+ defaultMessage: "This will publish the active locale versions <em>(from Internationalization)</em>"
2891
+ },
2892
+ {
2893
+ em: Emphasis
2894
+ }
2895
+ ) })
2896
+ ] }),
2897
+ endAction: /* @__PURE__ */ jsx(
2898
+ Button,
2899
+ {
2900
+ onClick: onConfirm,
2901
+ variant: "secondary",
2902
+ startIcon: /* @__PURE__ */ jsx(Check, {}),
2903
+ loading: isConfirmButtonLoading,
2904
+ children: formatMessage({
2905
+ id: "app.utils.publish",
2906
+ defaultMessage: "Publish"
2907
+ })
2908
+ }
2909
+ )
2910
+ }
2911
+ );
2912
+ };
2913
+ const TypographyMaxWidth = styled(Typography)`
2914
+ max-width: 300px;
2915
+ `;
2916
+ const formatErrorMessages = (errors, parentKey, formatMessage) => {
2917
+ const messages = [];
2918
+ Object.entries(errors).forEach(([key, value]) => {
2919
+ const currentKey = parentKey ? `${parentKey}.${key}` : key;
2920
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
2921
+ if ("id" in value && "defaultMessage" in value) {
2922
+ messages.push(
2923
+ formatMessage(
2924
+ {
2925
+ id: `${value.id}.withField`,
2926
+ defaultMessage: value.defaultMessage
2927
+ },
2928
+ { field: currentKey }
2929
+ )
2552
2930
  );
2553
- toggleNotification({
2554
- message: formatMessage({
2555
- id: "content-manager.actions.edit.error",
2556
- defaultMessage: "An error occurred while trying to edit the document."
2557
- }),
2558
- type: "danger"
2559
- });
2560
- return;
2931
+ } else {
2932
+ messages.push(...formatErrorMessages(value, currentKey, formatMessage));
2933
+ }
2934
+ } else {
2935
+ messages.push(
2936
+ formatMessage(
2937
+ {
2938
+ id: `${value}.withField`,
2939
+ defaultMessage: value
2940
+ },
2941
+ { field: currentKey }
2942
+ )
2943
+ );
2944
+ }
2945
+ });
2946
+ return messages;
2947
+ };
2948
+ const EntryValidationText = ({ validationErrors, status }) => {
2949
+ const { formatMessage } = useIntl();
2950
+ if (validationErrors) {
2951
+ const validationErrorsMessages = formatErrorMessages(validationErrors, "", formatMessage).join(
2952
+ " "
2953
+ );
2954
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2955
+ /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
2956
+ /* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
2957
+ ] });
2958
+ }
2959
+ if (status === "published") {
2960
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2961
+ /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
2962
+ /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
2963
+ id: "content-manager.bulk-publish.already-published",
2964
+ defaultMessage: "Already Published"
2965
+ }) })
2966
+ ] });
2967
+ }
2968
+ if (status === "modified") {
2969
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2970
+ /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
2971
+ /* @__PURE__ */ jsx(Typography, { children: formatMessage({
2972
+ id: "content-manager.bulk-publish.modified",
2973
+ defaultMessage: "Ready to publish changes"
2974
+ }) })
2975
+ ] });
2976
+ }
2977
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2978
+ /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
2979
+ /* @__PURE__ */ jsx(Typography, { children: formatMessage({
2980
+ id: "app.utils.ready-to-publish",
2981
+ defaultMessage: "Ready to publish"
2982
+ }) })
2983
+ ] });
2984
+ };
2985
+ const TABLE_HEADERS = [
2986
+ { name: "id", label: "id" },
2987
+ { name: "name", label: "name" },
2988
+ { name: "status", label: "status" },
2989
+ { name: "publicationStatus", label: "Publication status" }
2990
+ ];
2991
+ const SelectedEntriesTableContent = ({
2992
+ isPublishing,
2993
+ rowsToDisplay = [],
2994
+ entriesToPublish = [],
2995
+ validationErrors = {}
2996
+ }) => {
2997
+ const { pathname } = useLocation();
2998
+ const { formatMessage } = useIntl();
2999
+ const {
3000
+ list: {
3001
+ settings: { mainField }
3002
+ }
3003
+ } = useDocLayout();
3004
+ const shouldDisplayMainField = mainField != null && mainField !== "id";
3005
+ return /* @__PURE__ */ jsxs(Table.Content, { children: [
3006
+ /* @__PURE__ */ jsxs(Table.Head, { children: [
3007
+ /* @__PURE__ */ jsx(Table.HeaderCheckboxCell, {}),
3008
+ TABLE_HEADERS.filter((head) => head.name !== "name" || shouldDisplayMainField).map(
3009
+ (head) => /* @__PURE__ */ jsx(Table.HeaderCell, { ...head }, head.name)
3010
+ )
3011
+ ] }),
3012
+ /* @__PURE__ */ jsx(Table.Loading, {}),
3013
+ /* @__PURE__ */ jsx(Table.Body, { children: rowsToDisplay.map((row, index2) => /* @__PURE__ */ jsxs(Table.Row, { children: [
3014
+ /* @__PURE__ */ jsx(Table.CheckboxCell, { id: row.id }),
3015
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row.id }) }),
3016
+ shouldDisplayMainField && /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row[mainField] }) }),
3017
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(DocumentStatus, { status: row.status, maxWidth: "min-content" }) }),
3018
+ /* @__PURE__ */ jsx(Table.Cell, { children: isPublishing && entriesToPublish.includes(row.documentId) ? /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3019
+ /* @__PURE__ */ jsx(Typography, { children: formatMessage({
3020
+ id: "content-manager.success.record.publishing",
3021
+ defaultMessage: "Publishing..."
3022
+ }) }),
3023
+ /* @__PURE__ */ jsx(Loader, { small: true })
3024
+ ] }) : /* @__PURE__ */ jsx(
3025
+ EntryValidationText,
3026
+ {
3027
+ validationErrors: validationErrors[row.documentId],
3028
+ status: row.status
3029
+ }
3030
+ ) }),
3031
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
3032
+ IconButton,
3033
+ {
3034
+ tag: Link,
3035
+ to: {
3036
+ pathname: `${pathname}/${row.documentId}`,
3037
+ search: row.locale && `?plugins[i18n][locale]=${row.locale}`
3038
+ },
3039
+ state: { from: pathname },
3040
+ label: formatMessage(
3041
+ { id: "app.component.HelperPluginTable.edit", defaultMessage: "Edit {target}" },
3042
+ {
3043
+ target: formatMessage(
3044
+ {
3045
+ id: "content-manager.components.ListViewHelperPluginTable.row-line",
3046
+ defaultMessage: "item line {number}"
3047
+ },
3048
+ { number: index2 + 1 }
3049
+ )
3050
+ }
3051
+ ),
3052
+ target: "_blank",
3053
+ marginLeft: "auto",
3054
+ children: /* @__PURE__ */ jsx(Pencil, {})
3055
+ }
3056
+ ) })
3057
+ ] }, row.id)) })
3058
+ ] });
3059
+ };
3060
+ const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3061
+ const SelectedEntriesModalContent = ({
3062
+ listViewSelectedEntries,
3063
+ toggleModal,
3064
+ setListViewSelectedDocuments,
3065
+ model
3066
+ }) => {
3067
+ const { formatMessage } = useIntl();
3068
+ const { schema, components } = useContentTypeSchema(model);
3069
+ const documentIds = listViewSelectedEntries.map(({ documentId }) => documentId);
3070
+ const [{ query }] = useQueryParams();
3071
+ const params = React.useMemo(() => buildValidParams(query), [query]);
3072
+ const { data, isLoading, isFetching, refetch } = useGetAllDocumentsQuery(
3073
+ {
3074
+ model,
3075
+ params: {
3076
+ page: "1",
3077
+ pageSize: documentIds.length.toString(),
3078
+ sort: query.sort,
3079
+ filters: {
3080
+ documentId: {
3081
+ $in: documentIds
3082
+ }
3083
+ },
3084
+ locale: query.plugins?.i18n?.locale
2561
3085
  }
2562
- navigate({
2563
- pathname: documentId,
2564
- search: stringify({
2565
- plugins: query.plugins
2566
- })
3086
+ },
3087
+ {
3088
+ selectFromResult: ({ data: data2, ...restRes }) => ({ data: data2?.results ?? [], ...restRes })
3089
+ }
3090
+ );
3091
+ const { rows, validationErrors } = React.useMemo(() => {
3092
+ if (data.length > 0 && schema) {
3093
+ const validate = createYupSchema(schema.attributes, components);
3094
+ const validationErrors2 = {};
3095
+ const rows2 = data.map((entry) => {
3096
+ try {
3097
+ validate.validateSync(entry, { abortEarly: false });
3098
+ return entry;
3099
+ } catch (e) {
3100
+ if (e instanceof ValidationError) {
3101
+ validationErrors2[entry.documentId] = getYupValidationErrors(e);
3102
+ }
3103
+ return entry;
3104
+ }
3105
+ });
3106
+ return { rows: rows2, validationErrors: validationErrors2 };
3107
+ }
3108
+ return {
3109
+ rows: [],
3110
+ validationErrors: {}
3111
+ };
3112
+ }, [components, data, schema]);
3113
+ const [publishedCount, setPublishedCount] = React.useState(0);
3114
+ const [isDialogOpen, setIsDialogOpen] = React.useState(false);
3115
+ const { publishMany: bulkPublishAction } = useDocumentActions();
3116
+ const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
3117
+ const selectedRows = useTable("publishAction", (state) => state.selectedRows);
3118
+ const selectedEntries = rows.filter(
3119
+ (entry) => selectedRows.some((selectedEntry) => selectedEntry.documentId === entry.documentId)
3120
+ );
3121
+ const entriesToPublish = selectedEntries.filter((entry) => !validationErrors[entry.documentId]).map((entry) => entry.documentId);
3122
+ const selectedEntriesWithErrorsCount = selectedEntries.filter(
3123
+ ({ documentId }) => validationErrors[documentId]
3124
+ ).length;
3125
+ const selectedEntriesPublished = selectedEntries.filter(
3126
+ ({ status }) => status === "published"
3127
+ ).length;
3128
+ const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublished;
3129
+ const toggleDialog = () => setIsDialogOpen((prev) => !prev);
3130
+ const handleConfirmBulkPublish = async () => {
3131
+ toggleDialog();
3132
+ const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
3133
+ if (!("error" in res)) {
3134
+ setPublishedCount(res.count);
3135
+ const unpublishedEntries = rows.filter((row) => {
3136
+ return !entriesToPublish.includes(row.documentId);
2567
3137
  });
3138
+ setListViewSelectedDocuments(unpublishedEntries);
2568
3139
  }
2569
3140
  };
2570
- };
2571
- EditAction.type = "edit";
2572
- const StyledPencil = styled(Pencil)`
2573
- path {
2574
- fill: currentColor;
2575
- }
2576
- `;
2577
- const CloneAction = ({ model, documentId }) => {
2578
- const navigate = useNavigate();
2579
- const { formatMessage } = useIntl();
2580
- const { canCreate } = useDocumentRBAC("CloneAction", ({ canCreate: canCreate2 }) => ({ canCreate: canCreate2 }));
2581
- const { toggleNotification } = useNotification();
2582
- const { autoClone } = useDocumentActions();
2583
- const [prohibitedFields, setProhibitedFields] = React.useState([]);
2584
- return {
2585
- disabled: !canCreate,
2586
- icon: /* @__PURE__ */ jsx(StyledDuplicate, {}),
2587
- label: formatMessage({
2588
- id: "content-manager.actions.clone.label",
2589
- defaultMessage: "Duplicate"
2590
- }),
2591
- position: "table-row",
2592
- onClick: async () => {
2593
- if (!documentId) {
2594
- console.error(
2595
- "You're trying to clone a document in the table without an id, this is likely a bug with Strapi. Please open an issue."
2596
- );
2597
- toggleNotification({
2598
- message: formatMessage({
2599
- id: "content-manager.actions.clone.error",
2600
- defaultMessage: "An error occurred while trying to clone the document."
2601
- }),
2602
- type: "danger"
2603
- });
2604
- return;
3141
+ const getFormattedCountMessage = () => {
3142
+ if (publishedCount) {
3143
+ return formatMessage(
3144
+ {
3145
+ id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
3146
+ defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3147
+ },
3148
+ {
3149
+ publishedCount,
3150
+ withErrorsCount: selectedEntriesWithErrorsCount,
3151
+ b: BoldChunk
3152
+ }
3153
+ );
3154
+ }
3155
+ return formatMessage(
3156
+ {
3157
+ id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
3158
+ defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3159
+ },
3160
+ {
3161
+ readyToPublishCount: selectedEntriesWithNoErrorsCount,
3162
+ withErrorsCount: selectedEntriesWithErrorsCount,
3163
+ alreadyPublishedCount: selectedEntriesPublished,
3164
+ b: BoldChunk
2605
3165
  }
2606
- const res = await autoClone({ model, sourceId: documentId });
2607
- if ("data" in res) {
2608
- navigate(res.data.documentId);
2609
- return true;
3166
+ );
3167
+ };
3168
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3169
+ /* @__PURE__ */ jsxs(ModalBody, { children: [
3170
+ /* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
3171
+ /* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsx(
3172
+ SelectedEntriesTableContent,
3173
+ {
3174
+ isPublishing: isSubmittingForm,
3175
+ rowsToDisplay: rows,
3176
+ entriesToPublish,
3177
+ validationErrors
3178
+ }
3179
+ ) })
3180
+ ] }),
3181
+ /* @__PURE__ */ jsx(
3182
+ ModalFooter,
3183
+ {
3184
+ startActions: /* @__PURE__ */ jsx(Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
3185
+ id: "app.components.Button.cancel",
3186
+ defaultMessage: "Cancel"
3187
+ }) }),
3188
+ endActions: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3189
+ /* @__PURE__ */ jsx(Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
3190
+ /* @__PURE__ */ jsx(
3191
+ Button,
3192
+ {
3193
+ onClick: toggleDialog,
3194
+ disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3195
+ loading: isSubmittingForm,
3196
+ children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3197
+ }
3198
+ )
3199
+ ] })
2610
3200
  }
2611
- if (isBaseQueryError(res.error) && res.error.details && typeof res.error.details === "object" && "prohibitedFields" in res.error.details && Array.isArray(res.error.details.prohibitedFields)) {
2612
- const prohibitedFields2 = res.error.details.prohibitedFields;
2613
- setProhibitedFields(prohibitedFields2);
3201
+ ),
3202
+ /* @__PURE__ */ jsx(
3203
+ ConfirmDialogPublishAll,
3204
+ {
3205
+ isOpen: isDialogOpen,
3206
+ onToggleDialog: toggleDialog,
3207
+ isConfirmButtonLoading: isSubmittingForm,
3208
+ onConfirm: handleConfirmBulkPublish
2614
3209
  }
2615
- },
3210
+ )
3211
+ ] });
3212
+ };
3213
+ const PublishAction = ({ documents, model }) => {
3214
+ const { formatMessage } = useIntl();
3215
+ const hasPublishPermission = useDocumentRBAC("unpublishAction", (state) => state.canPublish);
3216
+ const showPublishButton = hasPublishPermission && documents.some(({ status }) => status !== "published");
3217
+ const setListViewSelectedDocuments = useTable("publishAction", (state) => state.selectRow);
3218
+ const refetchList = () => {
3219
+ contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3220
+ };
3221
+ if (!showPublishButton)
3222
+ return null;
3223
+ return {
3224
+ actionType: "publish",
3225
+ variant: "tertiary",
3226
+ label: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" }),
2616
3227
  dialog: {
2617
3228
  type: "modal",
2618
3229
  title: formatMessage({
2619
- id: "content-manager.containers.list.autoCloneModal.header",
2620
- defaultMessage: "Duplicate"
3230
+ id: getTranslation("containers.ListPage.selectedEntriesModal.title"),
3231
+ defaultMessage: "Publish entries"
2621
3232
  }),
2622
- content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
2623
- footer: ({ onClose }) => {
2624
- return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
2625
- /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
2626
- id: "cancel",
2627
- defaultMessage: "Cancel"
2628
- }) }),
2629
- /* @__PURE__ */ jsx(
2630
- LinkButton,
2631
- {
2632
- as: NavLink,
2633
- to: {
2634
- pathname: `clone/${documentId}`
2635
- },
2636
- children: formatMessage({
2637
- id: "content-manager.containers.list.autoCloneModal.create",
2638
- defaultMessage: "Create"
2639
- })
2640
- }
2641
- )
2642
- ] });
3233
+ content: ({ onClose }) => {
3234
+ return /* @__PURE__ */ jsx(Table.Root, { rows: documents, defaultSelectedRows: documents, headers: TABLE_HEADERS, children: /* @__PURE__ */ jsx(
3235
+ SelectedEntriesModalContent,
3236
+ {
3237
+ listViewSelectedEntries: documents,
3238
+ toggleModal: () => {
3239
+ onClose();
3240
+ refetchList();
3241
+ },
3242
+ setListViewSelectedDocuments,
3243
+ model
3244
+ }
3245
+ ) });
3246
+ },
3247
+ onClose: () => {
3248
+ refetchList();
2643
3249
  }
2644
3250
  }
2645
3251
  };
2646
3252
  };
2647
- CloneAction.type = "clone";
2648
- const StyledDuplicate = styled(Duplicate)`
2649
- path {
2650
- fill: currentColor;
2651
- }
2652
- `;
2653
- const DEFAULT_TABLE_ROW_ACTIONS = [EditAction, CloneAction];
2654
- class ContentManagerPlugin {
2655
- /**
2656
- * The following properties are the stored ones provided by any plugins registering with
2657
- * the content-manager. The function calls however, need to be called at runtime in the
2658
- * application, so instead we collate them and run them later with the complete list incl.
2659
- * ones already registered & the context of the view.
2660
- */
2661
- bulkActions = [...DEFAULT_BULK_ACTIONS];
2662
- documentActions = [
2663
- ...DEFAULT_ACTIONS,
2664
- ...DEFAULT_TABLE_ROW_ACTIONS,
2665
- ...DEFAULT_HEADER_ACTIONS,
2666
- HistoryAction
2667
- ];
2668
- editViewSidePanels = [ActionsPanel];
2669
- headerActions = [];
2670
- constructor() {
2671
- }
2672
- addEditViewSidePanel(panels) {
2673
- if (Array.isArray(panels)) {
2674
- this.editViewSidePanels = [...this.editViewSidePanels, ...panels];
2675
- } else if (typeof panels === "function") {
2676
- this.editViewSidePanels = panels(this.editViewSidePanels);
2677
- } else {
2678
- throw new Error(
2679
- `Expected the \`panels\` passed to \`addEditViewSidePanel\` to be an array or a function, but received ${getPrintableType(
2680
- panels
2681
- )}`
2682
- );
3253
+ const BulkActionsRenderer = () => {
3254
+ const plugins = useStrapiApp("BulkActionsRenderer", (state) => state.plugins);
3255
+ const { model, collectionType } = useDoc();
3256
+ const { selectedRows } = useTable("BulkActionsRenderer", (state) => state);
3257
+ return /* @__PURE__ */ jsx(Flex, { gap: 2, children: /* @__PURE__ */ jsx(
3258
+ DescriptionComponentRenderer,
3259
+ {
3260
+ props: {
3261
+ model,
3262
+ collectionType,
3263
+ documents: selectedRows
3264
+ },
3265
+ descriptions: plugins["content-manager"].apis.getBulkActions(),
3266
+ children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsx(BulkActionAction, { ...action }, action.id))
2683
3267
  }
2684
- }
2685
- addDocumentAction(actions2) {
2686
- if (Array.isArray(actions2)) {
2687
- this.documentActions = [...this.documentActions, ...actions2];
2688
- } else if (typeof actions2 === "function") {
2689
- this.documentActions = actions2(this.documentActions);
2690
- } else {
2691
- throw new Error(
2692
- `Expected the \`actions\` passed to \`addDocumentAction\` to be an array or a function, but received ${getPrintableType(
2693
- actions2
2694
- )}`
2695
- );
3268
+ ) });
3269
+ };
3270
+ const BulkActionAction = (action) => {
3271
+ const [dialogId, setDialogId] = React.useState(null);
3272
+ const { toggleNotification } = useNotification();
3273
+ const handleClick = (action2) => (e) => {
3274
+ const { onClick, dialog, id } = action2;
3275
+ if (onClick) {
3276
+ onClick(e);
2696
3277
  }
2697
- }
2698
- addDocumentHeaderAction(actions2) {
2699
- if (Array.isArray(actions2)) {
2700
- this.headerActions = [...this.headerActions, ...actions2];
2701
- } else if (typeof actions2 === "function") {
2702
- this.headerActions = actions2(this.headerActions);
2703
- } else {
2704
- throw new Error(
2705
- `Expected the \`actions\` passed to \`addDocumentHeaderAction\` to be an array or a function, but received ${getPrintableType(
2706
- actions2
2707
- )}`
2708
- );
3278
+ if (dialog) {
3279
+ switch (dialog.type) {
3280
+ case "notification":
3281
+ toggleNotification({
3282
+ title: dialog.title,
3283
+ message: dialog.content,
3284
+ type: dialog.status,
3285
+ timeout: dialog.timeout,
3286
+ onClose: dialog.onClose
3287
+ });
3288
+ break;
3289
+ case "dialog":
3290
+ case "modal": {
3291
+ e.preventDefault();
3292
+ setDialogId(id);
3293
+ }
3294
+ }
3295
+ }
3296
+ };
3297
+ const handleClose = () => {
3298
+ setDialogId(null);
3299
+ if (action.dialog?.type === "modal" && action.dialog?.onClose) {
3300
+ action.dialog.onClose();
3301
+ }
3302
+ };
3303
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3304
+ /* @__PURE__ */ jsx(
3305
+ Button,
3306
+ {
3307
+ disabled: action.disabled,
3308
+ startIcon: action.icon,
3309
+ variant: action.variant,
3310
+ onClick: handleClick(action),
3311
+ children: action.label
3312
+ }
3313
+ ),
3314
+ action.dialog?.type === "dialog" ? /* @__PURE__ */ jsx(
3315
+ BulkActionConfirmDialog,
3316
+ {
3317
+ ...action.dialog,
3318
+ variant: action.variant,
3319
+ isOpen: dialogId === action.id,
3320
+ onClose: handleClose
3321
+ }
3322
+ ) : null,
3323
+ action.dialog?.type === "modal" ? /* @__PURE__ */ jsx(
3324
+ BulkActionModal,
3325
+ {
3326
+ ...action.dialog,
3327
+ onModalClose: handleClose,
3328
+ isOpen: dialogId === action.id
3329
+ }
3330
+ ) : null
3331
+ ] });
3332
+ };
3333
+ const BulkActionConfirmDialog = ({
3334
+ onClose,
3335
+ onCancel,
3336
+ onConfirm,
3337
+ title,
3338
+ content,
3339
+ confirmButton,
3340
+ isOpen,
3341
+ variant = "secondary"
3342
+ }) => {
3343
+ const { formatMessage } = useIntl();
3344
+ const handleClose = async () => {
3345
+ if (onCancel) {
3346
+ await onCancel();
2709
3347
  }
2710
- }
2711
- addBulkAction(actions2) {
2712
- if (Array.isArray(actions2)) {
2713
- this.bulkActions = [...this.bulkActions, ...actions2];
2714
- } else if (typeof actions2 === "function") {
2715
- this.bulkActions = actions2(this.bulkActions);
2716
- } else {
2717
- throw new Error(
2718
- `Expected the \`actions\` passed to \`addBulkAction\` to be an array or a function, but received ${getPrintableType(
2719
- actions2
2720
- )}`
2721
- );
3348
+ onClose();
3349
+ };
3350
+ const handleConfirm = async () => {
3351
+ if (onConfirm) {
3352
+ await onConfirm();
2722
3353
  }
2723
- }
2724
- get config() {
2725
- return {
2726
- id: PLUGIN_ID,
2727
- name: "Content Manager",
2728
- injectionZones: INJECTION_ZONES,
2729
- apis: {
2730
- addBulkAction: this.addBulkAction.bind(this),
2731
- addDocumentAction: this.addDocumentAction.bind(this),
2732
- addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
2733
- addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
2734
- getBulkActions: () => this.bulkActions,
2735
- getDocumentActions: () => this.documentActions,
2736
- getEditViewSidePanels: () => this.editViewSidePanels,
2737
- getHeaderActions: () => this.headerActions
3354
+ onClose();
3355
+ };
3356
+ return /* @__PURE__ */ jsxs(Dialog, { isOpen, title, onClose: handleClose, children: [
3357
+ /* @__PURE__ */ jsx(DialogBody, { icon: /* @__PURE__ */ jsx(WarningCircle, {}), children: content }),
3358
+ /* @__PURE__ */ jsx(
3359
+ DialogFooter,
3360
+ {
3361
+ startAction: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
3362
+ id: "app.components.Button.cancel",
3363
+ defaultMessage: "Cancel"
3364
+ }) }),
3365
+ endAction: /* @__PURE__ */ jsx(
3366
+ Button,
3367
+ {
3368
+ onClick: handleConfirm,
3369
+ variant: variant === "danger-light" ? variant : "secondary",
3370
+ startIcon: variant === "danger-light" ? /* @__PURE__ */ jsx(Trash, {}) : /* @__PURE__ */ jsx(Check, {}),
3371
+ children: confirmButton ? confirmButton : formatMessage({
3372
+ id: "app.components.Button.confirm",
3373
+ defaultMessage: "Confirm"
3374
+ })
3375
+ }
3376
+ )
2738
3377
  }
2739
- };
3378
+ )
3379
+ ] });
3380
+ };
3381
+ const BulkActionModal = ({
3382
+ isOpen,
3383
+ title,
3384
+ onClose,
3385
+ content: Content,
3386
+ onModalClose
3387
+ }) => {
3388
+ const id = React.useId();
3389
+ if (!isOpen) {
3390
+ return null;
2740
3391
  }
2741
- }
2742
- const getPrintableType = (value) => {
2743
- const nativeType = typeof value;
2744
- if (nativeType === "object") {
2745
- if (value === null)
2746
- return "null";
2747
- if (Array.isArray(value))
2748
- return "array";
2749
- if (value instanceof Object && value.constructor.name !== "Object") {
2750
- return value.constructor.name;
3392
+ const handleClose = () => {
3393
+ if (onClose) {
3394
+ onClose();
2751
3395
  }
2752
- }
2753
- return nativeType;
2754
- };
2755
- const initialState = {
2756
- collectionTypeLinks: [],
2757
- components: [],
2758
- fieldSizes: {},
2759
- models: [],
2760
- singleTypeLinks: [],
2761
- isLoading: true
3396
+ onModalClose();
3397
+ };
3398
+ return /* @__PURE__ */ jsxs(ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
3399
+ /* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
3400
+ /* @__PURE__ */ jsx(Content, { onClose: handleClose })
3401
+ ] });
2762
3402
  };
2763
- const appSlice = createSlice({
2764
- name: "app",
2765
- initialState,
2766
- reducers: {
2767
- setInitialData(state, action) {
2768
- const {
2769
- authorizedCollectionTypeLinks,
2770
- authorizedSingleTypeLinks,
2771
- components,
2772
- contentTypeSchemas,
2773
- fieldSizes
2774
- } = action.payload;
2775
- state.collectionTypeLinks = authorizedCollectionTypeLinks.filter(
2776
- ({ isDisplayed }) => isDisplayed
2777
- );
2778
- state.singleTypeLinks = authorizedSingleTypeLinks.filter(({ isDisplayed }) => isDisplayed);
2779
- state.components = components;
2780
- state.models = contentTypeSchemas;
2781
- state.fieldSizes = fieldSizes;
2782
- state.isLoading = false;
3403
+ const DeleteAction = ({ documents, model }) => {
3404
+ const { formatMessage } = useIntl();
3405
+ const { schema: contentType } = useDoc();
3406
+ const selectRow = useTable("DeleteAction", (state) => state.selectRow);
3407
+ const hasI18nEnabled = Boolean(contentType?.pluginOptions?.i18n);
3408
+ const [{ query }] = useQueryParams();
3409
+ const params = React.useMemo(() => buildValidParams(query), [query]);
3410
+ const hasDeletePermission = useDocumentRBAC("deleteAction", (state) => state.canDelete);
3411
+ const { deleteMany: bulkDeleteAction } = useDocumentActions();
3412
+ const documentIds = documents.map(({ documentId }) => documentId);
3413
+ const handleConfirmBulkDelete = async () => {
3414
+ const res = await bulkDeleteAction({
3415
+ documentIds,
3416
+ model,
3417
+ params
3418
+ });
3419
+ if (!("error" in res)) {
3420
+ selectRow([]);
2783
3421
  }
2784
- }
2785
- });
2786
- const { actions, reducer: reducer$1 } = appSlice;
2787
- const { setInitialData } = actions;
2788
- const reducer = combineReducers({
2789
- app: reducer$1
2790
- });
2791
- const HOOKS = {
2792
- /**
2793
- * Hook that allows to mutate the displayed headers of the list view table
2794
- * @constant
2795
- * @type {string}
2796
- */
2797
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2798
- /**
2799
- * Hook that allows to mutate the CM's collection types links pre-set filters
2800
- * @constant
2801
- * @type {string}
2802
- */
2803
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2804
- /**
2805
- * Hook that allows to mutate the CM's edit view layout
2806
- * @constant
2807
- * @type {string}
2808
- */
2809
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2810
- /**
2811
- * Hook that allows to mutate the CM's single types links pre-set filters
2812
- * @constant
2813
- * @type {string}
2814
- */
2815
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2816
- };
2817
- const contentTypesApi = contentManagerApi.injectEndpoints({
2818
- endpoints: (builder) => ({
2819
- getContentTypeConfiguration: builder.query({
2820
- query: (uid) => ({
2821
- url: `/content-manager/content-types/${uid}/configuration`,
2822
- method: "GET"
2823
- }),
2824
- transformResponse: (response) => response.data,
2825
- providesTags: (_result, _error, uid) => [
2826
- { type: "ContentTypesConfiguration", id: uid },
2827
- { type: "ContentTypeSettings", id: "LIST" }
2828
- ]
2829
- }),
2830
- getAllContentTypeSettings: builder.query({
2831
- query: () => "/content-manager/content-types-settings",
2832
- transformResponse: (response) => response.data,
2833
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2834
- }),
2835
- updateContentTypeConfiguration: builder.mutation({
2836
- query: ({ uid, ...body }) => ({
2837
- url: `/content-manager/content-types/${uid}/configuration`,
2838
- method: "PUT",
2839
- data: body
2840
- }),
2841
- transformResponse: (response) => response.data,
2842
- invalidatesTags: (_result, _error, { uid }) => [
2843
- { type: "ContentTypesConfiguration", id: uid },
2844
- { type: "ContentTypeSettings", id: "LIST" },
2845
- // Is this necessary?
2846
- { type: "InitialData" }
2847
- ]
2848
- })
2849
- })
2850
- });
2851
- const {
2852
- useGetContentTypeConfigurationQuery,
2853
- useGetAllContentTypeSettingsQuery,
2854
- useUpdateContentTypeConfigurationMutation
2855
- } = contentTypesApi;
2856
- const checkIfAttributeIsDisplayable = (attribute) => {
2857
- const { type } = attribute;
2858
- if (type === "relation") {
2859
- return !attribute.relation.toLowerCase().includes("morph");
2860
- }
2861
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2862
- };
2863
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2864
- if (!mainFieldName) {
2865
- return void 0;
2866
- }
2867
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2868
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2869
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2870
- );
3422
+ };
3423
+ if (!hasDeletePermission)
3424
+ return null;
2871
3425
  return {
2872
- name: mainFieldName,
2873
- type: mainFieldType ?? "string"
3426
+ variant: "danger-light",
3427
+ label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
3428
+ dialog: {
3429
+ type: "dialog",
3430
+ title: formatMessage({
3431
+ id: "app.components.ConfirmDialog.title",
3432
+ defaultMessage: "Confirmation"
3433
+ }),
3434
+ content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3435
+ /* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
3436
+ id: "popUpWarning.bodyMessage.contentType.delete.all",
3437
+ defaultMessage: "Are you sure you want to delete these entries?"
3438
+ }) }),
3439
+ hasI18nEnabled && /* @__PURE__ */ jsx(Box, { textAlign: "center", padding: 3, children: /* @__PURE__ */ jsx(Typography, { textColor: "danger500", children: formatMessage(
3440
+ {
3441
+ id: getTranslation("Settings.list.actions.deleteAdditionalInfos"),
3442
+ defaultMessage: "This will delete the active locale versions <em>(from Internationalization)</em>"
3443
+ },
3444
+ {
3445
+ em: Emphasis
3446
+ }
3447
+ ) }) })
3448
+ ] }),
3449
+ onConfirm: handleConfirmBulkDelete
3450
+ }
2874
3451
  };
2875
3452
  };
2876
- const DEFAULT_SETTINGS = {
2877
- bulkable: false,
2878
- filterable: false,
2879
- searchable: false,
2880
- pagination: false,
2881
- defaultSortBy: "",
2882
- defaultSortOrder: "asc",
2883
- mainField: "id",
2884
- pageSize: 10
2885
- };
2886
- const useDocumentLayout = (model) => {
2887
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
3453
+ DeleteAction.type = "delete";
3454
+ const UnpublishAction = ({ documents, model }) => {
3455
+ const { formatMessage } = useIntl();
3456
+ const { schema } = useDoc();
3457
+ const selectRow = useTable("UnpublishAction", (state) => state.selectRow);
3458
+ const hasPublishPermission = useDocumentRBAC("unpublishAction", (state) => state.canPublish);
3459
+ const hasI18nEnabled = Boolean(schema?.pluginOptions?.i18n);
3460
+ const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);
3461
+ const { unpublishMany: bulkUnpublishAction } = useDocumentActions();
3462
+ const documentIds = documents.map(({ documentId }) => documentId);
2888
3463
  const [{ query }] = useQueryParams();
2889
- const runHookWaterfall = useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2890
- const { toggleNotification } = useNotification();
2891
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
2892
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2893
- const {
2894
- data,
2895
- isLoading: isLoadingConfigs,
2896
- error,
2897
- isFetching: isFetchingConfigs
2898
- } = useGetContentTypeConfigurationQuery(model);
2899
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2900
- React.useEffect(() => {
2901
- if (error) {
2902
- toggleNotification({
2903
- type: "danger",
2904
- message: formatAPIError(error)
2905
- });
3464
+ const params = React.useMemo(() => buildValidParams(query), [query]);
3465
+ const handleConfirmBulkUnpublish = async () => {
3466
+ const data = await bulkUnpublishAction({ documentIds, model, params });
3467
+ if (!("error" in data)) {
3468
+ selectRow([]);
2906
3469
  }
2907
- }, [error, formatAPIError, toggleNotification]);
2908
- const editLayout = React.useMemo(
2909
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2910
- layout: [],
2911
- components: {},
2912
- metadatas: {},
2913
- options: {},
2914
- settings: DEFAULT_SETTINGS
2915
- },
2916
- [data, isLoading, schemas, schema, components]
2917
- );
2918
- const listLayout = React.useMemo(() => {
2919
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2920
- layout: [],
2921
- metadatas: {},
2922
- options: {},
2923
- settings: DEFAULT_SETTINGS
2924
- };
2925
- }, [data, isLoading, schemas, schema, components]);
2926
- const { layout: edit } = React.useMemo(
2927
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2928
- layout: editLayout,
2929
- query
2930
- }),
2931
- [editLayout, query, runHookWaterfall]
2932
- );
3470
+ };
3471
+ const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3472
+ if (!showUnpublishButton)
3473
+ return null;
2933
3474
  return {
2934
- error,
2935
- isLoading,
2936
- edit,
2937
- list: listLayout
3475
+ variant: "tertiary",
3476
+ label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
3477
+ dialog: {
3478
+ type: "dialog",
3479
+ title: formatMessage({
3480
+ id: "app.components.ConfirmDialog.title",
3481
+ defaultMessage: "Confirmation"
3482
+ }),
3483
+ content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3484
+ /* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
3485
+ id: "popUpWarning.bodyMessage.contentType.unpublish.all",
3486
+ defaultMessage: "Are you sure you want to unpublish these entries?"
3487
+ }) }),
3488
+ hasI18nEnabled && /* @__PURE__ */ jsx(Box, { textAlign: "center", padding: 3, children: /* @__PURE__ */ jsx(Typography, { textColor: "danger500", children: formatMessage(
3489
+ {
3490
+ id: getTranslation("Settings.list.actions.unpublishAdditionalInfos"),
3491
+ defaultMessage: "This will unpublish the active locale versions <em>(from Internationalization)</em>"
3492
+ },
3493
+ {
3494
+ em: Emphasis
3495
+ }
3496
+ ) }) })
3497
+ ] }),
3498
+ confirmButton: formatMessage({
3499
+ id: "app.utils.unpublish",
3500
+ defaultMessage: "Unpublish"
3501
+ }),
3502
+ onConfirm: handleConfirmBulkUnpublish
3503
+ }
2938
3504
  };
2939
3505
  };
2940
- const useDocLayout = () => {
2941
- const { model } = useDoc();
2942
- return useDocumentLayout(model);
3506
+ UnpublishAction.type = "unpublish";
3507
+ const Emphasis = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold", textColor: "danger500", children: chunks });
3508
+ const DEFAULT_BULK_ACTIONS = [PublishAction, UnpublishAction, DeleteAction];
3509
+ const AutoCloneFailureModalBody = ({ prohibitedFields }) => {
3510
+ const { formatMessage } = useIntl();
3511
+ const getDefaultErrorMessage = (reason) => {
3512
+ switch (reason) {
3513
+ case "relation":
3514
+ return "Duplicating the relation could remove it from the original entry.";
3515
+ case "unique":
3516
+ return "Identical values in a unique field are not allowed";
3517
+ default:
3518
+ return reason;
3519
+ }
3520
+ };
3521
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3522
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", children: formatMessage({
3523
+ id: getTranslation("containers.list.autoCloneModal.title"),
3524
+ defaultMessage: "This entry can't be duplicated directly."
3525
+ }) }),
3526
+ /* @__PURE__ */ jsx(Box, { marginTop: 2, children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3527
+ id: getTranslation("containers.list.autoCloneModal.description"),
3528
+ defaultMessage: "A new entry will be created with the same content, but you'll have to change the following fields to save it."
3529
+ }) }) }),
3530
+ /* @__PURE__ */ jsx(Flex, { marginTop: 6, gap: 2, direction: "column", alignItems: "stretch", children: prohibitedFields.map(([fieldPath, reason]) => /* @__PURE__ */ jsxs(
3531
+ Flex,
3532
+ {
3533
+ direction: "column",
3534
+ gap: 2,
3535
+ alignItems: "flex-start",
3536
+ borderColor: "neutral200",
3537
+ hasRadius: true,
3538
+ padding: 6,
3539
+ children: [
3540
+ /* @__PURE__ */ jsx(Flex, { direction: "row", tag: "ol", children: fieldPath.map((pathSegment, index2) => /* @__PURE__ */ jsxs(Typography, { fontWeight: "semiBold", tag: "li", children: [
3541
+ pathSegment,
3542
+ index2 !== fieldPath.length - 1 && /* @__PURE__ */ jsx(
3543
+ ChevronRight,
3544
+ {
3545
+ fill: "neutral500",
3546
+ height: "0.8rem",
3547
+ width: "0.8rem",
3548
+ style: { margin: "0 0.8rem" }
3549
+ }
3550
+ )
3551
+ ] }, index2)) }),
3552
+ /* @__PURE__ */ jsx(Typography, { tag: "p", textColor: "neutral600", children: formatMessage({
3553
+ id: getTranslation(`containers.list.autoCloneModal.error.${reason}`),
3554
+ defaultMessage: getDefaultErrorMessage(reason)
3555
+ }) })
3556
+ ]
3557
+ },
3558
+ fieldPath.join()
3559
+ )) })
3560
+ ] });
2943
3561
  };
2944
- const formatEditLayout = (data, {
2945
- schemas,
2946
- schema,
2947
- components
2948
- }) => {
2949
- let currentPanelIndex = 0;
2950
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2951
- data.contentType.layouts.edit,
2952
- schema?.attributes,
2953
- data.contentType.metadatas,
2954
- { configurations: data.components, schemas: components },
2955
- schemas
2956
- ).reduce((panels, row) => {
2957
- if (row.some((field) => field.type === "dynamiczone")) {
2958
- panels.push([row]);
2959
- currentPanelIndex += 2;
2960
- } else {
2961
- if (!panels[currentPanelIndex]) {
2962
- panels.push([]);
3562
+ const TableActions = ({ document }) => {
3563
+ const { formatMessage } = useIntl();
3564
+ const { model, collectionType } = useDoc();
3565
+ const plugins = useStrapiApp("TableActions", (state) => state.plugins);
3566
+ const props = {
3567
+ activeTab: null,
3568
+ model,
3569
+ documentId: document.documentId,
3570
+ collectionType,
3571
+ document
3572
+ };
3573
+ return /* @__PURE__ */ jsx(
3574
+ DescriptionComponentRenderer,
3575
+ {
3576
+ props,
3577
+ descriptions: plugins["content-manager"].apis.getDocumentActions(),
3578
+ children: (actions2) => {
3579
+ const tableRowActions = actions2.filter((action) => {
3580
+ const positions = Array.isArray(action.position) ? action.position : [action.position];
3581
+ return positions.includes("table-row");
3582
+ });
3583
+ return /* @__PURE__ */ jsx(
3584
+ DocumentActionsMenu,
3585
+ {
3586
+ actions: tableRowActions,
3587
+ label: formatMessage({
3588
+ id: "content-manager.containers.list.table.row-actions",
3589
+ defaultMessage: "Row action"
3590
+ }),
3591
+ variant: "ghost"
3592
+ }
3593
+ );
2963
3594
  }
2964
- panels[currentPanelIndex].push(row);
2965
3595
  }
2966
- return panels;
2967
- }, []);
2968
- const componentEditAttributes = Object.entries(data.components).reduce(
2969
- (acc, [uid, configuration]) => {
2970
- acc[uid] = {
2971
- layout: convertEditLayoutToFieldLayouts(
2972
- configuration.layouts.edit,
2973
- components[uid].attributes,
2974
- configuration.metadatas
2975
- ),
2976
- settings: {
2977
- ...configuration.settings,
2978
- icon: components[uid].info.icon,
2979
- displayName: components[uid].info.displayName
2980
- }
2981
- };
2982
- return acc;
2983
- },
2984
- {}
2985
- );
2986
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2987
- (acc, [attribute, metadata]) => {
2988
- return {
2989
- ...acc,
2990
- [attribute]: metadata.edit
2991
- };
2992
- },
2993
- {}
2994
3596
  );
3597
+ };
3598
+ const EditAction = ({ documentId }) => {
3599
+ const navigate = useNavigate();
3600
+ const { formatMessage } = useIntl();
3601
+ const { canRead } = useDocumentRBAC("EditAction", ({ canRead: canRead2 }) => ({ canRead: canRead2 }));
3602
+ const { toggleNotification } = useNotification();
3603
+ const [{ query }] = useQueryParams();
2995
3604
  return {
2996
- layout: panelledEditAttributes,
2997
- components: componentEditAttributes,
2998
- metadatas: editMetadatas,
2999
- settings: {
3000
- ...data.contentType.settings,
3001
- displayName: schema?.info.displayName
3002
- },
3003
- options: {
3004
- ...schema?.options,
3005
- ...schema?.pluginOptions,
3006
- ...data.contentType.options
3605
+ disabled: !canRead,
3606
+ icon: /* @__PURE__ */ jsx(StyledPencil, {}),
3607
+ label: formatMessage({
3608
+ id: "content-manager.actions.edit.label",
3609
+ defaultMessage: "Edit"
3610
+ }),
3611
+ position: "table-row",
3612
+ onClick: async () => {
3613
+ if (!documentId) {
3614
+ console.error(
3615
+ "You're trying to edit a document without an id, this is likely a bug with Strapi. Please open an issue."
3616
+ );
3617
+ toggleNotification({
3618
+ message: formatMessage({
3619
+ id: "content-manager.actions.edit.error",
3620
+ defaultMessage: "An error occurred while trying to edit the document."
3621
+ }),
3622
+ type: "danger"
3623
+ });
3624
+ return;
3625
+ }
3626
+ navigate({
3627
+ pathname: documentId,
3628
+ search: stringify({
3629
+ plugins: query.plugins
3630
+ })
3631
+ });
3007
3632
  }
3008
3633
  };
3009
3634
  };
3010
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
3011
- return rows.map(
3012
- (row) => row.map((field) => {
3013
- const attribute = attributes[field.name];
3014
- if (!attribute) {
3015
- return null;
3016
- }
3017
- const { edit: metadata } = metadatas[field.name];
3018
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
3019
- return {
3020
- attribute,
3021
- disabled: !metadata.editable,
3022
- hint: metadata.description,
3023
- label: metadata.label ?? "",
3024
- name: field.name,
3025
- // @ts-expect-error – mainField does exist on the metadata for a relation.
3026
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
3027
- schemas,
3028
- components: components?.schemas ?? {}
3029
- }),
3030
- placeholder: metadata.placeholder ?? "",
3031
- required: attribute.required ?? false,
3032
- size: field.size,
3033
- unique: "unique" in attribute ? attribute.unique : false,
3034
- visible: metadata.visible ?? true,
3035
- type: attribute.type
3036
- };
3037
- }).filter((field) => field !== null)
3038
- );
3039
- };
3040
- const formatListLayout = (data, {
3041
- schemas,
3042
- schema,
3043
- components
3044
- }) => {
3045
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
3046
- (acc, [attribute, metadata]) => {
3047
- return {
3048
- ...acc,
3049
- [attribute]: metadata.list
3050
- };
3051
- },
3052
- {}
3053
- );
3054
- const listAttributes = convertListLayoutToFieldLayouts(
3055
- data.contentType.layouts.list,
3056
- schema?.attributes,
3057
- listMetadatas,
3058
- { configurations: data.components, schemas: components },
3059
- schemas
3060
- );
3635
+ EditAction.type = "edit";
3636
+ const StyledPencil = styled(Pencil)`
3637
+ path {
3638
+ fill: currentColor;
3639
+ }
3640
+ `;
3641
+ const CloneAction = ({ model, documentId }) => {
3642
+ const navigate = useNavigate();
3643
+ const { formatMessage } = useIntl();
3644
+ const { canCreate } = useDocumentRBAC("CloneAction", ({ canCreate: canCreate2 }) => ({ canCreate: canCreate2 }));
3645
+ const { toggleNotification } = useNotification();
3646
+ const { autoClone } = useDocumentActions();
3647
+ const [prohibitedFields, setProhibitedFields] = React.useState([]);
3061
3648
  return {
3062
- layout: listAttributes,
3063
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
3064
- metadatas: listMetadatas,
3065
- options: {
3066
- ...schema?.options,
3067
- ...schema?.pluginOptions,
3068
- ...data.contentType.options
3649
+ disabled: !canCreate,
3650
+ icon: /* @__PURE__ */ jsx(StyledDuplicate, {}),
3651
+ label: formatMessage({
3652
+ id: "content-manager.actions.clone.label",
3653
+ defaultMessage: "Duplicate"
3654
+ }),
3655
+ position: "table-row",
3656
+ onClick: async () => {
3657
+ if (!documentId) {
3658
+ console.error(
3659
+ "You're trying to clone a document in the table without an id, this is likely a bug with Strapi. Please open an issue."
3660
+ );
3661
+ toggleNotification({
3662
+ message: formatMessage({
3663
+ id: "content-manager.actions.clone.error",
3664
+ defaultMessage: "An error occurred while trying to clone the document."
3665
+ }),
3666
+ type: "danger"
3667
+ });
3668
+ return;
3669
+ }
3670
+ const res = await autoClone({ model, sourceId: documentId });
3671
+ if ("data" in res) {
3672
+ navigate(res.data.documentId);
3673
+ return true;
3674
+ }
3675
+ if (isBaseQueryError(res.error) && res.error.details && typeof res.error.details === "object" && "prohibitedFields" in res.error.details && Array.isArray(res.error.details.prohibitedFields)) {
3676
+ const prohibitedFields2 = res.error.details.prohibitedFields;
3677
+ setProhibitedFields(prohibitedFields2);
3678
+ }
3679
+ },
3680
+ dialog: {
3681
+ type: "modal",
3682
+ title: formatMessage({
3683
+ id: "content-manager.containers.list.autoCloneModal.header",
3684
+ defaultMessage: "Duplicate"
3685
+ }),
3686
+ content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3687
+ footer: ({ onClose }) => {
3688
+ return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
3689
+ /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3690
+ id: "cancel",
3691
+ defaultMessage: "Cancel"
3692
+ }) }),
3693
+ /* @__PURE__ */ jsx(
3694
+ LinkButton,
3695
+ {
3696
+ tag: NavLink,
3697
+ to: {
3698
+ pathname: `clone/${documentId}`
3699
+ },
3700
+ children: formatMessage({
3701
+ id: "content-manager.containers.list.autoCloneModal.create",
3702
+ defaultMessage: "Create"
3703
+ })
3704
+ }
3705
+ )
3706
+ ] });
3707
+ }
3069
3708
  }
3070
3709
  };
3071
3710
  };
3072
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
3073
- return columns.map((name) => {
3074
- const attribute = attributes[name];
3075
- if (!attribute) {
3076
- return null;
3711
+ CloneAction.type = "clone";
3712
+ const StyledDuplicate = styled(Duplicate)`
3713
+ path {
3714
+ fill: currentColor;
3715
+ }
3716
+ `;
3717
+ const DEFAULT_TABLE_ROW_ACTIONS = [EditAction, CloneAction];
3718
+ class ContentManagerPlugin {
3719
+ /**
3720
+ * The following properties are the stored ones provided by any plugins registering with
3721
+ * the content-manager. The function calls however, need to be called at runtime in the
3722
+ * application, so instead we collate them and run them later with the complete list incl.
3723
+ * ones already registered & the context of the view.
3724
+ */
3725
+ bulkActions = [...DEFAULT_BULK_ACTIONS];
3726
+ documentActions = [
3727
+ ...DEFAULT_ACTIONS,
3728
+ ...DEFAULT_TABLE_ROW_ACTIONS,
3729
+ ...DEFAULT_HEADER_ACTIONS,
3730
+ HistoryAction
3731
+ ];
3732
+ editViewSidePanels = [ActionsPanel];
3733
+ headerActions = [];
3734
+ constructor() {
3735
+ }
3736
+ addEditViewSidePanel(panels) {
3737
+ if (Array.isArray(panels)) {
3738
+ this.editViewSidePanels = [...this.editViewSidePanels, ...panels];
3739
+ } else if (typeof panels === "function") {
3740
+ this.editViewSidePanels = panels(this.editViewSidePanels);
3741
+ } else {
3742
+ throw new Error(
3743
+ `Expected the \`panels\` passed to \`addEditViewSidePanel\` to be an array or a function, but received ${getPrintableType(
3744
+ panels
3745
+ )}`
3746
+ );
3077
3747
  }
3078
- const metadata = metadatas[name];
3079
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
3748
+ }
3749
+ addDocumentAction(actions2) {
3750
+ if (Array.isArray(actions2)) {
3751
+ this.documentActions = [...this.documentActions, ...actions2];
3752
+ } else if (typeof actions2 === "function") {
3753
+ this.documentActions = actions2(this.documentActions);
3754
+ } else {
3755
+ throw new Error(
3756
+ `Expected the \`actions\` passed to \`addDocumentAction\` to be an array or a function, but received ${getPrintableType(
3757
+ actions2
3758
+ )}`
3759
+ );
3760
+ }
3761
+ }
3762
+ addDocumentHeaderAction(actions2) {
3763
+ if (Array.isArray(actions2)) {
3764
+ this.headerActions = [...this.headerActions, ...actions2];
3765
+ } else if (typeof actions2 === "function") {
3766
+ this.headerActions = actions2(this.headerActions);
3767
+ } else {
3768
+ throw new Error(
3769
+ `Expected the \`actions\` passed to \`addDocumentHeaderAction\` to be an array or a function, but received ${getPrintableType(
3770
+ actions2
3771
+ )}`
3772
+ );
3773
+ }
3774
+ }
3775
+ addBulkAction(actions2) {
3776
+ if (Array.isArray(actions2)) {
3777
+ this.bulkActions = [...this.bulkActions, ...actions2];
3778
+ } else if (typeof actions2 === "function") {
3779
+ this.bulkActions = actions2(this.bulkActions);
3780
+ } else {
3781
+ throw new Error(
3782
+ `Expected the \`actions\` passed to \`addBulkAction\` to be an array or a function, but received ${getPrintableType(
3783
+ actions2
3784
+ )}`
3785
+ );
3786
+ }
3787
+ }
3788
+ get config() {
3080
3789
  return {
3081
- attribute,
3082
- label: metadata.label ?? "",
3083
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
3084
- schemas,
3085
- components: components?.schemas ?? {}
3086
- }),
3087
- name,
3088
- searchable: metadata.searchable ?? true,
3089
- sortable: metadata.sortable ?? true
3790
+ id: PLUGIN_ID,
3791
+ name: "Content Manager",
3792
+ injectionZones: INJECTION_ZONES,
3793
+ apis: {
3794
+ addBulkAction: this.addBulkAction.bind(this),
3795
+ addDocumentAction: this.addDocumentAction.bind(this),
3796
+ addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3797
+ addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3798
+ getBulkActions: () => this.bulkActions,
3799
+ getDocumentActions: () => this.documentActions,
3800
+ getEditViewSidePanels: () => this.editViewSidePanels,
3801
+ getHeaderActions: () => this.headerActions
3802
+ }
3090
3803
  };
3091
- }).filter((field) => field !== null);
3804
+ }
3805
+ }
3806
+ const getPrintableType = (value) => {
3807
+ const nativeType = typeof value;
3808
+ if (nativeType === "object") {
3809
+ if (value === null)
3810
+ return "null";
3811
+ if (Array.isArray(value))
3812
+ return "array";
3813
+ if (value instanceof Object && value.constructor.name !== "Object") {
3814
+ return value.constructor.name;
3815
+ }
3816
+ }
3817
+ return nativeType;
3818
+ };
3819
+ const initialState = {
3820
+ collectionTypeLinks: [],
3821
+ components: [],
3822
+ fieldSizes: {},
3823
+ models: [],
3824
+ singleTypeLinks: [],
3825
+ isLoading: true
3092
3826
  };
3827
+ const appSlice = createSlice({
3828
+ name: "app",
3829
+ initialState,
3830
+ reducers: {
3831
+ setInitialData(state, action) {
3832
+ const {
3833
+ authorizedCollectionTypeLinks,
3834
+ authorizedSingleTypeLinks,
3835
+ components,
3836
+ contentTypeSchemas,
3837
+ fieldSizes
3838
+ } = action.payload;
3839
+ state.collectionTypeLinks = authorizedCollectionTypeLinks.filter(
3840
+ ({ isDisplayed }) => isDisplayed
3841
+ );
3842
+ state.singleTypeLinks = authorizedSingleTypeLinks.filter(({ isDisplayed }) => isDisplayed);
3843
+ state.components = components;
3844
+ state.models = contentTypeSchemas;
3845
+ state.fieldSizes = fieldSizes;
3846
+ state.isLoading = false;
3847
+ }
3848
+ }
3849
+ });
3850
+ const { actions, reducer: reducer$1 } = appSlice;
3851
+ const { setInitialData } = actions;
3852
+ const reducer = combineReducers({
3853
+ app: reducer$1
3854
+ });
3093
3855
  const index = {
3094
3856
  register(app) {
3095
3857
  const cm = new ContentManagerPlugin();
3096
3858
  app.addReducers({
3097
- [contentManagerApi.reducerPath]: contentManagerApi.reducer,
3098
3859
  [PLUGIN_ID]: reducer
3099
3860
  });
3100
- app.addMiddlewares([() => contentManagerApi.middleware]);
3101
3861
  app.addMenuLink({
3102
3862
  to: PLUGIN_ID,
3103
3863
  icon: Feather,
@@ -3106,14 +3866,15 @@ const index = {
3106
3866
  defaultMessage: "Content Manager"
3107
3867
  },
3108
3868
  permissions: [],
3109
- Component: () => import("./layout-Dnh0PNp9.mjs").then((mod) => ({ default: mod.Layout }))
3869
+ Component: () => import("./layout-BzAbmoO6.mjs").then((mod) => ({ default: mod.Layout })),
3870
+ position: 1
3110
3871
  });
3111
3872
  app.registerPlugin(cm.config);
3112
3873
  },
3113
3874
  async registerTrads({ locales }) {
3114
3875
  const importedTrads = await Promise.all(
3115
3876
  locales.map((locale) => {
3116
- 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-MBPul9Su.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 }) => {
3877
+ 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-Ux26r5pl.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 }) => {
3117
3878
  return {
3118
3879
  data: prefixPluginTranslations(data, PLUGIN_ID),
3119
3880
  locale
@@ -3131,45 +3892,46 @@ const index = {
3131
3892
  };
3132
3893
  export {
3133
3894
  ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as A,
3134
- extractContentTypeComponents as B,
3895
+ BulkActionsRenderer as B,
3135
3896
  COLLECTION_TYPES as C,
3136
3897
  DocumentStatus as D,
3137
- DEFAULT_SETTINGS as E,
3138
- convertEditLayoutToFieldLayouts as F,
3139
- useDocument as G,
3898
+ extractContentTypeComponents as E,
3899
+ DEFAULT_SETTINGS as F,
3900
+ convertEditLayoutToFieldLayouts as G,
3140
3901
  HOOKS as H,
3141
3902
  InjectionZone as I,
3142
- index as J,
3143
- useDocumentActions as K,
3903
+ useDocument as J,
3904
+ index as K,
3905
+ useDocumentActions as L,
3144
3906
  Panels as P,
3145
3907
  RelativeTime as R,
3146
3908
  SINGLE_TYPES as S,
3147
3909
  TableActions as T,
3148
- useGetAllContentTypeSettingsQuery as a,
3149
- useDoc as b,
3150
- buildValidParams as c,
3151
- contentManagerApi as d,
3152
- useDocumentRBAC as e,
3153
- useDocumentLayout as f,
3910
+ useGetInitialDataQuery as a,
3911
+ useGetAllContentTypeSettingsQuery as b,
3912
+ useDoc as c,
3913
+ buildValidParams as d,
3914
+ contentManagerApi as e,
3915
+ useDocumentRBAC as f,
3154
3916
  getTranslation as g,
3155
- createYupSchema as h,
3156
- Header as i,
3157
- PERMISSIONS as j,
3158
- DocumentRBAC as k,
3159
- DOCUMENT_META_FIELDS as l,
3160
- useDocLayout as m,
3161
- useContentTypeSchema as n,
3917
+ useDocumentLayout as h,
3918
+ createYupSchema as i,
3919
+ Header as j,
3920
+ PERMISSIONS as k,
3921
+ DocumentRBAC as l,
3922
+ DOCUMENT_META_FIELDS as m,
3923
+ useDocLayout as n,
3162
3924
  useGetContentTypeConfigurationQuery as o,
3163
3925
  CREATOR_FIELDS as p,
3164
3926
  getMainField as q,
3165
3927
  routes as r,
3166
3928
  setInitialData as s,
3167
3929
  getDisplayName as t,
3168
- useGetInitialDataQuery as u,
3930
+ useContentTypeSchema as u,
3169
3931
  checkIfAttributeIsDisplayable as v,
3170
3932
  useGetAllDocumentsQuery as w,
3171
3933
  convertListLayoutToFieldLayouts as x,
3172
3934
  capitalise as y,
3173
3935
  useUpdateContentTypeConfigurationMutation as z
3174
3936
  };
3175
- //# sourceMappingURL=index-DNVx8ssZ.mjs.map
3937
+ //# sourceMappingURL=index-Drt2DN7v.mjs.map