@strapi/admin 4.6.0-beta.2 → 4.6.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 (228) hide show
  1. package/.browserslistrc +2 -1
  2. package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
  3. package/admin/src/components/ConfigurationsProvider/index.js +21 -18
  4. package/admin/src/components/ConfigurationsProvider/reducer.js +1 -0
  5. package/admin/src/components/LeftMenu/index.js +62 -53
  6. package/admin/src/components/UnauthenticatedLogo/index.js +1 -1
  7. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +20 -16
  8. package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -5
  9. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +1 -3
  10. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +6 -5
  11. package/admin/src/content-manager/components/Hint/index.js +4 -17
  12. package/admin/src/content-manager/components/InputUID/index.js +7 -18
  13. package/admin/src/content-manager/components/Inputs/index.js +0 -2
  14. package/admin/src/content-manager/components/PreviewWysiwyg/Wrapper.js +22 -27
  15. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
  16. package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +19 -28
  17. package/admin/src/content-manager/components/Wysiwyg/index.js +4 -8
  18. package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +4 -3
  19. package/admin/src/content-manager/hooks/useLazyComponents/index.js +9 -13
  20. package/admin/src/content-manager/hooks/useRelation/useRelation.js +4 -4
  21. package/admin/src/content-manager/pages/App/LeftMenu/index.js +3 -8
  22. package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +1 -0
  23. package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +24 -0
  24. package/admin/src/content-manager/pages/App/useModels.js +8 -3
  25. package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +3 -2
  26. package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +4 -4
  27. package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +4 -2
  28. package/admin/src/content-manager/pages/EditView/{Informations → Information}/index.js +55 -39
  29. package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js +0 -0
  30. package/admin/src/content-manager/pages/EditView/index.js +3 -3
  31. package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +4 -2
  32. package/admin/src/content-manager/pages/ListView/index.js +9 -9
  33. package/admin/src/core/store/configureStore.js +22 -4
  34. package/admin/src/core/utils/index.js +0 -1
  35. package/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +3 -2
  36. package/admin/src/hooks/useInjectReducer/index.js +1 -0
  37. package/admin/src/hooks/useInjectReducer/useInjectReducer.js +19 -0
  38. package/admin/src/hooks/useRegenerate/index.js +3 -3
  39. package/admin/src/hooks/useRolesList/index.js +5 -3
  40. package/admin/src/hooks/useSettingsMenu/init.js +2 -25
  41. package/admin/src/hooks/useSettingsMenu/utils/adminLinks.js +4 -0
  42. package/admin/src/hooks/useSettingsMenu/utils/customAdminLinks.js +1 -0
  43. package/admin/src/hooks/useSettingsMenu/utils/defaultAdminLinks.js +21 -0
  44. package/admin/src/index.js +5 -4
  45. package/admin/src/pages/App/index.js +6 -2
  46. package/admin/src/pages/ProfilePage/utils/api.js +5 -3
  47. package/admin/src/pages/SettingsPage/{pages/Users/ListPage → components}/Filters/index.js +0 -0
  48. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +6 -5
  49. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -3
  50. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/CustomizationInfos/index.js +142 -0
  51. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/init.js +3 -0
  52. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/reducer.js +20 -0
  53. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +21 -17
  54. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +68 -42
  55. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +9 -3
  56. package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +6 -3
  57. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +9 -3
  58. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
  59. package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +6 -3
  60. package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +3 -2
  61. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +1 -1
  62. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
  63. package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -11
  64. package/admin/src/permissions/defaultPermissions.js +4 -0
  65. package/admin/src/translations/en.json +29 -21
  66. package/admin/src/translations/eu.json +796 -0
  67. package/admin/src/translations/languageNativeNames.js +1 -0
  68. package/admin/src/translations/ru.json +9 -9
  69. package/build/1412.936ed920.chunk.js +159 -0
  70. package/build/1683.c8aa7b7c.chunk.js +268 -0
  71. package/build/2607.2e48dbf8.chunk.js +66 -0
  72. package/build/2743.6d1632f9.chunk.js +45 -0
  73. package/build/3075.dc3894fe.chunk.js +108 -0
  74. package/build/3632.0317b618.chunk.js +138 -0
  75. package/build/4318.f96a9d4d.chunk.js +30 -0
  76. package/build/{3557.e7115160.chunk.js → 4855.bd092921.chunk.js} +131 -91
  77. package/build/{5015.f5e15fdb.chunk.js → 5015.8e3fe50b.chunk.js} +1 -1
  78. package/build/8633.00ccd382.chunk.js +1 -0
  79. package/build/9707.7290fd92.chunk.js +96 -0
  80. package/build/Admin-authenticatedApp.ce646f66.chunk.js +75 -0
  81. package/build/Admin_homePage.b1730882.chunk.js +77 -0
  82. package/build/Admin_marketplace.ea0316c2.chunk.js +26 -0
  83. package/build/Admin_pluginsPage.5c24f963.chunk.js +6 -0
  84. package/build/Admin_profilePage.59af1978.chunk.js +15 -0
  85. package/build/Admin_settingsPage.d1493824.chunk.js +178 -0
  86. package/build/{Upload_ConfigureTheView.9bdf41b5.chunk.js → Upload_ConfigureTheView.3f2b6e6a.chunk.js} +1 -1
  87. package/build/admin-app.25934eaa.chunk.js +112 -0
  88. package/build/admin-edit-roles-page.446b69dc.chunk.js +1 -0
  89. package/build/admin-edit-users.2ed69bfd.chunk.js +10 -0
  90. package/build/admin-users.fc003b10.chunk.js +11 -0
  91. package/build/{api-tokens-create-page.0e686c30.chunk.js → api-tokens-create-page.d248362d.chunk.js} +1 -1
  92. package/build/{api-tokens-edit-page.d6c7487b.chunk.js → api-tokens-edit-page.8516fa20.chunk.js} +1 -1
  93. package/build/api-tokens-list-page.44a79fda.chunk.js +16 -0
  94. package/build/audit-logs-settings-page.c3dce30d.chunk.js +1 -0
  95. package/build/content-manager.35ff9726.chunk.js +1139 -0
  96. package/build/content-type-builder-list-view.79e84b36.chunk.js +193 -0
  97. package/build/{content-type-builder-translation-de-json.29df67b8.chunk.js → content-type-builder-translation-de-json.0979cccb.chunk.js} +1 -1
  98. package/build/{content-type-builder-translation-dk-json.e22d2527.chunk.js → content-type-builder-translation-dk-json.e05583e9.chunk.js} +1 -1
  99. package/build/content-type-builder-translation-en-json.e577d595.chunk.js +1 -0
  100. package/build/{content-type-builder-translation-es-json.1044b252.chunk.js → content-type-builder-translation-es-json.fe4daad8.chunk.js} +1 -1
  101. package/build/{content-type-builder-translation-fr-json.2183e6b3.chunk.js → content-type-builder-translation-fr-json.b1eb52f6.chunk.js} +1 -1
  102. package/build/{content-type-builder-translation-id-json.ba3e8891.chunk.js → content-type-builder-translation-id-json.ee3b36bb.chunk.js} +1 -1
  103. package/build/{content-type-builder-translation-it-json.d4661201.chunk.js → content-type-builder-translation-it-json.13b3c26a.chunk.js} +1 -1
  104. package/build/{content-type-builder-translation-ko-json.57ff7f51.chunk.js → content-type-builder-translation-ko-json.8a274be5.chunk.js} +1 -1
  105. package/build/{content-type-builder-translation-pl-json.a057b51e.chunk.js → content-type-builder-translation-pl-json.24a34349.chunk.js} +1 -1
  106. package/build/{content-type-builder-translation-pt-BR-json.446df9da.chunk.js → content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js} +1 -1
  107. package/build/{content-type-builder-translation-ru-json.8c51843e.chunk.js → content-type-builder-translation-ru-json.54d11230.chunk.js} +1 -1
  108. package/build/{content-type-builder-translation-sv-json.af6ecca1.chunk.js → content-type-builder-translation-sv-json.59f5e1e5.chunk.js} +1 -1
  109. package/build/{content-type-builder-translation-tr-json.da83a07e.chunk.js → content-type-builder-translation-tr-json.cea4d226.chunk.js} +1 -1
  110. package/build/{content-type-builder-translation-zh-json.42f94cb3.chunk.js → content-type-builder-translation-zh-json.faedd610.chunk.js} +1 -1
  111. package/build/content-type-builder.855db321.chunk.js +126 -0
  112. package/build/email-settings-page.d1fcc7a3.chunk.js +10 -0
  113. package/build/en-json.1f137a90.chunk.js +1 -0
  114. package/build/eu-json.fceecd8b.chunk.js +1 -0
  115. package/build/i18n-settings-page.b8d8753e.chunk.js +60 -0
  116. package/build/{i18n-translation-de-json.dc876c08.chunk.js → i18n-translation-de-json.362384a6.chunk.js} +1 -1
  117. package/build/{i18n-translation-dk-json.49aaf933.chunk.js → i18n-translation-dk-json.89401417.chunk.js} +1 -1
  118. package/build/{i18n-translation-en-json.ac9ebc1b.chunk.js → i18n-translation-en-json.60af6722.chunk.js} +1 -1
  119. package/build/{i18n-translation-es-json.57072ed3.chunk.js → i18n-translation-es-json.87b494d1.chunk.js} +1 -1
  120. package/build/{i18n-translation-fr-json.84733f34.chunk.js → i18n-translation-fr-json.57ddc77e.chunk.js} +1 -1
  121. package/build/{i18n-translation-ko-json.fc73fe20.chunk.js → i18n-translation-ko-json.ef4f9471.chunk.js} +1 -1
  122. package/build/{i18n-translation-pl-json.16e5df90.chunk.js → i18n-translation-pl-json.dfac513d.chunk.js} +1 -1
  123. package/build/{i18n-translation-tr-json.cb39c048.chunk.js → i18n-translation-tr-json.10f0600d.chunk.js} +1 -1
  124. package/build/{i18n-translation-zh-Hans-json.2cf82d2d.chunk.js → i18n-translation-zh-Hans-json.757ce62d.chunk.js} +1 -1
  125. package/build/{i18n-translation-zh-json.ed1d272e.chunk.js → i18n-translation-zh-json.bef2dc07.chunk.js} +1 -1
  126. package/build/index.html +1 -1
  127. package/build/main.7b151630.js +4377 -0
  128. package/build/ru-json.aa5cd123.chunk.js +1 -0
  129. package/build/runtime~main.a20d633b.js +2 -0
  130. package/build/sso-settings-page.b85ad080.chunk.js +41 -0
  131. package/build/upload-settings.ef64bbf9.chunk.js +84 -0
  132. package/build/upload.c5730dfa.chunk.js +33 -0
  133. package/build/users-advanced-settings-page.fce9908e.chunk.js +8 -0
  134. package/build/users-email-settings-page.343d0ad2.chunk.js +23 -0
  135. package/build/users-providers-settings-page.e5a9a3f1.chunk.js +99 -0
  136. package/build/users-roles-settings-page.66312f31.chunk.js +30 -0
  137. package/build/webhook-edit-page.73e51e64.chunk.js +75 -0
  138. package/build/webhook-list-page.1134f130.chunk.js +42 -0
  139. package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +17 -0
  140. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
  141. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
  142. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionItem.js +0 -0
  143. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/index.js +5 -1
  144. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/PaginationFooter/index.js +0 -0
  145. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +1 -1
  146. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +47 -0
  147. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +0 -0
  148. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/index.js +35 -36
  149. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +10 -9
  150. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
  151. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +0 -0
  152. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +1 -1
  153. package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
  154. package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/index.js +3 -3
  155. package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/utils/schema.js +0 -0
  156. package/ee/admin/pages/SettingsPage/utils/customRoutes.js +28 -16
  157. package/ee/server/bootstrap.js +2 -0
  158. package/ee/server/migrations/audit-logs-table.js +45 -0
  159. package/ee/server/register.js +2 -0
  160. package/ee/server/routes/index.js +94 -10
  161. package/ee/server/services/audit-logs.js +30 -2
  162. package/ee/server/services/passport/sso.js +13 -1
  163. package/ee/server/services/passport.js +1 -4
  164. package/package.json +27 -32
  165. package/server/controllers/admin.js +19 -2
  166. package/server/register.js +7 -7
  167. package/server/services/project-settings.js +10 -6
  168. package/server/services/user.js +3 -1
  169. package/server/validation/project-settings.js +19 -10
  170. package/strapi-server.js +1 -1
  171. package/admin/src/content-manager/components/InputJSON/FieldWrapper.js +0 -40
  172. package/admin/src/content-manager/components/InputJSON/Label.js +0 -35
  173. package/admin/src/content-manager/components/InputJSON/components.js +0 -36
  174. package/admin/src/content-manager/components/InputJSON/index.js +0 -223
  175. package/admin/src/content-manager/components/InputJSON/jsonlint.js +0 -680
  176. package/admin/src/core/store/createReducer.js +0 -5
  177. package/admin/src/core/utils/axiosInstance.js +0 -38
  178. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
  179. package/build/2235.746d3cf7.chunk.js +0 -106
  180. package/build/2598.01c96bd5.chunk.js +0 -159
  181. package/build/2743.692b1f21.chunk.js +0 -42
  182. package/build/4318.87affaf2.chunk.js +0 -30
  183. package/build/4958.1979bbf5.chunk.js +0 -276
  184. package/build/5052.c2eacff2.chunk.js +0 -65
  185. package/build/7295.4e2dfbbb.chunk.js +0 -114
  186. package/build/805.da20168c.chunk.js +0 -138
  187. package/build/8633.6f546066.chunk.js +0 -1
  188. package/build/874.be41e4b3.chunk.js +0 -104
  189. package/build/9707.a07db355.chunk.js +0 -101
  190. package/build/Admin-authenticatedApp.9933974c.chunk.js +0 -75
  191. package/build/Admin_homePage.045bb0c8.chunk.js +0 -77
  192. package/build/Admin_marketplace.bf3ac090.chunk.js +0 -26
  193. package/build/Admin_pluginsPage.d2a9a619.chunk.js +0 -6
  194. package/build/Admin_profilePage.5e830ceb.chunk.js +0 -15
  195. package/build/Admin_settingsPage.53fa00a4.chunk.js +0 -178
  196. package/build/admin-app.8ed108ca.chunk.js +0 -112
  197. package/build/admin-audit-logs.68f833bf.chunk.js +0 -1
  198. package/build/admin-edit-roles-page.32bfe5ea.chunk.js +0 -1
  199. package/build/admin-edit-users.795f155c.chunk.js +0 -10
  200. package/build/admin-users.cbd9bcf7.chunk.js +0 -11
  201. package/build/api-tokens-list-page.a55e427c.chunk.js +0 -16
  202. package/build/codemirror-addon-closebrackets.71aa4bbd.chunk.js +0 -2
  203. package/build/codemirror-addon-lint-js.405f70fb.chunk.js +0 -1
  204. package/build/codemirror-addon-lint.8487ad3d.chunk.js +0 -1
  205. package/build/codemirror-addon-mark-selection.1928c849.chunk.js +0 -1
  206. package/build/codemirror-css.359a2a4b.chunk.js +0 -345
  207. package/build/codemirror-javacript.af237b68.chunk.js +0 -1
  208. package/build/codemirror-theme.2fe63a16.chunk.js +0 -33
  209. package/build/content-manager.ad929a94.chunk.js +0 -1174
  210. package/build/content-type-builder-list-view.3048854d.chunk.js +0 -198
  211. package/build/content-type-builder-translation-en-json.08e28f4e.chunk.js +0 -1
  212. package/build/content-type-builder.4edd1c22.chunk.js +0 -127
  213. package/build/email-settings-page.7c9e6c5e.chunk.js +0 -15
  214. package/build/en-json.d65a13ef.chunk.js +0 -1
  215. package/build/i18n-settings-page.fbccdf12.chunk.js +0 -1
  216. package/build/main.6bbf9950.js +0 -4417
  217. package/build/ru-json.3b411a39.chunk.js +0 -1
  218. package/build/runtime~main.c2bf62af.js +0 -2
  219. package/build/sso-settings-page.4031de9e.chunk.js +0 -41
  220. package/build/upload-settings.657790fd.chunk.js +0 -89
  221. package/build/upload.608a9856.chunk.js +0 -38
  222. package/build/users-advanced-settings-page.e3ab865f.chunk.js +0 -13
  223. package/build/users-email-settings-page.57adf9b7.chunk.js +0 -28
  224. package/build/users-providers-settings-page.7d1fb45c.chunk.js +0 -1
  225. package/build/users-roles-settings-page.ad28ab42.chunk.js +0 -30
  226. package/build/webhook-edit-page.1dd6d040.chunk.js +0 -75
  227. package/build/webhook-list-page.98afa3ea.chunk.js +0 -42
  228. package/ee/server/routes/features-routes.js +0 -66
package/.browserslistrc CHANGED
@@ -1,3 +1,4 @@
1
1
  last 3 major versions
2
2
  Firefox ESR
3
- last 2 Opera versions
3
+ last 2 Opera versions
4
+ not dead
@@ -1,10 +1,11 @@
1
1
  import axios from 'axios';
2
+ import { getFetchClient } from '@strapi/helper-plugin';
2
3
  import checkLatestStrapiVersion from './checkLatestStrapiVersion';
3
- import { axiosInstance } from '../../../core/utils';
4
4
  import packageJSON from '../../../../../package.json';
5
5
 
6
6
  const strapiVersion = packageJSON.version;
7
7
  const showUpdateNotif = !JSON.parse(localStorage.getItem('STRAPI_UPDATE_NOTIF'));
8
+ const { get } = getFetchClient();
8
9
 
9
10
  const fetchStrapiLatestRelease = async (toggleNotification) => {
10
11
  try {
@@ -38,7 +39,7 @@ const fetchStrapiLatestRelease = async (toggleNotification) => {
38
39
 
39
40
  const fetchAppInfo = async () => {
40
41
  try {
41
- const { data, headers } = await axiosInstance.get('/admin/information');
42
+ const { data, headers } = await get('/admin/information');
42
43
 
43
44
  if (!headers['content-type'].includes('application/json')) {
44
45
  throw new Error('Not found');
@@ -52,7 +53,7 @@ const fetchAppInfo = async () => {
52
53
 
53
54
  const fetchCurrentUserPermissions = async () => {
54
55
  try {
55
- const { data, headers } = await axiosInstance.get('/admin/users/me/permissions');
56
+ const { data, headers } = await get('/admin/users/me/permissions');
56
57
 
57
58
  if (!headers['content-type'].includes('application/json')) {
58
59
  throw new Error('Not found');
@@ -70,7 +71,7 @@ const fetchUserRoles = async () => {
70
71
  data: {
71
72
  data: { roles },
72
73
  },
73
- } = await axiosInstance.get('/admin/users/me');
74
+ } = await get('/admin/users/me');
74
75
 
75
76
  return roles;
76
77
  } catch (err) {
@@ -1,45 +1,48 @@
1
- import React, { useMemo, useReducer, useRef } from 'react';
1
+ import React, { useCallback, useMemo, useReducer } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { ConfigurationsContext } from '../../contexts';
4
4
  import reducer, { initialState } from './reducer';
5
5
 
6
6
  const ConfigurationsProvider = ({
7
7
  children,
8
- authLogo,
8
+ authLogo: defaultAuthLogo,
9
9
  menuLogo: defaultMenuLogo,
10
10
  showReleaseNotification,
11
11
  showTutorials,
12
12
  }) => {
13
- const [{ menuLogo }, dispatch] = useReducer(reducer, initialState);
13
+ const [{ menuLogo, authLogo }, dispatch] = useReducer(reducer, initialState);
14
14
 
15
- const updateProjectSettings = ({ menuLogo }) => {
16
- return dispatch({
17
- type: 'UPDATE_PROJECT_SETTINGS',
18
- values: {
19
- menuLogo: menuLogo || defaultMenuLogo,
20
- },
21
- });
22
- };
23
-
24
- const updateProjectSettingsRef = useRef(updateProjectSettings);
15
+ const updateProjectSettings = useCallback(
16
+ ({ menuLogo, authLogo }) => {
17
+ return dispatch({
18
+ type: 'UPDATE_PROJECT_SETTINGS',
19
+ values: {
20
+ menuLogo: menuLogo || defaultMenuLogo,
21
+ authLogo: authLogo || defaultAuthLogo,
22
+ },
23
+ });
24
+ },
25
+ [defaultAuthLogo, defaultMenuLogo]
26
+ );
25
27
 
26
28
  const configurationValue = useMemo(() => {
27
29
  return {
28
30
  logos: {
29
31
  menu: { custom: menuLogo, default: defaultMenuLogo },
30
- auth: { custom: null, default: authLogo },
32
+ auth: { custom: authLogo, default: defaultAuthLogo },
31
33
  },
32
- updateProjectSettings: updateProjectSettingsRef.current,
34
+ updateProjectSettings,
33
35
  showReleaseNotification,
34
36
  showTutorials,
35
37
  };
36
38
  }, [
37
- authLogo,
38
39
  menuLogo,
40
+ defaultMenuLogo,
41
+ authLogo,
42
+ defaultAuthLogo,
43
+ updateProjectSettings,
39
44
  showReleaseNotification,
40
45
  showTutorials,
41
- updateProjectSettingsRef,
42
- defaultMenuLogo,
43
46
  ]);
44
47
 
45
48
  return (
@@ -9,6 +9,7 @@ import produce from 'immer';
9
9
 
10
10
  const initialState = {
11
11
  menuLogo: null,
12
+ authLogo: null,
12
13
  };
13
14
 
14
15
  const reducer = (state = initialState, action) =>
@@ -12,6 +12,7 @@ import {
12
12
  NavSection,
13
13
  NavUser,
14
14
  NavCondense,
15
+ NavFooter,
15
16
  } from '@strapi/design-system/v2/MainNav';
16
17
  import { FocusTrap } from '@strapi/design-system/FocusTrap';
17
18
  import { Box } from '@strapi/design-system/Box';
@@ -19,9 +20,14 @@ import { Typography } from '@strapi/design-system/Typography';
19
20
  import { Stack } from '@strapi/design-system/Stack';
20
21
  import Write from '@strapi/icons/Write';
21
22
  import Exit from '@strapi/icons/Exit';
22
- import { auth, usePersistentState, useAppInfos, useTracking } from '@strapi/helper-plugin';
23
+ import {
24
+ auth,
25
+ usePersistentState,
26
+ useAppInfos,
27
+ useTracking,
28
+ getFetchClient,
29
+ } from '@strapi/helper-plugin';
23
30
  import { useConfigurations } from '../../hooks';
24
- import { axiosInstance } from '../../core/utils';
25
31
 
26
32
  const LinkUserWrapper = styled(Box)`
27
33
  width: ${150 / 16}rem;
@@ -63,6 +69,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
63
69
  const { trackUsage } = useTracking();
64
70
  const { pathname } = useLocation();
65
71
  const history = useHistory();
72
+ const { post } = getFetchClient();
66
73
 
67
74
  const initials = userDisplayName
68
75
  .split(' ')
@@ -73,7 +80,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
73
80
  const handleToggleUserLinks = () => setUserLinksVisible((prev) => !prev);
74
81
 
75
82
  const handleLogout = async () => {
76
- await axiosInstance.post('/admin/logout');
83
+ await post('/admin/logout');
77
84
  auth.clearAppStorage();
78
85
  handleToggleUserLinks();
79
86
  history.push('/auth/login');
@@ -183,57 +190,59 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
183
190
  ) : null}
184
191
  </NavSections>
185
192
 
186
- <NavUser
187
- id="main-nav-user-button"
188
- ref={buttonRef}
189
- onClick={handleToggleUserLinks}
190
- initials={initials}
191
- >
192
- {userDisplayName}
193
- </NavUser>
194
- {userLinksVisible && (
195
- <LinkUserWrapper
196
- onBlur={handleBlur}
197
- padding={1}
198
- shadow="tableShadow"
199
- background="neutral0"
200
- hasRadius
193
+ <NavFooter>
194
+ <NavUser
195
+ id="main-nav-user-button"
196
+ ref={buttonRef}
197
+ onClick={handleToggleUserLinks}
198
+ initials={initials}
201
199
  >
202
- <FocusTrap onEscape={handleToggleUserLinks}>
203
- <Stack spacing={0}>
204
- <LinkUser tabIndex={0} onClick={handleToggleUserLinks} to="/me">
205
- <Typography>
206
- {formatMessage({
207
- id: 'global.profile',
208
- defaultMessage: 'Profile',
209
- })}
210
- </Typography>
211
- </LinkUser>
212
- <LinkUser as="button" tabIndex={0} onClick={handleLogout} logout="logout">
213
- <Typography textColor="danger600">
214
- {formatMessage({
215
- id: 'app.components.LeftMenu.logout',
216
- defaultMessage: 'Logout',
217
- })}
218
- </Typography>
219
- <Exit />
220
- </LinkUser>
221
- </Stack>
222
- </FocusTrap>
223
- </LinkUserWrapper>
224
- )}
225
-
226
- <NavCondense onClick={() => setCondensed((s) => !s)}>
227
- {condensed
228
- ? formatMessage({
229
- id: 'app.components.LeftMenu.expand',
230
- defaultMessage: 'Expand the navbar',
231
- })
232
- : formatMessage({
233
- id: 'app.components.LeftMenu.collapse',
234
- defaultMessage: 'Collapse the navbar',
235
- })}
236
- </NavCondense>
200
+ {userDisplayName}
201
+ </NavUser>
202
+ {userLinksVisible && (
203
+ <LinkUserWrapper
204
+ onBlur={handleBlur}
205
+ padding={1}
206
+ shadow="tableShadow"
207
+ background="neutral0"
208
+ hasRadius
209
+ >
210
+ <FocusTrap onEscape={handleToggleUserLinks}>
211
+ <Stack spacing={0}>
212
+ <LinkUser tabIndex={0} onClick={handleToggleUserLinks} to="/me">
213
+ <Typography>
214
+ {formatMessage({
215
+ id: 'global.profile',
216
+ defaultMessage: 'Profile',
217
+ })}
218
+ </Typography>
219
+ </LinkUser>
220
+ <LinkUser tabIndex={0} onClick={handleLogout} logout="logout" to="/auth/login">
221
+ <Typography textColor="danger600">
222
+ {formatMessage({
223
+ id: 'app.components.LeftMenu.logout',
224
+ defaultMessage: 'Logout',
225
+ })}
226
+ </Typography>
227
+ <Exit />
228
+ </LinkUser>
229
+ </Stack>
230
+ </FocusTrap>
231
+ </LinkUserWrapper>
232
+ )}
233
+
234
+ <NavCondense onClick={() => setCondensed((s) => !s)}>
235
+ {condensed
236
+ ? formatMessage({
237
+ id: 'app.components.LeftMenu.expand',
238
+ defaultMessage: 'Expand the navbar',
239
+ })
240
+ : formatMessage({
241
+ id: 'app.components.LeftMenu.collapse',
242
+ defaultMessage: 'Collapse the navbar',
243
+ })}
244
+ </NavCondense>
245
+ </NavFooter>
237
246
  </MainNav>
238
247
  );
239
248
  };
@@ -11,7 +11,7 @@ const Logo = () => {
11
11
  logos: { auth },
12
12
  } = useConfigurations();
13
13
 
14
- return <Img src={auth.default} aria-hidden alt="" />;
14
+ return <Img src={auth?.custom ?? auth.default} aria-hidden alt="" />;
15
15
  };
16
16
 
17
17
  export default Logo;
@@ -10,11 +10,11 @@ import {
10
10
  formatContentTypeData,
11
11
  contentManagementUtilRemoveFieldsFromData,
12
12
  useGuidedTour,
13
+ useFetchClient,
13
14
  } from '@strapi/helper-plugin';
14
15
  import { useSelector, useDispatch } from 'react-redux';
15
16
  import PropTypes from 'prop-types';
16
17
  import isEqual from 'react-fast-compare';
17
- import { axiosInstance } from '../../../core/utils';
18
18
  import {
19
19
  createDefaultForm,
20
20
  getTrad,
@@ -51,6 +51,9 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
51
51
 
52
52
  const allLayoutDataRef = useRef(allLayoutData);
53
53
 
54
+ const fetchClient = useFetchClient();
55
+ const { put, post, del } = fetchClient;
56
+
54
57
  const isCreatingEntry = id === null;
55
58
 
56
59
  const requestURL = useMemo(() => {
@@ -137,7 +140,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
137
140
  dispatch(getData());
138
141
 
139
142
  try {
140
- const { data } = await axiosInstance.get(requestURL, { cancelToken: source.token });
143
+ const { data } = await fetchClient.get(requestURL, { cancelToken: source.token });
141
144
 
142
145
  dispatch(getDataSucceeded(cleanReceivedData(cleanClonedData(data))));
143
146
  } catch (err) {
@@ -187,6 +190,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
187
190
  source.cancel('Operation canceled by the user.');
188
191
  };
189
192
  }, [
193
+ fetchClient,
190
194
  cleanClonedData,
191
195
  cleanReceivedData,
192
196
  push,
@@ -216,12 +220,12 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
216
220
 
217
221
  const onDelete = useCallback(
218
222
  async (trackerProperty) => {
223
+ console.log('onDelete');
224
+
219
225
  try {
220
226
  trackUsageRef.current('willDeleteEntry', trackerProperty);
221
227
 
222
- const { data } = await axiosInstance.delete(
223
- getRequestUrl(`collection-types/${slug}/${id}`)
224
- );
228
+ const { data } = await del(getRequestUrl(`collection-types/${slug}/${id}`));
225
229
 
226
230
  toggleNotification({
227
231
  type: 'success',
@@ -237,7 +241,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
237
241
  return Promise.reject(err);
238
242
  }
239
243
  },
240
- [id, slug, toggleNotification]
244
+ [id, slug, toggleNotification, del]
241
245
  );
242
246
 
243
247
  const onDeleteSucceeded = useCallback(() => {
@@ -247,12 +251,11 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
247
251
  const onPost = useCallback(
248
252
  async (body, trackerProperty) => {
249
253
  const endPoint = `${getRequestUrl(`collection-types/${slug}`)}${rawQuery}`;
250
-
251
254
  try {
252
255
  // Show a loading button in the EditView/Header.js && lock the app => no navigation
253
256
  dispatch(setStatus('submit-pending'));
254
257
 
255
- const { data } = await axiosInstance.post(endPoint, body);
258
+ const { data } = await post(endPoint, body);
256
259
 
257
260
  trackUsageRef.current('didCreateEntry', trackerProperty);
258
261
  toggleNotification({
@@ -291,6 +294,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
291
294
  toggleNotification,
292
295
  setCurrentStep,
293
296
  queryClient,
297
+ post,
294
298
  ]
295
299
  );
296
300
 
@@ -303,7 +307,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
303
307
  );
304
308
  dispatch(setStatus('draft-relation-check-pending'));
305
309
 
306
- const numberOfDraftRelations = await axiosInstance.get(endPoint);
310
+ const numberOfDraftRelations = await fetchClient.get(endPoint);
307
311
  trackUsageRef.current('didCheckDraftRelations');
308
312
 
309
313
  dispatch(setStatus('resolved'));
@@ -315,7 +319,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
315
319
 
316
320
  return Promise.reject(err);
317
321
  }
318
- }, [displayErrors, id, slug, dispatch]);
322
+ }, [displayErrors, id, slug, dispatch, fetchClient]);
319
323
 
320
324
  const onPublish = useCallback(async () => {
321
325
  try {
@@ -324,7 +328,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
324
328
 
325
329
  dispatch(setStatus('publish-pending'));
326
330
 
327
- const { data } = await axiosInstance.post(endPoint);
331
+ const { data } = await post(endPoint);
328
332
 
329
333
  trackUsageRef.current('didPublishEntry');
330
334
 
@@ -343,7 +347,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
343
347
 
344
348
  return Promise.reject(err);
345
349
  }
346
- }, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification]);
350
+ }, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification, post]);
347
351
 
348
352
  const onPut = useCallback(
349
353
  async (body, trackerProperty) => {
@@ -354,7 +358,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
354
358
 
355
359
  dispatch(setStatus('submit-pending'));
356
360
 
357
- const { data } = await axiosInstance.put(endPoint, body);
361
+ const { data } = await put(endPoint, body);
358
362
 
359
363
  trackUsageRef.current('didEditEntry', { trackerProperty });
360
364
  toggleNotification({
@@ -379,7 +383,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
379
383
  return Promise.reject(err);
380
384
  }
381
385
  },
382
- [cleanReceivedData, displayErrors, slug, id, dispatch, toggleNotification, queryClient]
386
+ [cleanReceivedData, displayErrors, slug, id, dispatch, toggleNotification, queryClient, put]
383
387
  );
384
388
 
385
389
  const onUnpublish = useCallback(async () => {
@@ -390,7 +394,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
390
394
  try {
391
395
  trackUsageRef.current('willUnpublishEntry');
392
396
 
393
- const { data } = await axiosInstance.post(endPoint);
397
+ const { data } = await post(endPoint);
394
398
 
395
399
  trackUsageRef.current('didUnpublishEntry');
396
400
  toggleNotification({
@@ -408,7 +412,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
408
412
 
409
413
  return Promise.reject(err);
410
414
  }
411
- }, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification]);
415
+ }, [cleanReceivedData, displayErrors, id, slug, dispatch, toggleNotification, post]);
412
416
 
413
417
  return children({
414
418
  componentsDataStructure,
@@ -10,19 +10,18 @@ import { SimpleMenu, MenuItem } from '@strapi/design-system/SimpleMenu';
10
10
  import { Loader } from '@strapi/design-system/Loader';
11
11
  import styled from 'styled-components';
12
12
  import { useNotifyAT } from '@strapi/design-system/LiveRegions';
13
- import { stopPropagation } from '@strapi/helper-plugin';
13
+ import { stopPropagation, useFetchClient } from '@strapi/helper-plugin';
14
14
  import CellValue from '../CellValue';
15
- import { axiosInstance } from '../../../../../core/utils';
16
15
  import { getRequestUrl, getTrad } from '../../../../utils';
17
16
 
18
17
  const TypographyMaxWidth = styled(Typography)`
19
18
  max-width: 500px;
20
19
  `;
21
20
 
22
- const fetchRelation = async (endPoint, notifyStatus) => {
21
+ const fetchRelation = async (endPoint, notifyStatus, get) => {
23
22
  const {
24
23
  data: { results, pagination },
25
- } = await axiosInstance.get(endPoint);
24
+ } = await get(endPoint);
26
25
 
27
26
  notifyStatus();
28
27
 
@@ -37,6 +36,7 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
37
36
  [entityId, name, contentType]
38
37
  );
39
38
  const [isOpen, setIsOpen] = useState(false);
39
+ const { get } = useFetchClient();
40
40
 
41
41
  const Label = (
42
42
  <Flex gap={1} wrap="nowrap">
@@ -61,7 +61,7 @@ const RelationMultiple = ({ fieldSchema, metadatas, name, entityId, value, conte
61
61
 
62
62
  const { data, status } = useQuery(
63
63
  [fieldSchema.targetModel, entityId],
64
- () => fetchRelation(relationFetchEndpoint, notify),
64
+ () => fetchRelation(relationFetchEndpoint, notify, get),
65
65
  {
66
66
  enabled: isOpen,
67
67
  staleTime: 0,
@@ -21,11 +21,9 @@ export const findLeafByPathAndReplace = (endpath, replaceWith) => {
21
21
 
22
22
  /**
23
23
  * If this is the last item in the array of paths
24
- * and the current path is not undefined in the accumulator
25
24
  * then we assume it's a leaf and we can replace it.
26
25
  */
27
-
28
- if (ind === currentArr.length - 1 && endpath === curr && acc[curr] !== undefined) {
26
+ if (ind === currentArr.length - 1 && endpath === curr) {
29
27
  set(acc, curr, replaceWith);
30
28
 
31
29
  return acc;
@@ -216,10 +216,6 @@ const createYupSchemaAttribute = (type, validations, options) => {
216
216
  schema = yup
217
217
  .mixed(errorsTrads.json)
218
218
  .test('isJSON', errorsTrads.json, (value) => {
219
- if (value === undefined) {
220
- return true;
221
- }
222
-
223
219
  try {
224
220
  JSON.parse(value);
225
221
 
@@ -228,7 +224,12 @@ const createYupSchemaAttribute = (type, validations, options) => {
228
224
  return false;
229
225
  }
230
226
  })
231
- .nullable();
227
+ .nullable()
228
+ .test('required', errorsTrads.required, (value) => {
229
+ if (validations.required && !value.length) return false;
230
+
231
+ return true;
232
+ });
232
233
  }
233
234
 
234
235
  if (type === 'email') {
@@ -1,18 +1,9 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
3
  import { Typography } from '@strapi/design-system/Typography';
5
4
 
6
- export const Hint = ({ id, error, name, description }) => {
7
- const { formatMessage } = useIntl();
8
- const hint = description
9
- ? formatMessage(
10
- { id: description.id, defaultMessage: description.defaultMessage },
11
- { ...description.values }
12
- )
13
- : '';
14
-
15
- if (!hint || error) {
5
+ export const Hint = ({ id, error, name, hint }) => {
6
+ if (hint.length === 0 || error) {
16
7
  return null;
17
8
  }
18
9
 
@@ -25,16 +16,12 @@ export const Hint = ({ id, error, name, description }) => {
25
16
 
26
17
  Hint.defaultProps = {
27
18
  id: undefined,
28
- description: undefined,
29
19
  error: undefined,
20
+ hint: '',
30
21
  };
31
22
 
32
23
  Hint.propTypes = {
33
- description: PropTypes.shape({
34
- id: PropTypes.string.isRequired,
35
- defaultMessage: PropTypes.string.isRequired,
36
- values: PropTypes.object,
37
- }),
24
+ hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
38
25
  error: PropTypes.string,
39
26
  id: PropTypes.string,
40
27
  name: PropTypes.string.isRequired,
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { useCMEditViewDataManager } from '@strapi/helper-plugin';
3
+ import { useCMEditViewDataManager, useFetchClient } from '@strapi/helper-plugin';
4
4
  import { useIntl } from 'react-intl';
5
5
  import get from 'lodash/get';
6
6
  import { TextInput } from '@strapi/design-system/TextInput';
@@ -9,7 +9,6 @@ import Refresh from '@strapi/icons/Refresh';
9
9
  import CheckCircle from '@strapi/icons/CheckCircle';
10
10
  import ExclamationMarkCircle from '@strapi/icons/ExclamationMarkCircle';
11
11
  import Loader from '@strapi/icons/Loader';
12
- import { axiosInstance } from '../../../core/utils';
13
12
  import { getRequestUrl } from '../../utils';
14
13
  import useDebounce from './useDebounce';
15
14
  import UID_REGEX from './regex';
@@ -23,7 +22,7 @@ import {
23
22
  const InputUID = ({
24
23
  attribute,
25
24
  contentTypeUID,
26
- description,
25
+ hint,
27
26
  disabled,
28
27
  error,
29
28
  intlLabel,
@@ -46,6 +45,7 @@ const InputUID = ({
46
45
  const debouncedTargetFieldValue = useDebounce(modifiedData[attribute.targetField], 300);
47
46
  const [isCustomized, setIsCustomized] = useState(false);
48
47
  const [regenerateLabel, setRegenerateLabel] = useState(null);
48
+ const { post } = useFetchClient();
49
49
 
50
50
  const label = intlLabel.id
51
51
  ? formatMessage(
@@ -54,13 +54,6 @@ const InputUID = ({
54
54
  )
55
55
  : name;
56
56
 
57
- const hint = description
58
- ? formatMessage(
59
- { id: description.id, defaultMessage: description.defaultMessage },
60
- { ...description.values }
61
- )
62
- : '';
63
-
64
57
  const formattedPlaceholder = placeholder
65
58
  ? formatMessage(
66
59
  { id: placeholder.id, defaultMessage: placeholder.defaultMessage },
@@ -74,7 +67,7 @@ const InputUID = ({
74
67
  try {
75
68
  const {
76
69
  data: { data },
77
- } = await axiosInstance.post(requestURL, {
70
+ } = await post(requestURL, {
78
71
  contentTypeUID,
79
72
  field: name,
80
73
  data: modifiedData,
@@ -96,7 +89,7 @@ const InputUID = ({
96
89
  }
97
90
 
98
91
  try {
99
- const { data } = await axiosInstance.post(requestURL, {
92
+ const { data } = await post(requestURL, {
100
93
  contentTypeUID,
101
94
  field: name,
102
95
  value: value ? value.trim() : '',
@@ -251,11 +244,6 @@ InputUID.propTypes = {
251
244
  required: PropTypes.bool,
252
245
  }).isRequired,
253
246
  contentTypeUID: PropTypes.string.isRequired,
254
- description: PropTypes.shape({
255
- id: PropTypes.string.isRequired,
256
- defaultMessage: PropTypes.string.isRequired,
257
- values: PropTypes.object,
258
- }),
259
247
  disabled: PropTypes.bool,
260
248
  error: PropTypes.string,
261
249
  intlLabel: PropTypes.shape({
@@ -273,16 +261,17 @@ InputUID.propTypes = {
273
261
  values: PropTypes.object,
274
262
  }),
275
263
  required: PropTypes.bool,
264
+ hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
276
265
  };
277
266
 
278
267
  InputUID.defaultProps = {
279
- description: undefined,
280
268
  disabled: false,
281
269
  error: undefined,
282
270
  labelAction: undefined,
283
271
  placeholder: undefined,
284
272
  value: '',
285
273
  required: false,
274
+ hint: '',
286
275
  };
287
276
 
288
277
  export default InputUID;
@@ -9,7 +9,6 @@ import { GenericInput, NotAllowedInput, useLibrary } from '@strapi/helper-plugin
9
9
  import { useContentTypeLayout } from '../../hooks';
10
10
  import { getFieldName } from '../../utils';
11
11
  import Wysiwyg from '../Wysiwyg';
12
- import InputJSON from '../InputJSON';
13
12
  import InputUID from '../InputUID';
14
13
  import { RelationInputDataManager } from '../RelationInputDataManager';
15
14
 
@@ -250,7 +249,6 @@ function Inputs({
250
249
  }
251
250
 
252
251
  const customInputs = {
253
- json: InputJSON,
254
252
  uid: InputUID,
255
253
  media: fields.media,
256
254
  wysiwyg: Wysiwyg,