import dayjs from 'dayjs' import { type ReactNode } from 'react' import { TimestampInfo } from 'ui-patterns/TimestampInfo' import { InlineLink } from '@/components/ui/InlineLink' export const RESTRICTION_MESSAGES = { GRACE_PERIOD: { title: 'Organization exceeded its quota in the previous billing cycle', description: (date: string, slug: string): ReactNode => { const label = dayjs(date).format('DD MMM, YYYY') return ( <> Projects will be restricted from{' '} if your organization remains over quota.{' '} Review usage or{' '} billing. ) }, }, GRACE_PERIOD_OVER: { title: 'Grace period is over', description: (slug: string): ReactNode => ( <> Your projects will not be able to serve requests when you use up your quota.{' '} Review billing ), }, RESTRICTED: { title: 'Services restricted', description: (slug: string): ReactNode => ( <> Your projects are unable to serve requests as your organization has used up its quota.{' '} Resolve billing issues ), }, OVERDUE_INVOICES: { title: 'Outstanding invoices', description: (slug: string): ReactNode => ( <> Please pay your invoices to avoid service disruption ), }, OVERDUE_INVOICES_FROM_OTHER_ORGS: { title: 'Outstanding invoices in other organizations', description: (orgs: { name: string; slug: string }[]): ReactNode => { const [firstOrg, ...remainingOrgs] = orgs if (!firstOrg) { return ( <> Pay outstanding invoices to avoid service disruption ) } return ( <> Pay invoices for{' '} {firstOrg.name} {remainingOrgs.length > 0 && ` and ${remainingOrgs.length} other${remainingOrgs.length === 1 ? '' : 's'}`}{' '} to avoid service disruption ) }, }, }