@akemona-org/strapi-admin 3.7.0 → 3.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/admin/src/app.js +15 -15
  2. package/admin/src/components/Header/index.js +4 -4
  3. package/admin/src/components/LeftMenu/LeftMenuFooter/Wrapper.js +1 -1
  4. package/admin/src/components/LeftMenu/LeftMenuFooter/index.js +6 -1
  5. package/admin/src/components/LeftMenu/LeftMenuHeader/Wrapper.js +3 -3
  6. package/admin/src/components/LeftMenu/LeftMenuLink/A.js +7 -7
  7. package/admin/src/components/LeftMenu/LeftMenuLink/LeftMenuLinkContent.js +1 -1
  8. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/Title.js +1 -1
  9. package/admin/src/components/LeftMenu/LeftMenuLinkHeader/index.js +2 -2
  10. package/admin/src/components/LeftMenu/LeftMenuLinkSection/index.js +1 -1
  11. package/admin/src/components/LeftMenu/LinksContainer/index.js +2 -2
  12. package/admin/src/components/Notifications/Notification/Li.js +15 -15
  13. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/ClearIndicator.js +1 -1
  14. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/index.js +7 -6
  15. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/createCollapsesObject.js +1 -1
  16. package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/SingleValue.js +1 -1
  17. package/admin/src/components/Roles/ConditionsModal/index.js +2 -2
  18. package/admin/src/components/Roles/ConditionsModal/utils/selectStyle.js +8 -8
  19. package/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js +4 -7
  20. package/admin/src/components/Roles/ContentTypeCollapse/Collapse/utils/generateCheckboxesActions.js +1 -1
  21. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +1 -1
  22. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/getRowLabelCheckboxeState.js +1 -1
  23. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/Header/index.js +1 -1
  24. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +6 -10
  25. package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/utils/generateHeadersFromActions.js +1 -1
  26. package/admin/src/components/Roles/ContentTypeCollapse/utils/activeStyle.js +1 -1
  27. package/admin/src/components/Roles/ContentTypeCollapse/utils/getAvailableActions.js +1 -1
  28. package/admin/src/components/Roles/ContentTypeCollapses/index.js +1 -1
  29. package/admin/src/components/Roles/Curve/index.js +1 -1
  30. package/admin/src/components/Roles/GlobalActions/utils/findDisplayedActions.js +1 -1
  31. package/admin/src/components/Roles/GlobalActions/utils/getRowLabelCheckboxesState.js +2 -2
  32. package/admin/src/components/Roles/Permissions/index.js +5 -4
  33. package/admin/src/components/Roles/Permissions/reducer.js +4 -4
  34. package/admin/src/components/Roles/Permissions/utils/createDefaultCTFormFromLayout.js +1 -1
  35. package/admin/src/components/Roles/Permissions/utils/findMatchingPermissions.js +1 -1
  36. package/admin/src/components/Roles/Permissions/utils/formatContentTypesPermissionToAPI.js +2 -2
  37. package/admin/src/components/Roles/Permissions/utils/formatLayoutForSettingsAndPlugins.js +1 -1
  38. package/admin/src/components/Roles/Permissions/utils/formatPermissionsToAPI.js +1 -1
  39. package/admin/src/components/Roles/Permissions/utils/formatSettingsPermissionsToAPI.js +4 -4
  40. package/admin/src/components/Roles/Permissions/utils/updateConditionsToFalse.js +2 -2
  41. package/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js +1 -1
  42. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js +4 -7
  43. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/formatActions.js +2 -2
  44. package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/getConditionsButtonState.js +2 -2
  45. package/admin/src/components/Roles/PluginsAndSettings/index.js +1 -1
  46. package/admin/src/components/Roles/RoleForm/NameInput.js +1 -1
  47. package/admin/src/components/Roles/RoleList/RoleDescription.js +1 -1
  48. package/admin/src/components/Roles/Tabs/index.js +1 -1
  49. package/admin/src/components/Roles/utils/createArrayOfValues.js +2 -2
  50. package/admin/src/components/Roles/utils/getCheckboxState.js +3 -3
  51. package/admin/src/components/Roles/utils/removeConditionKeyFromData.js +1 -1
  52. package/admin/src/components/Users/FilterPicker/Card/Input.js +1 -1
  53. package/admin/src/components/Users/FilterPicker/Card/index.js +2 -2
  54. package/admin/src/components/Users/FilterPicker/Card/init.js +1 -1
  55. package/admin/src/components/Users/FilterPicker/Card/reducer.js +1 -1
  56. package/admin/src/components/Users/FilterPicker/index.js +1 -1
  57. package/admin/src/components/Users/List/index.js +5 -5
  58. package/admin/src/components/Users/List/init.js +1 -1
  59. package/admin/src/components/Users/List/reducer.js +1 -1
  60. package/admin/src/components/Users/List/utils/checkIfAllEntriesAreSelected.js +1 -1
  61. package/admin/src/components/Users/List/utils/headers.js +2 -2
  62. package/admin/src/components/Users/List/utils/updateRows.js +1 -1
  63. package/admin/src/components/Users/ModalCreateBody/index.js +3 -3
  64. package/admin/src/components/Users/ModalCreateBody/init.js +1 -1
  65. package/admin/src/components/Users/ModalCreateBody/reducer.js +1 -1
  66. package/admin/src/components/Users/ModalCreateBody/utils/schema.js +2 -8
  67. package/admin/src/components/Users/RoleSettingsModalSection/index.js +1 -1
  68. package/admin/src/components/Users/SelectRoles/ClearIndicator.js +1 -1
  69. package/admin/src/components/Users/SelectRoles/MultiValueContainer.js +1 -1
  70. package/admin/src/components/Users/SelectRoles/index.js +3 -3
  71. package/admin/src/components/Users/SelectRoles/utils/styles.js +4 -4
  72. package/admin/src/components/Users/SortPicker/Button.js +1 -1
  73. package/admin/src/components/Users/SortPicker/List.js +1 -1
  74. package/admin/src/components/Users/SortPicker/ListWrapper.js +1 -1
  75. package/admin/src/components/Users/SortPicker/index.js +2 -2
  76. package/admin/src/components/Webhooks/EventInput/EventRow.js +2 -2
  77. package/admin/src/components/Webhooks/EventInput/index.js +5 -5
  78. package/admin/src/components/Webhooks/EventInput/utils/formatValue.js +1 -1
  79. package/admin/src/components/Webhooks/HeadersInput/index.js +6 -6
  80. package/admin/src/components/Webhooks/Inputs/index.js +2 -2
  81. package/admin/src/components/Webhooks/ListRow/index.js +3 -3
  82. package/admin/src/configureStore.js +1 -1
  83. package/admin/src/containers/Admin/Content.js +5 -5
  84. package/admin/src/containers/Admin/Logout/index.js +1 -1
  85. package/admin/src/containers/Admin/Wrapper.js +1 -1
  86. package/admin/src/containers/Admin/reducer.js +1 -1
  87. package/admin/src/containers/Admin/selectors.js +2 -2
  88. package/admin/src/containers/App/selectors.js +9 -8
  89. package/admin/src/containers/App/styles/website.css +5 -5
  90. package/admin/src/containers/ApplicationInfosPage/index.js +4 -4
  91. package/admin/src/containers/AuthPage/components/ForgotPassword/index.js +1 -1
  92. package/admin/src/containers/AuthPage/components/Login/BaseLogin.js +1 -1
  93. package/admin/src/containers/AuthPage/components/Login/index.js +2 -2
  94. package/admin/src/containers/AuthPage/components/Register/index.js +3 -3
  95. package/admin/src/containers/AuthPage/components/ResetPassword/index.js +1 -1
  96. package/admin/src/containers/AuthPage/init.js +1 -1
  97. package/admin/src/containers/AuthPage/reducer.js +1 -1
  98. package/admin/src/containers/AuthPage/utils/forms.js +2 -8
  99. package/admin/src/containers/HomePage/index.js +15 -16
  100. package/admin/src/containers/InstalledPluginsPage/Row.js +1 -1
  101. package/admin/src/containers/InstalledPluginsPage/index.js +1 -1
  102. package/admin/src/containers/InstalledPluginsPage/utils/generateRows.js +1 -1
  103. package/admin/src/containers/LanguageProvider/hooks/useChangeLanguage.js +1 -1
  104. package/admin/src/containers/LanguageProvider/index.js +1 -1
  105. package/admin/src/containers/LanguageProvider/selectors.js +3 -10
  106. package/admin/src/containers/LeftMenu/Wrapper.js +5 -5
  107. package/admin/src/containers/LeftMenu/reducer.js +1 -1
  108. package/admin/src/containers/LeftMenu/selectors.js +1 -1
  109. package/admin/src/containers/LeftMenu/utils/generateModelsLinks.js +2 -2
  110. package/admin/src/containers/LeftMenu/utils/getCtOrStLinks.js +5 -4
  111. package/admin/src/containers/LeftMenu/utils/getGeneralLinks.js +1 -1
  112. package/admin/src/containers/LeftMenu/utils/getSettingsMenuLinksPermissions.js +1 -1
  113. package/admin/src/containers/LeftMenu/utils/toPluginLinks.js +2 -2
  114. package/admin/src/containers/LocaleToggle/index.js +2 -2
  115. package/admin/src/containers/LocaleToggle/selectors.js +4 -7
  116. package/admin/src/containers/MarketplacePage/PluginCard/index.js +3 -3
  117. package/admin/src/containers/MarketplacePage/index.js +2 -2
  118. package/admin/src/containers/NewNotification/Notification/index.js +4 -12
  119. package/admin/src/containers/NewNotification/Notification/styledComponents.js +1 -1
  120. package/admin/src/containers/NewNotification/index.js +2 -2
  121. package/admin/src/containers/NewNotification/reducer.js +2 -2
  122. package/admin/src/containers/NotFoundPage/index.js +1 -1
  123. package/admin/src/containers/NotificationProvider/actions.js +1 -1
  124. package/admin/src/containers/NotificationProvider/index.js +1 -1
  125. package/admin/src/containers/NotificationProvider/selectors.js +3 -3
  126. package/admin/src/containers/Onboarding/StaticLinks/index.js +2 -2
  127. package/admin/src/containers/Onboarding/Video.js +1 -1
  128. package/admin/src/containers/Onboarding/index.js +2 -2
  129. package/admin/src/containers/Onboarding/init.js +1 -1
  130. package/admin/src/containers/Onboarding/reducer.js +6 -6
  131. package/admin/src/containers/Onboarding/utils/formatAndStoreVideoArray.js +2 -2
  132. package/admin/src/containers/PermissionsManager/index.js +1 -1
  133. package/admin/src/containers/PermissionsManager/reducer.js +2 -2
  134. package/admin/src/containers/PrivateRoute/index.js +1 -1
  135. package/admin/src/containers/ProfilePage/index.js +4 -4
  136. package/admin/src/containers/Roles/EditPage/index.js +1 -1
  137. package/admin/src/containers/Roles/ListPage/index.js +5 -5
  138. package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Icon.js +1 -1
  139. package/admin/src/containers/SettingsPage/components/MenuWrapper/index.js +1 -1
  140. package/admin/src/containers/SettingsPage/index.js +3 -3
  141. package/admin/src/containers/SettingsPage/utils/createPluginsLinksRoutes.js +3 -3
  142. package/admin/src/containers/SettingsPage/utils/findFirstAllowedEndpoint.js +3 -3
  143. package/admin/src/containers/SettingsPage/utils/getSectionsToDisplay.js +2 -2
  144. package/admin/src/containers/SettingsPage/utils/makeUniqueRoutes.js +2 -2
  145. package/admin/src/containers/Users/EditPage/index.js +2 -2
  146. package/admin/src/containers/Users/ListPage/Header.js +2 -2
  147. package/admin/src/containers/Users/ListPage/index.js +4 -4
  148. package/admin/src/containers/Users/ListPage/init.js +1 -1
  149. package/admin/src/containers/Users/ListPage/reducer.js +1 -1
  150. package/admin/src/containers/Users/ListPage/utils/getFilters.js +1 -1
  151. package/admin/src/containers/Webhooks/EditView/index.js +11 -17
  152. package/admin/src/containers/Webhooks/EditView/reducer.js +4 -4
  153. package/admin/src/containers/Webhooks/EditView/utils/formatData.js +2 -2
  154. package/admin/src/containers/Webhooks/EditView/utils/schema.js +1 -1
  155. package/admin/src/containers/Webhooks/ListView/index.js +5 -5
  156. package/admin/src/containers/Webhooks/ListView/reducer.js +5 -5
  157. package/admin/src/contexts/MarketPlace/index.js +2 -10
  158. package/admin/src/hooks/useFetchPermissionsLayout/index.js +1 -1
  159. package/admin/src/hooks/useFetchPermissionsLayout/reducer.js +1 -1
  160. package/admin/src/hooks/useFetchPluginsFromMarketPlace/index.js +1 -1
  161. package/admin/src/hooks/useFetchRole/index.js +4 -4
  162. package/admin/src/hooks/useFetchRole/reducer.js +1 -1
  163. package/admin/src/hooks/useModels/index.js +1 -1
  164. package/admin/src/hooks/useModels/reducer.js +3 -3
  165. package/admin/src/hooks/useRolesList/reducer.js +1 -1
  166. package/admin/src/hooks/useSettingsForm/index.js +2 -2
  167. package/admin/src/hooks/useSettingsForm/reducer.js +1 -1
  168. package/admin/src/hooks/useSettingsMenu/index.js +2 -2
  169. package/admin/src/hooks/useSettingsMenu/reducer.js +3 -3
  170. package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +3 -3
  171. package/admin/src/plugins.js +2 -2
  172. package/admin/src/public-path.js +1 -3
  173. package/admin/src/utils/ComponentApi.js +3 -3
  174. package/admin/src/utils/FieldApi.js +3 -3
  175. package/admin/src/utils/Plugin.js +1 -1
  176. package/admin/src/utils/Strapi.js +2 -2
  177. package/admin/src/utils/checkStore.js +1 -4
  178. package/admin/src/utils/getAttributesToDisplay.js +1 -1
  179. package/admin/src/utils/getExistingActions.js +2 -2
  180. package/admin/src/utils/getRequestUrl.js +1 -1
  181. package/admin/src/utils/injectReducer.js +26 -25
  182. package/admin/src/utils/injectSaga.js +28 -27
  183. package/admin/src/utils/reducerInjectors.js +1 -5
  184. package/admin/src/utils/retrieveGlobalLinks.js +1 -1
  185. package/admin/src/utils/retrievePluginsMenu.js +1 -1
  186. package/admin/src/utils/sagaInjectors.js +4 -7
  187. package/admin/src/utils/sortLinks.js +1 -1
  188. package/admin/src/validations/users/profile.js +1 -5
  189. package/admin/src/validations/users/roles.js +1 -4
  190. package/config/admin-conditions.js +3 -3
  191. package/config/migrations/permissions-fields-to-properties.js +4 -4
  192. package/controllers/admin.js +1 -1
  193. package/controllers/formatters/format-actions-by-sections.js +1 -1
  194. package/doc/customize-menu.md +3 -3
  195. package/domain/action/index.js +3 -3
  196. package/domain/condition/index.js +2 -2
  197. package/domain/permission/index.js +3 -3
  198. package/domain/user.js +2 -2
  199. package/index.js +16 -14
  200. package/middlewares/auth/index.js +1 -1
  201. package/package.json +4 -4
  202. package/services/action.js +1 -1
  203. package/services/condition.js +1 -1
  204. package/services/passport/local-strategy.js +2 -2
  205. package/services/passport.js +2 -4
  206. package/services/permission/engine.js +9 -9
  207. package/services/permission/queries.js +11 -12
  208. package/services/permission/sections-builder/utils.js +5 -5
  209. package/services/token.js +2 -2
  210. package/utils/index.js +1 -1
  211. package/validation/common-functions/check-fields-are-correctly-nested.js +3 -2
  212. package/validation/common-functions/check-fields-dont-have-duplicates.js +1 -1
  213. package/webpack.config.js +2 -2
@@ -1,6 +1,6 @@
1
1
  import { get } from 'lodash';
2
2
 
3
- const getAttributesToDisplay = contentType => {
3
+ const getAttributesToDisplay = (contentType) => {
4
4
  const timestamps = get(contentType, ['options', 'timestamps']);
5
5
 
6
6
  // Sometimes timestamps is false
@@ -1,10 +1,10 @@
1
1
  import { get } from 'lodash';
2
2
 
3
- const getExistingActions = permissions => {
3
+ const getExistingActions = (permissions) => {
4
4
  return Array.from(
5
5
  new Set(
6
6
  Object.entries(permissions).reduce((acc, current) => {
7
- const getActionsPermission = permission =>
7
+ const getActionsPermission = (permission) =>
8
8
  permission.reduce((accAction, currentAction) => {
9
9
  let actionsToReturn = accAction;
10
10
 
@@ -1,3 +1,3 @@
1
- const getRequestUrl = path => `/admin/${path}`;
1
+ const getRequestUrl = (path) => `/admin/${path}`;
2
2
 
3
3
  export default getRequestUrl;
@@ -12,33 +12,34 @@ import getInjectors from './reducerInjectors';
12
12
  * @param {function} reducer A reducer that will be injected
13
13
  *
14
14
  */
15
- export default ({ key, reducer, pluginId }) => WrappedComponent => {
16
- class ReducerInjector extends React.Component {
17
- static WrappedComponent = WrappedComponent;
18
- static displayName = `withReducer(${WrappedComponent.displayName ||
19
- WrappedComponent.name ||
20
- 'Component'})`;
21
-
22
- static contextType = ReactReduxContext;
23
-
24
- constructor(props, context) {
25
- super(props, context);
26
- const reducerName = pluginId ? `${pluginId}_${key}` : key;
27
-
28
- console.warn(
29
- 'Warning: strapi.injectReducer will be removed in the next major release. \n Please update your code.'
30
- );
31
-
32
- getInjectors(context.store).injectReducer(reducerName, reducer);
15
+ export default ({ key, reducer, pluginId }) =>
16
+ (WrappedComponent) => {
17
+ class ReducerInjector extends React.Component {
18
+ static WrappedComponent = WrappedComponent;
19
+ static displayName = `withReducer(${
20
+ WrappedComponent.displayName || WrappedComponent.name || 'Component'
21
+ })`;
22
+
23
+ static contextType = ReactReduxContext;
24
+
25
+ constructor(props, context) {
26
+ super(props, context);
27
+ const reducerName = pluginId ? `${pluginId}_${key}` : key;
28
+
29
+ console.warn(
30
+ 'Warning: strapi.injectReducer will be removed in the next major release. \n Please update your code.'
31
+ );
32
+
33
+ getInjectors(context.store).injectReducer(reducerName, reducer);
34
+ }
35
+
36
+ render() {
37
+ return <WrappedComponent {...this.props} />;
38
+ }
33
39
  }
34
40
 
35
- render() {
36
- return <WrappedComponent {...this.props} />;
37
- }
38
- }
39
-
40
- return hoistNonReactStatics(ReducerInjector, WrappedComponent);
41
- };
41
+ return hoistNonReactStatics(ReducerInjector, WrappedComponent);
42
+ };
42
43
 
43
44
  const useInjectReducer = ({ key, reducer, pluginId }) => {
44
45
  const context = React.useContext(ReactReduxContext);
@@ -16,44 +16,45 @@ import getInjectors from './sagaInjectors';
16
16
  * - constants.ONCE_TILL_UNMOUNT—behaves like 'RESTART_ON_REMOUNT' but never runs it again.
17
17
  *
18
18
  */
19
- export default ({ key, saga, mode, pluginId }) => WrappedComponent => {
20
- class InjectSaga extends React.Component {
21
- static WrappedComponent = WrappedComponent;
22
- static displayName = `withSaga(${WrappedComponent.displayName ||
23
- WrappedComponent.name ||
24
- 'Component'})`;
19
+ export default ({ key, saga, mode, pluginId }) =>
20
+ (WrappedComponent) => {
21
+ class InjectSaga extends React.Component {
22
+ static WrappedComponent = WrappedComponent;
23
+ static displayName = `withSaga(${
24
+ WrappedComponent.displayName || WrappedComponent.name || 'Component'
25
+ })`;
25
26
 
26
- static contextType = ReactReduxContext;
27
+ static contextType = ReactReduxContext;
27
28
 
28
- constructor(props, context) {
29
- super(props, context);
29
+ constructor(props, context) {
30
+ super(props, context);
30
31
 
31
- this.injectors = getInjectors(context.store);
32
- const sagaName = pluginId ? `${pluginId}_${key}` : key;
32
+ this.injectors = getInjectors(context.store);
33
+ const sagaName = pluginId ? `${pluginId}_${key}` : key;
33
34
 
34
- console.warn(
35
- 'Warning: strapi.injectSaga will be removed in the next major release. \n Please update your code.'
36
- );
35
+ console.warn(
36
+ 'Warning: strapi.injectSaga will be removed in the next major release. \n Please update your code.'
37
+ );
37
38
 
38
- this.injectors.injectSaga(sagaName, { saga, mode }, this.props);
39
- }
39
+ this.injectors.injectSaga(sagaName, { saga, mode }, this.props);
40
+ }
40
41
 
41
- componentWillUnmount() {
42
- const { ejectSaga } = this.injectors;
43
- const sagaName = pluginId ? `${pluginId}_${key}` : key;
42
+ componentWillUnmount() {
43
+ const { ejectSaga } = this.injectors;
44
+ const sagaName = pluginId ? `${pluginId}_${key}` : key;
44
45
 
45
- ejectSaga(sagaName);
46
- }
46
+ ejectSaga(sagaName);
47
+ }
47
48
 
48
- injectors = getInjectors(this.context.store);
49
+ injectors = getInjectors(this.context.store);
49
50
 
50
- render() {
51
- return <WrappedComponent {...this.props} />;
51
+ render() {
52
+ return <WrappedComponent {...this.props} />;
53
+ }
52
54
  }
53
- }
54
55
 
55
- return hoistNonReactStatics(InjectSaga, WrappedComponent);
56
- };
56
+ return hoistNonReactStatics(InjectSaga, WrappedComponent);
57
+ };
57
58
 
58
59
  const useInjectSaga = ({ key, saga, mode, pluginId }) => {
59
60
  const context = React.useContext(ReactReduxContext);
@@ -18,11 +18,7 @@ export function injectReducerFactory(store, isValid) {
18
18
  );
19
19
 
20
20
  // Check `store.injectedReducers[key] === reducer` for hot reloading when a key is the same but a reducer is different
21
- if (
22
- Reflect.has(store.injectedReducers, key) &&
23
- store.injectedReducers[key] === reducer
24
- )
25
- return;
21
+ if (Reflect.has(store.injectedReducers, key) && store.injectedReducers[key] === reducer) return;
26
22
 
27
23
  store.injectedReducers[key] = reducer; // eslint-disable-line no-param-reassign
28
24
  store.replaceReducer(createReducer(store.injectedReducers));
@@ -1,6 +1,6 @@
1
1
  import { get } from 'lodash';
2
2
 
3
- const retrieveGlobalLinks = pluginsObj => {
3
+ const retrieveGlobalLinks = (pluginsObj) => {
4
4
  return Object.values(pluginsObj).reduce((acc, current) => {
5
5
  const links = get(current, ['settings', 'global', 'links'], null);
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { get } from 'lodash';
2
2
 
3
- const retrievePluginsMenu = pluginsObj => {
3
+ const retrievePluginsMenu = (pluginsObj) => {
4
4
  return Object.values(pluginsObj).reduce((acc, current) => {
5
5
  const pluginMenu = get(current, ['settings', 'menuSection'], null);
6
6
 
@@ -11,16 +11,16 @@ import { DAEMON, ONCE_TILL_UNMOUNT, RESTART_ON_REMOUNT } from './constants';
11
11
 
12
12
  const allowedModes = [RESTART_ON_REMOUNT, DAEMON, ONCE_TILL_UNMOUNT];
13
13
 
14
- const checkKey = key =>
14
+ const checkKey = (key) =>
15
15
  invariant(
16
16
  isString(key) && !isEmpty(key),
17
17
  '(app/utils...) injectSaga: Expected `key` to be a non empty string'
18
18
  );
19
19
 
20
- const checkDescriptor = descriptor => {
20
+ const checkDescriptor = (descriptor) => {
21
21
  const shape = {
22
22
  saga: isFunction,
23
- mode: mode => isString(mode) && allowedModes.includes(mode),
23
+ mode: (mode) => isString(mode) && allowedModes.includes(mode),
24
24
  };
25
25
  invariant(
26
26
  conformsTo(descriptor, shape),
@@ -52,10 +52,7 @@ export function injectSagaFactory(store, isValid) {
52
52
  }
53
53
  }
54
54
 
55
- if (
56
- !hasSaga ||
57
- (hasSaga && mode !== DAEMON && mode !== ONCE_TILL_UNMOUNT)
58
- ) {
55
+ if (!hasSaga || (hasSaga && mode !== DAEMON && mode !== ONCE_TILL_UNMOUNT)) {
59
56
  store.injectedSagas[key] = {
60
57
  ...newDescriptor,
61
58
  task: store.runSaga(saga, args),
@@ -1,5 +1,5 @@
1
1
  import { sortBy } from 'lodash';
2
2
 
3
- const sortLinks = links => sortBy(links, object => object.name);
3
+ const sortLinks = (links) => sortBy(links, (object) => object.name);
4
4
 
5
5
  export default sortLinks;
@@ -4,11 +4,7 @@ import { translatedErrors } from 'strapi-helper-plugin';
4
4
  const schema = {
5
5
  firstname: yup.mixed().required(translatedErrors.required),
6
6
  lastname: yup.mixed().required(translatedErrors.required),
7
- email: yup
8
- .string()
9
- .email(translatedErrors.email)
10
- .lowercase()
11
- .required(translatedErrors.required),
7
+ email: yup.string().email(translatedErrors.email).lowercase().required(translatedErrors.required),
12
8
  username: yup.string().nullable(),
13
9
  password: yup
14
10
  .string()
@@ -2,10 +2,7 @@ import * as yup from 'yup';
2
2
  import { translatedErrors } from 'strapi-helper-plugin';
3
3
 
4
4
  const schema = {
5
- roles: yup
6
- .array()
7
- .min(1)
8
- .required(translatedErrors.required),
5
+ roles: yup.array().min(1).required(translatedErrors.required),
9
6
  };
10
7
 
11
8
  export default schema;
@@ -6,17 +6,17 @@ module.exports = {
6
6
  displayName: 'Is creator',
7
7
  name: 'is-creator',
8
8
  plugin: 'admin',
9
- handler: user => ({ 'created_by.id': user.id }),
9
+ handler: (user) => ({ 'created_by.id': user.id }),
10
10
  },
11
11
  {
12
12
  displayName: 'Has same role as creator',
13
13
  name: 'has-same-role-as-creator',
14
14
  plugin: 'admin',
15
- handler: user => ({
15
+ handler: (user) => ({
16
16
  'created_by.roles': {
17
17
  $elemMatch: {
18
18
  id: {
19
- $in: user.roles.map(r => r.id),
19
+ $in: user.roles.map((r) => r.id),
20
20
  },
21
21
  },
22
22
  },
@@ -4,7 +4,7 @@ const { has, isObject } = require('lodash/fp');
4
4
 
5
5
  const permissionModelUID = 'strapi::permission';
6
6
 
7
- const hasAttribute = attribute => has(`attributes.${attribute}`);
7
+ const hasAttribute = (attribute) => has(`attributes.${attribute}`);
8
8
  const hasFieldsAttribute = hasAttribute('fields');
9
9
  const hasPropertiesAttribute = hasAttribute('properties');
10
10
 
@@ -26,7 +26,7 @@ const permissionsFinderByORM = {
26
26
  async bookshelf(model) {
27
27
  const permissions = await model.fetchAll();
28
28
 
29
- return permissions.toJSON().map(permission => {
29
+ return permissions.toJSON().map((permission) => {
30
30
  const fields = permission.fields;
31
31
 
32
32
  return {
@@ -74,7 +74,7 @@ module.exports = {
74
74
  const { permissions = [] } = permissionsFieldsToProperties;
75
75
 
76
76
  if (model.orm === 'bookshelf') {
77
- const update = async transacting => {
77
+ const update = async (transacting) => {
78
78
  for (const permission of permissions) {
79
79
  const { fields, ...rest } = permission;
80
80
 
@@ -84,7 +84,7 @@ module.exports = {
84
84
  }
85
85
  };
86
86
 
87
- await ORM.transaction(transacting => update(transacting));
87
+ await ORM.transaction((transacting) => update(transacting));
88
88
  }
89
89
 
90
90
  if (model.orm === 'mongoose') {
@@ -8,7 +8,7 @@ const PLUGIN_NAME_REGEX = /^[A-Za-z][A-Za-z0-9-_]+$/;
8
8
  /**
9
9
  * Validates a plugin name format
10
10
  */
11
- const isValidPluginName = plugin => {
11
+ const isValidPluginName = (plugin) => {
12
12
  return _.isString(plugin) && !_.isEmpty(plugin) && PLUGIN_NAME_REGEX.test(plugin);
13
13
  };
14
14
 
@@ -5,7 +5,7 @@
5
5
  * @param {Array<Action>} actions - array of actions
6
6
  * @returns {Object} "{ contentTypes, plugins, settings }"
7
7
  */
8
- const formatActionsBySections = actions =>
8
+ const formatActionsBySections = (actions) =>
9
9
  actions.reduce((result, p) => {
10
10
  const checkboxItem = {
11
11
  displayName: p.displayName,
@@ -1,6 +1,6 @@
1
1
  # Customizing the Admin leftMenu
2
2
 
3
- You can choose which *Content Types* you want to display in the admin.
3
+ You can choose which _Content Types_ you want to display in the admin.
4
4
 
5
5
  For example if you want to display only the `user` content type you have to edit the `layout.js` file located in
6
6
  `my-project/admin/config/layout.js` as follows:
@@ -10,8 +10,8 @@ module.exports = {
10
10
  contentTypesToShow: [
11
11
  {
12
12
  label: '',
13
- destination: 'user'
14
- }
13
+ destination: 'user',
14
+ },
15
15
  ],
16
16
  };
17
17
  ```
@@ -58,7 +58,7 @@ const sanitizeActionAttributes = pick(actionFields);
58
58
  * @param {CreateActionPayload} attributes
59
59
  * @return {string}
60
60
  */
61
- const computeActionId = attributes => {
61
+ const computeActionId = (attributes) => {
62
62
  const { pluginName, uid } = attributes;
63
63
 
64
64
  if (!pluginName) {
@@ -77,14 +77,14 @@ const computeActionId = attributes => {
77
77
  * @param {CreateActionPayload} attrs - Payload used to create an action
78
78
  * @return {CreateActionPayload}
79
79
  */
80
- const assignActionId = attrs => set('actionId', computeActionId(attrs), attrs);
80
+ const assignActionId = (attrs) => set('actionId', computeActionId(attrs), attrs);
81
81
 
82
82
  /**
83
83
  * Transform an action by adding or removing the {@link Action.subCategory} attribute
84
84
  * @param {Action} action - The action to process
85
85
  * @return {Action}
86
86
  */
87
- const assignOrOmitSubCategory = action => {
87
+ const assignOrOmitSubCategory = (action) => {
88
88
  const shouldHaveSubCategory = ['settings', 'plugins'].includes(action.section);
89
89
 
90
90
  return shouldHaveSubCategory
@@ -49,7 +49,7 @@ const sanitizeConditionAttributes = pick(conditionFields);
49
49
  * @param condition
50
50
  * @return {string}
51
51
  */
52
- const computeConditionId = condition => {
52
+ const computeConditionId = (condition) => {
53
53
  const { name, plugin } = condition;
54
54
 
55
55
  if (!plugin) {
@@ -68,7 +68,7 @@ const computeConditionId = condition => {
68
68
  * @param {CreateConditionPayload} attrs - Payload used to create a condition
69
69
  * @return {CreateConditionPayload}
70
70
  */
71
- const assignConditionId = attrs => set('id', computeConditionId(attrs), attrs);
71
+ const assignConditionId = (attrs) => set('id', computeConditionId(attrs), attrs);
72
72
 
73
73
  /**
74
74
  * Transform the given attributes into a domain representation of a Condition
@@ -98,7 +98,7 @@ const deleteProperty = (property, permission) => omit(`properties.${property}`,
98
98
  * @param {Permission} attributes
99
99
  * @return {Permission}
100
100
  */
101
- const create = attributes => {
101
+ const create = (attributes) => {
102
102
  return pipe(pick(permissionFields), merge(getDefaultPermission()))(attributes);
103
103
  };
104
104
 
@@ -114,7 +114,7 @@ const sanitizeConditions = curry((provider, permission) => {
114
114
  }
115
115
 
116
116
  return permission.conditions
117
- .filter(condition => !provider.has(condition))
117
+ .filter((condition) => !provider.has(condition))
118
118
  .reduce((perm, condition) => removeCondition(condition, perm), permission);
119
119
  });
120
120
 
@@ -123,7 +123,7 @@ const sanitizeConditions = curry((provider, permission) => {
123
123
  * @param {object | object[]} payload - Can either be a single object of attributes or an array of those objects.
124
124
  * @return {Permission | Permission[]}
125
125
  */
126
- const toPermission = payload => (isArray(payload) ? map(create, payload) : create(payload));
126
+ const toPermission = (payload) => (isArray(payload) ? map(create, payload) : create(payload));
127
127
 
128
128
  module.exports = {
129
129
  addCondition,
package/domain/user.js CHANGED
@@ -15,8 +15,8 @@ function createUser(attributes) {
15
15
  };
16
16
  }
17
17
 
18
- const hasSuperAdminRole = user => {
19
- return user.roles.filter(role => role.code === SUPER_ADMIN_CODE).length > 0;
18
+ const hasSuperAdminRole = (user) => {
19
+ return user.roles.filter((role) => role.code === SUPER_ADMIN_CODE).length > 0;
20
20
  };
21
21
 
22
22
  module.exports = {
package/index.js CHANGED
@@ -9,9 +9,9 @@ const chalk = require('chalk');
9
9
  const chokidar = require('chokidar');
10
10
  // eslint-disable-next-line node/no-extraneous-require
11
11
  const hasEE = require('strapi/lib/utils/ee');
12
- const getWebpackConfig = require('./webpack.config.js');
12
+ const getWebpackConfig = require('./webpack.config');
13
13
 
14
- const getPkgPath = name => path.dirname(require.resolve(`${name}/package.json`));
14
+ const getPkgPath = (name) => path.dirname(require.resolve(`${name}/package.json`));
15
15
 
16
16
  function getCustomWebpackConfig(dir, config) {
17
17
  const adminConfigPath = path.join(dir, 'admin', 'admin.config.js');
@@ -104,14 +104,14 @@ window.strapi = Object.assign(window.strapi || {}, {
104
104
 
105
105
  module.exports = {
106
106
  ${plugins
107
- .map(name => {
107
+ .map((name) => {
108
108
  const shortName = name.replace(/^strapi-plugin-/i, '');
109
109
  const req = `require('../../plugins/${name}/admin/src').default`;
110
110
  return `'${shortName}': ${req},`;
111
111
  })
112
112
  .join('\n')}
113
113
  ${localPlugins
114
- .map(name => {
114
+ .map((name) => {
115
115
  const shortName = name.replace(/^strapi-plugin-/i, '');
116
116
  const req = `require('../../../plugins/${name}/admin/src').default`;
117
117
  return `'${shortName}': ${req}`;
@@ -154,7 +154,7 @@ async function copyPlugin(name, dest) {
154
154
  }
155
155
 
156
156
  async function copyAdmin(dest) {
157
- const adminPath = getPkgPath('strapi-admin');
157
+ const adminPath = getPkgPath('@akemona-org/strapi-admin');
158
158
 
159
159
  // TODO copy ee folders for plugins
160
160
  await fs.copy(path.resolve(adminPath, 'ee', 'admin'), path.resolve(dest, 'ee', 'admin'));
@@ -180,7 +180,7 @@ async function createCacheDir(dir) {
180
180
  const pkgJSON = require(path.join(dir, 'package.json'));
181
181
 
182
182
  const pluginsToCopy = Object.keys(pkgJSON.dependencies).filter(
183
- dep =>
183
+ (dep) =>
184
184
  dep.startsWith('strapi-plugin') &&
185
185
  fs.existsSync(path.resolve(getPkgPath(dep), 'admin', 'src', 'index.js'))
186
186
  );
@@ -189,7 +189,7 @@ async function createCacheDir(dir) {
189
189
  if (fs.existsSync(path.join(dir, 'plugins'))) {
190
190
  localPluginsToCopy = fs
191
191
  .readdirSync(path.join(dir, 'plugins'))
192
- .filter(plugin =>
192
+ .filter((plugin) =>
193
193
  fs.existsSync(path.resolve(dir, 'plugins', plugin, 'admin', 'src', 'index.js'))
194
194
  );
195
195
  }
@@ -203,7 +203,7 @@ async function createCacheDir(dir) {
203
203
  await copyAdmin(cacheDir);
204
204
 
205
205
  // copy plugins code
206
- await Promise.all(pluginsToCopy.map(name => copyPlugin(name, cacheDir)));
206
+ await Promise.all(pluginsToCopy.map((name) => copyPlugin(name, cacheDir)));
207
207
 
208
208
  // override admin code with user customizations
209
209
  if (fs.pathExistsSync(path.join(dir, 'admin'))) {
@@ -225,7 +225,7 @@ async function createCacheDir(dir) {
225
225
  }, []);
226
226
 
227
227
  await Promise.all(
228
- pluginsToOverride.map(plugin =>
228
+ pluginsToOverride.map((plugin) =>
229
229
  copyCustomAdmin(
230
230
  path.join(dir, 'extensions', plugin, 'admin'),
231
231
  path.join(cacheDir, 'plugins', `strapi-plugin-${plugin}`)
@@ -265,7 +265,7 @@ async function watchAdmin({ dir, host, port, browser, options }) {
265
265
 
266
266
  const server = new WebpackDevServer(webpack(webpackConfig), opts);
267
267
 
268
- server.listen(port, host, function(err) {
268
+ server.listen(port, host, function (err) {
269
269
  if (err) {
270
270
  console.log(err);
271
271
  }
@@ -285,11 +285,11 @@ async function watchFiles(dir, ignoreFiles = []) {
285
285
  const extensionsPath = path.join(dir, 'extensions');
286
286
 
287
287
  const appPlugins = Object.keys(pkgJSON.dependencies).filter(
288
- dep =>
288
+ (dep) =>
289
289
  dep.startsWith('strapi-plugin') &&
290
290
  fs.existsSync(path.resolve(getPkgPath(dep), 'admin', 'src', 'index.js'))
291
291
  );
292
- const pluginsToWatch = appPlugins.map(plugin =>
292
+ const pluginsToWatch = appPlugins.map((plugin) =>
293
293
  path.join(extensionsPath, plugin.replace(/^strapi-plugin-/i, ''), 'admin')
294
294
  );
295
295
  const filesToWatch = [admin, ...pluginsToWatch];
@@ -304,7 +304,9 @@ async function watchFiles(dir, ignoreFiles = []) {
304
304
  const isExtension = filePath.includes(extensionsPath);
305
305
  const pluginName = isExtension ? filePath.replace(extensionsPath, '').split(path.sep)[1] : '';
306
306
 
307
- const packageName = isExtension ? `strapi-plugin-${pluginName}` : 'strapi-admin';
307
+ const packageName = isExtension
308
+ ? `@akemona-org/strapi-plugin-${pluginName}`
309
+ : '@akemona-org/strapi-admin';
308
310
 
309
311
  const targetPath = isExtension
310
312
  ? path.normalize(filePath.split(extensionsPath)[1].replace(pluginName, ''))
@@ -344,7 +346,7 @@ async function watchFiles(dir, ignoreFiles = []) {
344
346
  // or the plugins.js file
345
347
  // since the path are different when developing inside the monorepository or inside an app
346
348
  const shouldCopyPluginsJSFile =
347
- filePath.split('/admin/src').filter(p => !!p).length === 1;
349
+ filePath.split('/admin/src').filter((p) => !!p).length === 1;
348
350
 
349
351
  if (
350
352
  (event === 'unlinkDir' && !isExtension && shouldCopyPluginsJSFile) ||
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- module.exports = strapi => ({
3
+ module.exports = (strapi) => ({
4
4
  initialize() {
5
5
  const passportMiddleware = strapi.admin.services.passport.init();
6
6
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.7.0",
6
+ "version": "3.7.2",
7
7
  "description": "Strapi Admin",
8
8
  "repository": {
9
9
  "type": "git",
@@ -17,8 +17,8 @@
17
17
  },
18
18
  "main": "index.js",
19
19
  "dependencies": {
20
- "@akemona-org/strapi-helper-plugin": "3.7.0",
21
- "@akemona-org/strapi-utils": "3.7.0",
20
+ "@akemona-org/strapi-helper-plugin": "3.7.2",
21
+ "@akemona-org/strapi-utils": "3.7.2",
22
22
  "@babel/core": "^7.14.0",
23
23
  "@babel/plugin-proposal-async-generator-functions": "^7.13.15",
24
24
  "@babel/plugin-proposal-class-properties": "^7.12.1",
@@ -125,5 +125,5 @@
125
125
  "devDependencies": {
126
126
  "webpack-bundle-analyzer": "4.4.0"
127
127
  },
128
- "gitHead": "129a8d6191b55810fd66448dcc47fee829df986c"
128
+ "gitHead": "4ab59dbae5135819558c6ae27b45a556ff27cf55"
129
129
  }
@@ -11,7 +11,7 @@ const { AUTHOR_CODE, PUBLISH_ACTION } = require('./constants');
11
11
  * @param {string|number} roleId
12
12
  * @returns {object[]}
13
13
  */
14
- const getAllowedActionsForRole = async roleId => {
14
+ const getAllowedActionsForRole = async (roleId) => {
15
15
  const { actionProvider } = getService('permission');
16
16
 
17
17
  if (!isNil(roleId)) {
@@ -3,7 +3,7 @@
3
3
  const { isString } = require('lodash/fp');
4
4
  const { getService } = require('../utils');
5
5
 
6
- const isValidCondition = condition => {
6
+ const isValidCondition = (condition) => {
7
7
  const { conditionProvider } = getService('permission');
8
8
 
9
9
  return isString(condition) && conditionProvider.has(condition);
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { Strategy: LocalStrategy } = require('passport-local');
4
4
 
5
- const createLocalStrategy = strapi => {
5
+ const createLocalStrategy = (strapi) => {
6
6
  return new LocalStrategy(
7
7
  {
8
8
  usernameField: 'email',
@@ -13,7 +13,7 @@ const createLocalStrategy = strapi => {
13
13
  return strapi.admin.services.auth
14
14
  .checkCredentials({ email, password })
15
15
  .then(([error, user, message]) => done(error, user, message))
16
- .catch(error => done(error));
16
+ .catch((error) => done(error));
17
17
  }
18
18
  );
19
19
  };
@@ -21,9 +21,7 @@ const registerAuthEvents = () => {
21
21
  const { events = {} } = strapi.config.get('server.admin.auth', {});
22
22
  const { authEventsMapper } = strapi.admin.services.passport;
23
23
 
24
- const eventList = Object.entries(events)
25
- .filter(keyIsValidEventName)
26
- .filter(valueIsFunctionType);
24
+ const eventList = Object.entries(events).filter(keyIsValidEventName).filter(valueIsFunctionType);
27
25
 
28
26
  for (const [eventName, handler] of eventList) {
29
27
  strapi.eventHub.on(authEventsMapper[eventName], handler);
@@ -33,7 +31,7 @@ const registerAuthEvents = () => {
33
31
  const init = () => {
34
32
  strapi.admin.services.passport
35
33
  .getPassportStrategies()
36
- .forEach(strategy => passport.use(strategy));
34
+ .forEach((strategy) => passport.use(strategy));
37
35
 
38
36
  registerAuthEvents();
39
37