@strapi/admin 4.2.0-beta.3 → 4.3.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.
Files changed (177) hide show
  1. package/admin/src/components/ConfigurationsProvider/index.js +51 -0
  2. package/admin/src/components/ConfigurationsProvider/reducer.js +28 -0
  3. package/admin/src/components/LeftMenu/index.js +12 -2
  4. package/admin/src/components/Providers/index.js +8 -4
  5. package/admin/src/components/UnauthenticatedLogo/index.js +4 -2
  6. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +3 -3
  7. package/admin/src/content-manager/components/SelectMany/index.js +2 -4
  8. package/admin/src/content-manager/components/SelectWrapper/index.js +1 -13
  9. package/admin/src/hooks/useFetchMarketplaceProviders/index.js +23 -0
  10. package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +11 -0
  11. package/admin/src/pages/App/index.js +7 -2
  12. package/admin/src/pages/MarketplacePage/components/{EmptyPluginSearch/EmptyPluginGrid.js → EmptyNpmPackageSearch/EmptyNpmPackageGrid.js} +1 -1
  13. package/admin/src/pages/MarketplacePage/components/{EmptyPluginSearch → EmptyNpmPackageSearch}/index.js +6 -4
  14. package/admin/src/pages/MarketplacePage/components/{PluginCard → NpmPackageCard}/InstallPluginButton.js +0 -0
  15. package/admin/src/pages/MarketplacePage/components/{PluginCard → NpmPackageCard}/index.js +22 -10
  16. package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +42 -0
  17. package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +12 -5
  18. package/admin/src/pages/MarketplacePage/index.js +99 -37
  19. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +85 -0
  20. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +13 -0
  21. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +43 -0
  22. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +118 -0
  23. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +28 -0
  24. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +25 -0
  25. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +67 -0
  26. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +176 -0
  27. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +86 -0
  28. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +51 -0
  29. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +97 -0
  30. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +85 -0
  31. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +28 -0
  32. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +153 -91
  33. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +16 -0
  34. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +3 -0
  35. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +17 -0
  36. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +76 -0
  37. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +17 -0
  38. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +21 -0
  39. package/admin/src/translations/en.json +33 -3
  40. package/admin/src/translations/pl.json +264 -12
  41. package/admin/src/translations/vi.json +17 -17
  42. package/admin/src/tsconfig.json +1 -1
  43. package/build/1820.ca954075.chunk.js +503 -0
  44. package/build/1856.6a94980b.chunk.js +172 -0
  45. package/build/20.9e5a98b6.chunk.js +308 -0
  46. package/build/2077.5456ccd1.chunk.js +194 -0
  47. package/build/3531.231e0eb6.chunk.js +10 -0
  48. package/build/{4073.41ac1235.chunk.js → 4073.e144a91a.chunk.js} +1 -1
  49. package/build/413.d5986568.chunk.js +284 -0
  50. package/build/4715.4588fdf5.chunk.js +385 -0
  51. package/build/{210.014495c1.chunk.js → 472.d43be8bb.chunk.js} +58 -58
  52. package/build/4800.d3ebc81d.chunk.js +1 -0
  53. package/build/5250.24040688.chunk.js +11 -0
  54. package/build/6229.53b33cf0.chunk.js +194 -0
  55. package/build/7418.6db737ce.chunk.js +112 -0
  56. package/build/8773.54a26ded.chunk.js +327 -0
  57. package/build/9066.2847fdff.chunk.js +101 -0
  58. package/build/9262.25aa12a5.chunk.js +1 -0
  59. package/build/9420.ba035f29.chunk.js +508 -0
  60. package/build/Admin-authenticatedApp.52f3c150.chunk.js +80 -0
  61. package/build/{Admin_homePage.f157e33e.chunk.js → Admin_homePage.0ac648e8.chunk.js} +2 -2
  62. package/build/Admin_marketplace.71c66b49.chunk.js +11 -0
  63. package/build/{Admin_profilePage.62c203ad.chunk.js → Admin_profilePage.27191ed2.chunk.js} +1 -1
  64. package/build/Admin_settingsPage.021da806.chunk.js +178 -0
  65. package/build/{admin-edit-roles-page.94e1403b.chunk.js → admin-edit-roles-page.fb374555.chunk.js} +1 -1
  66. package/build/admin-edit-users.a360deaf.chunk.js +10 -0
  67. package/build/admin-users.47d06d24.chunk.js +11 -0
  68. package/build/api-tokens-create-page.698f132d.chunk.js +1 -0
  69. package/build/api-tokens-edit-page.afece2fe.chunk.js +1 -0
  70. package/build/{api-tokens-list-page.340750a6.chunk.js → api-tokens-list-page.46d96dee.chunk.js} +1 -1
  71. package/build/content-manager.afcc3624.chunk.js +1182 -0
  72. package/build/email-settings-page.8871dfe8.chunk.js +103 -0
  73. package/build/en-json.0a5ba154.chunk.js +1 -0
  74. package/build/i18n-settings-page.dfb4eb01.chunk.js +101 -0
  75. package/build/index.html +1 -1
  76. package/build/main.ca3856ed.js +8640 -0
  77. package/build/pl-json.f65302c2.chunk.js +1 -0
  78. package/build/{runtime~main.e7611418.js → runtime~main.48a46dd2.js} +1 -1
  79. package/build/{sso-settings-page.e9034e22.chunk.js → sso-settings-page.dfb0b917.chunk.js} +1 -1
  80. package/build/upload-settings.8d8c672a.chunk.js +101 -0
  81. package/build/upload-translation-de-json.745613c0.chunk.js +1 -0
  82. package/build/upload-translation-dk-json.cb25dcf0.chunk.js +1 -0
  83. package/build/upload-translation-en-json.e78688a0.chunk.js +1 -0
  84. package/build/upload-translation-es-json.1f344b53.chunk.js +1 -0
  85. package/build/upload-translation-fr-json.e21c0c7a.chunk.js +1 -0
  86. package/build/upload-translation-he-json.4ce77b7b.chunk.js +1 -0
  87. package/build/upload-translation-it-json.5ce11e0b.chunk.js +1 -0
  88. package/build/upload-translation-ja-json.22afae44.chunk.js +1 -0
  89. package/build/upload-translation-ko-json.9a2c21cb.chunk.js +1 -0
  90. package/build/upload-translation-ms-json.0605d6da.chunk.js +1 -0
  91. package/build/upload-translation-pl-json.e534b676.chunk.js +1 -0
  92. package/build/upload-translation-pt-BR-json.95686cfb.chunk.js +1 -0
  93. package/build/upload-translation-ru-json.37bd1546.chunk.js +1 -0
  94. package/build/upload-translation-sk-json.b03d4904.chunk.js +1 -0
  95. package/build/upload-translation-th-json.64dd70ce.chunk.js +1 -0
  96. package/build/upload-translation-uk-json.1328cb3e.chunk.js +1 -0
  97. package/build/{upload-translation-zh-Hans-json.c9622577.chunk.js → upload-translation-zh-Hans-json.6832ff81.chunk.js} +1 -1
  98. package/build/upload-translation-zh-json.ee8fba96.chunk.js +1 -0
  99. package/build/upload.5622b777.chunk.js +7 -0
  100. package/build/users-advanced-settings-page.4af9e241.chunk.js +101 -0
  101. package/build/users-email-settings-page.d69c0d87.chunk.js +101 -0
  102. package/build/users-providers-settings-page.fc1fda6d.chunk.js +101 -0
  103. package/build/vi-json.bf3424be.chunk.js +1 -0
  104. package/build/webhook-edit-page.a7ae6e3b.chunk.js +23 -0
  105. package/build/webhook-list-page.057f396c.chunk.js +133 -0
  106. package/index.js +2 -8
  107. package/package.json +10 -9
  108. package/scripts/build.js +3 -1
  109. package/server/config/admin-actions.js +14 -0
  110. package/server/controllers/admin.js +40 -2
  111. package/server/routes/admin.js +28 -1
  112. package/server/services/index.js +1 -0
  113. package/server/services/project-settings.js +173 -0
  114. package/server/utils/index.d.ts +2 -0
  115. package/server/validation/project-settings.js +39 -0
  116. package/utils/create-cache-dir.js +6 -36
  117. package/utils/get-custom-app-config-file.js +7 -2
  118. package/utils/get-plugins-path.js +1 -1
  119. package/admin/src/content-manager/components/SelectWrapper/ClearIndicator.js +0 -18
  120. package/admin/src/content-manager/components/SelectWrapper/DropdownIndicator.js +0 -24
  121. package/admin/src/content-manager/components/SelectWrapper/IconBox.js +0 -20
  122. package/admin/src/content-manager/components/SelectWrapper/IndicatorSeparator.js +0 -3
  123. package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +0 -92
  124. package/build/1709.ceed0e18.chunk.js +0 -503
  125. package/build/1856.521a99fd.chunk.js +0 -172
  126. package/build/20.cf744c35.chunk.js +0 -308
  127. package/build/2077.51485bfb.chunk.js +0 -194
  128. package/build/2135.95ee6de1.chunk.js +0 -162
  129. package/build/2524.688d0355.chunk.js +0 -1
  130. package/build/2912.79c2b3c8.chunk.js +0 -253
  131. package/build/4715.77e04177.chunk.js +0 -385
  132. package/build/4761.3eabdf46.chunk.js +0 -101
  133. package/build/6229.a5cca9f2.chunk.js +0 -194
  134. package/build/6281.f10a7e3a.chunk.js +0 -1
  135. package/build/7009.79fce86d.chunk.js +0 -164
  136. package/build/7191.3bde3cbf.chunk.js +0 -335
  137. package/build/7841.f0e7d629.chunk.js +0 -253
  138. package/build/7863.bc7a8f3a.chunk.js +0 -112
  139. package/build/9420.cb0b75e8.chunk.js +0 -508
  140. package/build/Admin-authenticatedApp.4ce8d292.chunk.js +0 -80
  141. package/build/Admin_marketplace.1e3393c9.chunk.js +0 -11
  142. package/build/Admin_settingsPage.924a7816.chunk.js +0 -170
  143. package/build/admin-edit-users.6c2bf718.chunk.js +0 -10
  144. package/build/admin-users.e03db115.chunk.js +0 -11
  145. package/build/api-tokens-create-page.787ab302.chunk.js +0 -1
  146. package/build/api-tokens-edit-page.e4010c0c.chunk.js +0 -1
  147. package/build/content-manager.6cdcfb6e.chunk.js +0 -1204
  148. package/build/email-settings-page.f67d13b2.chunk.js +0 -103
  149. package/build/en-json.3e1a222e.chunk.js +0 -1
  150. package/build/i18n-settings-page.6b67cb75.chunk.js +0 -101
  151. package/build/main.45472ea9.js +0 -8404
  152. package/build/pl-json.94f05d2c.chunk.js +0 -1
  153. package/build/upload-settings.3db55de0.chunk.js +0 -101
  154. package/build/upload-translation-de-json.b642da08.chunk.js +0 -1
  155. package/build/upload-translation-dk-json.fc61df13.chunk.js +0 -1
  156. package/build/upload-translation-en-json.59269508.chunk.js +0 -1
  157. package/build/upload-translation-es-json.8ec935ef.chunk.js +0 -1
  158. package/build/upload-translation-fr-json.eb9b4f84.chunk.js +0 -1
  159. package/build/upload-translation-he-json.c226f2dc.chunk.js +0 -1
  160. package/build/upload-translation-it-json.8e58456e.chunk.js +0 -1
  161. package/build/upload-translation-ja-json.1378a2e7.chunk.js +0 -1
  162. package/build/upload-translation-ko-json.5e06e112.chunk.js +0 -1
  163. package/build/upload-translation-ms-json.dc3bf0d7.chunk.js +0 -1
  164. package/build/upload-translation-pl-json.6071e38c.chunk.js +0 -1
  165. package/build/upload-translation-pt-BR-json.7e8d9550.chunk.js +0 -1
  166. package/build/upload-translation-ru-json.da2529f3.chunk.js +0 -1
  167. package/build/upload-translation-sk-json.bfdf4f09.chunk.js +0 -1
  168. package/build/upload-translation-th-json.6a48b826.chunk.js +0 -1
  169. package/build/upload-translation-uk-json.6fb09148.chunk.js +0 -1
  170. package/build/upload-translation-zh-json.711f804b.chunk.js +0 -1
  171. package/build/upload.070c189b.chunk.js +0 -105
  172. package/build/users-advanced-settings-page.a23cda17.chunk.js +0 -101
  173. package/build/users-email-settings-page.0a096388.chunk.js +0 -1
  174. package/build/users-providers-settings-page.bfe7755a.chunk.js +0 -1
  175. package/build/vi-json.3d14e91e.chunk.js +0 -1
  176. package/build/webhook-edit-page.2fa94db3.chunk.js +0 -23
  177. package/build/webhook-list-page.b594db49.chunk.js +0 -133
@@ -0,0 +1,51 @@
1
+ import React, { useReducer, useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { ConfigurationsContext } from '../../contexts';
4
+ import reducer, { initialState } from './reducer';
5
+
6
+ const ConfigurationsProvider = ({
7
+ children,
8
+ authLogo,
9
+ menuLogo: defaultMenuLogo,
10
+ showReleaseNotification,
11
+ showTutorials,
12
+ }) => {
13
+ const [{ menuLogo }, dispatch] = useReducer(reducer, initialState);
14
+
15
+ const updateProjectSettings = ({ menuLogo }) => {
16
+ return dispatch({
17
+ type: 'UPDATE_PROJECT_SETTINGS',
18
+ values: {
19
+ menuLogo: menuLogo || defaultMenuLogo,
20
+ },
21
+ });
22
+ };
23
+
24
+ const updateProjectSettingsRef = useRef(updateProjectSettings);
25
+
26
+ return (
27
+ <ConfigurationsContext.Provider
28
+ value={{
29
+ logos: {
30
+ menu: { custom: menuLogo, default: defaultMenuLogo },
31
+ auth: { custom: null, default: authLogo },
32
+ },
33
+ updateProjectSettings: updateProjectSettingsRef.current,
34
+ showReleaseNotification,
35
+ showTutorials,
36
+ }}
37
+ >
38
+ {children}
39
+ </ConfigurationsContext.Provider>
40
+ );
41
+ };
42
+
43
+ ConfigurationsProvider.propTypes = {
44
+ authLogo: PropTypes.string.isRequired,
45
+ children: PropTypes.element.isRequired,
46
+ menuLogo: PropTypes.string.isRequired,
47
+ showReleaseNotification: PropTypes.bool.isRequired,
48
+ showTutorials: PropTypes.bool.isRequired,
49
+ };
50
+
51
+ export default ConfigurationsProvider;
@@ -0,0 +1,28 @@
1
+ /* eslint-disable consistent-return */
2
+ /*
3
+ *
4
+ * ConfigurationsProvider reducer
5
+ *
6
+ */
7
+
8
+ import produce from 'immer';
9
+
10
+ const initialState = {
11
+ menuLogo: null,
12
+ };
13
+
14
+ const reducer = (state = initialState, action) =>
15
+ produce(state, draftState => {
16
+ switch (action.type) {
17
+ case 'UPDATE_PROJECT_SETTINGS': {
18
+ Object.assign(draftState, action.values);
19
+ break;
20
+ }
21
+ default: {
22
+ return draftState;
23
+ }
24
+ }
25
+ });
26
+
27
+ export default reducer;
28
+ export { initialState };
@@ -53,7 +53,9 @@ const LinkUser = styled(RouterNavLink)`
53
53
  const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
54
54
  const buttonRef = useRef();
55
55
  const [userLinksVisible, setUserLinksVisible] = useState(false);
56
- const { menuLogo } = useConfigurations();
56
+ const {
57
+ logos: { menu },
58
+ } = useConfigurations();
57
59
  const [condensed, setCondensed] = usePersistentState('navbar-condensed', false);
58
60
  const { userDisplayName } = useAppInfos();
59
61
  const { formatMessage } = useIntl();
@@ -94,7 +96,15 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
94
96
  defaultMessage: 'Workplace',
95
97
  })}
96
98
  title={menuTitle}
97
- icon={<img src={menuLogo} alt={menuTitle} />}
99
+ icon={
100
+ <img
101
+ src={menu.custom || menu.default}
102
+ alt={formatMessage({
103
+ id: 'app.components.LeftMenu.logo.alt',
104
+ defaultMessage: 'Application logo',
105
+ })}
106
+ />
107
+ }
98
108
  />
99
109
 
100
110
  <Divider />
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
3
3
  import { QueryClientProvider, QueryClient } from 'react-query';
4
4
  import { LibraryProvider, StrapiAppProvider } from '@strapi/helper-plugin';
5
5
  import { Provider } from 'react-redux';
6
- import { AdminContext, ConfigurationsContext } from '../../contexts';
6
+ import { AdminContext } from '../../contexts';
7
+ import ConfigurationsProvider from '../ConfigurationsProvider';
7
8
  import LanguageProvider from '../LanguageProvider';
8
9
  import GuidedTour from '../GuidedTour';
9
10
  import AutoReloadOverlayBlockerProvider from '../AutoReloadOverlayBlockerProvider';
@@ -47,8 +48,11 @@ const Providers = ({
47
48
  <QueryClientProvider client={queryClient}>
48
49
  <Provider store={store}>
49
50
  <AdminContext.Provider value={{ getAdminInjectedComponents }}>
50
- <ConfigurationsContext.Provider
51
- value={{ authLogo, menuLogo, showReleaseNotification, showTutorials }}
51
+ <ConfigurationsProvider
52
+ authLogo={authLogo}
53
+ menuLogo={menuLogo}
54
+ showReleaseNotification={showReleaseNotification}
55
+ showTutorials={showTutorials}
52
56
  >
53
57
  <StrapiAppProvider
54
58
  getPlugin={getPlugin}
@@ -71,7 +75,7 @@ const Providers = ({
71
75
  </LanguageProvider>
72
76
  </LibraryProvider>
73
77
  </StrapiAppProvider>
74
- </ConfigurationsContext.Provider>
78
+ </ConfigurationsProvider>
75
79
  </AdminContext.Provider>
76
80
  </Provider>
77
81
  </QueryClientProvider>
@@ -7,9 +7,11 @@ const Img = styled.img`
7
7
  `;
8
8
 
9
9
  const Logo = () => {
10
- const { authLogo } = useConfigurations();
10
+ const {
11
+ logos: { auth },
12
+ } = useConfigurations();
11
13
 
12
- return <Img src={authLogo} aria-hidden alt="" />;
14
+ return <Img src={auth.default} aria-hidden alt="" />;
13
15
  };
14
16
 
15
17
  export default Logo;
@@ -15,12 +15,12 @@ import {
15
15
  useOverlayBlocker,
16
16
  useTracking,
17
17
  getYupInnerErrors,
18
+ getAPIInnerErrors,
18
19
  } from '@strapi/helper-plugin';
19
20
 
20
21
  import { getTrad, removeKeyInObject } from '../../utils';
21
22
  import reducer, { initialState } from './reducer';
22
23
  import { cleanData, createYupSchema } from './utils';
23
- import { getAPIInnerError } from './utils/getAPIInnerError';
24
24
 
25
25
  const EditViewDataManagerProvider = ({
26
26
  allLayoutData,
@@ -316,7 +316,7 @@ const EditViewDataManagerProvider = ({
316
316
  } catch (err) {
317
317
  errors = {
318
318
  ...errors,
319
- ...getAPIInnerError(err),
319
+ ...getAPIInnerErrors(err),
320
320
  };
321
321
  }
322
322
 
@@ -352,7 +352,7 @@ const EditViewDataManagerProvider = ({
352
352
  } catch (err) {
353
353
  errors = {
354
354
  ...errors,
355
- ...getAPIInnerError(err),
355
+ ...getAPIInnerErrors(err),
356
356
  };
357
357
  }
358
358
 
@@ -2,7 +2,8 @@ import React, { memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
4
  import isEmpty from 'lodash/isEmpty';
5
- import Select, { createFilter } from 'react-select';
5
+ import { createFilter } from 'react-select';
6
+ import { ReactSelect as Select } from '@strapi/helper-plugin';
6
7
  import { Box } from '@strapi/design-system/Box';
7
8
  import { Stack } from '@strapi/design-system/Stack';
8
9
  import { Typography } from '@strapi/design-system/Typography';
@@ -24,7 +25,6 @@ function SelectMany({
24
25
  options,
25
26
  placeholder,
26
27
  searchToPersist,
27
- styles,
28
28
  targetModel,
29
29
  value,
30
30
  description,
@@ -72,7 +72,6 @@ function SelectMany({
72
72
  placeholder={formatMessage(
73
73
  placeholder || { id: 'global.select', defaultMessage: 'Select...' }
74
74
  )}
75
- styles={styles}
76
75
  value={[]}
77
76
  />
78
77
  <Box paddingTop={3} style={{ overflow: 'auto' }}>
@@ -138,7 +137,6 @@ SelectMany.propTypes = {
138
137
  defaultMessage: PropTypes.string.isRequired,
139
138
  }),
140
139
  searchToPersist: PropTypes.string,
141
- styles: PropTypes.object.isRequired,
142
140
  targetModel: PropTypes.string.isRequired,
143
141
  value: PropTypes.array,
144
142
  description: PropTypes.string,
@@ -2,7 +2,7 @@ import React, { useCallback, useState, useEffect, useMemo, memo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { useLocation } from 'react-router-dom';
5
- import { useTheme } from 'styled-components';
5
+ import { Stack } from '@strapi/design-system/Stack';
6
6
  import findIndex from 'lodash/findIndex';
7
7
  import get from 'lodash/get';
8
8
  import isArray from 'lodash/isArray';
@@ -16,18 +16,13 @@ import {
16
16
  } from '@strapi/helper-plugin';
17
17
  import { stringify } from 'qs';
18
18
  import axios from 'axios';
19
- import { Stack } from '@strapi/design-system/Stack';
20
19
  import { axiosInstance } from '../../../core/utils';
21
20
  import { getTrad } from '../../utils';
22
21
  import Label from './Label';
23
22
  import SelectOne from '../SelectOne';
24
23
  import SelectMany from '../SelectMany';
25
- import ClearIndicator from './ClearIndicator';
26
- import DropdownIndicator from './DropdownIndicator';
27
- import IndicatorSeparator from './IndicatorSeparator';
28
24
  import Option from './Option';
29
25
  import { connect, select } from './utils';
30
- import getSelectStyles from './utils/getSelectStyles';
31
26
 
32
27
  const initialPaginationState = {
33
28
  contains: '',
@@ -77,7 +72,6 @@ function SelectWrapper({
77
72
  onRemoveRelation,
78
73
  } = useCMEditViewDataManager();
79
74
  const { pathname } = useLocation();
80
- const theme = useTheme();
81
75
 
82
76
  const value = get(modifiedData, name, null);
83
77
  const [state, setState] = useState(initialPaginationState);
@@ -278,8 +272,6 @@ function SelectWrapper({
278
272
  return <NotAllowedInput intlLabel={intlLabel} labelAction={labelAction} />;
279
273
  }
280
274
 
281
- const styles = getSelectStyles(theme);
282
-
283
275
  return (
284
276
  <Stack spacing={1}>
285
277
  <Label
@@ -293,9 +285,6 @@ function SelectWrapper({
293
285
  <Component
294
286
  addRelation={handleAddRelation}
295
287
  components={{
296
- ClearIndicator,
297
- DropdownIndicator,
298
- IndicatorSeparator,
299
288
  Option,
300
289
  }}
301
290
  displayNavigationLink={shouldDisplayRelationLink}
@@ -315,7 +304,6 @@ function SelectWrapper({
315
304
  onRemove={onRemoveRelation}
316
305
  placeholder={placeholder}
317
306
  searchToPersist={searchToPersist}
318
- styles={styles}
319
307
  targetModel={targetModel}
320
308
  value={value}
321
309
  description={description}
@@ -0,0 +1,23 @@
1
+ import { useQuery } from 'react-query';
2
+ import { useNotification } from '@strapi/helper-plugin';
3
+ import { fetchMarketplacePlugins } from './utils/api';
4
+
5
+ const useFetchMarketplaceProviders = notifyLoad => {
6
+ const toggleNotification = useNotification();
7
+
8
+ return useQuery('list-marketplace-providers', () => fetchMarketplacePlugins(), {
9
+ onSuccess: () => {
10
+ if (notifyLoad) {
11
+ notifyLoad();
12
+ }
13
+ },
14
+ onError: () => {
15
+ toggleNotification({
16
+ type: 'warning',
17
+ message: { id: 'notification.error', defaultMessage: 'An error occured' },
18
+ });
19
+ },
20
+ });
21
+ };
22
+
23
+ export default useFetchMarketplaceProviders;
@@ -0,0 +1,11 @@
1
+ import axios from 'axios';
2
+
3
+ const MARKETPLACE_API_URL = 'https://market-api.strapi.io';
4
+
5
+ const fetchMarketplacePlugins = async () => {
6
+ const { data } = await axios.get(`${MARKETPLACE_API_URL}/providers`);
7
+
8
+ return data;
9
+ };
10
+
11
+ export { fetchMarketplacePlugins };
@@ -12,6 +12,7 @@ import {
12
12
  request,
13
13
  useNotification,
14
14
  TrackingContext,
15
+ prefixFileUrlWithBackendUrl,
15
16
  } from '@strapi/helper-plugin';
16
17
  import axios from 'axios';
17
18
  import { SkipToContent } from '@strapi/design-system/Main';
@@ -23,6 +24,7 @@ import NotFoundPage from '../NotFoundPage';
23
24
  import UseCasePage from '../UseCasePage';
24
25
  import { getUID } from './utils';
25
26
  import routes from './utils/routes';
27
+ import { useConfigurations } from '../../hooks';
26
28
 
27
29
  const AuthenticatedApp = lazy(() =>
28
30
  import(/* webpackChunkName: "Admin-authenticatedApp" */ '../../components/AuthenticatedApp')
@@ -30,6 +32,7 @@ const AuthenticatedApp = lazy(() =>
30
32
 
31
33
  function App() {
32
34
  const toggleNotification = useNotification();
35
+ const { updateProjectSettings } = useConfigurations();
33
36
  const { formatMessage } = useIntl();
34
37
  const [{ isLoading, hasAdmin, uuid }, setState] = useState({ isLoading: true, hasAdmin: false });
35
38
 
@@ -70,10 +73,12 @@ function App() {
70
73
  try {
71
74
  const {
72
75
  data: {
73
- data: { hasAdmin, uuid },
76
+ data: { hasAdmin, uuid, menuLogo },
74
77
  },
75
78
  } = await axios.get(`${strapi.backendURL}/admin/init`);
76
79
 
80
+ updateProjectSettings({ menuLogo: prefixFileUrlWithBackendUrl(menuLogo) });
81
+
77
82
  if (uuid) {
78
83
  const {
79
84
  data: { data: properties },
@@ -113,7 +118,7 @@ function App() {
113
118
  };
114
119
 
115
120
  getData();
116
- }, [toggleNotification]);
121
+ }, [toggleNotification, updateProjectSettings]);
117
122
 
118
123
  const setHasAdmin = hasAdmin => setState(prev => ({ ...prev, hasAdmin }));
119
124
 
@@ -9,7 +9,7 @@ const EmptyPluginCard = styled(Box)`
9
9
  opacity: 0.33;
10
10
  `;
11
11
 
12
- export const EmptyPluginGrid = () => {
12
+ export const EmptyNpmPackageGrid = () => {
13
13
  return (
14
14
  <GridLayout>
15
15
  {Array(12)
@@ -5,12 +5,12 @@ import { Box } from '@strapi/design-system/Box';
5
5
  import { Flex } from '@strapi/design-system/Flex';
6
6
  import { Icon } from '@strapi/design-system/Icon';
7
7
  import EmptyStateDocument from '@strapi/icons/EmptyDocuments';
8
- import { EmptyPluginGrid } from './EmptyPluginGrid';
8
+ import { EmptyNpmPackageGrid } from './EmptyNpmPackageGrid';
9
9
 
10
- export const EmptyPluginSearch = ({ content }) => {
10
+ const EmptyNpmPackageSearch = ({ content }) => {
11
11
  return (
12
12
  <Box position="relative">
13
- <EmptyPluginGrid />
13
+ <EmptyNpmPackageGrid />
14
14
  <Box position="absolute" top={11} width="100%">
15
15
  <Flex alignItems="center" justifyContent="center" direction="column">
16
16
  <Icon as={EmptyStateDocument} color="" width="160px" height="88px" />
@@ -25,6 +25,8 @@ export const EmptyPluginSearch = ({ content }) => {
25
25
  );
26
26
  };
27
27
 
28
- EmptyPluginSearch.propTypes = {
28
+ EmptyNpmPackageSearch.propTypes = {
29
29
  content: PropTypes.string.isRequired,
30
30
  };
31
+
32
+ export default EmptyNpmPackageSearch;
@@ -25,12 +25,18 @@ const EllipsisText = styled(Typography)`
25
25
  overflow: hidden;
26
26
  `;
27
27
 
28
- const PluginCard = ({ plugin, installedPluginNames, useYarn, isInDevelopmentMode }) => {
29
- const { attributes } = plugin;
28
+ const NpmPackageCard = ({
29
+ npmPackage,
30
+ installedPackageNames,
31
+ useYarn,
32
+ isInDevelopmentMode,
33
+ npmPackageType,
34
+ }) => {
35
+ const { attributes } = npmPackage;
30
36
  const { formatMessage } = useIntl();
31
37
  const { trackUsage } = useTracking();
32
38
 
33
- const isInstalled = installedPluginNames.includes(attributes.npmPackageName);
39
+ const isInstalled = installedPackageNames.includes(attributes.npmPackageName);
34
40
 
35
41
  const commandToCopy = useYarn
36
42
  ? `yarn add ${attributes.npmPackageName}`
@@ -41,6 +47,11 @@ const PluginCard = ({ plugin, installedPluginNames, useYarn, isInDevelopmentMode
41
47
  defaultMessage: 'Made by Strapi',
42
48
  });
43
49
 
50
+ const npmPackageHref =
51
+ npmPackageType === 'provider'
52
+ ? attributes.npmPackageUrl
53
+ : `https://market.strapi.io/plugins/${attributes.slug}`;
54
+
44
55
  return (
45
56
  <Flex
46
57
  direction="column"
@@ -107,7 +118,7 @@ const PluginCard = ({ plugin, installedPluginNames, useYarn, isInDevelopmentMode
107
118
  <Stack horizontal spacing={2} style={{ alignSelf: 'flex-end' }} paddingTop={6}>
108
119
  <LinkButton
109
120
  size="S"
110
- href={`https://market.strapi.io/plugins/${attributes.slug}`}
121
+ href={npmPackageHref}
111
122
  isExternal
112
123
  endIcon={<ExternalLink />}
113
124
  aria-label={formatMessage(
@@ -135,12 +146,12 @@ const PluginCard = ({ plugin, installedPluginNames, useYarn, isInDevelopmentMode
135
146
  );
136
147
  };
137
148
 
138
- PluginCard.defaultProps = {
149
+ NpmPackageCard.defaultProps = {
139
150
  isInDevelopmentMode: false,
140
151
  };
141
152
 
142
- PluginCard.propTypes = {
143
- plugin: PropTypes.shape({
153
+ NpmPackageCard.propTypes = {
154
+ npmPackage: PropTypes.shape({
144
155
  id: PropTypes.string.isRequired,
145
156
  attributes: PropTypes.shape({
146
157
  name: PropTypes.string.isRequired,
@@ -153,12 +164,13 @@ PluginCard.propTypes = {
153
164
  developerName: PropTypes.string.isRequired,
154
165
  validated: PropTypes.bool.isRequired,
155
166
  madeByStrapi: PropTypes.bool.isRequired,
156
- strapiCompatibility: PropTypes.oneOf(['v3', 'v4']).isRequired,
167
+ strapiCompatibility: PropTypes.oneOf(['v3', 'v4']),
157
168
  }).isRequired,
158
169
  }).isRequired,
159
- installedPluginNames: PropTypes.arrayOf(PropTypes.string).isRequired,
170
+ installedPackageNames: PropTypes.arrayOf(PropTypes.string).isRequired,
160
171
  useYarn: PropTypes.bool.isRequired,
161
172
  isInDevelopmentMode: PropTypes.bool,
173
+ npmPackageType: PropTypes.string.isRequired,
162
174
  };
163
175
 
164
- export default PluginCard;
176
+ export default NpmPackageCard;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Grid, GridItem } from '@strapi/design-system/Grid';
4
+ import NpmPackageCard from '../NpmPackageCard';
5
+
6
+ const NpmPackagesGrid = ({
7
+ npmPackages,
8
+ installedPackageNames,
9
+ useYarn,
10
+ isInDevelopmentMode,
11
+ npmPackageType,
12
+ }) => {
13
+ return (
14
+ <Grid gap={4}>
15
+ {npmPackages.map(npmPackage => (
16
+ <GridItem col={4} s={6} xs={12} style={{ height: '100%' }} key={npmPackage.id}>
17
+ <NpmPackageCard
18
+ npmPackage={npmPackage}
19
+ installedPackageNames={installedPackageNames}
20
+ useYarn={useYarn}
21
+ isInDevelopmentMode={isInDevelopmentMode}
22
+ npmPackageType={npmPackageType}
23
+ />
24
+ </GridItem>
25
+ ))}
26
+ </Grid>
27
+ );
28
+ };
29
+
30
+ NpmPackagesGrid.defaultProps = {
31
+ installedPackageNames: [],
32
+ };
33
+
34
+ NpmPackagesGrid.propTypes = {
35
+ npmPackages: PropTypes.array.isRequired,
36
+ installedPackageNames: PropTypes.arrayOf(PropTypes.string),
37
+ useYarn: PropTypes.bool.isRequired,
38
+ isInDevelopmentMode: PropTypes.bool.isRequired,
39
+ npmPackageType: PropTypes.string.isRequired,
40
+ };
41
+
42
+ export default NpmPackagesGrid;
@@ -6,10 +6,12 @@ import { LinkButton } from '@strapi/design-system/v2/LinkButton';
6
6
  import Upload from '@strapi/icons/Upload';
7
7
  import { useTracking } from '@strapi/helper-plugin';
8
8
 
9
- const PageHeader = ({ isOnline }) => {
9
+ const PageHeader = ({ isOnline, npmPackageType }) => {
10
10
  const { formatMessage } = useIntl();
11
11
  const { trackUsage } = useTracking();
12
12
 
13
+ const tracking = npmPackageType === 'provider' ? 'didSubmitProvider' : 'didSubmitPlugin';
14
+
13
15
  return (
14
16
  <HeaderLayout
15
17
  title={formatMessage({
@@ -25,13 +27,13 @@ const PageHeader = ({ isOnline }) => {
25
27
  <LinkButton
26
28
  startIcon={<Upload />}
27
29
  variant="tertiary"
28
- href="https://market.strapi.io/submit-plugin"
29
- onClick={() => trackUsage('didSubmitPlugin')}
30
+ href={`https://market.strapi.io/submit-${npmPackageType}`}
31
+ onClick={() => trackUsage(tracking)}
30
32
  isExternal
31
33
  >
32
34
  {formatMessage({
33
- id: 'admin.pages.MarketPlacePage.submit.plugin.link',
34
- defaultMessage: 'Submit your plugin',
35
+ id: `admin.pages.MarketPlacePage.submit.${npmPackageType}.link`,
36
+ defaultMessage: `Submit ${npmPackageType}`,
35
37
  })}
36
38
  </LinkButton>
37
39
  )
@@ -42,6 +44,11 @@ const PageHeader = ({ isOnline }) => {
42
44
 
43
45
  export default PageHeader;
44
46
 
47
+ PageHeader.defaultProps = {
48
+ npmPackageType: 'plugin',
49
+ };
50
+
45
51
  PageHeader.propTypes = {
46
52
  isOnline: PropTypes.bool.isRequired,
53
+ npmPackageType: PropTypes.string,
47
54
  };