// SPDX-License-Identifier: AGPL-3.0-or-later import {Routes} from '@app/app/Routes'; import type {RuntimeConfigSnapshot} from '@app/features/app/state/InstanceSnapshotStore'; import {AuthLoginLayout} from '@app/features/auth/flow/AuthLoginLayout'; import {AuthLoginStepCarousel} from '@app/features/auth/flow/AuthLoginStepCarousel'; import {AuthRouterLink} from '@app/features/auth/flow/AuthRouterLink'; import {AuthRuntimeTargetGate} from '@app/features/auth/flow/AuthRuntimeTargetGate'; import {isHandoffRequest} from '@app/features/auth/flow/auth_login_core/useDesktopHandoffFlow'; import {DesktopDeepLinkPrompt} from '@app/features/auth/flow/DesktopDeepLinkPrompt'; import {InviteHeader} from '@app/features/auth/flow/InviteHeader'; import {useAuthRuntimeTarget} from '@app/features/auth/state/AuthRuntimeTarget'; import {safeRedirectTarget} from '@app/features/auth/utils/SafeRedirect'; import {REGISTER_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors'; import { InviteAuthPageState, InvitesPausedPanel, useInviteAuthPage, } from '@app/features/invite/components/pages/InviteAuthPageState'; import {ACCEPT_INVITE_DESCRIPTOR} from '@app/features/invite/utils/InviteMessageDescriptors'; import {setPathQueryParams} from '@app/features/messaging/utils/MessagingUrlUtils'; import {useLocation, useParams} from '@app/features/platform/components/router/RouterReact'; import type {Invite} from '@fluxer/schema/src/domains/invite/InviteSchemas'; import {useLingui} from '@lingui/react/macro'; import {observer} from 'mobx-react-lite'; import {useMemo} from 'react'; interface InviteLoginPageProps { readonly code: string; readonly invite: Invite; } const InviteLoginPage = observer(function InviteLoginPage({code, invite}: InviteLoginPageProps) { const {i18n} = useLingui(); const runtimeTarget = useAuthRuntimeTarget(); const location = useLocation(); const params = useMemo(() => new URLSearchParams(location.search), [location.search]); const safeRedirect = safeRedirectTarget(params.get('redirect_to')); const isHandoff = isHandoffRequest(params); const registerSearch = safeRedirect == null ? undefined : {redirect_to: safeRedirect}; const redirectPath = useMemo(() => { return setPathQueryParams(Routes.inviteRegister(code), {redirect_to: safeRedirect}); }, [code, safeRedirect]); return ( } forgotPasswordAction={null} showTitle={false} title={null} onLoginComplete={runtimeTarget.reset} onBackActionChange={null} completeLoginRedirectPath={Routes.ME} forceCredentials={false} startWithAddAccount={false} runtimeTarget={runtimeTarget} ssoRedirectPath={null} suppressInlineBackButtons={false} initialIdentifier={null} registerLink={ {i18n._(REGISTER_DESCRIPTOR)} } data-flx="invite.invite-login-page.auth-login-layout" /> ); }); interface InviteLoginPageContentProps { readonly runtimeSnapshot: RuntimeConfigSnapshot; } const InviteLoginPageContent = observer(function InviteLoginPageContent({ runtimeSnapshot, }: InviteLoginPageContentProps) { const {i18n} = useLingui(); const runtimeTarget = useAuthRuntimeTarget(); const {code} = useParams() as {code: string}; const {invite, loading, guildInvite, isGroupDM, isInvitesDisabled, isRaidDetected} = useInviteAuthPage( code, runtimeSnapshot, ); if (!invite) return ( ); if (isInvitesDisabled && !isGroupDM) return ( ); return ( ); }); const InviteLoginPageContainer = observer(() => ( {(runtimeSnapshot) => ( )} )); export default InviteLoginPageContainer;