import {useEffect, useState} from 'react'; import Button from 'sentry/components/button'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import ThemeAndStyleProvider from 'sentry/components/themeAndStyleProvider'; import {t} from 'sentry/locale'; import useApi from 'sentry/utils/useApi'; type Props = { hash?: boolean | string; }; function SetupWizard({hash = false}: Props) { const api = useApi(); const [finished, setFinished] = useState(false); async function checkFinished() { try { await api.requestPromise(`/wizard/${hash}/`); } catch { setFinished(true); window.setTimeout(() => window.close(), 10000); } } useEffect(() => { const poller = window.setInterval(checkFinished, 1000); return () => window.clearTimeout(poller); }, []); return (
{!finished ? (
{t('Waiting for wizard to connect')}
) : (
{t('Return to your terminal to complete your setup')}
{t('(This window will close in 10 seconds)')}
)}
); } export default SetupWizard;