@strapi/admin 4.3.0-beta.1 → 4.3.0-beta.2

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 (108) hide show
  1. package/admin/src/components/OverlayBlocker/index.js +4 -0
  2. package/admin/src/content-manager/components/DynamicTable/CellContent/utils/hasContent.js +1 -1
  3. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +7 -13
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +1 -0
  5. package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +1 -1
  6. package/admin/src/content-manager/pages/ListView/index.js +2 -2
  7. package/admin/src/hooks/{useFetchInstalledPlugins → useFetchEnabledPlugins}/index.js +4 -4
  8. package/admin/src/hooks/{useFetchInstalledPlugins → useFetchEnabledPlugins}/utils/api.js +2 -2
  9. package/admin/src/pages/InstalledPluginsPage/Plugins.js +2 -2
  10. package/admin/src/pages/MarketplacePage/components/NpmPackageCard/index.js +7 -8
  11. package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +8 -2
  12. package/admin/src/pages/MarketplacePage/index.js +9 -39
  13. package/admin/src/translations/en.json +2 -0
  14. package/admin/src/translations/hi.json +699 -0
  15. package/admin/src/translations/languageNativeNames.js +2 -0
  16. package/admin/src/translations/pl.json +238 -233
  17. package/admin/src/translations/sa.json +698 -0
  18. package/admin/src/translations/zh-Hans.json +28 -1
  19. package/build/{4073.e144a91a.chunk.js → 2336.cb1c0d6e.chunk.js} +1 -1
  20. package/build/{6229.53b33cf0.chunk.js → 2863.bf3c1eff.chunk.js} +2 -2
  21. package/build/3531.ef1d2cfc.chunk.js +10 -0
  22. package/build/{4715.4588fdf5.chunk.js → 4715.a6e62860.chunk.js} +8 -8
  23. package/build/5250.9988a0ad.chunk.js +12 -0
  24. package/build/{1820.ca954075.chunk.js → 5520.9dcd6a9f.chunk.js} +6 -6
  25. package/build/5833.970a963d.chunk.js +112 -0
  26. package/build/6925.fb35248e.chunk.js +761 -0
  27. package/build/8773.16dea88d.chunk.js +327 -0
  28. package/build/{472.d43be8bb.chunk.js → 9166.5c585d7c.chunk.js} +25 -25
  29. package/build/Admin-authenticatedApp.d38dc4dd.chunk.js +80 -0
  30. package/build/Admin_homePage.e3571a75.chunk.js +71 -0
  31. package/build/Admin_marketplace.284bf8fc.chunk.js +11 -0
  32. package/build/Admin_pluginsPage.8537476f.chunk.js +1 -0
  33. package/build/{Admin_profilePage.27191ed2.chunk.js → Admin_profilePage.b7f85e78.chunk.js} +2 -2
  34. package/build/Admin_settingsPage.858ef0d7.chunk.js +178 -0
  35. package/build/admin-edit-roles-page.33647266.chunk.js +1 -0
  36. package/build/admin-edit-users.8cd7519b.chunk.js +10 -0
  37. package/build/{admin-users.47d06d24.chunk.js → admin-users.6581eec5.chunk.js} +3 -3
  38. package/build/{api-tokens-edit-page.afece2fe.chunk.js → api-tokens-create-page.efa1d2aa.chunk.js} +1 -1
  39. package/build/api-tokens-edit-page.6101f051.chunk.js +1 -0
  40. package/build/{api-tokens-list-page.46d96dee.chunk.js → api-tokens-list-page.782e872f.chunk.js} +2 -2
  41. package/build/{codemirror-css.b467b1de.chunk.js → codemirror-css.4e2bbed3.chunk.js} +2 -2
  42. package/build/codemirror-theme.a82cae4e.chunk.js +34 -0
  43. package/build/{content-manager.afcc3624.chunk.js → content-manager.adf6fc82.chunk.js} +58 -58
  44. package/build/content-type-builder-translation-pl-json.4a42349b.chunk.js +1 -0
  45. package/build/content-type-builder.366a3b10.chunk.js +142 -0
  46. package/build/{cropper-css.ecc0d670.chunk.js → cropper-css.12fe038c.chunk.js} +4 -4
  47. package/build/{email-settings-page.8871dfe8.chunk.js → email-settings-page.d72e7f4c.chunk.js} +2 -2
  48. package/build/email-translation-pl-json.a03bcf98.chunk.js +1 -0
  49. package/build/{en-json.0a5ba154.chunk.js → en-json.729eb94d.chunk.js} +1 -1
  50. package/build/{fontawesome-css-all.04f33619.chunk.js → fontawesome-css-all.15068c6e.chunk.js} +2 -2
  51. package/build/{fontawesome-css.477ba714.chunk.js → fontawesome-css.418f40da.chunk.js} +2 -2
  52. package/build/hi-json.b4ae16d1.chunk.js +1 -0
  53. package/build/highlight.js.af2de364.chunk.js +86 -0
  54. package/build/i18n-settings-page.8803df0b.chunk.js +101 -0
  55. package/build/i18n-translation-pl-json.cea5bf23.chunk.js +1 -0
  56. package/build/index.html +1 -1
  57. package/build/main.689d6439.js +8688 -0
  58. package/build/pl-json.4d11f53d.chunk.js +1 -0
  59. package/build/runtime~main.308a7c41.js +2 -0
  60. package/build/sa-json.be504091.chunk.js +1 -0
  61. package/build/{sso-settings-page.dfb0b917.chunk.js → sso-settings-page.2bae79df.chunk.js} +1 -1
  62. package/build/{upload-settings.8d8c672a.chunk.js → upload-settings.f1e587c0.chunk.js} +6 -6
  63. package/build/upload-translation-en-json.fddec9a6.chunk.js +1 -0
  64. package/build/upload-translation-pl-json.c1f86b50.chunk.js +1 -0
  65. package/build/upload.1346f4b1.chunk.js +7 -0
  66. package/build/{users-advanced-settings-page.4af9e241.chunk.js → users-advanced-settings-page.f38654fc.chunk.js} +1 -1
  67. package/build/{users-email-settings-page.d69c0d87.chunk.js → users-email-settings-page.824a3cdb.chunk.js} +5 -5
  68. package/build/users-permissions-translation-en-json.765abf48.chunk.js +1 -0
  69. package/build/users-permissions-translation-pl-json.1dbdd4a1.chunk.js +1 -0
  70. package/build/{users-providers-settings-page.fc1fda6d.chunk.js → users-providers-settings-page.82a4ba58.chunk.js} +1 -1
  71. package/build/users-roles-settings-page.1206751f.chunk.js +30 -0
  72. package/build/{webhook-edit-page.a7ae6e3b.chunk.js → webhook-edit-page.5c9bada0.chunk.js} +2 -2
  73. package/build/{webhook-list-page.057f396c.chunk.js → webhook-list-page.822927af.chunk.js} +1 -1
  74. package/build/zh-Hans-json.cbc69f3d.chunk.js +1 -0
  75. package/package.json +27 -25
  76. package/server/controllers/admin.js +2 -0
  77. package/webpack.alias.js +30 -19
  78. package/webpack.config.js +6 -1
  79. package/admin/src/pages/MarketplacePage/utils/api.js +0 -9
  80. package/build/3531.231e0eb6.chunk.js +0 -10
  81. package/build/5250.24040688.chunk.js +0 -11
  82. package/build/6925.fafef528.chunk.js +0 -761
  83. package/build/7418.6db737ce.chunk.js +0 -112
  84. package/build/8773.54a26ded.chunk.js +0 -327
  85. package/build/Admin-authenticatedApp.52f3c150.chunk.js +0 -80
  86. package/build/Admin_homePage.0ac648e8.chunk.js +0 -71
  87. package/build/Admin_marketplace.71c66b49.chunk.js +0 -11
  88. package/build/Admin_pluginsPage.788fb2f6.chunk.js +0 -1
  89. package/build/Admin_settingsPage.021da806.chunk.js +0 -178
  90. package/build/admin-edit-roles-page.fb374555.chunk.js +0 -1
  91. package/build/admin-edit-users.a360deaf.chunk.js +0 -10
  92. package/build/api-tokens-create-page.698f132d.chunk.js +0 -1
  93. package/build/codemirror-theme.cf9f9eb6.chunk.js +0 -34
  94. package/build/content-type-builder-translation-pl-json.a866acda.chunk.js +0 -1
  95. package/build/content-type-builder.e73879b9.chunk.js +0 -141
  96. package/build/email-translation-pl-json.6da50d0f.chunk.js +0 -1
  97. package/build/highlight.js.3381ffc3.chunk.js +0 -86
  98. package/build/i18n-settings-page.dfb4eb01.chunk.js +0 -101
  99. package/build/main.ca3856ed.js +0 -8640
  100. package/build/pl-json.f65302c2.chunk.js +0 -1
  101. package/build/runtime~main.48a46dd2.js +0 -2
  102. package/build/upload-translation-en-json.e78688a0.chunk.js +0 -1
  103. package/build/upload-translation-pl-json.e534b676.chunk.js +0 -1
  104. package/build/upload.5622b777.chunk.js +0 -7
  105. package/build/users-permissions-translation-en-json.3fe86528.chunk.js +0 -1
  106. package/build/users-permissions-translation-pl-json.3c4fe81c.chunk.js +0 -1
  107. package/build/users-roles-settings-page.988ebc3b.chunk.js +0 -30
  108. package/build/zh-Hans-json.c84ce330.chunk.js +0 -1
@@ -37,6 +37,10 @@ const Portal = ({ isOpen }) => {
37
37
  return null;
38
38
  };
39
39
 
40
+ Portal.propTypes = {
41
+ isOpen: PropTypes.bool.isRequired,
42
+ };
43
+
40
44
  const OverlayBlockerProvider = ({ children }) => {
41
45
  const [isOpen, setIsOpen] = useState(false);
42
46
 
@@ -45,7 +45,7 @@ export default function hasContent(type, content, metadatas, fieldSchema) {
45
45
  return !isEmpty(content);
46
46
  }
47
47
 
48
- return content.count > 0;
48
+ return content?.count > 0;
49
49
  }
50
50
 
51
51
  /*
@@ -233,9 +233,13 @@ const EditViewDataManagerProvider = ({
233
233
  ({ target: { name, value, type } }, shouldSetInitialValue = false) => {
234
234
  let inputValue = value;
235
235
 
236
- // Empty string is not a valid date,
237
- // Set the date to null when it's empty
238
- if (type === 'date' && value === '') {
236
+ // Allow to reset text, textarea, email, uid, select/enum, and number
237
+ if (
238
+ ['text', 'textarea', 'string', 'email', 'uid', 'select', 'select-one', 'number'].includes(
239
+ type
240
+ ) &&
241
+ !value
242
+ ) {
239
243
  inputValue = null;
240
244
  }
241
245
 
@@ -248,16 +252,6 @@ const EditViewDataManagerProvider = ({
248
252
  return;
249
253
  }
250
254
 
251
- // Allow to reset enum
252
- if (type === 'select-one' && value === '') {
253
- inputValue = null;
254
- }
255
-
256
- // Allow to reset number input
257
- if (type === 'number' && value === '') {
258
- inputValue = null;
259
- }
260
-
261
255
  dispatch({
262
256
  type: 'ON_CHANGE',
263
257
  keys: name.split('.'),
@@ -57,6 +57,7 @@ const cleanData = (retrievedData, currentSchema, componentsSchema) => {
57
57
  } else {
58
58
  cleanedData = value ? recursiveCleanData(value, componentsSchema[component]) : value;
59
59
  }
60
+
60
61
  break;
61
62
  case 'dynamiczone':
62
63
  cleanedData = value.map(componentData => {
@@ -16,7 +16,7 @@ export const EditorStylesContainer = styled.div`
16
16
  height: ${({ isExpandMode }) => (isExpandMode ? '100%' : '290px')};
17
17
  color: ${({ theme }) => theme.colors.neutral800};
18
18
  direction: ltr;
19
- font-family: --apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
19
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
20
20
  'Open Sans', 'Helvetica Neue', sans-serif;
21
21
  }
22
22
 
@@ -309,8 +309,8 @@ function ListView({
309
309
  { target: headerLayoutTitle }
310
310
  )}
311
311
  placeholder={formatMessage({
312
- id: 'app.component.search.placeholder',
313
- defaultMessage: 'Search...',
312
+ id: 'global.search',
313
+ defaultMessage: 'Search',
314
314
  })}
315
315
  trackedEvent="didSearch"
316
316
  />
@@ -1,11 +1,11 @@
1
1
  import { useQuery } from 'react-query';
2
2
  import { useNotification } from '@strapi/helper-plugin';
3
- import { fetchInstalledPlugins } from './utils/api';
3
+ import { fetchEnabledPlugins } from './utils/api';
4
4
 
5
- const useFetchInstalledPlugins = notifyLoad => {
5
+ const useFetchEnabledPlugins = notifyLoad => {
6
6
  const toggleNotification = useNotification();
7
7
 
8
- return useQuery('list-installed-plugins', () => fetchInstalledPlugins(), {
8
+ return useQuery('list-enabled-plugins', () => fetchEnabledPlugins(), {
9
9
  onSuccess: () => {
10
10
  if (notifyLoad) {
11
11
  notifyLoad();
@@ -20,4 +20,4 @@ const useFetchInstalledPlugins = notifyLoad => {
20
20
  });
21
21
  };
22
22
 
23
- export default useFetchInstalledPlugins;
23
+ export default useFetchEnabledPlugins;
@@ -1,9 +1,9 @@
1
1
  import { axiosInstance } from '../../../core/utils';
2
2
 
3
- const fetchInstalledPlugins = async () => {
3
+ const fetchEnabledPlugins = async () => {
4
4
  const { data } = await axiosInstance.get('/admin/plugins');
5
5
 
6
6
  return data;
7
7
  };
8
8
 
9
- export { fetchInstalledPlugins };
9
+ export { fetchEnabledPlugins };
@@ -6,7 +6,7 @@ import { Layout, HeaderLayout, ContentLayout } from '@strapi/design-system/Layou
6
6
  import { Main } from '@strapi/design-system/Main';
7
7
  import { Typography } from '@strapi/design-system/Typography';
8
8
  import { Table, Thead, Tbody, Tr, Td, Th } from '@strapi/design-system/Table';
9
- import useFetchInstalledPlugins from '../../hooks/useFetchInstalledPlugins';
9
+ import useFetchEnabledPlugins from '../../hooks/useFetchEnabledPlugins';
10
10
 
11
11
  const Plugins = () => {
12
12
  const { formatMessage } = useIntl();
@@ -30,7 +30,7 @@ const Plugins = () => {
30
30
  );
31
31
  };
32
32
 
33
- const { status, data } = useFetchInstalledPlugins(notifyPluginPageLoad);
33
+ const { status, data } = useFetchEnabledPlugins(notifyPluginPageLoad);
34
34
 
35
35
  const isLoading = status !== 'success' && status !== 'error';
36
36
 
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
4
  import styled from 'styled-components';
5
+ import pluralize from 'pluralize';
5
6
  import { Box } from '@strapi/design-system/Box';
6
7
  import { Stack } from '@strapi/design-system/Stack';
7
8
  import { Typography } from '@strapi/design-system/Typography';
@@ -27,7 +28,7 @@ const EllipsisText = styled(Typography)`
27
28
 
28
29
  const NpmPackageCard = ({
29
30
  npmPackage,
30
- installedPackageNames,
31
+ isInstalled,
31
32
  useYarn,
32
33
  isInDevelopmentMode,
33
34
  npmPackageType,
@@ -36,8 +37,6 @@ const NpmPackageCard = ({
36
37
  const { formatMessage } = useIntl();
37
38
  const { trackUsage } = useTracking();
38
39
 
39
- const isInstalled = installedPackageNames.includes(attributes.npmPackageName);
40
-
41
40
  const commandToCopy = useYarn
42
41
  ? `yarn add ${attributes.npmPackageName}`
43
42
  : `npm install ${attributes.npmPackageName}`;
@@ -47,10 +46,9 @@ const NpmPackageCard = ({
47
46
  defaultMessage: 'Made by Strapi',
48
47
  });
49
48
 
50
- const npmPackageHref =
51
- npmPackageType === 'provider'
52
- ? attributes.npmPackageUrl
53
- : `https://market.strapi.io/plugins/${attributes.slug}`;
49
+ const npmPackageHref = `https://market.strapi.io/${pluralize.plural(npmPackageType)}/${
50
+ attributes.slug
51
+ }`;
54
52
 
55
53
  return (
56
54
  <Flex
@@ -65,6 +63,7 @@ const NpmPackageCard = ({
65
63
  shadow="tableShadow"
66
64
  height="100%"
67
65
  alignItems="normal"
66
+ data-testid="npm-package-card"
68
67
  >
69
68
  <Box>
70
69
  <Box
@@ -167,7 +166,7 @@ NpmPackageCard.propTypes = {
167
166
  strapiCompatibility: PropTypes.oneOf(['v3', 'v4']),
168
167
  }).isRequired,
169
168
  }).isRequired,
170
- installedPackageNames: PropTypes.arrayOf(PropTypes.string).isRequired,
169
+ isInstalled: PropTypes.bool.isRequired,
171
170
  useYarn: PropTypes.bool.isRequired,
172
171
  isInDevelopmentMode: PropTypes.bool,
173
172
  npmPackageType: PropTypes.string.isRequired,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Grid, GridItem } from '@strapi/design-system/Grid';
4
4
  import NpmPackageCard from '../NpmPackageCard';
@@ -10,13 +10,19 @@ const NpmPackagesGrid = ({
10
10
  isInDevelopmentMode,
11
11
  npmPackageType,
12
12
  }) => {
13
+ // Check if an individual package is in the dependencies
14
+ const isAlreadyInstalled = useCallback(
15
+ npmPackageName => installedPackageNames.includes(npmPackageName),
16
+ [installedPackageNames]
17
+ );
18
+
13
19
  return (
14
20
  <Grid gap={4}>
15
21
  {npmPackages.map(npmPackage => (
16
22
  <GridItem col={4} s={6} xs={12} style={{ height: '100%' }} key={npmPackage.id}>
17
23
  <NpmPackageCard
18
24
  npmPackage={npmPackage}
19
- installedPackageNames={installedPackageNames}
25
+ isInstalled={isAlreadyInstalled(npmPackage.attributes.npmPackageName)}
20
26
  useYarn={useYarn}
21
27
  isInDevelopmentMode={isInDevelopmentMode}
22
28
  npmPackageType={npmPackageType}
@@ -1,7 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { Helmet } from 'react-helmet';
4
- import { useQuery } from 'react-query';
5
4
  import matchSorter from 'match-sorter';
6
5
  import {
7
6
  AnErrorOccurred,
@@ -23,8 +22,6 @@ import { Tabs, Tab, TabGroup, TabPanels, TabPanel } from '@strapi/design-system/
23
22
 
24
23
  import EmptyNpmPackageSearch from './components/EmptyNpmPackageSearch';
25
24
  import PageHeader from './components/PageHeader';
26
- import { fetchAppInformation } from './utils/api';
27
- import useFetchInstalledPlugins from '../../hooks/useFetchInstalledPlugins';
28
25
  import useFetchMarketplaceProviders from '../../hooks/useFetchMarketplaceProviders';
29
26
  import useFetchMarketplacePlugins from '../../hooks/useFetchMarketplacePlugins';
30
27
  import adminPermissions from '../../permissions';
@@ -53,7 +50,7 @@ const MarketPlacePage = () => {
53
50
  const toggleNotification = useNotification();
54
51
  const [searchQuery, setSearchQuery] = useState('');
55
52
  const [npmPackageType, setNpmPackageType] = useState('plugin');
56
- const { autoReload: isInDevelopmentMode } = useAppInfos();
53
+ const { autoReload: isInDevelopmentMode, dependencies, useYarn } = useAppInfos();
57
54
  const isOnline = useNavigatorOnLine();
58
55
 
59
56
  useFocusWhenNavigate();
@@ -85,37 +82,9 @@ const MarketPlacePage = () => {
85
82
  data: marketplaceProvidersResponse,
86
83
  } = useFetchMarketplaceProviders(notifyMarketplaceLoad);
87
84
 
88
- const {
89
- status: installedPluginsStatus,
90
- data: installedPluginsResponse,
91
- } = useFetchInstalledPlugins();
92
-
93
- const { data: appInfoResponse, status: appInfoStatus } = useQuery(
94
- 'app-information',
95
- fetchAppInformation,
96
- {
97
- onError: () => {
98
- toggleNotification({
99
- type: 'warning',
100
- message: { id: 'notification.error', defaultMessage: 'An error occured' },
101
- });
102
- },
103
- }
104
- );
105
-
106
- const isLoading = [
107
- marketplacePluginsStatus,
108
- marketplaceProvidersStatus,
109
- installedPluginsStatus,
110
- appInfoStatus,
111
- ].includes('loading');
85
+ const isLoading = [marketplacePluginsStatus, marketplaceProvidersStatus].includes('loading');
112
86
 
113
- const hasFailed = [
114
- marketplacePluginsStatus,
115
- marketplaceProvidersStatus,
116
- installedPluginsStatus,
117
- appInfoStatus,
118
- ].includes('error');
87
+ const hasFailed = [marketplacePluginsStatus, marketplaceProvidersStatus].includes('error');
119
88
 
120
89
  useEffect(() => {
121
90
  trackUsageRef.current('didGoToMarketplace');
@@ -208,8 +177,8 @@ const MarketPlacePage = () => {
208
177
  setNpmPackageType(packageType);
209
178
  };
210
179
 
211
- // Check if plugins are installed already
212
- const installedPluginNames = installedPluginsResponse.plugins.map(plugin => plugin.packageName);
180
+ // Check if plugins and providers are installed already
181
+ const installedPackageNames = Object.keys(dependencies);
213
182
 
214
183
  return (
215
184
  <Layout>
@@ -278,8 +247,8 @@ const MarketPlacePage = () => {
278
247
  ) : (
279
248
  <NpmPackagesGrid
280
249
  npmPackages={pluginSearchResults}
281
- installedPackageNames={installedPluginNames}
282
- useYarn={appInfoResponse.data.useYarn}
250
+ installedPackageNames={installedPackageNames}
251
+ useYarn={useYarn}
283
252
  isInDevelopmentMode={isInDevelopmentMode}
284
253
  npmPackageType="plugin"
285
254
  />
@@ -292,7 +261,8 @@ const MarketPlacePage = () => {
292
261
  ) : (
293
262
  <NpmPackagesGrid
294
263
  npmPackages={providerSearchResults}
295
- useYarn={appInfoResponse.data.useYarn}
264
+ installedPackageNames={installedPackageNames}
265
+ useYarn={useYarn}
296
266
  isInDevelopmentMode={isInDevelopmentMode}
297
267
  npmPackageType="provider"
298
268
  />
@@ -679,6 +679,7 @@
679
679
  "content-manager.apiError.This attribute must be unique": "{field} must be unique",
680
680
  "form.button.continue": "Continue",
681
681
  "form.button.done": "Done",
682
+ "global.search": "Search",
682
683
  "global.actions": "Actions",
683
684
  "global.back": "Back",
684
685
  "global.change-password": "Change password",
@@ -721,6 +722,7 @@
721
722
  "notification.success.title": "Success:",
722
723
  "notification.version.update.message": "A new version of Strapi is available!",
723
724
  "notification.warning.title": "Warning:",
725
+ "notification.warning.404": "404 - Not found",
724
726
  "or": "OR",
725
727
  "request.error.model.unknown": "This model doesn't exist",
726
728
  "skipToContent": "Skip to content",