diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js index d4462d427f..f31868dba4 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/App/index.js @@ -12,6 +12,7 @@ import { createStructuredSelector } from 'reselect'; import PropTypes from 'prop-types'; import { isEmpty, get } from 'lodash'; import { Switch, Route } from 'react-router-dom'; +import pluginId from 'pluginId'; import getQueryParameters from 'utils/getQueryParameters'; @@ -93,8 +94,8 @@ const mapStateToProps = createStructuredSelector({ }); const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId: 'content-manager' }); -const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId: 'content-manager' }); +const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js index 91c9ac3ad5..7aa9e5e65c 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/App/selectors.js @@ -1,9 +1,9 @@ import { createSelector } from 'reselect'; - +import pluginId from 'pluginId'; /** * Direct selector to the list state domain */ -const selectGlobalDomain = () => state => state.get('content-manager-global'); +const selectGlobalDomain = () => state => state.get(`${pluginId}-global`); /** * Other specific selectors diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js index 2a6b8f064d..73633a91d0 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js @@ -23,6 +23,7 @@ import { import HTML5Backend from 'react-dnd-html5-backend'; import { DragDropContext } from 'react-dnd'; import cn from 'classnames'; +import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src @@ -600,8 +601,8 @@ const withConnect = connect( mapDispatchToProps, ); -const withReducer = strapi.injectReducer({ key: 'editPage', reducer, pluginId: 'content-manager' }); -const withSaga = strapi.injectSaga({ key: 'editPage', saga, pluginId: 'content-manager' }); +const withReducer = strapi.injectReducer({ key: 'editPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'editPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js index d4fbe66c14..466267ddaa 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/selectors.js @@ -5,11 +5,12 @@ */ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the listPage state domain */ -const selectEditPageDomain = () => state => state.get('content-manager-editPage'); +const selectEditPageDomain = () => state => state.get(`${pluginId}-editPage`); /** diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/Home/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/Home/index.js deleted file mode 100644 index bd2e801d0c..0000000000 --- a/packages/strapi-plugin-content-manager/admin/src/containers/Home/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Home - */ - -import React from 'react'; -import { connect } from 'react-redux'; -import { createStructuredSelector } from 'reselect'; -import { FormattedMessage } from 'react-intl'; - -import PluginHeader from 'components/PluginHeader'; - -import styles from './styles.scss'; - -export class Home extends React.Component { - render() { - return ( -
-
- -

- -

-
-
- ); - } -} - -Home.propTypes = {}; - -export function mapDispatchToProps() { - return {}; -} - -const mapStateToProps = createStructuredSelector({}); - -// Wrap the component to inject dispatch and state into it -export default connect(mapStateToProps, mapDispatchToProps)(Home); diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/Home/messages.json b/packages/strapi-plugin-content-manager/admin/src/containers/Home/messages.json deleted file mode 100644 index 409935166b..0000000000 --- a/packages/strapi-plugin-content-manager/admin/src/containers/Home/messages.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "pluginHeaderDescription": { - "id": "contentManager.containers.Home.pluginHeaderDescription", - "defaultMessage": "A powerful UI to easily manage your data." - }, - "introduction": { - "id": "contentManager.containers.Home.introduction", - "defaultMessage": "To edit your content's entries go to the specific link in the left menu." - } -} \ No newline at end of file diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/Home/styles.scss b/packages/strapi-plugin-content-manager/admin/src/containers/Home/styles.scss deleted file mode 100644 index 689cab1129..0000000000 --- a/packages/strapi-plugin-content-manager/admin/src/containers/Home/styles.scss +++ /dev/null @@ -1,17 +0,0 @@ -/** - * styles.scss - * - * Home container styles - */ - - .containerFluid { /* stylelint-disable */ - padding: 18px 30px; - - p { - display: block; - margin: 0; - padding-bottom: 14px; - line-height: 18px; - text-align: left; - } -} diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js index 2c0a84cf95..8fe49fe212 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/index.js @@ -13,6 +13,7 @@ import { capitalize, findIndex, get, isUndefined, toInteger, upperFirst } from ' import { ButtonDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import { FormattedMessage } from 'react-intl'; import cn from 'classnames'; +import pluginId from 'pluginId'; // App selectors import { makeSelectSchema } from 'containers/App/selectors'; // You can find these components in either @@ -679,7 +680,7 @@ const mapStateToProps = createStructuredSelector({ const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'listPage', reducer, pluginId: 'content-manager' }); -const withSaga = strapi.injectSaga({ key: 'listPage', saga, pluginId: 'content-manager' }); +const withReducer = strapi.injectReducer({ key: 'listPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'listPage', saga, pluginId }); export default compose(withReducer, withSaga, withConnect)(ListPage); diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js index 4e559787f6..9e931fe729 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/ListPage/selectors.js @@ -5,11 +5,12 @@ */ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the listPage state domain */ -const selectListPageDomain = () => state => state.get('content-manager-listPage'); +const selectListPageDomain = () => state => state.get(`${pluginId}-listPage`); /** diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js index bf5fa2153a..e365027b7b 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/index.js @@ -14,6 +14,7 @@ import { DragDropContext } from 'react-dnd'; import { FormattedMessage } from 'react-intl'; import { ButtonDropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import PropTypes from 'prop-types'; +import pluginId from 'pluginId'; import { beginMove, endMove, @@ -1158,8 +1159,8 @@ const withConnect = connect( mapStateToProps, mapDispatchToProps, ); -const withReducer = strapi.injectReducer({ key: 'settingPage', reducer, pluginId: 'content-manager' }); -const withSaga = strapi.injectSaga({ key: 'settingPage', saga, pluginId: 'content-manager' }); +const withReducer = strapi.injectReducer({ key: 'settingPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'settingPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js index ad5b324206..06c06151ed 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingPage/selectors.js @@ -4,11 +4,12 @@ */ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the settingPage state domain */ -const selectSettingPageDomain = () => state => state.get('content-manager-settingPage'); +const selectSettingPageDomain = () => state => state.get(`${pluginId}-settingPage`); /** diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js index 523aa8e1c6..072d29e63b 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/index.js @@ -10,6 +10,7 @@ import { createStructuredSelector } from 'reselect'; import cn from 'classnames'; import { get, sortBy } from 'lodash'; import PropTypes from 'prop-types'; +import pluginId from 'pluginId'; import { onChange, onSubmit, onReset } from 'containers/App/actions'; import { makeSelectModifiedSchema, makeSelectSubmitSuccess } from 'containers/App/selectors'; import Input from 'components/InputsIndex'; @@ -209,8 +210,8 @@ const mapStateToProps = createStructuredSelector({ submitSuccess: makeSelectSubmitSuccess(), }); const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'settingsPage', reducer, pluginId: 'content-manager' }); -const withSaga = strapi.injectSaga({ key: 'settingsPage', saga, pluginId: 'content-manager' }); +const withReducer = strapi.injectReducer({ key: 'settingsPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'settingsPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js index 8d8a536b60..c75ad3a000 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/SettingsPage/selectors.js @@ -4,11 +4,12 @@ */ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the settingsPage state domain */ -const selectSettingsPageDomain = () => state => state.get('content-manager-settingsPage'); +const selectSettingsPageDomain = () => state => state.get(`${pluginId}-settingsPage`); /** diff --git a/packages/strapi-plugin-content-manager/admin/src/pluginId.js b/packages/strapi-plugin-content-manager/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-content-manager/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js index 84ea93dad3..e1b45b1234 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/index.js @@ -12,7 +12,7 @@ import { bindActionCreators, compose } from 'redux'; import { createStructuredSelector } from 'reselect'; import { Switch, Route, withRouter } from 'react-router-dom'; import PropTypes from 'prop-types'; -import { pluginId } from 'app'; +import pluginId from 'pluginId'; import HomePage from 'containers/HomePage'; import ModelPage from 'containers/ModelPage'; @@ -93,10 +93,10 @@ const mapStateToProps = createStructuredSelector({ }); const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId: 'content-type-builder' }); -const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId: 'content-type-builder' }); -const withFormReducer = strapi.injectReducer({ key: 'form', reducer: formReducer, pluginId: 'content-type-builder' }); -const withFormSaga = strapi.injectSaga({ key: 'form', saga: formSaga, pluginId: 'content-type-builder' }); +const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId }); +const withFormReducer = strapi.injectReducer({ key: 'form', reducer: formReducer, pluginId }); +const withFormSaga = strapi.injectSaga({ key: 'form', saga: formSaga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js index a0dfa9546d..c8c490ca42 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/selectors.js @@ -1,10 +1,11 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the list state domain */ -const selectGlobalDomain = () => state => state.get('content-type-builder-global'); +const selectGlobalDomain = () => state => state.get(`${pluginId}-global`); const makeSelectLoading = () => createSelector( selectGlobalDomain(), diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js index 12836375c4..5efdf6f836 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the form state domain */ -const selectFormDomain = () => state => state.get('content-type-builder-form'); +const selectFormDomain = () => state => state.get(`${pluginId}-form`); /** * Other specific selectors diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js index 101839fc70..021524f6b3 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/index.js @@ -12,6 +12,7 @@ import { size } from 'lodash'; import Helmet from 'react-helmet'; import PropTypes from 'prop-types'; import { router } from 'app'; +import pluginId from 'pluginId'; import { makeSelectLoading, makeSelectMenu, makeSelectModels } from 'containers/App/selectors'; import { deleteContentType } from 'containers/App/actions'; @@ -139,8 +140,8 @@ function mapDispatchToProps(dispatch) { } const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'content-type-builder' }); -const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'content-type-builder' }); +const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js index 4f6f7e2790..8a7012b567 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/HomePage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the homePage state domain */ -const selectHomePageDomain = () => state => state.get('content-type-builder-homePage'); +const selectHomePageDomain = () => state => state.get(`${pluginId}-homePage`); /** * Other specific selectors diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js index 9027aab785..f2beeff899 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js @@ -13,6 +13,7 @@ import { FormattedMessage } from 'react-intl'; import { NavLink } from 'react-router-dom'; import PropTypes from 'prop-types'; import { router } from 'app'; +import pluginId from 'pluginId'; // Global selectors import { makeSelectMenu } from 'containers/App/selectors'; import { makeSelectContentTypeUpdated } from 'containers/Form/selectors'; @@ -353,8 +354,8 @@ function mapDispatchToProps(dispatch) { } const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withSaga = strapi.injectSaga({ key: 'modelPage', saga, pluginId: 'content-type-builder' }); -const withReducer = strapi.injectReducer({ key: 'modelPage', reducer, pluginId: 'content-type-builder' }); +const withSaga = strapi.injectSaga({ key: 'modelPage', saga, pluginId }); +const withReducer = strapi.injectReducer({ key: 'modelPage', reducer, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js index bc7d32f29a..4c0ff68b3e 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the modelPage state domain */ -const selectModelPageDomain = () => state => state.get('content-type-builder-modelPage'); +const selectModelPageDomain = () => state => state.get(`${pluginId}-modelPage`); /** * Other specific selectors diff --git a/packages/strapi-plugin-content-type-builder/admin/src/pluginId.js b/packages/strapi-plugin-content-type-builder/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-content-type-builder/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId; diff --git a/packages/strapi-plugin-documentation/admin/src/containers/App/index.js b/packages/strapi-plugin-documentation/admin/src/containers/App/index.js index 973fca71a8..67b7a6dbf3 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/App/index.js @@ -8,7 +8,7 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; // Utils -import { pluginId } from 'app'; +import pluginId from 'pluginId'; // Containers import HomePage from 'containers/HomePage'; import NotFoundPage from 'containers/NotFoundPage'; diff --git a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js index d385118c39..9124be0809 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js @@ -12,6 +12,7 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; import { bindActionCreators, compose } from 'redux'; import { get, isEmpty } from 'lodash'; import cn from 'classnames'; +import pluginId from 'pluginId'; // Components import PluginHeader from 'components/PluginHeader'; import PopUpWarning from 'components/PopUpWarning'; @@ -19,7 +20,6 @@ import Block from 'components/Block'; import Row from 'components/Row'; import LoadingIndicatorPage from 'components/LoadingIndicatorPage'; import Input from 'components/InputsIndex'; -import { pluginId } from 'app'; // Utils import auth from 'utils/auth'; import openWithNewTab from 'utils/openWithNewTab'; @@ -243,8 +243,8 @@ const withConnect = connect( mapStateToProps, mapDispatchToProps, ); -const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'documentation' }); -const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'documentation' }); +const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js index 02ad67dfe1..2fc23027a0 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the homePage state domain */ -const selectHomePageDomain = () => state => state.get('documentation-homePage'); +const selectHomePageDomain = () => state => state.get(`${pluginId}-homePage`); /** * Default selector used by HomePage diff --git a/packages/strapi-plugin-documentation/admin/src/pluginId.js b/packages/strapi-plugin-documentation/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-documentation/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId; diff --git a/packages/strapi-plugin-email/admin/src/containers/App/index.js b/packages/strapi-plugin-email/admin/src/containers/App/index.js index 2c1fcd23b4..21fdf79df9 100644 --- a/packages/strapi-plugin-email/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-email/admin/src/containers/App/index.js @@ -7,9 +7,7 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; - -// Utils -import { pluginId } from 'app'; +import pluginId from 'pluginId'; // Containers import ConfigPage from 'containers/ConfigPage'; diff --git a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js index 0a56ea8346..5e212fada7 100644 --- a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js +++ b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/index.js @@ -9,6 +9,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { findIndex, get, isEmpty } from 'lodash'; +import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src @@ -174,8 +175,8 @@ const mapStateToProps = selectConfigPage(); const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'configPage', reducer, pluginId: 'email' }); -const withSaga = strapi.injectSaga({ key: 'configPage', saga, pluginId: 'email' }); +const withReducer = strapi.injectReducer({ key: 'configPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'configPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js index b9b8c95fdd..4d704602a0 100644 --- a/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js +++ b/packages/strapi-plugin-email/admin/src/containers/ConfigPage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the configPage state domain */ -const selectConfigPageDomain = () => state => state.get('email-configPage'); +const selectConfigPageDomain = () => state => state.get(`${pluginId}-configPage`); /** * Default selector used by ConfigPage diff --git a/packages/strapi-plugin-email/admin/src/pluginId.js b/packages/strapi-plugin-email/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-email/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId; diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js index 4c1ffcc8b8..c91b323b4e 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/index.js @@ -14,7 +14,7 @@ import 'flag-icon-css/css/flag-icon.css'; import 'react-select/dist/react-select.css'; import { Switch, Route } from 'react-router-dom'; import { isEmpty } from 'lodash'; -import { pluginId } from 'app'; +import pluginId from 'pluginId'; import HomePage from 'containers/HomePage'; @@ -94,8 +94,8 @@ const mapStateToProps = createStructuredSelector({ // Wrap the component to inject dispatch and state into it const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId: 'settings-manager' }); -const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId: 'settings-manager' }); +const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js b/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js index 2b6eb617cd..1fdd8623c6 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/App/selectors.js @@ -1,10 +1,11 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the list state domain */ -const selectGlobalDomain = () => state => state.get('settings-manager-global'); +const selectGlobalDomain = () => state => state.get(`${pluginId}-global`); const selectLocationState = () => { let prevRoutingState; diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js index ba6ddac98c..7e43f3c666 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/index.js @@ -9,6 +9,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { createStructuredSelector } from 'reselect'; +import pluginId from 'pluginId'; import { endsWith, @@ -562,8 +563,8 @@ HomePage.propTypes = { const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'settings-manager' }); -const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'settings-manager' }); +const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js index f4382b96d9..44a84af2b3 100644 --- a/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-settings-manager/admin/src/containers/HomePage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the home state domain */ -const selectHomePageDomain = () => state => state.get('settings-manager-homePage'); +const selectHomePageDomain = () => state => state.get(`${pluginId}-homePage`); /** * Other specific selectors diff --git a/packages/strapi-plugin-settings-manager/admin/src/pluginId.js b/packages/strapi-plugin-settings-manager/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-settings-manager/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId; diff --git a/packages/strapi-plugin-upload/admin/src/containers/App/index.js b/packages/strapi-plugin-upload/admin/src/containers/App/index.js index 0c90f21f39..38a5a6d9a0 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/App/index.js @@ -8,8 +8,7 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; -// Utils -import { pluginId } from 'app'; +import pluginId from 'pluginId'; // Containers import ConfigPage from 'containers/ConfigPage'; diff --git a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js index cb9b2348cf..1ea14f043c 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/index.js @@ -9,6 +9,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators, compose } from 'redux'; import { findIndex, get, isEmpty } from 'lodash'; +import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src @@ -174,8 +175,8 @@ const mapStateToProps = selectConfigPage(); const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'configPage', reducer, pluginId: 'upload' }); -const withSaga = strapi.injectSaga({ key: 'configPage', saga, pluginId: 'upload' }); +const withReducer = strapi.injectReducer({ key: 'configPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'configPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js index a20e92a94c..4d704602a0 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js +++ b/packages/strapi-plugin-upload/admin/src/containers/ConfigPage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the configPage state domain */ -const selectConfigPageDomain = () => state => state.get('upload-configPage'); +const selectConfigPageDomain = () => state => state.get(`${pluginId}-configPage`); /** * Default selector used by ConfigPage diff --git a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js index c6a488d535..a2eec0a223 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js @@ -11,6 +11,7 @@ import { connect } from 'react-redux'; import { injectIntl } from 'react-intl'; import { bindActionCreators, compose } from 'redux'; import { isEmpty } from 'lodash'; +import pluginId from 'pluginId'; // You can find these components in either // ./node_modules/strapi-helper-plugin/lib/src @@ -219,8 +220,8 @@ const mapStateToProps = selectHomePage(); const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'upload' }); -const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'upload' }); +const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js index 3719659206..17aadfc599 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the homePage state domain */ -const selectHomePageDomain = () => state => state.get('upload-homePage'); +const selectHomePageDomain = () => state => state.get(`${pluginId}-homePage`); /** * Default selector used by HomePage diff --git a/packages/strapi-plugin-upload/admin/src/pluginId.js b/packages/strapi-plugin-upload/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId; diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js index 6b44dea864..c60f43ab6b 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/App/index.js @@ -7,12 +7,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -// import { connect } from 'react-redux'; import { Switch, Route } from 'react-router-dom'; -// import { bindActionCreators, compose } from 'redux'; - -// Utils -import { pluginId } from 'app'; +import pluginId from 'pluginId'; // Containers import AuthPage from 'containers/AuthPage'; @@ -58,17 +54,4 @@ App.propTypes = { location: PropTypes.object.isRequired, }; -// export function mapDispatchToProps(dispatch) { -// return bindActionCreators( -// {}, -// dispatch, -// ); -// } - -// Wrap the component to inject dispatch and state into it -// const withConnect = connect(null, mapDispatchToProps); export default App; - -// export default compose( -// withConnect, -// )(App); diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js index d67fee74c7..b88aea1ddf 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/index.js @@ -12,6 +12,7 @@ import { Link } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import { findIndex, get, isBoolean, isEmpty, map, replace } from 'lodash'; import cn from 'classnames'; +import pluginId from 'pluginId'; // Logo import LogoStrapi from 'assets/images/logo_strapi.png'; @@ -326,8 +327,8 @@ function mapDispatchToProps(dispatch) { } const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'authPage', reducer, pluginId: 'users-permissions' }); -const withSaga = strapi.injectSaga({ key: 'authPage', saga, pluginId: 'users-permissions' }); +const withReducer = strapi.injectReducer({ key: 'authPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'authPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js index 6f9e7af843..5ca8db1704 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the authPage state domain */ -const selectAuthPageDomain = () => (state) => state.get('users-permissions-authPage'); +const selectAuthPageDomain = () => (state) => state.get(`${pluginId}-authPage`); /** * Default selector used by AuthPage diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js index 27ff04c536..44a257a764 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/index.js @@ -12,6 +12,7 @@ import { bindActionCreators, compose } from 'redux'; import { FormattedMessage } from 'react-intl'; import { findIndex, get, isEmpty, isEqual, size } from 'lodash'; import cn from 'classnames'; +import pluginId from 'pluginId'; // Design import BackHeader from 'components/BackHeader'; @@ -323,8 +324,8 @@ function mapDispatchToProps(dispatch) { } const withConnect = connect(mapStateToProps, mapDispatchToProps); -const withReducer = strapi.injectReducer({ key: 'editPage', reducer, pluginId: 'users-permissions'}); -const withSaga = strapi.injectSaga({ key: 'editPage', saga, pluginId: 'users-permissions' }); +const withReducer = strapi.injectReducer({ key: 'editPage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'editPage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js index 159023fb5e..311c2aa619 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/EditPage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the editPage state domain */ -const selectEditPageDomain = () => (state) => state.get('users-permissions-editPage'); +const selectEditPageDomain = () => (state) => state.get(`${pluginId}-editPage`); /** * Default selector used by EditPage diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js index 08df1f03b2..37097316d8 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/index.js @@ -11,6 +11,7 @@ import { injectIntl } from 'react-intl'; import { bindActionCreators, compose } from 'redux'; import cn from 'classnames'; import { clone, get, includes, isEqual, isEmpty } from 'lodash'; +import pluginId from 'pluginId'; // Design import EditForm from 'components/EditForm'; @@ -275,9 +276,8 @@ function mapDispatchToProps(dispatch) { const mapStateToProps = selectHomePage(); const withConnect = connect(mapStateToProps, mapDispatchToProps); - -const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'users-permissions' }); -const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'users-permissions' }); +const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId }); +const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId }); export default compose( withReducer, diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js index 4c9fc780e0..0433622926 100644 --- a/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js +++ b/packages/strapi-plugin-users-permissions/admin/src/containers/HomePage/selectors.js @@ -1,9 +1,10 @@ import { createSelector } from 'reselect'; +import pluginId from 'pluginId'; /** * Direct selector to the homePage state domain */ -const selectHomePageDomain = () => state => state.get('users-permissions-homePage'); +const selectHomePageDomain = () => state => state.get(`${pluginId}-homePage`); /** * Default selector used by HomePage diff --git a/packages/strapi-plugin-users-permissions/admin/src/pluginId.js b/packages/strapi-plugin-users-permissions/admin/src/pluginId.js new file mode 100644 index 0000000000..1b059ddba7 --- /dev/null +++ b/packages/strapi-plugin-users-permissions/admin/src/pluginId.js @@ -0,0 +1,7 @@ +const pluginPkg = require('../../package.json'); +const pluginId = pluginPkg.name.replace( + /^strapi-plugin-/i, + '' +); + +module.exports = pluginId;