@zengenti/contensis-react-base 3.0.2-beta.39 → 3.0.2-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/cjs/{App-6c803238.js → App-7ff737fa.js} +61 -29
- package/cjs/App-7ff737fa.js.map +1 -0
- package/cjs/{login-8eed92af.js → ChangePassword.container-a617190b.js} +246 -84
- package/cjs/ChangePassword.container-a617190b.js.map +1 -0
- package/cjs/{ContensisDeliveryApi-e37e14a9.js → ContensisDeliveryApi-9e32960d.js} +9 -8
- package/cjs/ContensisDeliveryApi-9e32960d.js.map +1 -0
- package/cjs/CookieConstants-000427db.js +10 -0
- package/cjs/CookieConstants-000427db.js.map +1 -0
- package/cjs/{RouteLoader-a49e4e93.js → RouteLoader-049e81e5.js} +8 -5
- package/cjs/RouteLoader-049e81e5.js.map +1 -0
- package/cjs/{ToJs-43cedc5c.js → ToJs-149fc5e1.js} +49 -2
- package/cjs/ToJs-149fc5e1.js.map +1 -0
- package/cjs/client.js +14 -11
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +24 -348
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/redux.js +3 -3
- package/cjs/routing.js +4 -3
- package/cjs/routing.js.map +1 -1
- package/cjs/{selectors-fa836926.js → selectors-46b689d0.js} +4 -9
- package/cjs/selectors-46b689d0.js.map +1 -0
- package/cjs/user.js +33 -159
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +6 -3
- package/cjs/util.js.map +1 -1
- package/cjs/{version-396cb8de.js → version-79a027cb.js} +2 -2
- package/cjs/{version-396cb8de.js.map → version-79a027cb.js.map} +1 -1
- package/cjs/{version-3060974c.js → version-afd4f77e.js} +3 -3
- package/cjs/{version-3060974c.js.map → version-afd4f77e.js.map} +1 -1
- package/esm/{App-bf3b5cdb.js → App-ff944c78.js} +55 -24
- package/esm/App-ff944c78.js.map +1 -0
- package/esm/{login-e4b1447e.js → ChangePassword.container-ae0f9ce4.js} +229 -78
- package/esm/ChangePassword.container-ae0f9ce4.js.map +1 -0
- package/esm/{ContensisDeliveryApi-8dbb3249.js → ContensisDeliveryApi-c66b0cc3.js} +7 -8
- package/esm/ContensisDeliveryApi-c66b0cc3.js.map +1 -0
- package/esm/CookieConstants-3d3b6531.js +6 -0
- package/esm/CookieConstants-3d3b6531.js.map +1 -0
- package/esm/{RouteLoader-58774c81.js → RouteLoader-02eef6d9.js} +8 -5
- package/esm/RouteLoader-02eef6d9.js.map +1 -0
- package/esm/{ToJs-b18ab86e.js → ToJs-ae860aad.js} +49 -3
- package/esm/ToJs-ae860aad.js.map +1 -0
- package/esm/client.js +15 -12
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +24 -349
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/redux.js +6 -6
- package/esm/routing.js +4 -3
- package/esm/routing.js.map +1 -1
- package/esm/{selectors-62746dce.js → selectors-01074974.js} +4 -9
- package/esm/selectors-01074974.js.map +1 -0
- package/esm/user.js +21 -151
- package/esm/user.js.map +1 -1
- package/esm/util.js +4 -3
- package/esm/util.js.map +1 -1
- package/esm/{version-1600ca2a.js → version-0fbd1b82.js} +3 -3
- package/esm/{version-1600ca2a.js.map → version-0fbd1b82.js.map} +1 -1
- package/esm/{version-29368be6.js → version-346a9787.js} +2 -2
- package/esm/{version-29368be6.js.map → version-346a9787.js.map} +1 -1
- package/models/client/client.d.ts +1 -1
- package/models/config.d.ts +4 -4
- package/models/redux/appstate.d.ts +1 -1
- package/models/routing/redux/actions.d.ts +10 -6
- package/models/routing/redux/selectors.d.ts +3 -3
- package/models/routing/redux/types.d.ts +0 -1
- package/models/routing/routes.d.ts +20 -17
- package/models/search/models/Queries.d.ts +8 -10
- package/models/search/models/Search.d.ts +24 -24
- package/models/search/models/SearchActions.d.ts +33 -33
- package/models/search/models/SearchState.d.ts +11 -11
- package/models/search/models/SearchUtil.d.ts +1 -1
- package/models/search/models/WithSearch.d.ts +1 -1
- package/models/search/redux/actions.d.ts +4 -4
- package/models/search/redux/selectors.d.ts +27 -27
- package/models/search/redux/types.d.ts +21 -21
- package/models/search/redux/util.d.ts +1 -1
- package/models/search/search/ContensisDeliveryApi.d.ts +1 -1
- package/models/search/search/expressions.d.ts +4 -4
- package/models/search/search/util.d.ts +2 -2
- package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
- package/models/server/features/linkdepth-api/LinkDepthSearchService.d.ts +1 -1
- package/models/server/features/linkdepth-api/search.d.ts +2 -2
- package/models/server/internalServer.d.ts +7 -5
- package/models/server/util/bundles.d.ts +2 -2
- package/models/server/util/handleExceptions.d.ts +1 -1
- package/models/testImmer/redux/reducer.d.ts +1 -1
- package/models/user/components/Login.d.ts +2 -3
- package/models/user/containers/ChangePassword.container.d.ts +2 -2
- package/models/user/containers/ForgotPassword.container.d.ts +2 -2
- package/models/user/containers/Login.container.d.ts +2 -2
- package/models/user/containers/Registration.container.d.ts +2 -2
- package/models/user/hocs/withLogin.d.ts +5 -11
- package/models/user/hocs/withRegistration.d.ts +2 -8
- package/models/user/redux/actions.d.ts +2 -2
- package/models/user/redux/sagas/login.d.ts +9 -8
- package/models/user/redux/selectors.d.ts +4 -4
- package/models/user/util/CookieConstants.d.ts +1 -1
- package/models/user/util/CookieHelper.class.d.ts +15 -3
- package/models/user/util/LoginHelper.class.d.ts +27 -23
- package/models/util/CachedDeliveryApi.d.ts +1 -1
- package/models/util/ContensisDeliveryApi.d.ts +4 -4
- package/models/util/ToJs.d.ts +1 -1
- package/models/util/index.d.ts +1 -1
- package/models/util/json-mapper.d.ts +1 -1
- package/package.json +9 -10
- package/cjs/App-6c803238.js.map +0 -1
- package/cjs/ContensisDeliveryApi-e37e14a9.js.map +0 -1
- package/cjs/RouteLoader-a49e4e93.js.map +0 -1
- package/cjs/ToJs-43cedc5c.js.map +0 -1
- package/cjs/login-8eed92af.js.map +0 -1
- package/cjs/selectors-fa836926.js.map +0 -1
- package/esm/App-bf3b5cdb.js.map +0 -1
- package/esm/ContensisDeliveryApi-8dbb3249.js.map +0 -1
- package/esm/RouteLoader-58774c81.js.map +0 -1
- package/esm/ToJs-b18ab86e.js.map +0 -1
- package/esm/login-e4b1447e.js.map +0 -1
- package/esm/selectors-62746dce.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangePassword.container-ae0f9ce4.js","sources":["../src/routing/util/find-contenttype-mapping.ts","../src/user/transformations/mapClientCredentials.js","../src/user/util/ContensisManagementApi.js","../src/user/util/OidcUserManager.ts","../src/user/util/LoginHelper.class.js","../src/user/redux/sagas/login.js","../src/user/redux/actions.js","../src/user/hooks/useLogin.js","../src/user/containers/Login.container.js","../src/user/hooks/useRegistration.js","../src/user/containers/Registration.container.js","../src/user/hooks/useForgotPassword.js","../src/user/containers/ForgotPassword.container.js","../src/user/hooks/useChangePassword.js","../src/user/containers/ChangePassword.container.js"],"sourcesContent":["import { ContentTypeMapping } from '../routes';\n\nexport const findContentTypeMapping = (\n ContentTypeMappings: ContentTypeMapping[],\n contentTypeId: string\n) => ContentTypeMappings.find(ct => ct.contentTypeID === contentTypeId);\n","import { mapJson } from '~/util/json-mapper';\n\nconst clientCredentials = {\n bearerToken: 'bearerToken',\n bearerTokenExpiryDate: ({ bearerTokenExpiryDate }) =>\n bearerTokenExpiryDate.toISOString(),\n refreshToken: 'refreshToken',\n refreshTokenExpiryDate: ({ refreshTokenExpiryDate }) =>\n refreshTokenExpiryDate.toISOString(),\n contensisClassicToken: 'contensisClassicToken',\n};\nexport default obj => mapJson(obj, clientCredentials);\n","// import { Client } from 'contensis-management-api';\n\nexport const getManagementApiClient = async ({\n bearerToken,\n bearerTokenExpiryDate,\n refreshToken,\n refreshTokenExpiryDate,\n contensisClassicToken,\n username,\n password,\n}) => {\n const rootUrl = SERVERS.api || SERVERS.cms; /* global SERVERS */\n const projectId = PROJECTS[0].id; /* global PROJECTS */\n\n let config = {};\n if (refreshToken) {\n config = {\n clientType: 'contensis_classic_refresh_token',\n clientDetails: {\n refreshToken,\n },\n };\n } else {\n config = {\n clientType: 'contensis_classic',\n clientDetails: {\n username,\n password,\n },\n };\n }\n\n let { Client } = await import('contensis-management-api');\n\n if (typeof window === 'undefined') {\n const { UniversalClient } = await import('contensis-management-api');\n Client = UniversalClient;\n }\n\n const client = Client.create({\n ...config,\n projectId,\n rootUrl,\n });\n\n if (bearerToken) client.bearerToken = bearerToken;\n if (bearerTokenExpiryDate)\n client.bearerTokenExpiryDate = bearerTokenExpiryDate;\n if (refreshToken) client.refreshToken = refreshToken;\n if (refreshTokenExpiryDate)\n client.refreshTokenExpiryDate = refreshTokenExpiryDate;\n if (contensisClassicToken)\n client.contensisClassicToken = contensisClassicToken;\n\n return client;\n};\n","import { UserManagerSettings } from 'oidc-client';\n\nconst context = (\n typeof window != 'undefined' ? window : global\n) as typeof globalThis & {\n WSFED_LOGIN: string;\n};\n\nconst requireOidc =\n process.env.NODE_ENV === 'development'\n ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */\n : context.WSFED_LOGIN === 'true';\n\nconst servers = SERVERS; /* global SERVERS */\n\nexport const userManagerConfig =\n typeof window !== 'undefined'\n ? {\n authority: `${servers.cms}/authenticate/`,\n client_id: 'WebsiteAdfsClient',\n redirect_uri: window.location.toString(),\n post_logout_redirect_uri: window.location.toString(),\n response_type: 'id_token',\n scope: 'openid',\n filterProtocolClaims: false,\n }\n : {};\n\nexport const createUserManager = async (config: UserManagerSettings) => {\n if (typeof window !== 'undefined' && requireOidc) {\n try {\n const { UserManager } = await import(\n /* webpackChunkName: \"oidcclient\" */ 'oidc-client'\n );\n return new UserManager(config);\n } catch (e) {\n console.error('Exception in createUserManager: ', e);\n }\n } else return {};\n};\n","/* eslint-disable require-atomic-updates */\nimport { to } from 'await-to-js';\n\nimport { getManagementApiClient } from './ContensisManagementApi';\n\nimport mapClientCredentials from '../transformations/mapClientCredentials';\nimport { createUserManager, userManagerConfig } from './OidcUserManager';\nimport { LOGIN_COOKIE, REFRESH_TOKEN_COOKIE } from './CookieConstants';\n\nconst context = typeof window != 'undefined' ? window : global;\n\nexport class LoginHelper {\n static CMS_URL = SERVERS.cms /* global SERVERS */;\n static WSFED_LOGIN =\n process.env.NODE_ENV === 'development'\n ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */\n : context.WSFED_LOGIN === 'true';\n static LOGIN_ROUTE = '/account/login';\n static ACCESS_DENIED_ROUTE = '/account/access-denied';\n\n cookies;\n constructor(cookies) {\n this.cookies = cookies;\n }\n\n SetLoginCookies({ contensisClassicToken, refreshToken }) {\n console.info(\n 'SetLoginCookies:',\n LOGIN_COOKIE,\n contensisClassicToken,\n REFRESH_TOKEN_COOKIE,\n refreshToken\n );\n\n if (contensisClassicToken)\n this.cookies.SetCookie(LOGIN_COOKIE, contensisClassicToken);\n\n if (refreshToken)\n this.cookies.SetCookie(REFRESH_TOKEN_COOKIE, refreshToken);\n }\n\n GetCachedCredentials() {\n return {\n bearerToken: null,\n bearerTokenExpiryDate: null,\n refreshToken: this.cookies.GetCookie(REFRESH_TOKEN_COOKIE),\n refreshTokenExpiryDate: null,\n contensisClassicToken: this.cookies.GetCookie(LOGIN_COOKIE),\n };\n }\n\n ClearCachedCredentials() {\n this.cookies.DeleteCookie(LOGIN_COOKIE);\n this.cookies.DeleteCookie(REFRESH_TOKEN_COOKIE);\n\n if (LoginHelper.WSFED_LOGIN && typeof window !== 'undefined') {\n // remove any oidc keys left over in localStorage\n const { localStorage } = window;\n const keys = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (typeof key === 'string' && key.startsWith('oidc.'))\n keys.push(localStorage.key(i));\n }\n keys.forEach(key => localStorage.removeItem(key));\n }\n }\n\n async LoginUser({ username, password, clientCredentials }) {\n let credentials = clientCredentials;\n let authenticationState = {\n clientCredentials: null,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: false,\n };\n let transientClient;\n let user;\n\n if (username && password) {\n // Get a management client with username and password\n transientClient = await getManagementApiClient({\n username,\n password,\n });\n\n // Ensure the client has requested a bearer token\n const [loginError, clientBearerToken] = await to(\n transientClient.ensureBearerToken()\n );\n\n // Problem getting token with username and password\n if (loginError) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: loginError.message || null,\n isAuthenticated: false,\n isAuthenticationError: loginError.name.includes(\n 'ContensisAuthenticationError'\n ),\n isError: true,\n };\n this.ClearCachedCredentials();\n }\n\n // Got a token using username and password\n if (clientBearerToken) {\n // Set credentials so we can continue to GetUserDetails\n credentials = mapClientCredentials(transientClient);\n this.SetLoginCookies(credentials);\n authenticationState = {\n clientCredentials: credentials,\n isAuthenticated: true,\n isAuthenticationError: false,\n isError: false,\n };\n }\n }\n\n // If we have credentials supplied by a successful username and password login\n // or clientCredentials supplied in the options argument we can continue to\n // fetch the user's details\n if (credentials) {\n const client =\n transientClient || (await getManagementApiClient(credentials));\n const [error, userDetails] = await LoginHelper.GetUserDetails(client);\n\n if (error) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: error.message,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: true,\n };\n this.ClearCachedCredentials();\n } else {\n // Ensure we get latest refreshToken and contensisClassicToken from the latest client\n const latestCredentials = mapClientCredentials(client);\n this.SetLoginCookies(latestCredentials);\n\n user = userDetails;\n authenticationState = {\n clientCredentials: latestCredentials,\n isAuthenticated: true,\n isAuthenticationError: false,\n isError: false,\n };\n }\n }\n\n return { authenticationState, user };\n }\n\n LogoutUser(redirectPath) {\n this.ClearCachedCredentials();\n if (LoginHelper.WSFED_LOGIN) {\n LoginHelper.WsFedLogout(redirectPath);\n } else {\n if (redirectPath) LoginHelper.ClientRedirectToPath(redirectPath);\n else LoginHelper.ClientRedirectToSignInPage();\n }\n }\n\n static withCookies = cookieHelper => new LoginHelper(cookieHelper);\n\n static GetUserDetails = async client => {\n let userError,\n groupsError,\n user = {},\n groupsResult;\n\n [userError, user] = await to(client.security.users.getCurrent());\n if (user && user.id) {\n [groupsError, groupsResult] = await to(\n client.security.users.getUserGroups({\n userId: user.id,\n includeInherited: true,\n pageOptions: { pageSize: 100 },\n })\n );\n // Set groups attribute in user object to be the items\n // array from the getUserGroups result\n if (groupsResult && groupsResult.items) user.groups = groupsResult.items;\n\n //If groups call fails then log the error but allow the user to login still\n // eslint-disable-next-line no-console\n if (groupsError) console.log(groupsError);\n }\n return [userError, user];\n };\n\n static ClientRedirectToHome(location) {\n if (typeof window != 'undefined') {\n let url = '/';\n if (location) {\n const { search, hash } = location;\n url = search ? `${url}${search}` : url;\n url = hash ? `${url}${hash}` : url;\n }\n window.location.href = url;\n }\n }\n\n static async ClientRedirectToSignInPage(redirectPath) {\n if (typeof location === 'undefined') return;\n if (LoginHelper.WSFED_LOGIN) {\n await LoginHelper.WsFedLogout();\n await LoginHelper.WsFedLogin();\n } else {\n // Standard Contensis Login\n let url = LoginHelper.LOGIN_ROUTE;\n if (typeof redirectPath === 'string')\n url = `${url}?redirect_uri=${redirectPath}`;\n if (\n typeof location !== 'undefined' &&\n redirectPath !== LoginHelper.LOGIN_ROUTE\n )\n location.replace(url);\n }\n }\n\n static GetAccessDeniedRoute(originalPath) {\n let url = LoginHelper.ACCESS_DENIED_ROUTE;\n if (originalPath !== url && typeof originalPath === 'string')\n url = `${url}?original_uri=${originalPath}`;\n return url;\n }\n\n static ClientRedirectToAccessDeniedPage(originalPath) {\n if (typeof location !== 'undefined')\n location.href = LoginHelper.GetAccessDeniedRoute(originalPath);\n }\n\n static ClientRedirectToPath(redirectPath) {\n if (typeof redirectPath === 'string') {\n if (typeof location !== 'undefined') window.location.href = redirectPath;\n } else LoginHelper.ClientRedirectToHome();\n }\n\n static async WsFedLogin(redirectUri) {\n const userManager = await createUserManager(userManagerConfig);\n userManager.signinRedirect({\n scope: 'openid',\n response_type: 'id_token',\n redirect_uri: redirectUri || window.location.toString(),\n });\n }\n\n static RemoveSecurityTokenQuery() {\n const params = new URLSearchParams(window.location.search);\n if (params.has('securitytoken') || params.has('securityToken')) {\n params.delete('securitytoken');\n params.delete('securityToken');\n window.location = `${window.location.pathname}${\n params.toString() ? `?${params}` : ''\n }`;\n }\n }\n\n static async WsFedLogout(redirectPath) {\n await fetch(\n `${LoginHelper.CMS_URL}/authenticate/logout?jsonResponseRequired=true`,\n {\n credentials: 'include',\n }\n );\n if (redirectPath) {\n window.location = redirectPath;\n } else {\n // Explicitly check and remove any stale\n // security token that may be in the query string\n LoginHelper.RemoveSecurityTokenQuery();\n }\n }\n\n static async GetCredentialsForSecurityToken(securityToken) {\n const [error, response] = await to(\n fetch(`${LoginHelper.CMS_URL}/REST/Contensis/Security/IsAuthenticated`, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n securityToken: encodeURIComponent(securityToken),\n }),\n })\n );\n if (error) return [{ message: 'Failed to fetch credentials' }];\n if (response.ok) {\n const [parseError, body] = await to(response.json());\n if (parseError) return [parseError];\n\n const { LogonResult, ApplicationData = [] } = body;\n if (LogonResult !== 0) {\n console.info(`Security token is invalid - LogonResult: ${LogonResult}`);\n return [\n { message: 'Security token is invalid', data: ApplicationData },\n ];\n }\n if (ApplicationData.length > 0) {\n let refreshToken;\n ApplicationData.forEach(item => {\n if (item.Key === 'ContensisSecurityRefreshToken')\n refreshToken = item.Value;\n });\n if (!refreshToken) {\n return [\n {\n message:\n 'Fetch credentials: Unable to find ContensisSecurityRefreshToken',\n },\n ];\n }\n return [undefined, refreshToken];\n } else {\n return [\n {\n message:\n 'Fetch credentials: Unable to find ContensisSecurityRefreshToken',\n },\n ];\n }\n } else {\n return [\n {\n message: `Fetch credentials error: ${response.status} ${response.statusText}`,\n },\n ];\n }\n }\n\n // static isZengentiStaff(email) {\n // const emailRefs = ['@zengenti', '@contensis'];\n\n // return emailRefs.some(emailRef => {\n // if (email.includes(emailRef)) {\n // return true;\n // }\n // });\n // }\n}\n","import { takeEvery, select, put, call } from 'redux-saga/effects';\nimport {\n SET_AUTHENTICATION_STATE,\n LOGIN_USER,\n LOGOUT_USER,\n VALIDATE_USER,\n} from '../types';\nimport {\n selectUserIsAuthenticated,\n selectClientCredentials,\n selectUserGroups,\n} from '../selectors';\n\nimport { setRoute } from '~/routing/redux/actions';\nimport { selectCurrentSearch } from '~/routing/redux/selectors';\nimport { findContentTypeMapping } from '~/routing/util/find-contenttype-mapping';\n\nimport mapClientCredentials from '~/user/transformations/mapClientCredentials';\n\nimport { getManagementApiClient } from '~/user/util/ContensisManagementApi';\nimport { LoginHelper } from '~/user/util/LoginHelper.class';\nimport { matchUserGroup } from '~/user/util/matchGroups';\nimport { queryParams } from '~/util/navigation';\n\nexport const loginSagas = [\n takeEvery(LOGIN_USER, loginUserSaga),\n takeEvery(LOGOUT_USER, logoutUserSaga),\n takeEvery(VALIDATE_USER, validateUserSaga),\n takeEvery(SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga),\n];\n\nexport function* handleRequiresLoginSaga(action) {\n const {\n cookies,\n entry,\n path,\n requireLogin,\n routes: { ContentTypeMappings },\n staticRoute,\n } = action;\n let userLoggedIn = yield select(selectUserIsAuthenticated);\n\n // Check for a securityToken in querystring\n const currentQs = queryParams(yield select(selectCurrentSearch));\n const securityToken = currentQs.securityToken || currentQs.securitytoken;\n\n // Check if any of the defined routes have \"requireLogin\" attribute\n const { requireLogin: authRoute } = (staticRoute && staticRoute.route) || {};\n const { requireLogin: authContentType } =\n (entry &&\n findContentTypeMapping(ContentTypeMappings, entry?.sys?.contentTypeId)) ||\n {};\n\n // If requireLogin, authRoute or authContentType has been specified as an\n // array of groups we can merge all the arrays and match on any group supplied\n const routeRequiresGroups = [\n ...((Array.isArray(authContentType) && authContentType) || []),\n ...((Array.isArray(authRoute) && authRoute) || []),\n ...((Array.isArray(requireLogin) && requireLogin) || []),\n ];\n const routeRequiresLogin = !!authContentType || !!authRoute || !!requireLogin;\n\n if (!userLoggedIn) {\n // If cookies or securityToken are found on any route change\n // always validate and login the user\n if (routeRequiresLogin) {\n console.info(`Route requires login: ${path}`);\n // If routeRequiresLogin do a blocking call that returns userLoggedIn\n userLoggedIn = yield call(validateUserSaga, {\n cookies,\n securityToken,\n });\n console.info(`User logged in: ${userLoggedIn}`);\n }\n // otherwise do a non blocking put to handle validation in the background\n else yield put({ type: VALIDATE_USER, cookies, securityToken });\n }\n\n if (routeRequiresLogin) {\n // If a security token is in the querystring and we are not already\n // logged in something is wrong and we won't bother going on another redirect loop\n if (!userLoggedIn && !securityToken) {\n LoginHelper.ClientRedirectToSignInPage(action.location.pathname);\n } else if (routeRequiresGroups.length > 0) {\n const userGroups = yield select(selectUserGroups, 'js');\n const groupMatch = matchUserGroup(userGroups, routeRequiresGroups);\n\n if (!groupMatch)\n LoginHelper.ClientRedirectToAccessDeniedPage(action.location.pathname);\n }\n }\n\n return userLoggedIn;\n}\n\nfunction* validateUserSaga({ cookies, securityToken }) {\n const login = LoginHelper.withCookies(cookies);\n // Check for refreshToken in cookies\n let clientCredentials = login.GetCachedCredentials();\n\n if (\n securityToken ||\n clientCredentials.securityToken ||\n clientCredentials.refreshToken\n ) {\n // We only attempt to validate the user if one of the stored\n // tokens are found, in this case we set loading state manually\n // so we don't need to set and unset loading if there are no stored\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState: {\n isLoading: true,\n },\n });\n // If we have just a security token we will call a CMS endpoint\n // and provide us with a RefreshToken cookie we can use during login\n if (\n securityToken ||\n (clientCredentials.securityToken && !clientCredentials.refreshToken)\n ) {\n const [error, refreshToken] =\n yield LoginHelper.GetCredentialsForSecurityToken(\n securityToken || clientCredentials.securityToken\n );\n if (refreshToken) {\n // Set cookies and reload values\n login.SetLoginCookies({\n contensisClassicToken: securityToken,\n refreshToken,\n });\n clientCredentials = login.GetCachedCredentials();\n }\n if (error) {\n login.ClearCachedCredentials();\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState: {\n isError: true,\n errorMessage:\n error?.message ||\n (error && 'toString' in error && error.toString()),\n },\n });\n }\n }\n\n // Log the user in if a refreshToken is found\n if (clientCredentials.refreshToken) {\n console.info(\n `Login user with refreshToken ${clientCredentials.refreshToken}`\n );\n yield call(loginUserSaga, {\n clientCredentials,\n cookies: login.cookies,\n });\n }\n }\n\n // Tell any callers have we successfully logged in?\n return yield select(selectUserIsAuthenticated);\n}\n\nfunction* loginUserSaga(action = {}) {\n const { username, password, clientCredentials, cookies } = action;\n const login = LoginHelper.withCookies(cookies);\n\n // If a WSFED_LOGIN site has dispatched the loginUser action\n // just redirect them to the Identity Provider sign in\n if (action.type === LOGIN_USER && LoginHelper.WSFED_LOGIN)\n LoginHelper.ClientRedirectToSignInPage();\n\n const { authenticationState, user } = yield login.LoginUser({\n username,\n password,\n clientCredentials,\n });\n\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState,\n user,\n });\n}\n\nconst removeHostnamePart = path => {\n // eslint-disable-next-line no-console\n console.log(path);\n const relativePath = '/' + path.split('/').splice(3).join('/');\n // eslint-disable-next-line no-console\n console.log(relativePath);\n return relativePath;\n};\n\nfunction* redirectAfterSuccessfulLoginSaga() {\n const isLoggedIn = yield select(selectUserIsAuthenticated);\n const { redirect_uri: redirectPath, ReturnURL: assetRedirectPath } =\n queryParams(yield select(selectCurrentSearch));\n\n if (isLoggedIn && assetRedirectPath && typeof window != 'undefined') {\n const path = removeHostnamePart(assetRedirectPath);\n // This has to be a hard href to get the app to\n // leave React and hit the server for the IIS hosted assets\n window.location.href = path;\n // yield put(setRoute(path)); // does not work in this scenario\n } else if (isLoggedIn && redirectPath) {\n yield put(setRoute(redirectPath));\n }\n}\n\nfunction* logoutUserSaga({ redirectPath, cookies }) {\n yield put({\n type: SET_AUTHENTICATION_STATE,\n user: null,\n });\n yield LoginHelper.withCookies(cookies).LogoutUser(redirectPath);\n}\n\nexport function* refreshSecurityToken() {\n const clientCredentials = yield select(selectClientCredentials, 'js');\n if (Object.keys(clientCredentials).length > 0) {\n const client = yield getManagementApiClient(clientCredentials);\n yield client.authenticate();\n\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState: {\n clientCredentials: mapClientCredentials(client),\n },\n });\n }\n}\n","import { action } from '~/redux/util';\nimport {\n CHANGE_USER_PASSWORD,\n LOGIN_USER,\n LOGOUT_USER,\n REGISTER_USER,\n REQUEST_USER_PASSWORD_RESET,\n RESET_USER_PASSWORD,\n} from './types';\n\nexport const loginUser = (username, password, cookies) =>\n action(LOGIN_USER, { username, password, cookies });\n\nexport const logoutUser = (redirectPath, cookies) =>\n action(LOGOUT_USER, { redirectPath, cookies });\n\nexport const registerUser = (user, mappers) =>\n action(REGISTER_USER, {\n user,\n mappers,\n });\n\nexport const requestPasswordReset = userEmailObject =>\n action(REQUEST_USER_PASSWORD_RESET, { userEmailObject });\n\nexport const resetPassword = resetPasswordObject =>\n action(RESET_USER_PASSWORD, { resetPasswordObject });\n\nexport const changePassword = (userId, currentPassword, newPassword) =>\n action(CHANGE_USER_PASSWORD, { userId, currentPassword, newPassword });\n","import { useCookies } from 'react-cookie';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { loginUser, logoutUser } from '../redux/actions';\nimport {\n selectUser,\n selectUserIsAuthenticationError,\n selectUserIsError,\n selectUserErrorMessage,\n selectUserIsAuthenticated,\n selectUserIsLoading,\n} from '../redux/selectors';\nimport { CookieHelper } from '../util/CookieHelper.class';\n\nconst useLogin = () => {\n const cookies = new CookieHelper(...useCookies());\n\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n loginUser: (username, password) =>\n dispatch(loginUser(username, password, cookies)),\n logoutUser: redirectPath => dispatch(logoutUser(redirectPath, cookies)),\n errorMessage: select(selectUserErrorMessage),\n isAuthenticated: select(selectUserIsAuthenticated),\n isAuthenticationError: select(selectUserIsAuthenticationError),\n isError: select(selectUserIsError),\n isLoading: select(selectUserIsLoading),\n user: select(selectUser),\n // DEPRECATED: authenticationError is deprecated use isAuthenticationError instead\n authenticationError: select(selectUserIsAuthenticationError),\n // DEPRECATED: authenticationErrorMessage is deprecated use errorMessage instead\n authenticationErrorMessage: select(selectUserErrorMessage),\n // DEPRECATED: error is deprecated use isError instead\n error: select(selectUserIsError),\n };\n};\n\nexport default useLogin;\n","import useLogin from '../hooks/useLogin';\nimport { toJS } from '~/util/ToJs';\n\nconst LoginContainer = ({ children, ...props }) => {\n const userProps = useLogin(props);\n return children(userProps);\n};\n\nLoginContainer.propTypes = {};\n\nexport default toJS(LoginContainer);\n","import { useDispatch, useSelector } from 'react-redux';\nimport { registerUser } from '../redux/actions';\nimport {\n selectUserRegistration,\n selectUserRegistrationError,\n selectUserRegistrationIsLoading,\n selectUserRegistrationIsSuccess,\n} from '../redux/selectors';\n\nconst useRegistration = () => {\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n registerUser: (user, mappers) => dispatch(registerUser(user, mappers)),\n error: select(selectUserRegistrationError),\n isLoading: select(selectUserRegistrationIsLoading),\n isSuccess: select(selectUserRegistrationIsSuccess),\n user: select(selectUserRegistration),\n };\n};\n\nexport default useRegistration;\n","import useRegistration from '../hooks/useRegistration';\nimport { toJS } from '~/util/ToJs';\n\nconst RegistrationContainer = ({ children, ...props }) => {\n const userProps = useRegistration(props);\n return children(userProps);\n};\n\nRegistrationContainer.propTypes = {};\n\nexport default toJS(RegistrationContainer);\n","import { useDispatch, useSelector } from 'react-redux';\nimport { requestPasswordReset, resetPassword } from '../redux/actions';\nimport {\n selectPasswordResetRequestError,\n selectPasswordResetRequestSending,\n selectPasswordResetRequestSent,\n selectResetPasswordSending,\n selectResetPasswordSent,\n selectResetPasswordError,\n} from '../redux/selectors';\nimport { selectCurrentSearch } from '~/routing/redux/selectors';\n\nconst useForgotPassword = () => {\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n isLoading: select(selectPasswordResetRequestSending),\n isSuccess: select(selectPasswordResetRequestSent),\n error: select(selectPasswordResetRequestError),\n requestPasswordReset: userEmailObject =>\n dispatch(requestPasswordReset(userEmailObject)),\n\n setNewPassword: {\n queryString: select(selectCurrentSearch),\n isLoading: select(selectResetPasswordSending),\n isSuccess: select(selectResetPasswordSent),\n error: select(selectResetPasswordError),\n submit: resetPasswordObject =>\n dispatch(resetPassword(resetPasswordObject)),\n },\n };\n};\n\nexport default useForgotPassword;\n","import useForgotPassword from '../hooks/useForgotPassword';\nimport { toJS } from '~/util/ToJs';\n\nconst ForgotPasswordContainer = ({ children, ...props }) => {\n const userProps = useForgotPassword(props);\n return children(userProps);\n};\n\nForgotPasswordContainer.propTypes = {};\n\nexport default toJS(ForgotPasswordContainer);\n","import { useDispatch, useSelector } from 'react-redux';\nimport { changePassword } from '../redux/actions';\nimport {\n selectChangePasswordSending,\n selectChangePasswordSent,\n selectChangePasswordError,\n selectUserIsAuthenticated,\n selectUserGuid,\n} from '../redux/selectors';\n\nconst useChangePassword = () => {\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n isLoading: select(selectChangePasswordSending),\n isSuccess: select(selectChangePasswordSent),\n userId: select(selectUserGuid),\n isLoggedIn: select(selectUserIsAuthenticated),\n error: select(selectChangePasswordError),\n changePassword: (userId, currentPassword, newPassword) =>\n dispatch(changePassword(userId, currentPassword, newPassword)),\n };\n};\n\nexport default useChangePassword;\n","import useChangePassword from '../hooks/useChangePassword';\nimport { toJS } from '~/util/ToJs';\n\nconst ChangePasswordContainer = ({ children, ...props }) => {\n const userProps = useChangePassword(props);\n return children(userProps);\n};\n\nChangePasswordContainer.propTypes = {};\n\nexport default toJS(ChangePasswordContainer);\n"],"names":["findContentTypeMapping","ContentTypeMappings","contentTypeId","find","ct","contentTypeID","clientCredentials","bearerToken","bearerTokenExpiryDate","toISOString","refreshToken","refreshTokenExpiryDate","contensisClassicToken","obj","mapJson","getManagementApiClient","username","password","rootUrl","SERVERS","api","cms","projectId","PROJECTS","id","config","clientType","clientDetails","Client","window","UniversalClient","client","create","context","global","requireOidc","process","env","NODE_ENV","WSFED_LOGIN","servers","userManagerConfig","authority","client_id","redirect_uri","location","toString","post_logout_redirect_uri","response_type","scope","filterProtocolClaims","createUserManager","UserManager","e","console","error","LoginHelper","constructor","cookies","SetLoginCookies","info","LOGIN_COOKIE","REFRESH_TOKEN_COOKIE","SetCookie","GetCachedCredentials","GetCookie","ClearCachedCredentials","DeleteCookie","localStorage","keys","i","length","key","startsWith","push","forEach","removeItem","LoginUser","credentials","authenticationState","isAuthenticated","isAuthenticationError","isError","transientClient","user","loginError","clientBearerToken","to","ensureBearerToken","errorMessage","message","name","includes","mapClientCredentials","userDetails","GetUserDetails","latestCredentials","LogoutUser","redirectPath","WsFedLogout","ClientRedirectToPath","ClientRedirectToSignInPage","ClientRedirectToHome","url","search","hash","href","WsFedLogin","LOGIN_ROUTE","replace","GetAccessDeniedRoute","originalPath","ACCESS_DENIED_ROUTE","ClientRedirectToAccessDeniedPage","redirectUri","userManager","signinRedirect","RemoveSecurityTokenQuery","params","URLSearchParams","has","delete","pathname","fetch","CMS_URL","GetCredentialsForSecurityToken","securityToken","response","method","headers","Accept","body","JSON","stringify","encodeURIComponent","ok","parseError","json","LogonResult","ApplicationData","data","item","Key","Value","undefined","status","statusText","withCookies","cookieHelper","userError","groupsError","groupsResult","security","users","getCurrent","getUserGroups","userId","includeInherited","pageOptions","pageSize","items","groups","log","loginSagas","takeEvery","LOGIN_USER","loginUserSaga","LOGOUT_USER","logoutUserSaga","VALIDATE_USER","validateUserSaga","SET_AUTHENTICATION_STATE","redirectAfterSuccessfulLoginSaga","handleRequiresLoginSaga","action","_entry$sys","entry","path","requireLogin","routes","staticRoute","userLoggedIn","select","selectUserIsAuthenticated","currentQs","queryParams","selectCurrentSearch","securitytoken","authRoute","route","authContentType","sys","routeRequiresGroups","Array","isArray","routeRequiresLogin","call","put","type","userGroups","selectUserGroups","groupMatch","matchUserGroup","login","isLoading","removeHostnamePart","relativePath","split","splice","join","isLoggedIn","ReturnURL","assetRedirectPath","setRoute","refreshSecurityToken","selectClientCredentials","Object","authenticate","loginUser","logoutUser","registerUser","mappers","REGISTER_USER","requestPasswordReset","userEmailObject","REQUEST_USER_PASSWORD_RESET","resetPassword","resetPasswordObject","RESET_USER_PASSWORD","changePassword","currentPassword","newPassword","CHANGE_USER_PASSWORD","useLogin","CookieHelper","useCookies","dispatch","useDispatch","useSelector","selectUserErrorMessage","selectUserIsAuthenticationError","selectUserIsError","selectUserIsLoading","selectUser","authenticationError","authenticationErrorMessage","LoginContainer","children","props","userProps","propTypes","toJS","useRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","isSuccess","selectUserRegistrationIsSuccess","selectUserRegistration","RegistrationContainer","useForgotPassword","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","setNewPassword","queryString","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","submit","ForgotPasswordContainer","useChangePassword","selectChangePasswordSending","selectChangePasswordSent","selectUserGuid","selectChangePasswordError","ChangePasswordContainer"],"mappings":";;;;;;;;;;MAEaA,sBAAsB,GAAGA,CACpCC,mBAAyC,EACzCC,aAAqB,KAClBD,mBAAmB,CAACE,IAAI,CAACC,EAAE,IAAIA,EAAE,CAACC,aAAa,KAAKH,aAAa;;ACHtE,MAAMI,iBAAiB,GAAG;AACxBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,qBAAqB,EAAEA,CAAC;AAAEA,IAAAA,qBAAAA;AAAsB,GAAC,KAC/CA,qBAAqB,CAACC,WAAW,EAAE;AACrCC,EAAAA,YAAY,EAAE,cAAc;AAC5BC,EAAAA,sBAAsB,EAAEA,CAAC;AAAEA,IAAAA,sBAAAA;AAAuB,GAAC,KACjDA,sBAAsB,CAACF,WAAW,EAAE;AACtCG,EAAAA,qBAAqB,EAAE,uBAAA;AACzB,CAAC,CAAA;AACD,2BAAA,CAAeC,GAAG,IAAIC,OAAO,CAACD,GAAG,EAAEP,iBAAiB,CAAC;;ACXrD;;AAEaS,MAAAA,sBAAsB,GAAG,OAAO;EAC3CR,WAAW;EACXC,qBAAqB;EACrBE,YAAY;EACZC,sBAAsB;EACtBC,qBAAqB;EACrBI,QAAQ;AACRC,EAAAA,QAAAA;AACF,CAAC,KAAK;EACJ,M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,MAAMlC,QAAQ,GAAGC,WAAW,EAAE,CAAA;EAC9B,MAAMvD,MAAM,GAAGwD,WAAW,CAAA;EAE1B,OAAO;AACLlC,IAAAA,SAAS,EAAEtB,MAAM,CAACyF,2BAA2B,CAAC;AAC9ChB,IAAAA,SAAS,EAAEzE,MAAM,CAAC0F,wBAAwB,CAAC;AAC3CpH,IAAAA,MAAM,EAAE0B,MAAM,CAAC2F,cAAc,CAAC;AAC9B/D,IAAAA,UAAU,EAAE5B,MAAM,CAACC,yBAAyB,CAAC;AAC7ChI,IAAAA,KAAK,EAAE+H,MAAM,CAAC4F,yBAAyB,CAAC;AACxC7C,IAAAA,cAAc,EAAEA,CAACzE,MAAM,EAAE0E,eAAe,EAAEC,WAAW,KACnDK,QAAQ,CAACP,cAAc,CAACzE,MAAM,EAAE0E,eAAe,EAAEC,WAAW,CAAC,CAAA;GAChE,CAAA;AACH;;ACpBA,MAAM4C,uBAAuB,GAAGA,CAAC;EAAE5B,QAAQ;EAAE,GAAGC,KAAAA;AAAM,CAAC,KAAK;AAC1D,EAAA,MAAMC,SAAS,GAAGqB,iBAAiB,CAAM,CAAC,CAAA;EAC1C,OAAOvB,QAAQ,CAACE,SAAS,CAAC,CAAA;AAC5B,CAAC,CAAA;AAED0B,uBAAuB,CAACzB,SAAS,GAAG,EAAE,CAAA;AAEtC,+BAAeC,IAAI,CAACwB,uBAAuB,CAAC;;;;"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Client } from 'contensis-delivery-api';
|
|
2
2
|
import { parse } from 'query-string';
|
|
3
|
-
import { A as selectCurrentHostname, w as selectCurrentPath, o as selectCurrentSearch, B as setSurrogateKeys } from './selectors-
|
|
4
|
-
import { r as reduxStore } from './version-
|
|
5
|
-
|
|
6
|
-
const LOGIN_COOKIE = 'ContensisCMSUserName';
|
|
7
|
-
const REFRESH_TOKEN_COOKIE = 'RefreshToken';
|
|
8
|
-
const findLoginCookies = cookies => typeof cookies === 'object' ? Object.fromEntries(Object.entries(cookies).filter(([name]) => [LOGIN_COOKIE, REFRESH_TOKEN_COOKIE].includes(name))) : cookies;
|
|
3
|
+
import { A as selectCurrentHostname, w as selectCurrentPath, o as selectCurrentSearch, B as setSurrogateKeys } from './selectors-01074974.js';
|
|
4
|
+
import { r as reduxStore } from './version-346a9787.js';
|
|
5
|
+
import { f as findLoginCookies } from './CookieConstants-3d3b6531.js';
|
|
9
6
|
|
|
10
7
|
class CacheNode {
|
|
11
8
|
constructor(key, value) {
|
|
@@ -141,6 +138,7 @@ class CachedSearch {
|
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
const cachedSearch = new CachedSearch();
|
|
141
|
+
const cachedSearchWithCookies = cookies => new CachedSearch(cookies);
|
|
144
142
|
|
|
145
143
|
const mapCookieHeader = cookies => typeof cookies === 'object' ? Object.entries(cookies).map(([name, value]) => `${name}=${value}`).join('; ') : cookies;
|
|
146
144
|
const getSsrReferer = () => {
|
|
@@ -255,6 +253,7 @@ class DeliveryApi {
|
|
|
255
253
|
}
|
|
256
254
|
}
|
|
257
255
|
const deliveryApi = new DeliveryApi();
|
|
256
|
+
const deliveryApiWithCookies = cookies => new DeliveryApi(cookies);
|
|
258
257
|
|
|
259
|
-
export { cachedSearch as c, deliveryApi as d, getClientConfig as g };
|
|
260
|
-
//# sourceMappingURL=ContensisDeliveryApi-
|
|
258
|
+
export { cachedSearchWithCookies as a, deliveryApiWithCookies as b, cachedSearch as c, deliveryApi as d, getClientConfig as g };
|
|
259
|
+
//# sourceMappingURL=ContensisDeliveryApi-c66b0cc3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContensisDeliveryApi-c66b0cc3.js","sources":["../src/util/LruCache.js","../src/util/CachedDeliveryApi.ts","../src/util/ContensisDeliveryApi.ts"],"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 { DeliveryApi, getClientConfig } 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\n constructor(cookies?: CookieObject) {\n this.cookies = cookies;\n }\n\n getClient(...args: Parameters<DeliveryApi['getClient']>) {\n return new DeliveryApi(this.cookies).getClient(...args);\n }\n\n search(query: Query, linkDepth = 0, project?: string) {\n const client = Client.create(getClientConfig(project, this.cookies));\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.cookies));\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(getClientConfig(project, this.cookies));\n client.clientConfig.versionStatus = versionStatus;\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.cookies));\n return this.request(`[CONTENT TYPE] ${id} ${project}`, () =>\n client.contentTypes.get(id)\n );\n }\n\n getRootNode(options: NodeGetRootOptions, project?: string) {\n const client = Client.create(getClientConfig(project, this.cookies));\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.cookies));\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.cookies));\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.cookies));\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.cookies));\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 = (cookies?: CookieObject) =>\n new CachedSearch(cookies);\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';\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 = (response: any) => {\n const keys = response.headers.get\n ? response.headers.get('surrogate-key')\n : response.headers.map['surrogate-key'];\n if (keys) reduxStore?.dispatch(setSurrogateKeys(keys, response.url));\n};\n\nexport const getClientConfig = (project?: string, cookies?: CookieObject) => {\n const config: Config = DELIVERY_API_CONFIG; /* global DELIVERY_API_CONFIG */\n config.responseHandler = {};\n\n if (project) {\n config.projectId = project;\n }\n\n // we only want the surrogate key header in a server context\n if (typeof window === 'undefined') {\n config.defaultHeaders = Object.assign(config.defaultHeaders || {}, {\n referer: getSsrReferer(),\n 'x-require-surrogate-key': true,\n 'x-crb-ssr': true, // add this for support tracing\n });\n config.responseHandler[200] = storeSurrogateKeys;\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\n if (cookies) {\n const cookieHeader = mapCookieHeader(findLoginCookies(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\n constructor(cookies?: CookieObject) {\n this.cookies = cookies;\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.cookies));\n return client.entries.search(\n query,\n typeof linkDepth !== 'undefined' ? linkDepth : 1\n );\n };\n\n getClient = (versionStatus: VersionStatus = 'published', project) => {\n const baseConfig = getClientConfig(project, this.cookies);\n baseConfig.versionStatus = versionStatus;\n return Client.create(baseConfig);\n };\n\n getEntry = (\n id: string,\n linkDepth = 0,\n versionStatus: VersionStatus = 'published',\n project?: string\n ) => {\n const baseConfig = getClientConfig(project, this.cookies);\n baseConfig.versionStatus = versionStatus;\n const client = Client.create(baseConfig);\n // return client.entries.get(id, linkDepth);\n return client.entries.get({ id, linkDepth });\n };\n}\n\nexport const deliveryApi = new DeliveryApi();\n\nexport const deliveryApiWithCookies = (cookies?: CookieObject) =>\n new DeliveryApi(cookies);\n\nexport * from './CachedDeliveryApi';\n"],"names":["CacheNode","constructor","key","value","next","prev","LruCache","limit","map","head","tail","size","get","node","remove","setHead","set","CachedSearch","cookies","cache","getClient","args","DeliveryApi","search","query","linkDepth","project","client","Client","create","getClientConfig","request","JSON","stringify","entries","searchUsingPost","id","versionStatus","clientConfig","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","headers","dispatch","setSurrogateKeys","url","config","DELIVERY_API_CONFIG","responseHandler","projectId","defaultHeaders","assign","PROXY_DELIVERY_API","rootUrl","cookieHeader","findLoginCookies","Cookie","getClientSideVersionStatus","parse","location","currentHostname","hostname","getVersionStatusFromHostname","getServerSideVersionStatus","deliveryApi","getVersionStatusFromHeaders","versionStatusHeader","indexOf","endsWith","baseConfig","getEntry","deliveryApiWithCookies"],"mappings":";;;;;;AAAA,MAAMA,SAAS,CAAC;AACdC,EAAA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S,MAAM,CAACO,OAAO,CAACX,MAAM,CAC1BC,KAAK,EACL,OAAOC,SAAS,KAAK,WAAW,GAAGA,SAAS,GAAG,CAAC,CACjD,CAAA;KACF,CAAA;IAAA,IAEDL,CAAAA,SAAS,GAAG,CAACiB,aAA4B,GAAG,WAAW,EAAEX,OAAO,KAAK;MACnE,MAAMwE,UAAU,GAAGpE,eAAe,CAACJ,OAAO,EAAE,IAAI,CAACR,OAAO,CAAC,CAAA;MACzDgF,UAAU,CAAC7D,aAAa,GAAGA,aAAa,CAAA;AACxC,MAAA,OAAOT,MAAM,CAACC,MAAM,CAACqE,UAAU,CAAC,CAAA;KACjC,CAAA;AAAA,IAAA,IAAA,CAEDC,QAAQ,GAAG,CACT/D,EAAU,EACVX,SAAS,GAAG,CAAC,EACbY,aAA4B,GAAG,WAAW,EAC1CX,OAAgB,KACb;MACH,MAAMwE,UAAU,GAAGpE,eAAe,CAACJ,OAAO,EAAE,IAAI,CAACR,OAAO,CAAC,CAAA;MACzDgF,UAAU,CAAC7D,aAAa,GAAGA,aAAa,CAAA;AACxC,MAAA,MAAMV,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACqE,UAAU,CAAC,CAAA;AACxC;AACA,MAAA,OAAOvE,MAAM,CAACO,OAAO,CAACtB,GAAG,CAAC;QAAEwB,EAAE;AAAEX,QAAAA,SAAAA;AAAU,OAAC,CAAC,CAAA;KAC7C,CAAA;IA5EC,IAAI,CAACP,OAAO,GAAGA,OAAO,CAAA;AACxB,GAAA;AA4EF,CAAA;AAEa2E,MAAAA,WAAW,GAAG,IAAIvE,WAAW,GAAE;AAErC,MAAM8E,sBAAsB,GAAIlF,OAAsB,IAC3D,IAAII,WAAW,CAACJ,OAAO;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const LOGIN_COOKIE = 'ContensisCMSUserName';
|
|
2
|
+
const REFRESH_TOKEN_COOKIE = 'RefreshToken';
|
|
3
|
+
const findLoginCookies = cookies => typeof cookies === 'object' ? Object.fromEntries(Object.entries(cookies).filter(([name]) => [LOGIN_COOKIE, REFRESH_TOKEN_COOKIE].includes(name))) : cookies;
|
|
4
|
+
|
|
5
|
+
export { LOGIN_COOKIE as L, REFRESH_TOKEN_COOKIE as R, findLoginCookies as f };
|
|
6
|
+
//# sourceMappingURL=CookieConstants-3d3b6531.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CookieConstants-3d3b6531.js","sources":["../src/user/util/CookieConstants.ts"],"sourcesContent":["export const LOGIN_COOKIE = 'ContensisCMSUserName';\nexport const REFRESH_TOKEN_COOKIE = 'RefreshToken';\n\nexport type CookieObject = { [name: string]: any };\n\nexport const findLoginCookies = (cookies: CookieObject | string) =>\n typeof cookies === 'object'\n ? Object.fromEntries(\n Object.entries(cookies).filter(([name]) =>\n [LOGIN_COOKIE, REFRESH_TOKEN_COOKIE].includes(name)\n )\n )\n : cookies;\n"],"names":["LOGIN_COOKIE","REFRESH_TOKEN_COOKIE","findLoginCookies","cookies","Object","fromEntries","entries","filter","name","includes"],"mappings":"AAAO,MAAMA,YAAY,GAAG,uBAAsB;AAC3C,MAAMC,oBAAoB,GAAG,eAAc;MAIrCC,gBAAgB,GAAIC,OAA8B,IAC7D,OAAOA,OAAO,KAAK,QAAQ,GACvBC,MAAM,CAACC,WAAW,CAChBD,MAAM,CAACE,OAAO,CAACH,OAAO,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,KACpC,CAACR,YAAY,EAAEC,oBAAoB,CAAC,CAACQ,QAAQ,CAACD,IAAI,CAAC,CACpD,CACF,GACDL;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
|
+
import { useCookies } from 'react-cookie';
|
|
2
3
|
import { connect } from 'react-redux';
|
|
3
4
|
import { hot } from 'react-hot-loader';
|
|
4
5
|
import { Route, useLocation, Redirect } from 'react-router-dom';
|
|
5
6
|
import { matchRoutes, renderRoutes } from 'react-router-config';
|
|
6
7
|
import { createSelector } from 'reselect';
|
|
7
|
-
import { r as selectRouteEntryContentTypeId, a as selectRouteEntry, t as selectRouteIsError, u as selectIsNotFound, v as selectRouteLoading, k as selectMappedEntry, b as selectCurrentProject, w as selectCurrentPath, x as selectRouteStatusCode, y as selectRouteErrorMessage, z as setNavigationPath } from './selectors-
|
|
8
|
-
import { a as selectUserIsAuthenticated, b as selectUserGroups, t as toJS, m as matchUserGroup } from './ToJs-
|
|
8
|
+
import { r as selectRouteEntryContentTypeId, a as selectRouteEntry, t as selectRouteIsError, u as selectIsNotFound, v as selectRouteLoading, k as selectMappedEntry, b as selectCurrentProject, w as selectCurrentPath, x as selectRouteStatusCode, y as selectRouteErrorMessage, z as setNavigationPath } from './selectors-01074974.js';
|
|
9
|
+
import { a as selectUserIsAuthenticated, b as selectUserGroups, t as toJS, C as CookieHelper, m as matchUserGroup } from './ToJs-ae860aad.js';
|
|
9
10
|
|
|
10
11
|
const NotFound = ({
|
|
11
12
|
statusCode,
|
|
@@ -71,13 +72,14 @@ const RouteLoader = ({
|
|
|
71
72
|
trailingSlashRedirectCode = 302
|
|
72
73
|
}) => {
|
|
73
74
|
const location = useLocation();
|
|
75
|
+
const cookies = new CookieHelper(...useCookies());
|
|
74
76
|
// Always ensure paths are trimmed of trailing slashes so urls are always unique
|
|
75
77
|
const trimmedPath = getTrimmedPath(location.pathname);
|
|
76
78
|
|
|
77
79
|
// Match any Static Routes a developer has defined
|
|
78
80
|
const matchedStaticRoute = () => matchRoutes(routes.StaticRoutes, location.pathname);
|
|
79
81
|
const isStaticRoute = () => matchedStaticRoute().length > 0;
|
|
80
|
-
const staticRoute = isStaticRoute()
|
|
82
|
+
const staticRoute = isStaticRoute() ? matchedStaticRoute()[0] : undefined;
|
|
81
83
|
const routeRequiresLogin = staticRoute && staticRoute.route.requireLogin;
|
|
82
84
|
const setPath = useCallback(() => {
|
|
83
85
|
// Use serverPath to control the path we send to siteview node api to resolve a route
|
|
@@ -108,7 +110,7 @@ const RouteLoader = ({
|
|
|
108
110
|
serverPath = (_route$path2 = route.path) === null || _route$path2 === void 0 ? void 0 : _route$path2.split('/').filter(p => !p.startsWith(':')).join('/');
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
|
-
setNavigationPath(serverPath || trimmedPath, location, staticRoute, withEvents, statePath, routes);
|
|
113
|
+
setNavigationPath(serverPath || trimmedPath, location, staticRoute, withEvents, statePath, routes, cookies);
|
|
112
114
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
115
|
}, [setNavigationPath,
|
|
114
116
|
// staticRoute,
|
|
@@ -162,6 +164,7 @@ const RouteLoader = ({
|
|
|
162
164
|
}
|
|
163
165
|
const NotFoundComponent = notFoundComponent ? notFoundComponent : NotFound;
|
|
164
166
|
if (isNotFound || isError) {
|
|
167
|
+
console.info(`RouteLoader rendering NotFound component: statusCode ${statusCode}, isNotFound ${isNotFound}, isError ${isError}`);
|
|
165
168
|
return /*#__PURE__*/React.createElement(Status, {
|
|
166
169
|
code: statusCode
|
|
167
170
|
}, /*#__PURE__*/React.createElement(NotFoundComponent, {
|
|
@@ -191,4 +194,4 @@ const mapDispatchToProps = {
|
|
|
191
194
|
var RouteLoader$1 = hot(module)(connect(mapStateToPropsMemoized, mapDispatchToProps)(toJS(RouteLoader)));
|
|
192
195
|
|
|
193
196
|
export { RouteLoader$1 as R };
|
|
194
|
-
//# sourceMappingURL=RouteLoader-
|
|
197
|
+
//# sourceMappingURL=RouteLoader-02eef6d9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteLoader-02eef6d9.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 { useCookies } from 'react-cookie';\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 { CookieHelper } from '~/user/util/CookieHelper.class';\n\nimport { Entry } from 'contensis-delivery-api/lib/models';\nimport { AppRootProps, RouteComponentProps, RouteLoaderProps } from '../routes';\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 const cookies = new CookieHelper(...useCookies());\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 cookies\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","cookies","CookieHelper","useCookies","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,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,MAAM;AAClBC,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,QAAQ,EAAE,MAAM;AAChBC,IAAAA,OAAO,EAAE,MAAA;AACX,GAAA;AAAE,CAEDR,EAAAA,UAAU,CAEd,CACM,CAEZ;;ACvBM,MAAMS,MAAM,GAAGA,CAAC;EACrBC,IAAI;AACJC,EAAAA,QAAAA;AACmC,CAAC,KAAK;AACzC,EAAA,oBACEV,KAAA,CAAAC,aAAA,CAACU,KAAK,EAAA;AACJC,IAAAA,MAAM,EAAEA,CAAC;AAAEC,MAAAA,aAAAA;AAAc,KAAC,KAAK;AAC7B,MAAA,IAAIA,aAAa,EAAEA,aAAa,CAACf,UAAU,GAAGW,IAAI,CAAA;AAClD,MAAA,OAAOC,QAAQ,CAAA;AACjB,KAAA;GACA,CAAA,CAAA;AAEN,CAAC;;ACqBD,MAAM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AEA,UAAAA;AAAW,KAAA,CAAG,CAC9D,CAAA;AAEb,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AACD,MAAMsG,uBAAuB,GAAGC,cAAc,CAC5CC,6BAA6B,EAC7BC,gBAAgB,EAChBC,kBAAkB,EAClBC,gBAAgB,EAChBC,kBAAkB,EAClBC,yBAAyB,EACzBC,iBAAiB,EACjBC,oBAAoB,EACpBC,iBAAiB,EACjBC,qBAAqB,EACrBC,uBAAuB,EACvBC,gBAAgB,EAChB,CACE1F,aAAa,EACbC,KAAK,EACLC,OAAO,EACPG,UAAU,EACVF,SAAS,EACTC,UAAU,EACVG,WAAW,EACXE,SAAS,EACTG,SAAS,EACTtC,UAAU,EACVC,UAAU,EACVsC,UAAU,MACN;EACJb,aAAa;EACbC,KAAK;EACLC,OAAO;EACPG,UAAU;EACVF,SAAS;EACTC,UAAU;EACVG,WAAW;EACXE,SAAS;EACTG,SAAS;EACTtC,UAAU;EACVC,UAAU;AACVsC,EAAAA,UAAAA;AACF,CAAC,CAAC,CACH,CAAA;AAED,MAAM8E,kBAAkB,GAAG;AACzBhF,EAAAA,iBAAAA;AACF,CAAC,CAAA;AAED,oBAAeiF,GAAG,CAACC,MAAM,CAAC,CACxBC,OAAO,CAACjB,uBAAuB,EAAEc,kBAAkB,CAAC,CAACI,IAAI,CAAChG,WAAW,CAAQ,CAAC,CAC/E;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getImmutableOrJS } from './selectors-
|
|
1
|
+
import { g as getImmutableOrJS } from './selectors-01074974.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
const selectUserIsLoading = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isLoading']);
|
|
@@ -81,6 +81,52 @@ const matchUserGroup = (userGroups = [], requiredGroups = []) => {
|
|
|
81
81
|
return groupMatch;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
const COOKIE_VALID_DAYS = 1; // 0 = Session cookie
|
|
85
|
+
|
|
86
|
+
// CookieHelper is a class that takes in and lets us pass around the methods provided
|
|
87
|
+
// by `useCookie` react hook in backend code that is connected to the universal-cookies
|
|
88
|
+
// instance created in SSR middleware (and provides browser cookies)
|
|
89
|
+
class CookieHelper {
|
|
90
|
+
get raw() {
|
|
91
|
+
return this.cookies;
|
|
92
|
+
}
|
|
93
|
+
constructor(cookies, setCookie, removeCookie) {
|
|
94
|
+
this.cookies = void 0;
|
|
95
|
+
this.setCookie = void 0;
|
|
96
|
+
this.removeCookie = void 0;
|
|
97
|
+
this.cookies = cookies;
|
|
98
|
+
this.setCookie = setCookie;
|
|
99
|
+
this.removeCookie = removeCookie;
|
|
100
|
+
}
|
|
101
|
+
GetCookie(name) {
|
|
102
|
+
const cookie = this.cookies[name];
|
|
103
|
+
if (typeof cookie === 'undefined') {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return cookie;
|
|
107
|
+
}
|
|
108
|
+
SetCookie(name, value, maxAgeDays = COOKIE_VALID_DAYS) {
|
|
109
|
+
// update local cookies object as this is provided as a clone of `req.universalCookies`
|
|
110
|
+
this.cookies[name] = value;
|
|
111
|
+
|
|
112
|
+
// call the passed setCookie method so we can update the `universal-cookie` instance
|
|
113
|
+
// with the change listener attached so the cookies can be set in SSR response
|
|
114
|
+
if (maxAgeDays === 0) this.setCookie(name, value);else this.setCookie(name, value, {
|
|
115
|
+
expires: addDays(new Date(), maxAgeDays)
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
DeleteCookie(name) {
|
|
119
|
+
// update local cookies object as this is provided as a clone of `req.universalCookies`
|
|
120
|
+
delete this.cookies[name];
|
|
121
|
+
this.removeCookie(name);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const addDays = (date = new Date(), days) => {
|
|
125
|
+
const result = new Date(date);
|
|
126
|
+
result.setDate(result.getDate() + days);
|
|
127
|
+
return result;
|
|
128
|
+
};
|
|
129
|
+
|
|
84
130
|
/* eslint-disable react/display-name */
|
|
85
131
|
const toJS = WrappedComponent => wrappedComponentProps => {
|
|
86
132
|
const KEY = 0;
|
|
@@ -94,5 +140,5 @@ const toJS = WrappedComponent => wrappedComponentProps => {
|
|
|
94
140
|
return /*#__PURE__*/React.createElement(WrappedComponent, propsJS);
|
|
95
141
|
};
|
|
96
142
|
|
|
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-
|
|
143
|
+
export { CookieHelper as C, 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 };
|
|
144
|
+
//# sourceMappingURL=ToJs-ae860aad.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToJs-ae860aad.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/user/util/CookieHelper.class.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","import { useCookies } from 'react-cookie';\n\nconst COOKIE_VALID_DAYS = 1; // 0 = Session cookie\n\ntype CookieHook = ReturnType<typeof useCookies>;\ntype Cookies = { [k: string]: string };\ntype SetCookie = CookieHook[1];\ntype RemoveCookie = CookieHook[2];\n\n// CookieHelper is a class that takes in and lets us pass around the methods provided\n// by `useCookie` react hook in backend code that is connected to the universal-cookies\n// instance created in SSR middleware (and provides browser cookies)\nexport class CookieHelper {\n private cookies: Cookies;\n private setCookie: SetCookie;\n private removeCookie: RemoveCookie;\n\n get raw() {\n return this.cookies;\n }\n\n constructor(\n cookies: { [k: string]: string },\n setCookie: CookieHelper['setCookie'],\n removeCookie: CookieHelper['removeCookie']\n ) {\n this.cookies = cookies;\n this.setCookie = setCookie;\n this.removeCookie = removeCookie;\n }\n\n GetCookie(name: string) {\n const cookie = this.cookies[name];\n if (typeof cookie === 'undefined') {\n return null;\n }\n return cookie;\n }\n\n SetCookie(name: string, value: string, maxAgeDays = COOKIE_VALID_DAYS) {\n // update local cookies object as this is provided as a clone of `req.universalCookies`\n this.cookies[name] = value;\n\n // call the passed setCookie method so we can update the `universal-cookie` instance\n // with the change listener attached so the cookies can be set in SSR response\n if (maxAgeDays === 0) this.setCookie(name, value);\n else\n this.setCookie(name, value, {\n expires: addDays(new Date(), maxAgeDays),\n });\n }\n\n DeleteCookie(name: string) {\n // update local cookies object as this is provided as a clone of `req.universalCookies`\n delete this.cookies[name];\n\n this.removeCookie(name);\n }\n}\nconst addDays = (date = new Date(), days: number) => {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n};\n\nexport const mapCookieHeader = cookies =>\n typeof cookies === 'object'\n ? Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n : cookies;\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","COOKIE_VALID_DAYS","CookieHelper","raw","cookies","constructor","setCookie","removeCookie","GetCookie","cookie","SetCookie","value","maxAgeDays","expires","addDays","Date","DeleteCookie","date","days","result","setDate","getDate","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","propKey","propValue","React","createElement"],"mappings":";;;MAIaA,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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GA,CAACG,IAAI,GAAG,IAAIF,IAAI,EAAE,EAAEG,IAAY,KAAK;AACnD,EAAA,MAAMC,MAAM,GAAG,IAAIJ,IAAI,CAACE,IAAI,CAAC,CAAA;EAC7BE,MAAM,CAACC,OAAO,CAACD,MAAM,CAACE,OAAO,EAAE,GAAGH,IAAI,CAAC,CAAA;AACvC,EAAA,OAAOC,MAAM,CAAA;AACf,CAAC;;AC/DD;MAIaG,IAAI,GAEbC,gBAA4C,IAE7CC,qBAA4B,IAAK;EAChC,MAAMC,GAAG,GAAG,CAAC,CAAA;EACb,MAAMC,KAAK,GAAG,CAAC,CAAA;AAEf,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,OAAO,CAACL,qBAAqB,CAAC,CAACM,MAAM,CAC1D,CAACC,QAAa,EAAEC,oBAAoB,KAAK;AACvC,IAAA,MAAMC,OAAO,GAAGD,oBAAoB,CAACP,GAAG,CAAC,CAAA;AACzC,IAAA,MAAMS,SAAS,GAAGF,oBAAoB,CAACN,KAAK,CAAC,CAAA;IAC7CK,QAAQ,CAACE,OAAO,CAAC,GACfC,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,MAAM,IAAIA,SAAS,GAC7DA,SAAS,CAACZ,IAAI,EAAE,GAChBY,SAAS,CAAA;AACf,IAAA,OAAOH,QAAQ,CAAA;GAChB,EACD,EAAE,CACH,CAAA;AAED,EAAA,oBAAOI,KAAA,CAAAC,aAAA,CAACb,gBAAgB,EAAKI,OAAO,CAAI,CAAA;AAC1C;;;;"}
|
package/esm/client.js
CHANGED
|
@@ -7,12 +7,12 @@ 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 { c as createStore, s as selectVersionStatus } from './version-
|
|
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 setCurrentProject } from './selectors-
|
|
15
|
-
import { d as deliveryApi } from './ContensisDeliveryApi-
|
|
10
|
+
import { c as createStore, s as selectVersionStatus } from './version-346a9787.js';
|
|
11
|
+
import { s as setVersionStatus } from './version-0fbd1b82.js';
|
|
12
|
+
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-ff944c78.js';
|
|
13
|
+
export { A as ReactApp } from './App-ff944c78.js';
|
|
14
|
+
import { c as setCurrentProject } from './selectors-01074974.js';
|
|
15
|
+
import { d as deliveryApi } from './ContensisDeliveryApi-c66b0cc3.js';
|
|
16
16
|
import 'redux';
|
|
17
17
|
import 'redux-thunk';
|
|
18
18
|
import 'redux-saga';
|
|
@@ -22,16 +22,19 @@ import './reducers-3d5c37d1.js';
|
|
|
22
22
|
import '@redux-saga/core/effects';
|
|
23
23
|
import 'history';
|
|
24
24
|
import 'loglevel';
|
|
25
|
-
import './login-e4b1447e.js';
|
|
26
|
-
import './ToJs-b18ab86e.js';
|
|
27
|
-
import 'jsonpath-mapper';
|
|
28
25
|
import 'await-to-js';
|
|
29
|
-
import 'js
|
|
26
|
+
import './ChangePassword.container-ae0f9ce4.js';
|
|
27
|
+
import './ToJs-ae860aad.js';
|
|
28
|
+
import 'jsonpath-mapper';
|
|
29
|
+
import './CookieConstants-3d3b6531.js';
|
|
30
30
|
import 'contensis-delivery-api';
|
|
31
|
-
import './RouteLoader-
|
|
31
|
+
import './RouteLoader-02eef6d9.js';
|
|
32
32
|
import 'react-router-config';
|
|
33
33
|
import 'reselect';
|
|
34
34
|
|
|
35
|
+
// Fix TS2769 error No overload matches this call
|
|
36
|
+
const Container = AppContainer; // as typeof AppContainer;
|
|
37
|
+
|
|
35
38
|
class ClientApp {
|
|
36
39
|
constructor(ReactApp, config) {
|
|
37
40
|
const documentRoot = document.getElementById('root');
|
|
@@ -43,7 +46,7 @@ class ClientApp {
|
|
|
43
46
|
withEvents
|
|
44
47
|
} = config;
|
|
45
48
|
const GetClientJSX = store => {
|
|
46
|
-
const ClientJsx = /*#__PURE__*/React.createElement(
|
|
49
|
+
const ClientJsx = /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(CookiesProvider, null, /*#__PURE__*/React.createElement(Provider, {
|
|
47
50
|
store: store
|
|
48
51
|
}, /*#__PURE__*/React.createElement(Router, {
|
|
49
52
|
history: browserHistory
|
package/esm/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 { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\n\nimport { selectVersionStatus } from '~/redux/selectors/version';\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 <
|
|
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 { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\n\nimport { selectVersionStatus } from '~/redux/selectors/version';\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\n// Fix TS2769 error No overload matches this call\nconst Container = AppContainer as any; // as typeof AppContainer;\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 <Container>\n <CookiesProvider>\n <ReduxProvider store={store}>\n <Router history={history}>\n <ReactApp routes={routes} withEvents={withEvents} />\n </Router>\n </ReduxProvider>\n </CookiesProvider>\n </Container>\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 = parse(window.location.search);\n const versionStatus = 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 const state = store.getState();\n const ssrVersionStatus = selectVersionStatus(state);\n if (!ssrVersionStatus)\n store.dispatch(setVersionStatus(versionStatus));\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 const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n store.dispatch(setVersionStatus(versionStatus));\n\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 HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["Container","AppContainer","ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","React","createElement","CookiesProvider","ReduxProvider","Router","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrate","namespace","render","hmr","module","hot","accept","qs","parse","window","location","search","versionStatus","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","state","getState","ssrVersionStatus","selectVersionStatus","dispatch","setVersionStatus","console","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA;AACA,MAAMA,SAAS,GAAGC,YAAmB,CAAC;;AAEtC,MAAMC,SAAS,CAAC;AACdC,EAAAA,WAAWA,CAACC,QAA4C,EAAEC,MAAiB,EAAE;AAC3E,IAAA,M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