@zengenti/contensis-react-base 3.1.1-beta.9 → 3.2.1-beta.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/README.md +36 -0
- package/cjs/{App-4c9e6d1b.js → App-8a2f85d5.js} +90 -74
- package/cjs/App-8a2f85d5.js.map +1 -0
- package/cjs/{ChangePassword.container-15acbce2.js → ChangePassword.container-efcb1fcd.js} +27 -28
- package/cjs/ChangePassword.container-efcb1fcd.js.map +1 -0
- package/{esm/ToJs-48b1f586.js → cjs/CookieHelper.class-34994aa1.js} +11 -97
- package/cjs/CookieHelper.class-34994aa1.js.map +1 -0
- package/cjs/{RouteLoader-190ac009.js → RouteLoader-4fb33db9.js} +10 -6
- package/cjs/RouteLoader-4fb33db9.js.map +1 -0
- package/cjs/{ContensisDeliveryApi-d63b3d39.js → SSRContext-433c53e4.js} +103 -42
- package/cjs/SSRContext-433c53e4.js.map +1 -0
- package/cjs/ToJs-7f965106.js +128 -0
- package/cjs/ToJs-7f965106.js.map +1 -0
- package/cjs/client.js +20 -20
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +44 -34
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +54 -14
- package/cjs/forms.js.map +1 -1
- package/cjs/redux.js +16 -16
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +13 -4
- package/cjs/routing.js.map +1 -1
- package/cjs/{sagas-e04b94c1.js → sagas-50a16d58.js} +9 -7
- package/cjs/sagas-50a16d58.js.map +1 -0
- package/cjs/search.js +1 -1
- package/cjs/{selectors-8e56cc34.js → selectors-e3f1fd85.js} +240 -3
- package/cjs/selectors-e3f1fd85.js.map +1 -0
- package/cjs/{version-bb4a3418.js → store-665c229b.js} +7 -23
- package/cjs/store-665c229b.js.map +1 -0
- package/cjs/user.js +9 -10
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +14 -10
- package/cjs/util.js.map +1 -1
- package/cjs/{version-c2a37225.js → version-3b05d6c8.js} +17 -17
- package/cjs/{version-c2a37225.js.map → version-3b05d6c8.js.map} +1 -1
- package/cjs/version-7b43af3e.js +20 -0
- package/cjs/version-7b43af3e.js.map +1 -0
- package/esm/{App-b8c75933.js → App-91d81f0c.js} +59 -43
- package/esm/App-91d81f0c.js.map +1 -0
- package/esm/{ChangePassword.container-6a1c60f3.js → ChangePassword.container-96dab474.js} +4 -5
- package/esm/ChangePassword.container-96dab474.js.map +1 -0
- package/{cjs/ToJs-374a7fbd.js → esm/CookieHelper.class-6d649751.js} +5 -129
- package/esm/CookieHelper.class-6d649751.js.map +1 -0
- package/esm/{RouteLoader-487b5a9b.js → RouteLoader-94ca1c51.js} +10 -6
- package/esm/RouteLoader-94ca1c51.js.map +1 -0
- package/esm/{ContensisDeliveryApi-7b71bb3e.js → SSRContext-88841734.js} +95 -41
- package/esm/SSRContext-88841734.js.map +1 -0
- package/esm/ToJs-67b34be1.js +98 -0
- package/esm/ToJs-67b34be1.js.map +1 -0
- package/esm/client.js +18 -18
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +31 -21
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +54 -14
- package/esm/forms.js.map +1 -1
- package/esm/redux.js +7 -7
- package/esm/routing.js +13 -4
- package/esm/routing.js.map +1 -1
- package/esm/{sagas-933a8fc8.js → sagas-cf693497.js} +9 -7
- package/esm/sagas-cf693497.js.map +1 -0
- package/esm/search.js +2 -2
- package/esm/selectors-d2bdfe22.js +396 -0
- package/esm/selectors-d2bdfe22.js.map +1 -0
- package/esm/{version-f6660b69.js → store-f524c50d.js} +4 -16
- package/esm/store-f524c50d.js.map +1 -0
- package/esm/user.js +7 -8
- package/esm/user.js.map +1 -1
- package/esm/util.js +6 -5
- package/esm/util.js.map +1 -1
- package/esm/version-7f50b694.js +15 -0
- package/esm/version-7f50b694.js.map +1 -0
- package/esm/{version-5a0b9406.js → version-dcc28b32.js} +3 -3
- package/esm/{version-5a0b9406.js.map → version-dcc28b32.js.map} +1 -1
- package/models/app/App.d.ts +1 -1
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
- package/models/client/client.d.ts +1 -1
- package/models/index.d.ts +1 -2
- package/models/models/AppRouteProps.d.ts +11 -0
- package/models/{redux/appstate.d.ts → models/AppState.d.ts} +1 -1
- package/models/models/ContentTypeMapping.d.ts +29 -0
- package/models/models/EntryMapper.d.ts +3 -0
- package/models/models/GetRouteActionArgs.d.ts +15 -0
- package/models/models/ReduxInjector.d.ts +5 -0
- package/models/models/RequireLogin.d.ts +6 -0
- package/models/models/RouteComponent.d.ts +2 -0
- package/models/models/RouteComponentProps.d.ts +9 -0
- package/models/models/RouteLoaderProps.d.ts +6 -0
- package/models/models/RouteNode.d.ts +5 -0
- package/models/models/SSRContext.d.ts +11 -0
- package/models/models/StaticRoute.d.ts +28 -0
- package/models/models/WithEvents.d.ts +29 -0
- package/models/models/config/AppConfig.d.ts +12 -0
- package/models/{config.d.ts → models/config/ServerConfig.d.ts} +2 -12
- package/models/models/config/StateType.d.ts +1 -0
- package/models/models/config/index.d.ts +3 -0
- package/models/models/index.d.ts +15 -0
- package/models/redux/sagas/navigation.d.ts +1 -3
- package/models/redux/store/injectors.d.ts +4 -4
- package/models/redux/store/store.d.ts +1 -2
- package/models/routing/components/RouteLoader.d.ts +1 -1
- package/models/routing/redux/actions.d.ts +2 -3
- package/models/routing/redux/selectors.d.ts +2 -2
- package/models/routing/util/find-contenttype-mapping.d.ts +1 -1
- package/models/routing/util/queries.d.ts +2 -2
- package/models/search/models/Queries.d.ts +2 -1
- package/models/search/models/Search.d.ts +3 -0
- package/models/search/search/ContensisDeliveryApi.d.ts +2 -2
- package/models/server/features/caching/cacheDuration.schema.d.ts +1 -0
- package/models/server/features/linkdepth-api/search.d.ts +1 -1
- package/models/server/internalServer.d.ts +1 -1
- package/models/server/util/bundles.d.ts +1 -1
- package/models/server/util/headers.d.ts +1 -1
- package/models/server/webApp.d.ts +1 -1
- package/models/user/redux/selectors.d.ts +1 -2
- package/models/user/util/matchGroups.d.ts +1 -1
- package/models/util/CachedDeliveryApi.d.ts +11 -10
- package/models/util/ContensisDeliveryApi.d.ts +9 -6
- package/models/util/SSRContext.d.ts +30 -0
- package/models/util/index.d.ts +1 -0
- package/models/util/json-mapper.d.ts +1 -2
- package/package.json +3 -3
- package/cjs/App-4c9e6d1b.js.map +0 -1
- package/cjs/ChangePassword.container-15acbce2.js.map +0 -1
- package/cjs/ContensisDeliveryApi-d63b3d39.js.map +0 -1
- package/cjs/CookieConstants-000427db.js +0 -10
- package/cjs/CookieConstants-000427db.js.map +0 -1
- package/cjs/RouteLoader-190ac009.js.map +0 -1
- package/cjs/ToJs-374a7fbd.js.map +0 -1
- package/cjs/reducers-ea1b2dc0.js +0 -236
- package/cjs/reducers-ea1b2dc0.js.map +0 -1
- package/cjs/sagas-e04b94c1.js.map +0 -1
- package/cjs/selectors-8e56cc34.js.map +0 -1
- package/cjs/version-bb4a3418.js.map +0 -1
- package/esm/App-b8c75933.js.map +0 -1
- package/esm/ChangePassword.container-6a1c60f3.js.map +0 -1
- package/esm/ContensisDeliveryApi-7b71bb3e.js.map +0 -1
- package/esm/CookieConstants-3d3b6531.js +0 -6
- package/esm/CookieConstants-3d3b6531.js.map +0 -1
- package/esm/RouteLoader-487b5a9b.js.map +0 -1
- package/esm/ToJs-48b1f586.js.map +0 -1
- package/esm/reducers-919da5e0.js +0 -213
- package/esm/reducers-919da5e0.js.map +0 -1
- package/esm/sagas-933a8fc8.js.map +0 -1
- package/esm/selectors-1f0cc787.js +0 -182
- package/esm/selectors-1f0cc787.js.map +0 -1
- package/esm/version-f6660b69.js.map +0 -1
- package/models/routing/routes.d.ts +0 -127
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
|
-
import { useCookies } from 'react-cookie';
|
|
3
2
|
import { connect } from 'react-redux';
|
|
4
3
|
import { hot } from 'react-hot-loader';
|
|
5
4
|
import { Route, useLocation, Redirect } from 'react-router-dom';
|
|
6
5
|
import { matchRoutes, renderRoutes } from 'react-router-config';
|
|
7
6
|
import { createSelector } from 'reselect';
|
|
8
|
-
import {
|
|
9
|
-
import { a as selectUserIsAuthenticated, b as selectUserGroups, t as toJS,
|
|
7
|
+
import { H as selectRouteEntryContentTypeId, b as selectRouteEntry, I as selectRouteIsError, J as selectIsNotFound, K as selectRouteLoading, m as selectMappedEntry, c as selectCurrentProject, L as selectCurrentPath, M as selectRouteStatusCode, N as selectRouteErrorMessage, O as setNavigationPath } from './selectors-d2bdfe22.js';
|
|
8
|
+
import { a as selectUserIsAuthenticated, b as selectUserGroups, t as toJS, m as matchUserGroup } from './ToJs-67b34be1.js';
|
|
9
|
+
import { u as useSSRContext } from './SSRContext-88841734.js';
|
|
10
10
|
|
|
11
11
|
const NotFound = ({
|
|
12
12
|
statusCode,
|
|
@@ -72,7 +72,11 @@ const RouteLoader = ({
|
|
|
72
72
|
trailingSlashRedirectCode = 302
|
|
73
73
|
}) => {
|
|
74
74
|
const location = useLocation();
|
|
75
|
-
|
|
75
|
+
|
|
76
|
+
// In SSR pass references to things in backing sagas
|
|
77
|
+
// we cannot access in a global scope
|
|
78
|
+
const ssrContext = useSSRContext();
|
|
79
|
+
|
|
76
80
|
// Always ensure paths are trimmed of trailing slashes so urls are always unique
|
|
77
81
|
const trimmedPath = getTrimmedPath(location.pathname);
|
|
78
82
|
|
|
@@ -110,7 +114,7 @@ const RouteLoader = ({
|
|
|
110
114
|
serverPath = (_route$path2 = route.path) === null || _route$path2 === void 0 ? void 0 : _route$path2.split('/').filter(p => !p.startsWith(':')).join('/');
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
|
-
setNavigationPath(serverPath || trimmedPath, location, staticRoute, withEvents, statePath, routes,
|
|
117
|
+
setNavigationPath(serverPath || trimmedPath, location, staticRoute, withEvents, statePath, routes, ssrContext);
|
|
114
118
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
119
|
}, [setNavigationPath,
|
|
116
120
|
// staticRoute,
|
|
@@ -194,4 +198,4 @@ const mapDispatchToProps = {
|
|
|
194
198
|
var RouteLoader$1 = hot(module)(connect(mapStateToPropsMemoized, mapDispatchToProps)(toJS(RouteLoader)));
|
|
195
199
|
|
|
196
200
|
export { RouteLoader$1 as R };
|
|
197
|
-
//# sourceMappingURL=RouteLoader-
|
|
201
|
+
//# sourceMappingURL=RouteLoader-94ca1c51.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteLoader-94ca1c51.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';\nimport { toJS } from '~/util/ToJs';\nimport { useSSRContext } from '~/util/SSRContext';\n\nimport { Entry } from 'contensis-delivery-api/lib/models';\nimport { AppRootProps, RouteComponentProps, RouteLoaderProps } from '~/models';\n\nconst replaceDoubleSlashRecursive = (path: string) => {\n const nextPath = path.replace(/\\/\\//, '/');\n\n if (nextPath.match(/\\/\\//)) {\n return replaceDoubleSlashRecursive(nextPath);\n }\n\n return nextPath;\n};\n\nconst getTrimmedPath = path => {\n if (path !== '/') {\n const nextPath = replaceDoubleSlashRecursive(path);\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 trailingSlashRedirectCode = 302,\n}: AppRootProps & RouteLoaderProps & IReduxProps) => {\n const location = useLocation();\n\n // In SSR pass references to things in backing sagas\n // we cannot access in a global scope\n const ssrContext = useSSRContext();\n\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] : undefined;\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 if (route.fetchNode?.params) {\n const fetchNodeParams: string[] = route.fetchNode.params;\n const routeParams: { [key: string]: string } = match.params;\n\n const regexExp = new RegExp(\n Object.keys(routeParams)\n .map(p => `:${p}`)\n .join('|'),\n 'g'\n );\n\n serverPath = match.path\n .replace(/\\?/g, '')\n .replace(regexExp, matched => {\n const param = matched.replace(':', '');\n if (fetchNodeParams.includes(param)) return routeParams[param];\n else return '';\n })\n .replace(/\\/$/, '');\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 ssrContext\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 (\n <Status code={trailingSlashRedirectCode}>\n <Redirect to={`${trimmedPath}${location.search}${location.hash}`} />\n </Status>\n );\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 console.info(\n `RouteLoader rendering NotFound component: statusCode ${statusCode}, isNotFound ${isNotFound}, isError ${isError}`\n );\n\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\nconst mapDispatchToProps = {\n setNavigationPath,\n};\n\nexport default hot(module)(\n connect(mapStateToPropsMemoized, mapDispatchToProps)(toJS(RouteLoader as any))\n) as unknown as (props: AppRootProps & RouteLoaderProps) => JSX.Element;\n"],"names":["NotFound","statusCode","statusText","React","createElement","Fragment","style","background","color","fontSize","padding","Status","code","children","Route","render","staticContext","replaceDoubleSlashRecursive","path","nextPath","replace","match","getTrimmedPath","lastChar","length","substring","RouteLoader","contentTypeId","entry","isError","isLoading","isLoggedIn","isNotFound","loadingComponent","mappedEntry","notFoundComponent","projectId","routes","setNavigationPath","statePath","userGroups","withEvents","trailingSlashRedirectCode","location","useLocation","ssrContext","useSSRContext","trimmedPath","pathname","matchedStaticRoute","matchRoutes","StaticRoutes","isStaticRoute","staticRoute","undefined","routeRequiresLogin","route","requireLogin","setPath","useCallback","serverPath","isExact","_route$path","_route$fetchNode","includes","url","fetchNodeLevel","split","splice","join","fetchNode","params","fetchNodeParams","routeParams","regexExp","RegExp","Object","keys","map","p","matched","param","_route$path2","filter","startsWith","window","useEffect","Redirect","to","search","hash","matchUserGroup","renderRoutes","LoadingComponent","MatchedComponent","ContentTypeMappings","find","item","contentTypeID","component","NotFoundComponent","console","info","mapStateToPropsMemoized","createSelector","selectRouteEntryContentTypeId","selectRouteEntry","selectRouteIsError","selectIsNotFound","selectRouteLoading","selectUserIsAuthenticated","selectMappedEntry","selectCurrentProject","selectCurrentPath","selectRouteStatusCode","selectRouteErrorMessage","selectUserGroups","mapDispatchToProps","hot","module","connect","toJS"],"mappings":";;;;;;;;;;AAEA,MAAMA,QAAQ,GAAGA,CAAC;EAChBC,UAAU;AACVC,EAAAA,UAAAA;AAIF,CAAC,kBACCC,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EACEF,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CACED,QAAAA,EAAAA,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAAKH,IAAAA,EAAAA,IAAAA,EAAAA,UAAU,IAAI,KAAK,EAAC,iBAAe,CAAK,EAC5CC,UAAU,iBACTC,KAAA,CAAAC,aAAA,CAAA,IAAA,EAAA;AACEE,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M6E,kBAAkB,GAAG;AACzB/E,EAAAA,iBAAAA;AACF,CAAC,CAAA;AAED,oBAAegF,GAAG,CAACC,MAAM,CAAC,CACxBC,OAAO,CAACjB,uBAAuB,EAAEc,kBAAkB,CAAC,CAACI,IAAI,CAAC/F,WAAW,CAAQ,CAAC,CAC/E;;;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import React, { useState, useContext, createContext } from 'react';
|
|
2
|
+
import { useCookies } from 'react-cookie';
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
1
4
|
import { Client } from 'contensis-delivery-api';
|
|
2
5
|
import { parse } from 'query-string';
|
|
3
|
-
import {
|
|
4
|
-
import { r as reduxStore } from './
|
|
5
|
-
import { f as findLoginCookies } from './
|
|
6
|
+
import { P as setSurrogateKeys, Q as selectCurrentHostname, L as selectCurrentPath, e as selectCurrentSearch } from './selectors-d2bdfe22.js';
|
|
7
|
+
import { r as reduxStore } from './store-f524c50d.js';
|
|
8
|
+
import { f as findLoginCookies, a as CookieHelper } from './CookieHelper.class-6d649751.js';
|
|
6
9
|
|
|
7
10
|
class CacheNode {
|
|
8
11
|
constructor(key, value) {
|
|
@@ -77,52 +80,60 @@ class LruCache {
|
|
|
77
80
|
|
|
78
81
|
// CachedSearch does not cache results in SSR by design
|
|
79
82
|
class CachedSearch {
|
|
80
|
-
constructor(
|
|
83
|
+
constructor(ssr) {
|
|
84
|
+
var _this$ssr;
|
|
81
85
|
this.cache = new LruCache();
|
|
82
86
|
this.cookies = void 0;
|
|
83
|
-
this.
|
|
87
|
+
this.ssr = void 0;
|
|
88
|
+
this.ssr = ssr;
|
|
89
|
+
this.cookies = (_this$ssr = this.ssr) === null || _this$ssr === void 0 ? void 0 : _this$ssr.cookies.raw;
|
|
84
90
|
}
|
|
85
91
|
getClient(...args) {
|
|
86
|
-
return new DeliveryApi(this.
|
|
92
|
+
return new DeliveryApi(this.ssr).getClient(...args);
|
|
87
93
|
}
|
|
88
94
|
search(query, linkDepth = 0, project) {
|
|
89
|
-
const client = Client.create(getClientConfig(project, this.
|
|
95
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
90
96
|
return this.request(`${project}+${JSON.stringify(query)}+${linkDepth}`, () => client.entries.search(query, linkDepth));
|
|
91
97
|
}
|
|
92
98
|
searchUsingPost(query, linkDepth = 0, project = '') {
|
|
93
|
-
const client = Client.create(getClientConfig(project, this.
|
|
99
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
94
100
|
return this.request(`${project}+${JSON.stringify(query)}+${linkDepth}`, () => client.entries.searchUsingPost(query, linkDepth));
|
|
95
101
|
}
|
|
96
102
|
get(id, linkDepth = 0, versionStatus = 'published', project) {
|
|
97
|
-
const client = Client.create(
|
|
98
|
-
|
|
103
|
+
const client = Client.create({
|
|
104
|
+
...getClientConfig(project, this.ssr),
|
|
105
|
+
versionStatus
|
|
106
|
+
});
|
|
99
107
|
return this.request(id, () => client.entries.get({
|
|
100
108
|
id,
|
|
101
109
|
linkDepth
|
|
102
110
|
}));
|
|
103
111
|
}
|
|
104
112
|
getContentType(id, project) {
|
|
105
|
-
const client = Client.create(getClientConfig(project, this.
|
|
113
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
106
114
|
return this.request(`[CONTENT TYPE] ${id} ${project}`, () => client.contentTypes.get(id));
|
|
107
115
|
}
|
|
108
|
-
getRootNode(options, project) {
|
|
109
|
-
const client = Client.create(
|
|
116
|
+
getRootNode(options, versionStatus = 'published', project) {
|
|
117
|
+
const client = Client.create({
|
|
118
|
+
...getClientConfig(project, this.ssr),
|
|
119
|
+
versionStatus
|
|
120
|
+
});
|
|
110
121
|
return this.request(`${project} / ${JSON.stringify(options)}`, () => client.nodes.getRoot(options));
|
|
111
122
|
}
|
|
112
123
|
getNode(options, project) {
|
|
113
|
-
const client = Client.create(getClientConfig(project, this.
|
|
124
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
114
125
|
return this.request(`${project} ${options && typeof options !== 'string' ? 'path' in options ? options.path : options.id : options} ${JSON.stringify(options)}`, () => client.nodes.get(options));
|
|
115
126
|
}
|
|
116
127
|
getAncestors(options, project) {
|
|
117
|
-
const client = Client.create(getClientConfig(project, this.
|
|
128
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
118
129
|
return this.request(`${project} [A] ${options && typeof options !== 'string' && options.id || options} ${JSON.stringify(options)}`, () => client.nodes.getAncestors(options));
|
|
119
130
|
}
|
|
120
131
|
getChildren(options, project) {
|
|
121
|
-
const client = Client.create(getClientConfig(project, this.
|
|
132
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
122
133
|
return this.request(`${project} [C] ${options && typeof options !== 'string' && options.id || options} ${JSON.stringify(options)}`, () => client.nodes.getChildren(options));
|
|
123
134
|
}
|
|
124
135
|
getSiblings(options, project) {
|
|
125
|
-
const client = Client.create(getClientConfig(project, this.
|
|
136
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
126
137
|
return this.request(`${project} [S] ${options && typeof options !== 'string' && options.id || options} ${JSON.stringify(options)}`, () => client.nodes.getSiblings(options));
|
|
127
138
|
}
|
|
128
139
|
request(key, execute) {
|
|
@@ -138,7 +149,7 @@ class CachedSearch {
|
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
const cachedSearch = new CachedSearch();
|
|
141
|
-
const cachedSearchWithCookies =
|
|
152
|
+
const cachedSearchWithCookies = ssr => new CachedSearch(ssr);
|
|
142
153
|
|
|
143
154
|
const mapCookieHeader = cookies => typeof cookies === 'object' ? Object.entries(cookies).map(([name, value]) => `${name}=${value}`).join('; ') : cookies;
|
|
144
155
|
const getSsrReferer = () => {
|
|
@@ -149,15 +160,16 @@ const getSsrReferer = () => {
|
|
|
149
160
|
}
|
|
150
161
|
return '';
|
|
151
162
|
};
|
|
152
|
-
const storeSurrogateKeys = response => {
|
|
163
|
+
const storeSurrogateKeys = ssr => response => {
|
|
153
164
|
let keys = '';
|
|
154
165
|
if (response.status === 200) {
|
|
155
166
|
keys = response.headers.get ? response.headers.get('surrogate-key') : response.headers.map['surrogate-key'];
|
|
156
167
|
if (!keys) console.info(`[storeSurrogateKeys] No keys in ${response.url}`);
|
|
157
168
|
}
|
|
158
|
-
|
|
169
|
+
const put = (ssr === null || ssr === void 0 ? void 0 : ssr.dispatch) || (reduxStore === null || reduxStore === void 0 ? void 0 : reduxStore.dispatch);
|
|
170
|
+
put === null || put === void 0 ? void 0 : put(setSurrogateKeys(keys, response.url, response.status));
|
|
159
171
|
};
|
|
160
|
-
const deliveryApiConfig =
|
|
172
|
+
const deliveryApiConfig = ssr => {
|
|
161
173
|
const config = {
|
|
162
174
|
...DELIVERY_API_CONFIG /* global DELIVERY_API_CONFIG */
|
|
163
175
|
};
|
|
@@ -170,7 +182,7 @@ const deliveryApiConfig = () => {
|
|
|
170
182
|
|
|
171
183
|
if (reduxStore) config.defaultHeaders.referer = getSsrReferer();
|
|
172
184
|
config.responseHandler = {
|
|
173
|
-
[
|
|
185
|
+
[200]: storeSurrogateKeys(ssr)
|
|
174
186
|
};
|
|
175
187
|
}
|
|
176
188
|
if (typeof window !== 'undefined' && PROXY_DELIVERY_API /* global PROXY_DELIVERY_API */) {
|
|
@@ -182,13 +194,13 @@ const deliveryApiConfig = () => {
|
|
|
182
194
|
}
|
|
183
195
|
return config;
|
|
184
196
|
};
|
|
185
|
-
const getClientConfig = (project,
|
|
186
|
-
const config = deliveryApiConfig();
|
|
197
|
+
const getClientConfig = (project, ssr) => {
|
|
198
|
+
const config = deliveryApiConfig(ssr);
|
|
187
199
|
if (project) {
|
|
188
200
|
config.projectId = project;
|
|
189
201
|
}
|
|
190
|
-
if (cookies) {
|
|
191
|
-
const cookieHeader = mapCookieHeader(findLoginCookies(cookies));
|
|
202
|
+
if (ssr !== null && ssr !== void 0 && ssr.cookies) {
|
|
203
|
+
const cookieHeader = mapCookieHeader(findLoginCookies(ssr.cookies));
|
|
192
204
|
if (cookieHeader) {
|
|
193
205
|
config.defaultHeaders = Object.assign(config.defaultHeaders || {}, {
|
|
194
206
|
Cookie: cookieHeader
|
|
@@ -201,8 +213,9 @@ const getClientConfig = (project, cookies) => {
|
|
|
201
213
|
// export * from 'contensis-delivery-api';
|
|
202
214
|
|
|
203
215
|
class DeliveryApi {
|
|
204
|
-
constructor(
|
|
216
|
+
constructor(ssr) {
|
|
205
217
|
this.cookies = void 0;
|
|
218
|
+
this.ssr = void 0;
|
|
206
219
|
this.getClientSideVersionStatus = () => {
|
|
207
220
|
if (typeof window !== 'undefined') {
|
|
208
221
|
// Allow overriding versionStatus with the querystring
|
|
@@ -243,29 +256,70 @@ class DeliveryApi {
|
|
|
243
256
|
return 'published';
|
|
244
257
|
};
|
|
245
258
|
this.search = (query, linkDepth = 0, project) => {
|
|
246
|
-
const client = Client.create(getClientConfig(project, this.
|
|
259
|
+
const client = Client.create(getClientConfig(project, this.ssr));
|
|
247
260
|
return client.entries.search(query, typeof linkDepth !== 'undefined' ? linkDepth : 1);
|
|
248
261
|
};
|
|
249
|
-
this.getClient = (versionStatus = 'published', project) => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
};
|
|
262
|
+
this.getClient = (versionStatus = 'published', project) => Client.create({
|
|
263
|
+
...getClientConfig(project, this.ssr),
|
|
264
|
+
versionStatus
|
|
265
|
+
});
|
|
254
266
|
this.getEntry = (id, linkDepth = 0, versionStatus = 'published', project) => {
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
267
|
+
const client = Client.create({
|
|
268
|
+
...getClientConfig(project, this.ssr),
|
|
269
|
+
versionStatus
|
|
270
|
+
});
|
|
259
271
|
return client.entries.get({
|
|
260
272
|
id,
|
|
261
273
|
linkDepth
|
|
262
274
|
});
|
|
263
275
|
};
|
|
264
|
-
this.
|
|
276
|
+
this.ssr = ssr;
|
|
277
|
+
this.cookies = ssr === null || ssr === void 0 ? void 0 : ssr.cookies.raw;
|
|
265
278
|
}
|
|
266
279
|
}
|
|
267
280
|
const deliveryApi = new DeliveryApi();
|
|
268
|
-
const deliveryApiWithCookies =
|
|
281
|
+
const deliveryApiWithCookies = ssr => new DeliveryApi(ssr);
|
|
282
|
+
|
|
283
|
+
const SSRContext = /*#__PURE__*/createContext(null);
|
|
284
|
+
|
|
285
|
+
/** SSRContextProvider allows us to hold and access request-scoped references
|
|
286
|
+
* throughout the component tree
|
|
287
|
+
*
|
|
288
|
+
* adding this in client side allows consumers to write universal code and use
|
|
289
|
+
* the same helpers and refs as in SSR */
|
|
290
|
+
const SSRContextProvider = ({
|
|
291
|
+
children,
|
|
292
|
+
request,
|
|
293
|
+
response
|
|
294
|
+
}) => {
|
|
295
|
+
// In SSR pass references to things in backing sagas
|
|
296
|
+
// we cannot access in a global scope
|
|
297
|
+
const dispatch = useDispatch();
|
|
298
|
+
const cookies = new CookieHelper(...useCookies());
|
|
299
|
+
const api = cachedSearchWithCookies({
|
|
300
|
+
cookies,
|
|
301
|
+
dispatch
|
|
302
|
+
});
|
|
303
|
+
const [context] = useState({
|
|
304
|
+
api,
|
|
305
|
+
cookies,
|
|
306
|
+
dispatch,
|
|
307
|
+
request,
|
|
308
|
+
response
|
|
309
|
+
});
|
|
310
|
+
return /*#__PURE__*/React.createElement(SSRContext.Provider, {
|
|
311
|
+
value: {
|
|
312
|
+
...context
|
|
313
|
+
}
|
|
314
|
+
}, children);
|
|
315
|
+
};
|
|
316
|
+
const useSSRContext = () => useContext(SSRContext);
|
|
317
|
+
const useDeliveryApi = () => {
|
|
318
|
+
const {
|
|
319
|
+
api
|
|
320
|
+
} = useSSRContext();
|
|
321
|
+
return api;
|
|
322
|
+
};
|
|
269
323
|
|
|
270
|
-
export { cachedSearchWithCookies as a, deliveryApiWithCookies as b, cachedSearch as c, deliveryApi as d, getClientConfig as g };
|
|
271
|
-
//# sourceMappingURL=
|
|
324
|
+
export { SSRContextProvider as S, cachedSearchWithCookies as a, deliveryApiWithCookies as b, cachedSearch as c, deliveryApi as d, useDeliveryApi as e, getClientConfig as g, useSSRContext as u };
|
|
325
|
+
//# sourceMappingURL=SSRContext-88841734.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSRContext-88841734.js","sources":["../src/util/LruCache.js","../src/util/CachedDeliveryApi.ts","../src/util/ContensisDeliveryApi.ts","../src/util/SSRContext.tsx"],"sourcesContent":["class CacheNode {\n constructor(key, value) {\n this.key = key;\n this.value = value;\n this.next = null;\n this.prev = null;\n }\n}\n\nexport class LruCache {\n constructor(limit = 100) {\n this.map = {};\n this.head = null;\n this.tail = null;\n this.limit = limit || 100;\n this.size = 0;\n }\n\n get(key) {\n if (this.map[key]) {\n let value = this.map[key].value;\n let node = new CacheNode(key, value);\n this.remove(key);\n this.setHead(node);\n return value;\n }\n }\n\n set(key, value) {\n let node = new CacheNode(key, value);\n if (this.map[key]) {\n this.remove(key);\n } else {\n if (this.size >= this.limit) {\n delete this.map[this.tail.key];\n this.size--;\n this.tail = this.tail.prev;\n this.tail.next = null;\n }\n }\n this.setHead(node);\n }\n\n setHead(node) {\n node.next = this.head;\n node.prev = null;\n if (this.head) {\n this.head.prev = node;\n }\n this.head = node;\n if (!this.tail) {\n this.tail = node;\n }\n this.size++;\n this.map[node.key] = node;\n }\n\n remove(key) {\n let node = this.map[key];\n if (!node) return; // This is sometimes null and crashes the container without this check\n\n if (node.prev) {\n node.prev.next = node.next;\n } else {\n this.head = node.next;\n }\n if (node.next) {\n node.next.prev = node.prev;\n } else {\n this.tail = node.prev;\n }\n delete this.map[key];\n this.size--;\n }\n}\n","import { VersionStatus } from 'contensis-core-api';\nimport { Client, Query } from 'contensis-delivery-api';\nimport {\n INodeOperations,\n NodeGetRootOptions,\n} from 'contensis-delivery-api/lib/models';\n\nimport {\n DeliveryApi,\n SSRContext,\n getClientConfig,\n} from './ContensisDeliveryApi';\nimport { LruCache } from './LruCache';\nimport { CookieObject } from '~/user/util/CookieConstants';\n\n// CachedSearch does not cache results in SSR by design\nclass CachedSearch {\n cache = new LruCache();\n cookies?: CookieObject;\n ssr?: SSRContext;\n\n constructor(ssr?: SSRContext) {\n this.ssr = ssr;\n this.cookies = this.ssr?.cookies.raw;\n }\n\n getClient(...args: Parameters<DeliveryApi['getClient']>) {\n return new DeliveryApi(this.ssr).getClient(...args);\n }\n\n search(query: Query, linkDepth = 0, project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project}+${JSON.stringify(query)}+${linkDepth}`,\n () => client.entries.search(query, linkDepth)\n );\n }\n\n searchUsingPost(query: Query, linkDepth = 0, project = '') {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project}+${JSON.stringify(query)}+${linkDepth}`,\n () => (client.entries as any).searchUsingPost(query, linkDepth)\n );\n }\n\n get(\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return this.request(id, () => client.entries.get({ id, linkDepth }));\n }\n\n getContentType(id: string, project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(`[CONTENT TYPE] ${id} ${project}`, () =>\n client.contentTypes.get(id)\n );\n }\n\n getRootNode(\n options: NodeGetRootOptions,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return this.request(`${project} / ${JSON.stringify(options)}`, () =>\n client.nodes.getRoot(options)\n );\n }\n\n getNode(options: Parameters<INodeOperations['get']>[0], project?: string) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} ${\n options && typeof options !== 'string'\n ? 'path' in options\n ? options.path\n : options.id\n : options\n } ${JSON.stringify(options)}`,\n () => client.nodes.get(options)\n );\n }\n\n getAncestors(\n options: Parameters<INodeOperations['getAncestors']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [A] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getAncestors(options)\n );\n }\n\n getChildren(\n options: Parameters<INodeOperations['getChildren']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [C] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getChildren(options)\n );\n }\n\n getSiblings(\n options: Parameters<INodeOperations['getSiblings']>[0],\n project?: string\n ) {\n const client = Client.create(getClientConfig(project, this.ssr));\n return this.request(\n `${project} [S] ${\n (options && typeof options !== 'string' && options.id) || options\n } ${JSON.stringify(options)}`,\n () => client.nodes.getSiblings(options)\n );\n }\n\n request<T extends () => Promise<any>>(key: string, execute: T) {\n // do not cache results in SSR\n if (!this.cache.get(key) || typeof window == 'undefined') {\n const promise = execute();\n this.cache.set(key, promise);\n promise.catch(() => {\n this.cache.remove(key);\n });\n }\n return this.cache.get(key) as ReturnType<T>;\n }\n}\n\nexport const cachedSearch = new CachedSearch();\nexport const cachedSearchWithCookies = (ssr?: SSRContext) =>\n new CachedSearch(ssr);\n","import { VersionStatus } from 'contensis-core-api';\nimport { Client, Query } from 'contensis-delivery-api';\nimport { Config } from 'contensis-delivery-api/lib/models';\nimport { parse } from 'query-string';\nimport { setSurrogateKeys } from '~/routing/redux/actions';\nimport { reduxStore } from '~/redux/store/store';\nimport {\n selectCurrentHostname,\n selectCurrentPath,\n selectCurrentSearch,\n} from '~/routing/redux/selectors';\nimport { CookieObject, findLoginCookies } from '~/user/util/CookieConstants';\nimport { Request } from 'express';\nimport { IncomingHttpHeaders } from 'http';\nimport { SSRContext as SSRContextType } from '~/models';\n\nexport type SSRContext = Omit<SSRContextType, 'api'>;\n\nconst mapCookieHeader = (cookies: CookieObject | string) =>\n typeof cookies === 'object'\n ? Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n : cookies;\n\nconst getSsrReferer = () => {\n if (typeof window === 'undefined') {\n const state = reduxStore.getState();\n const referer = `${selectCurrentHostname(state)}${selectCurrentPath(\n state\n )}${selectCurrentSearch(state)}`;\n\n return referer;\n }\n return '';\n};\n\nconst storeSurrogateKeys = (ssr?: SSRContext) => (response: any) => {\n let keys = '';\n if (response.status === 200) {\n keys = response.headers.get\n ? response.headers.get('surrogate-key')\n : response.headers.map['surrogate-key'];\n if (!keys) console.info(`[storeSurrogateKeys] No keys in ${response.url}`);\n }\n const put = ssr?.dispatch || reduxStore?.dispatch;\n put?.(setSurrogateKeys(keys, response.url, response.status));\n};\n\nconst deliveryApiConfig = (ssr?: SSRContext) => {\n const config: Config = {\n ...DELIVERY_API_CONFIG /* global DELIVERY_API_CONFIG */,\n };\n\n if (typeof window === 'undefined') {\n config.defaultHeaders = {\n 'x-require-surrogate-key': 'true',\n 'x-crb-ssr': 'true', // add this for support tracing\n };\n if (reduxStore) config.defaultHeaders.referer = getSsrReferer();\n\n config.responseHandler = { [200]: storeSurrogateKeys(ssr) };\n }\n\n if (\n typeof window !== 'undefined' &&\n PROXY_DELIVERY_API /* global PROXY_DELIVERY_API */\n ) {\n // ensure a relative url is used to bypass the need for CORS (separate OPTIONS calls)\n config.rootUrl = '';\n config.responseHandler = { [404]: () => null };\n }\n return config;\n};\n\nexport const getClientConfig = (project?: string, ssr?: SSRContext) => {\n const config = deliveryApiConfig(ssr);\n\n if (project) {\n config.projectId = project;\n }\n\n if (ssr?.cookies) {\n const cookieHeader = mapCookieHeader(findLoginCookies(ssr.cookies));\n if (cookieHeader) {\n config.defaultHeaders = Object.assign(config.defaultHeaders || {}, {\n Cookie: cookieHeader,\n });\n }\n }\n\n return config;\n};\n\n// export * from 'contensis-delivery-api';\n\ndeclare let window: Window &\n typeof globalThis & {\n versionStatus?: VersionStatus;\n };\n\nexport class DeliveryApi {\n cookies?: CookieObject;\n ssr?: SSRContext;\n\n constructor(ssr?: SSRContext) {\n this.ssr = ssr;\n this.cookies = ssr?.cookies.raw;\n }\n\n getClientSideVersionStatus = () => {\n if (typeof window !== 'undefined') {\n // Allow overriding versionStatus with the querystring\n const { versionStatus } = parse(window.location.search);\n if (versionStatus) return versionStatus;\n // Client-side we will have a global variable set if rendered by SSR in production\n if (typeof window.versionStatus !== 'undefined')\n return window.versionStatus;\n // For localhost development we can only work out versionStatus from the current hostname\n const currentHostname = window.location.hostname;\n return this.getVersionStatusFromHostname(currentHostname);\n }\n return null;\n };\n\n getServerSideVersionStatus = (request: Request) =>\n request.query.versionStatus ||\n deliveryApi.getVersionStatusFromHeaders(request.headers) ||\n deliveryApi.getVersionStatusFromHostname(request.hostname);\n\n getVersionStatusFromHeaders = (headers: IncomingHttpHeaders) => {\n const versionStatusHeader = headers['x-entry-versionstatus'];\n if (typeof versionStatusHeader !== 'undefined') return versionStatusHeader;\n return null;\n };\n\n getVersionStatusFromHostname = (currentHostname: string) => {\n if (currentHostname.indexOf('localhost') > -1) return 'latest';\n\n if (currentHostname.endsWith('contensis.cloud')) {\n if (currentHostname.indexOf('preview.') > -1) {\n return 'latest';\n } else {\n return 'published';\n }\n }\n\n if (currentHostname.endsWith('cloud.contensis.com')) {\n if (currentHostname.indexOf('preview-') > -1) {\n return 'latest';\n } else {\n return 'published';\n }\n }\n\n return 'published';\n };\n\n search = (query: Query, linkDepth = 0, project?: string) => {\n const client = Client.create(getClientConfig(project, this.ssr));\n return client.entries.search(\n query,\n typeof linkDepth !== 'undefined' ? linkDepth : 1\n );\n };\n\n getClient = (versionStatus: VersionStatus = 'published', project?: string) =>\n Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n\n getEntry = (\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) => {\n const client = Client.create({\n ...getClientConfig(project, this.ssr),\n versionStatus,\n });\n return client.entries.get({ id, linkDepth });\n };\n}\n\nexport const deliveryApi = new DeliveryApi();\n\nexport const deliveryApiWithCookies = (ssr?: SSRContext) =>\n new DeliveryApi(ssr);\n\nexport * from './CachedDeliveryApi';\n","import { Request, Response } from 'express';\nimport React, {\n PropsWithChildren,\n createContext,\n useContext,\n useState,\n} from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useDispatch } from 'react-redux';\nimport { SSRContext as SSRContextType } from '~/models';\nimport { cachedSearchWithCookies } from '~/util/CachedDeliveryApi';\nimport { CookieHelper } from '~/user/util/CookieHelper.class';\n\nconst SSRContext = createContext<SSRContextType | null>(null);\n\n/** SSRContextProvider allows us to hold and access request-scoped references\n * throughout the component tree\n *\n * adding this in client side allows consumers to write universal code and use\n * the same helpers and refs as in SSR */\nexport const SSRContextProvider = ({\n children,\n request,\n response,\n}: PropsWithChildren<{ request?: Request; response?: Response }>) => {\n // In SSR pass references to things in backing sagas\n // we cannot access in a global scope\n const dispatch = useDispatch();\n const cookies = new CookieHelper(...useCookies());\n const api = cachedSearchWithCookies({ cookies, dispatch });\n\n const [context] = useState<SSRContextType>({\n api,\n cookies,\n dispatch,\n request,\n response,\n });\n\n return (\n <SSRContext.Provider value={{ ...context }}>{children}</SSRContext.Provider>\n );\n};\n\nexport const useSSRContext = () => useContext(SSRContext) as SSRContextType;\n\nexport const useDeliveryApi = () => {\n const { api } = useSSRContext();\n return api;\n};\n"],"names":["CacheNode","constructor","key","value","next","prev","LruCache","limit","map","head","tail","size","get","node","remove","setHead","set","CachedSearch","ssr","_this$ssr","cache","cookies","raw","getClient","args","DeliveryApi","search","query","linkDepth","project","client","Client","create","getClientConfig","request","JSON","stringify","entries","searchUsingPost","id","versionStatus","getContentType","contentTypes","getRootNode","options","nodes","getRoot","getNode","path","getAncestors","getChildren","getSiblings","execute","window","promise","catch","cachedSearch","cachedSearchWithCookies","mapCookieHeader","Object","name","join","getSsrReferer","state","reduxStore","getState","referer","selectCurrentHostname","selectCurrentPath","selectCurrentSearch","storeSurrogateKeys","response","keys","status","headers","console","info","url","put","dispatch","setSurrogateKeys","deliveryApiConfig","config","DELIVERY_API_CONFIG","defaultHeaders","responseHandler","PROXY_DELIVERY_API","rootUrl","projectId","cookieHeader","findLoginCookies","assign","Cookie","getClientSideVersionStatus","parse","location","currentHostname","hostname","getVersionStatusFromHostname","getServerSideVersionStatus","deliveryApi","getVersionStatusFromHeaders","versionStatusHeader","indexOf","endsWith","getEntry","deliveryApiWithCookies","SSRContext","createContext","SSRContextProvider","children","useDispatch","CookieHelper","useCookies","api","context","useState","React","createElement","Provider","useSSRContext","useContext","useDeliveryApi"],"mappings":";;;;;;;;;AAAA,MAAMA,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,GAAG,EAAEC,KAAK,EAAE;IACtB,IAAI,CAACD,GAAG,GAAGA,GAAG,CAAA;IACd,IAAI,CAACC,KAAK,GAAGA,KAAK,CAAA;IAClB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;AAClB,GAAA;AACF,CAAA;AAEO,MAAMC,QAAQ,CAAC;AACpBL,EAAAA,WAAWA,CAACM,KAAK,GAAG,GAAG,EAAE;AACvB,IAAA,IAAI,CAACC,GAAG,GAAG,EAAE,CAAA;IACb,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;IAChB,IAAI,CAACC,IAAI,GAAG,IAAI,CAAA;AAChB,IAAA,IAAI,CAACH,KAAK,GAAGA,KAAK,IAAI,GAAG,CAAA;IACzB,IAAI,CAACI,IAAI,GAAG,CAAC,CAAA;AACf,GAAA;EAEAC,GAAGA,CAACV,GAAG,EAAE;AACP,IAAA,IAAI,IAAI,CAACM,GAAG,CAACN,GAAG,CAAC,EAAE;MACjB,IAAIC,KAAK,GAAG,IAAI,CAACK,GAAG,CAACN,GAAG,CAAC,CAACC,KAAK,CAAA;MAC/B,IAAIU,IAAI,GAAG,IAAIb,SAAS,CAACE,GAAG,EAAEC,KAAK,CAAC,CAAA;AACpC,MAAA,IAAI,CAACW,MAAM,CAACZ,GAAG,CAAC,CAAA;AAChB,MAAA,IAAI,CAACa,OAAO,CAACF,IAAI,CAAC,CAAA;AAClB,MAAA,OAAOV,KAAK,CAAA;AACd,KAAA;AACF,GAAA;AAEAa,EAAAA,GAA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CAAwB,IAAI,CAAC,CAAA;;AAE7D;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAGA,CAAC;EACjCC,QAAQ;EACR5E,OAAO;AACPqC,EAAAA,QAAAA;AAC6D,CAAC,KAAK;AACnE;AACA;EACA,MAAMQ,QAAQ,GAAGgC,WAAW,EAAE,CAAA;EAC9B,MAAM1F,OAAO,GAAG,IAAI2F,YAAY,CAAC,GAAGC,UAAU,EAAE,CAAC,CAAA;EACjD,MAAMC,GAAG,GAAGzD,uBAAuB,CAAC;IAAEpC,OAAO;AAAE0D,IAAAA,QAAAA;AAAS,GAAC,CAAC,CAAA;AAE1D,EAAA,MAAM,CAACoC,OAAO,CAAC,GAAGC,QAAQ,CAAiB;IACzCF,GAAG;IACH7F,OAAO;IACP0D,QAAQ;IACR7C,OAAO;AACPqC,IAAAA,QAAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,oBACE8C,KAAA,CAAAC,aAAA,CAACX,UAAU,CAACY,QAAQ,EAAA;AAACpH,IAAAA,KAAK,EAAE;MAAE,GAAGgH,OAAAA;AAAQ,KAAA;AAAE,GAAA,EAAEL,QAAQ,CAAuB,CAAA;AAEhF,EAAC;AAEM,MAAMU,aAAa,GAAGA,MAAMC,UAAU,CAACd,UAAU,EAAmB;AAE9De,MAAAA,cAAc,GAAGA,MAAM;EAClC,MAAM;AAAER,IAAAA,GAAAA;GAAK,GAAGM,aAAa,EAAE,CAAA;AAC/B,EAAA,OAAON,GAAG,CAAA;AACZ;;;;"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { g as getImmutableOrJS } from './selectors-d2bdfe22.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
const selectUserIsLoading = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isLoading']);
|
|
5
|
+
const selectUserIsAuthenticated = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticated']);
|
|
6
|
+
const selectUserIsAuthenticationError = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticationError']);
|
|
7
|
+
const selectUserIsError = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isError']);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* DEPRECATED 12/2021 - use selectUserErrorMessage instead
|
|
11
|
+
* @param state AppState
|
|
12
|
+
* @returns string
|
|
13
|
+
*/
|
|
14
|
+
const selectUserAuthenticationErrorMessage = state => getImmutableOrJS(state, ['user', 'authenticationState', 'errorMessage']);
|
|
15
|
+
const selectUserErrorMessage = state => getImmutableOrJS(state, ['user', 'authenticationState', 'errorMessage']);
|
|
16
|
+
const selectClientCredentials = (state, returnType) => getImmutableOrJS(state, ['user', 'authenticationState', 'clientCredentials'], {}, returnType);
|
|
17
|
+
const selectUser = (state, returnType) => getImmutableOrJS(state, 'user', {}, returnType);
|
|
18
|
+
const selectUserIsZengentiStaff = state => getImmutableOrJS(state, ['user', 'isZengentiStaff']);
|
|
19
|
+
const selectUserGuid = state => getImmutableOrJS(state, ['user', 'id']);
|
|
20
|
+
const selectUsername = state => getImmutableOrJS(state, ['user', 'username']);
|
|
21
|
+
const selectUserEmail = state => getImmutableOrJS(state, ['user', 'email']);
|
|
22
|
+
const selectUserGroups = (state, returnType) => getImmutableOrJS(state, ['user', 'groups'], [], returnType);
|
|
23
|
+
const selectUserSecurityToken = state => getImmutableOrJS(state, ['user', 'authenticationState', 'clientCredentials', 'contensisClassicToken']);
|
|
24
|
+
const selectUserRegistration = (state, returnType) => getImmutableOrJS(state, ['user', 'registration'], {}, returnType);
|
|
25
|
+
const selectUserRegistrationError = state => getImmutableOrJS(state, ['user', 'registration', 'error'], false);
|
|
26
|
+
const selectUserRegistrationIsLoading = state => getImmutableOrJS(state, ['user', 'registration', 'isLoading'], false);
|
|
27
|
+
const selectUserRegistrationIsSuccess = state => getImmutableOrJS(state, ['user', 'registration', 'success'], false);
|
|
28
|
+
const selectPasswordResetRequestSending = state => getImmutableOrJS(state, ['user', 'passwordResetRequest', 'isSending']);
|
|
29
|
+
const selectPasswordResetRequestSent = state => getImmutableOrJS(state, ['user', 'passwordResetRequest', 'sent']);
|
|
30
|
+
const selectPasswordResetRequestError = state => getImmutableOrJS(state, ['user', 'passwordResetRequest', 'error']);
|
|
31
|
+
const selectResetPasswordSending = state => getImmutableOrJS(state, ['user', 'resetPassword', 'isSending']);
|
|
32
|
+
const selectResetPasswordSent = state => getImmutableOrJS(state, ['user', 'resetPassword', 'sent']);
|
|
33
|
+
const selectResetPasswordError = state => getImmutableOrJS(state, ['user', 'resetPassword', 'error']);
|
|
34
|
+
const selectChangePasswordSending = state => getImmutableOrJS(state, ['user', 'changePassword', 'isSending']);
|
|
35
|
+
const selectChangePasswordSent = state => getImmutableOrJS(state, ['user', 'changePassword', 'sent']);
|
|
36
|
+
const selectChangePasswordError = state => getImmutableOrJS(state, ['user', 'changePassword', 'error']);
|
|
37
|
+
|
|
38
|
+
var selectors = /*#__PURE__*/Object.freeze({
|
|
39
|
+
__proto__: null,
|
|
40
|
+
selectUserIsLoading: selectUserIsLoading,
|
|
41
|
+
selectUserIsAuthenticated: selectUserIsAuthenticated,
|
|
42
|
+
selectUserIsAuthenticationError: selectUserIsAuthenticationError,
|
|
43
|
+
selectUserIsError: selectUserIsError,
|
|
44
|
+
selectUserAuthenticationErrorMessage: selectUserAuthenticationErrorMessage,
|
|
45
|
+
selectUserErrorMessage: selectUserErrorMessage,
|
|
46
|
+
selectClientCredentials: selectClientCredentials,
|
|
47
|
+
selectUser: selectUser,
|
|
48
|
+
selectUserIsZengentiStaff: selectUserIsZengentiStaff,
|
|
49
|
+
selectUserGuid: selectUserGuid,
|
|
50
|
+
selectUsername: selectUsername,
|
|
51
|
+
selectUserEmail: selectUserEmail,
|
|
52
|
+
selectUserGroups: selectUserGroups,
|
|
53
|
+
selectUserSecurityToken: selectUserSecurityToken,
|
|
54
|
+
selectUserRegistration: selectUserRegistration,
|
|
55
|
+
selectUserRegistrationError: selectUserRegistrationError,
|
|
56
|
+
selectUserRegistrationIsLoading: selectUserRegistrationIsLoading,
|
|
57
|
+
selectUserRegistrationIsSuccess: selectUserRegistrationIsSuccess,
|
|
58
|
+
selectPasswordResetRequestSending: selectPasswordResetRequestSending,
|
|
59
|
+
selectPasswordResetRequestSent: selectPasswordResetRequestSent,
|
|
60
|
+
selectPasswordResetRequestError: selectPasswordResetRequestError,
|
|
61
|
+
selectResetPasswordSending: selectResetPasswordSending,
|
|
62
|
+
selectResetPasswordSent: selectResetPasswordSent,
|
|
63
|
+
selectResetPasswordError: selectResetPasswordError,
|
|
64
|
+
selectChangePasswordSending: selectChangePasswordSending,
|
|
65
|
+
selectChangePasswordSent: selectChangePasswordSent,
|
|
66
|
+
selectChangePasswordError: selectChangePasswordError
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const matchUserGroup = (userGroups = [], requiredGroups = []) => {
|
|
70
|
+
if (!Array.isArray(requiredGroups) || Array.isArray(requiredGroups) && requiredGroups.length === 0) return true;
|
|
71
|
+
const groupMatch = requiredGroups.some(requiredGroup => {
|
|
72
|
+
return userGroups.some(userGroup => {
|
|
73
|
+
if (requiredGroup.id === userGroup.id) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (requiredGroup.name === userGroup.name) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
return groupMatch;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/* eslint-disable react/display-name */
|
|
85
|
+
const toJS = WrappedComponent => wrappedComponentProps => {
|
|
86
|
+
const KEY = 0;
|
|
87
|
+
const VALUE = 1;
|
|
88
|
+
const propsJS = Object.entries(wrappedComponentProps).reduce((newProps, wrappedComponentProp) => {
|
|
89
|
+
const propKey = wrappedComponentProp[KEY];
|
|
90
|
+
const propValue = wrappedComponentProp[VALUE];
|
|
91
|
+
newProps[propKey] = propValue && typeof propValue === 'object' && 'toJS' in propValue ? propValue.toJS() : propValue;
|
|
92
|
+
return newProps;
|
|
93
|
+
}, {});
|
|
94
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, propsJS);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { selectUserIsAuthenticated as a, selectUserGroups as b, selectUserErrorMessage as c, selectUserIsAuthenticationError as d, selectUserIsError as e, selectUserIsLoading as f, selectUser as g, selectUserRegistrationError as h, selectUserRegistrationIsLoading as i, selectUserRegistrationIsSuccess as j, selectUserRegistration as k, selectPasswordResetRequestSending as l, matchUserGroup as m, selectPasswordResetRequestSent as n, selectPasswordResetRequestError as o, selectResetPasswordSending as p, selectResetPasswordSent as q, selectResetPasswordError as r, selectClientCredentials as s, toJS as t, selectChangePasswordSending as u, selectChangePasswordSent as v, selectUserGuid as w, selectChangePasswordError as x, selectors as y };
|
|
98
|
+
//# sourceMappingURL=ToJs-67b34be1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToJs-67b34be1.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { AppState, StateType } from '~/models';\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 '~/models';\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 ) =>\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","createElement"],"mappings":";;;MAGaA,mBAAmB,GAAIC,KAAe,IACjDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,CAAC,EAAC;MAE/CE,yBAAyB,GAAIF,KAAe,IACvDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAC;MAErDG,+BAA+B,GAAIH,KAAe,IAC7DC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,CAAC,EAAC;MAE3DI,iBAAiB,GAAIJ,KAAe,IAC/CC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,SAAS,CAAC,EAAC;;AAE1D;AACA;AACA;AACA;AACA;AACO,MAAMK,oCAAoC,GAAIL,KAAe,IAClEC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAA;MAElDM,sBAAsB,GAAIN,KAAe,IACpDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,EAAC;AAExD,MAAMO,uBAAuB,GAAGA,CACrCP,KAAe,EACfQ,UAAsB,KAEtBP,gBAAK,CACHD,KAAK,EACL,CAAC,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,CAAC,EACpD,EAAE,EACFQ,UAAU,EACX;MAEUC,UAAU,GAAGA,CAACT,KAAe,EAAEQ,UAAsB,KAChEP,gBAAK,CAACD,KAAK,EAAE,MAAM,EAAE,EAAE,EAAEQ,UAAU,EAAC;AAE/B,MAAME,yBAAyB,GAAIV,KAAe,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 import { Router } from 'react-router-dom';
|
|
|
7
7
|
import { loadableReady } from '@loadable/component';
|
|
8
8
|
import { parse } from 'query-string';
|
|
9
9
|
import { CookiesProvider } from 'react-cookie';
|
|
10
|
-
import {
|
|
11
|
-
import { s as setVersionStatus } from './version-
|
|
12
|
-
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-
|
|
13
|
-
export { A as ReactApp } from './App-
|
|
14
|
-
import { c as
|
|
15
|
-
import { d as
|
|
16
|
-
import '
|
|
17
|
-
import 'redux-thunk';
|
|
18
|
-
import 'redux-saga';
|
|
19
|
-
import 'redux-injectors';
|
|
20
|
-
import 'immer';
|
|
21
|
-
import './reducers-919da5e0.js';
|
|
10
|
+
import { s as selectVersionStatus } from './version-7f50b694.js';
|
|
11
|
+
import { s as setVersionStatus } from './version-dcc28b32.js';
|
|
12
|
+
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-91d81f0c.js';
|
|
13
|
+
export { A as ReactApp } from './App-91d81f0c.js';
|
|
14
|
+
import { c as createStore } from './store-f524c50d.js';
|
|
15
|
+
import { d as setCurrentProject } from './selectors-d2bdfe22.js';
|
|
16
|
+
import { d as deliveryApi, S as SSRContextProvider } from './SSRContext-88841734.js';
|
|
22
17
|
import '@redux-saga/core/effects';
|
|
23
18
|
import 'history';
|
|
24
19
|
import 'loglevel';
|
|
25
20
|
import 'await-to-js';
|
|
26
|
-
import './ChangePassword.container-
|
|
27
|
-
import './ToJs-
|
|
21
|
+
import './ChangePassword.container-96dab474.js';
|
|
22
|
+
import './ToJs-67b34be1.js';
|
|
28
23
|
import 'jsonpath-mapper';
|
|
29
|
-
import './
|
|
24
|
+
import './CookieHelper.class-6d649751.js';
|
|
30
25
|
import 'contensis-delivery-api';
|
|
31
|
-
import './RouteLoader-
|
|
26
|
+
import './RouteLoader-94ca1c51.js';
|
|
32
27
|
import 'react-router-config';
|
|
33
28
|
import 'reselect';
|
|
29
|
+
import 'redux';
|
|
30
|
+
import 'redux-thunk';
|
|
31
|
+
import 'redux-saga';
|
|
32
|
+
import 'redux-injectors';
|
|
33
|
+
import 'immer';
|
|
34
34
|
|
|
35
35
|
// Fix TS2769 error No overload matches this call
|
|
36
36
|
const Container = AppContainer; // as typeof AppContainer;
|
|
@@ -50,10 +50,10 @@ class ClientApp {
|
|
|
50
50
|
store: store
|
|
51
51
|
}, /*#__PURE__*/React.createElement(Router, {
|
|
52
52
|
history: browserHistory
|
|
53
|
-
}, /*#__PURE__*/React.createElement(ReactApp, {
|
|
53
|
+
}, /*#__PURE__*/React.createElement(SSRContextProvider, null, /*#__PURE__*/React.createElement(ReactApp, {
|
|
54
54
|
routes: routes,
|
|
55
55
|
withEvents: withEvents
|
|
56
|
-
})))));
|
|
56
|
+
}))))));
|
|
57
57
|
return ClientJsx;
|
|
58
58
|
};
|
|
59
59
|
const isProduction = !(process.env.NODE_ENV !== 'production');
|