@strapi/admin 4.14.4 → 4.14.5

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 (235) hide show
  1. package/admin/.eslintrc.js +12 -0
  2. package/admin/custom.d.ts +20 -0
  3. package/admin/src/StrapiApp.js +14 -16
  4. package/admin/src/components/AuthenticatedApp/index.js +4 -4
  5. package/admin/src/components/ConfigurationProvider.tsx +67 -0
  6. package/admin/src/components/LanguageProvider.tsx +129 -0
  7. package/admin/src/components/{LeftMenu/index.js → LeftMenu.tsx} +23 -18
  8. package/admin/src/components/{NpsSurvey/index.js → NpsSurvey.tsx} +68 -21
  9. package/admin/src/components/PluginsInitializer.tsx +124 -0
  10. package/admin/src/components/Providers/index.js +6 -6
  11. package/admin/src/components/UnauthenticatedLogo.tsx +2 -2
  12. package/admin/src/components/{LocalesProvider/__mocks__/useLocalesProvider.js → __mocks__/LanguageProvider.js} +1 -1
  13. package/admin/src/content-manager/components/BlocksEditor/BlocksInput/index.js +48 -8
  14. package/admin/src/content-manager/components/BlocksEditor/Toolbar/index.js +146 -68
  15. package/admin/src/content-manager/components/BlocksEditor/hooks/useBlocksStore.js +50 -47
  16. package/admin/src/content-manager/components/BlocksEditor/hooks/useModifiersStore.js +11 -9
  17. package/admin/src/content-manager/components/BlocksEditor/index.js +1 -14
  18. package/admin/src/contexts/admin.ts +18 -0
  19. package/admin/src/contexts/configuration.ts +14 -4
  20. package/admin/src/hooks/__mocks__/useConfigurations.ts +2 -2
  21. package/admin/src/hooks/index.js +0 -3
  22. package/admin/src/hooks/{useAdminRoles/index.js → useAdminRoles.ts} +26 -10
  23. package/admin/src/hooks/useAdminUsers.ts +64 -0
  24. package/admin/src/hooks/useConfiguration.ts +5 -0
  25. package/admin/src/hooks/{useEnterprise/useEnterprise.js → useEnterprise.ts} +15 -5
  26. package/admin/src/hooks/useMenu.ts +153 -0
  27. package/admin/src/index.js +5 -2
  28. package/admin/src/layouts/UnauthenticatedLayout/LocaleToggle/index.js +2 -2
  29. package/admin/src/pages/Admin/index.js +4 -3
  30. package/admin/src/pages/App/index.js +5 -3
  31. package/admin/src/pages/AuthPage/components/Register/index.js +28 -33
  32. package/admin/src/pages/AuthPage/index.js +2 -2
  33. package/admin/src/pages/ProfilePage/index.js +2 -2
  34. package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +119 -87
  35. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/CustomizationInfos/index.js +2 -2
  36. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +2 -2
  37. package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
  38. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/index.js +1 -1
  39. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/index.js +1 -1
  40. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +1 -1
  41. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +1 -1
  42. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/index.js +1 -1
  43. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PermissionsDataManagerProvider/index.js +1 -1
  44. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/index.js +1 -1
  45. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/hooks/usePermissionsDataManager.ts +28 -0
  46. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +1 -1
  47. package/admin/src/{hooks/useAdminRolePermissions/index.js → pages/SettingsPage/pages/Roles/hooks/useAdminRolePermissions.ts} +13 -6
  48. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +3 -5
  49. package/admin/src/shared/hooks/index.js +0 -1
  50. package/admin/src/shared/hooks/useInjectionZone/index.js +2 -2
  51. package/admin/src/types/adminAPI.ts +29 -0
  52. package/admin/src/utils/createRoute.js +4 -1
  53. package/admin/tsconfig.build.json +4 -0
  54. package/admin/tsconfig.json +7 -1
  55. package/build/{1049.f7aed23d.chunk.js → 1049.9236e785.chunk.js} +1 -1
  56. package/build/1222.fe92c653.chunk.js +35 -0
  57. package/build/{1227.f9c74718.chunk.js → 1227.e0f7447b.chunk.js} +1 -1
  58. package/build/135.ad267b59.chunk.js +1 -0
  59. package/build/{1386.6b8819c6.chunk.js → 1386.07f2bbb3.chunk.js} +1 -1
  60. package/build/1835.eaa696ba.chunk.js +1 -0
  61. package/build/{2225.d1bcf7e3.chunk.js → 2225.a2147b8f.chunk.js} +2 -2
  62. package/build/2325.d705b39a.chunk.js +1 -0
  63. package/build/2379.b0bc4013.chunk.js +1 -0
  64. package/build/{2395.aca6ce66.chunk.js → 2395.d37b1025.chunk.js} +1 -1
  65. package/build/2421.79e5b3d0.chunk.js +1 -0
  66. package/build/267.073a3bcb.chunk.js +1 -0
  67. package/build/2801.12522720.chunk.js +1 -0
  68. package/build/2878.145ebf7c.chunk.js +1 -0
  69. package/build/2950.216f2e89.chunk.js +1 -0
  70. package/build/2953.284a63c0.chunk.js +1 -0
  71. package/build/{8743.31c921b1.chunk.js → 3019.0d74d080.chunk.js} +123 -139
  72. package/build/3021.33ad47fb.chunk.js +103 -0
  73. package/build/{3483.5df8e010.chunk.js → 3483.8f1b25f8.chunk.js} +1 -1
  74. package/build/3911.488fbde3.chunk.js +95 -0
  75. package/build/{4174.df9aa09a.chunk.js → 4174.2c4f958e.chunk.js} +1 -1
  76. package/build/4429.7f044dc7.chunk.js +1 -0
  77. package/build/4555.c883d697.chunk.js +1 -0
  78. package/build/4663.b906cc10.chunk.js +1 -0
  79. package/build/4916.480053a6.chunk.js +1 -0
  80. package/build/4996.d285c30b.chunk.js +1 -0
  81. package/build/502.b845473a.chunk.js +1 -0
  82. package/build/5858.493b31ec.chunk.js +1 -0
  83. package/build/6345.334e7678.chunk.js +1 -0
  84. package/build/6373.1a21d665.chunk.js +105 -0
  85. package/build/6453.4160b5b7.chunk.js +1 -0
  86. package/build/7448.6fd14dd3.chunk.js +1 -0
  87. package/build/7464.91341b4f.chunk.js +1 -0
  88. package/build/7735.9e7c9fdd.chunk.js +10 -0
  89. package/build/782.7243b183.chunk.js +1 -0
  90. package/build/7849.2a500ed8.chunk.js +1 -0
  91. package/build/7897.dffa5ad5.chunk.js +6 -0
  92. package/build/8162.7d1100a0.chunk.js +1 -0
  93. package/build/{8276.d4426fd8.chunk.js → 8276.e9698944.chunk.js} +2 -2
  94. package/build/8894.5ca4852a.chunk.js +26 -0
  95. package/build/8980.f0045cc1.chunk.js +1 -0
  96. package/build/9153.42c1428a.chunk.js +1 -0
  97. package/build/{9218.8bc01ab9.chunk.js → 9218.306ad178.chunk.js} +1 -1
  98. package/build/9285.5f174057.chunk.js +1 -0
  99. package/build/9302.550cf5b7.chunk.js +146 -0
  100. package/build/9547.62987774.chunk.js +1 -0
  101. package/build/9754.b4e73779.chunk.js +1 -0
  102. package/build/Admin-authenticatedApp.e897fccb.chunk.js +79 -0
  103. package/build/{Admin_InternalErrorPage.b66ee9c1.chunk.js → Admin_InternalErrorPage.e2431a95.chunk.js} +1 -1
  104. package/build/Admin_homePage.71ef8d06.chunk.js +81 -0
  105. package/build/{Admin_marketplace.31b962b8.chunk.js → Admin_marketplace.0db78604.chunk.js} +1 -1
  106. package/build/{Admin_pluginsPage.9217101d.chunk.js → Admin_pluginsPage.1083f7f0.chunk.js} +1 -1
  107. package/build/{Admin_profilePage.680123d9.chunk.js → Admin_profilePage.61704b7d.chunk.js} +2 -2
  108. package/build/Admin_settingsPage.39cb9fca.chunk.js +111 -0
  109. package/build/{Upload_ConfigureTheView.b40eea4d.chunk.js → Upload_ConfigureTheView.3cfeb108.chunk.js} +1 -1
  110. package/build/admin-app.06f5e70a.chunk.js +69 -0
  111. package/build/admin-edit-roles-page.556fac52.chunk.js +267 -0
  112. package/build/admin-edit-users.64fd1318.chunk.js +10 -0
  113. package/build/admin-roles-list.15918328.chunk.js +22 -0
  114. package/build/admin-users.74fddc87.chunk.js +11 -0
  115. package/build/{api-tokens-create-page.0dd63e91.chunk.js → api-tokens-create-page.c08ae118.chunk.js} +1 -1
  116. package/build/{api-tokens-edit-page.78d877f8.chunk.js → api-tokens-edit-page.ce18efdc.chunk.js} +1 -1
  117. package/build/api-tokens-list-page.783b7569.chunk.js +16 -0
  118. package/build/audit-logs-settings-page.12aeea8c.chunk.js +1 -0
  119. package/build/content-manager.2e3f660b.chunk.js +1220 -0
  120. package/build/{content-type-builder-list-view.3fffae65.chunk.js → content-type-builder-list-view.38ed3935.chunk.js} +7 -7
  121. package/build/{content-type-builder.98c71164.chunk.js → content-type-builder.758a9d23.chunk.js} +4 -4
  122. package/build/email-settings-page.e08a587e.chunk.js +11 -0
  123. package/build/{i18n-settings-page.a9708926.chunk.js → i18n-settings-page.3186e3e9.chunk.js} +1 -1
  124. package/build/index.html +1 -1
  125. package/build/main.00ea6f5a.js +2665 -0
  126. package/build/{review-workflows-settings-create-view.b7b0c6c5.chunk.js → review-workflows-settings-create-view.5cdc4d64.chunk.js} +1 -1
  127. package/build/{review-workflows-settings-edit-view.c331b3fe.chunk.js → review-workflows-settings-edit-view.53bf7865.chunk.js} +1 -1
  128. package/build/review-workflows-settings-list-view.b4a8aefb.chunk.js +56 -0
  129. package/build/runtime~main.e3bf3980.js +2 -0
  130. package/build/sso-settings-page.6a35d473.chunk.js +1 -0
  131. package/build/{transfer-tokens-create-page.e7f541d3.chunk.js → transfer-tokens-create-page.2662d519.chunk.js} +1 -1
  132. package/build/{transfer-tokens-edit-page.bd1276c2.chunk.js → transfer-tokens-edit-page.f64d8d8c.chunk.js} +1 -1
  133. package/build/transfer-tokens-list-page.e6fd5f87.chunk.js +16 -0
  134. package/build/{upload-settings.97ef4c92.chunk.js → upload-settings.450a1de0.chunk.js} +1 -1
  135. package/build/{upload.f08715a1.chunk.js → upload.0d53e7a3.chunk.js} +1 -1
  136. package/build/{users-advanced-settings-page.36a3c363.chunk.js → users-advanced-settings-page.4a1f1f6d.chunk.js} +1 -1
  137. package/build/users-email-settings-page.ea81fe82.chunk.js +9 -0
  138. package/build/users-providers-settings-page.10280cdb.chunk.js +14 -0
  139. package/build/{users-roles-settings-page.d5a8e8a1.chunk.js → users-roles-settings-page.4a7158be.chunk.js} +1 -1
  140. package/build/{webhook-edit-page.87456194.chunk.js → webhook-edit-page.65ac30ee.chunk.js} +2 -2
  141. package/build/{webhook-list-page.c88a382b.chunk.js → webhook-list-page.f57285ca.chunk.js} +1 -1
  142. package/jest.config.front.js +4 -0
  143. package/package.json +23 -17
  144. package/scripts/build.js +1 -1
  145. package/server/controllers/admin.js +3 -2
  146. package/shared/entities.ts +33 -0
  147. package/shared/permissions.ts +52 -0
  148. package/admin/src/components/ConfigurationsProvider/index.js +0 -66
  149. package/admin/src/components/ConfigurationsProvider/reducer.js +0 -29
  150. package/admin/src/components/LanguageProvider/index.js +0 -54
  151. package/admin/src/components/LanguageProvider/init.js +0 -13
  152. package/admin/src/components/LanguageProvider/reducer.js +0 -30
  153. package/admin/src/components/LanguageProvider/utils/localStorageKey.js +0 -3
  154. package/admin/src/components/LocalesProvider/context.js +0 -5
  155. package/admin/src/components/LocalesProvider/index.js +0 -21
  156. package/admin/src/components/LocalesProvider/useLocalesProvider.js +0 -11
  157. package/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +0 -17
  158. package/admin/src/components/PluginsInitializer/index.js +0 -68
  159. package/admin/src/components/PluginsInitializer/init.js +0 -11
  160. package/admin/src/components/PluginsInitializer/reducer.js +0 -22
  161. package/admin/src/contexts/Admin/index.js +0 -5
  162. package/admin/src/contexts/MarketPlace/index.js +0 -18
  163. package/admin/src/contexts/PermisssionsDataManagerContext/index.js +0 -5
  164. package/admin/src/contexts/index.js +0 -3
  165. package/admin/src/hooks/useAdminRoles/__mocks__/index.js +0 -5
  166. package/admin/src/hooks/useAdminUsers/index.js +0 -1
  167. package/admin/src/hooks/useAdminUsers/useAdminUsers.js +0 -47
  168. package/admin/src/hooks/useConfigurations.ts +0 -5
  169. package/admin/src/hooks/useEnterprise/index.js +0 -1
  170. package/admin/src/hooks/useMenu/index.js +0 -86
  171. package/admin/src/hooks/useMenu/utils/checkPermissions.js +0 -13
  172. package/admin/src/hooks/useMenu/utils/getGeneralLinks.js +0 -31
  173. package/admin/src/hooks/useMenu/utils/getPluginSectionLinks.js +0 -17
  174. package/admin/src/hooks/usePermissionsDataManager/index.js +0 -7
  175. package/admin/src/shared/hooks/useAdminProvider/index.js +0 -11
  176. package/build/2224.8af54440.chunk.js +0 -138
  177. package/build/2379.f0baf826.chunk.js +0 -1
  178. package/build/2421.a478ba24.chunk.js +0 -105
  179. package/build/2801.c49f88a1.chunk.js +0 -1
  180. package/build/3911.d4fada48.chunk.js +0 -95
  181. package/build/412.72afdf0c.chunk.js +0 -689
  182. package/build/502.8666bbef.chunk.js +0 -25
  183. package/build/5702.5b433d50.chunk.js +0 -1
  184. package/build/6186.c33ce082.chunk.js +0 -116
  185. package/build/6715.48e37308.chunk.js +0 -1
  186. package/build/6812.00ef5b0d.chunk.js +0 -26
  187. package/build/7464.43a4527c.chunk.js +0 -1
  188. package/build/7818.d2196a53.chunk.js +0 -29
  189. package/build/7897.5c03247b.chunk.js +0 -25
  190. package/build/8690.33243bba.chunk.js +0 -38
  191. package/build/Admin-authenticatedApp.27545a1b.chunk.js +0 -112
  192. package/build/Admin_homePage.a6281dd6.chunk.js +0 -124
  193. package/build/Admin_settingsPage.33378310.chunk.js +0 -111
  194. package/build/admin-app.e8c52c37.chunk.js +0 -36
  195. package/build/admin-edit-roles-page.fcf056bf.chunk.js +0 -275
  196. package/build/admin-edit-users.89efe3c4.chunk.js +0 -10
  197. package/build/admin-roles-list.8b77704a.chunk.js +0 -22
  198. package/build/admin-users.e3f1be14.chunk.js +0 -19
  199. package/build/api-tokens-list-page.ae13346c.chunk.js +0 -16
  200. package/build/audit-logs-settings-page.e9c92a75.chunk.js +0 -9
  201. package/build/content-manager.5849dbe3.chunk.js +0 -1226
  202. package/build/email-settings-page.ecfec9b3.chunk.js +0 -11
  203. package/build/email-translation-ar-json.88304564.chunk.js +0 -1
  204. package/build/email-translation-cs-json.6eaeec6a.chunk.js +0 -1
  205. package/build/email-translation-de-json.1b334230.chunk.js +0 -1
  206. package/build/email-translation-dk-json.85402492.chunk.js +0 -1
  207. package/build/email-translation-en-json.4211d4d0.chunk.js +0 -1
  208. package/build/email-translation-es-json.0b6b1006.chunk.js +0 -1
  209. package/build/email-translation-fr-json.78be2787.chunk.js +0 -1
  210. package/build/email-translation-id-json.c97239fe.chunk.js +0 -1
  211. package/build/email-translation-it-json.a2ed8c78.chunk.js +0 -1
  212. package/build/email-translation-ja-json.63eebd02.chunk.js +0 -1
  213. package/build/email-translation-ko-json.4de49b23.chunk.js +0 -1
  214. package/build/email-translation-ms-json.7390477e.chunk.js +0 -1
  215. package/build/email-translation-nl-json.377bdd9f.chunk.js +0 -1
  216. package/build/email-translation-pl-json.97d0db97.chunk.js +0 -1
  217. package/build/email-translation-pt-BR-json.81cca553.chunk.js +0 -1
  218. package/build/email-translation-pt-json.2a2a0643.chunk.js +0 -1
  219. package/build/email-translation-ru-json.6bce37dd.chunk.js +0 -1
  220. package/build/email-translation-sk-json.53da2fcd.chunk.js +0 -1
  221. package/build/email-translation-th-json.660fa9a8.chunk.js +0 -1
  222. package/build/email-translation-tr-json.e6c0f8fc.chunk.js +0 -1
  223. package/build/email-translation-uk-json.bd1fb6bf.chunk.js +0 -1
  224. package/build/email-translation-vi-json.9fb7e6d7.chunk.js +0 -1
  225. package/build/email-translation-zh-Hans-json.c6841563.chunk.js +0 -1
  226. package/build/email-translation-zh-json.7a2232ea.chunk.js +0 -1
  227. package/build/main.3abb6f34.js +0 -3278
  228. package/build/review-workflows-settings-list-view.70218dc1.chunk.js +0 -75
  229. package/build/runtime~main.450561b1.js +0 -2
  230. package/build/sso-settings-page.1a9e7f8f.chunk.js +0 -1
  231. package/build/transfer-tokens-list-page.5de6bb9f.chunk.js +0 -16
  232. package/build/users-email-settings-page.47b47962.chunk.js +0 -149
  233. package/build/users-providers-settings-page.1e0c8376.chunk.js +0 -154
  234. /package/admin/src/hooks/{useAdminUsers/__mocks__/index.js → __mocks__/useAdminUsers.ts} +0 -0
  235. /package/admin/src/{hooks/useAdminRolePermissions/__mocks__/index.js → pages/SettingsPage/pages/Roles/hooks/__mocks__/useAdminRolePermissions.ts} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4121],{80290:function(R,h,t){t.r(h),t.d(h,{default:function(){return ue}});var e=t(32735),s=t(61489),c=t(15062),u=t(30305),g=t(36150),L=t(99226),S=t(95162),D=t(64092),P=t(95181),l=t(8365),C=t(91779),j=t(56932),U=t(77981),_=t(23699),ee=t(22116),te=t(41013),K=t(45037),i=t(27947),V=t(96669),ne=t(99320),ae=t(1690),k=t(84642),E=t(74512),F=t(8471);const w=F.ZP.div`
1
+ "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4121],{80290:function(R,h,t){t.r(h),t.d(h,{default:function(){return ue}});var e=t(32735),s=t(59407),c=t(15062),u=t(30305),g=t(36150),L=t(99226),S=t(95162),D=t(64092),P=t(95181),l=t(8365),C=t(91779),j=t(56932),U=t(77981),_=t(23699),ee=t(22116),te=t(41013),K=t(45037),i=t(27947),V=t(96669),ne=t(99320),ae=t(1690),k=t(84642),E=t(74512),F=t(8471);const w=F.ZP.div`
2
2
  background: ${({theme:o})=>o.colors.danger500};
3
3
  border: none;
4
4
  border-radius: 16px;
@@ -4,4 +4,8 @@ module.exports = {
4
4
  preset: '../../../jest-preset.front.js',
5
5
  collectCoverageFrom: ['<rootDir>/packages/core/admin/admin/**/*.js'],
6
6
  displayName: 'Core admin',
7
+ moduleNameMapper: {
8
+ '^@tests/(.*)$': '<rootDir>/admin/tests/$1',
9
+ },
10
+ setupFilesAfterEnv: ['./admin/tests/setup.ts'],
7
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.14.4",
3
+ "version": "4.14.5",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,35 +23,36 @@
23
23
  "scripts": {
24
24
  "analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js",
25
25
  "analyze:deps": "ANALYZE_DEPS=true webpack serve --config webpack.config.dev.js --progress profile",
26
+ "build": "rimraf build && node ./scripts/build.js",
27
+ "build:measure": "rimraf build && cross-env MEASURE_BUILD_SPEED=true node ./scripts/build.js",
26
28
  "create:plugin-file": "node ./scripts/create-dev-plugins-file.js",
27
29
  "develop": "yarn create:plugin-file && yarn develop:webpack",
28
30
  "develop:webpack": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
31
+ "lint": "run -T eslint .",
29
32
  "prepublishOnly": "yarn build",
30
- "build": "rimraf build && node ./scripts/build.js",
31
- "build:measure": "rimraf build && cross-env MEASURE_BUILD_SPEED=true node ./scripts/build.js",
32
33
  "test": "echo \"no tests yet\"",
33
- "test:unit": "run -T jest",
34
- "test:unit:watch": "run -T jest --watch",
35
34
  "test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
36
- "test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
37
35
  "test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
38
- "test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
39
36
  "test:front:ce:cov": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --coverage",
37
+ "test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
38
+ "test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
40
39
  "test:ts:front": "run -T tsc -p admin/tsconfig.json",
41
- "lint": "run -T eslint ."
40
+ "test:unit": "run -T jest",
41
+ "test:unit:watch": "run -T jest --watch"
42
42
  },
43
43
  "dependencies": {
44
44
  "@casl/ability": "6.5.0",
45
45
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
46
46
  "@radix-ui/react-toolbar": "1.0.4",
47
- "@strapi/data-transfer": "4.14.4",
48
- "@strapi/design-system": "1.12.0",
49
- "@strapi/helper-plugin": "4.14.4",
50
- "@strapi/icons": "1.12.0",
51
- "@strapi/permissions": "4.14.4",
52
- "@strapi/provider-audit-logs-local": "4.14.4",
53
- "@strapi/typescript-utils": "4.14.4",
54
- "@strapi/utils": "4.14.4",
47
+ "@strapi/data-transfer": "4.14.5",
48
+ "@strapi/design-system": "1.12.2",
49
+ "@strapi/helper-plugin": "4.14.5",
50
+ "@strapi/icons": "1.12.2",
51
+ "@strapi/permissions": "4.14.5",
52
+ "@strapi/provider-audit-logs-local": "4.14.5",
53
+ "@strapi/types": "4.14.5",
54
+ "@strapi/typescript-utils": "4.14.5",
55
+ "@strapi/utils": "4.14.5",
55
56
  "axios": "1.5.0",
56
57
  "bcryptjs": "2.4.3",
57
58
  "browserslist": "^4.22.1",
@@ -134,6 +135,7 @@
134
135
  "yup": "0.32.9"
135
136
  },
136
137
  "devDependencies": {
138
+ "@strapi/admin-test-utils": "4.14.5",
137
139
  "@testing-library/dom": "9.2.0",
138
140
  "@testing-library/react": "14.0.0",
139
141
  "@testing-library/user-event": "14.4.3",
@@ -159,9 +161,13 @@
159
161
  }
160
162
  },
161
163
  "implicitDependencies": [
164
+ "@strapi/plugin-email",
165
+ "@strapi/plugin-content-manager",
166
+ "@strapi/plugin-content-type-builder",
167
+ "@strapi/plugin-upload",
162
168
  "!@strapi/data-transfer",
163
169
  "!@strapi/strapi"
164
170
  ]
165
171
  },
166
- "gitHead": "fbd6e3e3014b1c5eee1d7bb8d65e273318662656"
172
+ "gitHead": "a0400e4a0f47f8169b7ce31bc9087470c291209c"
167
173
  }
package/scripts/build.js CHANGED
@@ -15,7 +15,7 @@ const smp = new SpeedMeasurePlugin();
15
15
  const buildAdmin = async () => {
16
16
  const entry = path.join(__dirname, '..', 'admin', 'src');
17
17
  const dest = path.join(__dirname, '..', 'build');
18
- const tsConfigFilePath = path.join(__dirname, '..', 'admin', 'tsconfig.json');
18
+ const tsConfigFilePath = path.join(__dirname, '..', 'admin', 'tsconfig.build.json');
19
19
 
20
20
  /**
21
21
  * We _always_ install these FE plugins, they're considered "core"
@@ -26,11 +26,12 @@ module.exports = {
26
26
  // When removing this we need to update the /admin/src/index.js file
27
27
  // where we set the strapi.window.isEE value
28
28
  async getProjectType() {
29
+ const flags = strapi.config.get('admin.flags', {});
29
30
  // FIXME
30
31
  try {
31
- return { data: { isEE: strapi.EE, features: ee.features.list() } };
32
+ return { data: { isEE: strapi.EE, features: ee.features.list(), flags } };
32
33
  } catch (err) {
33
- return { data: { isEE: false, features: [] } };
34
+ return { data: { isEE: false, features: [], flags } };
34
35
  }
35
36
  },
36
37
 
@@ -0,0 +1,33 @@
1
+ import type { Entity as TEntity } from '@strapi/types';
2
+
3
+ export interface Entity {
4
+ id: TEntity.ID;
5
+ createdAt: string;
6
+ updatedAt: string;
7
+ }
8
+
9
+ /**
10
+ * TODO: is there a way to infer this from the content-type schema?
11
+ * TODO: define content-type schema for a role.
12
+ */
13
+ export interface RoleEntity extends Entity {
14
+ name: string;
15
+ code: string;
16
+ description?: string;
17
+ usersCount?: number;
18
+ }
19
+
20
+ /**
21
+ * TODO: is there a way to infer this from the content-type schema?
22
+ * TODO: define content-type schema for a user.
23
+ */
24
+ export interface UserEntity extends Entity {
25
+ firstname: string;
26
+ lastname?: string;
27
+ username: null | string;
28
+ email: string;
29
+ isActive: boolean;
30
+ blocked: boolean;
31
+ preferedLanguage: null | string;
32
+ roles: RoleEntity[];
33
+ }
@@ -0,0 +1,52 @@
1
+ type Condition = {
2
+ id: string;
3
+ displayName: string;
4
+ category: string;
5
+ }
6
+
7
+ type Permission = {
8
+ action: string;
9
+ displayName: string;
10
+ plugin: string;
11
+ subCategory: string;
12
+ }
13
+
14
+ type ContentTypePermission = {
15
+ actionId: string;
16
+ applyToProperties: string[];
17
+ label: string;
18
+ subjects: string[];
19
+ }
20
+
21
+ type ContentTypeSubject = {
22
+ uid: string;
23
+ label: string;
24
+ properties: ContentTypeSubjectProperties[];
25
+ };
26
+
27
+ type ContentTypeSubjectPropertyChild = {
28
+ label: string;
29
+ value: string;
30
+ required?: boolean;
31
+ }
32
+
33
+ type ContentTypeSubjectProperties = {
34
+ label: string;
35
+ value: string;
36
+ children: ContentTypeSubjectPropertyChild[];
37
+ }
38
+
39
+ type ContentTypePermissions = {
40
+ actions: ContentTypePermission[];
41
+ subjects: ContentTypeSubject[];
42
+ }
43
+
44
+ export interface RolePermissions {
45
+ conditions: Condition[];
46
+ sections: {
47
+ plugins: Permission[];
48
+ settings: Permission[];
49
+ singleTypes: ContentTypePermissions;
50
+ collectionTypes: ContentTypePermissions;
51
+ }
52
+ }
@@ -1,66 +0,0 @@
1
- import React, { useCallback, useMemo, useReducer } from 'react';
2
-
3
- import PropTypes from 'prop-types';
4
-
5
- import { ConfigurationsContext } from '../../contexts';
6
-
7
- import reducer, { initialState } from './reducer';
8
-
9
- const ConfigurationsProvider = ({
10
- children,
11
- authLogo: defaultAuthLogo,
12
- menuLogo: defaultMenuLogo,
13
- showReleaseNotification,
14
- showTutorials,
15
- }) => {
16
- const [{ menuLogo, authLogo }, dispatch] = useReducer(reducer, initialState);
17
-
18
- const updateProjectSettings = useCallback(
19
- ({ menuLogo, authLogo }) => {
20
- return dispatch({
21
- type: 'UPDATE_PROJECT_SETTINGS',
22
- values: {
23
- menuLogo: menuLogo || defaultMenuLogo,
24
- authLogo: authLogo || defaultAuthLogo,
25
- },
26
- });
27
- },
28
- [defaultAuthLogo, defaultMenuLogo]
29
- );
30
-
31
- const configurationValue = useMemo(() => {
32
- return {
33
- logos: {
34
- menu: { custom: menuLogo, default: defaultMenuLogo },
35
- auth: { custom: authLogo, default: defaultAuthLogo },
36
- },
37
- updateProjectSettings,
38
- showReleaseNotification,
39
- showTutorials,
40
- };
41
- }, [
42
- menuLogo,
43
- defaultMenuLogo,
44
- authLogo,
45
- defaultAuthLogo,
46
- updateProjectSettings,
47
- showReleaseNotification,
48
- showTutorials,
49
- ]);
50
-
51
- return (
52
- <ConfigurationsContext.Provider value={configurationValue}>
53
- {children}
54
- </ConfigurationsContext.Provider>
55
- );
56
- };
57
-
58
- ConfigurationsProvider.propTypes = {
59
- authLogo: PropTypes.string.isRequired,
60
- children: PropTypes.element.isRequired,
61
- menuLogo: PropTypes.string.isRequired,
62
- showReleaseNotification: PropTypes.bool.isRequired,
63
- showTutorials: PropTypes.bool.isRequired,
64
- };
65
-
66
- export default ConfigurationsProvider;
@@ -1,29 +0,0 @@
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
- authLogo: null,
13
- };
14
-
15
- const reducer = (state = initialState, action) =>
16
- produce(state, (draftState) => {
17
- switch (action.type) {
18
- case 'UPDATE_PROJECT_SETTINGS': {
19
- Object.assign(draftState, action.values);
20
- break;
21
- }
22
- default: {
23
- return draftState;
24
- }
25
- }
26
- });
27
-
28
- export default reducer;
29
- export { initialState };
@@ -1,54 +0,0 @@
1
- /*
2
- *
3
- * LanguageProvider
4
- *
5
- * this component connects the redux state language locale to the
6
- * IntlProvider component and i18n messages (loaded from `app/translations`)
7
- */
8
-
9
- import React, { useEffect, useReducer } from 'react';
10
-
11
- import defaultsDeep from 'lodash/defaultsDeep';
12
- import PropTypes from 'prop-types';
13
- import { IntlProvider } from 'react-intl';
14
-
15
- import LocalesProvider from '../LocalesProvider';
16
-
17
- import init from './init';
18
- import reducer, { initialState } from './reducer';
19
- import localStorageKey from './utils/localStorageKey';
20
-
21
- const LanguageProvider = ({ children, localeNames, messages }) => {
22
- const [{ locale }, dispatch] = useReducer(reducer, initialState, () => init(localeNames));
23
-
24
- useEffect(() => {
25
- // Set user language in local storage.
26
- window.localStorage.setItem(localStorageKey, locale);
27
- document.documentElement.setAttribute('lang', locale);
28
- }, [locale]);
29
-
30
- const changeLocale = (locale) => {
31
- dispatch({
32
- type: 'CHANGE_LOCALE',
33
- locale,
34
- });
35
- };
36
-
37
- const appMessages = defaultsDeep(messages[locale], messages.en);
38
-
39
- return (
40
- <IntlProvider locale={locale} defaultLocale="en" messages={appMessages} textComponent="span">
41
- <LocalesProvider changeLocale={changeLocale} localeNames={localeNames}>
42
- {children}
43
- </LocalesProvider>
44
- </IntlProvider>
45
- );
46
- };
47
-
48
- LanguageProvider.propTypes = {
49
- children: PropTypes.element.isRequired,
50
- localeNames: PropTypes.objectOf(PropTypes.string).isRequired,
51
- messages: PropTypes.object.isRequired,
52
- };
53
-
54
- export default LanguageProvider;
@@ -1,13 +0,0 @@
1
- import localStorageKey from './utils/localStorageKey';
2
-
3
- const init = (localeNames) => {
4
- const languageFromLocaleStorage = window.localStorage.getItem(localStorageKey);
5
- const appLanguage = localeNames[languageFromLocaleStorage] ? languageFromLocaleStorage : 'en';
6
-
7
- return {
8
- locale: appLanguage,
9
- localeNames,
10
- };
11
- };
12
-
13
- export default init;
@@ -1,30 +0,0 @@
1
- /*
2
- *
3
- * LanguageProvider reducer
4
- *
5
- */
6
-
7
- const initialState = {
8
- localeNames: { en: 'English' },
9
- locale: 'en',
10
- };
11
-
12
- const languageProviderReducer = (state = initialState, action) => {
13
- switch (action.type) {
14
- case 'CHANGE_LOCALE': {
15
- const { locale } = action;
16
-
17
- if (!state.localeNames[locale]) {
18
- return state;
19
- }
20
-
21
- return { ...state, locale };
22
- }
23
- default: {
24
- return state;
25
- }
26
- }
27
- };
28
-
29
- export default languageProviderReducer;
30
- export { initialState };
@@ -1,3 +0,0 @@
1
- const localStorageKey = 'strapi-admin-language';
2
-
3
- export default localStorageKey;
@@ -1,5 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const LocalesProviderContext = createContext();
4
-
5
- export default LocalesProviderContext;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
-
3
- import PropTypes from 'prop-types';
4
-
5
- import LocalesProviderContext from './context';
6
-
7
- const LocalesProvider = ({ changeLocale, children, localeNames }) => {
8
- return (
9
- <LocalesProviderContext.Provider value={{ changeLocale, localeNames }}>
10
- {children}
11
- </LocalesProviderContext.Provider>
12
- );
13
- };
14
-
15
- LocalesProvider.propTypes = {
16
- changeLocale: PropTypes.func.isRequired,
17
- children: PropTypes.element.isRequired,
18
- localeNames: PropTypes.object.isRequired,
19
- };
20
-
21
- export default LocalesProvider;
@@ -1,11 +0,0 @@
1
- import { useContext } from 'react';
2
-
3
- import LocalesProviderContext from './context';
4
-
5
- const useLocalesProvider = () => {
6
- const { changeLocale, localeNames, messages } = useContext(LocalesProviderContext);
7
-
8
- return { changeLocale, localeNames, messages };
9
- };
10
-
11
- export default useLocalesProvider;
@@ -1,17 +0,0 @@
1
- import { usePersistentState } from '@strapi/helper-plugin';
2
-
3
- // Exported to make it available during admin user registration.
4
- // Because we only enable the NPS for users who subscribe to the newsletter when signing up
5
- export function useNpsSurveySettings() {
6
- const [npsSurveySettings, setNpsSurveySettings] = usePersistentState(
7
- 'STRAPI_NPS_SURVEY_SETTINGS',
8
- {
9
- enabled: true,
10
- lastResponseDate: null,
11
- firstDismissalDate: null,
12
- lastDismissalDate: null,
13
- }
14
- );
15
-
16
- return { npsSurveySettings, setNpsSurveySettings };
17
- }
@@ -1,68 +0,0 @@
1
- import React, { useReducer, useRef } from 'react';
2
-
3
- import { LoadingIndicatorPage, useStrapiApp } from '@strapi/helper-plugin';
4
-
5
- import Admin from '../../pages/Admin';
6
-
7
- import init from './init';
8
- import reducer, { initialState } from './reducer';
9
-
10
- const PluginsInitializer = () => {
11
- const { plugins: appPlugins } = useStrapiApp();
12
- const [{ plugins }, dispatch] = useReducer(reducer, initialState, () => init(appPlugins));
13
- const setPlugin = useRef((pluginId) => {
14
- dispatch({ type: 'SET_PLUGIN_READY', pluginId });
15
- });
16
-
17
- const hasApluginNotReady = Object.keys(plugins).some(
18
- (plugin) => plugins[plugin].isReady === false
19
- );
20
-
21
- /**
22
- *
23
- * I have spent some time trying to understand what is happening here, and wanted to
24
- * leave that knowledge for my future me:
25
- *
26
- * `initializer` is an undocumented property of the `registerPlugin` API. At the time
27
- * of writing it seems only to be used by the i18n plugin.
28
- *
29
- * How does it work?
30
- *
31
- * Every plugin that has an `initializer` component defined, receives the
32
- * `setPlugin` function as a component prop. In the case of i18n the plugin fetches locales
33
- * first and calls `setPlugin` with `pluginId` once they are loaded, which then triggers the
34
- * reducer of the admin app defined above.
35
- *
36
- * Once all plugins are set to `isReady: true` the app renders.
37
- *
38
- * This API is used to block rendering of the admin app. We should remove that in v5 completely
39
- * and make sure plugins can inject data into the global store before they are initialized, to avoid
40
- * having a new prop-callback based communication channel between plugins and the core admin app.
41
- *
42
- */
43
-
44
- if (hasApluginNotReady) {
45
- const initializers = Object.keys(plugins).reduce((acc, current) => {
46
- const InitializerComponent = plugins[current].initializer;
47
-
48
- if (InitializerComponent) {
49
- const key = plugins[current].pluginId;
50
-
51
- acc.push(<InitializerComponent key={key} setPlugin={setPlugin.current} />);
52
- }
53
-
54
- return acc;
55
- }, []);
56
-
57
- return (
58
- <>
59
- {initializers}
60
- <LoadingIndicatorPage />
61
- </>
62
- );
63
- }
64
-
65
- return <Admin />;
66
- };
67
-
68
- export default PluginsInitializer;
@@ -1,11 +0,0 @@
1
- const init = (plugins) => {
2
- return {
3
- plugins: Object.keys(plugins).reduce((acc, current) => {
4
- acc[current] = { ...plugins[current] };
5
-
6
- return acc;
7
- }, {}),
8
- };
9
- };
10
-
11
- export default init;
@@ -1,22 +0,0 @@
1
- import produce from 'immer';
2
- import set from 'lodash/set';
3
-
4
- const initialState = {
5
- plugins: null,
6
- };
7
-
8
- const reducer = (state = initialState, action) =>
9
- /* eslint-disable-next-line consistent-return */
10
- produce(state, (draftState) => {
11
- switch (action.type) {
12
- case 'SET_PLUGIN_READY': {
13
- set(draftState, ['plugins', action.pluginId, 'isReady'], true);
14
- break;
15
- }
16
- default:
17
- return draftState;
18
- }
19
- });
20
-
21
- export { initialState };
22
- export default reducer;
@@ -1,5 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const AdminContext = createContext({});
4
-
5
- export default AdminContext;
@@ -1,18 +0,0 @@
1
- import React, { createContext, useContext } from 'react';
2
-
3
- import PropTypes from 'prop-types';
4
-
5
- const MarketPlaceContext = createContext({});
6
-
7
- const MarketPlaceContextProvider = ({ children, ...rest }) => {
8
- return <MarketPlaceContext.Provider value={rest}>{children}</MarketPlaceContext.Provider>;
9
- };
10
-
11
- const useMarketPlaceContext = () => useContext(MarketPlaceContext);
12
-
13
- MarketPlaceContextProvider.propTypes = {
14
- children: PropTypes.node.isRequired,
15
- downloadPlugin: PropTypes.func.isRequired,
16
- };
17
-
18
- export { MarketPlaceContext, MarketPlaceContextProvider, useMarketPlaceContext };
@@ -1,5 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const PermissionsDataManagerContext = createContext({});
4
-
5
- export default PermissionsDataManagerContext;
@@ -1,3 +0,0 @@
1
- export { default as AdminContext } from './Admin';
2
- export { ConfigurationsContext } from './configuration';
3
- export { default as PermissionsDataManagerContext } from './PermisssionsDataManagerContext';
@@ -1,5 +0,0 @@
1
- export const useAdminRoles = jest.fn().mockReturnValue({
2
- roles: [],
3
- isLoading: false,
4
- isError: false,
5
- });
@@ -1 +0,0 @@
1
- export * from './useAdminUsers';