+
+
+
+
+
+
+
+
+
+
+
+
+
+ Congratulations,
+
+
+
+
+
+ your Red Hat and {partner} accounts are connected and you can now access Red Hat support resources
-
-
-
-
- your Red Hat and AWS accounts are connected and you can now access Red Hat support resources
-
-
-
-
-
-
-
- To get started using your Red Hat products, follow the links below
-
-
-
-
-
-
- {productsList.map((item, i) => (
-
- ))}
-
-
-
-
-
-
-
- To manage or learn more about your Red Hat subscriptions, visit{' '}
-
- subscriptions.
-
-
-
-
-
-
-
-
-
-
-);
+
+
+
+ {partnerId !== 'from-azure' && (
+ <>
+
+
+
+ To get started using your Red Hat products, follow the links below
+
+
+
+
+
+
+ {productsList.map((item, i) => (
+
+ ))}
+
+
+
+ >
+ )}
+
+
+
+
+ To manage or learn more about your Red Hat subscriptions, visit{' '}
+
+ subscriptions.
+
+
+
+
+
+
+
+
+
+
+ );
+};
export default ProductSelection;
diff --git a/src/components/Stratosphere/RedirectBanner.test.tsx b/src/components/Stratosphere/RedirectBanner.test.tsx
index 024a14a95a..bf1e42bd97 100644
--- a/src/components/Stratosphere/RedirectBanner.test.tsx
+++ b/src/components/Stratosphere/RedirectBanner.test.tsx
@@ -6,7 +6,8 @@ import configureStore from 'redux-mock-store';
import { InitialEntry } from 'history';
import { Store } from 'redux';
-import RedirectBanner, { AWS_BANNER_NAME, AZURE_BANNER_NAME } from './RedirectBanner';
+import RedirectBanner from './RedirectBanner';
+import { AWS_BANNER_NAME, AZURE_BANNER_NAME } from '../../hooks/useMarketplacePartner';
const LocationSpy: React.VoidFunctionComponent<{ changeSpy: jest.Mock }> = ({ changeSpy }) => {
const { search, pathname, hash, state } = useLocation();
diff --git a/src/components/Stratosphere/RedirectBanner.tsx b/src/components/Stratosphere/RedirectBanner.tsx
index d6d1f9fa6d..ca6ef25f06 100644
--- a/src/components/Stratosphere/RedirectBanner.tsx
+++ b/src/components/Stratosphere/RedirectBanner.tsx
@@ -4,39 +4,22 @@ import { Text, TextContent } from '@patternfly/react-core/dist/dynamic/component
import { useSelector } from 'react-redux';
import { useLocation, useNavigate } from 'react-router-dom';
import { ReduxState } from '../../redux/store';
-
-// TODO: Figure out what param chrome should expect
-export const AWS_BANNER_NAME = 'from-aws';
-export const AZURE_BANNER_NAME = 'from-azure';
-export const GCP_BANNER_NAME = 'from-gcp';
-
-const partnerMapper: { [partner: string]: string } = {
- [AWS_BANNER_NAME]: 'AWS',
- [AZURE_BANNER_NAME]: 'Microsoft Azure',
- [GCP_BANNER_NAME]: 'Google Cloud',
-};
-const possibleParams = [AWS_BANNER_NAME, AZURE_BANNER_NAME, GCP_BANNER_NAME];
-
-const hasPartner = (params: URLSearchParams) => possibleParams.find((param) => params.has(param));
+import useMarketplacePartner from '../../hooks/useMarketplacePartner';
const RedirectBanner = () => {
- const { pathname, search, hash, state } = useLocation();
+ const { pathname, hash, state } = useLocation();
+ const { partnerId, partner, removePartnerParam } = useMarketplacePartner();
const navigate = useNavigate();
- const params = new URLSearchParams(search);
- const isVisible = hasPartner(params);
- const partner = isVisible ? partnerMapper[isVisible] : null;
const product = useSelector((state) => state.chrome.activeProduct);
const handleClose = () => {
// remove only the flag search param
- params.delete(AWS_BANNER_NAME);
- params.delete(AZURE_BANNER_NAME);
- params.delete(GCP_BANNER_NAME);
+ const clearedParams = removePartnerParam();
// only change the search params
navigate(
{
pathname,
- search: params.toString(),
+ search: clearedParams.toString(),
hash,
},
{
@@ -46,7 +29,7 @@ const RedirectBanner = () => {
);
};
// show the banner only if correct search param exists
- return isVisible ? (
+ return partnerId ? (
}
isInline
@@ -54,10 +37,17 @@ const RedirectBanner = () => {
title={`Congratulations, your Red Hat and ${partner} accounts are linked`}
>
-
- Welcome to the Red Hat Hybrid Cloud Console. If you cannot access production tools for a subscription that you have purchased, please wait 5
- minutes and and confirm your subscription at subscription inventory. {product ? `Here you can configure or manage ${product}` : ''}.
-
+ {partnerId === 'from-azure' ? (
+
+ It may take up to two days for all subscription information between Red Hat and Microsoft to synchronize. If any subscription services are
+ needed in the meantime, like technical support, simply note this in your request to receive the full benefit of your new subscription.
+
+ ) : (
+
+ Welcome to the Red Hat Hybrid Cloud Console. If you cannot access production tools for a subscription that you have purchased, please wait
+ 5 minutes and and confirm your subscription at subscription inventory. {product ? `Here you can configure or manage ${product}.` : ''}
+
+ )}
View subscription inventory
diff --git a/src/hooks/useMarketplacePartner.ts b/src/hooks/useMarketplacePartner.ts
new file mode 100644
index 0000000000..08637ef55d
--- /dev/null
+++ b/src/hooks/useMarketplacePartner.ts
@@ -0,0 +1,37 @@
+import { useLocation } from 'react-router-dom';
+
+// TODO: Figure out what param chrome should expect
+export const AWS_BANNER_NAME = 'from-aws';
+export const AZURE_BANNER_NAME = 'from-azure';
+export const GCP_BANNER_NAME = 'from-gcp';
+
+const partnerMapper: { [partner: string]: string } = {
+ [AWS_BANNER_NAME]: 'AWS',
+ [AZURE_BANNER_NAME]: 'Microsoft Azure',
+ [GCP_BANNER_NAME]: 'Google Cloud',
+};
+const possibleParams = [AWS_BANNER_NAME, AZURE_BANNER_NAME, GCP_BANNER_NAME];
+
+const hasPartner = (params: URLSearchParams) => possibleParams.find((param) => params.has(param));
+
+const removePartnerParam = (params: URLSearchParams) => {
+ params.delete(AWS_BANNER_NAME);
+ params.delete(AZURE_BANNER_NAME);
+ params.delete(GCP_BANNER_NAME);
+ return params;
+};
+
+const useMarketplacePartner = () => {
+ const { search } = useLocation();
+
+ const params = new URLSearchParams(search);
+ const partnerId = hasPartner(params);
+ const partner = partnerId ? partnerMapper[partnerId] : null;
+ return {
+ partner,
+ partnerId,
+ removePartnerParam: () => removePartnerParam(params),
+ };
+};
+
+export default useMarketplacePartner;
diff --git a/src/jwt/Priv.ts b/src/jwt/Priv.ts
index 0d3d84260a..f82199a789 100644
--- a/src/jwt/Priv.ts
+++ b/src/jwt/Priv.ts
@@ -1,7 +1,7 @@
import Keycloak, { KeycloakConfig, KeycloakInitOptions, KeycloakLoginOptions, KeycloakLogoutOptions } from 'keycloak-js';
-import { ITLess } from '../utils/common';
+import { ITLessCognito } from '../utils/common';
-const isITLessEnv = ITLess();
+const isITLessCognito = ITLessCognito();
export type PrivCookie = {
cookieName: string;
@@ -112,7 +112,7 @@ class Priv {
updateToken() {
// 5 is default KC value, min validaty is required by KC byt then has a default value for some reason
- if (!isITLessEnv) {
+ if (!isITLessCognito) {
return this._keycloak.updateToken(5);
}
}
diff --git a/src/jwt/__mocks__/keycloak-js.ts b/src/jwt/__mocks__/keycloak-js.ts
index 240bcaa5b4..dc170dd4d0 100644
--- a/src/jwt/__mocks__/keycloak-js.ts
+++ b/src/jwt/__mocks__/keycloak-js.ts
@@ -1,5 +1,7 @@
import cookie from 'js-cookie';
import { data as encodedToken } from '../../../testdata/encodedToken.json';
+import { ITLessKeycloak } from '../../utils/common';
+
class Keycloak {
scope: any;
token: any;
@@ -30,7 +32,7 @@ class Keycloak {
this.responseMode = 'fragment';
this.responseType = 'code';
this.flow = 'standard';
- this.clientId = 'cloud-services';
+ this.clientId = ITLessKeycloak() ? 'console-dot' : 'cloud-services';
this.authServerUrl = 'https://sso.qa.redhat.com/auth';
this.realm = 'redhat-external';
this.endpoints = {};
diff --git a/src/jwt/jwt.ts b/src/jwt/jwt.ts
index 9eff1acab6..d526504ea8 100644
--- a/src/jwt/jwt.ts
+++ b/src/jwt/jwt.ts
@@ -4,7 +4,8 @@ import { BroadcastChannel } from 'broadcast-channel';
import cookie from 'js-cookie';
import {
DEFAULT_SSO_ROUTES,
- ITLess,
+ ITLessCognito,
+ ITLessKeycloak,
LOGIN_SCOPES_STORAGE_KEY,
deleteLocalStorageItems,
getRouterBasename,
@@ -27,7 +28,8 @@ const log = logger('jwt.js');
const DEFAULT_COOKIE_NAME = 'cs_jwt';
const priv = new Priv();
-const itLessEnv = ITLess();
+const itLessCognito = ITLessCognito();
+const itLessKeycloakEnv = ITLessKeycloak();
enum AllowedPartnerScopes {
aws = 'aws',
@@ -134,7 +136,7 @@ export const doOffline = (key: string, val: string, configSsoUrl?: string) => {
scopes.push(partnerScope);
}
- if (ssoScopes) {
+ if (ssoScopes && !itLessKeycloakEnv) {
try {
// make sure add openid scope when custom scope is used
scopes.push('openid', JSON.parse(ssoScopes));
@@ -168,7 +170,7 @@ export const init = (options: JWTInitOptions, configSsoUrl?: string) => {
const cookieName = options.cookieName ? options.cookieName : DEFAULT_COOKIE_NAME;
priv.setCookie({ cookieName });
- if (itLessEnv) {
+ if (itLessCognito) {
let token;
let cogUser: CogUser;
@@ -197,7 +199,7 @@ export const init = (options: JWTInitOptions, configSsoUrl?: string) => {
return Promise.resolve(platformUrl(options.routes ? options.routes : DEFAULT_SSO_ROUTES, configSsoUrl)).then((ssoUrl) => {
//constructor for new Keycloak Object?
options.url = ssoUrl;
- options.clientId = 'cloud-services';
+ options.clientId = itLessKeycloakEnv ? 'console-dot' : 'cloud-services';
options.realm = 'redhat-external';
//options for keycloak.init method
@@ -293,10 +295,10 @@ export function isExistingValid(token?: string) {
export async function initSuccess() {
log('JWT Initialized');
let cogToken;
- if (itLessEnv) {
+ if (itLessCognito) {
cogToken = await getTokenWithAuthorizationCode();
}
- const token = itLessEnv ? cogToken : priv.getToken();
+ const token = itLessCognito ? cogToken : priv.getToken();
setCookie(token);
}
@@ -405,6 +407,9 @@ function refreshTokens() {
setCookie(priv.getToken());
authChannel.postMessage({ type: 'refresh' });
}
+export function getRefreshToken() {
+ return priv.getRefershToken();
+}
// Actually update the token
export function updateToken() {
@@ -445,14 +450,14 @@ export async function setCookie(token?: string) {
log('Setting the cs_jwt cookie');
let cogToken;
let cogUser;
- if (itLessEnv) {
+ if (itLessCognito) {
cogToken = await getTokenWithAuthorizationCode();
cogUser = await getUser();
}
- const tok = itLessEnv ? cogToken : token;
+ const tok = itLessCognito ? cogToken : token;
if (tok && tok.length > 10) {
// FIXME: Fix cognito typing not to use any
- const tokExpires = itLessEnv ? cogUser.exp : decodeToken(tok).exp;
+ const tokExpires = itLessCognito ? cogUser.exp : decodeToken(tok).exp;
const cookieName = priv.getCookie()?.cookieName;
if (cookieName) {
setCookieWrapper(`${cookieName}=${tok};` + `path=/wss;` + `secure=true;` + `expires=${getCookieExpires(tokExpires)}`);
diff --git a/src/jwt/offline.ts b/src/jwt/offline.ts
index 3200ff6425..921a916d6f 100644
--- a/src/jwt/offline.ts
+++ b/src/jwt/offline.ts
@@ -1,7 +1,7 @@
import consts, { OFFLINE_REDIRECT_STORAGE_KEY } from '../utils/consts';
import insightsUrl from './url';
import axios, { AxiosResponse } from 'axios';
-import { DEFAULT_SSO_ROUTES } from '../utils/common';
+import { DEFAULT_SSO_ROUTES, ITLessKeycloak, getEnv } from '../utils/common';
type Priv = {
postbackUrl?: string;
@@ -83,11 +83,18 @@ export function getPostbackUrl() {
}
export function getPostDataObject(url: string, clientId: string, code: string) {
+ const scr = getEnv() === 'scr';
+ const int = getEnv() === 'int';
+ const redirectUrl = scr
+ ? 'https://console01.stage.openshiftusgov.com/'
+ : int
+ ? 'https://console.int.openshiftusgov.com/'
+ : 'https://ephem.outrights.cc';
return {
code: code,
grant_type: 'authorization_code', // eslint-disable-line camelcase
- client_id: clientId, // eslint-disable-line camelcase
- redirect_uri: encodeURIComponent(url.split('#')[0]), // eslint-disable-line camelcase
+ client_id: ITLessKeycloak() ? 'console-dot' : clientId, // eslint-disable-line camelcase
+ redirect_uri: ITLessKeycloak() ? redirectUrl : encodeURIComponent(url.split('#')[0]), // eslint-disable-line camelcase
};
}
diff --git a/src/jwt/user.ts b/src/jwt/user.ts
index 1538c7ba86..0a4ef036eb 100644
--- a/src/jwt/user.ts
+++ b/src/jwt/user.ts
@@ -1,4 +1,4 @@
-import { ITLess, getRouterBasename, isBeta, isValidAccountNumber, pageAllowsUnentitled } from '../utils/common';
+import { ITLessCognito, getRouterBasename, isBeta, isValidAccountNumber, pageAllowsUnentitled } from '../utils/common';
import servicesApi from './entitlements';
import logger from './logger';
import { SSOParsedToken } from './Priv';
@@ -14,7 +14,7 @@ export type SSOServiceDetails = {
is_trial: boolean;
};
-const isITLessEnv = ITLess();
+const isITLessCognito = ITLessCognito();
const bounceInvocationLock: { [service: string]: boolean } = {
// not_entitled modal should appear only once for insights bundle
insights: false,
@@ -167,7 +167,7 @@ export function tryBounceIfUnentitled(
}
export default async (token: SSOParsedToken): Promise => {
- const user = isITLessEnv ? await createUser() : buildUser(token);
+ const user = isITLessCognito ? await createUser() : buildUser(token);
const pathName = getWindow().location.pathname.split('/');
pathName.shift();
@@ -187,12 +187,12 @@ export default async (token: SSOParsedToken): Promise => {
};
} = {};
// let cogToken;
- if (isITLessEnv) {
+ if (isITLessCognito) {
// cogToken = await getTokenWithAuthorizationCode();
}
try {
if (user.identity.org_id) {
- data = isITLessEnv
+ data = isITLessCognito
? ((await serviceAPI.servicesGet()) as unknown as typeof data)
: ((await serviceAPI.servicesGet()) as unknown as typeof data);
} else {
diff --git a/src/utils/common.ts b/src/utils/common.ts
index b0c8d49f3b..692669609c 100644
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@ -38,10 +38,25 @@ export const DEFAULT_SSO_ROUTES = {
portal: 'https://console.stage.openshiftusgov.com',
},
frhStage: {
+ url: ['console.stage.openshiftusgov.com'],
+ sso: 'https://ocm-ra-stage-domain.auth-fips.us-gov-west-1.amazoncognito.com/login',
+ portal: 'https://console.stage.openshiftusgov.com',
+ },
+ ephem: {
url: ['ephem.outsrights.cc'],
- sso: 'https://stage-gov-console.auth.us-east-1.amazoncognito.com/login',
+ sso: 'https://keycloak-fips-test.apps.fips-key.2vn8.p1.openshiftapps.com',
portal: 'https://ephem.outsrights.cc/',
},
+ int: {
+ url: ['console.int.openshiftusgov.com'],
+ sso: 'https://sso.int.openshiftusgov.com/',
+ portal: 'https://console.int.openshiftusgov.com/',
+ },
+ scr: {
+ url: ['console01.stage.openshiftusgov.com'],
+ sso: 'https://sso01.stage.openshiftusgov.com/',
+ portal: 'https://console01.stage.openshiftusgov.com',
+ },
dev: {
url: ['dev.foo.redhat.com', 'console.dev.redhat.com', 'us.console.dev.redhat.com'],
sso: 'https://sso.redhat.com/auth',
@@ -196,9 +211,17 @@ export function getRouterBasename(pathname?: string) {
}
export function ITLess() {
+ return getEnv() === 'frh' || getEnv() === 'frhStage' || getEnv() === 'ephem' || getEnv() === 'int' || getEnv() === 'scr';
+}
+
+export function ITLessCognito() {
return getEnv() === 'frh' || getEnv() === 'frhStage';
}
+export function ITLessKeycloak() {
+ return getEnv() === 'ephem' || getEnv() === 'int' || getEnv() === 'scr';
+}
+
export function updateDocumentTitle(title?: string, noSuffix = false) {
const titleSuffix = `| ${useBundle().bundleTitle}`;
if (typeof title === 'undefined') {
@@ -325,16 +348,18 @@ export const chromeServiceStaticPathname = {
beta: {
stage: '/static/beta/stage',
prod: '/static/beta/prod',
+ itless: '/static/beta/itless',
},
stable: {
stage: '/static/stable/stage',
prod: '/static/stable/prod',
+ itless: '/static/stable/itless',
},
};
export function getChromeStaticPathname(type: 'modules' | 'navigation' | 'services') {
const stableEnv = isBeta() ? 'beta' : 'stable';
- const prodEnv = isProd() ? 'prod' : 'stage';
+ const prodEnv = isProd() ? 'prod' : ITLess() ? 'itless' : 'stage';
return `${CHROME_SERVICE_BASE}${chromeServiceStaticPathname[stableEnv][prodEnv]}/${type}`;
}
@@ -374,7 +399,7 @@ export const loadFedModules = async () =>
export const generateRoutesList = (modules: { [key: string]: ChromeModule }) =>
Object.entries(modules)
.reduce(
- (acc, [scope, { dynamic, manifestLocation, isFedramp, modules = [] }]) => [
+ (acc, [scope, { dynamic, manifestLocation, modules = [] }]) => [
...acc,
...modules
.map(({ module, routes }) =>
@@ -382,7 +407,6 @@ export const generateRoutesList = (modules: { [key: string]: ChromeModule }) =>
routes.map((route) => ({
scope,
module,
- isFedramp: typeof route === 'string' ? isFedramp : route.isFedramp,
path: typeof route === 'string' ? route : route.pathname,
manifestLocation,
dynamic: typeof dynamic === 'boolean' ? dynamic : typeof route === 'string' ? true : route.dynamic,
diff --git a/src/utils/consts.ts b/src/utils/consts.ts
index 3c711d923c..e5c66d79e8 100644
--- a/src/utils/consts.ts
+++ b/src/utils/consts.ts
@@ -1,4 +1,4 @@
-import { ITLess } from './common';
+import { ITLess, ITLessKeycloak } from './common';
import { AppNavigationCB, ChromeAuthOptions, GenericCB, NavDOMEvent } from '../@types/types';
import { Listener } from '@redhat-cloud-services/frontend-components-utilities/MiddlewareListener';
import { APP_NAV_CLICK, GLOBAL_FILTER_UPDATE } from '../redux/action-types';
@@ -63,10 +63,9 @@ export const activationRequestURLs = [
];
// Global Defaults
-
export const defaultAuthOptions: ChromeAuthOptions = {
realm: 'redhat-external',
- clientId: 'cloud-services',
+ clientId: ITLessKeycloak() ? 'console-dot' : 'cloud-services',
cookieName: 'cs_jwt',
};
diff --git a/src/utils/fetchNavigationFiles.ts b/src/utils/fetchNavigationFiles.ts
index 8011017576..45cbabd864 100644
--- a/src/utils/fetchNavigationFiles.ts
+++ b/src/utils/fetchNavigationFiles.ts
@@ -1,13 +1,15 @@
import axios from 'axios';
import { BundleNavigation, NavItem, Navigation } from '../@types/types';
import { Required } from 'utility-types';
-import { requiredBundles } from '../components/AppFilter/useAppFilter';
-import { getChromeStaticPathname, isBeta } from './common';
+import { itLessBundles, requiredBundles } from '../components/AppFilter/useAppFilter';
+import { ITLessKeycloak, getChromeStaticPathname, isBeta } from './common';
export function isBundleNavigation(item: unknown): item is BundleNavigation {
return typeof item !== 'undefined';
}
+const bundles = ITLessKeycloak() ? itLessBundles : requiredBundles;
+
export function isNavItems(navigation: Navigation | NavItem[]): navigation is Navigation {
return Array.isArray((navigation as Navigation).navItems);
}
@@ -48,7 +50,7 @@ const fetchNavigationFiles = async () => {
}
filesCache.existingRequest = Promise.all(
- requiredBundles.map((fragment) =>
+ bundles.map((fragment) =>
axios
.get(`${getChromeStaticPathname('navigation')}/${fragment}-navigation.json?ts=${Date.now()}`)
.catch(() => axios.get(`${isBeta() ? '/beta' : ''}/config/chrome/${fragment}-navigation.json?ts=${Date.now()}`))
diff --git a/src/utils/iqeEnablement.ts b/src/utils/iqeEnablement.ts
index 586b98e176..f8d4adf27a 100644
--- a/src/utils/iqeEnablement.ts
+++ b/src/utils/iqeEnablement.ts
@@ -103,22 +103,15 @@ function init(store: Store, libJwt?: () => LibJWT | undefined) {
* Check response errors for cross_account requests.
* If we get error response with specific cross account error message, we kick the user out of the corss account session.
*/
- window.fetch = function fetchReplacement(path = '', options, ...rest) {
+ window.fetch = function fetchReplacement(input: URL | RequestInfo = '', init?: RequestInit | undefined, ...rest) {
const tid = Math.random().toString(36);
- const additionalHeaders: any = spreadAdditionalHeaders(options);
-
- const prom = oldFetch.apply(this, [
- path,
- {
- ...(options || {}),
- headers: {
- // If app wants to set its own Auth header it can do so
- ...(checkOrigin(path) && libJwt?.()?.jwt.isAuthenticated() && { Authorization: `Bearer ${libJwt?.()?.jwt.getEncodedToken()}` }),
- ...additionalHeaders,
- },
- },
- ...rest,
- ]);
+ const request: Request = new Request(input, init);
+
+ if (checkOrigin(input) && libJwt?.()?.jwt.isAuthenticated() && !request.headers.has('Authorization')) {
+ request.headers.append('Authorization', `Bearer ${libJwt?.()?.jwt.getEncodedToken()}`);
+ }
+
+ const prom = oldFetch.apply(this, [request, ...rest]);
if (iqeEnabled) {
fetchResults[tid] = arguments[0];
prom
diff --git a/src/utils/useRenderFedramp.ts b/src/utils/useRenderFedramp.ts
deleted file mode 100644
index 8e55b5c87e..0000000000
--- a/src/utils/useRenderFedramp.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { useEffect, useState } from 'react';
-import { useSelector } from 'react-redux';
-import { matchPath } from 'react-router-dom';
-import { ChromeModule } from '../@types/types';
-
-import { ReduxState } from '../redux/store';
-import { ITLess } from './common';
-const isITLessEnv = ITLess();
-
-export const computeFedrampResult = (
- isITLessEnv: boolean | string,
- linkHref = '',
- { modules, isFedramp }: Omit = { modules: [] }
-) => {
- /**
- * Render everything on non-fedramp env
- */
- if (!isITLessEnv) {
- return undefined;
- }
-
- /**
- * Look for module routes with fedramp flag that match the link
- */
- const configs =
- modules
- ?.map(({ routes }) => routes)
- .flat()
- .filter((route) => {
- if (typeof route !== 'object') {
- return false;
- }
-
- const match = matchPath(linkHref, route.pathname);
-
- return match !== null;
- })
- .filter((moduleRoute) => typeof moduleRoute !== 'string' && typeof moduleRoute.isFedramp === 'boolean') || [];
- const result = configs.length > 0 ? configs.some((moduleRoute) => typeof moduleRoute !== 'string' && moduleRoute.isFedramp === true) : undefined;
-
- if (typeof result === 'boolean') {
- return result;
- }
- /**
- * Global module setting has the lowest priority
- */
- return isFedramp;
-};
-
-const useRenderFedramp = (appId: string, linkHref: string) => {
- const module = useSelector(({ chrome: { modules } }: ReduxState) => modules && modules[appId]);
- const [shouldRender, setShouldRender] = useState(() => computeFedrampResult(isITLessEnv, linkHref, module));
-
- useEffect(() => {
- setShouldRender(computeFedrampResult(isITLessEnv, linkHref, module));
- }, [appId, linkHref]);
-
- return isITLessEnv ? shouldRender : true;
-};
-
-export default useRenderFedramp;