@strapi/content-manager 0.0.0-experimental.e0df4d50334a17a1beb3d203bff414fbbff62f7b → 0.0.0-experimental.e12978dcee698470990e9c5c63384faf2c307443

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 (120) hide show
  1. package/dist/admin/chunks/{ComponentConfigurationPage-C5H-5L1u.js → ComponentConfigurationPage-Ci3dN40b.js} +5 -6
  2. package/dist/admin/chunks/{ComponentConfigurationPage-C5H-5L1u.js.map → ComponentConfigurationPage-Ci3dN40b.js.map} +1 -1
  3. package/dist/admin/chunks/{ComponentConfigurationPage-BN2kOtDm.mjs → ComponentConfigurationPage-DFPdl9pm.mjs} +5 -6
  4. package/dist/admin/chunks/{ComponentConfigurationPage-BN2kOtDm.mjs.map → ComponentConfigurationPage-DFPdl9pm.mjs.map} +1 -1
  5. package/dist/admin/chunks/{EditConfigurationPage-BExtZuB7.js → EditConfigurationPage-7xe8u-Pp.js} +5 -6
  6. package/dist/admin/chunks/{EditConfigurationPage-BExtZuB7.js.map → EditConfigurationPage-7xe8u-Pp.js.map} +1 -1
  7. package/dist/admin/chunks/{EditConfigurationPage-tMgOELQG.mjs → EditConfigurationPage-BFse-urJ.mjs} +5 -6
  8. package/dist/admin/chunks/{EditConfigurationPage-tMgOELQG.mjs.map → EditConfigurationPage-BFse-urJ.mjs.map} +1 -1
  9. package/dist/admin/chunks/{EditViewPage-CYe7wAXF.mjs → EditViewPage-BNpRr7fZ.mjs} +99 -98
  10. package/dist/admin/chunks/EditViewPage-BNpRr7fZ.mjs.map +1 -0
  11. package/dist/admin/chunks/{EditViewPage-DFkloeMZ.js → EditViewPage-CwYSs8Cq.js} +99 -98
  12. package/dist/admin/chunks/EditViewPage-CwYSs8Cq.js.map +1 -0
  13. package/dist/admin/chunks/{Form-DTO0ZIaB.mjs → Form-D9Ee-exF.mjs} +3 -3
  14. package/dist/admin/chunks/{Form-DTO0ZIaB.mjs.map → Form-D9Ee-exF.mjs.map} +1 -1
  15. package/dist/admin/chunks/{Form-DGUP3zQO.js → Form-DDbxreII.js} +5 -5
  16. package/dist/admin/chunks/{Form-DGUP3zQO.js.map → Form-DDbxreII.js.map} +1 -1
  17. package/dist/admin/chunks/{History-CQznK1pG.js → History-D5joC76n.js} +17 -13
  18. package/dist/admin/chunks/History-D5joC76n.js.map +1 -0
  19. package/dist/admin/chunks/{History-C333pgXF.mjs → History-FuD7Tp5I.mjs} +16 -12
  20. package/dist/admin/chunks/History-FuD7Tp5I.mjs.map +1 -0
  21. package/dist/admin/chunks/{Input-BexkC_pp.mjs → Input-BHucdqva.mjs} +1108 -47
  22. package/dist/admin/chunks/Input-BHucdqva.mjs.map +1 -0
  23. package/dist/admin/chunks/{Input-DLJZHw9Y.js → Input-BJCenRYN.js} +1121 -57
  24. package/dist/admin/chunks/Input-BJCenRYN.js.map +1 -0
  25. package/dist/admin/chunks/{ListConfigurationPage-BX2WR7MI.mjs → ListConfigurationPage-3kSfz9xV.mjs} +4 -5
  26. package/dist/admin/chunks/{ListConfigurationPage-BX2WR7MI.mjs.map → ListConfigurationPage-3kSfz9xV.mjs.map} +1 -1
  27. package/dist/admin/chunks/{ListConfigurationPage-71I_stAM.js → ListConfigurationPage-CgJEcEkD.js} +6 -7
  28. package/dist/admin/chunks/{ListConfigurationPage-71I_stAM.js.map → ListConfigurationPage-CgJEcEkD.js.map} +1 -1
  29. package/dist/admin/chunks/{ListViewPage-DV3heO4F.js → ListViewPage-CvQ1w8IW.js} +7 -8
  30. package/dist/admin/chunks/{ListViewPage-DV3heO4F.js.map → ListViewPage-CvQ1w8IW.js.map} +1 -1
  31. package/dist/admin/chunks/{ListViewPage-BDeT3Dkk.mjs → ListViewPage-DPUYRHss.mjs} +3 -4
  32. package/dist/admin/chunks/{ListViewPage-BDeT3Dkk.mjs.map → ListViewPage-DPUYRHss.mjs.map} +1 -1
  33. package/dist/admin/chunks/{NoContentTypePage-9JHYpYVX.mjs → NoContentTypePage-BRLLtjLb.mjs} +2 -2
  34. package/dist/admin/chunks/{NoContentTypePage-9JHYpYVX.mjs.map → NoContentTypePage-BRLLtjLb.mjs.map} +1 -1
  35. package/dist/admin/chunks/{NoContentTypePage-COih9y2J.js → NoContentTypePage-C5Vut1Af.js} +2 -2
  36. package/dist/admin/chunks/{NoContentTypePage-COih9y2J.js.map → NoContentTypePage-C5Vut1Af.js.map} +1 -1
  37. package/dist/admin/chunks/{NoPermissionsPage-DTe9I47q.mjs → NoPermissionsPage-B5HJbcjm.mjs} +2 -2
  38. package/dist/admin/chunks/{NoPermissionsPage-DTe9I47q.mjs.map → NoPermissionsPage-B5HJbcjm.mjs.map} +1 -1
  39. package/dist/admin/chunks/{NoPermissionsPage-DGAwRIlN.js → NoPermissionsPage-BBXnpc7M.js} +2 -2
  40. package/dist/admin/chunks/{NoPermissionsPage-DGAwRIlN.js.map → NoPermissionsPage-BBXnpc7M.js.map} +1 -1
  41. package/dist/admin/chunks/{Preview-BEq0FXda.mjs → Preview-C3lnOgQx.mjs} +244 -116
  42. package/dist/admin/chunks/Preview-C3lnOgQx.mjs.map +1 -0
  43. package/dist/admin/chunks/{Preview-CXtc9yEV.js → Preview-DB7ZGawL.js} +240 -112
  44. package/dist/admin/chunks/Preview-DB7ZGawL.js.map +1 -0
  45. package/dist/admin/chunks/{en-C1CjdAtC.js → en-CH__IC8g.js} +4 -1
  46. package/dist/admin/chunks/{en-C1CjdAtC.js.map → en-CH__IC8g.js.map} +1 -1
  47. package/dist/admin/chunks/{en-LfhocNG2.mjs → en-DBP0Gaid.mjs} +4 -1
  48. package/dist/admin/chunks/{en-LfhocNG2.mjs.map → en-DBP0Gaid.mjs.map} +1 -1
  49. package/dist/admin/chunks/{index-Cs6qwFQu.mjs → index-DYrCidCq.mjs} +225 -140
  50. package/dist/admin/chunks/index-DYrCidCq.mjs.map +1 -0
  51. package/dist/admin/chunks/{index-BHimg6jW.js → index-DoUQnFTk.js} +227 -138
  52. package/dist/admin/chunks/index-DoUQnFTk.js.map +1 -0
  53. package/dist/admin/chunks/{layout-Dtahn4Ue.js → layout-CqndYVtU.js} +86 -13
  54. package/dist/admin/chunks/layout-CqndYVtU.js.map +1 -0
  55. package/dist/admin/chunks/{layout-DStNia_P.mjs → layout-D2NJmgCw.mjs} +78 -5
  56. package/dist/admin/chunks/layout-D2NJmgCw.mjs.map +1 -0
  57. package/dist/admin/chunks/{useDragAndDrop-gcqEJMnO.js → objects-BJTP843m.js} +73 -1
  58. package/dist/admin/chunks/objects-BJTP843m.js.map +1 -0
  59. package/dist/admin/chunks/{useDragAndDrop-HYwNDExe.mjs → objects-D2z-IJgu.mjs} +72 -2
  60. package/dist/admin/chunks/objects-D2z-IJgu.mjs.map +1 -0
  61. package/dist/admin/chunks/uk-BtM6WnaE.mjs +313 -0
  62. package/dist/admin/chunks/uk-BtM6WnaE.mjs.map +1 -0
  63. package/dist/admin/chunks/uk-DB6OgySY.js +318 -0
  64. package/dist/admin/chunks/uk-DB6OgySY.js.map +1 -0
  65. package/dist/admin/chunks/{relations-XOYEEqMz.js → usePrev-Cm_0-qRC.js} +18 -2
  66. package/dist/admin/chunks/usePrev-Cm_0-qRC.js.map +1 -0
  67. package/dist/admin/chunks/{relations-Cq8NRUto.mjs → usePrev-DinC2aha.mjs} +18 -4
  68. package/dist/admin/chunks/usePrev-DinC2aha.mjs.map +1 -0
  69. package/dist/admin/index.js +1 -1
  70. package/dist/admin/index.mjs +1 -1
  71. package/dist/admin/src/components/InjectionZone.d.ts +7 -1
  72. package/dist/admin/src/content-manager.d.ts +4 -0
  73. package/dist/admin/src/features/DocumentContext.d.ts +48 -0
  74. package/dist/admin/src/features/DocumentRBAC.d.ts +3 -2
  75. package/dist/admin/src/hooks/useDocument.d.ts +2 -0
  76. package/dist/admin/src/hooks/useDocumentActions.d.ts +1 -0
  77. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -1
  78. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +7 -0
  79. package/dist/admin/src/pages/EditView/components/FormInputs/{Relations.d.ts → Relations/Relations.d.ts} +9 -4
  80. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +5 -2
  81. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +3 -3
  82. package/dist/admin/src/preview/components/PreviewContent.d.ts +1 -2
  83. package/dist/admin/src/preview/pages/Preview.d.ts +2 -0
  84. package/dist/server/index.js +1 -1
  85. package/dist/server/index.js.map +1 -1
  86. package/dist/server/index.mjs +1 -1
  87. package/dist/server/index.mjs.map +1 -1
  88. package/package.json +8 -8
  89. package/dist/admin/chunks/EditViewPage-CYe7wAXF.mjs.map +0 -1
  90. package/dist/admin/chunks/EditViewPage-DFkloeMZ.js.map +0 -1
  91. package/dist/admin/chunks/History-C333pgXF.mjs.map +0 -1
  92. package/dist/admin/chunks/History-CQznK1pG.js.map +0 -1
  93. package/dist/admin/chunks/Input-BexkC_pp.mjs.map +0 -1
  94. package/dist/admin/chunks/Input-DLJZHw9Y.js.map +0 -1
  95. package/dist/admin/chunks/Preview-BEq0FXda.mjs.map +0 -1
  96. package/dist/admin/chunks/Preview-CXtc9yEV.js.map +0 -1
  97. package/dist/admin/chunks/Relations-o7_hVGyK.js +0 -1318
  98. package/dist/admin/chunks/Relations-o7_hVGyK.js.map +0 -1
  99. package/dist/admin/chunks/Relations-qeZyLDgQ.mjs +0 -1291
  100. package/dist/admin/chunks/Relations-qeZyLDgQ.mjs.map +0 -1
  101. package/dist/admin/chunks/index-BHimg6jW.js.map +0 -1
  102. package/dist/admin/chunks/index-Cs6qwFQu.mjs.map +0 -1
  103. package/dist/admin/chunks/layout-DStNia_P.mjs.map +0 -1
  104. package/dist/admin/chunks/layout-Dtahn4Ue.js.map +0 -1
  105. package/dist/admin/chunks/objects-C3EebVVe.js +0 -76
  106. package/dist/admin/chunks/objects-C3EebVVe.js.map +0 -1
  107. package/dist/admin/chunks/objects-wl73iEma.mjs +0 -73
  108. package/dist/admin/chunks/objects-wl73iEma.mjs.map +0 -1
  109. package/dist/admin/chunks/relations-Cq8NRUto.mjs.map +0 -1
  110. package/dist/admin/chunks/relations-XOYEEqMz.js.map +0 -1
  111. package/dist/admin/chunks/uk-B24MoTVg.js +0 -145
  112. package/dist/admin/chunks/uk-B24MoTVg.js.map +0 -1
  113. package/dist/admin/chunks/uk-Cpgmm7gE.mjs +0 -140
  114. package/dist/admin/chunks/uk-Cpgmm7gE.mjs.map +0 -1
  115. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs.map +0 -1
  116. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +0 -1
  117. package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs +0 -18
  118. package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs.map +0 -1
  119. package/dist/admin/chunks/usePrev-DIYl-IAL.js +0 -21
  120. package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { Cross, WarningCircle, More, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, CrossCircle, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from '@strapi/icons';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import { useStrapiApp, createContext, useQueryParams, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useForm, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from '@strapi/admin/strapi-admin';
3
+ import { useStrapiApp, adminApi, translatedErrors, useNotification, useAPIErrorHandler, useQueryParams, getYupValidationErrors, useForm, createContext, useAuth, useRBAC, Page, useTracking, useGuidedTour, BackButton, DescriptionComponentRenderer, useTable, Table } from '@strapi/admin/strapi-admin';
4
4
  import * as React from 'react';
5
5
  import { lazy } from 'react';
6
6
  import { Menu, Flex, Typography, Radio, Button, VisuallyHidden, Dialog, Modal, Status, Box, SingleSelect, SingleSelectOption, IconButton, RawTable, Loader, Tbody, Tr, Td, Tooltip, LinkButton } from '@strapi/design-system';
@@ -36,6 +36,9 @@ const INJECTION_ZONES = {
36
36
  deleteModalAdditionalInfos: [],
37
37
  publishModalAdditionalInfos: [],
38
38
  unpublishModalAdditionalInfos: []
39
+ },
40
+ preview: {
41
+ actions: []
39
42
  }
40
43
  };
41
44
  /**
@@ -96,102 +99,6 @@ const DOCUMENT_META_FIELDS = [
96
99
  const SINGLE_TYPES = 'single-types';
97
100
  const COLLECTION_TYPES = 'collection-types';
98
101
 
99
- const [DocumentRBACProvider, useDocumentRBAC] = createContext('DocumentRBAC', {
100
- canCreate: false,
101
- canCreateFields: [],
102
- canDelete: false,
103
- canPublish: false,
104
- canRead: false,
105
- canReadFields: [],
106
- canUpdate: false,
107
- canUpdateFields: [],
108
- canUserAction: ()=>false,
109
- isLoading: false
110
- });
111
- /**
112
- * @internal This component is not meant to be used outside of the Content Manager plugin.
113
- * It depends on knowing the slug/model of the content-type using the params of the URL.
114
- * If you do use the hook outside of the context, we default to `false` for all actions.
115
- *
116
- * It then creates an list of `can{Action}` that are passed to the context for consumption
117
- * within the app to enforce RBAC.
118
- */ const DocumentRBAC = ({ children, permissions })=>{
119
- const { slug } = useParams();
120
- if (!slug) {
121
- throw new Error('Cannot find the slug param in the URL');
122
- }
123
- const [{ rawQuery }] = useQueryParams();
124
- const userPermissions = useAuth('DocumentRBAC', (state)=>state.permissions);
125
- const contentTypePermissions = React.useMemo(()=>{
126
- const contentTypePermissions = userPermissions.filter((permission)=>permission.subject === slug);
127
- return contentTypePermissions.reduce((acc, permission)=>{
128
- const [action] = permission.action.split('.').slice(-1);
129
- return {
130
- ...acc,
131
- [action]: [
132
- permission
133
- ]
134
- };
135
- }, {});
136
- }, [
137
- slug,
138
- userPermissions
139
- ]);
140
- const { isLoading, allowedActions } = useRBAC(contentTypePermissions, permissions ?? undefined, // TODO: useRBAC context should be typed and built differently
141
- // We are passing raw query as context to the hook so that it can
142
- // rely on the locale provided from DocumentRBAC for its permission calculations.
143
- rawQuery);
144
- const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
145
- const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
146
- const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
147
- /**
148
- * @description Checks if the user can perform an action on a field based on the field names
149
- * provided as the second argument.
150
- */ const canUserAction = React.useCallback((fieldName, fieldsUserCanAction, fieldType)=>{
151
- const name = removeNumericalStrings(fieldName.split('.'));
152
- const componentFieldNames = fieldsUserCanAction// filter out fields that aren't components (components are dot separated)
153
- .filter((field)=>field.split('.').length > 1);
154
- if (fieldType === 'component') {
155
- // check if the field name is within any of those arrays
156
- return componentFieldNames.some((field)=>{
157
- return field.includes(name.join('.'));
158
- });
159
- }
160
- /**
161
- * The field is within a component.
162
- */ if (name.length > 1) {
163
- return componentFieldNames.includes(name.join('.'));
164
- }
165
- /**
166
- * just a regular field
167
- */ return fieldsUserCanAction.includes(fieldName);
168
- }, []);
169
- if (isLoading) {
170
- return /*#__PURE__*/ jsx(Page.Loading, {});
171
- }
172
- return /*#__PURE__*/ jsx(DocumentRBACProvider, {
173
- isLoading: isLoading,
174
- canCreateFields: canCreateFields,
175
- canReadFields: canReadFields,
176
- canUpdateFields: canUpdateFields,
177
- canUserAction: canUserAction,
178
- ...allowedActions,
179
- children: children
180
- });
181
- };
182
- /**
183
- * @internal it's really small, but it's used three times in a row and DRY for something this straight forward.
184
- */ const extractAndDedupeFields = (permissions = [])=>permissions.flatMap((permission)=>permission.properties?.fields).filter((field, index, arr)=>arr.indexOf(field) === index && typeof field === 'string');
185
- /**
186
- * @internal removes numerical strings from arrays.
187
- * @example
188
- * ```ts
189
- * const name = 'a.0.b';
190
- * const res = removeNumericalStrings(name.split('.'));
191
- * console.log(res); // ['a', 'b']
192
- * ```
193
- */ const removeNumericalStrings = (arr)=>arr.filter((item)=>isNaN(Number(item)));
194
-
195
102
  const BLOCK_LIST_ATTRIBUTE_KEYS = [
196
103
  '__component',
197
104
  '__temp_key__'
@@ -1502,7 +1409,7 @@ const checkIfAttributeIsDisplayable = (attribute)=>{
1502
1409
  const { toggleNotification } = useNotification();
1503
1410
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
1504
1411
  const { formatMessage } = useIntl();
1505
- const { currentData: data, isLoading: isLoadingDocument, isFetching: isFetchingDocument, error } = useGetDocumentQuery(args, {
1412
+ const { currentData: data, isLoading: isLoadingDocument, isFetching: isFetchingDocument, error, refetch } = useGetDocumentQuery(args, {
1506
1413
  ...opts,
1507
1414
  skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1508
1415
  });
@@ -1601,7 +1508,8 @@ const checkIfAttributeIsDisplayable = (attribute)=>{
1601
1508
  schemas,
1602
1509
  validate,
1603
1510
  getTitle,
1604
- getInitialFormValues
1511
+ getInitialFormValues,
1512
+ refetch
1605
1513
  };
1606
1514
  };
1607
1515
  /* -------------------------------------------------------------------------------------------------
@@ -1674,6 +1582,140 @@ const checkIfAttributeIsDisplayable = (attribute)=>{
1674
1582
  };
1675
1583
  };
1676
1584
 
1585
+ const [DocumentProvider, useDocumentContext] = createContext('DocumentContext');
1586
+ /**
1587
+ * TODO: Document in contributor docs, Add unit test
1588
+ *
1589
+ * This context provider and its associated hook are used to access a document at its root level
1590
+ * and expose a function to change the current document being viewed to one of the root level docuemnt's relations.
1591
+ *
1592
+ * The useDocumentContext hook exposes:
1593
+ * - meta: information about the currentDocument,
1594
+ * - document: the actual document,
1595
+ * - changeDocument: a function to change the current document to one of its relations.
1596
+ */ const DocumentContextProvider = ({ children, initialDocument })=>{
1597
+ /**
1598
+ * Initialize with the "root" document and expose a setter method to change to
1599
+ * one of the root level document's relations.
1600
+ */ const [currentDocumentMeta, changeDocument] = React.useState(initialDocument);
1601
+ const params = React.useMemo(()=>buildValidParams(currentDocumentMeta.params ?? {}), [
1602
+ currentDocumentMeta.params
1603
+ ]);
1604
+ const document = useDocument({
1605
+ ...currentDocumentMeta,
1606
+ params
1607
+ });
1608
+ return /*#__PURE__*/ jsx(DocumentProvider, {
1609
+ changeDocument: changeDocument,
1610
+ document: document,
1611
+ rootDocumentMeta: {
1612
+ documentId: initialDocument.documentId,
1613
+ model: initialDocument.model,
1614
+ collectionType: initialDocument.collectionType,
1615
+ params: initialDocument.params
1616
+ },
1617
+ meta: currentDocumentMeta,
1618
+ children: children
1619
+ });
1620
+ };
1621
+
1622
+ const [DocumentRBACProvider, useDocumentRBAC] = createContext('DocumentRBAC', {
1623
+ canCreate: false,
1624
+ canCreateFields: [],
1625
+ canDelete: false,
1626
+ canPublish: false,
1627
+ canRead: false,
1628
+ canReadFields: [],
1629
+ canUpdate: false,
1630
+ canUpdateFields: [],
1631
+ canUserAction: ()=>false,
1632
+ isLoading: false
1633
+ });
1634
+ /**
1635
+ * @internal This component is not meant to be used outside of the Content Manager plugin.
1636
+ * It depends on knowing the slug/model of the content-type using the params of the URL or the model if it is passed as arg.
1637
+ * If you do use the hook outside of the context, we default to `false` for all actions.
1638
+ *
1639
+ * It then creates an list of `can{Action}` that are passed to the context for consumption
1640
+ * within the app to enforce RBAC.
1641
+ */ const DocumentRBAC = ({ children, permissions, model })=>{
1642
+ const { slug } = useParams();
1643
+ if (!slug && !model) {
1644
+ throw new Error('Cannot find the slug param in the URL or the model prop is not provided.');
1645
+ }
1646
+ const contentTypeUid = model ?? slug;
1647
+ const [{ rawQuery }] = useQueryParams();
1648
+ const userPermissions = useAuth('DocumentRBAC', (state)=>state.permissions);
1649
+ const contentTypePermissions = React.useMemo(()=>{
1650
+ const contentTypePermissions = userPermissions.filter((permission)=>permission.subject === contentTypeUid);
1651
+ return contentTypePermissions.reduce((acc, permission)=>{
1652
+ const [action] = permission.action.split('.').slice(-1);
1653
+ return {
1654
+ ...acc,
1655
+ [action]: [
1656
+ permission
1657
+ ]
1658
+ };
1659
+ }, {});
1660
+ }, [
1661
+ contentTypeUid,
1662
+ userPermissions
1663
+ ]);
1664
+ const { isLoading, allowedActions } = useRBAC(contentTypePermissions, permissions ?? undefined, // TODO: useRBAC context should be typed and built differently
1665
+ // We are passing raw query as context to the hook so that it can
1666
+ // rely on the locale provided from DocumentRBAC for its permission calculations.
1667
+ rawQuery);
1668
+ const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
1669
+ const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
1670
+ const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
1671
+ /**
1672
+ * @description Checks if the user can perform an action on a field based on the field names
1673
+ * provided as the second argument.
1674
+ */ const canUserAction = React.useCallback((fieldName, fieldsUserCanAction, fieldType)=>{
1675
+ const name = removeNumericalStrings(fieldName.split('.'));
1676
+ const componentFieldNames = fieldsUserCanAction// filter out fields that aren't components (components are dot separated)
1677
+ .filter((field)=>field.split('.').length > 1);
1678
+ if (fieldType === 'component') {
1679
+ // check if the field name is within any of those arrays
1680
+ return componentFieldNames.some((field)=>{
1681
+ return field.includes(name.join('.'));
1682
+ });
1683
+ }
1684
+ /**
1685
+ * The field is within a component.
1686
+ */ if (name.length > 1) {
1687
+ return componentFieldNames.includes(name.join('.'));
1688
+ }
1689
+ /**
1690
+ * just a regular field
1691
+ */ return fieldsUserCanAction.includes(fieldName);
1692
+ }, []);
1693
+ if (isLoading) {
1694
+ return /*#__PURE__*/ jsx(Page.Loading, {});
1695
+ }
1696
+ return /*#__PURE__*/ jsx(DocumentRBACProvider, {
1697
+ isLoading: isLoading,
1698
+ canCreateFields: canCreateFields,
1699
+ canReadFields: canReadFields,
1700
+ canUpdateFields: canUpdateFields,
1701
+ canUserAction: canUserAction,
1702
+ ...allowedActions,
1703
+ children: children
1704
+ });
1705
+ };
1706
+ /**
1707
+ * @internal it's really small, but it's used three times in a row and DRY for something this straight forward.
1708
+ */ const extractAndDedupeFields = (permissions = [])=>permissions.flatMap((permission)=>permission.properties?.fields).filter((field, index, arr)=>arr.indexOf(field) === index && typeof field === 'string');
1709
+ /**
1710
+ * @internal removes numerical strings from arrays.
1711
+ * @example
1712
+ * ```ts
1713
+ * const name = 'a.0.b';
1714
+ * const res = removeNumericalStrings(name.split('.'));
1715
+ * console.log(res); // ['a', 'b']
1716
+ * ```
1717
+ */ const removeNumericalStrings = (arr)=>arr.filter((item)=>isNaN(Number(item)));
1718
+
1677
1719
  const prefixPluginTranslations = (trad, pluginId)=>{
1678
1720
  return Object.keys(trad).reduce((acc, current)=>{
1679
1721
  acc[`${pluginId}.${current}`] = trad[current];
@@ -1715,7 +1757,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1715
1757
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
1716
1758
  const navigate = useNavigate();
1717
1759
  const setCurrentStep = useGuidedTour('useDocumentActions', (state)=>state.setCurrentStep);
1718
- const [deleteDocument] = useDeleteDocumentMutation();
1760
+ const [deleteDocument, { isLoading: isDeleting }] = useDeleteDocumentMutation();
1719
1761
  const _delete = React.useCallback(async ({ collectionType, model, documentId, params }, trackerProperty)=>{
1720
1762
  try {
1721
1763
  trackUsage('willDeleteEntry', trackerProperty);
@@ -1761,7 +1803,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1761
1803
  formatMessage,
1762
1804
  formatAPIError
1763
1805
  ]);
1764
- const [deleteManyDocuments] = useDeleteManyDocumentsMutation();
1806
+ const [deleteManyDocuments, { isLoading: isDeletingMany }] = useDeleteManyDocumentsMutation();
1765
1807
  const deleteMany = React.useCallback(async ({ model, documentIds, params })=>{
1766
1808
  try {
1767
1809
  trackUsage('willBulkDeleteEntries');
@@ -1804,7 +1846,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1804
1846
  formatMessage,
1805
1847
  formatAPIError
1806
1848
  ]);
1807
- const [discardDocument] = useDiscardDocumentMutation();
1849
+ const [discardDocument, { isLoading: isDiscardingDocument }] = useDiscardDocumentMutation();
1808
1850
  const discard = React.useCallback(async ({ collectionType, model, documentId, params })=>{
1809
1851
  try {
1810
1852
  const res = await discardDocument({
@@ -1843,7 +1885,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1843
1885
  formatMessage,
1844
1886
  toggleNotification
1845
1887
  ]);
1846
- const [publishDocument] = usePublishDocumentMutation();
1888
+ const [publishDocument, { isLoading: isPublishing }] = usePublishDocumentMutation();
1847
1889
  const publish = React.useCallback(async ({ collectionType, model, documentId, params }, data)=>{
1848
1890
  try {
1849
1891
  trackUsage('willPublishEntry');
@@ -1886,7 +1928,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1886
1928
  formatMessage,
1887
1929
  formatAPIError
1888
1930
  ]);
1889
- const [publishManyDocuments] = usePublishManyDocumentsMutation();
1931
+ const [publishManyDocuments, { isLoading: isPublishingMany }] = usePublishManyDocumentsMutation();
1890
1932
  const publishMany = React.useCallback(async ({ model, documentIds, params })=>{
1891
1933
  try {
1892
1934
  // TODO Confirm tracking events for bulk publish?
@@ -1926,7 +1968,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1926
1968
  formatMessage,
1927
1969
  formatAPIError
1928
1970
  ]);
1929
- const [updateDocument] = useUpdateDocumentMutation();
1971
+ const [updateDocument, { isLoading: isUpdating }] = useUpdateDocumentMutation();
1930
1972
  const update = React.useCallback(async ({ collectionType, model, documentId, params }, data, trackerProperty)=>{
1931
1973
  try {
1932
1974
  trackUsage('willEditEntry', trackerProperty);
@@ -2022,7 +2064,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
2022
2064
  formatMessage,
2023
2065
  formatAPIError
2024
2066
  ]);
2025
- const [unpublishManyDocuments] = useUnpublishManyDocumentsMutation();
2067
+ const [unpublishManyDocuments, { isLoading: isUnpublishingMany }] = useUnpublishManyDocumentsMutation();
2026
2068
  const unpublishMany = React.useCallback(async ({ model, documentIds, params })=>{
2027
2069
  try {
2028
2070
  trackUsage('willBulkUnpublishEntries');
@@ -2213,6 +2255,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
2213
2255
  getDoc
2214
2256
  ]);
2215
2257
  return {
2258
+ isLoading: isPublishing || isUpdating || isDiscardingDocument || isDeleting || isDeletingMany || isUnpublishingMany || isPublishingMany,
2216
2259
  autoClone,
2217
2260
  clone,
2218
2261
  create,
@@ -2228,7 +2271,7 @@ const DEFAULT_UNEXPECTED_ERROR_MSG = {
2228
2271
  };
2229
2272
  };
2230
2273
 
2231
- const ProtectedHistoryPage = /*#__PURE__*/ React.lazy(()=>import('./History-C333pgXF.mjs').then((mod)=>({
2274
+ const ProtectedHistoryPage = /*#__PURE__*/ React.lazy(()=>import('./History-FuD7Tp5I.mjs').then((mod)=>({
2232
2275
  default: mod.ProtectedHistoryPage
2233
2276
  })));
2234
2277
  /**
@@ -2244,7 +2287,7 @@ const ProtectedHistoryPage = /*#__PURE__*/ React.lazy(()=>import('./History-C333
2244
2287
  }
2245
2288
  ];
2246
2289
 
2247
- const ProtectedPreviewPage = /*#__PURE__*/ React.lazy(()=>import('./Preview-BEq0FXda.mjs').then((mod)=>({
2290
+ const ProtectedPreviewPage = /*#__PURE__*/ React.lazy(()=>import('./Preview-C3lnOgQx.mjs').then((mod)=>({
2248
2291
  default: mod.ProtectedPreviewPage
2249
2292
  })));
2250
2293
  const routes$1 = [
@@ -2258,25 +2301,25 @@ const routes$1 = [
2258
2301
  }
2259
2302
  ];
2260
2303
 
2261
- const ProtectedEditViewPage = /*#__PURE__*/ lazy(()=>import('./EditViewPage-CYe7wAXF.mjs').then((mod)=>({
2304
+ const ProtectedEditViewPage = /*#__PURE__*/ lazy(()=>import('./EditViewPage-BNpRr7fZ.mjs').then((mod)=>({
2262
2305
  default: mod.ProtectedEditViewPage
2263
2306
  })));
2264
- const ProtectedListViewPage = /*#__PURE__*/ lazy(()=>import('./ListViewPage-BDeT3Dkk.mjs').then((mod)=>({
2307
+ const ProtectedListViewPage = /*#__PURE__*/ lazy(()=>import('./ListViewPage-DPUYRHss.mjs').then((mod)=>({
2265
2308
  default: mod.ProtectedListViewPage
2266
2309
  })));
2267
- const ProtectedListConfiguration = /*#__PURE__*/ lazy(()=>import('./ListConfigurationPage-BX2WR7MI.mjs').then((mod)=>({
2310
+ const ProtectedListConfiguration = /*#__PURE__*/ lazy(()=>import('./ListConfigurationPage-3kSfz9xV.mjs').then((mod)=>({
2268
2311
  default: mod.ProtectedListConfiguration
2269
2312
  })));
2270
- const ProtectedEditConfigurationPage = /*#__PURE__*/ lazy(()=>import('./EditConfigurationPage-tMgOELQG.mjs').then((mod)=>({
2313
+ const ProtectedEditConfigurationPage = /*#__PURE__*/ lazy(()=>import('./EditConfigurationPage-BFse-urJ.mjs').then((mod)=>({
2271
2314
  default: mod.ProtectedEditConfigurationPage
2272
2315
  })));
2273
- const ProtectedComponentConfigurationPage = /*#__PURE__*/ lazy(()=>import('./ComponentConfigurationPage-BN2kOtDm.mjs').then((mod)=>({
2316
+ const ProtectedComponentConfigurationPage = /*#__PURE__*/ lazy(()=>import('./ComponentConfigurationPage-DFPdl9pm.mjs').then((mod)=>({
2274
2317
  default: mod.ProtectedComponentConfigurationPage
2275
2318
  })));
2276
- const NoPermissions = /*#__PURE__*/ lazy(()=>import('./NoPermissionsPage-DTe9I47q.mjs').then((mod)=>({
2319
+ const NoPermissions = /*#__PURE__*/ lazy(()=>import('./NoPermissionsPage-B5HJbcjm.mjs').then((mod)=>({
2277
2320
  default: mod.NoPermissions
2278
2321
  })));
2279
- const NoContentType = /*#__PURE__*/ lazy(()=>import('./NoContentTypePage-9JHYpYVX.mjs').then((mod)=>({
2322
+ const NoContentType = /*#__PURE__*/ lazy(()=>import('./NoContentTypePage-BRLLtjLb.mjs').then((mod)=>({
2280
2323
  default: mod.NoContentType
2281
2324
  })));
2282
2325
  const CollectionTypePages = ()=>{
@@ -2412,6 +2455,7 @@ const DocumentActionButton = (action)=>{
2412
2455
  variant: action.variant || 'default',
2413
2456
  paddingTop: "7px",
2414
2457
  paddingBottom: "7px",
2458
+ loading: action.loading,
2415
2459
  children: action.label
2416
2460
  }),
2417
2461
  action.dialog?.type === 'dialog' ? /*#__PURE__*/ jsx(DocumentActionConfirmDialog, {
@@ -2566,7 +2610,7 @@ const convertActionVariantToIconColor = (variant = 'secondary')=>{
2566
2610
  return 'primary600';
2567
2611
  }
2568
2612
  };
2569
- const DocumentActionConfirmDialog = ({ onClose, onCancel, onConfirm, title, content, isOpen, variant = 'secondary' })=>{
2613
+ const DocumentActionConfirmDialog = ({ onClose, onCancel, onConfirm, title, content, isOpen, variant = 'secondary', loading })=>{
2570
2614
  const { formatMessage } = useIntl();
2571
2615
  const handleClose = async ()=>{
2572
2616
  if (onCancel) {
@@ -2607,6 +2651,7 @@ const DocumentActionConfirmDialog = ({ onClose, onCancel, onConfirm, title, cont
2607
2651
  onClick: handleConfirm,
2608
2652
  variant: variant,
2609
2653
  fullWidth: true,
2654
+ loading: loading,
2610
2655
  children: formatMessage({
2611
2656
  id: 'app.components.Button.confirm',
2612
2657
  defaultMessage: 'Confirm'
@@ -2661,8 +2706,8 @@ const transformData = (data)=>{
2661
2706
  };
2662
2707
  /* -------------------------------------------------------------------------------------------------
2663
2708
  * DocumentActionComponents
2664
- * -----------------------------------------------------------------------------------------------*/ const PublishAction$1 = ({ activeTab, documentId, model, collectionType, meta, document })=>{
2665
- const { schema } = useDoc();
2709
+ * -----------------------------------------------------------------------------------------------*/ const PublishAction$1 = ({ activeTab, documentId, model, collectionType, meta, document, onPreview })=>{
2710
+ const schema = useDocumentContext('PublishAction', (state)=>state.document.schema);
2666
2711
  const navigate = useNavigate();
2667
2712
  const { toggleNotification } = useNotification();
2668
2713
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
@@ -2671,7 +2716,7 @@ const transformData = (data)=>{
2671
2716
  const { id } = useParams();
2672
2717
  const { formatMessage } = useIntl();
2673
2718
  const canPublish = useDocumentRBAC('PublishAction', ({ canPublish })=>canPublish);
2674
- const { publish } = useDocumentActions();
2719
+ const { publish, isLoading } = useDocumentActions();
2675
2720
  const [countDraftRelations, { isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }] = useLazyGetDraftRelationCountQuery();
2676
2721
  const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React.useState(0);
2677
2722
  const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React.useState(0);
@@ -2685,6 +2730,8 @@ const transformData = (data)=>{
2685
2730
  const validate = useForm('PublishAction', (state)=>state.validate);
2686
2731
  const setErrors = useForm('PublishAction', (state)=>state.setErrors);
2687
2732
  const formValues = useForm('PublishAction', ({ values })=>values);
2733
+ const rootDocumentMeta = useDocumentContext('PublishAction', (state)=>state.rootDocumentMeta);
2734
+ const currentDocumentMeta = useDocumentContext('PublishAction', (state)=>state.meta);
2688
2735
  React.useEffect(()=>{
2689
2736
  if (isErrorDraftRelations) {
2690
2737
  toggleNotification({
@@ -2787,11 +2834,12 @@ const transformData = (data)=>{
2787
2834
  });
2788
2835
  return;
2789
2836
  }
2837
+ const isPublishingRelation = rootDocumentMeta.documentId !== currentDocumentMeta.documentId;
2790
2838
  const res = await publish({
2791
2839
  collectionType,
2792
2840
  model,
2793
2841
  documentId,
2794
- params
2842
+ params: isPublishingRelation ? currentDocumentMeta.params : params
2795
2843
  }, transformData(formValues));
2796
2844
  if ('data' in res && collectionType !== SINGLE_TYPES) {
2797
2845
  /**
@@ -2807,6 +2855,9 @@ const transformData = (data)=>{
2807
2855
  }
2808
2856
  } finally{
2809
2857
  setSubmitting(false);
2858
+ if (onPreview) {
2859
+ onPreview();
2860
+ }
2810
2861
  }
2811
2862
  };
2812
2863
  const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
@@ -2815,6 +2866,12 @@ const transformData = (data)=>{
2815
2866
  const enableDraftRelationsCount = false;
2816
2867
  const hasDraftRelations = enableDraftRelationsCount;
2817
2868
  return {
2869
+ loading: isLoading,
2870
+ position: [
2871
+ 'panel',
2872
+ 'preview',
2873
+ 'relation-modal'
2874
+ ],
2818
2875
  /**
2819
2876
  * Disabled when:
2820
2877
  * - currently if you're cloning a document we don't support publish & clone at the same time.
@@ -2852,15 +2909,19 @@ const transformData = (data)=>{
2852
2909
  };
2853
2910
  };
2854
2911
  PublishAction$1.type = 'publish';
2855
- PublishAction$1.position = 'panel';
2856
- const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
2912
+ PublishAction$1.position = [
2913
+ 'panel',
2914
+ 'preview',
2915
+ 'relation-modal'
2916
+ ];
2917
+ const UpdateAction = ({ activeTab, documentId, model, collectionType, onPreview })=>{
2857
2918
  const navigate = useNavigate();
2858
2919
  const { toggleNotification } = useNotification();
2859
2920
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
2860
2921
  const cloneMatch = useMatch(CLONE_PATH);
2861
2922
  const isCloning = cloneMatch !== null;
2862
2923
  const { formatMessage } = useIntl();
2863
- const { create, update, clone } = useDocumentActions();
2924
+ const { create, update, clone, isLoading } = useDocumentActions();
2864
2925
  const [{ query, rawQuery }] = useQueryParams();
2865
2926
  const params = React.useMemo(()=>buildValidParams(query), [
2866
2927
  query
@@ -2872,6 +2933,8 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
2872
2933
  const validate = useForm('UpdateAction', (state)=>state.validate);
2873
2934
  const setErrors = useForm('UpdateAction', (state)=>state.setErrors);
2874
2935
  const resetForm = useForm('PublishAction', ({ resetForm })=>resetForm);
2936
+ const rootDocumentMeta = useDocumentContext('UpdateAction', (state)=>state.rootDocumentMeta);
2937
+ const currentDocumentMeta = useDocumentContext('UpdateAction', (state)=>state.meta);
2875
2938
  const handleUpdate = React.useCallback(async ()=>{
2876
2939
  setSubmitting(true);
2877
2940
  try {
@@ -2908,11 +2971,12 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
2908
2971
  setErrors(formatValidationErrors(res.error));
2909
2972
  }
2910
2973
  } else if (documentId || collectionType === SINGLE_TYPES) {
2974
+ const isEditingRelation = rootDocumentMeta.documentId !== currentDocumentMeta.documentId;
2911
2975
  const res = await update({
2912
2976
  collectionType,
2913
2977
  model,
2914
2978
  documentId,
2915
- params
2979
+ params: isEditingRelation ? currentDocumentMeta.params : params
2916
2980
  }, transformData(document));
2917
2981
  if ('error' in res && isBaseQueryError(res.error) && res.error.name === 'ValidationError') {
2918
2982
  setErrors(formatValidationErrors(res.error));
@@ -2938,6 +3002,9 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
2938
3002
  }
2939
3003
  } finally{
2940
3004
  setSubmitting(false);
3005
+ if (onPreview) {
3006
+ onPreview();
3007
+ }
2941
3008
  }
2942
3009
  }, [
2943
3010
  clone,
@@ -2977,6 +3044,7 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
2977
3044
  handleUpdate
2978
3045
  ]);
2979
3046
  return {
3047
+ loading: isLoading,
2980
3048
  /**
2981
3049
  * Disabled when:
2982
3050
  * - the form is submitting
@@ -2987,11 +3055,20 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
2987
3055
  id: 'global.save',
2988
3056
  defaultMessage: 'Save'
2989
3057
  }),
2990
- onClick: handleUpdate
3058
+ onClick: handleUpdate,
3059
+ position: [
3060
+ 'panel',
3061
+ 'preview',
3062
+ 'relation-modal'
3063
+ ]
2991
3064
  };
2992
3065
  };
2993
3066
  UpdateAction.type = 'update';
2994
- UpdateAction.position = 'panel';
3067
+ UpdateAction.position = [
3068
+ 'panel',
3069
+ 'preview',
3070
+ 'relation-modal'
3071
+ ];
2995
3072
  const UNPUBLISH_DRAFT_OPTIONS = {
2996
3073
  KEEP: 'keep',
2997
3074
  DISCARD: 'discard'
@@ -3141,7 +3218,7 @@ const DiscardAction = ({ activeTab, documentId, model, collectionType, document
3141
3218
  const { formatMessage } = useIntl();
3142
3219
  const { schema } = useDoc();
3143
3220
  const canUpdate = useDocumentRBAC('DiscardAction', ({ canUpdate })=>canUpdate);
3144
- const { discard } = useDocumentActions();
3221
+ const { discard, isLoading } = useDocumentActions();
3145
3222
  const [{ query }] = useQueryParams();
3146
3223
  const params = React.useMemo(()=>buildValidParams(query), [
3147
3224
  query
@@ -3187,6 +3264,7 @@ const DiscardAction = ({ activeTab, documentId, model, collectionType, document
3187
3264
  })
3188
3265
  ]
3189
3266
  }),
3267
+ loading: isLoading,
3190
3268
  onConfirm: async ()=>{
3191
3269
  await discard({
3192
3270
  collectionType,
@@ -3281,6 +3359,8 @@ const capitalise = (str)=>str.charAt(0).toUpperCase() + str.slice(1);
3281
3359
  ...restProps,
3282
3360
  size: size,
3283
3361
  variant: statusVariant,
3362
+ role: "status",
3363
+ "aria-label": status,
3284
3364
  children: /*#__PURE__*/ jsx(Typography, {
3285
3365
  tag: "span",
3286
3366
  variant: "omega",
@@ -3623,7 +3703,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document })=>{
3623
3703
  const { formatMessage } = useIntl();
3624
3704
  const listViewPathMatch = useMatch(LIST_PATH);
3625
3705
  const canDelete = useDocumentRBAC('DeleteAction', (state)=>state.canDelete);
3626
- const { delete: deleteAction } = useDocumentActions();
3706
+ const { delete: deleteAction, isLoading } = useDocumentActions();
3627
3707
  const { toggleNotification } = useNotification();
3628
3708
  const setSubmitting = useForm('DeleteAction', (state)=>state.setSubmitting);
3629
3709
  const isLocalized = document?.locale != null;
@@ -3662,6 +3742,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document })=>{
3662
3742
  })
3663
3743
  ]
3664
3744
  }),
3745
+ loading: isLoading,
3665
3746
  onConfirm: async ()=>{
3666
3747
  /**
3667
3748
  * If we have a match, we're in the list view
@@ -4343,7 +4424,7 @@ const SelectedEntriesModalContent = ({ listViewSelectedEntries, toggleModal, set
4343
4424
  schema
4344
4425
  ]);
4345
4426
  const [isDialogOpen, setIsDialogOpen] = React.useState(false);
4346
- const { publishMany: bulkPublishAction } = useDocumentActions();
4427
+ const { publishMany: bulkPublishAction, isLoading: isPublishing } = useDocumentActions();
4347
4428
  const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
4348
4429
  const selectedRows = useTable('publishAction', (state)=>state.selectedRows);
4349
4430
  // Filter selected entries from the updated modal table rows
@@ -4415,7 +4496,7 @@ const SelectedEntriesModalContent = ({ listViewSelectedEntries, toggleModal, set
4415
4496
  /*#__PURE__*/ jsx(Button, {
4416
4497
  onClick: toggleDialog,
4417
4498
  disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublishedCount === selectedEntries.length || isLoading,
4418
- loading: isSubmittingForm,
4499
+ loading: isPublishing || isSubmittingForm,
4419
4500
  children: formatMessage({
4420
4501
  id: 'app.utils.publish',
4421
4502
  defaultMessage: 'Publish'
@@ -4428,7 +4509,7 @@ const SelectedEntriesModalContent = ({ listViewSelectedEntries, toggleModal, set
4428
4509
  /*#__PURE__*/ jsx(ConfirmDialogPublishAll, {
4429
4510
  isOpen: isDialogOpen,
4430
4511
  onToggleDialog: toggleDialog,
4431
- isConfirmButtonLoading: isSubmittingForm,
4512
+ isConfirmButtonLoading: isPublishing || isSubmittingForm,
4432
4513
  onConfirm: handleConfirmBulkPublish
4433
4514
  })
4434
4515
  ]
@@ -4520,7 +4601,7 @@ const SelectedEntriesModalContent = ({ listViewSelectedEntries, toggleModal, set
4520
4601
  query
4521
4602
  ]);
4522
4603
  const hasDeletePermission = useDocumentRBAC('deleteAction', (state)=>state.canDelete);
4523
- const { deleteMany: bulkDeleteAction } = useDocumentActions();
4604
+ const { deleteMany: bulkDeleteAction, isLoading } = useDocumentActions();
4524
4605
  const documentIds = documents.map(({ documentId })=>documentId);
4525
4606
  const handleConfirmBulkDelete = async ()=>{
4526
4607
  const res = await bulkDeleteAction({
@@ -4545,6 +4626,7 @@ const SelectedEntriesModalContent = ({ listViewSelectedEntries, toggleModal, set
4545
4626
  id: 'app.components.ConfirmDialog.title',
4546
4627
  defaultMessage: 'Confirmation'
4547
4628
  }),
4629
+ loading: isLoading,
4548
4630
  content: /*#__PURE__*/ jsxs(Flex, {
4549
4631
  direction: "column",
4550
4632
  alignItems: "stretch",
@@ -4593,7 +4675,7 @@ const UnpublishAction = ({ documents, model })=>{
4593
4675
  const hasPublishPermission = useDocumentRBAC('unpublishAction', (state)=>state.canPublish);
4594
4676
  const hasI18nEnabled = Boolean(schema?.pluginOptions?.i18n);
4595
4677
  const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);
4596
- const { unpublishMany: bulkUnpublishAction } = useDocumentActions();
4678
+ const { unpublishMany: bulkUnpublishAction, isLoading } = useDocumentActions();
4597
4679
  const documentIds = documents.map(({ documentId })=>documentId);
4598
4680
  const [{ query }] = useQueryParams();
4599
4681
  const params = React.useMemo(()=>buildValidParams(query), [
@@ -4623,6 +4705,7 @@ const UnpublishAction = ({ documents, model })=>{
4623
4705
  id: 'app.components.ConfirmDialog.title',
4624
4706
  defaultMessage: 'Confirmation'
4625
4707
  }),
4708
+ loading: isLoading,
4626
4709
  content: /*#__PURE__*/ jsxs(Flex, {
4627
4710
  direction: "column",
4628
4711
  alignItems: "stretch",
@@ -5004,9 +5087,11 @@ const DEFAULT_TABLE_ROW_ACTIONS = [
5004
5087
  * The response should still be filtered by the position, as the static property is new
5005
5088
  * and not mandatory to avoid a breaking change.
5006
5089
  */ if (position) {
5007
- return this.documentActions.filter((action)=>action.position == undefined || [
5090
+ return this.documentActions.filter((action)=>{
5091
+ return action.position == undefined || [
5008
5092
  action.position
5009
- ].flat().includes(position));
5093
+ ].flat().includes(position);
5094
+ });
5010
5095
  }
5011
5096
  return this.documentActions;
5012
5097
  },
@@ -5258,7 +5343,7 @@ function __variableDynamicImportRuntime1__(path) {
5258
5343
  case './translations/ca.json': return import('./ca-DviY7mRj.mjs');
5259
5344
  case './translations/cs.json': return import('./cs-C7OSYFQ7.mjs');
5260
5345
  case './translations/de.json': return import('./de-5QRlDHyR.mjs');
5261
- case './translations/en.json': return import('./en-LfhocNG2.mjs');
5346
+ case './translations/en.json': return import('./en-DBP0Gaid.mjs');
5262
5347
  case './translations/es.json': return import('./es-DkoWSExG.mjs');
5263
5348
  case './translations/eu.json': return import('./eu-BG1xX7HK.mjs');
5264
5349
  case './translations/fr.json': return import('./fr-CFdRaRVj.mjs');
@@ -5281,7 +5366,7 @@ function __variableDynamicImportRuntime1__(path) {
5281
5366
  case './translations/sv.json': return import('./sv-cq4ZrQRd.mjs');
5282
5367
  case './translations/th.json': return import('./th-mUH7hEtc.mjs');
5283
5368
  case './translations/tr.json': return import('./tr-Yt38daxh.mjs');
5284
- case './translations/uk.json': return import('./uk-Cpgmm7gE.mjs');
5369
+ case './translations/uk.json': return import('./uk-BtM6WnaE.mjs');
5285
5370
  case './translations/vi.json': return import('./vi-CvBGlTjr.mjs');
5286
5371
  case './translations/zh-Hans.json': return import('./zh-Hans-CI0HKio3.mjs');
5287
5372
  case './translations/zh.json': return import('./zh-BmF-sHaT.mjs');
@@ -5312,7 +5397,7 @@ var index = {
5312
5397
  app.router.addRoute({
5313
5398
  path: 'content-manager/*',
5314
5399
  lazy: async ()=>{
5315
- const { Layout } = await import('./layout-DStNia_P.mjs');
5400
+ const { Layout } = await import('./layout-D2NJmgCw.mjs');
5316
5401
  return {
5317
5402
  Component: Layout
5318
5403
  };
@@ -5347,5 +5432,5 @@ var index = {
5347
5432
  }
5348
5433
  };
5349
5434
 
5350
- export { useUpdateContentTypeConfigurationMutation as A, BulkActionsRenderer as B, COLLECTION_TYPES as C, DocumentStatus as D, ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as E, extractContentTypeComponents as F, DEFAULT_SETTINGS as G, HOOKS as H, InjectionZone as I, convertEditLayoutToFieldLayouts as J, removeFieldsThatDontExistOnSchema as K, prepareTempKeys as L, useDocument as M, useGetPreviewUrlQuery as N, index as O, Panels as P, useContentManagerContext as Q, RelativeTime as R, SINGLE_TYPES as S, TableActions as T, useDocumentActions as U, useGetInitialDataQuery as a, useGetAllContentTypeSettingsQuery as b, useDoc as c, buildValidParams as d, contentManagerApi as e, useDocumentRBAC as f, getTranslation as g, useDocumentLayout as h, createYupSchema as i, Header as j, PERMISSIONS as k, DocumentRBAC as l, useDocLayout as m, createDefaultForm as n, CLONE_PATH as o, useGetContentTypeConfigurationQuery as p, CREATOR_FIELDS as q, getMainField as r, setInitialData as s, transformDocument as t, useContentTypeSchema as u, getDisplayName as v, checkIfAttributeIsDisplayable as w, useGetAllDocumentsQuery as x, convertListLayoutToFieldLayouts as y, capitalise as z };
5351
- //# sourceMappingURL=index-Cs6qwFQu.mjs.map
5435
+ export { checkIfAttributeIsDisplayable as A, useGetAllDocumentsQuery as B, COLLECTION_TYPES as C, DocumentStatus as D, BulkActionsRenderer as E, convertListLayoutToFieldLayouts as F, capitalise as G, HOOKS as H, InjectionZone as I, useUpdateContentTypeConfigurationMutation as J, ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as K, extractContentTypeComponents as L, DEFAULT_SETTINGS as M, convertEditLayoutToFieldLayouts as N, removeFieldsThatDontExistOnSchema as O, PERMISSIONS as P, prepareTempKeys as Q, RelativeTime as R, SINGLE_TYPES as S, TableActions as T, useDocument as U, useGetPreviewUrlQuery as V, index as W, useContentManagerContext as X, useDocumentActions as Y, useGetInitialDataQuery as a, useGetAllContentTypeSettingsQuery as b, useDocumentContext as c, useDocumentLayout as d, createDefaultForm as e, DocumentRBAC as f, getTranslation as g, createYupSchema as h, DocumentActionButton as i, buildValidParams as j, useLazyGetDocumentQuery as k, contentManagerApi as l, useDoc as m, CLONE_PATH as n, useDocumentRBAC as o, useDocLayout as p, DocumentContextProvider as q, Header as r, setInitialData as s, transformDocument as t, useContentTypeSchema as u, Panels as v, useGetContentTypeConfigurationQuery as w, CREATOR_FIELDS as x, getMainField as y, getDisplayName as z };
5436
+ //# sourceMappingURL=index-DYrCidCq.mjs.map