@strapi/admin 4.10.4 → 4.10.6

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 (94) 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/marketplace/constants.js +1 -0
  15. package/admin/src/hooks/{useFetchMarketplacePlugins → marketplace/useFetchMarketplacePlugins}/index.js +21 -1
  16. package/admin/src/hooks/{useFetchMarketplaceProviders → marketplace/useFetchMarketplaceProviders}/index.js +21 -1
  17. package/admin/src/hooks/useReleaseNotification/utils/api.js +6 -5
  18. package/admin/src/pages/Admin/Onboarding/index.js +89 -91
  19. package/admin/src/pages/App/index.js +1 -5
  20. package/admin/src/pages/AuthPage/components/Register/index.js +3 -4
  21. package/admin/src/pages/AuthPage/index.js +11 -26
  22. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +39 -41
  23. package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +2 -2
  24. package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +1 -1
  25. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +3 -2
  26. package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
  27. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -1
  28. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +12 -1
  29. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +120 -205
  30. package/admin/src/pages/UseCasePage/index.js +13 -15
  31. package/admin/src/translations/en.json +11 -9
  32. package/build/1387.a86ac314.chunk.js +1 -0
  33. package/build/{1657.85034334.chunk.js → 1657.ca8562dd.chunk.js} +46 -46
  34. package/build/{3816.2b58bc1a.chunk.js → 3816.60f858cf.chunk.js} +19 -22
  35. package/build/{5542.5328b662.chunk.js → 5542.002522eb.chunk.js} +13 -13
  36. package/build/{5563.44e0ef15.chunk.js → 5563.2c8334ef.chunk.js} +1 -1
  37. package/build/617.87b2fe96.chunk.js +155 -0
  38. package/build/{6970.e8422af3.chunk.js → 6970.36d3ffff.chunk.js} +1 -1
  39. package/build/7259.116a9960.chunk.js +1 -0
  40. package/build/Admin-authenticatedApp.0318dfb3.chunk.js +79 -0
  41. package/build/{Admin_marketplace.87f51b29.chunk.js → Admin_marketplace.f446ba2b.chunk.js} +10 -10
  42. package/build/Admin_settingsPage.f8c46a9a.chunk.js +79 -0
  43. package/build/admin-app.6d48536c.chunk.js +63 -0
  44. package/build/{admin-edit-roles-page.6fe9de49.chunk.js → admin-edit-roles-page.02c3b136.chunk.js} +3 -3
  45. package/build/{admin-users.16bb6e77.chunk.js → admin-users.69f4900a.chunk.js} +11 -11
  46. package/build/audit-logs-settings-page.482909d7.chunk.js +129 -0
  47. package/build/{content-manager.a837bfcd.chunk.js → content-manager.cd71cb6e.chunk.js} +95 -95
  48. package/build/content-type-builder-translation-en-json.af293c9e.chunk.js +1 -0
  49. package/build/content-type-builder.b10576e7.chunk.js +126 -0
  50. package/build/{email-settings-page.5bc22e5a.chunk.js → email-settings-page.dba83275.chunk.js} +4 -4
  51. package/build/en-json.d965e364.chunk.js +1 -0
  52. package/build/i18n-settings-page.55628f74.chunk.js +114 -0
  53. package/build/index.html +1 -1
  54. package/build/main.adab8b96.js +2630 -0
  55. package/build/{runtime~main.a096f3d0.js → runtime~main.0201a49b.js} +2 -2
  56. package/build/upload-settings.63d99bf5.chunk.js +14 -0
  57. package/build/upload.c50d8c7a.chunk.js +34 -0
  58. package/build/{users-advanced-settings-page.dd2a4954.chunk.js → users-advanced-settings-page.4f49ca57.chunk.js} +3 -3
  59. package/build/users-email-settings-page.d2429d0a.chunk.js +24 -0
  60. package/build/users-providers-settings-page.50c5ba27.chunk.js +29 -0
  61. package/build/{users-roles-settings-page.eeb3a339.chunk.js → users-roles-settings-page.2549794b.chunk.js} +2 -2
  62. package/build/webhook-edit-page.cb2cf1a5.chunk.js +128 -0
  63. package/build/webhook-list-page.e2fca9f8.chunk.js +71 -0
  64. package/ee/LICENSE +1 -21
  65. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +6 -1
  66. package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
  67. package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
  68. package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
  69. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +1 -1
  70. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +1 -1
  71. package/package.json +13 -15
  72. package/webpack.alias.js +0 -1
  73. package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -18
  74. package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +0 -18
  75. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +0 -13
  76. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +0 -72
  77. package/build/1387.437eb420.chunk.js +0 -1
  78. package/build/617.ce23dea8.chunk.js +0 -155
  79. package/build/7259.3ed2b60e.chunk.js +0 -1
  80. package/build/Admin-authenticatedApp.dbb99d34.chunk.js +0 -79
  81. package/build/Admin_settingsPage.20884a40.chunk.js +0 -79
  82. package/build/admin-app.d4fd9379.chunk.js +0 -63
  83. package/build/audit-logs-settings-page.48b921f9.chunk.js +0 -129
  84. package/build/content-type-builder-translation-en-json.5e5f8607.chunk.js +0 -1
  85. package/build/content-type-builder.51c64fe5.chunk.js +0 -126
  86. package/build/en-json.1f6af924.chunk.js +0 -1
  87. package/build/i18n-settings-page.1581894e.chunk.js +0 -114
  88. package/build/main.31bdf27e.js +0 -2679
  89. package/build/upload-settings.4d962053.chunk.js +0 -14
  90. package/build/upload.4dcd513f.chunk.js +0 -34
  91. package/build/users-email-settings-page.510648ab.chunk.js +0 -24
  92. package/build/users-providers-settings-page.0ee7d54f.chunk.js +0 -29
  93. package/build/webhook-edit-page.36c9f20d.chunk.js +0 -128
  94. 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);
@@ -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();
@@ -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) {
@@ -7,7 +7,6 @@ import {
7
7
  Button,
8
8
  Divider,
9
9
  Flex,
10
- FocusTrap,
11
10
  Icon,
12
11
  Portal,
13
12
  PopoverPrimitives,
@@ -119,103 +118,102 @@ const Onboarding = () => {
119
118
  <Portal>
120
119
  <PopoverPrimitives.Content
121
120
  padding={0}
121
+ onDimiss={handlePopoverVisibility}
122
122
  source={triggerRef}
123
123
  placement="top-end"
124
124
  spacing={12}
125
125
  >
126
- <FocusTrap onEscape={handlePopoverVisibility}>
127
- <Flex
128
- justifyContent="space-between"
129
- paddingBottom={5}
130
- paddingRight={6}
126
+ <Flex
127
+ justifyContent="space-between"
128
+ paddingBottom={5}
129
+ paddingRight={6}
130
+ paddingLeft={6}
131
+ paddingTop={6}
132
+ >
133
+ <TypographyLineHeight fontWeight="bold">
134
+ {formatMessage({
135
+ id: 'app.components.Onboarding.title',
136
+ defaultMessage: 'Get started videos',
137
+ })}
138
+ </TypographyLineHeight>
139
+ <TextLink
140
+ as="a"
141
+ href={WATCH_MORE.href}
142
+ target="_blank"
143
+ rel="noreferrer noopener"
144
+ variant="pi"
145
+ textColor="primary600"
146
+ >
147
+ {formatMessage(WATCH_MORE.label)}
148
+ </TextLink>
149
+ </Flex>
150
+ <Divider />
151
+ {VIDEO_LINKS.map(({ href, duration, label }, index) => (
152
+ <VideoLinkWrapper
153
+ as="a"
154
+ href={href}
155
+ target="_blank"
156
+ rel="noreferrer noopener"
157
+ key={href}
158
+ hasRadius
159
+ paddingTop={4}
160
+ paddingBottom={4}
131
161
  paddingLeft={6}
132
- paddingTop={6}
162
+ paddingRight={11}
133
163
  >
134
- <TypographyLineHeight fontWeight="bold">
135
- {formatMessage({
136
- id: 'app.components.Onboarding.title',
137
- defaultMessage: 'Get started videos',
138
- })}
139
- </TypographyLineHeight>
140
- <TextLink
141
- as="a"
142
- href={WATCH_MORE.href}
143
- target="_blank"
144
- rel="noreferrer noopener"
145
- variant="pi"
146
- textColor="primary600"
147
- >
148
- {formatMessage(WATCH_MORE.label)}
149
- </TextLink>
150
- </Flex>
151
- <Divider />
152
- {VIDEO_LINKS.map(({ href, duration, label }, index) => (
153
- <VideoLinkWrapper
154
- as="a"
155
- href={href}
156
- target="_blank"
157
- rel="noreferrer noopener"
158
- key={href}
159
- hasRadius
160
- paddingTop={4}
161
- paddingBottom={4}
162
- paddingLeft={6}
163
- paddingRight={11}
164
- >
165
- <Box paddingRight={5}>
166
- <Typography textColor="neutral200" variant="alpha">
167
- {index + 1}
168
- </Typography>
169
- </Box>
170
- <Box position="relative">
171
- <Preview src={onboardingPreview} alt="" />
172
- <IconWrapper
173
- position="absolute"
174
- top="50%"
175
- left="50%"
176
- background="primary600"
177
- borderRadius="50%"
178
- justifyContent="center"
179
- width={6}
180
- height={6}
181
- >
182
- <Icon as={Play} color="buttonNeutral0" width={3} height={3} />
183
- </IconWrapper>
184
- </Box>
185
- <Flex direction="column" alignItems="start" paddingLeft={4}>
186
- <Typography fontWeight="bold">{formatMessage(label)}</Typography>
187
- <VisuallyHidden>:</VisuallyHidden>
188
- <Typography textColor="neutral600" variant="pi">
189
- {duration}
190
- </Typography>
191
- </Flex>
192
- </VideoLinkWrapper>
164
+ <Box paddingRight={5}>
165
+ <Typography textColor="neutral200" variant="alpha">
166
+ {index + 1}
167
+ </Typography>
168
+ </Box>
169
+ <Box position="relative">
170
+ <Preview src={onboardingPreview} alt="" />
171
+ <IconWrapper
172
+ position="absolute"
173
+ top="50%"
174
+ left="50%"
175
+ background="primary600"
176
+ borderRadius="50%"
177
+ justifyContent="center"
178
+ width={6}
179
+ height={6}
180
+ >
181
+ <Icon as={Play} color="buttonNeutral0" width={3} height={3} />
182
+ </IconWrapper>
183
+ </Box>
184
+ <Flex direction="column" alignItems="start" paddingLeft={4}>
185
+ <Typography fontWeight="bold">{formatMessage(label)}</Typography>
186
+ <VisuallyHidden>:</VisuallyHidden>
187
+ <Typography textColor="neutral600" variant="pi">
188
+ {duration}
189
+ </Typography>
190
+ </Flex>
191
+ </VideoLinkWrapper>
192
+ ))}
193
+ <Flex
194
+ direction="column"
195
+ alignItems="stretch"
196
+ gap={2}
197
+ paddingLeft={5}
198
+ paddingTop={2}
199
+ paddingBottom={5}
200
+ >
201
+ {docLinks.map(({ label, href, icon }) => (
202
+ <Flex gap={3} key={href}>
203
+ <Icon as={icon} color="primary600" />
204
+ <TextLink
205
+ as="a"
206
+ href={href}
207
+ target="_blank"
208
+ rel="noreferrer noopener"
209
+ variant="sigma"
210
+ textColor="primary700"
211
+ >
212
+ {formatMessage(label)}
213
+ </TextLink>
214
+ </Flex>
193
215
  ))}
194
- <Flex
195
- direction="column"
196
- alignItems="stretch"
197
- gap={2}
198
- paddingLeft={5}
199
- paddingTop={2}
200
- paddingBottom={5}
201
- >
202
- {docLinks.map(({ label, href, icon }) => (
203
- <Flex gap={3} key={href}>
204
- <Icon as={icon} color="primary600" />
205
- <TextLink
206
- as="a"
207
- href={href}
208
- target="_blank"
209
- rel="noreferrer noopener"
210
- variant="sigma"
211
- textColor="primary700"
212
- >
213
- {formatMessage(label)}
214
- </TextLink>
215
- </Flex>
216
- ))}
217
- </Flex>
218
- </FocusTrap>
216
+ </Flex>
219
217
  </PopoverPrimitives.Content>
220
218
  </Portal>
221
219
  )}