diff --git a/packages/email/template-components/template-document-invite.tsx b/packages/email/template-components/template-document-invite.tsx index 8c550fbfa..c8b4a402d 100644 --- a/packages/email/template-components/template-document-invite.tsx +++ b/packages/email/template-components/template-document-invite.tsx @@ -2,7 +2,7 @@ import { useMemo } from 'react'; import { Trans } from '@lingui/macro'; import { useLingui } from '@lingui/react'; -import { match } from 'ts-pattern'; +import { P, match } from 'ts-pattern'; import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles'; import { RecipientRole } from '@documenso/prisma/client'; @@ -40,11 +40,9 @@ export const TemplateDocumentInvite = ({ const rejectDocumentLink = useMemo(() => { const url = new URL(signDocumentLink); - url.searchParams.set('reject', 'true'); - return url.toString(); - }, []); + }, [signDocumentLink]); return ( <> @@ -52,31 +50,32 @@ export const TemplateDocumentInvite = ({
- {selfSigner ? ( - - Please {_(actionVerb).toLowerCase()} your document -
"{documentName}" -
- ) : isTeamInvite ? ( - <> - {includeSenderDetails ? ( - - {inviterName} on behalf of "{teamName}" has invited you to{' '} - {_(actionVerb).toLowerCase()} - - ) : ( - - {teamName} has invited you to {_(actionVerb).toLowerCase()} - - )} -
"{documentName}" - - ) : ( - - {inviterName} has invited you to {_(actionVerb).toLowerCase()} -
"{documentName}" -
- )} + {match({ selfSigner, isTeamInvite, includeSenderDetails, teamName }) + .with({ selfSigner: true }, () => ( + + Please {_(actionVerb).toLowerCase()} your document +
"{documentName}" +
+ )) + .with({ isTeamInvite: true, includeSenderDetails: true, teamName: P.string }, () => ( + + {inviterName} on behalf of "{teamName}" has invited you to{' '} + {_(actionVerb).toLowerCase()} +
"{documentName}" +
+ )) + .with({ isTeamInvite: true, teamName: P.string }, () => ( + + {teamName} has invited you to {_(actionVerb).toLowerCase()} +
"{documentName}" +
+ )) + .otherwise(() => ( + + {inviterName} has invited you to {_(actionVerb).toLowerCase()} +
"{documentName}" +
+ ))}