import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n' import getMeta from '@/utils/meta' import HasIndividualRecurlySubscription from './has-individual-recurly-subscription' import { useEffect, useState } from 'react' import { useTranslation, Trans } from 'react-i18next' import ManagedUserCannotJoin from './managed-user-cannot-join' import Notification from '@/shared/components/notification' import JoinGroup from './join-group' import AcceptedInvite from './accepted-invite' export type InviteViewTypes = | 'invite' | 'invite-accepted' | 'cancel-personal-subscription' | 'managed-user-cannot-join' | undefined function GroupInviteViews() { const hasIndividualRecurlySubscription = getMeta( 'ol-hasIndividualRecurlySubscription' ) const cannotJoinSubscription = getMeta('ol-cannot-join-subscription') useEffect(() => { if (cannotJoinSubscription) { setView('managed-user-cannot-join') } else if (hasIndividualRecurlySubscription) { setView('cancel-personal-subscription') } else { setView('invite') } }, [cannotJoinSubscription, hasIndividualRecurlySubscription]) const [view, setView] = useState(undefined) if (!view) { return null } if (view === 'managed-user-cannot-join') { return } else if (view === 'cancel-personal-subscription') { return } else if (view === 'invite') { return } else if (view === 'invite-accepted') { return } return null } export default function GroupInvite() { const inviterName = getMeta('ol-inviterName') const expired = getMeta('ol-expired') const { isReady } = useWaitForI18n() const { t } = useTranslation() if (!isReady) { return null } return (
{expired && (
)}

] } />

) }