diff --git a/src/modules/integration-picker/IntegrationPicker.tsx b/src/modules/integration-picker/IntegrationPicker.tsx index 1b9e899..f77915a 100644 --- a/src/modules/integration-picker/IntegrationPicker.tsx +++ b/src/modules/integration-picker/IntegrationPicker.tsx @@ -1,6 +1,7 @@ import { Card } from '@stackone/malachite'; import { useCallback, useMemo, useState } from 'react'; import useFeatureFlags from '../../shared/hooks/useFeatureFlags'; +import { isEmbeddedInAuthLink } from '../../shared/utils/utils'; import { IntegrationPickerContent } from './components/IntegrationPickerContent'; import { IntegrationPickerTitle } from './components/IntegrationPickerTitle'; import CardFooter from './components/cardFooter'; @@ -81,6 +82,9 @@ export const IntegrationPicker: React.FC = ({ return activeIntegrations.length === 1; }, [hubData]); + // Hide close button when Hub is embedded in the auth link page + const hideCloseButton = useMemo(() => isEmbeddedInAuthLink(), []); + const onBack = () => { setSelectedIntegration(null); resetConnectionState(); @@ -96,6 +100,7 @@ export const IntegrationPicker: React.FC = ({ onClose?.()} showFooterLinks={showFooterLinks} + hideCloseButton={hideCloseButton} /> ) : ( void; showFooterLinks?: boolean; + hideCloseButton?: boolean; } -const SuccessCardFooter: React.FC = ({ showFooterLinks = true, onClose }) => { +const SuccessCardFooter: React.FC = ({ + showFooterLinks = true, + onClose, + hideCloseButton = false, +}) => { + // When both footer links and close button are hidden, render nothing + if (!showFooterLinks && hideCloseButton) { + return null; + } + + // When only footer links are shown (no close button) + if (hideCloseButton) { + return ; + } + return ( {showFooterLinks && } diff --git a/src/shared/utils/utils.ts b/src/shared/utils/utils.ts index 33f87d5..926ae3a 100644 --- a/src/shared/utils/utils.ts +++ b/src/shared/utils/utils.ts @@ -1,3 +1,13 @@ export const isFalconVersion = (version: string) => { return version != null && version != '1' && version != '2'; }; + +/** + * Detects if the Hub is embedded in the auth link page (e.g., /hub/embedded). + * When embedded in this context, certain UI elements like the Close button + * should be hidden since they don't function properly. + */ +export const isEmbeddedInAuthLink = (): boolean => { + if (typeof window === 'undefined') return false; + return window.location.pathname.includes('/hub/embedded'); +};