@zengenti/contensis-react-base 2.4.1-beta.6 → 2.5.0
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.
- package/CHANGELOG.md +61 -0
- package/README.md +77 -0
- package/cjs/{App-2334f3e0.js → App-79703372.js} +213 -8
- package/cjs/App-79703372.js.map +1 -0
- package/cjs/{RouteLoader-5c44f039.js → RouteLoader-f67bbf9e.js} +8 -39
- package/cjs/RouteLoader-f67bbf9e.js.map +1 -0
- package/cjs/{ToJs-ca9bea03.js → ToJs-d72e5b10.js} +58 -2
- package/cjs/ToJs-d72e5b10.js.map +1 -0
- package/cjs/{actions-e22726ed.js → actions-e9f69947.js} +1 -1
- package/cjs/actions-e9f69947.js.map +1 -0
- package/cjs/client.js +13 -15
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +38 -38
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +1 -2
- package/cjs/forms.js.map +1 -1
- package/cjs/{login-6eb5e46d.js → login-4f274c6a.js} +8 -5
- package/cjs/login-4f274c6a.js.map +1 -0
- package/cjs/reducers-cb531715.js +207 -0
- package/cjs/reducers-cb531715.js.map +1 -0
- package/cjs/redux.js +4 -4
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +4 -5
- package/cjs/routing.js.map +1 -1
- package/cjs/search.js +6 -4
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-69c3d37c.js → selectors-1295124a.js} +9 -1
- package/cjs/selectors-1295124a.js.map +1 -0
- package/cjs/user.js +82 -27
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +21 -91
- package/cjs/util.js.map +1 -1
- package/cjs/{version-d8f5b436.js → version-3a808c12.js} +4 -4
- package/cjs/version-3a808c12.js.map +1 -0
- package/esm/{App-b2b80182.js → App-452c2ab3.js} +213 -8
- package/esm/App-452c2ab3.js.map +1 -0
- package/esm/{RouteLoader-2cfdfc5c.js → RouteLoader-dedcc835.js} +8 -38
- package/esm/RouteLoader-dedcc835.js.map +1 -0
- package/esm/{ToJs-19a3244a.js → ToJs-6e7b247c.js} +47 -3
- package/esm/ToJs-6e7b247c.js.map +1 -0
- package/esm/{actions-fda5e103.js → actions-ddd9c623.js} +1 -1
- package/esm/actions-ddd9c623.js.map +1 -0
- package/esm/client.js +15 -16
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +37 -37
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +1 -2
- package/esm/forms.js.map +1 -1
- package/esm/{login-866fe64c.js → login-1f9ad133.js} +8 -6
- package/esm/login-1f9ad133.js.map +1 -0
- package/esm/reducers-feab84fc.js +183 -0
- package/esm/reducers-feab84fc.js.map +1 -0
- package/esm/redux.js +5 -5
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +4 -5
- package/esm/routing.js.map +1 -1
- package/esm/search.js +6 -4
- package/esm/search.js.map +1 -1
- package/esm/{selectors-170581d2.js → selectors-68799788.js} +9 -1
- package/esm/selectors-68799788.js.map +1 -0
- package/esm/user.js +80 -29
- package/esm/user.js.map +1 -1
- package/esm/util.js +20 -90
- package/esm/util.js.map +1 -1
- package/esm/{version-8d757fb4.js → version-64906b26.js} +5 -4
- package/esm/version-64906b26.js.map +1 -0
- package/models/app/App.d.ts +4 -0
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +40 -0
- package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +1 -0
- package/models/app/pages/VersionInfo/index.d.ts +2 -0
- package/models/app/pages/VersionInfo/transformations/state-to-versioninfoprops.mapper.d.ts +3 -0
- package/models/client/client.d.ts +11 -0
- package/models/client/index.d.ts +3 -0
- package/models/config.d.ts +33 -0
- package/models/forms/index.d.ts +1 -0
- package/models/index.d.ts +5 -0
- package/models/redux/actions/index.d.ts +9 -0
- package/models/redux/actions/navigation.d.ts +1 -0
- package/models/redux/actions/version.d.ts +2 -0
- package/models/redux/index.d.ts +17 -0
- package/models/redux/reducers/navigation.d.ts +3 -0
- package/models/redux/reducers/version.d.ts +3 -0
- package/models/redux/sagas/index.d.ts +1 -0
- package/models/redux/sagas/navigation.d.ts +4 -0
- package/models/redux/selectors/index.d.ts +9 -0
- package/models/redux/selectors/navigation.d.ts +3 -0
- package/models/redux/selectors/version.d.ts +3 -0
- package/models/redux/store/history.d.ts +2 -0
- package/models/redux/store/injectors.d.ts +19 -0
- package/models/redux/store/routerMiddleware.d.ts +7 -0
- package/models/redux/store/store.d.ts +3 -0
- package/models/redux/types/index.d.ts +9 -0
- package/models/redux/types/navigation.d.ts +3 -0
- package/models/redux/types/version.d.ts +2 -0
- package/models/redux/util.d.ts +1 -0
- package/models/routing/components/Loading.d.ts +5 -0
- package/models/routing/components/NotFound.d.ts +6 -0
- package/models/routing/components/RouteLoader.d.ts +3 -0
- package/models/routing/components/Status.d.ts +4 -0
- package/models/routing/index.d.ts +4 -0
- package/models/routing/redux/actions.d.ts +6 -0
- package/models/routing/redux/reducers.d.ts +4 -0
- package/models/routing/redux/sagas.d.ts +1 -0
- package/models/routing/redux/selectors.d.ts +25 -0
- package/models/routing/redux/types.d.ts +12 -0
- package/models/routing/routes.d.ts +99 -0
- package/models/routing/util/expressions.d.ts +2 -0
- package/models/routing/util/find-contenttype-mapping.d.ts +2 -0
- package/models/routing/util/queries.d.ts +2 -0
- package/models/search/containers/withListing.d.ts +4 -0
- package/models/search/containers/withSearch.d.ts +4 -0
- package/models/search/hooks/useMinilist.hook.d.ts +23 -0
- package/models/search/index.d.ts +16 -0
- package/models/search/models/Enums.d.ts +5 -0
- package/models/search/models/Queries.d.ts +43 -0
- package/models/search/models/Search.d.ts +180 -0
- package/models/search/models/SearchActions.d.ts +127 -0
- package/models/search/models/SearchProps.d.ts +45 -0
- package/models/search/models/SearchState.d.ts +83 -0
- package/models/search/models/SearchUtil.d.ts +6 -0
- package/models/search/models/index.d.ts +3 -0
- package/models/search/redux/actions.d.ts +39 -0
- package/models/search/redux/queries.d.ts +3 -0
- package/models/search/redux/reducers.d.ts +4 -0
- package/models/search/redux/sagas.d.ts +20 -0
- package/models/search/redux/schema.d.ts +9 -0
- package/models/search/redux/selectors.d.ts +112 -0
- package/models/search/redux/types.d.ts +20 -0
- package/models/search/redux/util.d.ts +25 -0
- package/models/search/search/ContensisDeliveryApi.d.ts +32 -0
- package/models/search/search/ToJs.d.ts +4 -0
- package/models/search/search/expressions.d.ts +29 -0
- package/models/search/search/performance.d.ts +1 -0
- package/models/search/search/schema.d.ts +28 -0
- package/models/search/search/util.d.ts +21 -0
- package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -0
- package/models/search/transformations/filters-to-filterexpression.d.ts +1 -0
- package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +2 -0
- package/models/search/transformations/searchresult-to-state.mapper.d.ts +6 -0
- package/models/search/transformations/state-to-queryparams.mapper.d.ts +12 -0
- package/models/search/transformations/state-to-searchuri.d.ts +14 -0
- package/models/server/features/caching/cacheDuration.schema.d.ts +7 -0
- package/models/server/features/caching/cacheHashing.d.ts +1 -0
- package/models/server/features/caching/setCachingHeaders.d.ts +6 -0
- package/models/server/features/response-handler/index.d.ts +12 -0
- package/models/server/features/response-handler/types.d.ts +5 -0
- package/models/server/features/reverse-proxy/index.d.ts +4 -0
- package/models/server/features/static-assets/index.d.ts +14 -0
- package/models/server/internalServer.d.ts +10 -0
- package/models/server/middleware/bundleManipulation.d.ts +6 -0
- package/models/server/middleware/resolveStartup.d.ts +13 -0
- package/models/server/util/displayStartupConfiguration.d.ts +2 -0
- package/models/server/util/staticPaths.d.ts +1 -0
- package/models/server/util/stringifyAttributes.d.ts +2 -0
- package/models/server/webApp.d.ts +9 -0
- package/models/testImmer/redux/reducer.d.ts +8 -0
- package/models/testImmer/redux/selectors.d.ts +3 -0
- package/models/user/components/Login.d.ts +2 -0
- package/models/user/components/LoginForm.d.ts +16 -0
- package/models/user/components/LogoutForm.d.ts +12 -0
- package/models/user/components.styled/Login.styled.d.ts +2 -0
- package/models/user/components.styled/LoginForm.styled.d.ts +2 -0
- package/models/user/containers/ChangePassword.container.d.ts +2 -0
- package/models/user/containers/ForgotPassword.container.d.ts +2 -0
- package/models/user/containers/Login.container.d.ts +2 -0
- package/models/user/containers/Registration.container.d.ts +2 -0
- package/models/user/hocs/withLogin.d.ts +2 -0
- package/models/user/hocs/withRegistration.d.ts +2 -0
- package/models/user/hooks/useChangePassword.d.ts +9 -0
- package/models/user/hooks/useForgotPassword.d.ts +14 -0
- package/models/user/hooks/useLogin.d.ts +12 -0
- package/models/user/hooks/useRegistration.d.ts +8 -0
- package/models/user/index.d.ts +16 -0
- package/models/user/redux/actions.d.ts +6 -0
- package/models/user/redux/reducers.d.ts +4 -0
- package/models/user/redux/sagas/index.d.ts +1 -0
- package/models/user/redux/sagas/login.d.ts +36 -0
- package/models/user/redux/sagas/register.d.ts +1 -0
- package/models/user/redux/sagas/resetPassword.d.ts +1 -0
- package/models/user/redux/selectors.d.ts +27 -0
- package/models/user/redux/types.d.ts +21 -0
- package/models/user/transformations/mapClientCredentials.d.ts +2 -0
- package/models/user/util/ContensisManagementApi.d.ts +9 -0
- package/models/user/util/CookieHelper.class.d.ts +5 -0
- package/models/user/util/LoginHelper.class.d.ts +52 -0
- package/models/user/util/OidcUserManager.d.ts +18 -0
- package/models/user/util/matchGroups.d.ts +3 -0
- package/models/user/util/userHelper.d.ts +12 -0
- package/models/util/ContensisDeliveryApi.d.ts +40 -0
- package/models/util/ToJs.d.ts +1 -0
- package/models/util/fromJSLeaveImmer.d.ts +2 -0
- package/models/util/fromJSOrdered.d.ts +2 -0
- package/models/util/index.d.ts +5 -0
- package/models/util/json-mapper.d.ts +81 -0
- package/models/util/navHelper.d.ts +7 -0
- package/models/util/navigation.d.ts +4 -0
- package/models/util/performance.d.ts +1 -0
- package/models/util/pickProject.d.ts +2 -0
- package/models/util/schema.d.ts +25 -0
- package/models/util/stringifyStrings.d.ts +2 -0
- package/models/util/urls.d.ts +9 -0
- package/package-lock.json +7920 -7722
- package/package.json +17 -11
- package/cjs/App-2334f3e0.js.map +0 -1
- package/cjs/RouteLoader-5c44f039.js.map +0 -1
- package/cjs/ToJs-ca9bea03.js.map +0 -1
- package/cjs/actions-e22726ed.js.map +0 -1
- package/cjs/login-6eb5e46d.js.map +0 -1
- package/cjs/reducers-c42035ab.js +0 -120
- package/cjs/reducers-c42035ab.js.map +0 -1
- package/cjs/selectors-69c3d37c.js.map +0 -1
- package/cjs/version-d8f5b436.js.map +0 -1
- package/esm/App-b2b80182.js.map +0 -1
- package/esm/RouteLoader-2cfdfc5c.js.map +0 -1
- package/esm/ToJs-19a3244a.js.map +0 -1
- package/esm/actions-fda5e103.js.map +0 -1
- package/esm/login-866fe64c.js.map +0 -1
- package/esm/reducers-b426d14a.js +0 -108
- package/esm/reducers-b426d14a.js.map +0 -1
- package/esm/selectors-170581d2.js.map +0 -1
- package/esm/version-8d757fb4.js.map +0 -1
|
@@ -4,16 +4,14 @@ var React = require('react');
|
|
|
4
4
|
var reactRouterDom = require('react-router-dom');
|
|
5
5
|
var reactRedux = require('react-redux');
|
|
6
6
|
var reactRouterConfig = require('react-router-config');
|
|
7
|
-
var actions = require('./actions-
|
|
8
|
-
var selectors = require('./selectors-
|
|
9
|
-
var ToJs = require('./ToJs-
|
|
7
|
+
var actions = require('./actions-e9f69947.js');
|
|
8
|
+
var selectors = require('./selectors-1295124a.js');
|
|
9
|
+
var ToJs = require('./ToJs-d72e5b10.js');
|
|
10
10
|
var reactHotLoader = require('react-hot-loader');
|
|
11
|
-
var PropTypes = require('prop-types');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
13
|
|
|
15
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
17
15
|
|
|
18
16
|
const NotFound = ({
|
|
19
17
|
statusCode,
|
|
@@ -27,11 +25,6 @@ const NotFound = ({
|
|
|
27
25
|
}
|
|
28
26
|
}, statusText)));
|
|
29
27
|
|
|
30
|
-
NotFound.propTypes = {
|
|
31
|
-
statusCode: PropTypes__default['default'].number,
|
|
32
|
-
statusText: PropTypes__default['default'].string
|
|
33
|
-
};
|
|
34
|
-
|
|
35
28
|
const Status = ({
|
|
36
29
|
code,
|
|
37
30
|
children
|
|
@@ -40,22 +33,18 @@ const Status = ({
|
|
|
40
33
|
render: ({
|
|
41
34
|
staticContext
|
|
42
35
|
}) => {
|
|
43
|
-
if (staticContext) staticContext.
|
|
36
|
+
if (staticContext) staticContext.statusCode = code;
|
|
44
37
|
return children;
|
|
45
38
|
}
|
|
46
39
|
});
|
|
47
40
|
};
|
|
48
|
-
Status.propTypes = {
|
|
49
|
-
code: PropTypes__default['default'].number.isRequired,
|
|
50
|
-
children: PropTypes__default['default'].element
|
|
51
|
-
};
|
|
52
41
|
|
|
53
42
|
const getTrimmedPath = path => {
|
|
54
43
|
if (path !== '/') {
|
|
55
44
|
const nextPath = path.replace(/\/\//, '/');
|
|
56
45
|
const lastChar = nextPath[nextPath.length - 1];
|
|
57
46
|
|
|
58
|
-
if (lastChar
|
|
47
|
+
if (lastChar === '/') {
|
|
59
48
|
return nextPath.substring(0, nextPath.length - 1);
|
|
60
49
|
}
|
|
61
50
|
}
|
|
@@ -94,7 +83,7 @@ const RouteLoader = ({
|
|
|
94
83
|
const routeRequiresLogin = staticRoute && staticRoute.route.requireLogin;
|
|
95
84
|
const setPath = React.useCallback(() => {
|
|
96
85
|
// Use serverPath to control the path we send to siteview node api to resolve a route
|
|
97
|
-
let serverPath =
|
|
86
|
+
let serverPath = '';
|
|
98
87
|
|
|
99
88
|
if (staticRoute && staticRoute.match && staticRoute.match.isExact) {
|
|
100
89
|
const {
|
|
@@ -149,7 +138,7 @@ const RouteLoader = ({
|
|
|
149
138
|
|
|
150
139
|
|
|
151
140
|
if (contentTypeId && !(!isLoggedIn && routeRequiresLogin)) {
|
|
152
|
-
const MatchedComponent = routes.ContentTypeMappings.find(item => item.contentTypeID
|
|
141
|
+
const MatchedComponent = routes.ContentTypeMappings.find(item => item.contentTypeID === contentTypeId); // debugger;
|
|
153
142
|
|
|
154
143
|
if (MatchedComponent && !(MatchedComponent.requireLogin && !isLoggedIn)) {
|
|
155
144
|
if (ToJs.matchUserGroup(userGroups, MatchedComponent.requireLogin)) return /*#__PURE__*/React__default['default'].createElement(MatchedComponent.component, {
|
|
@@ -176,26 +165,6 @@ const RouteLoader = ({
|
|
|
176
165
|
return null;
|
|
177
166
|
};
|
|
178
167
|
|
|
179
|
-
RouteLoader.propTypes = {
|
|
180
|
-
contentTypeId: PropTypes__default['default'].string,
|
|
181
|
-
entry: PropTypes__default['default'].object,
|
|
182
|
-
isError: PropTypes__default['default'].bool,
|
|
183
|
-
isLoading: PropTypes__default['default'].bool,
|
|
184
|
-
isLoggedIn: PropTypes__default['default'].bool,
|
|
185
|
-
isNotFound: PropTypes__default['default'].bool,
|
|
186
|
-
loadingComponent: PropTypes__default['default'].func,
|
|
187
|
-
mappedEntry: PropTypes__default['default'].object,
|
|
188
|
-
notFoundComponent: PropTypes__default['default'].func,
|
|
189
|
-
projectId: PropTypes__default['default'].string,
|
|
190
|
-
routes: PropTypes__default['default'].objectOf(PropTypes__default['default'].array, PropTypes__default['default'].array),
|
|
191
|
-
setNavigationPath: PropTypes__default['default'].func,
|
|
192
|
-
statePath: PropTypes__default['default'].string,
|
|
193
|
-
statusCode: PropTypes__default['default'].number,
|
|
194
|
-
statusText: PropTypes__default['default'].string,
|
|
195
|
-
userGroups: PropTypes__default['default'].array,
|
|
196
|
-
withEvents: PropTypes__default['default'].object
|
|
197
|
-
};
|
|
198
|
-
|
|
199
168
|
const mapStateToProps = state => {
|
|
200
169
|
return {
|
|
201
170
|
contentTypeId: selectors.selectRouteEntryContentTypeId(state),
|
|
@@ -219,4 +188,4 @@ const mapDispatchToProps = {
|
|
|
219
188
|
var RouteLoader$1 = reactHotLoader.hot(module)(reactRedux.connect(mapStateToProps, mapDispatchToProps)(ToJs.toJS(RouteLoader)));
|
|
220
189
|
|
|
221
190
|
exports.RouteLoader = RouteLoader$1;
|
|
222
|
-
//# sourceMappingURL=RouteLoader-
|
|
191
|
+
//# sourceMappingURL=RouteLoader-f67bbf9e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteLoader-f67bbf9e.js","sources":["../src/routing/components/NotFound.tsx","../src/routing/components/Status.tsx","../src/routing/components/RouteLoader.tsx"],"sourcesContent":["import React from 'react';\n\nconst NotFound = ({\n statusCode,\n statusText,\n}: {\n statusCode: number;\n statusText: string;\n}) => (\n <>\n <header>\n <h1>{statusCode || '404'} Page Not Found</h1>\n {statusText && (\n <h2\n style={{\n background: '#eee',\n color: '#666',\n fontSize: '100%',\n padding: '10px',\n }}\n >\n {statusText}\n </h2>\n )}\n </header>\n </>\n);\n\nexport default NotFound;\n","import React, { PropsWithChildren } from 'react';\nimport { Route } from 'react-router-dom';\n\nexport const Status = ({\n code,\n children,\n}: PropsWithChildren<{ code: number }>) => {\n return (\n <Route\n render={({ staticContext }) => {\n if (staticContext) staticContext.statusCode = code;\n return children;\n }}\n />\n );\n};\n","import React, { useEffect, useCallback } from 'react';\nimport { connect } from 'react-redux';\nimport { hot } from 'react-hot-loader';\nimport { Redirect, useLocation } from 'react-router-dom';\nimport { renderRoutes, matchRoutes } from 'react-router-config';\n\nimport NotFound from './NotFound';\nimport { Status } from './Status';\n\nimport {\n selectCurrentPath,\n selectCurrentProject,\n selectIsNotFound,\n selectMappedEntry,\n selectRouteEntry,\n selectRouteEntryContentTypeId,\n selectRouteErrorMessage,\n selectRouteIsError,\n selectRouteLoading,\n selectRouteStatusCode,\n} from '../redux/selectors';\nimport { setNavigationPath } from '../redux/actions';\n\nimport {\n selectUserGroups,\n selectUserIsAuthenticated,\n} from '~/user/redux/selectors';\nimport { matchUserGroup } from '~/user/util/matchGroups';\n\nimport { toJS } from '~/util/ToJs';\nimport { Entry } from 'contensis-delivery-api/lib/models';\nimport { AppRootProps, RouteLoaderProps } from '../routes';\n\nconst getTrimmedPath = path => {\n if (path !== '/') {\n const nextPath = path.replace(/\\/\\//, '/');\n const lastChar = nextPath[nextPath.length - 1];\n if (lastChar === '/') {\n return nextPath.substring(0, nextPath.length - 1);\n }\n }\n return path;\n};\n\ninterface IReduxProps {\n contentTypeId: string;\n entry: Entry;\n isError: boolean;\n isNotFound: boolean;\n isLoading: boolean;\n isLoggedIn: boolean;\n mappedEntry: any;\n projectId: string;\n setNavigationPath: typeof setNavigationPath;\n statePath: string;\n statusCode: any;\n statusText: string;\n userGroups: any;\n}\n\nconst RouteLoader = ({\n contentTypeId,\n entry,\n isError,\n isLoading,\n isLoggedIn,\n isNotFound,\n loadingComponent,\n mappedEntry,\n notFoundComponent,\n projectId,\n routes,\n setNavigationPath,\n statePath,\n statusCode,\n statusText,\n userGroups,\n withEvents,\n}: AppRootProps & RouteLoaderProps & IReduxProps) => {\n const location = useLocation();\n // Always ensure paths are trimmed of trailing slashes so urls are always unique\n const trimmedPath = getTrimmedPath(location.pathname);\n\n // Match any Static Routes a developer has defined\n const matchedStaticRoute = () =>\n matchRoutes(routes.StaticRoutes, location.pathname);\n const isStaticRoute = () => matchedStaticRoute().length > 0;\n\n const staticRoute = isStaticRoute() && matchedStaticRoute()[0];\n const routeRequiresLogin = staticRoute && staticRoute.route.requireLogin;\n\n const setPath = useCallback(() => {\n // Use serverPath to control the path we send to siteview node api to resolve a route\n let serverPath = '';\n if (staticRoute && staticRoute.match && staticRoute.match.isExact) {\n const { match, route } = staticRoute;\n\n if (route.path.includes('*')) {\n // Send the whole url to api if we have matched route containing wildcard\n serverPath = match.url;\n } else if (typeof route.fetchNodeLevel === 'number') {\n // Send all url parts to a specified level to api\n serverPath = match.url\n .split('/')\n .splice(0, route.fetchNodeLevel + 1)\n .join('/');\n } else {\n // Send all non-parameterised url parts to api\n serverPath = route.path\n .split('/')\n .filter(p => !p.startsWith(':'))\n .join('/');\n }\n }\n\n setNavigationPath(\n serverPath || trimmedPath,\n location,\n staticRoute,\n withEvents,\n statePath,\n routes\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n setNavigationPath,\n // staticRoute,\n withEvents,\n location,\n routes,\n // statePath,\n trimmedPath,\n ]);\n\n if (typeof window == 'undefined') setPath();\n\n useEffect(() => {\n setPath();\n }, [location, setPath]);\n\n // Need to redirect when url endswith a /\n if (location.pathname.length > trimmedPath.length) {\n return <Redirect to={trimmedPath} />;\n }\n\n // Render any Static Routes a developer has defined\n if (isStaticRoute() && !(!isLoggedIn && routeRequiresLogin)) {\n if (matchUserGroup(userGroups, routeRequiresLogin))\n return renderRoutes(routes.StaticRoutes, {\n projectId,\n contentTypeId,\n entry,\n mappedEntry,\n isLoggedIn,\n });\n }\n\n // Render a supplied Loading component if the route\n // is not a static route and is in a loading state\n if (isLoading && !isNotFound && loadingComponent) {\n const LoadingComponent = loadingComponent;\n return <LoadingComponent />;\n }\n\n // Match any defined Content Type Mappings\n if (contentTypeId && !(!isLoggedIn && routeRequiresLogin)) {\n const MatchedComponent = routes.ContentTypeMappings.find(\n item => item.contentTypeID === contentTypeId\n );\n\n // debugger;\n if (MatchedComponent && !(MatchedComponent.requireLogin && !isLoggedIn)) {\n if (matchUserGroup(userGroups, MatchedComponent.requireLogin))\n return (\n <MatchedComponent.component\n projectId={projectId}\n contentTypeId={contentTypeId}\n entry={entry}\n mappedEntry={mappedEntry}\n isLoggedIn={isLoggedIn}\n />\n );\n }\n }\n\n const NotFoundComponent = notFoundComponent ? notFoundComponent : NotFound;\n if (isNotFound || isError) {\n return (\n <Status code={statusCode}>\n <NotFoundComponent statusCode={statusCode} statusText={statusText} />\n </Status>\n );\n }\n\n return null;\n};\n\nconst mapStateToProps = state => {\n return {\n contentTypeId: selectRouteEntryContentTypeId(state),\n entry: selectRouteEntry(state),\n isError: selectRouteIsError(state),\n isNotFound: selectIsNotFound(state),\n isLoading: selectRouteLoading(state),\n isLoggedIn: selectUserIsAuthenticated(state),\n mappedEntry: selectMappedEntry(state),\n projectId: selectCurrentProject(state),\n statePath: selectCurrentPath(state),\n statusCode: selectRouteStatusCode(state),\n statusText: selectRouteErrorMessage(state),\n userGroups: selectUserGroups(state),\n };\n};\n\nconst mapDispatchToProps = {\n setNavigationPath,\n};\n\nexport default hot(module)(\n connect(mapStateToProps, mapDispatchToProps)(toJS(RouteLoader))\n);\n"],"names":["NotFound","statusCode","statusText","React","background","color","fontSize","padding","Status","code","children","Route","staticContext","getTrimmedPath","path","nextPath","replace","lastChar","length","substring","RouteLoader","contentTypeId","entry","isError","isLoading","isLoggedIn","isNotFound","loadingComponent","mappedEntry","notFoundComponent","projectId","routes","setNavigationPath","statePath","userGroups","withEvents","location","useLocation","trimmedPath","pathname","matchedStaticRoute","matchRoutes","StaticRoutes","isStaticRoute","staticRoute","routeRequiresLogin","route","requireLogin","setPath","useCallback","serverPath","match","isExact","includes","url","fetchNodeLevel","split","splice","join","filter","p","startsWith","window","useEffect","Redirect","matchUserGroup","renderRoutes","LoadingComponent","MatchedComponent","ContentTypeMappings","find","item","contentTypeID","NotFoundComponent","mapStateToProps","state","selectRouteEntryContentTypeId","selectRouteEntry","selectRouteIsError","selectIsNotFound","selectRouteLoading","selectUserIsAuthenticated","selectMappedEntry","selectCurrentProject","selectCurrentPath","selectRouteStatusCode","selectRouteErrorMessage","selectUserGroups","mapDispatchToProps","hot","module","connect","toJS"],"mappings":";;;;;;;;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,CAAC;AAChBC,EAAAA,UADgB;AAEhBC,EAAAA;AAFgB,CAAD,kBAOfC,+FACEA,qEACEA,oDAAKF,UAAU,IAAI,KAAnB,oBADF,EAEGC,UAAU,iBACTC;AACE,EAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,MADP;AAELC,IAAAA,KAAK,EAAE,MAFF;AAGLC,IAAAA,QAAQ,EAAE,MAHL;AAILC,IAAAA,OAAO,EAAE;AAJJ;AADT,GAQGL,UARH,CAHJ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SAAS,EAAEmD,2BAAiB,CAACT,KAAD,CATvB;AAUL1E,IAAAA,UAAU,EAAEoF,+BAAqB,CAACV,KAAD,CAV5B;AAWLzE,IAAAA,UAAU,EAAEoF,iCAAuB,CAACX,KAAD,CAX9B;AAYLzC,IAAAA,UAAU,EAAEqD,qBAAgB,CAACZ,KAAD;AAZvB,GAAP;AAcD,CAfD;;AAiBA,MAAMa,kBAAkB,GAAG;AACzBxD,qBAAAA;AADyB,CAA3B;AAIA,oBAAeyD,kBAAG,CAACC,MAAD,CAAH,CACbC,kBAAO,CAACjB,eAAD,EAAkBc,kBAAlB,CAAP,CAA6CI,SAAI,CAACxE,WAAD,CAAjD,CADa,CAAf;;;;"}
|
|
@@ -16,9 +16,15 @@ const selectUserIsAuthenticated = state => {
|
|
|
16
16
|
const selectUserAuthenticationError = state => {
|
|
17
17
|
return state.getIn(['user', 'authenticationState', 'authenticationError']);
|
|
18
18
|
};
|
|
19
|
+
const selectUserAuthenticationErrorMessage = state => {
|
|
20
|
+
return state.getIn(['user', 'authenticationState', 'authenticationErrorMessage']);
|
|
21
|
+
};
|
|
19
22
|
const selectUserError = state => {
|
|
20
23
|
return state.getIn(['user', 'authenticationState', 'error']);
|
|
21
24
|
};
|
|
25
|
+
const selectUserErrorMessage = state => {
|
|
26
|
+
return state.getIn(['user', 'authenticationState', 'errorMessage']);
|
|
27
|
+
};
|
|
22
28
|
const selectClientCredentials = state => {
|
|
23
29
|
return state.getIn(['user', 'authenticationState', 'clientCredentials']);
|
|
24
30
|
};
|
|
@@ -47,13 +53,42 @@ const selectUserRegistration = state => state.getIn(['user', 'registration'], im
|
|
|
47
53
|
const selectUserRegistrationError = state => state.getIn(['user', 'registration', 'error'], false);
|
|
48
54
|
const selectUserRegistrationIsLoading = state => state.getIn(['user', 'registration', 'loading'], false);
|
|
49
55
|
const selectUserRegistrationIsSuccess = state => state.getIn(['user', 'registration', 'success'], false);
|
|
56
|
+
const selectPasswordResetRequestSending = state => {
|
|
57
|
+
return state.getIn(['user', 'passwordResetRequest', 'isSending']);
|
|
58
|
+
};
|
|
59
|
+
const selectPasswordResetRequestSent = state => {
|
|
60
|
+
return state.getIn(['user', 'passwordResetRequest', 'sent']);
|
|
61
|
+
};
|
|
62
|
+
const selectPasswordResetRequestError = state => {
|
|
63
|
+
return state.getIn(['user', 'passwordResetRequest', 'error']);
|
|
64
|
+
};
|
|
65
|
+
const selectResetPasswordSending = state => {
|
|
66
|
+
return state.getIn(['user', 'resetPassword', 'isSending']);
|
|
67
|
+
};
|
|
68
|
+
const selectResetPasswordSent = state => {
|
|
69
|
+
return state.getIn(['user', 'resetPassword', 'sent']);
|
|
70
|
+
};
|
|
71
|
+
const selectResetPasswordError = state => {
|
|
72
|
+
return state.getIn(['user', 'resetPassword', 'error']);
|
|
73
|
+
};
|
|
74
|
+
const selectChangePasswordSending = state => {
|
|
75
|
+
return state.getIn(['user', 'changePassword', 'isSending']);
|
|
76
|
+
};
|
|
77
|
+
const selectChangePasswordSent = state => {
|
|
78
|
+
return state.getIn(['user', 'changePassword', 'sent']);
|
|
79
|
+
};
|
|
80
|
+
const selectChangePasswordError = state => {
|
|
81
|
+
return state.getIn(['user', 'changePassword', 'error']);
|
|
82
|
+
};
|
|
50
83
|
|
|
51
84
|
var selectors = /*#__PURE__*/Object.freeze({
|
|
52
85
|
__proto__: null,
|
|
53
86
|
selectUserIsLoading: selectUserIsLoading,
|
|
54
87
|
selectUserIsAuthenticated: selectUserIsAuthenticated,
|
|
55
88
|
selectUserAuthenticationError: selectUserAuthenticationError,
|
|
89
|
+
selectUserAuthenticationErrorMessage: selectUserAuthenticationErrorMessage,
|
|
56
90
|
selectUserError: selectUserError,
|
|
91
|
+
selectUserErrorMessage: selectUserErrorMessage,
|
|
57
92
|
selectClientCredentials: selectClientCredentials,
|
|
58
93
|
selectUser: selectUser,
|
|
59
94
|
selectUserIsZengentiStaff: selectUserIsZengentiStaff,
|
|
@@ -65,7 +100,16 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
65
100
|
selectUserRegistration: selectUserRegistration,
|
|
66
101
|
selectUserRegistrationError: selectUserRegistrationError,
|
|
67
102
|
selectUserRegistrationIsLoading: selectUserRegistrationIsLoading,
|
|
68
|
-
selectUserRegistrationIsSuccess: selectUserRegistrationIsSuccess
|
|
103
|
+
selectUserRegistrationIsSuccess: selectUserRegistrationIsSuccess,
|
|
104
|
+
selectPasswordResetRequestSending: selectPasswordResetRequestSending,
|
|
105
|
+
selectPasswordResetRequestSent: selectPasswordResetRequestSent,
|
|
106
|
+
selectPasswordResetRequestError: selectPasswordResetRequestError,
|
|
107
|
+
selectResetPasswordSending: selectResetPasswordSending,
|
|
108
|
+
selectResetPasswordSent: selectResetPasswordSent,
|
|
109
|
+
selectResetPasswordError: selectResetPasswordError,
|
|
110
|
+
selectChangePasswordSending: selectChangePasswordSending,
|
|
111
|
+
selectChangePasswordSent: selectChangePasswordSent,
|
|
112
|
+
selectChangePasswordError: selectChangePasswordError
|
|
69
113
|
});
|
|
70
114
|
|
|
71
115
|
const matchUserGroup = (userGroups = [], requiredGroups = []) => {
|
|
@@ -95,11 +139,23 @@ const toJS = WrappedComponent => wrappedComponentProps => {
|
|
|
95
139
|
};
|
|
96
140
|
|
|
97
141
|
exports.matchUserGroup = matchUserGroup;
|
|
142
|
+
exports.selectChangePasswordError = selectChangePasswordError;
|
|
143
|
+
exports.selectChangePasswordSending = selectChangePasswordSending;
|
|
144
|
+
exports.selectChangePasswordSent = selectChangePasswordSent;
|
|
98
145
|
exports.selectClientCredentials = selectClientCredentials;
|
|
146
|
+
exports.selectPasswordResetRequestError = selectPasswordResetRequestError;
|
|
147
|
+
exports.selectPasswordResetRequestSending = selectPasswordResetRequestSending;
|
|
148
|
+
exports.selectPasswordResetRequestSent = selectPasswordResetRequestSent;
|
|
149
|
+
exports.selectResetPasswordError = selectResetPasswordError;
|
|
150
|
+
exports.selectResetPasswordSending = selectResetPasswordSending;
|
|
151
|
+
exports.selectResetPasswordSent = selectResetPasswordSent;
|
|
99
152
|
exports.selectUser = selectUser;
|
|
100
153
|
exports.selectUserAuthenticationError = selectUserAuthenticationError;
|
|
154
|
+
exports.selectUserAuthenticationErrorMessage = selectUserAuthenticationErrorMessage;
|
|
101
155
|
exports.selectUserError = selectUserError;
|
|
156
|
+
exports.selectUserErrorMessage = selectUserErrorMessage;
|
|
102
157
|
exports.selectUserGroups = selectUserGroups;
|
|
158
|
+
exports.selectUserGuid = selectUserGuid;
|
|
103
159
|
exports.selectUserIsAuthenticated = selectUserIsAuthenticated;
|
|
104
160
|
exports.selectUserIsLoading = selectUserIsLoading;
|
|
105
161
|
exports.selectUserRegistration = selectUserRegistration;
|
|
@@ -108,4 +164,4 @@ exports.selectUserRegistrationIsLoading = selectUserRegistrationIsLoading;
|
|
|
108
164
|
exports.selectUserRegistrationIsSuccess = selectUserRegistrationIsSuccess;
|
|
109
165
|
exports.selectors = selectors;
|
|
110
166
|
exports.toJS = toJS;
|
|
111
|
-
//# sourceMappingURL=ToJs-
|
|
167
|
+
//# sourceMappingURL=ToJs-d72e5b10.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToJs-d72e5b10.js","sources":["../src/user/redux/selectors.js","../src/user/util/matchGroups.ts","../src/util/ToJs.js"],"sourcesContent":["import { Map } from 'immutable';\n\nexport const selectUserIsLoading = state => {\n return state.getIn(['user', 'authenticationState', 'loading']);\n};\nexport const selectUserIsAuthenticated = state => {\n return (\n state.getIn(['user', 'authenticationState', 'authenticated']) &&\n state.getIn(['user']) != null\n );\n};\nexport const selectUserAuthenticationError = state => {\n return state.getIn(['user', 'authenticationState', 'authenticationError']);\n};\nexport const selectUserAuthenticationErrorMessage = state => {\n return state.getIn([\n 'user',\n 'authenticationState',\n 'authenticationErrorMessage',\n ]);\n};\nexport const selectUserError = state => {\n return state.getIn(['user', 'authenticationState', 'error']);\n};\nexport const selectUserErrorMessage = state => {\n return state.getIn(['user', 'authenticationState', 'errorMessage']);\n};\nexport const selectClientCredentials = state => {\n return state.getIn(['user', 'authenticationState', 'clientCredentials']);\n};\nexport const selectUser = state => {\n return state.getIn(['user']);\n};\nexport const selectUserIsZengentiStaff = state => {\n return state.getIn(['user', 'isZengentiStaff']);\n};\nexport const selectUserGuid = state => {\n return state.getIn(['user', 'id']);\n};\nexport const selectUsername = state => {\n return state.getIn(['user', 'username']);\n};\nexport const selectUserEmail = state => {\n return state.getIn(['user', 'email']);\n};\nexport const selectUserGroups = state => {\n return state.getIn(['user', 'groups']);\n};\nexport const selectUserSecurityToken = state => {\n return state.getIn([\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n};\n\nexport const selectUserRegistration = state =>\n state.getIn(['user', 'registration'], Map());\n\nexport const selectUserRegistrationError = state =>\n state.getIn(['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = state =>\n state.getIn(['user', 'registration', 'loading'], false);\n\nexport const selectUserRegistrationIsSuccess = state =>\n state.getIn(['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = state => {\n return state.getIn(['user', 'passwordResetRequest', 'isSending']);\n};\nexport const selectPasswordResetRequestSent = state => {\n return state.getIn(['user', 'passwordResetRequest', 'sent']);\n};\nexport const selectPasswordResetRequestError = state => {\n return state.getIn(['user', 'passwordResetRequest', 'error']);\n};\nexport const selectResetPasswordSending = state => {\n return state.getIn(['user', 'resetPassword', 'isSending']);\n};\nexport const selectResetPasswordSent = state => {\n return state.getIn(['user', 'resetPassword', 'sent']);\n};\nexport const selectResetPasswordError = state => {\n return state.getIn(['user', 'resetPassword', 'error']);\n};\nexport const selectChangePasswordSending = state => {\n return state.getIn(['user', 'changePassword', 'isSending']);\n};\nexport const selectChangePasswordSent = state => {\n return state.getIn(['user', 'changePassword', 'sent']);\n};\nexport const selectChangePasswordError = state => {\n return state.getIn(['user', 'changePassword', 'error']);\n};\n","import { Group } from 'contensis-management-api/lib/models';\nimport { RequireLogin } from '~/routing/routes';\n\nexport const matchUserGroup = (\n userGroups: Group[] = [],\n requiredGroups: RequireLogin = []\n) => {\n if (\n !Array.isArray(requiredGroups) ||\n (Array.isArray(requiredGroups) && requiredGroups.length === 0)\n )\n return true;\n\n const groupMatch = requiredGroups.some(requiredGroup => {\n return userGroups.some(userGroup => {\n if (requiredGroup.id === userGroup.id) {\n return true;\n }\n if (requiredGroup.name === userGroup.name) {\n return true;\n }\n });\n });\n return groupMatch;\n};\n","import React from 'react';\nimport { Iterable } from 'immutable';\n\nexport const toJS = WrappedComponent => wrappedComponentProps => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce(\n (newProps, wrappedComponentProp) => {\n newProps[wrappedComponentProp[KEY]] = Iterable.isIterable(\n wrappedComponentProp[VALUE]\n )\n ? wrappedComponentProp[VALUE].toJS()\n : wrappedComponentProp[VALUE];\n return newProps;\n },\n {}\n );\n\n return <WrappedComponent {...propsJS} />;\n};\n"],"names":["selectUserIsLoading","state","getIn","selectUserIsAuthenticated","selectUserAuthenticationError","selectUserAuthenticationErrorMessage","selectUserError","selectUserErrorMessage","selectClientCredentials","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","Map","selectUserRegistrationError","selectUserRegistrationIsLoading","selectUserRegistrationIsSuccess","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","selectChangePasswordSending","selectChangePasswordSent","selectChangePasswordError","matchUserGroup","userGroups","requiredGroups","Array","isArray","length","groupMatch","some","requiredGroup","userGroup","id","name","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","Iterable","isIterable","React"],"mappings":";;;;;;;;;MAEaA,mBAAmB,GAAGC,KAAK,IAAI;AAC1C,SAAOA,KAAK,CAACC,KAAN,CAAY,CAAC,MAAD,EAAS,qBAAT,EAAgC,SAA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AAf,CAAoBC,aAAa,IAAI;AACtD,WAAOP,UAAU,CAACM,IAAX,CAAgBE,SAAS,IAAI;AAClC,UAAID,aAAa,CAACE,EAAd,KAAqBD,SAAS,CAACC,EAAnC,EAAuC;AACrC,eAAO,IAAP;AACD;;AACD,UAAIF,aAAa,CAACG,IAAd,KAAuBF,SAAS,CAACE,IAArC,EAA2C;AACzC,eAAO,IAAP;AACD;AACF,KAPM,CAAP;AAQD,GATkB,CAAnB;AAUA,SAAOL,UAAP;AACD;;MCrBYM,IAAI,GAAGC,gBAAgB,IAAIC,qBAAqB,IAAI;AAC/D,QAAMC,GAAG,GAAG,CAAZ;AACA,QAAMC,KAAK,GAAG,CAAd;AAEA,QAAMC,OAAO,GAAGC,MAAM,CAACC,OAAP,CAAeL,qBAAf,EAAsCM,MAAtC,CACd,CAACC,QAAD,EAAWC,oBAAX,KAAoC;AAClCD,IAAAA,QAAQ,CAACC,oBAAoB,CAACP,GAAD,CAArB,CAAR,GAAsCQ,kBAAQ,CAACC,UAAT,CACpCF,oBAAoB,CAACN,KAAD,CADgB,IAGlCM,oBAAoB,CAACN,KAAD,CAApB,CAA4BJ,IAA5B,EAHkC,GAIlCU,oBAAoB,CAACN,KAAD,CAJxB;AAKA,WAAOK,QAAP;AACD,GARa,EASd,EATc,CAAhB;AAYA,sBAAOI,wCAAC,gBAAD,EAAsBR,OAAtB,CAAP;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -87,4 +87,4 @@ exports.setCurrentProject = setCurrentProject;
|
|
|
87
87
|
exports.setNavigationPath = setNavigationPath;
|
|
88
88
|
exports.setRoute = setRoute;
|
|
89
89
|
exports.setSurrogateKeys = setSurrogateKeys;
|
|
90
|
-
//# sourceMappingURL=actions-
|
|
90
|
+
//# sourceMappingURL=actions-e9f69947.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions-e9f69947.js","sources":["../src/routing/redux/types.ts","../src/redux/util.ts","../src/routing/redux/actions.ts"],"sourcesContent":["const ROUTING_PREFIX = '@ROUTING/';\nexport const GET_ENTRY = `${ROUTING_PREFIX}_GET_ENTRY`;\nexport const SET_ENTRY = `${ROUTING_PREFIX}_SET_ENTRY`;\nexport const SET_NODE = `${ROUTING_PREFIX}_SET_NODE`;\nexport const SET_ANCESTORS = `${ROUTING_PREFIX}_SET_ANCESTORS`;\nexport const SET_SIBLINGS = `${ROUTING_PREFIX}_SET_SIBLINGS`;\nexport const SET_ENTRY_ID = `${ROUTING_PREFIX}_SET_ENTRY_ID`;\nexport const SET_SURROGATE_KEYS = `${ROUTING_PREFIX}_SET_SURROGATE_KEYS`;\n\nexport const SET_NAVIGATION_NOT_FOUND = `${ROUTING_PREFIX}_SET_NOT_FOUND`;\nexport const SET_NAVIGATION_PATH = `${ROUTING_PREFIX}_SET_NAVIGATION_PATH`;\n\nexport const SET_TARGET_PROJECT = `${ROUTING_PREFIX}_SET_TARGET_PROJECT`;\n\nexport const SET_ROUTE = `${ROUTING_PREFIX}_SET_ROUTE`;\n\nexport const UPDATE_LOADING_STATE = `${ROUTING_PREFIX}_UPDATE_LOADING_STATE`;\n","export const action = (type: string, payload: any = {}) => ({\n type,\n ...payload,\n});\n","import { action } from '~/redux/util';\nimport {\n SET_ENTRY,\n SET_NAVIGATION_NOT_FOUND,\n SET_NAVIGATION_PATH,\n SET_TARGET_PROJECT,\n SET_ROUTE,\n SET_SURROGATE_KEYS,\n} from './types';\n\nexport const setNotFound = notFound =>\n action(SET_NAVIGATION_NOT_FOUND, { notFound });\nexport const setNavigationPath = (\n path,\n location,\n staticRoute,\n withEvents,\n statePath,\n routes\n) =>\n action(SET_NAVIGATION_PATH, {\n path,\n location,\n staticRoute,\n withEvents,\n statePath,\n routes,\n });\nexport const setCurrentProject = (project, allowedGroups, hostname) =>\n action(SET_TARGET_PROJECT, { project, allowedGroups, hostname });\nexport const setRoute = (path, state) => action(SET_ROUTE, { path, state });\nexport const setRouteEntry = entry => action(SET_ENTRY, { entry });\nexport const setSurrogateKeys = keys => action(SET_SURROGATE_KEYS, { keys });\n"],"names":["ROUTING_PREFIX","GET_ENTRY","SET_ENTRY","SET_NODE","SET_ANCESTORS","SET_SIBLINGS","SET_ENTRY_ID","SET_SURROGATE_KEYS","SET_NAVIGATION_NOT_FOUND","SET_NAVIGATION_PATH","SET_TARGET_PROJECT","SET_ROUTE","UPDATE_LOADING_STATE","action","type","payload","setNotFound","notFound","setNavigationPath","path","location","staticRoute","withEvents","statePath","routes","setCurrentProject","project","allowedGroups","hostname","setRoute","state","setRouteEntry","entry","setSurrogateKeys","keys"],"mappings":";;AAAA,MAAMA,cAAc,GAAG,WAAvB;AACO,MAAMC,SAAS,GAAI,GAAED,cAAe,YAApC;MACME,SAAS,GAAI,GAAEF,cAAe;AACpC,MAAMG,QAAQ,GAAI,GAAEH,cAAe,WAAnC;MACMI,aAAa,GAAI,GAAEJ,cAAe;MAClCK,YAAY,GAAI,GAAEL,cAAe;AACvC,MAAMM,YAAY,GAAI,GAAEN,cAAe,eAAvC;MACMO,kBAAkB,GAAI,GAAEP,cAAe;AAE7C,MAAMQ,wBAAwB,GAAI,GAAER,cAAe,gBAAnD;MACMS,mBAAmB,GAAI,GAAET,cAAe;MAExCU,kBAAkB,GAAI,GAAEV,cAAe;MAEvCW,SAAS,GAAI,GAAEX,cAAe;MAE9BY,oBAAoB,GAAI,GAAEZ,cAAe;;;;;;;;;;;;;;;;;;MChBzCa,MAAM,GAAG,CAACC,IAAD,EAAeC,OAAY,GAAG,EAA9B,MAAsC;AAC1DD,EAAAA,IAD0D;AAE1D,KAAGC;AAFuD,CAAtC;;ACUf,MAAMC,WAAW,GAAGC,QAAQ,IACjCJ,MAAM,CAACL,wBAAD,EAA2B;AAAES,EAAAA;AAAF,CAA3B,CADD;MAEMC,iBAAiB,GAAG,CAC/BC,IAD+B,EAE/BC,QAF+B,EAG/BC,WAH+B,EAI/BC,UAJ+B,EAK/BC,SAL+B,EAM/BC,MAN+B,KAQ/BX,MAAM,CAACJ,mBAAD,EAAsB;AAC1BU,EAAAA,IAD0B;AAE1BC,EAAAA,QAF0B;AAG1BC,EAAAA,WAH0B;AAI1BC,EAAAA,UAJ0B;AAK1BC,EAAAA,SAL0B;AAM1BC,EAAAA;AAN0B,CAAtB;MAQKC,iBAAiB,GAAG,CAACC,OAAD,EAAUC,aAAV,EAAyBC,QAAzB,KAC/Bf,MAAM,CAACH,kBAAD,EAAqB;AAAEgB,EAAAA,OAAF;AAAWC,EAAAA,aAAX;AAA0BC,EAAAA;AAA1B,CAArB;MACKC,QAAQ,GAAG,CAACV,IAAD,EAAOW,KAAP,KAAiBjB,MAAM,CAACF,SAAD,EAAY;AAAEQ,EAAAA,IAAF;AAAQW,EAAAA;AAAR,CAAZ;AACxC,MAAMC,aAAa,GAAGC,KAAK,IAAInB,MAAM,CAACX,SAAD,EAAY;AAAE8B,EAAAA;AAAF,CAAZ,CAArC;MACMC,gBAAgB,GAAGC,IAAI,IAAIrB,MAAM,CAACN,kBAAD,EAAqB;AAAE2B,EAAAA;AAAF,CAArB;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/cjs/client.js
CHANGED
|
@@ -15,30 +15,28 @@ require('redux-immutable');
|
|
|
15
15
|
require('redux-thunk');
|
|
16
16
|
require('redux-saga');
|
|
17
17
|
require('redux-injectors');
|
|
18
|
-
var version = require('./version-
|
|
19
|
-
var actions = require('./actions-
|
|
20
|
-
var reducers = require('./reducers-
|
|
18
|
+
var version = require('./version-3a808c12.js');
|
|
19
|
+
var actions = require('./actions-e9f69947.js');
|
|
20
|
+
var reducers = require('./reducers-cb531715.js');
|
|
21
21
|
require('history');
|
|
22
|
-
var App = require('./App-
|
|
22
|
+
var App = require('./App-79703372.js');
|
|
23
23
|
require('@redux-saga/core/effects');
|
|
24
24
|
require('contensis-delivery-api');
|
|
25
25
|
require('./version-2193b4a2.js');
|
|
26
26
|
var queryString = require('query-string');
|
|
27
|
-
require('./selectors-
|
|
27
|
+
require('./selectors-1295124a.js');
|
|
28
28
|
require('loglevel');
|
|
29
|
-
require('./ToJs-
|
|
30
|
-
require('./login-
|
|
29
|
+
require('./ToJs-d72e5b10.js');
|
|
30
|
+
require('./login-4f274c6a.js');
|
|
31
31
|
require('await-to-js');
|
|
32
32
|
require('js-cookie');
|
|
33
33
|
var reactHotLoader = require('react-hot-loader');
|
|
34
|
-
require('
|
|
35
|
-
require('./RouteLoader-5c44f039.js');
|
|
34
|
+
require('./RouteLoader-f67bbf9e.js');
|
|
36
35
|
var reactDom = require('react-dom');
|
|
37
36
|
|
|
38
37
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
38
|
|
|
40
39
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
41
|
-
var queryString__default = /*#__PURE__*/_interopDefaultLegacy(queryString);
|
|
42
40
|
|
|
43
41
|
const fromJSLeaveImmer = js => {
|
|
44
42
|
// console.info(js);
|
|
@@ -86,19 +84,19 @@ class ClientApp {
|
|
|
86
84
|
return ClientJsx;
|
|
87
85
|
};
|
|
88
86
|
|
|
89
|
-
const isProduction = !(process.env.NODE_ENV
|
|
87
|
+
const isProduction = !(process.env.NODE_ENV !== 'production');
|
|
90
88
|
/**
|
|
91
89
|
* Webpack HMR Setup.
|
|
92
90
|
*/
|
|
93
91
|
|
|
94
92
|
const HMRRenderer = Component => {
|
|
95
93
|
Loadable.preloadReady().then(() => {
|
|
96
|
-
isProduction
|
|
94
|
+
if (isProduction) reactDom.hydrate(Component, documentRoot);else reactDom.render(Component, documentRoot);
|
|
97
95
|
});
|
|
98
96
|
};
|
|
99
97
|
|
|
100
98
|
let store = null;
|
|
101
|
-
const qs =
|
|
99
|
+
const qs = queryString.parse(window.location.search);
|
|
102
100
|
const versionStatusFromHostname = App.deliveryApi.getClientSideVersionStatus();
|
|
103
101
|
|
|
104
102
|
if (window.isDynamic || window.REDUX_DATA || process.env.NODE_ENV !== 'production') {
|
|
@@ -116,7 +114,7 @@ class ClientApp {
|
|
|
116
114
|
} else {
|
|
117
115
|
fetch(`${window.location.pathname}?redux=true`).then(response => response.json()).then(data => {
|
|
118
116
|
/* eslint-disable no-console */
|
|
119
|
-
//console.log('Got Data Back');
|
|
117
|
+
// console.log('Got Data Back');
|
|
120
118
|
// console.log(data);
|
|
121
119
|
|
|
122
120
|
/* eslint-enable no-console */
|
|
@@ -124,7 +122,7 @@ class ClientApp {
|
|
|
124
122
|
store = version.createStore(withReducers, fromJSLeaveImmer(ssRedux), App.browserHistory); // store.dispatch(setVersionStatus(versionStatusFromHostname));
|
|
125
123
|
|
|
126
124
|
store.runSaga(App.rootSaga(withSagas));
|
|
127
|
-
store.dispatch(actions.setCurrentProject(App.pickProject(window.location.hostname,
|
|
125
|
+
store.dispatch(actions.setCurrentProject(App.pickProject(window.location.hostname, queryString.parse(window.location.search)), [], window.location.hostname)); // if (typeof window != 'undefined') {
|
|
128
126
|
// store.dispatch(checkUserLoggedIn());
|
|
129
127
|
// }
|
|
130
128
|
|
package/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../src/util/fromJSLeaveImmer.js","../src/client/client.
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/util/fromJSLeaveImmer.js","../src/client/client.tsx"],"sourcesContent":["import fromJSOrdered from './fromJSOrdered';\n\nconst fromJSLeaveImmer = js => {\n // console.info(js);\n // if (typeof js !== 'object' || js === null) return js;\n // // console.info(`from js - here is js ${JSON.stringify(js)}`);\n // const convertedObject = isOrdered ? OrderedMap() : fromJS({});\n // const keys = Object.keys(js);\n // keys.forEach(key => {\n // if (key === 'immer') {\n // convertedObject.set(key, js[key]);\n // // console.info(`LOOK! - immer untouched bar root key \"${key}\"`);\n // } else {\n // // console.info(`LOOK! - normal immutable feature \"${key}\"`);\n // convertedObject.set(key, isOrdered ? fromJSOrdered(js) : fromJS(js));\n // }\n // });\n const immutableObj = fromJSOrdered(js);\n if (immutableObj && !!immutableObj.get('immer')) {\n immutableObj.set('immer', immutableObj.get('immer').toJS());\n }\n return immutableObj;\n};\nexport default fromJSLeaveImmer;\n","import 'isomorphic-fetch';\nimport React from 'react';\nimport { render, hydrate } from 'react-dom';\nimport { Router } from 'react-router-dom';\nimport { preloadReady } from 'react-loadable';\nimport { AppContainer } from 'react-hot-loader';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport * as queryString from 'query-string';\n// import { fromJS } from 'immutable';\n\nimport createStore from '~/redux/store/store';\nimport { browserHistory as history } from '~/redux/store/history';\nimport rootSaga from '~/redux/sagas';\n\nimport { setVersionStatus } from '~/redux/actions/version';\nimport { deliveryApi } from '~/util/ContensisDeliveryApi';\nimport { setCurrentProject } from '~/routing/redux/actions';\nimport pickProject from '~/util/pickProject';\n// import fromJSOrdered from '~/util/fromJSOrdered';\nimport fromJSLeaveImmer from '~/util/fromJSLeaveImmer';\n\nimport { AppConfig } from '~/config';\n\ndeclare let window: typeof globalThis & {\n isDynamic;\n REDUX_DATA;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\nclass ClientApp {\n constructor(ReactApp: React.ComponentType<ReactAppProps>, config: AppConfig) {\n const documentRoot = document.getElementById('root');\n\n const { routes, withReducers, withSagas, withEvents } = config;\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <AppContainer>\n <ReduxProvider store={store}>\n <Router history={history}>\n <ReactApp routes={routes} withEvents={withEvents} />\n </Router>\n </ReduxProvider>\n </AppContainer>\n );\n return ClientJsx;\n };\n\n const isProduction = !(process.env.NODE_ENV !== 'production');\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n preloadReady().then(() => {\n if (isProduction) hydrate(Component, documentRoot);\n else render(Component, documentRoot);\n });\n };\n let store: any = null;\n const qs = queryString.parse(window.location.search);\n\n const versionStatusFromHostname = deliveryApi.getClientSideVersionStatus();\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n store = createStore(\n withReducers,\n fromJSLeaveImmer(window.REDUX_DATA),\n history\n );\n store.dispatch(\n setVersionStatus(qs.versionStatus || versionStatusFromHostname)\n );\n\n /* eslint-disable no-console */\n console.log('Hydrating from inline Redux');\n /* eslint-enable no-console */\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n delete window.REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n /* eslint-disable no-console */\n // console.log('Got Data Back');\n // console.log(data);\n /* eslint-enable no-console */\n const ssRedux = JSON.parse(data);\n store = createStore(withReducers, fromJSLeaveImmer(ssRedux), history);\n // store.dispatch(setVersionStatus(versionStatusFromHostname));\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(\n window.location.hostname,\n queryString.parse(window.location.search)\n ),\n [],\n window.location.hostname\n )\n );\n // if (typeof window != 'undefined') {\n // store.dispatch(checkUserLoggedIn());\n // }\n HMRRenderer(GetClientJSX(store));\n });\n }\n\n // webpack Hot Module Replacement API\n if (module.hot) {\n module.hot.accept(ReactApp as unknown as string, () => {\n // if you are using harmony modules ({modules:false})\n HMRRenderer(GetClientJSX(store));\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["fromJSLeaveImmer","js","immutableObj","fromJSOrdered","get","set","toJS","ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","AppContainer","ReduxProvider","Router","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","preloadReady","then","hydrate","render","qs","queryString","window","location","search","versionStatusFromHostname","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","dispatch","setVersionStatus","versionStatus","console","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON","parse","module","hot","accept"],"mappings":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