@strapi/admin 4.12.0-beta.0 → 4.12.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 (133) hide show
  1. package/admin/src/content-manager/pages/EditView/Information/index.js +1 -1
  2. package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +1 -2
  3. package/admin/src/content-manager/pages/EditView/InformationBox/index.js +1 -3
  4. package/admin/src/content-manager/pages/EditView/index.js +14 -2
  5. package/admin/src/hooks/useSettingsMenu/index.js +35 -21
  6. package/admin/src/pages/AuthPage/components/Login/index.js +3 -5
  7. package/admin/src/pages/AuthPage/constants.js +3 -2
  8. package/admin/src/pages/AuthPage/index.js +18 -1
  9. package/admin/src/pages/HomePage/index.js +19 -7
  10. package/admin/src/pages/ProfilePage/index.js +6 -11
  11. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +13 -11
  12. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +17 -1
  13. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +15 -2
  14. package/admin/src/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +2 -4
  15. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +15 -1
  16. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +36 -5
  17. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  18. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  19. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +16 -1
  20. package/build/1049.758a01f5.chunk.js +1 -0
  21. package/build/{3528.4845cf92.chunk.js → 1386.762d6eb8.chunk.js} +1 -1
  22. package/build/1727.b49f0713.chunk.js +1 -0
  23. package/build/190.66d89241.chunk.js +117 -0
  24. package/build/{5563.a146acac.chunk.js → 2225.15d1df72.chunk.js} +2 -2
  25. package/build/2379.d33a2e16.chunk.js +1 -0
  26. package/build/2395.b0419a54.chunk.js +26 -0
  27. package/build/2801.18ac397d.chunk.js +1 -0
  28. package/build/{7394.423886bd.chunk.js → 3100.21c343fa.chunk.js} +1 -1
  29. package/build/311.cb0884bb.chunk.js +1 -0
  30. package/build/3483.e182b190.chunk.js +1 -0
  31. package/build/3984.ea7b8036.chunk.js +1 -0
  32. package/build/4546.ff9fdf30.chunk.js +1 -0
  33. package/build/502.ccb38223.chunk.js +1 -0
  34. package/build/5483.ed2c7efa.chunk.js +6 -0
  35. package/build/{5542.c62d0daf.chunk.js → 5542.2415a393.chunk.js} +6 -6
  36. package/build/6158.f9d82db9.chunk.js +1 -0
  37. package/build/7030.b98dcedf.chunk.js +1 -0
  38. package/build/7464.c6d0565c.chunk.js +1 -0
  39. package/build/8276.23e0763b.chunk.js +26 -0
  40. package/build/918.54414509.chunk.js +1 -0
  41. package/build/{9932.7e2b71de.chunk.js → 9932.b5a3bb3a.chunk.js} +81 -81
  42. package/build/{9944.29289a16.chunk.js → 9944.7af075a5.chunk.js} +1 -1
  43. package/build/{Admin-authenticatedApp.9d3afb79.chunk.js → Admin-authenticatedApp.2ffa318a.chunk.js} +5 -5
  44. package/build/Admin_InternalErrorPage.f45f2462.chunk.js +1 -0
  45. package/build/{Admin_homePage.be30ef4e.chunk.js → Admin_homePage.ac9dfb86.chunk.js} +23 -15
  46. package/build/{Admin_marketplace.74a58e20.chunk.js → Admin_marketplace.f0b87fce.chunk.js} +1 -1
  47. package/build/{Admin_pluginsPage.ce464189.chunk.js → Admin_pluginsPage.8728ff6e.chunk.js} +1 -1
  48. package/build/{Admin_profilePage.2131eb68.chunk.js → Admin_profilePage.a968035f.chunk.js} +2 -2
  49. package/build/Admin_settingsPage.3ad19487.chunk.js +79 -0
  50. package/build/Upload_ConfigureTheView.345ac1e0.chunk.js +1 -0
  51. package/build/admin-app.088bcd33.chunk.js +36 -0
  52. package/build/{admin-edit-roles-page.3fdd6b9d.chunk.js → admin-edit-roles-page.a49b9f4f.chunk.js} +4 -4
  53. package/build/admin-edit-users.67704088.chunk.js +10 -0
  54. package/build/{admin-roles-list.e17b00d7.chunk.js → admin-roles-list.0c129e98.chunk.js} +1 -1
  55. package/build/admin-users.3279ffb0.chunk.js +11 -0
  56. package/build/api-tokens-create-page.46c2ea84.chunk.js +1 -0
  57. package/build/{api-tokens-edit-page.9a1dd2fa.chunk.js → api-tokens-edit-page.58139df9.chunk.js} +1 -1
  58. package/build/{api-tokens-list-page.a103f526.chunk.js → api-tokens-list-page.505bf7e0.chunk.js} +2 -2
  59. package/build/audit-logs-settings-page.4b422831.chunk.js +1 -0
  60. package/build/content-manager.9b569036.chunk.js +1094 -0
  61. package/build/{content-type-builder-list-view.a200a358.chunk.js → content-type-builder-list-view.bf9be456.chunk.js} +9 -9
  62. package/build/{content-type-builder-translation-zh-json.ad24dbeb.chunk.js → content-type-builder-translation-zh-json.958d90e1.chunk.js} +1 -1
  63. package/build/content-type-builder.3963fb2d.chunk.js +166 -0
  64. package/build/{email-settings-page.45695daa.chunk.js → email-settings-page.d494d1eb.chunk.js} +2 -2
  65. package/build/{i18n-settings-page.29308d0b.chunk.js → i18n-settings-page.47f78016.chunk.js} +1 -1
  66. package/build/index.html +1 -1
  67. package/build/main.98c989b0.js +2908 -0
  68. package/build/review-workflows-settings-create-view.60bc516c.chunk.js +1 -0
  69. package/build/review-workflows-settings-edit-view.898ea409.chunk.js +1 -0
  70. package/build/review-workflows-settings-list-view.240cacdf.chunk.js +56 -0
  71. package/build/{runtime~main.5e9bf4b3.js → runtime~main.44bf2a37.js} +2 -2
  72. package/build/sso-settings-page.ed6f3f15.chunk.js +1 -0
  73. package/build/transfer-tokens-create-page.1597e6ab.chunk.js +1 -0
  74. package/build/transfer-tokens-edit-page.8741529f.chunk.js +1 -0
  75. package/build/{transfer-tokens-list-page.7237443d.chunk.js → transfer-tokens-list-page.22147d2c.chunk.js} +2 -2
  76. package/build/upload-settings.cac210a0.chunk.js +14 -0
  77. package/build/upload.8d01c525.chunk.js +26 -0
  78. package/build/{users-advanced-settings-page.750b1f76.chunk.js → users-advanced-settings-page.18379a56.chunk.js} +1 -1
  79. package/build/users-email-settings-page.a87978e5.chunk.js +9 -0
  80. package/build/users-providers-settings-page.8876c1ee.chunk.js +14 -0
  81. package/build/{users-roles-settings-page.d286426a.chunk.js → users-roles-settings-page.0431f48c.chunk.js} +2 -2
  82. package/build/webhook-edit-page.a91f27a1.chunk.js +33 -0
  83. package/build/{webhook-list-page.940a40f1.chunk.js → webhook-list-page.65e1b5bb.chunk.js} +1 -1
  84. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +6 -3
  85. package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +1 -3
  86. package/ee/admin/pages/AuthPage/components/Login/index.js +3 -5
  87. package/ee/admin/pages/HomePage/index.js +11 -0
  88. package/ee/admin/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +1 -3
  89. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +1 -1
  90. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +4 -4
  91. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +20 -2
  92. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +3 -3
  93. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +2 -4
  94. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +13 -0
  95. package/ee/admin/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  96. package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  97. package/ee/server/constants/default-stages.json +1 -1
  98. package/index.js +0 -14
  99. package/package.json +11 -19
  100. package/webpack.alias.js +0 -3
  101. package/webpack.config.js +1 -75
  102. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +0 -5
  103. package/build/1386.3b2aa6a7.chunk.js +0 -3
  104. package/build/1970.39a2d75e.chunk.js +0 -1
  105. package/build/2799.cf9b491f.chunk.js +0 -1
  106. package/build/3269.1ea0f5a6.chunk.js +0 -1
  107. package/build/4485.d3c6dd1d.chunk.js +0 -6
  108. package/build/539.865446c0.chunk.js +0 -1
  109. package/build/7018.f3dad3c1.chunk.js +0 -1
  110. package/build/7259.0e25ab5d.chunk.js +0 -1
  111. package/build/9465.d8fc1377.chunk.js +0 -112
  112. package/build/Admin_InternalErrorPage.8911cb49.chunk.js +0 -1
  113. package/build/Admin_settingsPage.074655f6.chunk.js +0 -79
  114. package/build/Upload_ConfigureTheView.7a1cb9c9.chunk.js +0 -1
  115. package/build/admin-app.3ede71ad.chunk.js +0 -61
  116. package/build/admin-edit-users.78552758.chunk.js +0 -10
  117. package/build/admin-users.c23322fc.chunk.js +0 -11
  118. package/build/api-tokens-create-page.3dd4e921.chunk.js +0 -1
  119. package/build/audit-logs-settings-page.37fe915c.chunk.js +0 -1
  120. package/build/content-manager.08541eeb.chunk.js +0 -1094
  121. package/build/content-type-builder.de22f7c9.chunk.js +0 -166
  122. package/build/main.a8ede50d.js +0 -2927
  123. package/build/review-workflows-settings-create-view.56f61e18.chunk.js +0 -1
  124. package/build/review-workflows-settings-edit-view.912bc9c0.chunk.js +0 -1
  125. package/build/review-workflows-settings-list-view.cf6a08d3.chunk.js +0 -56
  126. package/build/sso-settings-page.0cdb96a6.chunk.js +0 -1
  127. package/build/transfer-tokens-create-page.de14cad4.chunk.js +0 -1
  128. package/build/transfer-tokens-edit-page.4f5e39af.chunk.js +0 -1
  129. package/build/upload-settings.cb6c14c3.chunk.js +0 -14
  130. package/build/upload.7e629643.chunk.js +0 -26
  131. package/build/users-email-settings-page.e9bcd865.chunk.js +0 -9
  132. package/build/users-providers-settings-page.a94253e9.chunk.js +0 -14
  133. package/build/webhook-edit-page.77ef4f1a.chunk.js +0 -33
@@ -124,7 +124,7 @@ Root.propTypes = {
124
124
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
125
125
  };
126
126
 
127
- export default {
127
+ export const Information = {
128
128
  Root,
129
129
  Title,
130
130
  Body,
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
- import Information from '../Information';
3
+ import { Information } from '../Information';
4
4
 
5
- // This component is overwritten by the EE counterpart
6
5
  export function InformationBoxCE() {
7
6
  return (
8
7
  <Information.Root>
@@ -1,3 +1 @@
1
- import { InformationBoxCE } from './InformationBoxCE';
2
-
3
- export default InformationBoxCE;
1
+ export * from './InformationBoxCE';
@@ -9,12 +9,12 @@ import {
9
9
  useTracking,
10
10
  } from '@strapi/helper-plugin';
11
11
  import { Layer, Pencil } from '@strapi/icons';
12
- import InformationBox from 'ee_else_ce/content-manager/pages/EditView/InformationBox';
13
12
  import PropTypes from 'prop-types';
14
13
  import { useIntl } from 'react-intl';
15
14
  import { useSelector } from 'react-redux';
16
15
  import { useLocation } from 'react-router-dom';
17
16
 
17
+ import { useEnterprise } from '../../../hooks/useEnterprise';
18
18
  import { selectAdminPermissions } from '../../../pages/App/selectors';
19
19
  import { InjectionZone } from '../../../shared/components';
20
20
  import CollectionTypeFormWrapper from '../../components/CollectionTypeFormWrapper';
@@ -29,6 +29,7 @@ import DraftAndPublishBadge from './DraftAndPublishBadge';
29
29
  import GridRow from './GridRow';
30
30
  import Header from './Header';
31
31
  import { useOnce } from './hooks/useOnce';
32
+ import { InformationBoxCE } from './InformationBox';
32
33
  import { selectCurrentLayout, selectAttributesLayout, selectCustomFieldUids } from './selectors';
33
34
  import { getFieldsActionMatchingPermissions } from './utils';
34
35
 
@@ -42,6 +43,12 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
42
43
  const permissions = useSelector(selectAdminPermissions);
43
44
  const location = useLocation();
44
45
  const toggleNotification = useNotification();
46
+ const Information = useEnterprise(
47
+ InformationBoxCE,
48
+ async () =>
49
+ (await import('../../../../../ee/admin/content-manager/pages/EditView/InformationBox'))
50
+ .InformationBoxEE
51
+ );
45
52
 
46
53
  useOnce(() => {
47
54
  /**
@@ -91,6 +98,11 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
91
98
  return <LoadingIndicatorPage />;
92
99
  }
93
100
 
101
+ // wait until the EE component is fully loaded before rendering, to prevent flickering
102
+ if (!Information) {
103
+ return null;
104
+ }
105
+
94
106
  return (
95
107
  <DataManagementWrapper allLayoutData={layout} slug={slug} id={id} origin={origin}>
96
108
  {({
@@ -202,7 +214,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
202
214
  paddingTop={6}
203
215
  shadow="tableShadow"
204
216
  >
205
- <InformationBox />
217
+ <Information />
206
218
  <InjectionZone area="contentManager.editView.informations" />
207
219
  </Box>
208
220
  <Box as="aside" aria-labelledby="links">
@@ -1,4 +1,4 @@
1
- import { useState, useEffect } from 'react';
1
+ import { useState, useEffect, useCallback } from 'react';
2
2
 
3
3
  import { hasPermissions, useRBACProvider, useStrapiApp, useAppInfo } from '@strapi/helper-plugin';
4
4
  import { useSelector } from 'react-redux';
@@ -19,25 +19,15 @@ const useSettingsMenu = () => {
19
19
  const { shouldUpdateStrapi } = useAppInfo();
20
20
  const { settings } = useStrapiApp();
21
21
  const permissions = useSelector(selectAdminPermissions);
22
+
22
23
  const { global: globalLinks, admin: adminLinks } = useEnterprise(
23
24
  LINKS_CE,
24
25
  async () => (await import('../../../../ee/admin/hooks/useSettingsMenu/constants')).LINKS_EE,
25
26
  {
26
27
  combine(ceLinks, eeLinks) {
27
- function addPermissions(link) {
28
- if (!link.id) {
29
- throw new Error('The settings menu item must have an id attribute.');
30
- }
31
-
32
- return {
33
- ...link,
34
- permissions: permissions.settings?.[link.id]?.main,
35
- };
36
- }
37
-
38
28
  return {
39
- admin: [...eeLinks.admin, ...ceLinks.admin].map(addPermissions),
40
- global: [...ceLinks.global, ...eeLinks.global].map(addPermissions),
29
+ admin: [...eeLinks.admin, ...ceLinks.admin],
30
+ global: [...ceLinks.global, ...eeLinks.global],
41
31
  };
42
32
  },
43
33
  defaultValue: {
@@ -47,6 +37,20 @@ const useSettingsMenu = () => {
47
37
  }
48
38
  );
49
39
 
40
+ const addPermissions = useCallback(
41
+ (link) => {
42
+ if (!link.id) {
43
+ throw new Error('The settings menu item must have an id attribute.');
44
+ }
45
+
46
+ return {
47
+ ...link,
48
+ permissions: permissions.settings?.[link.id]?.main,
49
+ };
50
+ },
51
+ [permissions.settings]
52
+ );
53
+
50
54
  useEffect(() => {
51
55
  const getData = async () => {
52
56
  const buildMenuPermissions = (sections) =>
@@ -86,26 +90,36 @@ const useSettingsMenu = () => {
86
90
  };
87
91
 
88
92
  const { global, ...otherSections } = settings;
93
+
89
94
  const sections = formatLinks([
90
95
  {
91
96
  ...settings.global,
92
- links: sortLinks([...settings.global.links, ...globalLinks]).map((link) => ({
93
- ...link,
94
- hasNotification: link.id === '000-application-infos' && shouldUpdateStrapi,
95
- })),
97
+ links: sortLinks([...settings.global.links, ...globalLinks.map(addPermissions)]).map(
98
+ (link) => ({
99
+ ...link,
100
+ hasNotification: link.id === '000-application-infos' && shouldUpdateStrapi,
101
+ })
102
+ ),
96
103
  },
97
104
  {
98
105
  id: 'permissions',
99
106
  intlLabel: { id: 'Settings.permissions', defaultMessage: 'Administration Panel' },
100
- links: adminLinks,
107
+ links: adminLinks.map(addPermissions),
101
108
  },
102
109
  ...Object.values(otherSections),
103
110
  ]);
104
111
 
105
112
  getData();
106
- }, [adminLinks, globalLinks, userPermissions, settings, shouldUpdateStrapi]);
113
+ }, [adminLinks, globalLinks, userPermissions, settings, shouldUpdateStrapi, addPermissions]);
114
+
115
+ const filterMenu = (menuItem) => {
116
+ return {
117
+ ...menuItem,
118
+ links: menuItem.links.filter((link) => link.isDisplayed),
119
+ };
120
+ };
107
121
 
108
- return { isLoading, menu };
122
+ return { isLoading, menu: menu.map(filterMenu) };
109
123
  };
110
124
 
111
125
  export default useSettingsMenu;
@@ -6,7 +6,7 @@ import UnauthenticatedLayout from '../../../../layouts/UnauthenticatedLayout';
6
6
 
7
7
  import BaseLogin from './BaseLogin';
8
8
 
9
- const Login = (loginProps) => {
9
+ export const LoginCE = (loginProps) => {
10
10
  return (
11
11
  <UnauthenticatedLayout>
12
12
  <BaseLogin {...loginProps} />
@@ -14,12 +14,10 @@ const Login = (loginProps) => {
14
14
  );
15
15
  };
16
16
 
17
- Login.defaultProps = {
17
+ LoginCE.defaultProps = {
18
18
  onSubmit: (e) => e.preventDefault(),
19
19
  };
20
20
 
21
- Login.propTypes = {
21
+ LoginCE.propTypes = {
22
22
  onSubmit: PropTypes.func,
23
23
  };
24
-
25
- export default Login;
@@ -1,5 +1,4 @@
1
1
  import { translatedErrors } from '@strapi/helper-plugin';
2
- import Login from 'ee_else_ce/pages/AuthPage/components/Login';
3
2
  import * as yup from 'yup';
4
3
 
5
4
  import ForgotPassword from './components/ForgotPassword';
@@ -27,8 +26,10 @@ export const FORMS = {
27
26
  schema: null,
28
27
  inputsPrefix: '',
29
28
  },
29
+
30
+ // the `Component` attribute is set after all forms and CE/EE components are loaded, but since we
31
+ // are here outside of a React component we can not use the hook directly
30
32
  login: {
31
- Component: Login,
32
33
  endPoint: 'login',
33
34
  fieldsToDisable: [],
34
35
  fieldsToOmit: ['rememberMe'],
@@ -13,6 +13,7 @@ import useLocalesProvider from '../../components/LocalesProvider/useLocalesProvi
13
13
  import { useEnterprise } from '../../hooks/useEnterprise';
14
14
  import formatAPIErrors from '../../utils/formatAPIErrors';
15
15
 
16
+ import { LoginCE } from './components/Login';
16
17
  import { FORMS } from './constants';
17
18
  import init from './init';
18
19
  import { initialState, reducer } from './reducer';
@@ -29,6 +30,10 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
29
30
  params: { authType },
30
31
  } = useRouteMatch('/auth/:authType');
31
32
  const query = useQuery();
33
+ const Login = useEnterprise(
34
+ LoginCE,
35
+ async () => (await import('../../../../ee/admin/pages/AuthPage/components/Login')).LoginEE
36
+ );
32
37
  const forms = useEnterprise(
33
38
  FORMS,
34
39
  async () => (await import('../../../../ee/admin/pages/AuthPage/constants')).FORMS,
@@ -50,7 +55,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
50
55
  );
51
56
  const CancelToken = axios.CancelToken;
52
57
  const source = CancelToken.source();
53
- const { Component, endPoint, fieldsToDisable, fieldsToOmit, inputsPrefix, schema, ...rest } =
58
+ const { endPoint, fieldsToDisable, fieldsToOmit, inputsPrefix, schema, ...rest } =
54
59
  forms?.[authType] ?? {};
55
60
 
56
61
  useEffect(() => {
@@ -274,6 +279,18 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
274
279
  );
275
280
  }
276
281
 
282
+ if (Login) {
283
+ // Assign the component to render for the login form
284
+ forms.login.Component = Login;
285
+ }
286
+
287
+ // block rendering until the Login EE component is fully loaded
288
+ if (!Login) {
289
+ return null;
290
+ }
291
+
292
+ const { Component } = forms?.[authType] ?? {};
293
+
277
294
  return (
278
295
  <Component
279
296
  {...rest}
@@ -3,11 +3,10 @@
3
3
  *
4
4
  */
5
5
 
6
- import React, { memo, useMemo } from 'react';
6
+ import React, { useMemo } from 'react';
7
7
 
8
8
  import { Box, Grid, GridItem, Layout, Main } from '@strapi/design-system';
9
9
  import { LoadingIndicatorPage, useGuidedTour } from '@strapi/helper-plugin';
10
- import useLicenseLimitNotification from 'ee_else_ce/hooks/useLicenseLimitNotification';
11
10
  import { Helmet } from 'react-helmet';
12
11
  import { FormattedMessage } from 'react-intl';
13
12
  import { useHistory } from 'react-router-dom';
@@ -16,6 +15,7 @@ import styled from 'styled-components';
16
15
  import GuidedTourHomepage from '../../components/GuidedTour/Homepage';
17
16
  import isGuidedTourCompleted from '../../components/GuidedTour/utils/isGuidedTourCompleted';
18
17
  import { useContentTypes } from '../../hooks/useContentTypes';
18
+ import { useEnterprise } from '../../hooks/useEnterprise';
19
19
 
20
20
  import cornerOrnamentPath from './assets/corner-ornament.svg';
21
21
  import ContentBlocks from './ContentBlocks';
@@ -32,15 +32,12 @@ const LogoContainer = styled(Box)`
32
32
  }
33
33
  `;
34
34
 
35
- const HomePage = () => {
35
+ export const HomePageCE = () => {
36
36
  // Temporary until we develop the menu API
37
37
  const { collectionTypes, singleTypes, isLoading: isLoadingForModels } = useContentTypes();
38
38
  const { guidedTourState, isGuidedTourVisible, isSkipped } = useGuidedTour();
39
- useLicenseLimitNotification();
40
-
41
39
  const showGuidedTour =
42
40
  !isGuidedTourCompleted(guidedTourState) && isGuidedTourVisible && !isSkipped;
43
-
44
41
  const { push } = useHistory();
45
42
  const handleClick = (e) => {
46
43
  e.preventDefault();
@@ -92,4 +89,19 @@ const HomePage = () => {
92
89
  );
93
90
  };
94
91
 
95
- export default memo(HomePage);
92
+ function HomePageSwitch() {
93
+ const HomePage = useEnterprise(
94
+ HomePageCE,
95
+ // eslint-disable-next-line import/no-cycle
96
+ async () => (await import('../../../../ee/admin/pages/HomePage')).HomePageEE
97
+ );
98
+
99
+ // block rendering until the EE component is fully loaded
100
+ if (!HomePage) {
101
+ return null;
102
+ }
103
+
104
+ return <HomePage />;
105
+ }
106
+
107
+ export default HomePageSwitch;
@@ -77,19 +77,14 @@ const ProfilePage = () => {
77
77
  const { isLoading: isLoadingSSO, data: dataSSO } = useQuery(
78
78
  ['providers', 'isSSOLocked'],
79
79
  async () => {
80
- if (window.strapi.isEE) {
81
- const {
82
- data: { data },
83
- } = await get('/admin/providers/isSSOLocked');
80
+ const {
81
+ data: { data },
82
+ } = await get('/admin/providers/isSSOLocked');
84
83
 
85
- return data;
86
- }
87
-
88
- return {
89
- isSSOLocked: false,
90
- };
84
+ return data;
91
85
  },
92
86
  {
87
+ enabled: window.strapi.isEE && window.strapi.features.isEnabled('sso'),
93
88
  onError() {
94
89
  toggleNotification({
95
90
  type: 'warning',
@@ -178,7 +173,7 @@ const ProfilePage = () => {
178
173
  );
179
174
  }
180
175
 
181
- const hasLockedRole = dataSSO?.isSSOLocked;
176
+ const hasLockedRole = dataSSO?.isSSOLocked ?? false;
182
177
  const { email, firstname, lastname, username, preferedLanguage } = data;
183
178
  const initialData = { email, firstname, lastname, username, preferedLanguage, currentTheme };
184
179
 
@@ -50,17 +50,19 @@ const SettingsNav = ({ menu }) => {
50
50
  <SubNavSections>
51
51
  {sections.map((section) => (
52
52
  <SubNavSection key={section.id} label={formatMessage(section.intlLabel)}>
53
- {section.links.map((link) => (
54
- <SubNavLink
55
- as={NavLink}
56
- withBullet={link.hasNotification}
57
- to={link.to}
58
- onClick={() => handleClickOnLink(link.to)}
59
- key={link.id}
60
- >
61
- {formatMessage(link.intlLabel)}
62
- </SubNavLink>
63
- ))}
53
+ {section.links.map((link) => {
54
+ return (
55
+ <SubNavLink
56
+ as={NavLink}
57
+ withBullet={link.hasNotification}
58
+ to={link.to}
59
+ onClick={() => handleClickOnLink(link.to)}
60
+ key={link.id}
61
+ >
62
+ {formatMessage(link.intlLabel)}
63
+ </SubNavLink>
64
+ );
65
+ })}
64
66
  </SubNavSection>
65
67
  ))}
66
68
  </SubNavSections>
@@ -22,18 +22,20 @@ import {
22
22
  useTracking,
23
23
  } from '@strapi/helper-plugin';
24
24
  import { Check, ExternalLink } from '@strapi/icons';
25
- import AdminSeatInfo from 'ee_else_ce/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo';
26
25
  import { useIntl } from 'react-intl';
27
26
  import { useMutation, useQuery, useQueryClient } from 'react-query';
28
27
  import { useSelector } from 'react-redux';
29
28
 
30
29
  import { useConfigurations } from '../../../../hooks';
30
+ import { useEnterprise } from '../../../../hooks/useEnterprise';
31
31
  import { selectAdminPermissions } from '../../../App/selectors';
32
32
 
33
33
  import CustomizationInfos from './components/CustomizationInfos';
34
34
  import { fetchProjectSettings, postProjectSettings } from './utils/api';
35
35
  import getFormData from './utils/getFormData';
36
36
 
37
+ const AdminSeatInfoCE = () => null;
38
+
37
39
  const ApplicationInfosPage = () => {
38
40
  const inputsRef = useRef();
39
41
  const toggleNotification = useNotification();
@@ -50,6 +52,15 @@ const ApplicationInfosPage = () => {
50
52
  } = useAppInfo();
51
53
  const { updateProjectSettings } = useConfigurations();
52
54
  const permissions = useSelector(selectAdminPermissions);
55
+ const AdminSeatInfo = useEnterprise(
56
+ AdminSeatInfoCE,
57
+ async () =>
58
+ (
59
+ await import(
60
+ '../../../../../../ee/admin/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo'
61
+ )
62
+ ).AdminSeatInfoEE
63
+ );
53
64
 
54
65
  const {
55
66
  allowedActions: { canRead, canUpdate },
@@ -105,6 +116,11 @@ const ApplicationInfosPage = () => {
105
116
  });
106
117
  };
107
118
 
119
+ // block rendering until the EE component is fully loaded
120
+ if (!AdminSeatInfo) {
121
+ return null;
122
+ }
123
+
108
124
  return (
109
125
  <Layout>
110
126
  {/* TODO: Add missing translation */}
@@ -24,7 +24,6 @@ import {
24
24
  useOverlayBlocker,
25
25
  } from '@strapi/helper-plugin';
26
26
  import { ArrowLeft, Check } from '@strapi/icons';
27
- import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
28
27
  import { Formik } from 'formik';
29
28
  import get from 'lodash/get';
30
29
  import omit from 'lodash/omit';
@@ -34,7 +33,9 @@ import { useIntl } from 'react-intl';
34
33
  import { useHistory, useRouteMatch } from 'react-router-dom';
35
34
 
36
35
  import { useAdminUsers } from '../../../../../hooks/useAdminUsers';
36
+ import { useEnterprise } from '../../../../../hooks/useEnterprise';
37
37
  import { formatAPIErrors, getFullName } from '../../../../../utils';
38
+ import { MagicLinkCE } from '../components/MagicLink';
38
39
  import SelectRoles from '../components/SelectRoles';
39
40
  import { editValidation } from '../utils/validations/users';
40
41
 
@@ -52,11 +53,21 @@ const EditPage = ({ canUpdate }) => {
52
53
  const { setUserDisplayName } = useAppInfo();
53
54
  const toggleNotification = useNotification();
54
55
  const { lockApp, unlockApp } = useOverlayBlocker();
56
+ const MagicLink = useEnterprise(
57
+ MagicLinkCE,
58
+ async () =>
59
+ (
60
+ await import(
61
+ '../../../../../../../ee/admin/pages/SettingsPage/pages/Users/components/MagicLink'
62
+ )
63
+ ).MagicLinkEE
64
+ );
65
+
55
66
  useFocusWhenNavigate();
56
67
 
57
68
  const {
58
69
  users: [user],
59
- isLoading,
70
+ isLoading: isLoadingAdminUsers,
60
71
  } = useAdminUsers(
61
72
  { id },
62
73
  {
@@ -125,6 +136,8 @@ const EditPage = ({ canUpdate }) => {
125
136
  unlockApp();
126
137
  };
127
138
 
139
+ const isLoading = isLoadingAdminUsers || !MagicLink;
140
+
128
141
  const headerLabel = isLoading
129
142
  ? { id: 'app.containers.Users.EditPage.header.label-loading', defaultMessage: 'Edit user' }
130
143
  : { id: 'app.containers.Users.EditPage.header.label', defaultMessage: 'Edit {name}' };
@@ -5,7 +5,7 @@ import { Envelop } from '@strapi/icons';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useIntl } from 'react-intl';
7
7
 
8
- const CreateAction = ({ onClick }) => {
8
+ export const CreateActionCE = ({ onClick }) => {
9
9
  const { formatMessage } = useIntl();
10
10
 
11
11
  return (
@@ -18,8 +18,6 @@ const CreateAction = ({ onClick }) => {
18
18
  );
19
19
  };
20
20
 
21
- CreateAction.propTypes = {
21
+ CreateActionCE.propTypes = {
22
22
  onClick: PropTypes.func.isRequired,
23
23
  };
24
-
25
- export default CreateAction;
@@ -20,13 +20,13 @@ import {
20
20
  useNotification,
21
21
  useOverlayBlocker,
22
22
  } from '@strapi/helper-plugin';
23
- import MagicLink from 'ee_else_ce/pages/SettingsPage/pages/Users/components/MagicLink';
24
23
  import { Formik } from 'formik';
25
24
  import PropTypes from 'prop-types';
26
25
  import { useIntl } from 'react-intl';
27
26
  import { useMutation } from 'react-query';
28
27
 
29
28
  import { useEnterprise } from '../../../../../../hooks/useEnterprise';
29
+ import { MagicLinkCE } from '../../components/MagicLink';
30
30
  import SelectRoles from '../../components/SelectRoles';
31
31
 
32
32
  import { FORM_LAYOUT, FORM_SCHEMA, FORM_INITIAL_VALUES, ROLE_LAYOUT, STEPPER } from './constants';
@@ -74,6 +74,15 @@ const ModalForm = ({ onSuccess, onToggle }) => {
74
74
  defaultValue: FORM_INITIAL_VALUES,
75
75
  }
76
76
  );
77
+ const MagicLink = useEnterprise(
78
+ MagicLinkCE,
79
+ async () =>
80
+ (
81
+ await import(
82
+ '../../../../../../../../ee/admin/pages/SettingsPage/pages/Users/components/MagicLink'
83
+ )
84
+ ).MagicLinkEE
85
+ );
77
86
  const postMutation = useMutation(
78
87
  (body) => {
79
88
  return post('/admin/users', body);
@@ -142,6 +151,11 @@ const ModalForm = ({ onSuccess, onToggle }) => {
142
151
  </Button>
143
152
  );
144
153
 
154
+ // block rendering until the EE component is fully loaded
155
+ if (!MagicLink) {
156
+ return null;
157
+ }
158
+
145
159
  return (
146
160
  <ModalLayout onClose={onToggle} labelledBy="title">
147
161
  <ModalHeader>
@@ -12,8 +12,6 @@ import {
12
12
  useNotification,
13
13
  useRBAC,
14
14
  } from '@strapi/helper-plugin';
15
- import useLicenseLimitNotification from 'ee_else_ce/hooks/useLicenseLimitNotification';
16
- import CreateAction from 'ee_else_ce/pages/SettingsPage/pages/Users/ListPage/CreateAction';
17
15
  import qs from 'qs';
18
16
  import { useIntl } from 'react-intl';
19
17
  import { useMutation, useQueryClient } from 'react-query';
@@ -21,9 +19,11 @@ import { useSelector } from 'react-redux';
21
19
  import { useLocation } from 'react-router-dom';
22
20
 
23
21
  import { useAdminUsers } from '../../../../../hooks/useAdminUsers';
22
+ import { useEnterprise } from '../../../../../hooks/useEnterprise';
24
23
  import { selectAdminPermissions } from '../../../../App/selectors';
25
24
  import Filters from '../../../components/Filters';
26
25
 
26
+ import { CreateActionCE } from './CreateAction';
27
27
  import TableRows from './DynamicTable/TableRows';
28
28
  import ModalForm from './ModalForm';
29
29
  import PaginationFooter from './PaginationFooter';
@@ -32,7 +32,7 @@ import tableHeaders from './utils/tableHeaders';
32
32
 
33
33
  const EE_LICENSE_LIMIT_QUERY_KEY = ['ee', 'license-limit-info'];
34
34
 
35
- const ListPage = () => {
35
+ export const UserListPageCE = () => {
36
36
  const { post } = useFetchClient();
37
37
  const { formatAPIError } = useAPIErrorHandler();
38
38
  const [isModalOpened, setIsModalOpen] = useState(false);
@@ -45,7 +45,6 @@ const ListPage = () => {
45
45
  const { formatMessage } = useIntl();
46
46
  const { search } = useLocation();
47
47
  useFocusWhenNavigate();
48
- useLicenseLimitNotification();
49
48
  const {
50
49
  users,
51
50
  pagination,
@@ -55,6 +54,15 @@ const ListPage = () => {
55
54
  } = useAdminUsers(qs.parse(search, { ignoreQueryPrefix: true }), {
56
55
  enabled: canRead,
57
56
  });
57
+ const CreateAction = useEnterprise(
58
+ CreateActionCE,
59
+ async () =>
60
+ (
61
+ await import(
62
+ '../../../../../../../ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction'
63
+ )
64
+ ).CreateActionEE
65
+ );
58
66
 
59
67
  const headers = tableHeaders.map((header) => ({
60
68
  ...header,
@@ -97,6 +105,11 @@ const ListPage = () => {
97
105
  }
98
106
  );
99
107
 
108
+ // block rendering until the EE component is fully loaded
109
+ if (!CreateAction) {
110
+ return null;
111
+ }
112
+
100
113
  return (
101
114
  <Main aria-busy={isLoading}>
102
115
  <SettingsPageTitle name="Users" />
@@ -166,4 +179,22 @@ const ListPage = () => {
166
179
  );
167
180
  };
168
181
 
169
- export default ListPage;
182
+ // component which determines whether this page should render the CE or EE page
183
+ const UsersListPageSwitch = () => {
184
+ const UsersListPage = useEnterprise(
185
+ UserListPageCE,
186
+ async () =>
187
+ // eslint-disable-next-line import/no-cycle
188
+ (await import('../../../../../../../ee/admin/pages/SettingsPage/pages/Users/ListPage'))
189
+ .UserListPageEE
190
+ );
191
+
192
+ // block rendering until the EE component is fully loaded
193
+ if (!UsersListPage) {
194
+ return null;
195
+ }
196
+
197
+ return <UsersListPage />;
198
+ };
199
+
200
+ export default UsersListPageSwitch;
@@ -7,7 +7,7 @@ import basename from '../../../../../../core/utils/basename';
7
7
 
8
8
  import MagicLinkWrapper from './MagicLinkWrapper';
9
9
 
10
- const MagicLink = ({ registrationToken }) => {
10
+ export const MagicLinkCE = ({ registrationToken }) => {
11
11
  const { formatMessage } = useIntl();
12
12
  const target = `${window.location.origin}${basename}auth/register?registrationToken=${registrationToken}`;
13
13
 
@@ -21,12 +21,10 @@ const MagicLink = ({ registrationToken }) => {
21
21
  );
22
22
  };
23
23
 
24
- MagicLink.defaultProps = {
24
+ MagicLinkCE.defaultProps = {
25
25
  registrationToken: '',
26
26
  };
27
27
 
28
- MagicLink.propTypes = {
28
+ MagicLinkCE.propTypes = {
29
29
  registrationToken: PropTypes.string,
30
30
  };
31
-
32
- export default MagicLink;
@@ -1,3 +1 @@
1
- import { EventTableCE } from './EventTableCE';
2
-
3
- export default EventTableCE;
1
+ export * from './EventTableCE';