@zengenti/contensis-react-base 3.0.0-beta.4 → 3.0.0-beta.40
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/README.md +4 -4
- package/cjs/{App-581b6653.js → App-2ff001f6.js} +139 -124
- package/cjs/App-2ff001f6.js.map +1 -0
- package/cjs/{RouteLoader-282c03ab.js → RouteLoader-2ed14766.js} +44 -30
- package/cjs/RouteLoader-2ed14766.js.map +1 -0
- package/cjs/ToJs-09204afd.js +129 -0
- package/cjs/ToJs-09204afd.js.map +1 -0
- package/cjs/{actions-12871aca.js → actions-6b9ef168.js} +9 -8
- package/cjs/actions-6b9ef168.js.map +1 -0
- package/cjs/client.js +43 -22
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +42 -46
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +275 -275
- package/cjs/forms.js.map +1 -1
- package/cjs/fromJSLeaveImmer-65d26804.js +28 -0
- package/cjs/fromJSLeaveImmer-65d26804.js.map +1 -0
- package/cjs/{login-81d7f9ef.js → login-d67b82aa.js} +113 -79
- package/cjs/login-d67b82aa.js.map +1 -0
- package/cjs/{reducers-fde41d6b.js → reducers-3a4f8971.js} +26 -25
- package/cjs/reducers-3a4f8971.js.map +1 -0
- package/cjs/redux.js +13 -14
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +9 -8
- package/cjs/routing.js.map +1 -1
- package/cjs/search.js +413 -254
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-ed26ed97.js → selectors-2c1b1183.js} +8 -4
- package/cjs/selectors-2c1b1183.js.map +1 -0
- package/cjs/user.js +32 -23
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +49 -46
- package/cjs/util.js.map +1 -1
- package/cjs/{version-f061e409.js → version-951bc80c.js} +58 -52
- package/cjs/version-951bc80c.js.map +1 -0
- package/cjs/{version-0c190929.js → version-dcfdafd9.js} +5 -5
- package/cjs/{version-0c190929.js.map → version-dcfdafd9.js.map} +1 -1
- package/esm/{App-122f28a3.js → App-7b3aee16.js} +120 -124
- package/esm/App-7b3aee16.js.map +1 -0
- package/esm/{RouteLoader-c2faac87.js → RouteLoader-d4b4d320.js} +37 -23
- package/esm/RouteLoader-d4b4d320.js.map +1 -0
- package/esm/ToJs-2627ce21.js +99 -0
- package/esm/ToJs-2627ce21.js.map +1 -0
- package/esm/{actions-3cc39599.js → actions-5437f43d.js} +8 -7
- package/esm/actions-5437f43d.js.map +1 -0
- package/esm/client.js +22 -20
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +24 -28
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +5 -5
- package/esm/forms.js.map +1 -1
- package/esm/fromJSLeaveImmer-e2f0f331.js +26 -0
- package/esm/fromJSLeaveImmer-e2f0f331.js.map +1 -0
- package/esm/{login-92db44d1.js → login-f6dfbe1b.js} +97 -60
- package/esm/login-f6dfbe1b.js.map +1 -0
- package/esm/{reducers-d6c0edb1.js → reducers-8e5d6232.js} +26 -25
- package/esm/reducers-8e5d6232.js.map +1 -0
- package/esm/redux.js +14 -13
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +9 -8
- package/esm/routing.js.map +1 -1
- package/esm/search.js +382 -242
- package/esm/search.js.map +1 -1
- package/esm/{selectors-82e71d8e.js → selectors-65f0f31c.js} +9 -6
- package/esm/selectors-65f0f31c.js.map +1 -0
- package/esm/user.js +31 -22
- package/esm/user.js.map +1 -1
- package/esm/util.js +18 -11
- package/esm/util.js.map +1 -1
- package/esm/version-696796d7.js +15 -0
- package/esm/{version-59c8f9be.js.map → version-696796d7.js.map} +1 -1
- package/esm/{version-cb9cd09d.js → version-b2ca1dab.js} +38 -31
- package/esm/version-b2ca1dab.js.map +1 -0
- package/models/redux/appstate.d.ts +5 -10
- package/models/redux/reducers/navigation.d.ts +1 -6
- package/models/redux/reducers/version.d.ts +1 -5
- package/models/redux/selectors/navigation.d.ts +2 -1
- package/models/routing/redux/actions.d.ts +1 -1
- package/models/routing/redux/reducers.d.ts +1 -21
- package/models/routing/redux/selectors.d.ts +1 -1
- package/models/routing/routes.d.ts +3 -2
- package/models/routing/util/expressions.d.ts +3 -2
- package/models/routing/util/queries.d.ts +1 -1
- package/models/search/containers/withListing.d.ts +1 -1
- package/models/search/containers/withSearch.d.ts +1 -1
- package/models/search/hooks/useListing.hook.d.ts +3 -0
- package/models/search/hooks/useMinilist.hook.d.ts +2 -9
- package/models/search/index.d.ts +1 -0
- package/models/search/models/Queries.d.ts +8 -5
- package/models/search/models/Search.d.ts +58 -26
- package/models/search/models/SearchActions.d.ts +4 -3
- package/models/search/models/SearchProps.d.ts +25 -2
- package/models/search/models/SearchState.d.ts +5 -1
- package/models/search/models/index.d.ts +2 -1
- package/models/search/redux/actions.d.ts +2 -1
- package/models/search/redux/reducers.d.ts +230 -314
- package/models/search/redux/sagas.d.ts +5 -5
- package/models/search/redux/selectors.d.ts +5 -10
- package/models/search/search/expressions.d.ts +2 -6
- package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -1
- package/models/search/transformations/filter-to-filterexpression.mapper.d.ts +6 -0
- package/models/search/transformations/filters-to-filterexpressions.mapper.d.ts +3 -0
- package/models/search/transformations/index.d.ts +3 -0
- package/models/search/transformations/state-to-searchuri.d.ts +2 -13
- package/models/server/util/headers.d.ts +3 -2
- package/models/testImmer/redux/reducer.d.ts +1 -7
- package/models/user/components/Login.d.ts +1 -2
- package/models/user/components/LoginForm.d.ts +1 -2
- package/models/user/hocs/withLogin.d.ts +2 -2
- package/models/user/hooks/useChangePassword.d.ts +5 -5
- package/models/user/hooks/useForgotPassword.d.ts +6 -6
- package/models/user/hooks/useLogin.d.ts +9 -45
- package/models/user/hooks/useRegistration.d.ts +4 -4
- package/models/user/redux/reducers.d.ts +5 -32
- package/models/user/redux/sagas/login.d.ts +11 -8
- package/models/user/redux/selectors.d.ts +33 -71
- package/models/user/util/LoginHelper.class.d.ts +4 -3
- package/models/util/json-mapper.d.ts +9 -3
- package/models/util/merge.d.ts +1 -0
- package/package-lock.json +2006 -4796
- package/package.json +47 -48
- package/cjs/App-581b6653.js.map +0 -1
- package/cjs/RouteLoader-282c03ab.js.map +0 -1
- package/cjs/ToJs-87edc45d.js +0 -230
- package/cjs/ToJs-87edc45d.js.map +0 -1
- package/cjs/actions-12871aca.js.map +0 -1
- package/cjs/fromJSLeaveImmer-9b550c8e.js +0 -40
- package/cjs/fromJSLeaveImmer-9b550c8e.js.map +0 -1
- package/cjs/login-81d7f9ef.js.map +0 -1
- package/cjs/reducers-fde41d6b.js.map +0 -1
- package/cjs/selectors-ed26ed97.js.map +0 -1
- package/cjs/version-f061e409.js.map +0 -1
- package/esm/App-122f28a3.js.map +0 -1
- package/esm/RouteLoader-c2faac87.js.map +0 -1
- package/esm/ToJs-52fee252.js +0 -199
- package/esm/ToJs-52fee252.js.map +0 -1
- package/esm/actions-3cc39599.js.map +0 -1
- package/esm/fromJSLeaveImmer-e44d1a91.js +0 -38
- package/esm/fromJSLeaveImmer-e44d1a91.js.map +0 -1
- package/esm/login-92db44d1.js.map +0 -1
- package/esm/reducers-d6c0edb1.js.map +0 -1
- package/esm/selectors-82e71d8e.js.map +0 -1
- package/esm/version-59c8f9be.js +0 -15
- package/esm/version-cb9cd09d.js.map +0 -1
- package/models/search/transformations/filters-to-filterexpression.d.ts +0 -1
- package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +0 -2
- package/models/server/features/caching/cacheHashing.d.ts +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var reactRouterDom = require('react-router-dom');
|
|
5
4
|
var reactRedux = require('react-redux');
|
|
6
|
-
var reactRouterConfig = require('react-router-config');
|
|
7
|
-
var actions = require('./actions-12871aca.js');
|
|
8
|
-
var selectors = require('./selectors-ed26ed97.js');
|
|
9
|
-
var ToJs = require('./ToJs-87edc45d.js');
|
|
10
5
|
var reactHotLoader = require('react-hot-loader');
|
|
6
|
+
var reactRouterDom = require('react-router-dom');
|
|
7
|
+
var reactRouterConfig = require('react-router-config');
|
|
8
|
+
var reselect = require('reselect');
|
|
9
|
+
var selectors = require('./selectors-2c1b1183.js');
|
|
10
|
+
var actions = require('./actions-6b9ef168.js');
|
|
11
|
+
var ToJs = require('./ToJs-09204afd.js');
|
|
11
12
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
14
|
|
|
@@ -16,7 +17,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
16
17
|
const NotFound = ({
|
|
17
18
|
statusCode,
|
|
18
19
|
statusText
|
|
19
|
-
}) => /*#__PURE__*/React__default[
|
|
20
|
+
}) => /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("header", null, /*#__PURE__*/React__default["default"].createElement("h1", null, statusCode || '404', " Page Not Found"), statusText && /*#__PURE__*/React__default["default"].createElement("h2", {
|
|
20
21
|
style: {
|
|
21
22
|
background: '#eee',
|
|
22
23
|
color: '#666',
|
|
@@ -29,7 +30,7 @@ const Status = ({
|
|
|
29
30
|
code,
|
|
30
31
|
children
|
|
31
32
|
}) => {
|
|
32
|
-
return /*#__PURE__*/React__default[
|
|
33
|
+
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Route, {
|
|
33
34
|
render: ({
|
|
34
35
|
staticContext
|
|
35
36
|
}) => {
|
|
@@ -117,7 +118,7 @@ const RouteLoader = ({
|
|
|
117
118
|
}, [location, setPath]); // Need to redirect when url endswith a /
|
|
118
119
|
|
|
119
120
|
if (location.pathname.length > trimmedPath.length) {
|
|
120
|
-
return /*#__PURE__*/React__default[
|
|
121
|
+
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Redirect, {
|
|
121
122
|
to: trimmedPath
|
|
122
123
|
});
|
|
123
124
|
} // Render any Static Routes a developer has defined
|
|
@@ -137,7 +138,7 @@ const RouteLoader = ({
|
|
|
137
138
|
|
|
138
139
|
if (isLoading && !isNotFound && loadingComponent) {
|
|
139
140
|
const LoadingComponent = loadingComponent;
|
|
140
|
-
return /*#__PURE__*/React__default[
|
|
141
|
+
return /*#__PURE__*/React__default["default"].createElement(LoadingComponent, null);
|
|
141
142
|
} // Match any defined Content Type Mappings
|
|
142
143
|
|
|
143
144
|
|
|
@@ -145,7 +146,7 @@ const RouteLoader = ({
|
|
|
145
146
|
const MatchedComponent = routes.ContentTypeMappings.find(item => item.contentTypeID === contentTypeId);
|
|
146
147
|
|
|
147
148
|
if (MatchedComponent && !(MatchedComponent.requireLogin && !isLoggedIn)) {
|
|
148
|
-
if (ToJs.matchUserGroup(userGroups, MatchedComponent.requireLogin)) return /*#__PURE__*/React__default[
|
|
149
|
+
if (ToJs.matchUserGroup(userGroups, MatchedComponent.requireLogin)) return /*#__PURE__*/React__default["default"].createElement(MatchedComponent.component, {
|
|
149
150
|
projectId: projectId,
|
|
150
151
|
contentTypeId: contentTypeId,
|
|
151
152
|
entry: entry,
|
|
@@ -158,9 +159,9 @@ const RouteLoader = ({
|
|
|
158
159
|
const NotFoundComponent = notFoundComponent ? notFoundComponent : NotFound;
|
|
159
160
|
|
|
160
161
|
if (isNotFound || isError) {
|
|
161
|
-
return /*#__PURE__*/React__default[
|
|
162
|
+
return /*#__PURE__*/React__default["default"].createElement(Status, {
|
|
162
163
|
code: statusCode
|
|
163
|
-
}, /*#__PURE__*/React__default[
|
|
164
|
+
}, /*#__PURE__*/React__default["default"].createElement(NotFoundComponent, {
|
|
164
165
|
statusCode: statusCode,
|
|
165
166
|
statusText: statusText
|
|
166
167
|
}));
|
|
@@ -169,27 +170,40 @@ const RouteLoader = ({
|
|
|
169
170
|
return null;
|
|
170
171
|
};
|
|
171
172
|
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
173
|
+
const mapStateToPropsMemoized = reselect.createSelector(selectors.selectRouteEntryContentTypeId, selectors.selectRouteEntry, selectors.selectRouteIsError, selectors.selectIsNotFound, selectors.selectRouteLoading, ToJs.selectUserIsAuthenticated, selectors.selectMappedEntry, selectors.selectCurrentProject, selectors.selectCurrentPath, selectors.selectRouteStatusCode, selectors.selectRouteErrorMessage, ToJs.selectUserGroups, (contentTypeId, entry, isError, isNotFound, isLoading, isLoggedIn, mappedEntry, projectId, statePath, statusCode, statusText, userGroups) => ({
|
|
174
|
+
contentTypeId,
|
|
175
|
+
entry,
|
|
176
|
+
isError,
|
|
177
|
+
isNotFound,
|
|
178
|
+
isLoading,
|
|
179
|
+
isLoggedIn,
|
|
180
|
+
mappedEntry,
|
|
181
|
+
projectId,
|
|
182
|
+
statePath,
|
|
183
|
+
statusCode,
|
|
184
|
+
statusText,
|
|
185
|
+
userGroups
|
|
186
|
+
})); // const mapStateToProps = state => {
|
|
187
|
+
// return {
|
|
188
|
+
// contentTypeId: selectRouteEntryContentTypeId(state),
|
|
189
|
+
// entry: selectRouteEntry(state),
|
|
190
|
+
// isError: selectRouteIsError(state),
|
|
191
|
+
// isNotFound: selectIsNotFound(state),
|
|
192
|
+
// isLoading: selectRouteLoading(state),
|
|
193
|
+
// isLoggedIn: selectUserIsAuthenticated(state),
|
|
194
|
+
// mappedEntry: selectMappedEntry(state),
|
|
195
|
+
// projectId: selectCurrentProject(state),
|
|
196
|
+
// statePath: selectCurrentPath(state),
|
|
197
|
+
// statusCode: selectRouteStatusCode(state),
|
|
198
|
+
// statusText: selectRouteErrorMessage(state),
|
|
199
|
+
// userGroups: selectUserGroups(state),
|
|
200
|
+
// };
|
|
201
|
+
// };
|
|
188
202
|
|
|
189
203
|
const mapDispatchToProps = {
|
|
190
204
|
setNavigationPath: actions.setNavigationPath
|
|
191
205
|
};
|
|
192
|
-
var RouteLoader$1 = reactHotLoader.hot(module)(reactRedux.connect(
|
|
206
|
+
var RouteLoader$1 = reactHotLoader.hot(module)(reactRedux.connect(mapStateToPropsMemoized, mapDispatchToProps)(ToJs.toJS(RouteLoader)));
|
|
193
207
|
|
|
194
208
|
exports.RouteLoader = RouteLoader$1;
|
|
195
|
-
//# sourceMappingURL=RouteLoader-
|
|
209
|
+
//# sourceMappingURL=RouteLoader-2ed14766.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteLoader-2ed14766.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, RouteConfig } from 'react-router-config';\nimport { createSelector } from 'reselect';\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, RouteComponentProps, 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 | null;\n entry: Entry | null;\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 as RouteConfig[], 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 as string)\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(\n routes.StaticRoutes as RouteConfig[],\n {\n projectId,\n contentTypeId,\n entry,\n mappedEntry,\n isLoggedIn,\n } as RouteComponentProps\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 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};\nconst mapStateToPropsMemoized = createSelector(\n selectRouteEntryContentTypeId,\n selectRouteEntry,\n selectRouteIsError,\n selectIsNotFound,\n selectRouteLoading,\n selectUserIsAuthenticated,\n selectMappedEntry,\n selectCurrentProject,\n selectCurrentPath,\n selectRouteStatusCode,\n selectRouteErrorMessage,\n selectUserGroups,\n (\n contentTypeId,\n entry,\n isError,\n isNotFound,\n isLoading,\n isLoggedIn,\n mappedEntry,\n projectId,\n statePath,\n statusCode,\n statusText,\n userGroups\n ) => ({\n contentTypeId,\n entry,\n isError,\n isNotFound,\n isLoading,\n isLoggedIn,\n mappedEntry,\n projectId,\n statePath,\n statusCode,\n statusText,\n userGroups,\n })\n);\n\n// const 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(mapStateToPropsMemoized, 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","mapStateToPropsMemoized","createSelector","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,CADF,CAPF;;ACCO,MAAMM,MAAM,GAAG,CAAC;AACrBC,EAAAA,IADqB;AAErBC,EAAAA;AAFqB,CAAD,KAGqB;AACzC,sBACEP,wCAACQ,oBAAD;AACE,IAAA,MAAM,EAAE,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAuB;AAC7B,UAAIA,aAAJ,EAAmBA,aAAa,CAACX,UAAd,GAA2BQ,IAA3B;AACnB,aAAOC,QAAP;AACD;AAJH,IADF;AAQD,CAZM;;AC+BP,MAAMG,cAAc,GAAGC,IAAI,IAAI;AAC7B,MAAIA,IAAI,KAAK,GAAb,EAAkB;AAChB,UAAMC,QAAQ,GAAGD,IAAI,CAACE,OAAL,CAAa,MAAb,EAAqB,GAArB,CAAjB;AACA,UAAMC,QAAQ,GAAGF,QAAQ,CAACA,QAAQ,CAACG,MAAT,GAAkB,CAAnB,CAAzB;;AACA,QAAID,QAAQ,KAAK,GAAjB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
6
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
|
+
|
|
8
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
9
|
+
|
|
10
|
+
const selectUserIsLoading = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isLoading']);
|
|
11
|
+
const selectUserIsAuthenticated = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticated']);
|
|
12
|
+
const selectUserIsAuthenticationError = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticationError']);
|
|
13
|
+
const selectUserIsError = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'isError']);
|
|
14
|
+
/**
|
|
15
|
+
* DEPRECATED 12/2021 - use selectUserErrorMessage instead
|
|
16
|
+
* @param state AppState
|
|
17
|
+
* @returns string
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const selectUserAuthenticationErrorMessage = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'errorMessage']);
|
|
21
|
+
const selectUserErrorMessage = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'errorMessage']);
|
|
22
|
+
const selectClientCredentials = (state, returnType) => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'clientCredentials'], {}, returnType);
|
|
23
|
+
const selectUser = (state, returnType) => selectors$1.getImmutableOrJS(state, 'user', {}, returnType);
|
|
24
|
+
const selectUserIsZengentiStaff = state => selectors$1.getImmutableOrJS(state, ['user', 'isZengentiStaff']);
|
|
25
|
+
const selectUserGuid = state => selectors$1.getImmutableOrJS(state, ['user', 'id']);
|
|
26
|
+
const selectUsername = state => selectors$1.getImmutableOrJS(state, ['user', 'username']);
|
|
27
|
+
const selectUserEmail = state => selectors$1.getImmutableOrJS(state, ['user', 'email']);
|
|
28
|
+
const selectUserGroups = (state, returnType) => selectors$1.getImmutableOrJS(state, ['user', 'groups'], [], returnType);
|
|
29
|
+
const selectUserSecurityToken = state => selectors$1.getImmutableOrJS(state, ['user', 'authenticationState', 'clientCredentials', 'contensisClassicToken']);
|
|
30
|
+
const selectUserRegistration = (state, returnType) => selectors$1.getImmutableOrJS(state, ['user', 'registration'], {}, returnType);
|
|
31
|
+
const selectUserRegistrationError = state => selectors$1.getImmutableOrJS(state, ['user', 'registration', 'error'], false);
|
|
32
|
+
const selectUserRegistrationIsLoading = state => selectors$1.getImmutableOrJS(state, ['user', 'registration', 'isLoading'], false);
|
|
33
|
+
const selectUserRegistrationIsSuccess = state => selectors$1.getImmutableOrJS(state, ['user', 'registration', 'success'], false);
|
|
34
|
+
const selectPasswordResetRequestSending = state => selectors$1.getImmutableOrJS(state, ['user', 'passwordResetRequest', 'isSending']);
|
|
35
|
+
const selectPasswordResetRequestSent = state => selectors$1.getImmutableOrJS(state, ['user', 'passwordResetRequest', 'sent']);
|
|
36
|
+
const selectPasswordResetRequestError = state => selectors$1.getImmutableOrJS(state, ['user', 'passwordResetRequest', 'error']);
|
|
37
|
+
const selectResetPasswordSending = state => selectors$1.getImmutableOrJS(state, ['user', 'resetPassword', 'isSending']);
|
|
38
|
+
const selectResetPasswordSent = state => selectors$1.getImmutableOrJS(state, ['user', 'resetPassword', 'sent']);
|
|
39
|
+
const selectResetPasswordError = state => selectors$1.getImmutableOrJS(state, ['user', 'resetPassword', 'error']);
|
|
40
|
+
const selectChangePasswordSending = state => selectors$1.getImmutableOrJS(state, ['user', 'changePassword', 'isSending']);
|
|
41
|
+
const selectChangePasswordSent = state => selectors$1.getImmutableOrJS(state, ['user', 'changePassword', 'sent']);
|
|
42
|
+
const selectChangePasswordError = state => selectors$1.getImmutableOrJS(state, ['user', 'changePassword', 'error']);
|
|
43
|
+
|
|
44
|
+
var selectors = /*#__PURE__*/Object.freeze({
|
|
45
|
+
__proto__: null,
|
|
46
|
+
selectUserIsLoading: selectUserIsLoading,
|
|
47
|
+
selectUserIsAuthenticated: selectUserIsAuthenticated,
|
|
48
|
+
selectUserIsAuthenticationError: selectUserIsAuthenticationError,
|
|
49
|
+
selectUserIsError: selectUserIsError,
|
|
50
|
+
selectUserAuthenticationErrorMessage: selectUserAuthenticationErrorMessage,
|
|
51
|
+
selectUserErrorMessage: selectUserErrorMessage,
|
|
52
|
+
selectClientCredentials: selectClientCredentials,
|
|
53
|
+
selectUser: selectUser,
|
|
54
|
+
selectUserIsZengentiStaff: selectUserIsZengentiStaff,
|
|
55
|
+
selectUserGuid: selectUserGuid,
|
|
56
|
+
selectUsername: selectUsername,
|
|
57
|
+
selectUserEmail: selectUserEmail,
|
|
58
|
+
selectUserGroups: selectUserGroups,
|
|
59
|
+
selectUserSecurityToken: selectUserSecurityToken,
|
|
60
|
+
selectUserRegistration: selectUserRegistration,
|
|
61
|
+
selectUserRegistrationError: selectUserRegistrationError,
|
|
62
|
+
selectUserRegistrationIsLoading: selectUserRegistrationIsLoading,
|
|
63
|
+
selectUserRegistrationIsSuccess: selectUserRegistrationIsSuccess,
|
|
64
|
+
selectPasswordResetRequestSending: selectPasswordResetRequestSending,
|
|
65
|
+
selectPasswordResetRequestSent: selectPasswordResetRequestSent,
|
|
66
|
+
selectPasswordResetRequestError: selectPasswordResetRequestError,
|
|
67
|
+
selectResetPasswordSending: selectResetPasswordSending,
|
|
68
|
+
selectResetPasswordSent: selectResetPasswordSent,
|
|
69
|
+
selectResetPasswordError: selectResetPasswordError,
|
|
70
|
+
selectChangePasswordSending: selectChangePasswordSending,
|
|
71
|
+
selectChangePasswordSent: selectChangePasswordSent,
|
|
72
|
+
selectChangePasswordError: selectChangePasswordError
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const matchUserGroup = (userGroups = [], requiredGroups = []) => {
|
|
76
|
+
if (!Array.isArray(requiredGroups) || Array.isArray(requiredGroups) && requiredGroups.length === 0) return true;
|
|
77
|
+
const groupMatch = requiredGroups.some(requiredGroup => {
|
|
78
|
+
return userGroups.some(userGroup => {
|
|
79
|
+
if (requiredGroup.id === userGroup.id) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (requiredGroup.name === userGroup.name) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return groupMatch;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/* eslint-disable react/display-name */
|
|
92
|
+
const toJS = WrappedComponent => wrappedComponentProps => {
|
|
93
|
+
const KEY = 0;
|
|
94
|
+
const VALUE = 1;
|
|
95
|
+
const propsJS = Object.entries(wrappedComponentProps).reduce((newProps, wrappedComponentProp) => {
|
|
96
|
+
const propKey = wrappedComponentProp[KEY];
|
|
97
|
+
const propValue = wrappedComponentProp[VALUE];
|
|
98
|
+
newProps[propKey] = propValue && typeof propValue === 'object' && 'toJS' in propValue ? propValue.toJS() : propValue;
|
|
99
|
+
return newProps;
|
|
100
|
+
}, {});
|
|
101
|
+
return /*#__PURE__*/React__default["default"].createElement(WrappedComponent, propsJS);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
exports.matchUserGroup = matchUserGroup;
|
|
105
|
+
exports.selectChangePasswordError = selectChangePasswordError;
|
|
106
|
+
exports.selectChangePasswordSending = selectChangePasswordSending;
|
|
107
|
+
exports.selectChangePasswordSent = selectChangePasswordSent;
|
|
108
|
+
exports.selectClientCredentials = selectClientCredentials;
|
|
109
|
+
exports.selectPasswordResetRequestError = selectPasswordResetRequestError;
|
|
110
|
+
exports.selectPasswordResetRequestSending = selectPasswordResetRequestSending;
|
|
111
|
+
exports.selectPasswordResetRequestSent = selectPasswordResetRequestSent;
|
|
112
|
+
exports.selectResetPasswordError = selectResetPasswordError;
|
|
113
|
+
exports.selectResetPasswordSending = selectResetPasswordSending;
|
|
114
|
+
exports.selectResetPasswordSent = selectResetPasswordSent;
|
|
115
|
+
exports.selectUser = selectUser;
|
|
116
|
+
exports.selectUserErrorMessage = selectUserErrorMessage;
|
|
117
|
+
exports.selectUserGroups = selectUserGroups;
|
|
118
|
+
exports.selectUserGuid = selectUserGuid;
|
|
119
|
+
exports.selectUserIsAuthenticated = selectUserIsAuthenticated;
|
|
120
|
+
exports.selectUserIsAuthenticationError = selectUserIsAuthenticationError;
|
|
121
|
+
exports.selectUserIsError = selectUserIsError;
|
|
122
|
+
exports.selectUserIsLoading = selectUserIsLoading;
|
|
123
|
+
exports.selectUserRegistration = selectUserRegistration;
|
|
124
|
+
exports.selectUserRegistrationError = selectUserRegistrationError;
|
|
125
|
+
exports.selectUserRegistrationIsLoading = selectUserRegistrationIsLoading;
|
|
126
|
+
exports.selectUserRegistrationIsSuccess = selectUserRegistrationIsSuccess;
|
|
127
|
+
exports.selectors = selectors;
|
|
128
|
+
exports.toJS = toJS;
|
|
129
|
+
//# sourceMappingURL=ToJs-09204afd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToJs-09204afd.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { StateType } from '~/config';\nimport { AppState } from '~/redux/appstate';\nimport { getImmutableOrJS as getIn } from '~/redux/util';\n\nexport const selectUserIsLoading = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isLoading']);\n\nexport const selectUserIsAuthenticated = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticated']);\n\nexport const selectUserIsAuthenticationError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticationError']);\n\nexport const selectUserIsError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isError']);\n\n/**\n * DEPRECATED 12/2021 - use selectUserErrorMessage instead\n * @param state AppState\n * @returns string\n */\nexport const selectUserAuthenticationErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectUserErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectClientCredentials = (\n state: AppState,\n returnType?: StateType\n) =>\n getIn(\n state,\n ['user', 'authenticationState', 'clientCredentials'],\n {},\n returnType\n );\n\nexport const selectUser = (state: AppState, returnType?: StateType) =>\n getIn(state, 'user', {}, returnType);\n\nexport const selectUserIsZengentiStaff = (state: AppState) =>\n getIn(state, ['user', 'isZengentiStaff']);\n\nexport const selectUserGuid = (state: AppState) => getIn(state, ['user', 'id']);\n\nexport const selectUsername = (state: AppState) =>\n getIn(state, ['user', 'username']);\n\nexport const selectUserEmail = (state: AppState) =>\n getIn(state, ['user', 'email']);\n\nexport const selectUserGroups = (state: AppState, returnType?: StateType) =>\n getIn(state, ['user', 'groups'], [], returnType);\n\nexport const selectUserSecurityToken = (state: AppState) =>\n getIn(state, [\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n\nexport const selectUserRegistration = (\n state: AppState,\n returnType?: StateType\n) => getIn(state, ['user', 'registration'], {}, returnType);\n\nexport const selectUserRegistrationError = (state: AppState) =>\n getIn(state, ['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = (state: AppState) =>\n getIn(state, ['user', 'registration', 'isLoading'], false);\n\nexport const selectUserRegistrationIsSuccess = (state: AppState) =>\n getIn(state, ['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'isSending']);\n\nexport const selectPasswordResetRequestSent = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'sent']);\n\nexport const selectPasswordResetRequestError = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'error']);\n\nexport const selectResetPasswordSending = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'isSending']);\n\nexport const selectResetPasswordSent = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'sent']);\n\nexport const selectResetPasswordError = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'error']);\n\nexport const selectChangePasswordSending = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'isSending']);\n\nexport const selectChangePasswordSent = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'sent']);\n\nexport const selectChangePasswordError = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'error']);\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","/* eslint-disable react/display-name */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport React from 'react';\n\nexport const toJS =\n <Props extends { [key: string]: any }>(\n WrappedComponent: React.ComponentType<Props>\n ): React.ComponentType<Props> =>\n (wrappedComponentProps: Props) => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce<Props>(\n (newProps: any, wrappedComponentProp) => {\n const propKey = wrappedComponentProp[KEY];\n const propValue = wrappedComponentProp[VALUE];\n newProps[propKey] =\n propValue && typeof propValue === 'object' && 'toJS' in propValue\n ? propValue.toJS()\n : propValue;\n return newProps as Props;\n },\n {} as Props\n );\n\n return <WrappedComponent {...propsJS} />;\n };\n"],"names":["selectUserIsLoading","state","getIn","selectUserIsAuthenticated","selectUserIsAuthenticationError","selectUserIsError","selectUserAuthenticationErrorMessage","selectUserErrorMessage","selectClientCredentials","returnType","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","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","propKey","propValue","React"],"mappings":";;;;;;;;;MAIaA,mBAAmB,GAAIC,KAAD,IACjCC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,WAAhC,CAAR;MAEME,yBAAyB,GAAIF,KAAD,IACvCC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,iBAAhC,CAAR;MAEMG,+BAA+B,GAAIH,KAAD,IAC7CC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,uBAAhC,CAAR;MAEMI,iBAAiB,GAAIJ,KAAD,IAC/BC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,SAAhC,CAAR;AAEP;AACA;AACA;AACA;AACA;;AACO,MAAMK,oCAAoC,GAAIL,KAAD,IAClDC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,cAAhC,CAAR,CADA;MAGMM,sBAAsB,GAAIN,KAAD,IACpCC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,cAAhC,CAAR;MAEMO,uBAAuB,GAAG,CACrCP,KADqC,EAErCQ,UAFqC,KAIrCP,4BAAK,CACHD,KADG,EAEH,CAAC,MAAD,EAAS,qBAAT,EAAgC,mBAAhC,CAFG,EAGH,EAHG,EAIHQ,UAJG;MAOMC,UAAU,GAAG,CAACT,KAAD,EAAkBQ,UAAlB,KACxBP,4BAAK,CAACD,KAAD,EAAQ,MAAR,EAAgB,EAAhB,EAAoBQ,UAApB;AAEA,MAAME,yBAAyB,GAAIV,KAAD,IACvCC,4BAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,E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AAU,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;;ACxBD;MAIaM,IAAI,GAEbC,gBADF,IAGCC,qBAAD,IAAkC;AAChC,QAAMC,GAAG,GAAG,CAAZ;AACA,QAAMC,KAAK,GAAG,CAAd;AAEA,QAAMC,OAAO,GAAGC,MAAM,CAACC,OAAP,CAAeL,qBAAf,EAAsCM,MAAtC,CACd,CAACC,QAAD,EAAgBC,oBAAhB,KAAyC;AACvC,UAAMC,OAAO,GAAGD,oBAAoB,CAACP,GAAD,CAApC;AACA,UAAMS,SAAS,GAAGF,oBAAoB,CAACN,KAAD,CAAtC;AACAK,IAAAA,QAAQ,CAACE,OAAD,CAAR,GACEC,SAAS,IAAI,OAAOA,SAAP,KAAqB,QAAlC,IAA8C,UAAUA,SAAxD,GACIA,SAAS,CAACZ,IAAV,EADJ,GAEIY,SAHN;AAIA,WAAOH,QAAP;AACD,GATa,EAUd,EAVc,CAAhB;AAaA,sBAAOI,wCAAC,gBAAD,EAAsBR,OAAtB,CAAP;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var selectors = require('./selectors-
|
|
3
|
+
var selectors = require('./selectors-2c1b1183.js');
|
|
4
4
|
|
|
5
5
|
const ROUTING_PREFIX = '@ROUTING/';
|
|
6
6
|
const GET_ENTRY = `${ROUTING_PREFIX}_GET_ENTRY`;
|
|
@@ -16,7 +16,7 @@ const SET_TARGET_PROJECT = `${ROUTING_PREFIX}_SET_TARGET_PROJECT`;
|
|
|
16
16
|
const SET_ROUTE = `${ROUTING_PREFIX}_SET_ROUTE`;
|
|
17
17
|
const UPDATE_LOADING_STATE = `${ROUTING_PREFIX}_UPDATE_LOADING_STATE`;
|
|
18
18
|
|
|
19
|
-
var routing = /*#__PURE__*/Object.freeze({
|
|
19
|
+
var routing$1 = /*#__PURE__*/Object.freeze({
|
|
20
20
|
__proto__: null,
|
|
21
21
|
GET_ENTRY: GET_ENTRY,
|
|
22
22
|
SET_ENTRY: SET_ENTRY,
|
|
@@ -55,11 +55,12 @@ const setRoute = (path, state) => selectors.action(SET_ROUTE, {
|
|
|
55
55
|
const setRouteEntry = entry => selectors.action(SET_ENTRY, {
|
|
56
56
|
entry
|
|
57
57
|
});
|
|
58
|
-
const setSurrogateKeys = keys => selectors.action(SET_SURROGATE_KEYS, {
|
|
59
|
-
keys
|
|
58
|
+
const setSurrogateKeys = (keys, url) => selectors.action(SET_SURROGATE_KEYS, {
|
|
59
|
+
keys,
|
|
60
|
+
url
|
|
60
61
|
});
|
|
61
62
|
|
|
62
|
-
var routing
|
|
63
|
+
var routing = /*#__PURE__*/Object.freeze({
|
|
63
64
|
__proto__: null,
|
|
64
65
|
setNotFound: setNotFound,
|
|
65
66
|
setNavigationPath: setNavigationPath,
|
|
@@ -77,10 +78,10 @@ exports.SET_SIBLINGS = SET_SIBLINGS;
|
|
|
77
78
|
exports.SET_SURROGATE_KEYS = SET_SURROGATE_KEYS;
|
|
78
79
|
exports.SET_TARGET_PROJECT = SET_TARGET_PROJECT;
|
|
79
80
|
exports.UPDATE_LOADING_STATE = UPDATE_LOADING_STATE;
|
|
80
|
-
exports.routing = routing;
|
|
81
|
-
exports.routing$1 = routing
|
|
81
|
+
exports.routing = routing$1;
|
|
82
|
+
exports.routing$1 = routing;
|
|
82
83
|
exports.setCurrentProject = setCurrentProject;
|
|
83
84
|
exports.setNavigationPath = setNavigationPath;
|
|
84
85
|
exports.setRoute = setRoute;
|
|
85
86
|
exports.setSurrogateKeys = setSurrogateKeys;
|
|
86
|
-
//# sourceMappingURL=actions-
|
|
87
|
+
//# sourceMappingURL=actions-6b9ef168.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions-6b9ef168.js","sources":["../src/routing/redux/types.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","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, url) =>\n action(SET_SURROGATE_KEYS, { keys, url });\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","setNotFound","notFound","action","setNavigationPath","path","location","staticRoute","withEvents","statePath","routes","setCurrentProject","project","allowedGroups","hostname","setRoute","state","setRouteEntry","entry","setSurrogateKeys","keys","url"],"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;;;;;;;;;;;;;;;;;;ACN/C,MAAMa,WAAW,GAAGC,QAAQ,IACjCC,gBAAM,CAACP,wBAAD,EAA2B;AAAEM,EAAAA;AAAF,CAA3B,CADD;MAEME,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/BP,gBAAM,CAACN,mBAAD,EAAsB;AAC1BQ,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/BX,gBAAM,CAACL,kBAAD,EAAqB;AAAEc,EAAAA,OAAF;AAAWC,EAAAA,aAAX;AAA0BC,EAAAA;AAA1B,CAArB;MACKC,QAAQ,GAAG,CAACV,IAAD,EAAOW,KAAP,KAAiBb,gBAAM,CAACJ,SAAD,EAAY;AAAEM,EAAAA,IAAF;AAAQW,EAAAA;AAAR,CAAZ;AACxC,MAAMC,aAAa,GAAGC,KAAK,IAAIf,gBAAM,CAACb,SAAD,EAAY;AAAE4B,EAAAA;AAAF,CAAZ,CAArC;MACMC,gBAAgB,GAAG,CAACC,IAAD,EAAOC,GAAP,KAC9BlB,gBAAM,CAACR,kBAAD,EAAqB;AAAEyB,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAArB;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/cjs/client.js
CHANGED
|
@@ -4,38 +4,59 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('isomorphic-fetch');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var reactDom = require('react-dom');
|
|
8
|
+
var reactHotLoader = require('react-hot-loader');
|
|
8
9
|
var reactRedux = require('react-redux');
|
|
9
|
-
require('react-router-
|
|
10
|
+
var reactRouterDom = require('react-router-dom');
|
|
11
|
+
var component = require('@loadable/component');
|
|
12
|
+
var queryString = require('query-string');
|
|
13
|
+
var version = require('./version-951bc80c.js');
|
|
14
|
+
var App = require('./App-2ff001f6.js');
|
|
15
|
+
var actions = require('./actions-6b9ef168.js');
|
|
16
|
+
require('./selectors-2c1b1183.js');
|
|
10
17
|
require('jsonpath-mapper');
|
|
18
|
+
require('@redux-saga/core/effects');
|
|
11
19
|
require('redux');
|
|
12
20
|
require('redux-thunk');
|
|
13
21
|
require('redux-saga');
|
|
14
22
|
require('redux-injectors');
|
|
15
23
|
require('immer');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
require('./reducers-fde41d6b.js');
|
|
24
|
+
require('deepmerge');
|
|
25
|
+
require('./reducers-3a4f8971.js');
|
|
19
26
|
require('history');
|
|
20
|
-
var App = require('./App-581b6653.js');
|
|
21
|
-
require('@redux-saga/core/effects');
|
|
22
27
|
require('contensis-delivery-api');
|
|
23
|
-
require('./
|
|
24
|
-
require('./version-0c190929.js');
|
|
25
|
-
var queryString = require('query-string');
|
|
28
|
+
require('./version-dcfdafd9.js');
|
|
26
29
|
require('loglevel');
|
|
27
|
-
require('./
|
|
28
|
-
require('./
|
|
30
|
+
require('./login-d67b82aa.js');
|
|
31
|
+
require('./ToJs-09204afd.js');
|
|
29
32
|
require('await-to-js');
|
|
30
33
|
require('js-cookie');
|
|
31
|
-
|
|
32
|
-
require('
|
|
33
|
-
|
|
34
|
-
var component = require('@loadable/component');
|
|
34
|
+
require('./RouteLoader-2ed14766.js');
|
|
35
|
+
require('react-router-config');
|
|
36
|
+
require('reselect');
|
|
35
37
|
|
|
36
38
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
37
39
|
|
|
40
|
+
function _interopNamespace(e) {
|
|
41
|
+
if (e && e.__esModule) return e;
|
|
42
|
+
var n = Object.create(null);
|
|
43
|
+
if (e) {
|
|
44
|
+
Object.keys(e).forEach(function (k) {
|
|
45
|
+
if (k !== 'default') {
|
|
46
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
47
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return e[k]; }
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
n["default"] = e;
|
|
55
|
+
return Object.freeze(n);
|
|
56
|
+
}
|
|
57
|
+
|
|
38
58
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
59
|
+
var queryString__namespace = /*#__PURE__*/_interopNamespace(queryString);
|
|
39
60
|
|
|
40
61
|
class ClientApp {
|
|
41
62
|
constructor(ReactApp, config) {
|
|
@@ -49,11 +70,11 @@ class ClientApp {
|
|
|
49
70
|
} = config;
|
|
50
71
|
|
|
51
72
|
const GetClientJSX = store => {
|
|
52
|
-
const ClientJsx = /*#__PURE__*/React__default[
|
|
73
|
+
const ClientJsx = /*#__PURE__*/React__default["default"].createElement(reactHotLoader.AppContainer, null, /*#__PURE__*/React__default["default"].createElement(reactRedux.Provider, {
|
|
53
74
|
store: store
|
|
54
|
-
}, /*#__PURE__*/React__default[
|
|
75
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Router, {
|
|
55
76
|
history: App.browserHistory
|
|
56
|
-
}, /*#__PURE__*/React__default[
|
|
77
|
+
}, /*#__PURE__*/React__default["default"].createElement(ReactApp, {
|
|
57
78
|
routes: routes,
|
|
58
79
|
withEvents: withEvents
|
|
59
80
|
}))));
|
|
@@ -83,7 +104,7 @@ class ClientApp {
|
|
|
83
104
|
}
|
|
84
105
|
};
|
|
85
106
|
|
|
86
|
-
const qs =
|
|
107
|
+
const qs = queryString__namespace.parse(window.location.search);
|
|
87
108
|
const versionStatusFromHostname = App.deliveryApi.getClientSideVersionStatus();
|
|
88
109
|
|
|
89
110
|
if (window.isDynamic || window.REDUX_DATA || process.env.NODE_ENV !== 'production') {
|
|
@@ -111,7 +132,7 @@ class ClientApp {
|
|
|
111
132
|
version.createStore(withReducers, ssRedux, App.browserHistory, stateType).then(store => {
|
|
112
133
|
// store.dispatch(setVersionStatus(versionStatusFromHostname));
|
|
113
134
|
store.runSaga(App.rootSaga(withSagas));
|
|
114
|
-
store.dispatch(actions.setCurrentProject(App.pickProject(window.location.hostname,
|
|
135
|
+
store.dispatch(actions.setCurrentProject(App.pickProject(window.location.hostname, queryString__namespace.parse(window.location.search)), [], window.location.hostname)); // if (typeof window != 'undefined') {
|
|
115
136
|
// store.dispatch(checkUserLoggedIn());
|
|
116
137
|
// }
|
|
117
138
|
|
|
@@ -125,5 +146,5 @@ class ClientApp {
|
|
|
125
146
|
}
|
|
126
147
|
|
|
127
148
|
exports.ReactApp = App.AppRoot;
|
|
128
|
-
exports
|
|
149
|
+
exports["default"] = ClientApp;
|
|
129
150
|
//# sourceMappingURL=client.js.map
|
package/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../src/client/client.tsx"],"sourcesContent":["import 'isomorphic-fetch';\nimport React from 'react';\nimport { render, hydrate } from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { Router } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport * as queryString from 'query-string';\n\nimport { setVersionStatus } from '~/redux/actions/version';\nimport rootSaga from '~/redux/sagas';\nimport { browserHistory as history } from '~/redux/store/history';\nimport createStore from '~/redux/store/store';\n\nimport { setCurrentProject } from '~/routing/redux/actions';\n\nimport { deliveryApi } from '~/util/ContensisDeliveryApi';\nimport pickProject from '~/util/pickProject';\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 {\n stateType = 'immutable',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = 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 if (isProduction)\n loadableReady(\n () => {\n hydrate(Component, documentRoot);\n },\n { namespace: 'modern' }\n );\n else render(Component, documentRoot);\n };\n\n const hmr = store => {\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 const qs = queryString.parse(window.location.search);\n const versionStatusFromHostname = deliveryApi.getClientSideVersionStatus();\n\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\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\n hmr(store);\n }\n );\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 createStore(withReducers, ssRedux, history, stateType).then(store => {\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 hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","AppContainer","ReduxProvider","Router","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrate","namespace","render","hmr","module","hot","accept","qs","queryString","window","location","search","versionStatusFromHostname","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","dispatch","setVersionStatus","versionStatus","console","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON"
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client/client.tsx"],"sourcesContent":["import 'isomorphic-fetch';\nimport React from 'react';\nimport { render, hydrate } from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { Router } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport * as queryString from 'query-string';\n\nimport { setVersionStatus } from '~/redux/actions/version';\nimport rootSaga from '~/redux/sagas';\nimport { browserHistory as history } from '~/redux/store/history';\nimport createStore from '~/redux/store/store';\n\nimport { setCurrentProject } from '~/routing/redux/actions';\n\nimport { deliveryApi } from '~/util/ContensisDeliveryApi';\nimport pickProject from '~/util/pickProject';\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 {\n stateType = 'immutable',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = 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 if (isProduction)\n loadableReady(\n () => {\n hydrate(Component, documentRoot);\n },\n { namespace: 'modern' }\n );\n else render(Component, documentRoot);\n };\n\n const hmr = store => {\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 const qs = queryString.parse(window.location.search);\n const versionStatusFromHostname = deliveryApi.getClientSideVersionStatus();\n\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\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\n hmr(store);\n }\n );\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 createStore(withReducers, ssRedux, history, stateType).then(store => {\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 hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","AppContainer","ReduxProvider","Router","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrate","namespace","render","hmr","module","hot","accept","qs","queryString","parse","window","location","search","versionStatusFromHostname","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","dispatch","setVersionStatus","versionStatus","console","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,SAAN,CAAgB;AACdC,EAAAA,WAAW,CAACC,QAAD,EAA+CC,MAA/C,EAAkE;AAC3E,UAAMC,YAAY,GAAGC,QAAQ,CAACC,cAAT,CAAwB,MAAxB,CAArB;AAEA,UAAM;AACJC,MAAAA,SAAS,GAAG,WADR;AAEJC,MAAAA,MAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA,SAJI;AAKJC,MAAAA;AALI,QAMFR,MANJ;;AAQA,UAAMS,YAAY,GAAGC,KAAK,IAAI;AAC5B,YAAMC,SAAS,gBACbC,wCAACC,2BAAD,qBACED,wCAACE,mBAAD;AAAe,QAAA,KAAK,EAAEJ;AAAtB,sBACEE,wCAACG,qBAAD;AAAQ,QAAA,OAAO,EAAEC;AAAjB,sBACEJ,wCAAC,QAAD;AAAU,QAAA,MAAM,EAAEP,MAAlB;AAA0B,QAAA,UAAU,EAAEG;AAAtC,QADF,CADF,CADF,CADF;AASA,aAAOG,SAAP;AACD,KAXD;;AAaA,UAAMM,YAAY,GAAG,EAAEC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA3B,CAArB;AAEA;AACJ;AACA;;AACI,UAAMC,WAAW,GAAGC,SAAS,IAAI;AAC/B,UAAIL,YAAJ,EACEM,uBAAa,CACX,MAAM;AACJC,QAAAA,gBAAO,CAACF,SAAD,EAAYrB,YAAZ,CAAP;AACD,OAHU,EAIX;AAAEwB,QAAAA,SAAS,EAAE;AAAb,OAJW,CAAb,CADF,KAOKC,eAAM,CAACJ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