@strapi/admin 4.11.4 → 4.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +8 -5
  2. package/admin/src/content-manager/components/Inputs/index.js +3 -47
  3. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +34 -37
  4. package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +23 -21
  5. package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +21 -50
  6. package/admin/src/content-manager/pages/EditView/Information/index.js +1 -1
  7. package/admin/src/content-manager/pages/EditView/InformationBox/InformationBoxCE.js +1 -2
  8. package/admin/src/content-manager/pages/EditView/InformationBox/index.js +1 -3
  9. package/admin/src/content-manager/pages/EditView/index.js +14 -2
  10. package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +24 -22
  11. package/admin/src/content-manager/pages/ListView/components/CellContent/RelationMultiple/index.js +61 -67
  12. package/admin/src/content-manager/pages/ListView/components/CellContent/RepeatableComponent/index.js +28 -21
  13. package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +97 -14
  14. package/admin/src/content-manager/pages/ListView/index.js +65 -59
  15. package/admin/src/content-manager/pages/ListView/utils/buildValidGetParams.js +30 -0
  16. package/admin/src/content-manager/pages/ListView/utils/index.js +1 -1
  17. package/admin/src/hooks/useAdminUsers/useAdminUsers.js +3 -3
  18. package/admin/src/hooks/useEnterprise/useEnterprise.js +4 -4
  19. package/admin/src/hooks/useSettingsMenu/index.js +35 -21
  20. package/admin/src/layouts/UnauthenticatedLayout/LocaleToggle/index.js +7 -7
  21. package/admin/src/pages/App/index.js +0 -3
  22. package/admin/src/pages/AuthPage/components/Login/index.js +3 -5
  23. package/admin/src/pages/AuthPage/components/Register/index.js +5 -1
  24. package/admin/src/pages/AuthPage/constants.js +3 -2
  25. package/admin/src/pages/AuthPage/index.js +18 -1
  26. package/admin/src/pages/HomePage/index.js +19 -7
  27. package/admin/src/pages/ProfilePage/index.js +12 -12
  28. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +13 -11
  29. package/admin/src/pages/SettingsPage/components/Tokens/TokenBox/index.js +1 -1
  30. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +17 -1
  31. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +16 -3
  32. package/admin/src/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +2 -4
  33. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +15 -1
  34. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +36 -5
  35. package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  36. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  37. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +16 -1
  38. package/admin/src/translations/zh-Hans.json +1 -1
  39. package/build/1049.758a01f5.chunk.js +1 -0
  40. package/build/{3528.4845cf92.chunk.js → 1386.762d6eb8.chunk.js} +1 -1
  41. package/build/1727.b49f0713.chunk.js +1 -0
  42. package/build/{5563.86f9aa9c.chunk.js → 2225.15d1df72.chunk.js} +3 -3
  43. package/build/2379.3ba39b61.chunk.js +1 -0
  44. package/build/2395.c27eb585.chunk.js +26 -0
  45. package/build/2801.93343c11.chunk.js +1 -0
  46. package/build/{7394.423886bd.chunk.js → 3100.21c343fa.chunk.js} +1 -1
  47. package/build/311.cb0884bb.chunk.js +1 -0
  48. package/build/3483.642d2321.chunk.js +1 -0
  49. package/build/{970.89601f27.chunk.js → 3739.63e352f1.chunk.js} +52 -20
  50. package/build/3984.298bdb66.chunk.js +1 -0
  51. package/build/4546.5aac90fe.chunk.js +1 -0
  52. package/build/502.f6b78f85.chunk.js +1 -0
  53. package/build/{5542.c62d0daf.chunk.js → 5542.2415a393.chunk.js} +6 -6
  54. package/build/6158.f9d82db9.chunk.js +1 -0
  55. package/build/7030.b98dcedf.chunk.js +1 -0
  56. package/build/7464.fe31804b.chunk.js +1 -0
  57. package/build/8276.d03dc679.chunk.js +26 -0
  58. package/build/918.54414509.chunk.js +1 -0
  59. package/build/978.bab58f0a.chunk.js +1 -0
  60. package/build/{9932.7e2b71de.chunk.js → 9932.b5a3bb3a.chunk.js} +81 -81
  61. package/build/9944.7af075a5.chunk.js +26 -0
  62. package/build/{Admin-authenticatedApp.cb649fc1.chunk.js → Admin-authenticatedApp.b3060bbe.chunk.js} +5 -5
  63. package/build/Admin_InternalErrorPage.f45f2462.chunk.js +1 -0
  64. package/build/{Admin_homePage.be30ef4e.chunk.js → Admin_homePage.ac9dfb86.chunk.js} +23 -15
  65. package/build/{Admin_marketplace.74a58e20.chunk.js → Admin_marketplace.f0b87fce.chunk.js} +1 -1
  66. package/build/{Admin_pluginsPage.ce464189.chunk.js → Admin_pluginsPage.8728ff6e.chunk.js} +1 -1
  67. package/build/{Admin_profilePage.2131eb68.chunk.js → Admin_profilePage.a968035f.chunk.js} +2 -2
  68. package/build/Admin_settingsPage.8c600d1a.chunk.js +111 -0
  69. package/build/Upload_ConfigureTheView.345ac1e0.chunk.js +1 -0
  70. package/build/admin-app.1c3f7fd6.chunk.js +36 -0
  71. package/build/{admin-edit-roles-page.3fdd6b9d.chunk.js → admin-edit-roles-page.a49b9f4f.chunk.js} +4 -4
  72. package/build/admin-edit-users.67704088.chunk.js +10 -0
  73. package/build/{admin-roles-list.e17b00d7.chunk.js → admin-roles-list.0c129e98.chunk.js} +1 -1
  74. package/build/admin-users.3279ffb0.chunk.js +11 -0
  75. package/build/api-tokens-create-page.46c2ea84.chunk.js +1 -0
  76. package/build/{api-tokens-edit-page.9a1dd2fa.chunk.js → api-tokens-edit-page.58139df9.chunk.js} +1 -1
  77. package/build/{api-tokens-list-page.a103f526.chunk.js → api-tokens-list-page.505bf7e0.chunk.js} +2 -2
  78. package/build/audit-logs-settings-page.4b422831.chunk.js +1 -0
  79. package/build/content-manager.9f7f0cb8.chunk.js +1101 -0
  80. package/build/{content-type-builder-list-view.a200a358.chunk.js → content-type-builder-list-view.bf9be456.chunk.js} +9 -9
  81. package/build/{content-type-builder-translation-ar-json.56d8fcf4.chunk.js → content-type-builder-translation-ar-json.3e808e2f.chunk.js} +1 -1
  82. package/build/{content-type-builder-translation-cs-json.a5b299ca.chunk.js → content-type-builder-translation-cs-json.1ef9e106.chunk.js} +1 -1
  83. package/build/{content-type-builder-translation-de-json.393a76c0.chunk.js → content-type-builder-translation-de-json.63fcff7b.chunk.js} +1 -1
  84. package/build/{content-type-builder-translation-dk-json.fbd39bb7.chunk.js → content-type-builder-translation-dk-json.fd626b67.chunk.js} +1 -1
  85. package/build/{content-type-builder-translation-en-json.f592325b.chunk.js → content-type-builder-translation-en-json.9f2b9c49.chunk.js} +1 -1
  86. package/build/{content-type-builder-translation-es-json.9288474b.chunk.js → content-type-builder-translation-es-json.a4a361a9.chunk.js} +1 -1
  87. package/build/{content-type-builder-translation-fr-json.d35e269c.chunk.js → content-type-builder-translation-fr-json.499c3a46.chunk.js} +1 -1
  88. package/build/{content-type-builder-translation-id-json.f0513929.chunk.js → content-type-builder-translation-id-json.65255f93.chunk.js} +1 -1
  89. package/build/{content-type-builder-translation-it-json.aaf16753.chunk.js → content-type-builder-translation-it-json.e268ab74.chunk.js} +1 -1
  90. package/build/{content-type-builder-translation-ko-json.8fe21a7f.chunk.js → content-type-builder-translation-ko-json.04cb309d.chunk.js} +1 -1
  91. package/build/{content-type-builder-translation-ms-json.3b5d2d3e.chunk.js → content-type-builder-translation-ms-json.f6b743b9.chunk.js} +1 -1
  92. package/build/{content-type-builder-translation-nl-json.225ef5d3.chunk.js → content-type-builder-translation-nl-json.997fe8cc.chunk.js} +1 -1
  93. package/build/{content-type-builder-translation-pl-json.92f36be2.chunk.js → content-type-builder-translation-pl-json.634f638b.chunk.js} +1 -1
  94. package/build/{content-type-builder-translation-pt-BR-json.3bd10f89.chunk.js → content-type-builder-translation-pt-BR-json.6a95dc71.chunk.js} +1 -1
  95. package/build/{content-type-builder-translation-ru-json.9bfe47ce.chunk.js → content-type-builder-translation-ru-json.3af65503.chunk.js} +1 -1
  96. package/build/{content-type-builder-translation-sk-json.d03cc18a.chunk.js → content-type-builder-translation-sk-json.c6078082.chunk.js} +1 -1
  97. package/build/{content-type-builder-translation-sv-json.d23dcd32.chunk.js → content-type-builder-translation-sv-json.a6df2462.chunk.js} +1 -1
  98. package/build/{content-type-builder-translation-th-json.7ad256e2.chunk.js → content-type-builder-translation-th-json.122277cc.chunk.js} +1 -1
  99. package/build/{content-type-builder-translation-tr-json.926f6191.chunk.js → content-type-builder-translation-tr-json.41f44f77.chunk.js} +1 -1
  100. package/build/{content-type-builder-translation-uk-json.7bf19546.chunk.js → content-type-builder-translation-uk-json.e1315acd.chunk.js} +1 -1
  101. package/build/{content-type-builder-translation-zh-Hans-json.415577fb.chunk.js → content-type-builder-translation-zh-Hans-json.6ff57db6.chunk.js} +1 -1
  102. package/build/{content-type-builder-translation-zh-json.ad24dbeb.chunk.js → content-type-builder-translation-zh-json.3532b962.chunk.js} +1 -1
  103. package/build/content-type-builder.7a90cece.chunk.js +170 -0
  104. package/build/{email-settings-page.45695daa.chunk.js → email-settings-page.d494d1eb.chunk.js} +2 -2
  105. package/build/{i18n-settings-page.29308d0b.chunk.js → i18n-settings-page.47f78016.chunk.js} +1 -1
  106. package/build/index.html +1 -1
  107. package/build/main.22e2d4ec.js +2856 -0
  108. package/build/review-workflows-settings.f1104fb9.chunk.js +110 -0
  109. package/build/{runtime~main.efd966f6.js → runtime~main.437fdcbb.js} +2 -2
  110. package/build/sso-settings-page.ed6f3f15.chunk.js +1 -0
  111. package/build/transfer-tokens-create-page.1597e6ab.chunk.js +1 -0
  112. package/build/transfer-tokens-edit-page.8741529f.chunk.js +1 -0
  113. package/build/{transfer-tokens-list-page.7237443d.chunk.js → transfer-tokens-list-page.22147d2c.chunk.js} +2 -2
  114. package/build/upload-settings.cac210a0.chunk.js +14 -0
  115. package/build/upload.cbfeefa5.chunk.js +58 -0
  116. package/build/{users-advanced-settings-page.750b1f76.chunk.js → users-advanced-settings-page.18379a56.chunk.js} +1 -1
  117. package/build/users-email-settings-page.a87978e5.chunk.js +9 -0
  118. package/build/users-providers-settings-page.8876c1ee.chunk.js +14 -0
  119. package/build/{users-roles-settings-page.1f505119.chunk.js → users-roles-settings-page.0431f48c.chunk.js} +2 -2
  120. package/build/webhook-edit-page.a91f27a1.chunk.js +33 -0
  121. package/build/{webhook-list-page.940a40f1.chunk.js → webhook-list-page.65e1b5bb.chunk.js} +1 -1
  122. package/build/{zh-Hans-json.4cfef87d.chunk.js → zh-Hans-json.fada6f40.chunk.js} +1 -1
  123. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -1
  124. package/ee/admin/content-manager/pages/EditView/InformationBox/index.js +1 -3
  125. package/ee/admin/content-manager/{components/DynamicTable/CellContent/ReviewWorkflowsStage → pages/ListView/ReviewWorkflowsColumn}/ReviewWorkflowsStageEE.js +7 -2
  126. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +24 -0
  127. package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/index.js +1 -0
  128. package/ee/admin/hooks/useLicenseLimitNotification/index.js +17 -6
  129. package/ee/admin/hooks/useLicenseLimits/index.js +1 -32
  130. package/ee/admin/hooks/useLicenseLimits/useLicenseLimits.js +44 -0
  131. package/ee/admin/pages/AuthPage/components/Login/index.js +3 -5
  132. package/ee/admin/pages/HomePage/index.js +11 -0
  133. package/ee/admin/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +7 -7
  134. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +6 -4
  135. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +3 -5
  136. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +11 -6
  137. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +13 -0
  138. package/ee/admin/pages/SettingsPage/pages/Users/components/MagicLink/index.js +3 -5
  139. package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +1 -3
  140. package/index.js +0 -14
  141. package/package.json +12 -21
  142. package/webpack.alias.js +0 -3
  143. package/webpack.config.js +1 -75
  144. package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +0 -2
  145. package/admin/src/content-manager/pages/ListView/utils/buildQueryString.js +0 -36
  146. package/admin/src/content-manager/pages/ListView/utils/createPluginsFilter.js +0 -4
  147. package/admin/src/pages/App/utils/index.js +0 -3
  148. package/admin/src/pages/App/utils/unique-identifier.js +0 -12
  149. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/AdminSeatInfo/index.js +0 -5
  150. package/build/1386.3b2aa6a7.chunk.js +0 -3
  151. package/build/1799.44d2e264.chunk.js +0 -33
  152. package/build/1970.39a2d75e.chunk.js +0 -1
  153. package/build/3269.1ea0f5a6.chunk.js +0 -1
  154. package/build/5932.6a23b88c.chunk.js +0 -1
  155. package/build/7018.98feed67.chunk.js +0 -1
  156. package/build/7259.fb69d4bf.chunk.js +0 -1
  157. package/build/Admin_InternalErrorPage.8911cb49.chunk.js +0 -1
  158. package/build/Admin_settingsPage.4069bb8a.chunk.js +0 -79
  159. package/build/Upload_ConfigureTheView.7a1cb9c9.chunk.js +0 -1
  160. package/build/admin-app.fea867af.chunk.js +0 -61
  161. package/build/admin-edit-users.200551e3.chunk.js +0 -10
  162. package/build/admin-users.3b12dca2.chunk.js +0 -11
  163. package/build/api-tokens-create-page.3dd4e921.chunk.js +0 -1
  164. package/build/audit-logs-settings-page.f538490f.chunk.js +0 -1
  165. package/build/content-manager.c40f5ff9.chunk.js +0 -1088
  166. package/build/content-type-builder.bd1bbff1.chunk.js +0 -166
  167. package/build/main.ee36abd9.js +0 -2927
  168. package/build/review-workflows-settings.93808ae0.chunk.js +0 -110
  169. package/build/sso-settings-page.0cdb96a6.chunk.js +0 -1
  170. package/build/transfer-tokens-create-page.de14cad4.chunk.js +0 -1
  171. package/build/transfer-tokens-edit-page.4f5e39af.chunk.js +0 -1
  172. package/build/upload-settings.cb6c14c3.chunk.js +0 -14
  173. package/build/upload.7e629643.chunk.js +0 -26
  174. package/build/users-email-settings-page.e9bcd865.chunk.js +0 -9
  175. package/build/users-providers-settings-page.a94253e9.chunk.js +0 -14
  176. package/build/webhook-edit-page.77ef4f1a.chunk.js +0 -33
  177. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +0 -58
  178. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +0 -3
@@ -0,0 +1,30 @@
1
+ const createPluginsFilter = (obj = {}) =>
2
+ Object.values(obj).reduce((acc, current) => Object.assign(acc, current), {});
3
+
4
+ /**
5
+ * @description
6
+ * Creates a valid query params object for get requests
7
+ * ie. plugins[18n][locale]=en becomes locale=en
8
+ * @param {object} [query={}] - The query params
9
+ * @returns {object} - The modified query params
10
+ */
11
+ const buildValidGetParams = (query = {}) => {
12
+ // Extract pluginOptions from the query, they shouldn't be part of the URL
13
+ const {
14
+ plugins: _,
15
+ _q: searchQuery,
16
+ ...validQueryParams
17
+ } = {
18
+ ...query,
19
+ ...createPluginsFilter(query.plugins),
20
+ };
21
+
22
+ if (searchQuery) {
23
+ // Encode the search query here since the paramsSerializer will not
24
+ validQueryParams._q = encodeURIComponent(searchQuery);
25
+ }
26
+
27
+ return validQueryParams;
28
+ };
29
+
30
+ export default buildValidGetParams;
@@ -1 +1 @@
1
- export { default as buildQueryString } from './buildQueryString';
1
+ export { default as buildValidGetParams } from './buildValidGetParams';
@@ -1,10 +1,8 @@
1
1
  import { useFetchClient } from '@strapi/helper-plugin';
2
- import { stringify } from 'qs';
3
2
  import { useQuery } from 'react-query';
4
3
 
5
4
  export function useAdminUsers(params = {}, queryOptions = {}) {
6
5
  const { id = '', ...queryParams } = params;
7
- const queryString = stringify(queryParams, { encode: false });
8
6
 
9
7
  const { get } = useFetchClient();
10
8
 
@@ -13,7 +11,9 @@ export function useAdminUsers(params = {}, queryOptions = {}) {
13
11
  async () => {
14
12
  const {
15
13
  data: { data },
16
- } = await get(`/admin/users/${id}${queryString ? `?${queryString}` : ''}`);
14
+ } = await get(`/admin/users/${id}`, {
15
+ params: queryParams,
16
+ });
17
17
 
18
18
  return data;
19
19
  },
@@ -9,7 +9,7 @@ function isEnterprise() {
9
9
  export function useEnterprise(
10
10
  ceData,
11
11
  eeCallback,
12
- { defaultValue = null, combine = (ceData, eeData) => eeData } = {}
12
+ { defaultValue = null, combine = (ceData, eeData) => eeData, enabled = true } = {}
13
13
  ) {
14
14
  const eeCallbackRef = useCallbackRef(eeCallback);
15
15
  const combineCallbackRef = useCallbackRef(combine);
@@ -17,7 +17,7 @@ export function useEnterprise(
17
17
  // We have to use a nested object here, because functions (e.g. Components)
18
18
  // can not be stored as value directly
19
19
  const [{ data }, setData] = React.useState({
20
- data: isEnterprise() ? defaultValue : ceData,
20
+ data: isEnterprise() && enabled ? defaultValue : ceData,
21
21
  });
22
22
 
23
23
  React.useEffect(() => {
@@ -27,10 +27,10 @@ export function useEnterprise(
27
27
  setData({ data: combineCallbackRef(ceData, eeData) });
28
28
  }
29
29
 
30
- if (isEnterprise()) {
30
+ if (isEnterprise() && enabled) {
31
31
  importEE();
32
32
  }
33
- }, [ceData, eeCallbackRef, combineCallbackRef]);
33
+ }, [ceData, eeCallbackRef, combineCallbackRef, enabled]);
34
34
 
35
35
  return data;
36
36
  }
@@ -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 @@
6
6
 
7
7
  import React from 'react';
8
8
 
9
- import { MenuItem, SimpleMenu } from '@strapi/design-system';
9
+ import { SingleSelect, SingleSelectOption } from '@strapi/design-system';
10
10
  import { useIntl } from 'react-intl';
11
11
 
12
12
  import useLocalesProvider from '../../../components/LocalesProvider/useLocalesProvider';
@@ -16,13 +16,13 @@ const LocaleToggle = () => {
16
16
  const { locale } = useIntl();
17
17
 
18
18
  return (
19
- <SimpleMenu label={localeNames[locale]}>
20
- {Object.keys(localeNames).map((lang) => (
21
- <MenuItem onClick={() => changeLocale(lang)} key={lang}>
22
- {localeNames[lang]}
23
- </MenuItem>
19
+ <SingleSelect value={locale} onChange={(language) => changeLocale(language)}>
20
+ {Object.entries(localeNames).map(([language, name]) => (
21
+ <SingleSelectOption key={language} value={language}>
22
+ {name}
23
+ </SingleSelectOption>
24
24
  ))}
25
- </SimpleMenu>
25
+ </SingleSelect>
26
26
  );
27
27
  };
28
28
 
@@ -31,7 +31,6 @@ import NotFoundPage from '../NotFoundPage';
31
31
  import UseCasePage from '../UseCasePage';
32
32
 
33
33
  import { ROUTES_CE, SET_ADMIN_PERMISSIONS } from './constants';
34
- import { getUID } from './utils';
35
34
 
36
35
  const AuthenticatedApp = lazy(() =>
37
36
  import(/* webpackChunkName: "Admin-authenticatedApp" */ '../../components/AuthenticatedApp')
@@ -113,8 +112,6 @@ function App() {
113
112
  authLogo: prefixFileUrlWithBackendUrl(authLogo),
114
113
  });
115
114
 
116
- const deviceId = await getUID();
117
-
118
115
  if (uuid) {
119
116
  const {
120
117
  data: { data: properties },
@@ -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;
@@ -64,7 +64,11 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
64
64
  try {
65
65
  const {
66
66
  data: { data },
67
- } = await get(`/admin/registration-info?registrationToken=${registrationToken}`);
67
+ } = await get(`/admin/registration-info`, {
68
+ params: {
69
+ registrationToken,
70
+ },
71
+ });
68
72
 
69
73
  if (data) {
70
74
  setUserInfo(data);
@@ -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
 
@@ -203,7 +198,12 @@ const ProfilePage = () => {
203
198
  <HeaderLayout
204
199
  title={data.username || getFullName(data.firstname, data.lastname)}
205
200
  primaryAction={
206
- <Button startIcon={<Check />} loading={isSubmitting} type="submit" disabled={!dirty}>
201
+ <Button
202
+ startIcon={<Check />}
203
+ loading={isSubmitting}
204
+ type="submit"
205
+ disabled={!dirty}
206
+ >
207
207
  {formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
208
208
  </Button>
209
209
  }
@@ -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>
@@ -17,7 +17,7 @@ const TokenBox = ({ token, tokenType }) => {
17
17
  const didCopy = await copy(token);
18
18
 
19
19
  if (didCopy) {
20
- trackUsage.current('didCopyTokenKey', {
20
+ trackUsage('didCopyTokenKey', {
21
21
  tokenType,
22
22
  });
23
23
  toggleNotification({
@@ -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}' };
@@ -189,7 +202,7 @@ const EditPage = ({ canUpdate }) => {
189
202
  <HeaderLayout
190
203
  primaryAction={
191
204
  <Button
192
- disabled={(isSubmitting || !canUpdate) ? true : !dirty}
205
+ disabled={isSubmitting || !canUpdate ? true : !dirty}
193
206
  startIcon={<Check />}
194
207
  loading={isSubmitting}
195
208
  type="submit"
@@ -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>