@strapi/admin 4.11.0-alpha.0 → 4.11.0-beta.0

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 (147) 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 +47 -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/en.json +11 -9
  48. package/build/1387.a86ac314.chunk.js +1 -0
  49. package/build/{1657.45231968.chunk.js → 1657.ca8562dd.chunk.js} +17 -17
  50. package/build/3081.c2cdfac8.chunk.js +108 -0
  51. package/build/{3562.57745ccd.chunk.js → 3562.e0b1a0b3.chunk.js} +6 -6
  52. package/build/3816.60f858cf.chunk.js +211 -0
  53. package/build/462.a073ff1f.chunk.js +71 -0
  54. package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
  55. package/build/5542.002522eb.chunk.js +71 -0
  56. package/build/5563.79950369.chunk.js +79 -0
  57. package/build/617.87b2fe96.chunk.js +155 -0
  58. package/build/6970.7ea35fbd.chunk.js +1 -0
  59. package/build/7259.5cc67413.chunk.js +1 -0
  60. package/build/Admin-authenticatedApp.65172a0c.chunk.js +79 -0
  61. package/build/Admin_homePage.107a9fe0.chunk.js +73 -0
  62. package/build/Admin_marketplace.717bd7ca.chunk.js +55 -0
  63. package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
  64. package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.a8fa3a56.chunk.js} +1 -1
  65. package/build/Admin_settingsPage.bd715ed3.chunk.js +79 -0
  66. package/build/{Upload_ConfigureTheView.d429a7fc.chunk.js → Upload_ConfigureTheView.aa64ed9a.chunk.js} +1 -1
  67. package/build/admin-app.9c79b484.chunk.js +63 -0
  68. package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.0d12b741.chunk.js} +43 -41
  69. package/build/admin-edit-users.f9ce7844.chunk.js +10 -0
  70. package/build/admin-roles-list.e8bf9685.chunk.js +31 -0
  71. package/build/admin-users.751b28b2.chunk.js +34 -0
  72. package/build/audit-logs-settings-page.3c6cea81.chunk.js +129 -0
  73. package/build/{content-manager.cf467ecc.chunk.js → content-manager.bf060d8e.chunk.js} +95 -95
  74. package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
  75. package/build/content-type-builder-translation-en-json.af293c9e.chunk.js +1 -0
  76. package/build/content-type-builder.b10576e7.chunk.js +126 -0
  77. package/build/email-settings-page.dba83275.chunk.js +11 -0
  78. package/build/en-json.19e9ff9b.chunk.js +1 -0
  79. package/build/i18n-settings-page.55628f74.chunk.js +114 -0
  80. package/build/index.html +1 -1
  81. package/build/main.576a9d22.js +2630 -0
  82. package/build/review-workflows-settings.4b39b837.chunk.js +61 -0
  83. package/build/{runtime~main.1074f2bb.js → runtime~main.96d92f16.js} +2 -2
  84. package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.265e3d72.chunk.js} +1 -1
  85. package/build/upload-settings.63d99bf5.chunk.js +14 -0
  86. package/build/upload.c50d8c7a.chunk.js +34 -0
  87. package/build/users-advanced-settings-page.4f49ca57.chunk.js +9 -0
  88. package/build/users-email-settings-page.d2429d0a.chunk.js +24 -0
  89. package/build/users-providers-settings-page.50c5ba27.chunk.js +29 -0
  90. package/build/{users-roles-settings-page.eeb3a339.chunk.js → users-roles-settings-page.2549794b.chunk.js} +2 -2
  91. package/build/webhook-edit-page.ddd5963d.chunk.js +128 -0
  92. package/build/webhook-list-page.e2fca9f8.chunk.js +71 -0
  93. package/ee/LICENSE +1 -21
  94. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -2
  95. package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
  96. package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
  97. package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
  98. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +36 -28
  99. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +1 -1
  100. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +3 -3
  101. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +32 -21
  102. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +1 -1
  103. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +1 -1
  104. package/ee/server/services/audit-logs.js +5 -1
  105. package/package.json +14 -17
  106. package/webpack.alias.js +0 -2
  107. package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -18
  108. package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +0 -18
  109. package/admin/src/hooks/useModels/index.js +0 -58
  110. package/admin/src/hooks/useModels/reducer.js +0 -45
  111. package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +0 -20
  112. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +0 -13
  113. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +0 -72
  114. package/build/1387.84b454d3.chunk.js +0 -1
  115. package/build/3081.bcf9a12f.chunk.js +0 -108
  116. package/build/462.8fff7f3b.chunk.js +0 -71
  117. package/build/5542.b8240e3f.chunk.js +0 -70
  118. package/build/5563.986609ed.chunk.js +0 -79
  119. package/build/6404.68405699.chunk.js +0 -100
  120. package/build/6970.5159b068.chunk.js +0 -1
  121. package/build/7259.7a48aa2f.chunk.js +0 -1
  122. package/build/7725.1633e06f.chunk.js +0 -213
  123. package/build/Admin-authenticatedApp.27a2329f.chunk.js +0 -79
  124. package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
  125. package/build/Admin_marketplace.5f7b89e5.chunk.js +0 -55
  126. package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
  127. package/build/Admin_settingsPage.9d0419bc.chunk.js +0 -79
  128. package/build/admin-app.8e1f56bc.chunk.js +0 -63
  129. package/build/admin-edit-users.2aae89f5.chunk.js +0 -10
  130. package/build/admin-roles-list.c759daa3.chunk.js +0 -31
  131. package/build/admin-users.04a823ca.chunk.js +0 -34
  132. package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
  133. package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
  134. package/build/content-type-builder-translation-en-json.5e5f8607.chunk.js +0 -1
  135. package/build/content-type-builder.4737a30c.chunk.js +0 -126
  136. package/build/email-settings-page.dc07d518.chunk.js +0 -10
  137. package/build/en-json.7edb00f6.chunk.js +0 -1
  138. package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
  139. package/build/main.14dca275.js +0 -2592
  140. package/build/review-workflows-settings.6a662ebd.chunk.js +0 -61
  141. package/build/upload-settings.dd2d987c.chunk.js +0 -13
  142. package/build/upload.c8479232.chunk.js +0 -33
  143. package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
  144. package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
  145. package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
  146. package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
  147. package/build/webhook-list-page.30d73114.chunk.js +0 -71
@@ -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
  )}
@@ -6,7 +6,6 @@
6
6
 
7
7
  import React, { useEffect, useState, useMemo, lazy, Suspense } from 'react';
8
8
  import { Switch, Route } from 'react-router-dom';
9
- import axios from 'axios';
10
9
  import {
11
10
  LoadingIndicatorPage,
12
11
  auth,
@@ -100,10 +99,7 @@ function App() {
100
99
  setTelemetryProperties(properties);
101
100
 
102
101
  try {
103
- /**
104
- * TODO: remove this call to `axios`
105
- */
106
- await axios.post('https://analytics.strapi.io/api/v2/track', {
102
+ await post('https://analytics.strapi.io/api/v2/track', {
107
103
  // This event is anonymous
108
104
  event: 'didInitializeAdministration',
109
105
  userId: '',
@@ -5,7 +5,6 @@ import omit from 'lodash/omit';
5
5
  import { useHistory } from 'react-router-dom';
6
6
  import PropTypes from 'prop-types';
7
7
  import { Formik } from 'formik';
8
- import axios from 'axios';
9
8
  import {
10
9
  Form,
11
10
  useQuery,
@@ -14,6 +13,7 @@ import {
14
13
  getYupInnerErrors,
15
14
  Link,
16
15
  useAPIErrorHandler,
16
+ useFetchClient,
17
17
  } from '@strapi/helper-plugin';
18
18
  import {
19
19
  Box,
@@ -52,6 +52,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
52
52
  const { formatMessage } = useIntl();
53
53
  const query = useQuery();
54
54
  const { formatAPIError } = useAPIErrorHandler();
55
+ const { get } = useFetchClient();
55
56
 
56
57
  const registrationToken = query.get('registrationToken');
57
58
 
@@ -61,9 +62,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
61
62
  try {
62
63
  const {
63
64
  data: { data },
64
- } = await axios.get(
65
- `${strapi.backendURL}/admin/registration-info?registrationToken=${registrationToken}`
66
- );
65
+ } = await get(`/admin/registration-info?registrationToken=${registrationToken}`);
67
66
 
68
67
  if (data) {
69
68
  setUserInfo(data);
@@ -4,7 +4,7 @@ import camelCase from 'lodash/camelCase';
4
4
  import get from 'lodash/get';
5
5
  import omit from 'lodash/omit';
6
6
  import { Redirect, useRouteMatch, useHistory } from 'react-router-dom';
7
- import { auth, useQuery, useGuidedTour, useTracking } from '@strapi/helper-plugin';
7
+ import { auth, useQuery, useGuidedTour, useTracking, useFetchClient } from '@strapi/helper-plugin';
8
8
  import PropTypes from 'prop-types';
9
9
  import forms from 'ee_else_ce/pages/AuthPage/utils/forms';
10
10
  import persistStateToLocaleStorage from '../../components/GuidedTour/utils/persistStateToLocaleStorage';
@@ -46,6 +46,8 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
46
46
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
47
  }, []);
48
48
 
49
+ const { post } = useFetchClient();
50
+
49
51
  // Reset the state on navigation change
50
52
  useEffect(() => {
51
53
  dispatch({
@@ -85,12 +87,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
85
87
 
86
88
  const forgotPasswordRequest = async (body, requestURL, { setSubmitting, setErrors }) => {
87
89
  try {
88
- await axios({
89
- method: 'POST',
90
- url: `${strapi.backendURL}${requestURL}`,
91
- data: body,
92
- cancelToken: source.token,
93
- });
90
+ await post(requestURL, body, { cancelToken: source.token });
94
91
 
95
92
  push('/auth/forgot-password-success');
96
93
  } catch (err) {
@@ -108,12 +105,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
108
105
  data: {
109
106
  data: { token, user },
110
107
  },
111
- } = await axios({
112
- method: 'POST',
113
- url: `${strapi.backendURL}${requestURL}`,
114
- data: omit(body, fieldsToOmit),
115
- cancelToken: source.token,
116
- });
108
+ } = await post(requestURL, omit(body, fieldsToOmit), { cancelToken: source.token });
117
109
 
118
110
  if (user.preferedLanguage) {
119
111
  changeLocale(user.preferedLanguage);
@@ -151,17 +143,11 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
151
143
  const registerRequest = async (body, requestURL, { setSubmitting, setErrors }) => {
152
144
  try {
153
145
  trackUsage('willCreateFirstAdmin');
154
-
155
146
  const {
156
147
  data: {
157
148
  data: { token, user },
158
149
  },
159
- } = await axios({
160
- method: 'POST',
161
- url: `${strapi.backendURL}${requestURL}`,
162
- data: omit(body, fieldsToOmit),
163
- cancelToken: source.token,
164
- });
150
+ } = await post(requestURL, omit(body, fieldsToOmit), { cancelToken: source.token });
165
151
 
166
152
  auth.setToken(token, false);
167
153
  auth.setUserInfo(user, false);
@@ -212,12 +198,11 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
212
198
  data: {
213
199
  data: { token, user },
214
200
  },
215
- } = await axios({
216
- method: 'POST',
217
- url: `${strapi.backendURL}${requestURL}`,
218
- data: { ...body, resetPasswordToken: query.get('code') },
219
- cancelToken: source.token,
220
- });
201
+ } = await post(
202
+ requestURL,
203
+ { ...body, resetPasswordToken: query.get('code') },
204
+ { cancelToken: source.token }
205
+ );
221
206
 
222
207
  auth.setToken(token, false);
223
208
  auth.setUserInfo(user, false);
@@ -11,8 +11,9 @@ import { useHistory } from 'react-router-dom';
11
11
  import { LoadingIndicatorPage, useGuidedTour } from '@strapi/helper-plugin';
12
12
  import { Layout, Main, Box, Grid, GridItem } from '@strapi/design-system';
13
13
  import useLicenseLimitNotification from 'ee_else_ce/hooks/useLicenseLimitNotification';
14
+
14
15
  import cornerOrnamentPath from './assets/corner-ornament.svg';
15
- import { useModels } from '../../hooks';
16
+ import { useContentTypes } from '../../hooks/useContentTypes';
16
17
  import isGuidedTourCompleted from '../../components/GuidedTour/utils/isGuidedTourCompleted';
17
18
  import GuidedTourHomepage from '../../components/GuidedTour/Homepage';
18
19
  import SocialLinks from './SocialLinks';
@@ -31,7 +32,7 @@ const LogoContainer = styled(Box)`
31
32
 
32
33
  const HomePage = () => {
33
34
  // Temporary until we develop the menu API
34
- const { collectionTypes, singleTypes, isLoading: isLoadingForModels } = useModels();
35
+ const { collectionTypes, singleTypes, isLoading: isLoadingForModels } = useContentTypes();
35
36
  const { guidedTourState, isGuidedTourVisible, isSkipped } = useGuidedTour();
36
37
  useLicenseLimitNotification();
37
38
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
- import { useNotification, useTracking } from '@strapi/helper-plugin';
4
+ import { useNotification, useTracking, useClipboard } from '@strapi/helper-plugin';
5
5
  import { Box, Icon, Typography } from '@strapi/design-system';
6
6
  import { Check } from '@strapi/icons';
7
7
  import CardButton from './CardButton';
@@ -17,14 +17,18 @@ const InstallPluginButton = ({
17
17
  const toggleNotification = useNotification();
18
18
  const { formatMessage } = useIntl();
19
19
  const { trackUsage } = useTracking();
20
+ const { copy } = useClipboard();
20
21
 
21
- const handleCopy = () => {
22
- navigator.clipboard.writeText(commandToCopy);
23
- trackUsage('willInstallPlugin');
24
- toggleNotification({
25
- type: 'success',
26
- message: { id: 'admin.pages.MarketPlacePage.plugin.copy.success' },
27
- });
22
+ const handleCopy = async () => {
23
+ const didCopy = await copy(commandToCopy);
24
+
25
+ if (didCopy) {
26
+ trackUsage('willInstallPlugin');
27
+ toggleNotification({
28
+ type: 'success',
29
+ message: { id: 'admin.pages.MarketPlacePage.plugin.copy.success' },
30
+ });
31
+ }
28
32
  };
29
33
 
30
34
  // Already installed
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
- import { Popover, Flex, FocusTrap } from '@strapi/design-system';
4
+ import { Popover, Flex } from '@strapi/design-system';
5
5
  import { useIntl } from 'react-intl';
6
6
  import FilterSelect from './FilterSelect';
7
7
 
@@ -18,60 +18,58 @@ const FiltersPopover = ({
18
18
  const { formatMessage } = useIntl();
19
19
 
20
20
  return (
21
- <Popover source={source} padding={3} spacing={4} onBlur={() => {}}>
22
- <FocusTrap onEscape={onToggle}>
23
- <FiltersFlex direction="column" alignItems="stretch" gap={1}>
21
+ <Popover source={source} onDismiss={onToggle} padding={3} spacing={4}>
22
+ <FiltersFlex direction="column" alignItems="stretch" gap={1}>
23
+ <FilterSelect
24
+ message={formatMessage({
25
+ id: 'admin.pages.MarketPlacePage.filters.collections',
26
+ defaultMessage: 'Collections',
27
+ })}
28
+ value={query?.collections || []}
29
+ onChange={(newCollections) => {
30
+ const update = { collections: newCollections };
31
+ handleSelectChange(update);
32
+ }}
33
+ onClear={() => handleSelectClear('collections')}
34
+ possibleFilters={possibleCollections}
35
+ customizeContent={(values) =>
36
+ formatMessage(
37
+ {
38
+ id: 'admin.pages.MarketPlacePage.filters.collectionsSelected',
39
+ defaultMessage:
40
+ '{count, plural, =0 {No collections} one {# collection} other {# collections}} selected',
41
+ },
42
+ { count: values.length }
43
+ )
44
+ }
45
+ />
46
+ {npmPackageType === 'plugin' && (
24
47
  <FilterSelect
25
48
  message={formatMessage({
26
- id: 'admin.pages.MarketPlacePage.filters.collections',
27
- defaultMessage: 'Collections',
49
+ id: 'admin.pages.MarketPlacePage.filters.categories',
50
+ defaultMessage: 'Categories',
28
51
  })}
29
- value={query?.collections || []}
30
- onChange={(newCollections) => {
31
- const update = { collections: newCollections };
52
+ value={query?.categories || []}
53
+ onChange={(newCategories) => {
54
+ const update = { categories: newCategories };
32
55
  handleSelectChange(update);
33
56
  }}
34
- onClear={() => handleSelectClear('collections')}
35
- possibleFilters={possibleCollections}
57
+ onClear={() => handleSelectClear('categories')}
58
+ possibleFilters={possibleCategories}
36
59
  customizeContent={(values) =>
37
60
  formatMessage(
38
61
  {
39
- id: 'admin.pages.MarketPlacePage.filters.collectionsSelected',
62
+ id: 'admin.pages.MarketPlacePage.filters.categoriesSelected',
40
63
  defaultMessage:
41
- '{count, plural, =0 {No collections} one {# collection} other {# collections}} selected',
64
+ '{count, plural, =0 {No categories} one {# category} other {# categories}} selected',
42
65
  },
43
66
  { count: values.length }
44
67
  )
45
68
  }
69
+ name="categories"
46
70
  />
47
- {npmPackageType === 'plugin' && (
48
- <FilterSelect
49
- message={formatMessage({
50
- id: 'admin.pages.MarketPlacePage.filters.categories',
51
- defaultMessage: 'Categories',
52
- })}
53
- value={query?.categories || []}
54
- onChange={(newCategories) => {
55
- const update = { categories: newCategories };
56
- handleSelectChange(update);
57
- }}
58
- onClear={() => handleSelectClear('categories')}
59
- possibleFilters={possibleCategories}
60
- customizeContent={(values) =>
61
- formatMessage(
62
- {
63
- id: 'admin.pages.MarketPlacePage.filters.categoriesSelected',
64
- defaultMessage:
65
- '{count, plural, =0 {No categories} one {# category} other {# categories}} selected',
66
- },
67
- { count: values.length }
68
- )
69
- }
70
- name="categories"
71
- />
72
- )}
73
- </FiltersFlex>
74
- </FocusTrap>
71
+ )}
72
+ </FiltersFlex>
75
73
  </Popover>
76
74
  );
77
75
  };
@@ -1,8 +1,8 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { useNotifyAT } from '@strapi/design-system';
4
- import useFetchMarketplacePlugins from '../../../hooks/useFetchMarketplacePlugins';
5
- import useFetchMarketplaceProviders from '../../../hooks/useFetchMarketplaceProviders';
4
+ import useFetchMarketplacePlugins from '../../../hooks/marketplace/useFetchMarketplacePlugins';
5
+ import useFetchMarketplaceProviders from '../../../hooks/marketplace/useFetchMarketplaceProviders';
6
6
 
7
7
  function useMarketplaceData({ npmPackageType, debouncedSearch, query, tabQuery }) {
8
8
  const { notifyStatus } = useNotifyAT();
@@ -1,44 +1,46 @@
1
- import React, { useRef } from 'react';
1
+ import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
- import { ContentBox, useNotification, useTracking } from '@strapi/helper-plugin';
3
+ import { ContentBox, useNotification, useTracking, useClipboard } from '@strapi/helper-plugin';
4
4
  import { IconButton } from '@strapi/design-system';
5
5
  import { Duplicate, Key } from '@strapi/icons';
6
6
  import PropTypes from 'prop-types';
7
- import { CopyToClipboard } from 'react-copy-to-clipboard';
8
7
 
9
8
  const TokenBox = ({ token, tokenType }) => {
10
9
  const { formatMessage } = useIntl();
11
10
  const toggleNotification = useNotification();
12
11
  const { trackUsage } = useTracking();
13
- const trackUsageRef = useRef(trackUsage);
12
+
13
+ const { copy } = useClipboard();
14
+
15
+ const handleClick = (token) => async () => {
16
+ const didCopy = await copy(token);
17
+
18
+ if (didCopy) {
19
+ trackUsage.current('didCopyTokenKey', {
20
+ tokenType,
21
+ });
22
+ toggleNotification({
23
+ type: 'success',
24
+ message: { id: 'Settings.tokens.notification.copied' },
25
+ });
26
+ }
27
+ };
14
28
 
15
29
  return (
16
30
  <ContentBox
17
31
  endAction={
18
32
  token && (
19
33
  <span style={{ alignSelf: 'start' }}>
20
- <CopyToClipboard
21
- onCopy={() => {
22
- trackUsageRef.current('didCopyTokenKey', {
23
- tokenType,
24
- });
25
- toggleNotification({
26
- type: 'success',
27
- message: { id: 'Settings.tokens.notification.copied' },
28
- });
29
- }}
30
- text={token}
31
- >
32
- <IconButton
33
- label={formatMessage({
34
- id: 'app.component.CopyToClipboard.label',
35
- defaultMessage: 'Copy to clipboard',
36
- })}
37
- noBorder
38
- icon={<Duplicate />}
39
- style={{ padding: 0, height: '1rem' }}
40
- />
41
- </CopyToClipboard>
34
+ <IconButton
35
+ label={formatMessage({
36
+ id: 'app.component.CopyToClipboard.label',
37
+ defaultMessage: 'Copy to clipboard',
38
+ })}
39
+ onClick={handleClick(token)}
40
+ noBorder
41
+ icon={<Duplicate />}
42
+ style={{ padding: 0, height: '1rem' }}
43
+ />
42
44
  </span>
43
45
  )
44
46
  }
@@ -12,7 +12,7 @@ const TokenDescription = ({ errors, values, onChange, canEditInputs }) => {
12
12
  id: 'Settings.tokens.form.description',
13
13
  defaultMessage: 'Description',
14
14
  })}
15
- name="description"
15
+ id="description"
16
16
  error={
17
17
  errors.description
18
18
  ? formatMessage(
@@ -1,8 +1,9 @@
1
- import axios from 'axios';
1
+ import { getFetchClient } from '@strapi/helper-plugin';
2
2
 
3
3
  const urlToFile = async (url) => {
4
4
  try {
5
- const res = await axios.get(url, { responseType: 'blob', timeout: 8000 });
5
+ const { get } = getFetchClient();
6
+ const res = await get(url, { responseType: 'blob', timeout: 8000 });
6
7
  const loadedFile = new File([res.data], res.config.url, {
7
8
  type: res.headers['content-type'],
8
9
  });
@@ -219,7 +219,7 @@ const CreatePage = () => {
219
219
  id: 'global.description',
220
220
  defaultMessage: 'Description',
221
221
  })}
222
- name="description"
222
+ id="description"
223
223
  error={errors.description && formatMessage({ id: errors.description })}
224
224
  onChange={handleChange}
225
225
  >
@@ -74,7 +74,7 @@ const RoleForm = ({ disabled, role, values, errors, onChange, onBlur }) => {
74
74
  id: 'global.description',
75
75
  defaultMessage: 'Description',
76
76
  })}
77
- name="description"
77
+ id="description"
78
78
  error={errors.name && formatMessage({ id: errors.name })}
79
79
  onChange={onChange}
80
80
  onBlur={onBlur}