@strapi/admin 4.10.5 → 4.10.7

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 (146) hide show
  1. package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
  2. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +1 -2
  3. package/admin/src/content-manager/components/DynamicZone/index.js +1 -1
  4. package/admin/src/content-manager/components/FieldComponent/index.js +1 -1
  5. package/admin/src/content-manager/components/Inputs/index.js +1 -1
  6. package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +67 -71
  7. package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +3 -5
  8. package/admin/src/content-manager/pages/App/useContentManagerInitData.js +2 -3
  9. package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +2 -5
  10. package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +1 -1
  11. package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
  12. package/admin/src/content-manager/pages/EditViewLayoutManager/Permissions.js +1 -1
  13. package/admin/src/content-manager/pages/ListView/index.js +1 -2
  14. package/admin/src/hooks/index.js +1 -1
  15. package/admin/src/hooks/marketplace/constants.js +1 -0
  16. package/admin/src/hooks/{useFetchMarketplacePlugins → marketplace/useFetchMarketplacePlugins}/index.js +21 -1
  17. package/admin/src/hooks/{useFetchMarketplaceProviders → marketplace/useFetchMarketplaceProviders}/index.js +21 -1
  18. package/admin/src/hooks/useAdminUsers/__mocks__/index.js +5 -0
  19. package/admin/src/hooks/useAdminUsers/index.js +1 -0
  20. package/admin/src/hooks/useAdminUsers/useAdminUsers.js +38 -0
  21. package/admin/src/hooks/useContentTypes/__mocks__/index.js +6 -0
  22. package/admin/src/hooks/useContentTypes/index.js +1 -0
  23. package/admin/src/hooks/useContentTypes/useContentTypes.js +45 -0
  24. package/admin/src/hooks/useReleaseNotification/utils/api.js +6 -5
  25. package/admin/src/pages/Admin/Onboarding/index.js +89 -91
  26. package/admin/src/pages/App/index.js +1 -5
  27. package/admin/src/pages/AuthPage/components/Register/index.js +3 -4
  28. package/admin/src/pages/AuthPage/index.js +11 -26
  29. package/admin/src/pages/HomePage/index.js +3 -2
  30. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/InstallPluginButton.js +12 -8
  31. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +39 -41
  32. package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +2 -2
  33. package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +28 -26
  34. package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +1 -1
  35. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +3 -2
  36. package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
  37. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -1
  38. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +36 -26
  39. package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +1 -8
  40. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +6 -7
  41. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +54 -63
  42. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +11 -9
  43. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +12 -1
  44. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +2 -2
  45. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +120 -205
  46. package/admin/src/pages/UseCasePage/index.js +13 -15
  47. package/admin/src/translations/ar.json +684 -1
  48. package/admin/src/translations/en.json +12 -9
  49. package/build/1387.a86ac314.chunk.js +1 -0
  50. package/build/{1657.85034334.chunk.js → 1657.3f2b2c11.chunk.js} +46 -54
  51. package/build/3081.7e9329cb.chunk.js +105 -0
  52. package/build/462.6f8cbd19.chunk.js +71 -0
  53. package/build/5542.64b623c9.chunk.js +63 -0
  54. package/build/5563.79950369.chunk.js +79 -0
  55. package/build/617.1591eeb0.chunk.js +155 -0
  56. package/build/6970.6a329e15.chunk.js +1 -0
  57. package/build/7259.5cc67413.chunk.js +1 -0
  58. package/build/9036.f7ce35cc.chunk.js +211 -0
  59. package/build/Admin-authenticatedApp.ad8a8a15.chunk.js +79 -0
  60. package/build/{Admin_homePage.e15dcf28.chunk.js → Admin_homePage.94dc81b1.chunk.js} +16 -16
  61. package/build/Admin_marketplace.1b0c3d3b.chunk.js +55 -0
  62. package/build/Admin_pluginsPage.a28b96d5.chunk.js +6 -0
  63. package/build/{Admin_profilePage.1687246a.chunk.js → Admin_profilePage.a8fa3a56.chunk.js} +1 -1
  64. package/build/Admin_settingsPage.ee76d19e.chunk.js +79 -0
  65. package/build/admin-app.bd209f08.chunk.js +63 -0
  66. package/build/{admin-edit-roles-page.6fe9de49.chunk.js → admin-edit-roles-page.0d12b741.chunk.js} +3 -3
  67. package/build/admin-edit-users.f9ce7844.chunk.js +10 -0
  68. package/build/admin-roles-list.af53b372.chunk.js +23 -0
  69. package/build/admin-users.0fc77b35.chunk.js +26 -0
  70. package/build/ar-json.f530bc3f.chunk.js +1 -0
  71. package/build/audit-logs-settings-page.dc07596e.chunk.js +121 -0
  72. package/build/{content-manager.a97db8a1.chunk.js → content-manager.70548048.chunk.js} +95 -95
  73. package/build/content-type-builder-list-view.26aab6f3.chunk.js +215 -0
  74. package/build/content-type-builder-translation-en-json.af293c9e.chunk.js +1 -0
  75. package/build/content-type-builder.b10576e7.chunk.js +126 -0
  76. package/build/email-settings-page.63f269ff.chunk.js +11 -0
  77. package/build/en-json.ba3290b8.chunk.js +1 -0
  78. package/build/i18n-settings-page.f84c4782.chunk.js +114 -0
  79. package/build/index.html +1 -1
  80. package/build/main.4016f4ad.js +2630 -0
  81. package/build/review-workflows-settings.56cab253.chunk.js +61 -0
  82. package/build/{runtime~main.df78e1c7.js → runtime~main.d7e177e4.js} +1 -1
  83. package/build/{sso-settings-page.c9d7c8df.chunk.js → sso-settings-page.265e3d72.chunk.js} +1 -1
  84. package/build/upload-settings.1d187578.chunk.js +14 -0
  85. package/build/upload.bc340679.chunk.js +26 -0
  86. package/build/users-advanced-settings-page.7b4bf63a.chunk.js +9 -0
  87. package/build/users-email-settings-page.035a026c.chunk.js +24 -0
  88. package/build/users-providers-settings-page.6873dce9.chunk.js +29 -0
  89. package/build/{users-roles-settings-page.eeb3a339.chunk.js → users-roles-settings-page.2549794b.chunk.js} +2 -2
  90. package/build/webhook-edit-page.ddd5963d.chunk.js +128 -0
  91. package/build/webhook-list-page.0861d3e9.chunk.js +63 -0
  92. package/ee/LICENSE +1 -21
  93. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -2
  94. package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
  95. package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
  96. package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
  97. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +36 -28
  98. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +1 -1
  99. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +3 -3
  100. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +32 -21
  101. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +1 -1
  102. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +1 -1
  103. package/ee/server/services/audit-logs.js +5 -1
  104. package/package.json +18 -21
  105. package/webpack.alias.js +0 -2
  106. package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -18
  107. package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +0 -18
  108. package/admin/src/hooks/useModels/index.js +0 -58
  109. package/admin/src/hooks/useModels/reducer.js +0 -45
  110. package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +0 -20
  111. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +0 -13
  112. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +0 -72
  113. package/build/1387.437eb420.chunk.js +0 -1
  114. package/build/3081.c2cdfac8.chunk.js +0 -108
  115. package/build/3816.1a828046.chunk.js +0 -211
  116. package/build/462.a073ff1f.chunk.js +0 -71
  117. package/build/5542.002522eb.chunk.js +0 -71
  118. package/build/5563.44e0ef15.chunk.js +0 -79
  119. package/build/617.2c8c7183.chunk.js +0 -155
  120. package/build/6970.e8422af3.chunk.js +0 -1
  121. package/build/7259.3ed2b60e.chunk.js +0 -1
  122. package/build/Admin-authenticatedApp.6b74c5fd.chunk.js +0 -79
  123. package/build/Admin_marketplace.87f51b29.chunk.js +0 -55
  124. package/build/Admin_pluginsPage.7df6b5a9.chunk.js +0 -6
  125. package/build/Admin_settingsPage.20884a40.chunk.js +0 -79
  126. package/build/admin-app.d4fd9379.chunk.js +0 -63
  127. package/build/admin-edit-users.49363035.chunk.js +0 -10
  128. package/build/admin-roles-list.a323aa9f.chunk.js +0 -31
  129. package/build/admin-users.16bb6e77.chunk.js +0 -34
  130. package/build/ar-json.39e54aba.chunk.js +0 -1
  131. package/build/audit-logs-settings-page.7ec976e1.chunk.js +0 -129
  132. package/build/content-type-builder-list-view.1e821eb9.chunk.js +0 -215
  133. package/build/content-type-builder-translation-en-json.5e5f8607.chunk.js +0 -1
  134. package/build/content-type-builder.51c64fe5.chunk.js +0 -126
  135. package/build/email-settings-page.dba83275.chunk.js +0 -11
  136. package/build/en-json.1f6af924.chunk.js +0 -1
  137. package/build/i18n-settings-page.e34ec940.chunk.js +0 -114
  138. package/build/main.57970a57.js +0 -2674
  139. package/build/review-workflows-settings.26409ce4.chunk.js +0 -61
  140. package/build/upload-settings.63d99bf5.chunk.js +0 -14
  141. package/build/upload.bf183c0c.chunk.js +0 -34
  142. package/build/users-advanced-settings-page.4f49ca57.chunk.js +0 -9
  143. package/build/users-email-settings-page.756aa7ab.chunk.js +0 -24
  144. package/build/users-providers-settings-page.ff9e4c0a.chunk.js +0 -29
  145. package/build/webhook-edit-page.550be445.chunk.js +0 -128
  146. package/build/webhook-list-page.0983d83f.chunk.js +0 -71
@@ -1,4 +1,3 @@
1
- import axios from 'axios';
2
1
  import { getFetchClient } from '@strapi/helper-plugin';
3
2
  import checkLatestStrapiVersion from './checkLatestStrapiVersion';
4
3
  import packageJSON from '../../../../../package.json';
@@ -9,10 +8,12 @@ const { get } = getFetchClient();
9
8
 
10
9
  const fetchStrapiLatestRelease = async (toggleNotification) => {
11
10
  try {
12
- const {
13
- data: { tag_name },
14
- } = await axios.get('https://api.github.com/repos/strapi/strapi/releases/latest');
11
+ const res = await fetch('https://api.github.com/repos/strapi/strapi/releases/latest');
15
12
 
13
+ if (!res.ok) {
14
+ throw new Error('Failed to fetch latest Strapi version.');
15
+ }
16
+ const { tag_name } = await res.json();
16
17
  const shouldUpdateStrapi = checkLatestStrapiVersion(strapiVersion, tag_name);
17
18
 
18
19
  if (shouldUpdateStrapi && showUpdateNotif) {
@@ -15,7 +15,7 @@ import {
15
15
  } from '@strapi/helper-plugin';
16
16
  import { useSelector, useDispatch } from 'react-redux';
17
17
  import PropTypes from 'prop-types';
18
- import isEqual from 'react-fast-compare';
18
+ import isEqual from 'lodash/isEqual';
19
19
  import {
20
20
  createDefaultForm,
21
21
  getTrad,
@@ -149,7 +149,6 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
149
149
  if (axios.isCancel(err)) {
150
150
  return;
151
151
  }
152
-
153
152
  const resStatus = get(err, 'response.status', null);
154
153
 
155
154
  if (resStatus === 404) {
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useMemo, useState } from 'react';
2
2
  import get from 'lodash/get';
3
- import isEqual from 'react-fast-compare';
3
+ import isEqual from 'lodash/isEqual';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Box, Flex, VisuallyHidden } from '@strapi/design-system';
6
6
  import { NotAllowedInput, useNotification } from '@strapi/helper-plugin';
@@ -2,7 +2,7 @@
2
2
  import React, { memo, useMemo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import size from 'lodash/size';
5
- import isEqual from 'react-fast-compare';
5
+ import isEqual from 'lodash/isEqual';
6
6
  import { useIntl } from 'react-intl';
7
7
 
8
8
  import { NotAllowedInput } from '@strapi/helper-plugin';
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl';
4
4
  import get from 'lodash/get';
5
5
  import omit from 'lodash/omit';
6
6
  import take from 'lodash/take';
7
- import isEqual from 'react-fast-compare';
7
+ import isEqual from 'lodash/isEqual';
8
8
  import { GenericInput, NotAllowedInput, useLibrary } from '@strapi/helper-plugin';
9
9
  import { useContentTypeLayout } from '../../hooks';
10
10
  import { getFieldName } from '../../utils';
@@ -2,15 +2,7 @@ import React, { useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import { useIntl } from 'react-intl';
5
- import {
6
- FocusTrap,
7
- Button,
8
- IconButtonGroup,
9
- Option,
10
- Select,
11
- Popover,
12
- Flex,
13
- } from '@strapi/design-system';
5
+ import { Button, IconButtonGroup, Option, Select, Popover, Flex } from '@strapi/design-system';
14
6
  import {
15
7
  Bold,
16
8
  Italic,
@@ -146,68 +138,72 @@ const WysiwygNav = ({
146
138
  icon={<More />}
147
139
  />
148
140
  {visiblePopover && (
149
- <Popover centered source={buttonMoreRef} spacing={4} id="popover">
150
- <FocusTrap onEscape={handleTogglePopover} restoreFocus={false}>
151
- <Flex>
152
- <IconButtonGroupMargin>
153
- <CustomIconButton
154
- onClick={() => onActionClick('Strikethrough', editorRef, handleTogglePopover)}
155
- id="Strikethrough"
156
- label="Strikethrough"
157
- name="Strikethrough"
158
- icon={<StrikeThrough />}
159
- />
160
- <CustomIconButton
161
- onClick={() => onActionClick('BulletList', editorRef, handleTogglePopover)}
162
- id="BulletList"
163
- label="BulletList"
164
- name="BulletList"
165
- icon={<BulletList />}
166
- />
167
- <CustomIconButton
168
- onClick={() => onActionClick('NumberList', editorRef, handleTogglePopover)}
169
- id="NumberList"
170
- label="NumberList"
171
- name="NumberList"
172
- icon={<NumberList />}
173
- />
174
- </IconButtonGroupMargin>
175
- <IconButtonGroup>
176
- <CustomIconButton
177
- onClick={() => onActionClick('Code', editorRef, handleTogglePopover)}
178
- id="Code"
179
- label="Code"
180
- name="Code"
181
- icon={<Code />}
182
- />
183
- <CustomIconButton
184
- onClick={() => {
185
- handleTogglePopover();
186
- onToggleMediaLib();
187
- }}
188
- id="Image"
189
- label="Image"
190
- name="Image"
191
- icon={<Image />}
192
- />
193
- <CustomLinkIconButton
194
- onClick={() => onActionClick('Link', editorRef, handleTogglePopover)}
195
- id="Link"
196
- label="Link"
197
- name="Link"
198
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
199
- icon={<Link />}
200
- />
201
- <CustomIconButton
202
- onClick={() => onActionClick('Quote', editorRef, handleTogglePopover)}
203
- id="Quote"
204
- label="Quote"
205
- name="Quote"
206
- icon={<Quote />}
207
- />
208
- </IconButtonGroup>
209
- </Flex>
210
- </FocusTrap>
141
+ <Popover
142
+ onDismiss={handleTogglePopover}
143
+ centered
144
+ source={buttonMoreRef}
145
+ spacing={4}
146
+ id="popover"
147
+ >
148
+ <Flex>
149
+ <IconButtonGroupMargin>
150
+ <CustomIconButton
151
+ onClick={() => onActionClick('Strikethrough', editorRef, handleTogglePopover)}
152
+ id="Strikethrough"
153
+ label="Strikethrough"
154
+ name="Strikethrough"
155
+ icon={<StrikeThrough />}
156
+ />
157
+ <CustomIconButton
158
+ onClick={() => onActionClick('BulletList', editorRef, handleTogglePopover)}
159
+ id="BulletList"
160
+ label="BulletList"
161
+ name="BulletList"
162
+ icon={<BulletList />}
163
+ />
164
+ <CustomIconButton
165
+ onClick={() => onActionClick('NumberList', editorRef, handleTogglePopover)}
166
+ id="NumberList"
167
+ label="NumberList"
168
+ name="NumberList"
169
+ icon={<NumberList />}
170
+ />
171
+ </IconButtonGroupMargin>
172
+ <IconButtonGroup>
173
+ <CustomIconButton
174
+ onClick={() => onActionClick('Code', editorRef, handleTogglePopover)}
175
+ id="Code"
176
+ label="Code"
177
+ name="Code"
178
+ icon={<Code />}
179
+ />
180
+ <CustomIconButton
181
+ onClick={() => {
182
+ handleTogglePopover();
183
+ onToggleMediaLib();
184
+ }}
185
+ id="Image"
186
+ label="Image"
187
+ name="Image"
188
+ icon={<Image />}
189
+ />
190
+ <CustomLinkIconButton
191
+ onClick={() => onActionClick('Link', editorRef, handleTogglePopover)}
192
+ id="Link"
193
+ label="Link"
194
+ name="Link"
195
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
196
+ icon={<Link />}
197
+ />
198
+ <CustomIconButton
199
+ onClick={() => onActionClick('Quote', editorRef, handleTogglePopover)}
200
+ id="Quote"
201
+ label="Quote"
202
+ name="Quote"
203
+ icon={<Quote />}
204
+ />
205
+ </IconButtonGroup>
206
+ </Flex>
211
207
  </Popover>
212
208
  )}
213
209
  </StyledFlex>
@@ -5,7 +5,6 @@ import { useFetchClient } from '@strapi/helper-plugin';
5
5
  import formatLayouts from './utils/formatLayouts';
6
6
  import reducer, { initialState } from './reducer';
7
7
  import { makeSelectModelAndComponentSchemas } from '../../pages/App/selectors';
8
- import { getRequestUrl } from '../../utils';
9
8
 
10
9
  const useFetchContentTypeLayout = (contentTypeUID) => {
11
10
  const [{ error, isLoading, layout, layouts }, dispatch] = useReducer(reducer, initialState);
@@ -24,11 +23,11 @@ const useFetchContentTypeLayout = (contentTypeUID) => {
24
23
  dispatch({ type: 'GET_DATA' });
25
24
 
26
25
  try {
27
- const endPoint = getRequestUrl(`content-types/${uid}/configuration`);
28
-
29
26
  const {
30
27
  data: { data },
31
- } = await get(endPoint, { cancelToken: source.token });
28
+ } = await get(`/content-manager/content-types/${uid}/configuration`, {
29
+ cancelToken: source.token,
30
+ });
32
31
 
33
32
  dispatch({
34
33
  type: 'GET_DATA_SUCCEEDED',
@@ -38,7 +37,6 @@ const useFetchContentTypeLayout = (contentTypeUID) => {
38
37
  if (axios.isCancel(error)) {
39
38
  return;
40
39
  }
41
-
42
40
  if (isMounted.current) {
43
41
  console.error(error);
44
42
  }
@@ -10,7 +10,7 @@ import { useNotifyAT } from '@strapi/design-system';
10
10
  import axios from 'axios';
11
11
  import { useIntl } from 'react-intl';
12
12
  import { MUTATE_COLLECTION_TYPES_LINKS, MUTATE_SINGLE_TYPES_LINKS } from '../../../exposedHooks';
13
- import { getRequestUrl, getTrad } from '../../utils';
13
+ import { getTrad } from '../../utils';
14
14
  import { getInitData, resetInitData, setInitData } from './actions';
15
15
  import { selectAppDomain } from './selectors';
16
16
  import getContentTypeLinks from './utils/getContentTypeLinks';
@@ -36,7 +36,7 @@ const useContentManagerInitData = () => {
36
36
  data: {
37
37
  data: { components, contentTypes: models, fieldSizes },
38
38
  },
39
- } = await get(getRequestUrl('init'), { cancelToken: source.token });
39
+ } = await get('/content-manager/init', { cancelToken: source.token });
40
40
  notifyStatus(
41
41
  formatMessage({
42
42
  id: getTrad('App.schemas.data-loaded'),
@@ -75,7 +75,6 @@ const useContentManagerInitData = () => {
75
75
  if (axios.isCancel(err)) {
76
76
  return;
77
77
  }
78
-
79
78
  console.error(err);
80
79
 
81
80
  toggleNotification({ type: 'warning', message: { id: 'notification.error' } });
@@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
3
3
  import { CheckPagePermissions, LoadingIndicatorPage, useFetchClient } from '@strapi/helper-plugin';
4
4
  import { useSelector, shallowEqual } from 'react-redux';
5
5
  import axios from 'axios';
6
- import { getRequestUrl, mergeMetasWithSchema } from '../../utils';
6
+ import { mergeMetasWithSchema } from '../../utils';
7
7
  import { makeSelectModelAndComponentSchemas } from '../App/selectors';
8
8
  import permissions from '../../../permissions';
9
9
  import crudReducer, { crudInitialState } from '../../sharedReducers/crudReducer/reducer';
@@ -22,23 +22,20 @@ const ComponentSettingsView = () => {
22
22
  useEffect(() => {
23
23
  const CancelToken = axios.CancelToken;
24
24
  const source = CancelToken.source();
25
-
26
25
  const fetchData = async (source) => {
27
26
  try {
28
27
  dispatch(getData());
29
28
 
30
29
  const {
31
30
  data: { data },
32
- } = await get(getRequestUrl(`components/${uid}/configuration`), {
31
+ } = await get(`/content-manager/components/${uid}/configuration`, {
33
32
  cancelToken: source.token,
34
33
  });
35
-
36
34
  dispatch(getDataSucceeded(mergeMetasWithSchema(data, schemas, 'component')));
37
35
  } catch (err) {
38
36
  if (axios.isCancel(err)) {
39
37
  return;
40
38
  }
41
-
42
39
  console.error(err);
43
40
  }
44
41
  };
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useState } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
- import isEqual from 'react-fast-compare';
3
+ import isEqual from 'lodash/isEqual';
4
4
  import { Button } from '@strapi/design-system';
5
5
  import { Trash } from '@strapi/icons';
6
6
  import { ConfirmDialog, useNotification, useAPIErrorHandler } from '@strapi/helper-plugin';
@@ -2,7 +2,7 @@ import React, { memo, useState } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { useHistory } from 'react-router-dom';
4
4
  import PropTypes from 'prop-types';
5
- import isEqualFastCompare from 'react-fast-compare';
5
+ import isEqualFastCompare from 'lodash/isEqual';
6
6
  import get from 'lodash/get';
7
7
  import isEqual from 'lodash/isEqual';
8
8
  import isEmpty from 'lodash/isEmpty';
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useRBAC, LoadingIndicatorPage } from '@strapi/helper-plugin';
4
- import isEqual from 'react-fast-compare';
4
+ import isEqual from 'lodash/isEqual';
5
5
  import EditView from '../EditView';
6
6
  import { generatePermissionsObject } from '../../utils';
7
7
 
@@ -2,7 +2,7 @@ import React, { memo, useCallback, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import { connect } from 'react-redux';
5
- import isEqual from 'react-fast-compare';
5
+ import isEqual from 'lodash/isEqual';
6
6
  import { bindActionCreators, compose } from 'redux';
7
7
  import { useIntl } from 'react-intl';
8
8
  import { useHistory, useLocation, Link as ReactRouterLink } from 'react-router-dom';
@@ -111,7 +111,6 @@ function ListView({
111
111
 
112
112
  try {
113
113
  const opts = source ? { cancelToken: source.token } : null;
114
-
115
114
  const {
116
115
  data: { results, pagination: paginationResult },
117
116
  } = await fetchClient.get(endPoint, opts);
@@ -1,5 +1,5 @@
1
1
  export { default as useConfigurations } from './useConfigurations';
2
- export { default as useModels } from './useModels';
2
+ export { useContentTypes } from './useContentTypes';
3
3
  export { default as useFetchPermissionsLayout } from './useFetchPermissionsLayout';
4
4
  export { default as useFetchRole } from './useFetchRole';
5
5
  export { default as useMenu } from './useMenu';
@@ -0,0 +1 @@
1
+ export const MARKETPLACE_API_URL = 'https://market-api.strapi.io';
@@ -1,6 +1,26 @@
1
1
  import { useQuery } from 'react-query';
2
2
  import { useNotification } from '@strapi/helper-plugin';
3
- import { fetchMarketplacePlugins } from './utils/api';
3
+ import qs from 'qs';
4
+ import { MARKETPLACE_API_URL } from '../constants';
5
+
6
+ const fetchMarketplacePlugins = async (params = {}) => {
7
+ try {
8
+ const queryString = qs.stringify(qs.parse(params));
9
+ const res = await fetch(`${MARKETPLACE_API_URL}/plugins?${queryString}`);
10
+
11
+ if (!res.ok) {
12
+ throw new Error('Failed to fetch marketplace plugins.');
13
+ }
14
+
15
+ const data = await res.json();
16
+
17
+ return data;
18
+ } catch (error) {
19
+ console.error(error);
20
+ }
21
+
22
+ return null;
23
+ };
4
24
 
5
25
  const useFetchMarketplacePlugins = (notifyLoad, params) => {
6
26
  const toggleNotification = useNotification();
@@ -1,6 +1,26 @@
1
1
  import { useQuery } from 'react-query';
2
2
  import { useNotification } from '@strapi/helper-plugin';
3
- import { fetchMarketplaceProviders } from './utils/api';
3
+ import qs from 'qs';
4
+ import { MARKETPLACE_API_URL } from '../constants';
5
+
6
+ const fetchMarketplaceProviders = async (params = {}) => {
7
+ try {
8
+ const queryString = qs.stringify(qs.parse(params));
9
+ const res = await fetch(`${MARKETPLACE_API_URL}/providers?${queryString}`);
10
+
11
+ if (!res.ok) {
12
+ throw new Error('Failed to fetch marketplace providers.');
13
+ }
14
+
15
+ const data = await res.json();
16
+
17
+ return data;
18
+ } catch (error) {
19
+ console.error(error);
20
+ }
21
+
22
+ return null;
23
+ };
4
24
 
5
25
  const useFetchMarketplaceProviders = (notifyLoad, params) => {
6
26
  const toggleNotification = useNotification();
@@ -0,0 +1,5 @@
1
+ export const useAdminUsers = jest.fn().mockReturnValue({
2
+ users: [],
3
+ isLoading: false,
4
+ isError: false,
5
+ });
@@ -0,0 +1 @@
1
+ export * from './useAdminUsers';
@@ -0,0 +1,38 @@
1
+ import { useQuery } from 'react-query';
2
+ import { useFetchClient } from '@strapi/helper-plugin';
3
+ import { stringify } from 'qs';
4
+
5
+ export function useAdminUsers(params = {}, queryOptions = {}) {
6
+ const { id = '', ...queryParams } = params;
7
+ const queryString = stringify(queryParams, { encode: false });
8
+
9
+ const { get } = useFetchClient();
10
+
11
+ const { data, isError, isLoading, refetch } = useQuery(
12
+ ['users', id, queryParams],
13
+ async () => {
14
+ const {
15
+ data: { data },
16
+ } = await get(`/admin/users/${id}${queryString ? `?${queryString}` : ''}`);
17
+
18
+ return data;
19
+ },
20
+ queryOptions
21
+ );
22
+
23
+ let users = [];
24
+
25
+ if (id && data) {
26
+ users = [data];
27
+ } else if (Array.isArray(data?.results)) {
28
+ users = data.results;
29
+ }
30
+
31
+ return {
32
+ users,
33
+ pagination: data?.pagination ?? null,
34
+ isLoading,
35
+ isError,
36
+ refetch,
37
+ };
38
+ }
@@ -0,0 +1,6 @@
1
+ export const useContentTypes = jest.fn().mockReturnValue({
2
+ isLoading: false,
3
+ components: [],
4
+ collectionTypes: [],
5
+ singleTypes: [],
6
+ });
@@ -0,0 +1 @@
1
+ export * from './useContentTypes';
@@ -0,0 +1,45 @@
1
+ import { useAPIErrorHandler, useFetchClient, useNotification } from '@strapi/helper-plugin';
2
+ import { useQueries } from 'react-query';
3
+
4
+ export function useContentTypes() {
5
+ const { get } = useFetchClient();
6
+ const { formatAPIError } = useAPIErrorHandler();
7
+ const toggleNotification = useNotification();
8
+ const queries = useQueries(
9
+ ['components', 'content-types'].map((type) => {
10
+ return {
11
+ queryKey: ['content-manager', type],
12
+ async queryFn() {
13
+ const {
14
+ data: { data },
15
+ } = await get(`/content-manager/${type}`);
16
+
17
+ return data;
18
+ },
19
+ onError(error) {
20
+ toggleNotification({
21
+ type: 'warning',
22
+ message: formatAPIError(error),
23
+ });
24
+ },
25
+ };
26
+ })
27
+ );
28
+
29
+ const [components, contentTypes] = queries;
30
+ const isLoading = components.isLoading || contentTypes.isLoading;
31
+
32
+ const collectionTypes = (contentTypes?.data ?? []).filter(
33
+ (contentType) => contentType.kind === 'collectionType' && contentType.isDisplayed
34
+ );
35
+ const singleTypes = (contentTypes?.data ?? []).filter(
36
+ (contentType) => contentType.kind !== 'collectionType' && contentType.isDisplayed
37
+ );
38
+
39
+ return {
40
+ isLoading,
41
+ components: components?.data ?? [],
42
+ collectionTypes,
43
+ singleTypes,
44
+ };
45
+ }
@@ -1,13 +1,14 @@
1
- import axios from 'axios';
2
1
  import packageJSON from '../../../../../package.json';
3
2
 
4
3
  const strapiVersion = packageJSON.version;
5
-
6
4
  const fetchStrapiLatestRelease = async () => {
7
5
  try {
8
- const {
9
- data: { tag_name },
10
- } = await axios.get('https://api.github.com/repos/strapi/strapi/releases/latest');
6
+ const res = await fetch('https://api.github.com/repos/strapi/strapi/releases/latest');
7
+
8
+ if (!res.ok) {
9
+ throw new Error('Failed to fetch latest Strapi version.');
10
+ }
11
+ const { tag_name } = await res.json();
11
12
 
12
13
  return tag_name;
13
14
  } catch (err) {