@strapi/admin 4.12.0-beta.5 → 4.12.1

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 (162) hide show
  1. package/admin/src/components/LeftMenu/index.js +1 -1
  2. package/admin/src/components/PluginsInitializer/index.js +23 -0
  3. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +9 -14
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +1 -1
  5. package/admin/src/content-manager/components/InputUID/index.js +2 -3
  6. package/admin/src/content-manager/components/RelationInput/RelationInput.js +1 -1
  7. package/admin/src/content-manager/components/RelationInputDataManager/utils/getRelationLink.js +1 -3
  8. package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +4 -6
  9. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +7 -9
  10. package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +1 -3
  11. package/admin/src/content-manager/pages/EditSettingsView/index.js +31 -18
  12. package/admin/src/content-manager/pages/ListSettingsView/components/EditFieldForm.js +1 -3
  13. package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +1 -3
  14. package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +14 -32
  15. package/admin/src/content-manager/pages/ListSettingsView/index.js +50 -40
  16. package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/ConfirmBulkActionDialog/index.js +2 -0
  17. package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +83 -36
  18. package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js +2 -2
  19. package/admin/src/content-manager/pages/ListView/index.js +3 -3
  20. package/admin/src/content-manager/sharedReducers/crudReducer/reducer.js +1 -1
  21. package/admin/src/content-manager/utils/checkIfAttributeIsDisplayable.js +2 -4
  22. package/admin/src/content-manager/utils/index.js +0 -1
  23. package/admin/src/pages/AuthPage/constants.js +2 -2
  24. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js +1 -1
  25. package/admin/src/translations/ar.json +9 -3
  26. package/admin/src/translations/ca.json +8 -2
  27. package/admin/src/translations/de.json +8 -2
  28. package/admin/src/translations/dk.json +8 -2
  29. package/admin/src/translations/en.json +9 -2
  30. package/admin/src/translations/es.json +9 -3
  31. package/admin/src/translations/eu.json +8 -2
  32. package/admin/src/translations/fr.json +9 -2
  33. package/admin/src/translations/gu.json +8 -2
  34. package/admin/src/translations/hi.json +9 -3
  35. package/admin/src/translations/hu.json +9 -3
  36. package/admin/src/translations/ja.json +12 -6
  37. package/admin/src/translations/ko.json +12 -6
  38. package/admin/src/translations/ml.json +8 -2
  39. package/admin/src/translations/nl.json +8 -2
  40. package/admin/src/translations/pl.json +8 -2
  41. package/admin/src/translations/pt-BR.json +8 -2
  42. package/admin/src/translations/ru.json +8 -2
  43. package/admin/src/translations/sa.json +9 -3
  44. package/admin/src/translations/sk.json +8 -2
  45. package/admin/src/translations/sv.json +7 -2
  46. package/admin/src/translations/tr.json +8 -2
  47. package/admin/src/translations/zh-Hans.json +8 -2
  48. package/admin/src/translations/zh.json +8 -2
  49. package/admin/src/utils/index.js +0 -1
  50. package/build/{1049.758a01f5.chunk.js → 1049.c3d082e9.chunk.js} +1 -1
  51. package/build/1386.879bcd90.chunk.js +7 -0
  52. package/build/{2225.15d1df72.chunk.js → 2225.0e4f8c77.chunk.js} +1 -1
  53. package/build/2379.f1641312.chunk.js +1 -0
  54. package/build/2395.46f8d0c1.chunk.js +26 -0
  55. package/build/2801.5cef5ec8.chunk.js +1 -0
  56. package/build/{3483.e2ee2547.chunk.js → 3483.03c24f96.chunk.js} +1 -1
  57. package/build/3929.5632f24d.chunk.js +114 -0
  58. package/build/4546.cfafae68.chunk.js +1 -0
  59. package/build/6691.4985ef22.chunk.js +105 -0
  60. package/build/7464.3e64a1d5.chunk.js +1 -0
  61. package/build/8276.10a3f883.chunk.js +26 -0
  62. package/build/{9806.aa25371d.chunk.js → 9806.3392505e.chunk.js} +2 -2
  63. package/build/{Admin-authenticatedApp.6b8dfa45.chunk.js → Admin-authenticatedApp.8dfbc48d.chunk.js} +3 -3
  64. package/build/{Admin_profilePage.a968035f.chunk.js → Admin_profilePage.ca82c67b.chunk.js} +1 -1
  65. package/build/{Admin_settingsPage.8c600d1a.chunk.js → Admin_settingsPage.50c867bf.chunk.js} +1 -1
  66. package/build/admin-app.041dcd81.chunk.js +36 -0
  67. package/build/{admin-edit-users.67704088.chunk.js → admin-edit-users.79eeb125.chunk.js} +1 -1
  68. package/build/{admin-users.3279ffb0.chunk.js → admin-users.123aa08e.chunk.js} +1 -1
  69. package/build/ar-json.74e40bc7.chunk.js +1 -0
  70. package/build/{ca-json.a53c10b6.chunk.js → ca-json.fc6001d3.chunk.js} +1 -1
  71. package/build/content-manager.098eb004.chunk.js +1099 -0
  72. package/build/content-type-builder.64f4d6ac.chunk.js +170 -0
  73. package/build/{de-json.b3be02c7.chunk.js → de-json.e72545cf.chunk.js} +1 -1
  74. package/build/dk-json.e77140ef.chunk.js +1 -0
  75. package/build/{en-json.4c733bd1.chunk.js → en-json.01456e61.chunk.js} +1 -1
  76. package/build/es-json.b1f2284b.chunk.js +1 -0
  77. package/build/{eu-json.633025f0.chunk.js → eu-json.63d0a898.chunk.js} +1 -1
  78. package/build/{fr-json.aa8839d2.chunk.js → fr-json.33c6428b.chunk.js} +1 -1
  79. package/build/{gu-json.5bd62812.chunk.js → gu-json.7efe8cc2.chunk.js} +1 -1
  80. package/build/{hi-json.9104eb78.chunk.js → hi-json.0d633692.chunk.js} +1 -1
  81. package/build/{hu-json.9f4aae42.chunk.js → hu-json.c74b6a1e.chunk.js} +1 -1
  82. package/build/index.html +1 -1
  83. package/build/{ja-json.91286391.chunk.js → ja-json.e1959a1c.chunk.js} +1 -1
  84. package/build/{ko-json.fcf3ec4b.chunk.js → ko-json.ce5d6d94.chunk.js} +1 -1
  85. package/build/{main.af84ad9c.js → main.1f8cc299.js} +429 -429
  86. package/build/{ml-json.557aa14c.chunk.js → ml-json.940d7ace.chunk.js} +1 -1
  87. package/build/{nl-json.b2b16eea.chunk.js → nl-json.fe38f0fb.chunk.js} +1 -1
  88. package/build/{pl-json.f094a417.chunk.js → pl-json.d55e8e78.chunk.js} +1 -1
  89. package/build/{pt-BR-json.dec7fb01.chunk.js → pt-BR-json.ae0a0d2e.chunk.js} +1 -1
  90. package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +1 -0
  91. package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +1 -0
  92. package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +56 -0
  93. package/build/{ru-json.8193d8c4.chunk.js → ru-json.1c976644.chunk.js} +1 -1
  94. package/build/{runtime~main.a65ca6fb.js → runtime~main.80a43c16.js} +2 -2
  95. package/build/{sa-json.a56836f1.chunk.js → sa-json.2c03ef4e.chunk.js} +1 -1
  96. package/build/sk-json.b41847e8.chunk.js +1 -0
  97. package/build/sso-settings-page.81152e62.chunk.js +1 -0
  98. package/build/{sv-json.fd0e86c6.chunk.js → sv-json.568cb7ae.chunk.js} +1 -1
  99. package/build/{tr-json.56c32cf6.chunk.js → tr-json.c9f22432.chunk.js} +1 -1
  100. package/build/transfer-tokens-list-page.692eee77.chunk.js +16 -0
  101. package/build/upload-settings.7f93d4c0.chunk.js +14 -0
  102. package/build/upload.77d8a64c.chunk.js +58 -0
  103. package/build/users-advanced-settings-page.f0760eb8.chunk.js +9 -0
  104. package/build/users-email-settings-page.ff4b32f3.chunk.js +9 -0
  105. package/build/users-providers-settings-page.48de0306.chunk.js +14 -0
  106. package/build/users-roles-settings-page.3f9f063e.chunk.js +30 -0
  107. package/build/{webhook-edit-page.a91f27a1.chunk.js → webhook-edit-page.6cb479ff.chunk.js} +2 -2
  108. package/build/{zh-Hans-json.36d81cdc.chunk.js → zh-Hans-json.937b395b.chunk.js} +1 -1
  109. package/build/{zh-json.1cc86ff0.chunk.js → zh-json.bfc2e036.chunk.js} +1 -1
  110. package/ee/admin/hooks/useAuthProviders/index.js +1 -3
  111. package/ee/admin/pages/AuthResponse/index.js +1 -3
  112. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +35 -32
  113. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -7
  114. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +16 -14
  115. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +33 -33
  116. package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +1 -2
  117. package/ee/server/bootstrap.js +2 -0
  118. package/ee/server/config/admin-actions.js +6 -6
  119. package/ee/server/services/auth.js +1 -1
  120. package/ee/server/services/index.js +1 -0
  121. package/ee/server/services/review-workflows/entity-service-decorator.js +4 -3
  122. package/ee/server/services/review-workflows/metrics/index.js +51 -0
  123. package/ee/server/services/review-workflows/metrics/weekly-metrics.js +76 -0
  124. package/ee/server/services/review-workflows/workflows/index.js +5 -0
  125. package/package.json +16 -16
  126. package/server/middlewares/rateLimit.js +6 -2
  127. package/server/services/transfer/token.js +27 -4
  128. package/server/validation/authentication/register.js +2 -2
  129. package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/getRequestUrl.js +0 -5
  130. package/admin/src/content-manager/components/SingleTypeFormWrapper/utils/index.js +0 -2
  131. package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +0 -16
  132. package/admin/src/content-manager/pages/ListSettingsView/init.js +0 -9
  133. package/admin/src/content-manager/utils/getRequestUrl.js +0 -4
  134. package/admin/src/utils/getRequestUrl.js +0 -3
  135. package/build/1386.762d6eb8.chunk.js +0 -7
  136. package/build/2379.0ca87a89.chunk.js +0 -1
  137. package/build/2395.df7a044a.chunk.js +0 -26
  138. package/build/2801.b1140c9b.chunk.js +0 -1
  139. package/build/4546.ff9fdf30.chunk.js +0 -1
  140. package/build/6691.f880a0b6.chunk.js +0 -105
  141. package/build/7065.ec811562.chunk.js +0 -114
  142. package/build/7464.8a6c1e6c.chunk.js +0 -1
  143. package/build/8276.6c7b8e6e.chunk.js +0 -26
  144. package/build/admin-app.c2e4e128.chunk.js +0 -36
  145. package/build/ar-json.f530bc3f.chunk.js +0 -1
  146. package/build/content-manager.8772445b.chunk.js +0 -1103
  147. package/build/content-type-builder.40534de5.chunk.js +0 -170
  148. package/build/dk-json.842aa391.chunk.js +0 -1
  149. package/build/es-json.f57b5335.chunk.js +0 -1
  150. package/build/review-workflows-settings-create-view.05758184.chunk.js +0 -1
  151. package/build/review-workflows-settings-edit-view.c33f7c58.chunk.js +0 -1
  152. package/build/review-workflows-settings-list-view.3ee9190d.chunk.js +0 -56
  153. package/build/sk-json.bf2f057a.chunk.js +0 -1
  154. package/build/sso-settings-page.7c9b2fd9.chunk.js +0 -1
  155. package/build/transfer-tokens-list-page.22147d2c.chunk.js +0 -16
  156. package/build/upload-settings.cac210a0.chunk.js +0 -14
  157. package/build/upload.cbfeefa5.chunk.js +0 -58
  158. package/build/users-advanced-settings-page.18379a56.chunk.js +0 -9
  159. package/build/users-email-settings-page.a87978e5.chunk.js +0 -9
  160. package/build/users-providers-settings-page.8876c1ee.chunk.js +0 -14
  161. package/build/users-roles-settings-page.0431f48c.chunk.js +0 -30
  162. package/ee/server/services/review-workflows/metrics.js +0 -24
@@ -214,7 +214,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
214
214
  })}
215
215
  </Typography>
216
216
  </LinkUser>
217
- <LinkUser tabIndex={0} onClick={handleLogout} logout="logout" to="/auth/login">
217
+ <LinkUser tabIndex={0} onClick={handleLogout} to="/auth/login">
218
218
  <Typography textColor="danger600">
219
219
  {formatMessage({
220
220
  id: 'app.components.LeftMenu.logout',
@@ -18,6 +18,29 @@ const PluginsInitializer = () => {
18
18
  (plugin) => plugins[plugin].isReady === false
19
19
  );
20
20
 
21
+ /**
22
+ *
23
+ * I have spent some time trying to understand what is happening here, and wanted to
24
+ * leave that knowledge for my future me:
25
+ *
26
+ * `initializer` is an undocumented property of the `registerPlugin` API. At the time
27
+ * of writing it seems only to be used by the i18n plugin.
28
+ *
29
+ * How does it work?
30
+ *
31
+ * Every plugin that has an `initializer` component defined, receives the
32
+ * `setPlugin` function as a component prop. In the case of i18n the plugin fetches locales
33
+ * first and calls `setPlugin` with `pluginId` once they are loaded, which then triggers the
34
+ * reducer of the admin app defined above.
35
+ *
36
+ * Once all plugins are set to `isReady: true` the app renders.
37
+ *
38
+ * This API is used to block rendering of the admin app. We should remove that in v5 completely
39
+ * and make sure plugins can inject data into the global store before they are initialized, to avoid
40
+ * having a new prop-callback based communication channel between plugins and the core admin app.
41
+ *
42
+ */
43
+
21
44
  if (hasApluginNotReady) {
22
45
  const initializers = Object.keys(plugins).reduce((acc, current) => {
23
46
  const InitializerComponent = plugins[current].initializer;
@@ -28,12 +28,7 @@ import {
28
28
  submitSucceeded,
29
29
  } from '../../sharedReducers/crudReducer/actions';
30
30
  import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
31
- import {
32
- createDefaultForm,
33
- getRequestUrl,
34
- getTrad,
35
- removePasswordFieldsFromData,
36
- } from '../../utils';
31
+ import { createDefaultForm, getTrad, removePasswordFieldsFromData } from '../../utils';
37
32
 
38
33
  // This container is used to handle the CRUD
39
34
  const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }) => {
@@ -60,7 +55,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
60
55
  const isCreatingEntry = id === null;
61
56
 
62
57
  const requestURL =
63
- isCreatingEntry && !origin ? null : getRequestUrl(`collection-types/${slug}/${origin || id}`);
58
+ isCreatingEntry && !origin ? null : `/content-manager/collection-types/${slug}/${origin || id}`;
64
59
 
65
60
  const cleanReceivedData = useCallback((data) => {
66
61
  const cleaned = removePasswordFieldsFromData(
@@ -190,7 +185,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
190
185
  try {
191
186
  trackUsageRef.current('willDeleteEntry', trackerProperty);
192
187
 
193
- const { data } = await del(getRequestUrl(`collection-types/${slug}/${id}`));
188
+ const { data } = await del(`/content-manager/collection-types/${slug}/${id}`);
194
189
 
195
190
  toggleNotification({
196
191
  type: 'success',
@@ -220,8 +215,8 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
220
215
  * are correctly attached to the entry.
221
216
  */
222
217
  const endPoint = isCloning
223
- ? getRequestUrl(`collection-types/${slug}/clone/${origin}`)
224
- : getRequestUrl(`collection-types/${slug}`);
218
+ ? `/content-manager/collection-types/${slug}/clone/${origin}`
219
+ : `/content-manager/collection-types/${slug}`;
225
220
  try {
226
221
  // Show a loading button in the EditView/Header.js && lock the app => no navigation
227
222
  dispatch(setStatus('submit-pending'));
@@ -279,7 +274,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
279
274
  try {
280
275
  trackUsageRef.current('willCheckDraftRelations');
281
276
 
282
- const endPoint = getRequestUrl(`collection-types/${slug}/${id}/actions/countDraftRelations`);
277
+ const endPoint = `/content-manager/collection-types/${slug}/${id}/actions/countDraftRelations`;
283
278
  dispatch(setStatus('draft-relation-check-pending'));
284
279
 
285
280
  const numberOfDraftRelations = await fetchClient.get(endPoint);
@@ -299,7 +294,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
299
294
  const onPublish = useCallback(async () => {
300
295
  try {
301
296
  trackUsageRef.current('willPublishEntry');
302
- const endPoint = getRequestUrl(`collection-types/${slug}/${id}/actions/publish`);
297
+ const endPoint = `/content-manager/collection-types/${slug}/${id}/actions/publish`;
303
298
 
304
299
  dispatch(setStatus('publish-pending'));
305
300
 
@@ -326,7 +321,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
326
321
 
327
322
  const onPut = useCallback(
328
323
  async (body, trackerProperty) => {
329
- const endPoint = getRequestUrl(`collection-types/${slug}/${id}`);
324
+ const endPoint = `/content-manager/collection-types/${slug}/${id}`;
330
325
 
331
326
  try {
332
327
  trackUsageRef.current('willEditEntry', trackerProperty);
@@ -362,7 +357,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
362
357
  );
363
358
 
364
359
  const onUnpublish = useCallback(async () => {
365
- const endPoint = getRequestUrl(`collection-types/${slug}/${id}/actions/unpublish`);
360
+ const endPoint = `/content-manager/collection-types/${slug}/${id}/actions/unpublish`;
366
361
 
367
362
  dispatch(setStatus('unpublish-pending'));
368
363
 
@@ -91,7 +91,7 @@ const cleanData = ({ browserState, serverState }, currentSchema, componentsSchem
91
91
  /**
92
92
  * Because of how repeatable components work when you dig into them the server
93
93
  * will have no object to compare too therefore no relation array will be setup
94
- * because the component has not been initialised, therefore we can safely assume
94
+ * because the component has not been initialized, therefore we can safely assume
95
95
  * it needs to be added and provide a default empty array.
96
96
  */
97
97
  let actualOldValue = get(rootServerState, trueInitialDataPath, []);
@@ -12,7 +12,6 @@ import PropTypes from 'prop-types';
12
12
  import { useIntl } from 'react-intl';
13
13
 
14
14
  import useDebounce from '../../../hooks/useDebounce';
15
- import { getRequestUrl } from '../../utils';
16
15
 
17
16
  import { FieldActionWrapper, LoadingWrapper, TextValidation } from './endActionStyle';
18
17
  import UID_REGEX from './regex';
@@ -67,7 +66,7 @@ const InputUID = ({
67
66
  try {
68
67
  const {
69
68
  data: { data },
70
- } = await post(getRequestUrl('uid/generate'), {
69
+ } = await post('/content-manager/uid/generate', {
71
70
  contentTypeUID,
72
71
  field: name,
73
72
  data: modifiedData,
@@ -92,7 +91,7 @@ const InputUID = ({
92
91
  setIsLoading(true);
93
92
 
94
93
  try {
95
- const { data } = await post(getRequestUrl('uid/check-availability'), {
94
+ const { data } = await post('/content-manager/uid/check-availability', {
96
95
  contentTypeUID,
97
96
  field: name,
98
97
  value: value ? value.trim() : '',
@@ -373,7 +373,7 @@ RelationInput.propTypes = {
373
373
  };
374
374
 
375
375
  /**
376
- * This is in a seperate component to enforce passing all the props the component requires to react-window
376
+ * This is in a separate component to enforce passing all the props the component requires to react-window
377
377
  * to ensure drag & drop correctly works.
378
378
  */
379
379
  const ListItem = ({ data, index, style }) => {
@@ -1,5 +1,3 @@
1
- import { getRequestUrl } from '../../../utils';
2
-
3
1
  export function getRelationLink(targetModel, id) {
4
- return `${getRequestUrl(`collectionType/${targetModel}/${id ?? ''}`)}`;
2
+ return `/content-manager/collectionType/${targetModel}/${id ?? ''}`;
5
3
  }
@@ -4,8 +4,6 @@ import { useCMEditViewDataManager } from '@strapi/helper-plugin';
4
4
  import get from 'lodash/get';
5
5
  import { useRouteMatch } from 'react-router-dom';
6
6
 
7
- import { getRequestUrl } from '../../../utils';
8
-
9
7
  function useSelect({
10
8
  componentUid,
11
9
  isUserAllowedToEditField,
@@ -78,20 +76,20 @@ function useSelect({
78
76
  // if no componentId exists in modifiedData it means that the user just created it
79
77
  // there then are no relations to request
80
78
  return componentId
81
- ? getRequestUrl(`relations/${componentUid}/${componentId}/${fieldNameKeys.at(-1)}`)
79
+ ? `/content-manager/relations/${componentUid}/${componentId}/${fieldNameKeys.at(-1)}`
82
80
  : null;
83
81
  }
84
82
 
85
- return getRequestUrl(`relations/${slug}/${entityId}/${name.split('.').at(-1)}`);
83
+ return `/content-manager/relations/${slug}/${entityId}/${name.split('.').at(-1)}`;
86
84
  }, [isCreatingEntry, origin, componentUid, slug, entityId, name, componentId, fieldNameKeys]);
87
85
 
88
86
  // /content-manager/relations/[model]/[field-name]
89
87
  const relationSearchEndpoint = useMemo(() => {
90
88
  if (componentUid) {
91
- return getRequestUrl(`relations/${componentUid}/${name.split('.').at(-1)}`);
89
+ return `/content-manager/relations/${componentUid}/${name.split('.').at(-1)}`;
92
90
  }
93
91
 
94
- return getRequestUrl(`relations/${slug}/${name.split('.').at(-1)}`);
92
+ return `/content-manager/relations/${slug}/${name.split('.').at(-1)}`;
95
93
  }, [componentUid, slug, name]);
96
94
 
97
95
  return {
@@ -29,8 +29,6 @@ import {
29
29
  import selectCrudReducer from '../../sharedReducers/crudReducer/selectors';
30
30
  import { createDefaultForm, getTrad, removePasswordFieldsFromData } from '../../utils';
31
31
 
32
- import { getRequestUrl } from './utils';
33
-
34
32
  // This container is used to handle the CRUD
35
33
  const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
36
34
  const queryClient = useQueryClient();
@@ -110,7 +108,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
110
108
  setIsCreatingEntry(true);
111
109
 
112
110
  try {
113
- const { data } = await fetchClient.get(getRequestUrl(slug), {
111
+ const { data } = await fetchClient.get(`/content-manager/single-types/${slug}`, {
114
112
  cancelToken: source.token,
115
113
  params,
116
114
  });
@@ -158,7 +156,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
158
156
  try {
159
157
  trackUsageRef.current('willDeleteEntry', trackerProperty);
160
158
 
161
- const { data } = await del(getRequestUrl(slug), {
159
+ const { data } = await del(`/content-manager/single-types/${slug}`, {
162
160
  params,
163
161
  });
164
162
 
@@ -186,7 +184,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
186
184
 
187
185
  const onPost = useCallback(
188
186
  async (body, trackerProperty) => {
189
- const endPoint = getRequestUrl(slug);
187
+ const endPoint = `/content-manager/single-types/${slug}`;
190
188
 
191
189
  try {
192
190
  dispatch(setStatus('submit-pending'));
@@ -237,7 +235,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
237
235
  try {
238
236
  trackUsageRef.current('willCheckDraftRelations');
239
237
 
240
- const endPoint = getRequestUrl(`${slug}/actions/countDraftRelations`);
238
+ const endPoint = `/content-manager/single-types/${slug}/actions/countDraftRelations`;
241
239
  dispatch(setStatus('draft-relation-check-pending'));
242
240
 
243
241
  const numberOfDraftRelations = await fetchClient.get(endPoint);
@@ -257,7 +255,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
257
255
  const onPublish = useCallback(async () => {
258
256
  try {
259
257
  trackUsageRef.current('willPublishEntry');
260
- const endPoint = getRequestUrl(`${slug}/actions/publish`);
258
+ const endPoint = `/content-manager/single-types/${slug}/actions/publish`;
261
259
 
262
260
  dispatch(setStatus('publish-pending'));
263
261
 
@@ -291,7 +289,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
291
289
 
292
290
  const onPut = useCallback(
293
291
  async (body, trackerProperty) => {
294
- const endPoint = getRequestUrl(slug);
292
+ const endPoint = `/content-manager/single-types/${slug}`;
295
293
 
296
294
  try {
297
295
  trackUsageRef.current('willEditEntry', trackerProperty);
@@ -330,7 +328,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
330
328
 
331
329
  // The publish and unpublish method could be refactored but let's leave the duplication for now
332
330
  const onUnpublish = useCallback(async () => {
333
- const endPoint = getRequestUrl(`${slug}/actions/unpublish`);
331
+ const endPoint = `/content-manager/single-types/${slug}/actions/unpublish`;
334
332
 
335
333
  dispatch(setStatus('unpublish-pending'));
336
334
 
@@ -1,7 +1,5 @@
1
1
  import { getFetchClient } from '@strapi/helper-plugin';
2
2
 
3
- import { getRequestUrl } from '../../../utils';
4
-
5
3
  import checkPermissions from './checkPermissions';
6
4
  import generateModelsLinks from './generateModelsLinks';
7
5
 
@@ -10,7 +8,7 @@ const getContentTypeLinks = async ({ models, userPermissions, toggleNotification
10
8
  try {
11
9
  const {
12
10
  data: { data: contentTypeConfigurations },
13
- } = await get(getRequestUrl('content-types-settings'));
11
+ } = await get('/content-manager/content-types-settings');
14
12
 
15
13
  const { collectionTypeSectionLinks, singleTypeSectionLinks } = generateModelsLinks(
16
14
  models,
@@ -14,14 +14,16 @@ import {
14
14
  Select,
15
15
  Typography,
16
16
  } from '@strapi/design-system';
17
- import { ConfirmDialog, Link, useNotification, useTracking } from '@strapi/helper-plugin';
17
+ import {
18
+ ConfirmDialog,
19
+ Link,
20
+ useFetchClient,
21
+ useNotification,
22
+ useTracking,
23
+ } from '@strapi/helper-plugin';
18
24
  import { ArrowLeft, Check } from '@strapi/icons';
19
25
  import cloneDeep from 'lodash/cloneDeep';
20
- import flatMap from 'lodash/flatMap';
21
- import get from 'lodash/get';
22
26
  import isEqual from 'lodash/isEqual';
23
- import pick from 'lodash/pick';
24
- import set from 'lodash/set';
25
27
  import upperFirst from 'lodash/upperFirst';
26
28
  import PropTypes from 'prop-types';
27
29
  import { useIntl } from 'react-intl';
@@ -37,7 +39,6 @@ import ModalForm from './components/FormModal';
37
39
  import { LayoutDndProvider } from './components/LayoutDndProvider';
38
40
  import init from './init';
39
41
  import reducer, { initialState } from './reducer';
40
- import putCMSettingsEV from './utils/api';
41
42
  import { unformatLayout } from './utils/layout';
42
43
 
43
44
  const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, updateLayout }) => {
@@ -52,12 +53,13 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
52
53
  const [isConfirmDialogOpen, setIsConfirmDialogOpen] = useState(false);
53
54
  const { componentLayouts, initialData, modifiedData, metaToEdit, metaForm } = reducerState;
54
55
  const { formatMessage } = useIntl();
55
- const modelName = get(mainLayout, ['info', 'displayName'], '');
56
- const attributes = get(modifiedData, ['attributes'], {});
56
+ const modelName = mainLayout.info.displayName;
57
+ const attributes = modifiedData?.attributes ?? {};
57
58
  const fieldSizes = useSelector(selectFieldSizes);
59
+ const { put } = useFetchClient();
58
60
 
59
61
  const entryTitleOptions = Object.keys(attributes).filter((attr) => {
60
- const type = get(attributes, [attr, 'type'], '');
62
+ const type = attributes?.[attr]?.type ?? '';
61
63
 
62
64
  return (
63
65
  ![
@@ -74,10 +76,10 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
74
76
  ].includes(type) && !!type
75
77
  );
76
78
  });
77
- const editLayout = get(modifiedData, ['layouts', 'edit'], []);
78
- const displayedFields = flatMap(editLayout, 'rowContent');
79
+ const editLayout = modifiedData.layouts.edit;
80
+ const displayedFields = editLayout.flatMap((layout) => layout.rowContent);
79
81
  const editLayoutFields = Object.keys(modifiedData.attributes)
80
- .filter((attr) => get(modifiedData, ['metadatas', attr, 'edit', 'visible'], false) === true)
82
+ .filter((attr) => (modifiedData?.metadatas?.[attr]?.edit?.visible ?? false) === true)
81
83
  .filter((attr) => displayedFields.findIndex((el) => el.name === attr) === -1)
82
84
  .sort();
83
85
 
@@ -128,7 +130,12 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
128
130
 
129
131
  const submitMutation = useMutation(
130
132
  (body) => {
131
- return putCMSettingsEV(body, slug, isContentTypeView);
133
+ return put(
134
+ isContentTypeView
135
+ ? `/content-manager/content-types/${slug}/configuration`
136
+ : `components/${slug}/configuration`,
137
+ body
138
+ );
132
139
  },
133
140
  {
134
141
  onSuccess({ data }) {
@@ -149,9 +156,15 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
149
156
  const { isLoading: isSubmittingForm } = submitMutation;
150
157
 
151
158
  const handleConfirm = () => {
152
- const body = pick(cloneDeep(modifiedData), ['layouts', 'metadatas', 'settings']);
153
- set(body, 'layouts.edit', unformatLayout(body.layouts.edit));
154
- submitMutation.mutate(body);
159
+ const { layouts, metadatas, settings } = cloneDeep(modifiedData);
160
+ submitMutation.mutate({
161
+ layouts: {
162
+ ...layouts,
163
+ edit: unformatLayout(layouts.edit),
164
+ },
165
+ metadatas,
166
+ settings,
167
+ });
155
168
  };
156
169
 
157
170
  const handleMoveRelation = (fromIndex, toIndex) => {
@@ -357,8 +370,8 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
357
370
  onToggle={handleToggleModal}
358
371
  onMetaChange={handleMetaChange}
359
372
  onSizeChange={handleSizeChange}
360
- type={get(attributes, [metaToEdit, 'type'], '')}
361
- customFieldUid={get(attributes, [metaToEdit, 'customField'], '')}
373
+ type={attributes?.[metaToEdit]?.type ?? ''}
374
+ customFieldUid={attributes?.[metaToEdit]?.customField ?? ''}
362
375
  />
363
376
  )}
364
377
  </Main>
@@ -29,7 +29,7 @@ const HeaderContainer = styled(Flex)`
29
29
  }
30
30
  `;
31
31
 
32
- const EditFieldForm = ({
32
+ export const EditFieldForm = ({
33
33
  attributes,
34
34
  fieldForm,
35
35
  fieldToEdit,
@@ -142,5 +142,3 @@ EditFieldForm.propTypes = {
142
142
  onSubmit: PropTypes.func.isRequired,
143
143
  type: PropTypes.string.isRequired,
144
144
  };
145
-
146
- export default EditFieldForm;
@@ -15,7 +15,7 @@ import { useIntl } from 'react-intl';
15
15
 
16
16
  import { getTrad } from '../../../utils';
17
17
 
18
- const Settings = ({ modifiedData, onChange, sortOptions }) => {
18
+ export const Settings = ({ modifiedData, onChange, sortOptions }) => {
19
19
  const { formatMessage } = useIntl();
20
20
  const { settings, metadatas } = modifiedData;
21
21
 
@@ -168,5 +168,3 @@ Settings.propTypes = {
168
168
  onChange: PropTypes.func.isRequired,
169
169
  sortOptions: PropTypes.array,
170
170
  };
171
-
172
- export default Settings;
@@ -5,19 +5,12 @@ import { Menu } from '@strapi/design-system/v2';
5
5
  import { Plus } from '@strapi/icons';
6
6
  import { PropTypes } from 'prop-types';
7
7
  import { useIntl } from 'react-intl';
8
- import styled from 'styled-components';
9
8
 
10
9
  import { getTrad } from '../../../utils';
11
10
 
12
11
  import DraggableCard from './DraggableCard';
13
12
 
14
- const ScrollableContainer = styled(Box)`
15
- flex: ${({ size }) => size};
16
- overflow-x: scroll;
17
- overflow-y: hidden;
18
- `;
19
-
20
- const SortDisplayedFields = ({
13
+ export const SortDisplayedFields = ({
21
14
  displayedFields,
22
15
  listRemainingFields,
23
16
  metadatas,
@@ -48,25 +41,16 @@ const SortDisplayedFields = ({
48
41
  }, [displayedFields, lastAction]);
49
42
 
50
43
  return (
51
- <>
52
- <Box paddingBottom={4}>
53
- <Typography variant="delta" as="h2">
54
- {formatMessage({
55
- id: getTrad('containers.SettingPage.view'),
56
- defaultMessage: 'View',
57
- })}
58
- </Typography>
59
- </Box>
60
- <Flex
61
- paddingTop={4}
62
- paddingLeft={4}
63
- paddingRight={4}
64
- borderColor="neutral300"
65
- borderStyle="dashed"
66
- borderWidth="1px"
67
- hasRadius
68
- >
69
- <ScrollableContainer size="1" paddingBottom={4} ref={scrollableContainerRef}>
44
+ <Flex alignItems="stretch" direction="column" gap={4}>
45
+ <Typography variant="delta" as="h2">
46
+ {formatMessage({
47
+ id: getTrad('containers.SettingPage.view'),
48
+ defaultMessage: 'View',
49
+ })}
50
+ </Typography>
51
+
52
+ <Flex padding={4} borderColor="neutral300" borderStyle="dashed" borderWidth="1px" hasRadius>
53
+ <Box flex="1" overflow="scroll hidden" ref={scrollableContainerRef}>
70
54
  <Flex gap={3}>
71
55
  {displayedFields.map((field, index) => (
72
56
  <DraggableCard
@@ -82,7 +66,8 @@ const SortDisplayedFields = ({
82
66
  />
83
67
  ))}
84
68
  </Flex>
85
- </ScrollableContainer>
69
+ </Box>
70
+
86
71
  <Menu.Root>
87
72
  <Menu.Trigger
88
73
  paddingLeft={2}
@@ -90,7 +75,6 @@ const SortDisplayedFields = ({
90
75
  justifyContent="center"
91
76
  endIcon={null}
92
77
  disabled={listRemainingFields.length <= 0}
93
- marginBottom={4}
94
78
  variant="tertiary"
95
79
  >
96
80
  <VisuallyHidden as="span">
@@ -110,7 +94,7 @@ const SortDisplayedFields = ({
110
94
  </Menu.Content>
111
95
  </Menu.Root>
112
96
  </Flex>
113
- </>
97
+ </Flex>
114
98
  );
115
99
  };
116
100
 
@@ -129,5 +113,3 @@ SortDisplayedFields.propTypes = {
129
113
  onMoveField: PropTypes.func.isRequired,
130
114
  onRemoveField: PropTypes.func.isRequired,
131
115
  };
132
-
133
- export default SortDisplayedFields;