@strapi/admin 4.12.4 → 4.12.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.
- package/admin/src/StrapiApp.js +1 -1
- package/admin/src/components/AuthenticatedApp.js +229 -0
- package/admin/src/components/GuidedTour/Modal/index.js +1 -3
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +7 -30
- package/admin/src/content-manager/hooks/useSyncRbac/index.js +10 -2
- package/admin/src/content-manager/pages/App/index.js +5 -16
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/Information/index.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/index.js +2 -2
- package/admin/src/content-manager/pages/ListSettingsView/index.js +16 -41
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +2 -2
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +27 -1
- package/admin/src/content-manager/pages/ListViewLayoutManager/index.js +2 -2
- package/admin/src/hooks/useSettingsForm/index.js +14 -3
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +1 -3
- package/admin/src/hooks/useSettingsMenu/utils/sortLinks.js +1 -3
- package/admin/src/index.js +1 -1
- package/admin/src/pages/Admin/Onboarding/index.js +1 -3
- package/admin/src/pages/Admin/index.js +80 -74
- package/admin/src/pages/App/constants.js +1 -1
- package/admin/src/pages/App/index.js +160 -122
- package/admin/src/pages/AuthPage/index.js +2 -4
- package/admin/src/pages/HomePage/index.js +1 -3
- package/admin/src/pages/InstalledPluginsPage/index.js +1 -3
- package/admin/src/pages/{InternalErrorPage/index.js → InternalErrorPage.js} +3 -4
- package/admin/src/pages/MarketplacePage/index.js +0 -1
- package/admin/src/pages/{NotFoundPage/index.js → NotFoundPage.js} +1 -3
- package/admin/src/pages/ProfilePage/index.js +2 -4
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +3 -3
- package/admin/src/pages/SettingsPage/constants.js +67 -132
- package/admin/src/pages/SettingsPage/index.js +31 -36
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +24 -31
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +69 -35
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +4 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -0
- package/admin/src/pages/UseCasePage.js +174 -0
- package/admin/src/translations/zh-Hans.json +918 -902
- package/admin/src/utils/createRoute.js +5 -7
- package/admin/src/utils/formatAPIErrors.js +1 -3
- package/admin/src/utils/getFullName.js +1 -1
- package/admin/src/utils/sortLinks.js +1 -3
- package/admin/src/utils/uniqueAdminHash.js +2 -9
- package/build/{1049.f76cb14b.chunk.js → 1049.9d69d231.chunk.js} +1 -1
- package/build/1504.eff012f7.chunk.js +95 -0
- package/build/2166.c837469a.chunk.js +1 -0
- package/build/2225.33287e1b.chunk.js +79 -0
- package/build/2237.03792b63.chunk.js +114 -0
- package/build/2379.401f56f3.chunk.js +1 -0
- package/build/2395.e6a79fbb.chunk.js +26 -0
- package/build/{9806.3392505e.chunk.js → 2747.d1442a90.chunk.js} +78 -70
- package/build/2801.31393ffe.chunk.js +1 -0
- package/build/3483.8517171f.chunk.js +1 -0
- package/build/4546.7a3c0d03.chunk.js +1 -0
- package/build/502.8dd074ff.chunk.js +1 -0
- package/build/5483.5bfbb00d.chunk.js +6 -0
- package/build/7464.592a9295.chunk.js +1 -0
- package/build/748.fd2e5afd.chunk.js +105 -0
- package/build/773.6381d62d.chunk.js +18 -0
- package/build/7826.399afe81.chunk.js +103 -0
- package/build/8261.2525d35c.chunk.js +7 -0
- package/build/8276.e519a707.chunk.js +26 -0
- package/build/8299.62b67c72.chunk.js +1 -0
- package/build/Admin-AuthPage.90d64342.chunk.js +35 -0
- package/build/Admin-AuthenticatedApp.379ac945.chunk.js +24 -0
- package/build/Admin-UseCasePage.1f757db5.chunk.js +13 -0
- package/build/Admin_GuidedTourModal.8ccf1fbc.chunk.js +12 -0
- package/build/Admin_InternalErrorPage.9de92c6d.chunk.js +9 -0
- package/build/Admin_NotFoundPage.21620424.chunk.js +9 -0
- package/build/Admin_Onboarding.dbfa32f6.chunk.js +43 -0
- package/build/Admin_homePage.2000cbe9.chunk.js +86 -0
- package/build/Admin_marketplace.ec80e29b.chunk.js +63 -0
- package/build/Admin_pluginsPage.0c6851f8.chunk.js +14 -0
- package/build/Admin_profilePage.78cd8495.chunk.js +21 -0
- package/build/Admin_settingsPage.1760c3ce.chunk.js +119 -0
- package/build/StrapiApp.221fac30.chunk.js +5 -0
- package/build/{admin-edit-roles-page.6d567273.chunk.js → admin-edit-roles-page.24bdf746.chunk.js} +1 -1
- package/build/admin-edit-users.5d10d444.chunk.js +10 -0
- package/build/admin-users.2b3e4305.chunk.js +11 -0
- package/build/api-tokens-list-page.0af7d431.chunk.js +16 -0
- package/build/audit-logs-settings-page.0f73ccf8.chunk.js +1 -0
- package/build/content-manager.fb0833bd.chunk.js +1099 -0
- package/build/{content-type-builder.40534de5.chunk.js → content-type-builder.66066281.chunk.js} +18 -18
- package/build/email-settings-page.2f7e35c0.chunk.js +11 -0
- package/build/i18n-translation-ru-json.a3dbc125.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.ee3c1938.js +2859 -0
- package/build/review-workflows-settings-create-view.d24a32b9.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.6044b022.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.3f0ef4bc.chunk.js +56 -0
- package/build/runtime~main.397ee447.js +2 -0
- package/build/{sso-settings-page.12b6d8ae.chunk.js → sso-settings-page.4dba0670.chunk.js} +1 -1
- package/build/transfer-tokens-list-page.d6986b03.chunk.js +16 -0
- package/build/users-advanced-settings-page.17052d72.chunk.js +9 -0
- package/build/users-email-settings-page.3de8ea50.chunk.js +9 -0
- package/build/users-permissions-translation-zh-Hans-json.8d82c809.chunk.js +1 -0
- package/build/users-providers-settings-page.0eaa916d.chunk.js +14 -0
- package/build/users-roles-settings-page.957ad48b.chunk.js +55 -0
- package/build/webhook-edit-page.665210af.chunk.js +33 -0
- package/build/zh-Hans-json.97efd015.chunk.js +1 -0
- package/ee/admin/hooks/useAuthProviders.js +25 -0
- package/ee/admin/hooks/{useLicenseLimitNotification/index.js → useLicenseLimitNotification.js} +2 -4
- package/ee/admin/hooks/{useLicenseLimits/useLicenseLimits.js → useLicenseLimits.js} +4 -1
- package/ee/admin/pages/App/constants.js +6 -5
- package/ee/admin/pages/AuthPage/components/Login/index.js +8 -4
- package/ee/admin/pages/AuthPage/components/Providers/index.js +8 -5
- package/ee/admin/pages/HomePage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/constants.js +27 -42
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/package.json +10 -10
- package/admin/src/components/AuthenticatedApp/index.js +0 -118
- package/admin/src/components/AuthenticatedApp/utils/api.js +0 -85
- package/admin/src/components/AuthenticatedApp/utils/checkLatestStrapiVersion.js +0 -11
- package/admin/src/components/PluginsInitializer/index.js +0 -68
- package/admin/src/components/PluginsInitializer/init.js +0 -11
- package/admin/src/components/PluginsInitializer/reducer.js +0 -22
- package/admin/src/layouts/AppLayout/index.js +0 -33
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -23
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +0 -11
- package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +0 -5
- package/admin/src/pages/SettingsPage/utils/index.js +0 -2
- package/admin/src/pages/UseCasePage/index.js +0 -175
- package/admin/src/utils/checkFormValidity.js +0 -15
- package/admin/src/utils/getAttributesToDisplay.js +0 -19
- package/admin/src/utils/getExistingActions.js +0 -32
- package/admin/src/utils/index.js +0 -9
- package/admin/src/utils/makeUniqueRoutes.js +0 -6
- package/build/1386.879bcd90.chunk.js +0 -7
- package/build/2225.c6244756.chunk.js +0 -79
- package/build/2379.f1641312.chunk.js +0 -1
- package/build/2395.46f8d0c1.chunk.js +0 -26
- package/build/2801.5cef5ec8.chunk.js +0 -1
- package/build/3483.03c24f96.chunk.js +0 -1
- package/build/3739.63e352f1.chunk.js +0 -103
- package/build/3929.5632f24d.chunk.js +0 -114
- package/build/448.829e1344.chunk.js +0 -1
- package/build/4546.cfafae68.chunk.js +0 -1
- package/build/502.8ae8ef60.chunk.js +0 -1
- package/build/5483.6dd2e776.chunk.js +0 -6
- package/build/5542.2415a393.chunk.js +0 -63
- package/build/6691.4985ef22.chunk.js +0 -105
- package/build/7464.3e64a1d5.chunk.js +0 -1
- package/build/8276.10a3f883.chunk.js +0 -26
- package/build/9944.7af075a5.chunk.js +0 -26
- package/build/Admin-authenticatedApp.f5ece8ff.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.f45f2462.chunk.js +0 -1
- package/build/Admin_homePage.ac9dfb86.chunk.js +0 -81
- package/build/Admin_marketplace.dde9c148.chunk.js +0 -55
- package/build/Admin_pluginsPage.bbe79434.chunk.js +0 -6
- package/build/Admin_profilePage.192edc52.chunk.js +0 -13
- package/build/Admin_settingsPage.97cb9d41.chunk.js +0 -111
- package/build/admin-app.91898385.chunk.js +0 -36
- package/build/admin-edit-users.79eeb125.chunk.js +0 -10
- package/build/admin-users.123aa08e.chunk.js +0 -11
- package/build/api-tokens-list-page.505bf7e0.chunk.js +0 -16
- package/build/audit-logs-settings-page.4b422831.chunk.js +0 -1
- package/build/content-manager.2af15f57.chunk.js +0 -1099
- package/build/email-settings-page.d494d1eb.chunk.js +0 -11
- package/build/i18n-translation-ru-json.401bc498.chunk.js +0 -1
- package/build/main.f13fc96c.js +0 -2856
- package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +0 -1
- package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +0 -56
- package/build/runtime~main.bb4efc54.js +0 -2
- package/build/transfer-tokens-list-page.22147d2c.chunk.js +0 -16
- package/build/users-advanced-settings-page.f0760eb8.chunk.js +0 -9
- package/build/users-email-settings-page.ff4b32f3.chunk.js +0 -9
- package/build/users-permissions-translation-zh-Hans-json.6ab714ee.chunk.js +0 -1
- package/build/users-providers-settings-page.48de0306.chunk.js +0 -14
- package/build/users-roles-settings-page.3f9f063e.chunk.js +0 -30
- package/build/webhook-edit-page.6cb479ff.chunk.js +0 -33
- package/build/zh-Hans-json.937b395b.chunk.js +0 -1
- package/ee/admin/hooks/index.js +0 -4
- package/ee/admin/hooks/useAuthProviders/index.js +0 -50
- package/ee/admin/hooks/useAuthProviders/reducer.js +0 -26
- package/ee/admin/hooks/useLicenseLimits/index.js +0 -1
- /package/ee/admin/hooks/{useLicenseLimits/__mocks__/index.js → __mocks__/useLicenseLimits.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -14,8 +14,11 @@ import {
|
|
|
14
14
|
Typography,
|
|
15
15
|
} from '@strapi/design-system';
|
|
16
16
|
import {
|
|
17
|
+
prefixFileUrlWithBackendUrl,
|
|
17
18
|
SettingsPageTitle,
|
|
19
|
+
useAPIErrorHandler,
|
|
18
20
|
useAppInfo,
|
|
21
|
+
useFetchClient,
|
|
19
22
|
useFocusWhenNavigate,
|
|
20
23
|
useNotification,
|
|
21
24
|
useRBAC,
|
|
@@ -23,7 +26,7 @@ import {
|
|
|
23
26
|
} from '@strapi/helper-plugin';
|
|
24
27
|
import { Check, ExternalLink } from '@strapi/icons';
|
|
25
28
|
import { useIntl } from 'react-intl';
|
|
26
|
-
import { useMutation, useQuery
|
|
29
|
+
import { useMutation, useQuery } from 'react-query';
|
|
27
30
|
import { useSelector } from 'react-redux';
|
|
28
31
|
|
|
29
32
|
import { useConfigurations } from '../../../../hooks';
|
|
@@ -31,18 +34,20 @@ import { useEnterprise } from '../../../../hooks/useEnterprise';
|
|
|
31
34
|
import { selectAdminPermissions } from '../../../App/selectors';
|
|
32
35
|
|
|
33
36
|
import CustomizationInfos from './components/CustomizationInfos';
|
|
34
|
-
import { fetchProjectSettings, postProjectSettings } from './utils/api';
|
|
35
37
|
import getFormData from './utils/getFormData';
|
|
36
38
|
|
|
37
39
|
const AdminSeatInfoCE = () => null;
|
|
38
40
|
|
|
39
41
|
const ApplicationInfosPage = () => {
|
|
40
|
-
const inputsRef = useRef();
|
|
42
|
+
const inputsRef = React.useRef();
|
|
41
43
|
const toggleNotification = useNotification();
|
|
42
44
|
const { trackUsage } = useTracking();
|
|
43
45
|
const { formatMessage } = useIntl();
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
+
const { get, post } = useFetchClient();
|
|
47
|
+
const { updateProjectSettings } = useConfigurations();
|
|
48
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
49
|
+
const { formatAPIError } = useAPIErrorHandler();
|
|
50
|
+
|
|
46
51
|
const {
|
|
47
52
|
communityEdition,
|
|
48
53
|
latestStrapiReleaseTag,
|
|
@@ -50,8 +55,7 @@ const ApplicationInfosPage = () => {
|
|
|
50
55
|
shouldUpdateStrapi,
|
|
51
56
|
strapiVersion,
|
|
52
57
|
} = useAppInfo();
|
|
53
|
-
|
|
54
|
-
const permissions = useSelector(selectAdminPermissions);
|
|
58
|
+
|
|
55
59
|
const AdminSeatInfo = useEnterprise(
|
|
56
60
|
AdminSeatInfoCE,
|
|
57
61
|
async () =>
|
|
@@ -65,38 +69,68 @@ const ApplicationInfosPage = () => {
|
|
|
65
69
|
const {
|
|
66
70
|
allowedActions: { canRead, canUpdate },
|
|
67
71
|
} = useRBAC(permissions.settings['project-settings']);
|
|
68
|
-
const canSubmit = canRead && canUpdate;
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
enabled: canRead,
|
|
72
|
-
});
|
|
73
|
+
useFocusWhenNavigate();
|
|
73
74
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const { data, isLoading } = useQuery(
|
|
76
|
+
['project-settings'],
|
|
77
|
+
async () => {
|
|
78
|
+
const { data } = await get('/admin/project-settings');
|
|
79
|
+
|
|
80
|
+
return data;
|
|
78
81
|
},
|
|
79
|
-
|
|
82
|
+
{
|
|
83
|
+
cacheTime: 0,
|
|
84
|
+
enabled: canRead,
|
|
85
|
+
select(data) {
|
|
86
|
+
return {
|
|
87
|
+
...data,
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
authLogo: data.authLogo
|
|
90
|
+
? {
|
|
91
|
+
...data.authLogo,
|
|
92
|
+
url: prefixFileUrlWithBackendUrl(data.authLogo.url),
|
|
93
|
+
}
|
|
94
|
+
: data.authLogo,
|
|
83
95
|
|
|
84
|
-
|
|
96
|
+
menuLogo: data.menuLogo
|
|
97
|
+
? {
|
|
98
|
+
...data.menuLogo,
|
|
99
|
+
url: prefixFileUrlWithBackendUrl(data.menuLogo.url),
|
|
100
|
+
}
|
|
101
|
+
: data.menuLogo,
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
);
|
|
85
106
|
|
|
86
|
-
|
|
87
|
-
|
|
107
|
+
const submitMutation = useMutation(
|
|
108
|
+
(body) =>
|
|
109
|
+
post('/admin/project-settings', body, {
|
|
110
|
+
headers: {
|
|
111
|
+
'Content-Type': 'multipart/form-data',
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
{
|
|
115
|
+
onError(error) {
|
|
116
|
+
toggleNotification({
|
|
117
|
+
type: 'warning',
|
|
118
|
+
message: formatAPIError(error),
|
|
119
|
+
});
|
|
120
|
+
},
|
|
88
121
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const { menuLogo, authLogo } = inputValues;
|
|
122
|
+
async onSuccess(data) {
|
|
123
|
+
const { menuLogo, authLogo } = data;
|
|
92
124
|
|
|
93
|
-
|
|
125
|
+
updateProjectSettings({ menuLogo: menuLogo?.url, authLogo: authLogo?.url });
|
|
126
|
+
|
|
127
|
+
if (menuLogo?.rawFile) {
|
|
94
128
|
trackUsage('didChangeLogo', {
|
|
95
129
|
logo: 'menu',
|
|
96
130
|
});
|
|
97
131
|
}
|
|
98
132
|
|
|
99
|
-
if (authLogo
|
|
133
|
+
if (authLogo?.rawFile) {
|
|
100
134
|
trackUsage('didChangeLogo', {
|
|
101
135
|
logo: 'auth',
|
|
102
136
|
});
|
|
@@ -107,13 +141,13 @@ const ApplicationInfosPage = () => {
|
|
|
107
141
|
message: formatMessage({ id: 'app', defaultMessage: 'Saved' }),
|
|
108
142
|
});
|
|
109
143
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const handleSubmit = (e) => {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
|
|
150
|
+
submitMutation.mutate(getFormData(inputsRef.current.getValues()));
|
|
117
151
|
};
|
|
118
152
|
|
|
119
153
|
// block rendering until the EE component is fully loaded
|
|
@@ -145,7 +179,7 @@ const ApplicationInfosPage = () => {
|
|
|
145
179
|
defaultMessage: 'Administration panel’s global information',
|
|
146
180
|
})}
|
|
147
181
|
primaryAction={
|
|
148
|
-
|
|
182
|
+
canUpdate && (
|
|
149
183
|
<Button type="submit" startIcon={<Check />}>
|
|
150
184
|
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
|
151
185
|
</Button>
|
|
@@ -19,7 +19,7 @@ import { useQuery } from 'react-query';
|
|
|
19
19
|
import { useSelector } from 'react-redux';
|
|
20
20
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
21
21
|
|
|
22
|
-
import { formatAPIErrors } from '../../../../../utils';
|
|
22
|
+
import { formatAPIErrors } from '../../../../../utils/formatAPIErrors';
|
|
23
23
|
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
24
24
|
import { TRANSFER_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
|
25
25
|
import FormHead from '../../../components/Tokens/FormHead';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ContentLayout, HeaderLayout, Main } from '@strapi/design-system';
|
|
4
4
|
import {
|
|
5
5
|
LinkButton,
|
|
6
6
|
NoContent,
|
|
@@ -136,9 +136,10 @@ const TransferTokenListView = () => {
|
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
138
|
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
const
|
|
139
|
+
const hasTransferTokens = transferTokens && transferTokens?.length > 0;
|
|
140
|
+
const shouldDisplayDynamicTable = canRead && hasTransferTokens;
|
|
141
|
+
const shouldDisplayNoContent = canRead && !hasTransferTokens && !canCreate;
|
|
142
|
+
const shouldDisplayNoContentWithCreationButton = canRead && !hasTransferTokens && canCreate;
|
|
142
143
|
|
|
143
144
|
return (
|
|
144
145
|
<Main aria-busy={isLoading}>
|
|
@@ -194,12 +195,16 @@ const TransferTokenListView = () => {
|
|
|
194
195
|
defaultMessage: 'Add your first Transfer Token',
|
|
195
196
|
}}
|
|
196
197
|
action={
|
|
197
|
-
<
|
|
198
|
+
<LinkButton
|
|
199
|
+
variant="secondary"
|
|
200
|
+
startIcon={<Plus />}
|
|
201
|
+
to="/settings/transfer-tokens/create"
|
|
202
|
+
>
|
|
198
203
|
{formatMessage({
|
|
199
204
|
id: 'Settings.transferTokens.addNewToken',
|
|
200
205
|
defaultMessage: 'Add new Transfer Token',
|
|
201
206
|
})}
|
|
202
|
-
</
|
|
207
|
+
</LinkButton>
|
|
203
208
|
}
|
|
204
209
|
/>
|
|
205
210
|
)}
|
|
@@ -34,7 +34,8 @@ import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
|
34
34
|
|
|
35
35
|
import { useAdminUsers } from '../../../../../hooks/useAdminUsers';
|
|
36
36
|
import { useEnterprise } from '../../../../../hooks/useEnterprise';
|
|
37
|
-
import { formatAPIErrors
|
|
37
|
+
import { formatAPIErrors } from '../../../../../utils/formatAPIErrors';
|
|
38
|
+
import { getFullName } from '../../../../../utils/getFullName';
|
|
38
39
|
import { MagicLinkCE } from '../components/MagicLink';
|
|
39
40
|
import SelectRoles from '../components/SelectRoles';
|
|
40
41
|
import { editValidation } from '../utils/validations/users';
|
|
@@ -71,6 +72,8 @@ const EditPage = ({ canUpdate }) => {
|
|
|
71
72
|
} = useAdminUsers(
|
|
72
73
|
{ id },
|
|
73
74
|
{
|
|
75
|
+
cacheTime: 0,
|
|
76
|
+
|
|
74
77
|
onError(error) {
|
|
75
78
|
const { status } = error.response;
|
|
76
79
|
|
|
@@ -16,7 +16,7 @@ import PropTypes from 'prop-types';
|
|
|
16
16
|
import { useIntl } from 'react-intl';
|
|
17
17
|
import { useHistory } from 'react-router-dom';
|
|
18
18
|
|
|
19
|
-
import { getFullName } from '../../../../../../../utils';
|
|
19
|
+
import { getFullName } from '../../../../../../../utils/getFullName';
|
|
20
20
|
|
|
21
21
|
const TableRows = ({
|
|
22
22
|
canDelete,
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Flex,
|
|
6
|
+
Main,
|
|
7
|
+
Option,
|
|
8
|
+
Select,
|
|
9
|
+
TextButton,
|
|
10
|
+
TextInput,
|
|
11
|
+
Typography,
|
|
12
|
+
} from '@strapi/design-system';
|
|
13
|
+
import { auth, useNotification } from '@strapi/helper-plugin';
|
|
14
|
+
import { parse } from 'qs';
|
|
15
|
+
import { useIntl } from 'react-intl';
|
|
16
|
+
import { useHistory } from 'react-router-dom';
|
|
17
|
+
|
|
18
|
+
import Logo from '../components/UnauthenticatedLogo';
|
|
19
|
+
import UnauthenticatedLayout, { LayoutContent } from '../layouts/UnauthenticatedLayout';
|
|
20
|
+
|
|
21
|
+
export const options = [
|
|
22
|
+
{
|
|
23
|
+
intlLabel: {
|
|
24
|
+
id: 'Usecase.front-end',
|
|
25
|
+
defaultMessage: 'Front-end developer',
|
|
26
|
+
},
|
|
27
|
+
value: 'front_end_developer',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
intlLabel: {
|
|
31
|
+
id: 'Usecase.back-end',
|
|
32
|
+
defaultMessage: 'Back-end developer',
|
|
33
|
+
},
|
|
34
|
+
value: 'back_end_developer',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
intlLabel: {
|
|
38
|
+
id: 'Usecase.full-stack',
|
|
39
|
+
defaultMessage: 'Full-stack developer',
|
|
40
|
+
},
|
|
41
|
+
value: 'full_stack_developer',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
intlLabel: {
|
|
45
|
+
id: 'global.content-manager',
|
|
46
|
+
defaultMessage: 'Content Manager',
|
|
47
|
+
},
|
|
48
|
+
value: 'content_manager',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
intlLabel: {
|
|
52
|
+
id: 'Usecase.content-creator',
|
|
53
|
+
defaultMessage: 'Content Creator',
|
|
54
|
+
},
|
|
55
|
+
value: 'content_creator',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
intlLabel: {
|
|
59
|
+
id: 'Usecase.other',
|
|
60
|
+
defaultMessage: 'Other',
|
|
61
|
+
},
|
|
62
|
+
value: 'other',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export const UseCasePage = () => {
|
|
67
|
+
const toggleNotification = useNotification();
|
|
68
|
+
const { push, location } = useHistory();
|
|
69
|
+
const { formatMessage } = useIntl();
|
|
70
|
+
const [role, setRole] = React.useState();
|
|
71
|
+
const [otherRole, setOtherRole] = React.useState('');
|
|
72
|
+
|
|
73
|
+
const { firstname, email } = auth.getUserInfo();
|
|
74
|
+
const { hasAdmin } = parse(location?.search, { ignoreQueryPrefix: true });
|
|
75
|
+
|
|
76
|
+
const handleSubmit = async (event) => {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
|
|
79
|
+
const shouldSkip = event.nativeEvent?.submitter?.name === 'skip';
|
|
80
|
+
|
|
81
|
+
await fetch('https://analytics.strapi.io/register', {
|
|
82
|
+
body: JSON.stringify({
|
|
83
|
+
email,
|
|
84
|
+
username: firstname,
|
|
85
|
+
firstAdmin: Boolean(!hasAdmin),
|
|
86
|
+
persona: {
|
|
87
|
+
role: shouldSkip ? undefined : role,
|
|
88
|
+
otherRole: shouldSkip ? undefined : otherRole,
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
|
|
92
|
+
headers: {
|
|
93
|
+
'Content-Type': 'application/json',
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
method: 'POST',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
toggleNotification({
|
|
100
|
+
type: 'success',
|
|
101
|
+
message: {
|
|
102
|
+
id: 'Usecase.notification.success.project-created',
|
|
103
|
+
defaultMessage: 'Project has been successfully created',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
push('/');
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<UnauthenticatedLayout>
|
|
112
|
+
<Main labelledBy="usecase-title">
|
|
113
|
+
<form onSubmit={handleSubmit}>
|
|
114
|
+
<LayoutContent>
|
|
115
|
+
<Flex direction="column" alignItems="stretch" gap={7}>
|
|
116
|
+
<Flex direction="column" gap={6}>
|
|
117
|
+
<Logo />
|
|
118
|
+
|
|
119
|
+
<Typography textAlign="center" variant="alpha" as="h1" id="usecase-title">
|
|
120
|
+
{formatMessage({
|
|
121
|
+
id: 'Usecase.title',
|
|
122
|
+
defaultMessage: 'Tell us a bit more about yourself',
|
|
123
|
+
})}
|
|
124
|
+
</Typography>
|
|
125
|
+
</Flex>
|
|
126
|
+
|
|
127
|
+
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
128
|
+
<Select
|
|
129
|
+
id="usecase"
|
|
130
|
+
data-testid="usecase"
|
|
131
|
+
label={formatMessage({
|
|
132
|
+
id: 'Usecase.input.work-type',
|
|
133
|
+
defaultMessage: 'What type of work do you do?',
|
|
134
|
+
})}
|
|
135
|
+
onChange={setRole}
|
|
136
|
+
value={role}
|
|
137
|
+
>
|
|
138
|
+
{options.map(({ intlLabel, value }) => (
|
|
139
|
+
<Option key={value} value={value}>
|
|
140
|
+
{formatMessage(intlLabel)}
|
|
141
|
+
</Option>
|
|
142
|
+
))}
|
|
143
|
+
</Select>
|
|
144
|
+
|
|
145
|
+
{role === 'other' && (
|
|
146
|
+
<TextInput
|
|
147
|
+
name="other"
|
|
148
|
+
label={formatMessage({ id: 'Usecase.other', defaultMessage: 'Other' })}
|
|
149
|
+
value={otherRole}
|
|
150
|
+
onChange={(e) => setOtherRole(e.target.value)}
|
|
151
|
+
data-testid="other"
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
<Button type="submit" size="L" fullWidth disabled={!role}>
|
|
156
|
+
{formatMessage({ id: 'global.finish', defaultMessage: 'Finish' })}
|
|
157
|
+
</Button>
|
|
158
|
+
</Flex>
|
|
159
|
+
</Flex>
|
|
160
|
+
</LayoutContent>
|
|
161
|
+
|
|
162
|
+
<Flex justifyContent="center" paddingTop={4}>
|
|
163
|
+
<TextButton type="submit" name="skip">
|
|
164
|
+
{formatMessage({
|
|
165
|
+
id: 'Usecase.button.skip',
|
|
166
|
+
defaultMessage: 'Skip this question',
|
|
167
|
+
})}
|
|
168
|
+
</TextButton>
|
|
169
|
+
</Flex>
|
|
170
|
+
</form>
|
|
171
|
+
</Main>
|
|
172
|
+
</UnauthenticatedLayout>
|
|
173
|
+
);
|
|
174
|
+
};
|