@strapi/admin 4.11.0-alpha.0 → 4.11.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
- package/admin/src/components/Providers/index.js +32 -32
- package/admin/src/components/Theme/index.js +5 -3
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +1 -2
- package/admin/src/content-manager/components/DynamicZone/index.js +1 -1
- package/admin/src/content-manager/components/FieldComponent/index.js +1 -1
- package/admin/src/content-manager/components/Inputs/index.js +19 -12
- package/admin/src/content-manager/components/Inputs/utils/index.js +0 -1
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +67 -71
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +3 -5
- package/admin/src/content-manager/pages/App/useContentManagerInitData.js +2 -3
- package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +2 -5
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +1 -1
- package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
- package/admin/src/content-manager/pages/EditViewLayoutManager/Permissions.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +1 -2
- package/admin/src/hooks/index.js +1 -1
- package/admin/src/hooks/marketplace/constants.js +1 -0
- package/admin/src/hooks/{useFetchMarketplacePlugins → marketplace/useFetchMarketplacePlugins}/index.js +21 -1
- package/admin/src/hooks/{useFetchMarketplaceProviders → marketplace/useFetchMarketplaceProviders}/index.js +21 -1
- package/admin/src/hooks/useAdminUsers/__mocks__/index.js +5 -0
- package/admin/src/hooks/useAdminUsers/index.js +1 -0
- package/admin/src/hooks/useAdminUsers/useAdminUsers.js +38 -0
- package/admin/src/hooks/useContentTypes/__mocks__/index.js +6 -0
- package/admin/src/hooks/useContentTypes/index.js +1 -0
- package/admin/src/hooks/useContentTypes/useContentTypes.js +47 -0
- package/admin/src/hooks/useReleaseNotification/utils/api.js +6 -5
- package/admin/src/pages/Admin/Onboarding/index.js +89 -91
- package/admin/src/pages/App/index.js +1 -5
- package/admin/src/pages/AuthPage/components/Register/index.js +3 -4
- package/admin/src/pages/AuthPage/index.js +11 -26
- package/admin/src/pages/HomePage/index.js +3 -2
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/InstallPluginButton.js +12 -8
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +39 -41
- package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +2 -2
- package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +28 -26
- package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +3 -2
- package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/RoleForm/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +36 -26
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +1 -8
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +6 -7
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +54 -63
- package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +11 -9
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +12 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +120 -205
- package/admin/src/pages/UseCasePage/index.js +13 -15
- package/admin/src/translations/ar.json +684 -1
- package/admin/src/translations/en.json +12 -9
- package/build/1387.a86ac314.chunk.js +1 -0
- package/build/{1657.45231968.chunk.js → 1657.ca8562dd.chunk.js} +17 -17
- package/build/3081.c2cdfac8.chunk.js +108 -0
- package/build/{3562.57745ccd.chunk.js → 3562.e0b1a0b3.chunk.js} +6 -6
- package/build/456.9b85d4c6.chunk.js +39 -0
- package/build/462.a073ff1f.chunk.js +71 -0
- package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
- package/build/5542.002522eb.chunk.js +71 -0
- package/build/5563.79950369.chunk.js +79 -0
- package/build/617.87b2fe96.chunk.js +155 -0
- package/build/6970.7ea35fbd.chunk.js +1 -0
- package/build/7259.5cc67413.chunk.js +1 -0
- package/build/Admin-authenticatedApp.990df65d.chunk.js +79 -0
- package/build/Admin_homePage.107a9fe0.chunk.js +73 -0
- package/build/Admin_marketplace.1436fc2b.chunk.js +55 -0
- package/build/Admin_pluginsPage.e1afd5ed.chunk.js +6 -0
- package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.75bc083a.chunk.js} +1 -1
- package/build/Admin_settingsPage.bd715ed3.chunk.js +79 -0
- package/build/{Upload_ConfigureTheView.d429a7fc.chunk.js → Upload_ConfigureTheView.aa64ed9a.chunk.js} +1 -1
- package/build/admin-app.8b102fe2.chunk.js +63 -0
- package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.0d12b741.chunk.js} +43 -41
- package/build/admin-edit-users.f9ce7844.chunk.js +10 -0
- package/build/admin-roles-list.e8bf9685.chunk.js +31 -0
- package/build/admin-users.751b28b2.chunk.js +34 -0
- package/build/ar-json.f530bc3f.chunk.js +1 -0
- package/build/audit-logs-settings-page.3c6cea81.chunk.js +129 -0
- package/build/content-manager.89099707.chunk.js +1123 -0
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
- package/build/content-type-builder-translation-en-json.af293c9e.chunk.js +1 -0
- package/build/content-type-builder.b10576e7.chunk.js +126 -0
- package/build/email-settings-page.4368689f.chunk.js +11 -0
- package/build/en-json.0f5cc115.chunk.js +1 -0
- package/build/i18n-settings-page.7988d872.chunk.js +114 -0
- package/build/index.html +1 -1
- package/build/main.5a232c3d.js +2630 -0
- package/build/review-workflows-settings.4b39b837.chunk.js +61 -0
- package/build/{runtime~main.1074f2bb.js → runtime~main.55d43bd7.js} +2 -2
- package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.265e3d72.chunk.js} +1 -1
- package/build/upload-settings.63d99bf5.chunk.js +14 -0
- package/build/upload.c50d8c7a.chunk.js +34 -0
- package/build/users-advanced-settings-page.2cfb5d24.chunk.js +9 -0
- package/build/users-email-settings-page.bd6c774a.chunk.js +24 -0
- package/build/users-providers-settings-page.528f0036.chunk.js +29 -0
- package/build/{users-roles-settings-page.eeb3a339.chunk.js → users-roles-settings-page.c773086b.chunk.js} +2 -2
- package/build/webhook-edit-page.ddd5963d.chunk.js +128 -0
- package/build/webhook-list-page.b0f5a02c.chunk.js +71 -0
- package/ee/LICENSE +1 -21
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -2
- package/ee/admin/pages/AuthPage/components/Login/index.js +1 -1
- package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +1 -1
- package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +36 -28
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +3 -3
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +32 -21
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +1 -1
- package/ee/server/services/audit-logs.js +5 -1
- package/package.json +18 -21
- package/webpack.alias.js +0 -2
- package/admin/src/content-manager/components/Inputs/utils/getStep.js +0 -13
- package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -18
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +0 -18
- package/admin/src/hooks/useModels/index.js +0 -58
- package/admin/src/hooks/useModels/reducer.js +0 -45
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +0 -20
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/utils/formatValue.js +0 -13
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/reducer.js +0 -72
- package/build/1387.84b454d3.chunk.js +0 -1
- package/build/3081.bcf9a12f.chunk.js +0 -108
- package/build/462.8fff7f3b.chunk.js +0 -71
- package/build/5542.b8240e3f.chunk.js +0 -70
- package/build/5563.986609ed.chunk.js +0 -79
- package/build/6404.68405699.chunk.js +0 -100
- package/build/6970.5159b068.chunk.js +0 -1
- package/build/7259.7a48aa2f.chunk.js +0 -1
- package/build/7725.1633e06f.chunk.js +0 -213
- package/build/Admin-authenticatedApp.27a2329f.chunk.js +0 -79
- package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
- package/build/Admin_marketplace.5f7b89e5.chunk.js +0 -55
- package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
- package/build/Admin_settingsPage.9d0419bc.chunk.js +0 -79
- package/build/admin-app.8e1f56bc.chunk.js +0 -63
- package/build/admin-edit-users.2aae89f5.chunk.js +0 -10
- package/build/admin-roles-list.c759daa3.chunk.js +0 -31
- package/build/admin-users.04a823ca.chunk.js +0 -34
- package/build/ar-json.39e54aba.chunk.js +0 -1
- package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
- package/build/content-manager.cf467ecc.chunk.js +0 -1123
- package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
- package/build/content-type-builder-translation-en-json.5e5f8607.chunk.js +0 -1
- package/build/content-type-builder.4737a30c.chunk.js +0 -126
- package/build/email-settings-page.dc07d518.chunk.js +0 -10
- package/build/en-json.7edb00f6.chunk.js +0 -1
- package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
- package/build/main.14dca275.js +0 -2592
- package/build/review-workflows-settings.6a662ebd.chunk.js +0 -61
- package/build/upload-settings.dd2d987c.chunk.js +0 -13
- package/build/upload.c8479232.chunk.js +0 -33
- package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
- package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
- package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
- package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
- package/build/webhook-list-page.30d73114.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) {
|
|
@@ -48,29 +48,29 @@ const Providers = ({
|
|
|
48
48
|
themes,
|
|
49
49
|
}) => {
|
|
50
50
|
return (
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<StrapiAppProvider
|
|
63
|
-
getPlugin={getPlugin}
|
|
64
|
-
menu={menu}
|
|
65
|
-
plugins={plugins}
|
|
66
|
-
runHookParallel={runHookParallel}
|
|
67
|
-
runHookWaterfall={runHookWaterfall}
|
|
68
|
-
runHookSeries={runHookSeries}
|
|
69
|
-
settings={settings}
|
|
51
|
+
<LanguageProvider messages={messages} localeNames={localeNames}>
|
|
52
|
+
<ThemeToggleProvider themes={themes}>
|
|
53
|
+
<Theme>
|
|
54
|
+
<QueryClientProvider client={queryClient}>
|
|
55
|
+
<Provider store={store}>
|
|
56
|
+
<AdminContext.Provider value={{ getAdminInjectedComponents }}>
|
|
57
|
+
<ConfigurationsProvider
|
|
58
|
+
authLogo={authLogo}
|
|
59
|
+
menuLogo={menuLogo}
|
|
60
|
+
showReleaseNotification={showReleaseNotification}
|
|
61
|
+
showTutorials={showTutorials}
|
|
70
62
|
>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
<StrapiAppProvider
|
|
64
|
+
getPlugin={getPlugin}
|
|
65
|
+
menu={menu}
|
|
66
|
+
plugins={plugins}
|
|
67
|
+
runHookParallel={runHookParallel}
|
|
68
|
+
runHookWaterfall={runHookWaterfall}
|
|
69
|
+
runHookSeries={runHookSeries}
|
|
70
|
+
settings={settings}
|
|
71
|
+
>
|
|
72
|
+
<LibraryProvider components={components} fields={fields}>
|
|
73
|
+
<CustomFieldsProvider customFields={customFields}>
|
|
74
74
|
<AutoReloadOverlayBlockerProvider>
|
|
75
75
|
<OverlayBlockerProvider>
|
|
76
76
|
<GuidedTour>
|
|
@@ -78,16 +78,16 @@ const Providers = ({
|
|
|
78
78
|
</GuidedTour>
|
|
79
79
|
</OverlayBlockerProvider>
|
|
80
80
|
</AutoReloadOverlayBlockerProvider>
|
|
81
|
-
</
|
|
82
|
-
</
|
|
83
|
-
</
|
|
84
|
-
</
|
|
85
|
-
</
|
|
86
|
-
</
|
|
87
|
-
</
|
|
88
|
-
</
|
|
89
|
-
</
|
|
90
|
-
</
|
|
81
|
+
</CustomFieldsProvider>
|
|
82
|
+
</LibraryProvider>
|
|
83
|
+
</StrapiAppProvider>
|
|
84
|
+
</ConfigurationsProvider>
|
|
85
|
+
</AdminContext.Provider>
|
|
86
|
+
</Provider>
|
|
87
|
+
</QueryClientProvider>
|
|
88
|
+
</Theme>
|
|
89
|
+
</ThemeToggleProvider>
|
|
90
|
+
</LanguageProvider>
|
|
91
91
|
);
|
|
92
92
|
};
|
|
93
93
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DesignSystemProvider } from '@strapi/design-system';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
4
5
|
import { useThemeToggle } from '../../hooks';
|
|
5
6
|
import GlobalStyle from '../GlobalStyle';
|
|
6
7
|
|
|
7
8
|
const Theme = ({ children }) => {
|
|
8
9
|
const { currentTheme, themes } = useThemeToggle();
|
|
10
|
+
const { locale } = useIntl();
|
|
9
11
|
|
|
10
12
|
return (
|
|
11
|
-
<
|
|
13
|
+
<DesignSystemProvider locale={locale} theme={themes[currentTheme] || themes.light}>
|
|
12
14
|
{children}
|
|
13
15
|
<GlobalStyle />
|
|
14
|
-
</
|
|
16
|
+
</DesignSystemProvider>
|
|
15
17
|
);
|
|
16
18
|
};
|
|
17
19
|
|
|
@@ -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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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';
|
|
@@ -12,14 +12,7 @@ import Wysiwyg from '../Wysiwyg';
|
|
|
12
12
|
import InputUID from '../InputUID';
|
|
13
13
|
import { RelationInputDataManager } from '../RelationInputDataManager';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
connect,
|
|
17
|
-
generateOptions,
|
|
18
|
-
getInputType,
|
|
19
|
-
getStep,
|
|
20
|
-
select,
|
|
21
|
-
VALIDATIONS_TO_OMIT,
|
|
22
|
-
} from './utils';
|
|
15
|
+
import { connect, generateOptions, getInputType, select, VALIDATIONS_TO_OMIT } from './utils';
|
|
23
16
|
|
|
24
17
|
function Inputs({
|
|
25
18
|
allowedFields,
|
|
@@ -93,9 +86,7 @@ function Inputs({
|
|
|
93
86
|
return value;
|
|
94
87
|
}, [type, value]);
|
|
95
88
|
|
|
96
|
-
const step =
|
|
97
|
-
return getStep(type);
|
|
98
|
-
}, [type]);
|
|
89
|
+
const step = getStep(type);
|
|
99
90
|
|
|
100
91
|
const isUserAllowedToEditField = useMemo(() => {
|
|
101
92
|
const joinedName = fieldName.join('.');
|
|
@@ -184,6 +175,9 @@ function Inputs({
|
|
|
184
175
|
|
|
185
176
|
let minutes;
|
|
186
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Wtf is this?
|
|
180
|
+
*/
|
|
187
181
|
if (inputType === 'datetime') {
|
|
188
182
|
minutes = parseInt(inputValue.substr(14, 2), 10);
|
|
189
183
|
} else if (inputType === 'time') {
|
|
@@ -316,6 +310,19 @@ Inputs.propTypes = {
|
|
|
316
310
|
customFieldInputs: PropTypes.object,
|
|
317
311
|
};
|
|
318
312
|
|
|
313
|
+
const getStep = (type) => {
|
|
314
|
+
switch (type) {
|
|
315
|
+
case 'float':
|
|
316
|
+
case 'decimal':
|
|
317
|
+
return 0.01;
|
|
318
|
+
case 'time':
|
|
319
|
+
case 'datetime':
|
|
320
|
+
return 15;
|
|
321
|
+
default:
|
|
322
|
+
return 1;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
319
326
|
const Memoized = memo(Inputs, isEqual);
|
|
320
327
|
|
|
321
328
|
export default connect(Memoized, select);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as connect } from './connect';
|
|
2
2
|
export { default as generateOptions } from './generateOptions';
|
|
3
3
|
export { default as getInputType } from './getInputType';
|
|
4
|
-
export { default as getStep } from './getStep';
|
|
5
4
|
export { default as select } from './select';
|
|
6
5
|
export { default as VALIDATIONS_TO_OMIT } from './VALIDATIONS_TO_OMIT';
|
|
@@ -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
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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(
|
|
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 {
|
|
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(
|
|
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 {
|
|
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(
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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';
|
|
@@ -158,7 +158,6 @@ function ListView({
|
|
|
158
158
|
|
|
159
159
|
try {
|
|
160
160
|
const opts = source ? { cancelToken: source.token } : null;
|
|
161
|
-
|
|
162
161
|
const {
|
|
163
162
|
data: { results, pagination: paginationResult },
|
|
164
163
|
} = await fetchClient.get(endPoint, opts);
|
package/admin/src/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as useConfigurations } from './useConfigurations';
|
|
2
|
-
export {
|
|
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
|
|
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
|
|
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 @@
|
|
|
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
|
+
}
|