diff --git a/.travis.yml b/.travis.yml
index c3bc70a41..3b9b016d9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,11 +1,12 @@
language: node_js
sudo: required
+dist: jammy
notifications:
email: false
slack:
secure: 'd3g5oKl5kfzi2L96QTrj2g77lzLWzjnM6Ct2OTXRrk90GxxhwHS8RH4Q1IgBqkQjw68nkq7CNE9oAs+pt3si8kT4GQ164YLoTMVkDPBGOoOoMACPyanxQOEluUfdLEDIzChy/7EdlY3l1J2IM+lOK4e95jUwsT9BSXBsSladP++1EUiZfon9JcQSiSZa0e1/cVxLpEDuBB2cruUSTZ9sUATe/XZ0uH1EGzrooQJMkRgdty5UyNSsMxkvAY0Haivq8u9/gWAsLar0bA/90M5CVK7yohh9fY9UfTUbXVqwR3dFAXuW+SURrFVnPAX4FLZt/D09cg/CVCvoasiZdNi9RAeKOCfN+FoxB2ZJNnuM+4KDJX3dxnatd/stmEH1bcd75i4mh9zOWE1HX5d23HuZ4sKdDPpvhG3l7SpZfhLv0/EKL10ld9RdIaiTO2uPI3rsoyDeArzeV+09+dbB1iPKnS/3/Iw5KLhbew3mdJXKVfRk6KYcJySjT8EltrNy5Y7mty7/JzWssSpIpkMCnu6RGAtXO2v/jUfFm1WvsKK5BeH5efbLi1sjMNbVTeA3Bp8pvRPuw+50l94uDfeQ1HUTrq5zKXMUaG9dTdaYZX4fEDMmrbM1TLudjb9Xj4elaA5ioBH0gRFxAnSVTmrKFtFoCRVaqfmj3ceqxttCLUpkfvI='
node_js:
-- '16'
+- '18'
before_install:
- npm install -g npm@latest
install:
@@ -38,4 +39,4 @@ env:
cache:
directories:
- "$HOME/.npm"
- - ".cache"
\ No newline at end of file
+ - ".cache"
diff --git a/src/components/Stratosphere/ProductSelection.tsx b/src/components/Stratosphere/ProductSelection.tsx
index d042bc7b3..bfa470e4d 100644
--- a/src/components/Stratosphere/ProductSelection.tsx
+++ b/src/components/Stratosphere/ProductSelection.tsx
@@ -7,74 +7,82 @@ import ProductCard from './ProductCard';
import { Header } from '../Header/Header';
import ChromeLink from '../ChromeLink/ChromeLink';
import Footer from './Footer';
+import useMarketplacePartner from '../../hooks/useMarketplacePartner';
import './product-selection.scss';
-const ProductSelection = () => (
-
-
-
-
- }
- >
-
-
-
-
-
-
-
-
-
-
-
-
- Congratulations,
+const ProductSelection = () => {
+ const { partner, partnerId } = useMarketplacePartner();
+ return (
+
+
+
+
+ }
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+ 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 658468deb..983b8e637 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 171f58ff6..a0b62bbf1 100644
--- a/src/components/Stratosphere/RedirectBanner.tsx
+++ b/src/components/Stratosphere/RedirectBanner.tsx
@@ -3,39 +3,22 @@ import { Alert, AlertActionCloseButton, Text, TextContent } from '@patternfly/re
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,
},
{
@@ -45,7 +28,7 @@ const RedirectBanner = () => {
);
};
// show the banner only if correct search param exists
- return isVisible ? (
+ return partnerId ? (
}
isInline
diff --git a/src/hooks/useMarketplacePartner.ts b/src/hooks/useMarketplacePartner.ts
new file mode 100644
index 000000000..08637ef55
--- /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;