import { SUPPORT_EMAIL } from '@documenso/lib/constants/app';
import { msg } from '@lingui/core/macro';
import { useLingui } from '@lingui/react';
import { Trans } from '@lingui/react/macro';
import { match } from 'ts-pattern';
import { Body, Container, Head, Hr, Html, Img, Preview, Section, Text } from '../components';
import { useBranding } from '../providers/branding';
import { TemplateFooter } from '../template-components/template-footer';
import TemplateImage from '../template-components/template-image';
export type OrganisationLimitExceededEmailProps = {
assetBaseUrl: string;
organisationName: string;
counter: 'document' | 'email' | 'api';
kind: 'rateLimit' | 'quota';
period: string;
};
export const OrganisationLimitExceededEmailTemplate = ({
assetBaseUrl = 'http://localhost:3002',
organisationName = 'Organisation Name',
counter = 'email',
kind = 'quota',
period = '2026-05',
}: OrganisationLimitExceededEmailProps) => {
const { _ } = useLingui();
const branding = useBranding();
const previewText = msg`Organisation Review Required`;
return (
{branding.brandingEnabled && branding.brandingLogo ? (
) : (
)}
Organisation Review Required
{kind === 'quota' ? (
{match(counter)
.with('document', () => (
We've noticed document activity on your account that exceeds the fair use limits of your current
plan. As a precaution, new document activity has been temporarily paused pending review.
))
.with('email', () => (
We've noticed email sending activity on your account that exceeds the fair use limits of your
current plan. As a precaution, new email activity has been temporarily paused pending review.
))
.with('api', () => (
We've noticed API activity on your account that exceeds the fair use limits of your current
plan. As a precaution, new API activity has been temporarily paused pending review.
))
.exhaustive()}
) : (
{match(counter)
.with('document', () => (
Your organisation is generating documents faster than normal, so some requests are being
temporarily throttled.
))
.with('email', () => (
Your organisation is generating emails faster than normal, so some requests are being
temporarily throttled.
))
.with('api', () => (
Your organisation is generating API requests faster than normal, so some requests are being
temporarily throttled.
))
.exhaustive()}
)}
Please contact support at {SUPPORT_EMAIL} and we will review your account.
);
};
export default OrganisationLimitExceededEmailTemplate;