import type { TCachedLicense } from '@documenso/lib/types/license'; import { cn } from '@documenso/ui/lib/utils'; import { Button } from '@documenso/ui/primitives/button'; import { Trans } from '@lingui/react/macro'; import { AlertTriangleIcon, KeyRoundIcon } from 'lucide-react'; import { Link } from 'react-router'; import { match } from 'ts-pattern'; export type AdminLicenseStatusBannerProps = { license: TCachedLicense | null; }; export const AdminLicenseStatusBanner = ({ license }: AdminLicenseStatusBannerProps) => { const licenseStatus = license?.derivedStatus; if (!license || licenseStatus === 'ACTIVE' || licenseStatus === 'NOT_FOUND') { return null; } return (
{match(licenseStatus) .with('PAST_DUE', () => ( License Payment Overdue - Please update your payment to avoid service disruptions. )) .with('EXPIRED', () => ( License Expired - Please renew your license to continue using enterprise features. )) .with('UNAUTHORIZED', () => license ? ( Invalid License Type - Your Documenso instance is using features that are not part of your license. ) : ( Missing License - Your Documenso instance is using features that require a license. ), ) .otherwise(() => null)}
); };