The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
feat: add envelopes (#2025)
David Nguyen7f09ba72f45a
diff --git a/apps/openpage-api/lib/growth/get-monthly-completed-document.ts b/apps/openpage-api/lib/growth/get-monthly-completed-document.tsindex f429b0a54..808d7259d 100644--- a/apps/openpage-api/lib/growth/get-monthly-completed-document.ts+++ b/apps/openpage-api/lib/growth/get-monthly-completed-document.ts@@ -1,4 +1,4 @@-import { DocumentStatus } from '@prisma/client';+import { DocumentStatus, EnvelopeType } from '@prisma/client';import { DateTime } from 'luxon';import { kyselyPrisma, sql } from '@documenso/prisma';@@ -7,18 +7,19 @@ import { addZeroMonth } from '../add-zero-month';export const getCompletedDocumentsMonthly = async (type: 'count' | 'cumulative' = 'count') => {const qb = kyselyPrisma.$kysely- .selectFrom('Document')+ .selectFrom('Envelope').select(({ fn }) => [- fn<Date>('DATE_TRUNC', [sql.lit('MONTH'), 'Document.updatedAt']).as('month'),+ fn<Date>('DATE_TRUNC', [sql.lit('MONTH'), 'Envelope.updatedAt']).as('month'),fn.count('id').as('count'),fn.sum(fn.count('id'))// Feels like a bug in the Kysely extension but I just can not do this orderBy in a type-safe manner// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-explicit-any- .over((ob) => ob.orderBy(fn('DATE_TRUNC', [sql.lit('MONTH'), 'Document.updatedAt']) as any))+ .over((ob) => ob.orderBy(fn('DATE_TRUNC', [sql.lit('MONTH'), 'Envelope.updatedAt']) as any)).as('cume_count'),])- .where(() => sql`"Document"."status" = ${DocumentStatus.COMPLETED}::"DocumentStatus"`)+ .where(() => sql`"Envelope"."status" = ${DocumentStatus.COMPLETED}::"DocumentStatus"`)+ .where(() => sql`"Envelope"."type" = ${EnvelopeType.DOCUMENT}::"EnvelopeType"`).groupBy('month').orderBy('month', 'desc').limit(12);diff --git a/apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx b/apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxindex 9f82d8551..aee9167cc 100644--- a/apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx+++ b/apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -3,7 +3,6 @@ import { useState } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Document } from '@prisma/client';import { useNavigate } from 'react-router';import { trpc } from '@documenso/trpc/react';@@ -22,10 +21,10 @@ import { Input } from '@documenso/ui/primitives/input';import { useToast } from '@documenso/ui/primitives/use-toast';export type AdminDocumentDeleteDialogProps = {- document: Document;+ envelopeId: string;};-export const AdminDocumentDeleteDialog = ({ document }: AdminDocumentDeleteDialogProps) => {+export const AdminDocumentDeleteDialog = ({ envelopeId }: AdminDocumentDeleteDialogProps) => {const { _ } = useLingui();const { toast } = useToast();@@ -42,7 +41,7 @@ export const AdminDocumentDeleteDialog = ({ document }: AdminDocumentDeleteDialoreturn;}- await deleteDocument({ id: document.id, reason });+ await deleteDocument({ id: envelopeId, reason });toast({title: _(msg`Document deleted`),diff --git a/apps/remix/app/components/dialogs/document-duplicate-dialog.tsx b/apps/remix/app/components/dialogs/document-duplicate-dialog.tsxindex 57146ed9f..81ec5bdf4 100644--- a/apps/remix/app/components/dialogs/document-duplicate-dialog.tsx+++ b/apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -57,14 +57,14 @@ export const DocumentDuplicateDialog = ({const { mutateAsync: duplicateDocument, isPending: isDuplicateLoading } =trpcReact.document.duplicate.useMutation({- onSuccess: async ({ documentId }) => {+ onSuccess: async ({ id }) => {toast({title: _(msg`Document Duplicated`),description: _(msg`Your document has been successfully duplicated.`),duration: 5000,});- await navigate(`${documentsPath}/${documentId}/edit`);+ await navigate(`${documentsPath}/${id}/edit`);onOpenChange(false);},});diff --git a/apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx b/apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxindex 401fb3529..c4c85c051 100644--- a/apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx+++ b/apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx@@ -81,7 +81,7 @@ export const DocumentMoveToFolderDialog = ({},);- const { mutateAsync: moveDocumentToFolder } = trpc.folder.moveDocumentToFolder.useMutation();+ const { mutateAsync: updateDocument } = trpc.document.update.useMutation();useEffect(() => {if (!open) {@@ -94,9 +94,11 @@ export const DocumentMoveToFolderDialog = ({const onSubmit = async (data: TMoveDocumentFormSchema) => {try {- await moveDocumentToFolder({+ await updateDocument({documentId,- folderId: data.folderId ?? null,+ data: {+ folderId: data.folderId ?? null,+ },});const documentsPath = formatDocumentsPath(team.url);diff --git a/apps/remix/app/components/dialogs/document-resend-dialog.tsx b/apps/remix/app/components/dialogs/document-resend-dialog.tsxindex d93f29e84..d8c0a73ee 100644--- a/apps/remix/app/components/dialogs/document-resend-dialog.tsx+++ b/apps/remix/app/components/dialogs/document-resend-dialog.tsx@@ -4,15 +4,15 @@ import { zodResolver } from '@hookform/resolvers/zod';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import { type Recipient, SigningStatus } from '@prisma/client';+import { type Recipient, SigningStatus, type Team, type User } from '@prisma/client';import { History } from 'lucide-react';import { useForm, useWatch } from 'react-hook-form';import * as z from 'zod';import { useSession } from '@documenso/lib/client-only/providers/session';import { getRecipientType } from '@documenso/lib/client-only/recipient-type';-import type { TDocumentMany as TDocumentRow } from '@documenso/lib/types/document';import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter';+import type { Document } from '@documenso/prisma/types/document-legacy-schema';import { trpc as trpcReact } from '@documenso/trpc/react';import { cn } from '@documenso/ui/lib/utils';import { Button } from '@documenso/ui/primitives/button';@@ -43,7 +43,11 @@ import { StackAvatar } from '../general/stack-avatar';const FORM_ID = 'resend-email';export type DocumentResendDialogProps = {- document: TDocumentRow;+ document: Pick<Document, 'id' | 'userId' | 'teamId' | 'status'> & {+ user: Pick<User, 'id' | 'name' | 'email'>;+ recipients: Recipient[];+ team: Pick<Team, 'id' | 'url'> | null;+ };recipients: Recipient[];};diff --git a/apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx b/apps/remix/app/components/dialogs/envelope-distribute-dialog.tsxnew file mode 100644index 000000000..a3aac4436--- /dev/null+++ b/apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx@@ -0,0 +1,449 @@+import { useMemo, useState } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import {+ DocumentDistributionMethod,+ DocumentStatus,+ EnvelopeType,+ type Field,+ FieldType,+ type Recipient,+ RecipientRole,+} from '@prisma/client';+import { AnimatePresence, motion } from 'framer-motion';+import { InfoIcon } from 'lucide-react';+import { useForm } from 'react-hook-form';+import * as z from 'zod';++import { useCurrentOrganisation } from '@documenso/lib/client-only/providers/organisation';+import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles';+import type { TEnvelope } from '@documenso/lib/types/envelope';+import { formatSigningLink } from '@documenso/lib/utils/recipients';+import { trpc, trpc as trpcReact } from '@documenso/trpc/react';+import { CopyTextButton } from '@documenso/ui/components/common/copy-text-button';+import { DocumentSendEmailMessageHelper } from '@documenso/ui/components/document/document-send-email-message-helper';+import { Alert, AlertDescription } from '@documenso/ui/primitives/alert';+import { AvatarWithText } from '@documenso/ui/primitives/avatar';+import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';+import { Tabs, TabsList, TabsTrigger } from '@documenso/ui/primitives/tabs';+import { Textarea } from '@documenso/ui/primitives/textarea';+import { Tooltip, TooltipContent, TooltipTrigger } from '@documenso/ui/primitives/tooltip';+import { useToast } from '@documenso/ui/primitives/use-toast';++export type EnvelopeDistributeDialogProps = {+ envelope: Pick<TEnvelope, 'id' | 'userId' | 'teamId' | 'status' | 'type' | 'documentMeta'> & {+ recipients: Recipient[];+ fields: Field[];+ };+ trigger?: React.ReactNode;+};++export const ZEnvelopeDistributeFormSchema = z.object({+ meta: z.object({+ emailId: z.string().nullable(),+ emailReplyTo: z.preprocess(+ (val) => (val === '' ? undefined : val),+ z.string().email().optional(),+ ),+ subject: z.string(),+ message: z.string(),+ distributionMethod: z+ .nativeEnum(DocumentDistributionMethod)+ .optional()+ .default(DocumentDistributionMethod.EMAIL),+ }),+});++export type TEnvelopeDistributeFormSchema = z.infer<typeof ZEnvelopeDistributeFormSchema>;++export const EnvelopeDistributeDialog = ({ envelope, trigger }: EnvelopeDistributeDialogProps) => {+ const organisation = useCurrentOrganisation();++ const recipients = envelope.recipients;++ const { toast } = useToast();+ const { t } = useLingui();++ const [isOpen, setIsOpen] = useState(false);++ const { mutateAsync: distributeEnvelope } = trpcReact.envelope.distribute.useMutation();++ const form = useForm<TEnvelopeDistributeFormSchema>({+ defaultValues: {+ meta: {+ emailId: envelope.documentMeta?.emailId ?? null,+ emailReplyTo: envelope.documentMeta?.emailReplyTo || undefined,+ subject: envelope.documentMeta?.subject ?? '',+ message: envelope.documentMeta?.message ?? '',+ distributionMethod:+ envelope.documentMeta?.distributionMethod || DocumentDistributionMethod.EMAIL,+ },+ },+ resolver: zodResolver(ZEnvelopeDistributeFormSchema),+ });++ const {+ handleSubmit,+ setValue,+ watch,+ formState: { isSubmitting },+ } = form;++ const { data: emailData, isLoading: isLoadingEmails } =+ trpc.enterprise.organisation.email.find.useQuery({+ organisationId: organisation.id,+ perPage: 100,+ });++ const emails = emailData?.data || [];++ const distributionMethod = watch('meta.distributionMethod');++ const everySignerHasSignature = useMemo(+ () =>+ envelope.recipients+ .filter((recipient) => recipient.role === RecipientRole.SIGNER)+ .every((recipient) =>+ envelope.fields.some(+ (field) => field.type === FieldType.SIGNATURE && field.recipientId === recipient.id,+ ),+ ),+ [envelope.recipients, envelope.fields],+ );++ const onFormSubmit = async ({ meta }: TEnvelopeDistributeFormSchema) => {+ try {+ await distributeEnvelope({ envelopeId: envelope.id, meta });++ toast({+ title: t`Envelope distributed`,+ description: t`Your envelope has been distributed successfully.`,+ duration: 5000,+ });++ setIsOpen(false);+ } catch (err) {+ toast({+ title: t`Something went wrong`,+ description: t`This envelope could not be distributed at this time. Please try again.`,+ variant: 'destructive',+ duration: 7500,+ });+ }+ };++ if (envelope.status !== DocumentStatus.DRAFT || envelope.type !== EnvelopeType.DOCUMENT) {+ return null;+ }++ return (+ <Dialog open={isOpen} onOpenChange={setIsOpen}>+ <DialogTrigger asChild>{trigger}</DialogTrigger>++ <DialogContent className="max-w-md" hideClose>+ <DialogHeader>+ <DialogTitle>+ <Trans>Send Document</Trans>+ </DialogTitle>++ <DialogDescription>+ <Trans>Recipients will be able to sign the document once sent</Trans>+ </DialogDescription>+ </DialogHeader>+ {everySignerHasSignature ? (+ <Form {...form}>+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <fieldset disabled={isSubmitting}>+ <Tabs+ onValueChange={(value) =>+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ setValue('meta.distributionMethod', value as DocumentDistributionMethod)+ }+ value={distributionMethod}+ className="mb-2"+ >+ <TabsList className="w-full">+ <TabsTrigger className="w-full" value={DocumentDistributionMethod.EMAIL}>+ </TabsTrigger>+ <TabsTrigger className="w-full" value={DocumentDistributionMethod.NONE}>+ None+ </TabsTrigger>+ </TabsList>+ </Tabs>++ <div className="min-h-72">+ <AnimatePresence initial={false} mode="wait">+ {distributionMethod === DocumentDistributionMethod.EMAIL && (+ <motion.div+ key={'Emails'}+ initial={{ opacity: 0, y: 5 }}+ animate={{ opacity: 1, y: 0, transition: { duration: 0.3 } }}+ exit={{ opacity: 0, transition: { duration: 0.15 } }}+ >+ <Form {...form}>+ <fieldset+ className="mt-2 flex flex-col gap-y-4 rounded-lg"+ disabled={form.formState.isSubmitting}+ >+ {organisation.organisationClaim.flags.emailDomains && (+ <FormField+ control={form.control}+ name="meta.emailId"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Email Sender</Trans>+ </FormLabel>+ <FormControl>+ <Select+ {...field}+ value={field.value === null ? '-1' : field.value}+ onValueChange={(value) =>+ field.onChange(value === '-1' ? null : value)+ }+ >+ <SelectTrigger+ loading={isLoadingEmails}+ className="bg-background"+ >+ <SelectValue />+ </SelectTrigger>++ <SelectContent>+ {emails.map((email) => (+ <SelectItem key={email.id} value={email.id}>+ {email.email}+ </SelectItem>+ ))}++ <SelectItem value={'-1'}>Documenso</SelectItem>+ </SelectContent>+ </Select>+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ )}++ <FormField+ control={form.control}+ name="meta.emailReplyTo"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Reply To Email</Trans>{' '}+ <span className="text-muted-foreground">(Optional)</span>+ </FormLabel>++ <FormControl>+ <Input {...field} maxLength={254} />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="meta.subject"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Subject</Trans>{' '}+ <span className="text-muted-foreground">(Optional)</span>+ </FormLabel>++ <FormControl>+ <Input {...field} maxLength={255} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="meta.message"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Message</Trans>{' '}+ <span className="text-muted-foreground">(Optional)</span>+ <Tooltip>+ <TooltipTrigger>+ <InfoIcon className="mx-2 h-4 w-4" />+ </TooltipTrigger>+ <TooltipContent className="text-muted-foreground p-4">+ <DocumentSendEmailMessageHelper />+ </TooltipContent>+ </Tooltip>+ </FormLabel>++ <FormControl>+ <Textarea+ className="bg-background mt-2 h-16 resize-none"+ {...field}+ maxLength={5000}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ </fieldset>+ </Form>+ </motion.div>+ )}++ {distributionMethod === DocumentDistributionMethod.NONE && (+ <motion.div+ key={'Links'}+ initial={{ opacity: 0, y: 5 }}+ animate={{ opacity: 1, y: 0, transition: { duration: 0.3 } }}+ exit={{ opacity: 0, transition: { duration: 0.15 } }}+ className="min-h-60 rounded-lg border"+ >+ {envelope.status === DocumentStatus.DRAFT ? (+ <div className="text-muted-foreground py-24 text-center text-sm">+ <p>+ <Trans>We won't send anything to notify recipients.</Trans>+ </p>++ <p className="mt-2">+ <Trans>+ We will generate signing links for you, which you can send to the+ recipients through your method of choice.+ </Trans>+ </p>+ </div>+ ) : (+ <ul className="text-muted-foreground divide-y">+ {recipients.length === 0 && (+ <li className="flex flex-col items-center justify-center py-6 text-sm">+ <Trans>No recipients</Trans>+ </li>+ )}++ {recipients.map((recipient) => (+ <li+ key={recipient.id}+ className="flex items-center justify-between px-4 py-3 text-sm"+ >+ <AvatarWithText+ avatarFallback={recipient.email.slice(0, 1).toUpperCase()}+ primaryText={+ <p className="text-muted-foreground text-sm">+ {recipient.email}+ </p>+ }+ secondaryText={+ <p className="text-muted-foreground/70 text-xs">+ {t(RECIPIENT_ROLES_DESCRIPTION[recipient.role].roleName)}+ </p>+ }+ />++ {recipient.role !== RecipientRole.CC && (+ <CopyTextButton+ value={formatSigningLink(recipient.token)}+ onCopySuccess={() => {+ toast({+ title: t`Copied to clipboard`,+ description: t`The signing link has been copied to your clipboard.`,+ });+ }}+ badgeContentUncopied={+ <p className="ml-1 text-xs">+ <Trans>Copy</Trans>+ </p>+ }+ badgeContentCopied={+ <p className="ml-1 text-xs">+ <Trans>Copied</Trans>+ </p>+ }+ />+ )}+ </li>+ ))}+ </ul>+ )}+ </motion.div>+ )}+ </AnimatePresence>+ </div>++ <DialogFooter>+ <DialogClose asChild>+ <Button type="button" variant="secondary" disabled={isSubmitting}>+ <Trans>Cancel</Trans>+ </Button>+ </DialogClose>++ <Button loading={isSubmitting} type="submit">+ {distributionMethod === DocumentDistributionMethod.EMAIL ? (+ <Trans>Send</Trans>+ ) : (+ <Trans>Generate Links</Trans>+ )}+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ ) : (+ <>+ <Alert variant="warning">+ <AlertDescription>+ <Trans>+ Some signers have not been assigned a signature field. Please assign at least 1+ signature field to each signer before proceeding.+ </Trans>+ </AlertDescription>+ </Alert>++ <DialogFooter>+ <DialogClose asChild>+ <Button type="button" variant="secondary">+ <Trans>Close</Trans>+ </Button>+ </DialogClose>+ </DialogFooter>+ </>+ )}+ </DialogContent>+ </Dialog>+ );+};diff --git a/apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx b/apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsxnew file mode 100644index 000000000..92d55b71b--- /dev/null+++ b/apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx@@ -0,0 +1,113 @@+import { useState } from 'react';++import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { EnvelopeType } from '@prisma/client';+import { useNavigate } from 'react-router';++import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams';+import { trpc } from '@documenso/trpc/react';+import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from '@documenso/ui/primitives/dialog';+import { useToast } from '@documenso/ui/primitives/use-toast';++import { useCurrentTeam } from '~/providers/team';++type EnvelopeDuplicateDialogProps = {+ envelopeId: string;+ envelopeType: EnvelopeType;+ trigger?: React.ReactNode;+};++export const EnvelopeDuplicateDialog = ({+ envelopeId,+ envelopeType,+ trigger,+}: EnvelopeDuplicateDialogProps) => {+ const navigate = useNavigate();++ const [open, setOpen] = useState(false);++ const { toast } = useToast();+ const { t } = useLingui();++ const team = useCurrentTeam();++ const { mutateAsync: duplicateEnvelope, isPending: isDuplicating } =+ trpc.envelope.duplicate.useMutation({+ onSuccess: async ({ duplicatedEnvelopeId }) => {+ toast({+ title: t`Envelope Duplicated`,+ description: t`Your envelope has been successfully duplicated.`,+ duration: 5000,+ });++ const path =+ envelopeType === EnvelopeType.DOCUMENT+ ? formatDocumentsPath(team.url)+ : formatTemplatesPath(team.url);++ await navigate(`${path}/${duplicatedEnvelopeId}/edit`);+ setOpen(false);+ },+ });++ const onDuplicate = async () => {+ try {+ await duplicateEnvelope({ envelopeId });+ } catch {+ toast({+ title: t`Something went wrong`,+ description: t`This document could not be duplicated at this time. Please try again.`,+ variant: 'destructive',+ duration: 7500,+ });+ }+ };++ return (+ <Dialog open={open} onOpenChange={(value) => !isDuplicating && setOpen(value)}>+ {trigger && <DialogTrigger asChild>{trigger}</DialogTrigger>}++ <DialogContent>+ {envelopeType === EnvelopeType.DOCUMENT ? (+ <DialogHeader>+ <DialogTitle>+ <Trans>Duplicate Document</Trans>+ </DialogTitle>+ <DialogDescription>+ <Trans>This document will be duplicated.</Trans>+ </DialogDescription>+ </DialogHeader>+ ) : (+ <DialogHeader>+ <DialogTitle>+ <Trans>Duplicate Template</Trans>+ </DialogTitle>+ <DialogDescription>+ <Trans>This template will be duplicated.</Trans>+ </DialogDescription>+ </DialogHeader>+ )}++ <DialogFooter>+ <Button type="button" variant="secondary" disabled={isDuplicating}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="button" loading={isDuplicating} onClick={onDuplicate}>+ <Trans>Duplicate</Trans>+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+};diff --git a/apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx b/apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsxnew file mode 100644index 000000000..dfee36496--- /dev/null+++ b/apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx@@ -0,0 +1,134 @@+import { useState } from 'react';++import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';++import { trpc } from '@documenso/trpc/react';+import { Alert, AlertDescription } from '@documenso/ui/primitives/alert';+import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from '@documenso/ui/primitives/dialog';+import { useToast } from '@documenso/ui/primitives/use-toast';++export type EnvelopeItemDeleteDialogProps = {+ canItemBeDeleted: boolean;+ envelopeId: string;+ envelopeItemId: string;+ envelopeItemTitle: string;+ onDelete?: (envelopeItemId: string) => void;+ trigger?: React.ReactNode;+};++export const EnvelopeItemDeleteDialog = ({+ trigger,+ canItemBeDeleted,+ envelopeId,+ envelopeItemId,+ envelopeItemTitle,+ onDelete,+}: EnvelopeItemDeleteDialogProps) => {+ const [open, setOpen] = useState(false);++ const { t } = useLingui();+ const { toast } = useToast();++ const { mutateAsync: deleteEnvelopeItem, isPending: isDeleting } =+ trpc.envelope.item.delete.useMutation({+ onSuccess: () => {+ toast({+ title: t`Success`,+ description: t`You have successfully removed this envelope item.`,+ duration: 5000,+ });++ onDelete?.(envelopeItemId);++ setOpen(false);+ },+ onError: () => {+ toast({+ title: t`An unknown error occurred`,+ description: t`We encountered an unknown error while attempting to remove this envelope item. Please try again later.`,+ variant: 'destructive',+ duration: 10000,+ });+ },+ });++ return (+ <Dialog open={open} onOpenChange={(value) => !isDeleting && setOpen(value)}>+ <DialogTrigger asChild>{trigger}</DialogTrigger>++ {canItemBeDeleted ? (+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Are you sure?</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>+ You are about to remove the following document and all associated fields+ </Trans>+ </DialogDescription>+ </DialogHeader>++ <Alert variant="neutral">+ <AlertDescription className="text-center font-semibold">+ {envelopeItemTitle}+ </AlertDescription>+ </Alert>++ <fieldset disabled={isDeleting}>+ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => setOpen(false)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button+ type="submit"+ variant="destructive"+ loading={isDeleting}+ onClick={async () =>+ deleteEnvelopeItem({+ envelopeId,+ envelopeItemId,+ })+ }+ >+ <Trans>Delete</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </DialogContent>+ ) : (+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>This item cannot be deleted</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>+ You cannot delete this item because the document has been sent to recipients+ </Trans>+ </DialogDescription>+ </DialogHeader>++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => setOpen(false)}>+ <Trans>Close</Trans>+ </Button>+ </DialogFooter>+ </DialogContent>+ )}+ </Dialog>+ );+};diff --git a/apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx b/apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsxnew file mode 100644index 000000000..6a60ba81b--- /dev/null+++ b/apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx@@ -0,0 +1,187 @@+import { useEffect, useState } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { DocumentStatus, EnvelopeType, type Recipient, SigningStatus } from '@prisma/client';+import { useForm } from 'react-hook-form';+import * as z from 'zod';++import { getRecipientType } from '@documenso/lib/client-only/recipient-type';+import type { TEnvelope } from '@documenso/lib/types/envelope';+import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter';+import { trpc as trpcReact } from '@documenso/trpc/react';+import { cn } from '@documenso/ui/lib/utils';+import { Button } from '@documenso/ui/primitives/button';+import { Checkbox } from '@documenso/ui/primitives/checkbox';+import {+ Dialog,+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+} from '@documenso/ui/primitives/form/form';+import { useToast } from '@documenso/ui/primitives/use-toast';++import { StackAvatar } from '../general/stack-avatar';++export type EnvelopeRedistributeDialogProps = {+ envelope: Pick<TEnvelope, 'id' | 'userId' | 'teamId' | 'status' | 'type' | 'documentMeta'> & {+ recipients: Recipient[];+ };+ trigger?: React.ReactNode;+};++export const ZEnvelopeRedistributeFormSchema = z.object({+ recipients: z.array(z.number()).min(1, {+ message: msg`You must select at least one item`.id,+ }),+});++export type TEnvelopeRedistributeFormSchema = z.infer<typeof ZEnvelopeRedistributeFormSchema>;++export const EnvelopeRedistributeDialog = ({+ envelope,+ trigger,+}: EnvelopeRedistributeDialogProps) => {+ const recipients = envelope.recipients;++ const { toast } = useToast();+ const { t } = useLingui();++ const [isOpen, setIsOpen] = useState(false);++ const { mutateAsync: redistributeEnvelope } = trpcReact.envelope.redistribute.useMutation();++ const form = useForm<TEnvelopeRedistributeFormSchema>({+ defaultValues: {+ recipients: [],+ },+ resolver: zodResolver(ZEnvelopeRedistributeFormSchema),+ });++ const {+ handleSubmit,+ formState: { isSubmitting },+ } = form;++ const onFormSubmit = async ({ recipients }: TEnvelopeRedistributeFormSchema) => {+ try {+ await redistributeEnvelope({ envelopeId: envelope.id, recipients });++ toast({+ title: t`Envelope resent`,+ description: t`Your envelope has been resent successfully.`,+ duration: 5000,+ });++ setIsOpen(false);+ } catch (err) {+ toast({+ title: t`Something went wrong`,+ description: t`This envelope could not be resent at this time. Please try again.`,+ variant: 'destructive',+ duration: 7500,+ });+ }+ };++ useEffect(() => {+ if (!isOpen) {+ form.reset();+ }+ }, [isOpen]);++ if (envelope.status !== DocumentStatus.PENDING || envelope.type !== EnvelopeType.DOCUMENT) {+ return null;+ }++ return (+ <Dialog open={isOpen} onOpenChange={setIsOpen}>+ <DialogTrigger asChild>{trigger}</DialogTrigger>++ <DialogContent className="max-w-md" hideClose>+ <DialogHeader>+ <DialogTitle>+ <Trans>Resend Document</Trans>+ </DialogTitle>++ <DialogDescription>+ <Trans>Send reminders to the following recipients</Trans>+ </DialogDescription>+ </DialogHeader>+ <Form {...form}>+ <form onSubmit={handleSubmit(onFormSubmit)}>+ <fieldset disabled={isSubmitting}>+ <FormField+ control={form.control}+ name="recipients"+ render={({ field: { value, onChange } }) => (+ <>+ {recipients+ .filter((recipient) => recipient.signingStatus === SigningStatus.NOT_SIGNED)+ .map((recipient) => (+ <FormItem+ key={recipient.id}+ className="flex flex-row items-center justify-between gap-x-3 px-3"+ >+ <FormLabel+ className={cn('my-2 flex items-center gap-2 font-normal', {+ 'opacity-50': !value.includes(recipient.id),+ })}+ >+ <StackAvatar+ key={recipient.id}+ type={getRecipientType(recipient)}+ fallbackText={recipientAbbreviation(recipient)}+ />+ {recipient.email}+ </FormLabel>++ <FormControl>+ <Checkbox+ className="h-5 w-5 rounded-full"+ value={recipient.id}+ checked={value.includes(recipient.id)}+ onCheckedChange={(checked: boolean) =>+ checked+ ? onChange([...value, recipient.id])+ : onChange(value.filter((v) => v !== recipient.id))+ }+ />+ </FormControl>+ </FormItem>+ ))}+ </>+ )}+ />++ <DialogFooter className="mt-4">+ <DialogClose asChild>+ <Button type="button" variant="secondary" disabled={isSubmitting}>+ <Trans>Cancel</Trans>+ </Button>+ </DialogClose>++ <Button loading={isSubmitting} type="submit">+ <Trans>Send reminder</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+};diff --git a/apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx b/apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxindex bcd624290..4ef2de031 100644--- a/apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx+++ b/apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx@@ -4,14 +4,14 @@ import { zodResolver } from '@hookform/resolvers/zod';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Plural, Trans } from '@lingui/react/macro';-import type { Template, TemplateDirectLink } from '@prisma/client';-import { TemplateType } from '@prisma/client';+import { type TemplateDirectLink, TemplateType } from '@prisma/client';import type * as DialogPrimitive from '@radix-ui/react-dialog';import { CheckCircle2Icon, CircleIcon } from 'lucide-react';import { useForm } from 'react-hook-form';import { P, match } from 'ts-pattern';import { z } from 'zod';+import { type Template } from '@documenso/prisma/types/template-legacy-schema';import { trpc } from '@documenso/trpc/react';import {MAX_TEMPLATE_PUBLIC_DESCRIPTION_LENGTH,@@ -52,7 +52,7 @@ import { useToast } from '@documenso/ui/primitives/use-toast';import { useCurrentTeam } from '~/providers/team';export type ManagePublicTemplateDialogProps = {- directTemplates: (Template & {+ directTemplates: (Omit<Template, 'templateDocumentDataId'> & {directLink: Pick<TemplateDirectLink, 'token' | 'enabled'>;})[];initialTemplateId?: number | null;diff --git a/apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsxnew file mode 100644index 000000000..cf80c6009--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx@@ -0,0 +1,117 @@+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';+import { createCallable } from 'react-call';+import { useForm } from 'react-hook-form';+import { z } from 'zod';++import type { TDropdownFieldMeta } from '@documenso/lib/types/field-meta';+import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';++const ZSignFieldDropdownFormSchema = z.object({+ dropdown: z.string().min(1, { message: msg`Option is required`.id }),+});++type TSignFieldDropdownFormSchema = z.infer<typeof ZSignFieldDropdownFormSchema>;++export type SignFieldDropdownDialogProps = {+ fieldMeta: TDropdownFieldMeta;+};++export const SignFieldDropdownDialog = createCallable<SignFieldDropdownDialogProps, string | null>(+ ({ call, fieldMeta }) => {+ const { t } = useLingui();++ const values = fieldMeta.values?.map((value) => value.value) ?? [];++ const form = useForm<TSignFieldDropdownFormSchema>({+ resolver: zodResolver(ZSignFieldDropdownFormSchema),+ defaultValues: {+ dropdown: fieldMeta.defaultValue,+ },+ });++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Dropdown Field</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>Select a value to sign into the field</Trans>+ </DialogDescription>+ </DialogHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit((data) => call.end(data.dropdown))}>+ <fieldset+ className="flex h-full flex-col space-y-4"+ disabled={form.formState.isSubmitting}+ >+ <FormField+ control={form.control}+ name="dropdown"+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Select {...field} onValueChange={field.onChange}>+ <SelectTrigger className="bg-background">+ <SelectValue placeholder={t`Select an option`} />+ </SelectTrigger>++ <SelectContent>+ {values.map((value, i) => (+ <SelectItem key={i} value={value}>+ {value}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="submit">+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/sign-field-email-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-email-dialog.tsxnew file mode 100644index 000000000..1ced42000--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-email-dialog.tsx@@ -0,0 +1,91 @@+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { createCallable } from 'react-call';+import { useForm } from 'react-hook-form';+import { z } from 'zod';++import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';++const ZSignFieldEmailFormSchema = z.object({+ email: z.string().min(1, { message: msg`Email is required`.id }),+});++type TSignFieldEmailFormSchema = z.infer<typeof ZSignFieldEmailFormSchema>;++export type SignFieldEmailDialogProps = Record<string, never>;++export const SignFieldEmailDialog = createCallable<SignFieldEmailDialogProps, string | null>(+ ({ call }) => {+ const form = useForm<TSignFieldEmailFormSchema>({+ resolver: zodResolver(ZSignFieldEmailFormSchema),+ defaultValues: {+ email: '',+ },+ });++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Email</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>Sign your email into the field</Trans>+ </DialogDescription>+ </DialogHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit((data) => call.end(data.email))}>+ <fieldset+ className="flex h-full flex-col space-y-4"+ disabled={form.formState.isSubmitting}+ >+ <FormField+ control={form.control}+ name="email"+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Input {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="submit">+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-initials-dialog.tsxnew file mode 100644index 000000000..e171da56f--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx@@ -0,0 +1,97 @@+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { createCallable } from 'react-call';+import { useForm } from 'react-hook-form';+import { z } from 'zod';++import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';++const ZSignFieldInitialsFormSchema = z.object({+ initials: z.string().min(1, { message: msg`Initials are required`.id }),+});++type TSignFieldInitialsFormSchema = z.infer<typeof ZSignFieldInitialsFormSchema>;++export type SignFieldInitialsDialogProps = {+ //+};++export const SignFieldInitialsDialog = createCallable<SignFieldInitialsDialogProps, string | null>(+ ({ call }) => {+ const form = useForm<TSignFieldInitialsFormSchema>({+ resolver: zodResolver(ZSignFieldInitialsFormSchema),+ defaultValues: {+ initials: '',+ },+ });++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Initials</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>Sign your initials into the field</Trans>+ </DialogDescription>+ </DialogHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit((data) => call.end(data.initials))}>+ <fieldset+ className="flex h-full flex-col space-y-4"+ disabled={form.formState.isSubmitting}+ >+ <FormField+ control={form.control}+ name="initials"+ render={({ field }) => (+ <FormItem>+ <FormLabel required>+ <Trans>Initials</Trans>+ </FormLabel>+ <FormControl>+ <Input {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="submit">+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/sign-field-name-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-name-dialog.tsxnew file mode 100644index 000000000..eebfd7e4a--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-name-dialog.tsx@@ -0,0 +1,93 @@+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { createCallable } from 'react-call';+import { useForm } from 'react-hook-form';+import { z } from 'zod';++import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';++const ZSignFieldNameFormSchema = z.object({+ name: z.string().min(1, { message: msg`Name is required`.id }),+});++type TSignFieldNameFormSchema = z.infer<typeof ZSignFieldNameFormSchema>;++export type SignFieldNameDialogProps = {+ //+};++export const SignFieldNameDialog = createCallable<SignFieldNameDialogProps, string | null>(+ ({ call }) => {+ const form = useForm<TSignFieldNameFormSchema>({+ resolver: zodResolver(ZSignFieldNameFormSchema),+ defaultValues: {+ name: '',+ },+ });++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Name</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>Sign your full name into the field</Trans>+ </DialogDescription>+ </DialogHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit((data) => call.end(data.name))}>+ <fieldset+ className="flex h-full flex-col space-y-4"+ disabled={form.formState.isSubmitting}+ >+ <FormField+ control={form.control}+ name="name"+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Input {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="submit">+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/sign-field-number-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-number-dialog.tsxnew file mode 100644index 000000000..4476f7965--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-number-dialog.tsx@@ -0,0 +1,144 @@+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { createCallable } from 'react-call';+import { useForm } from 'react-hook-form';+import { z } from 'zod';++import type { TNumberFieldMeta } from '@documenso/lib/types/field-meta';+import { cn } from '@documenso/ui/lib/utils';+import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import { numberFormatValues } from '@documenso/ui/primitives/document-flow/field-items-advanced-settings/constants';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';++const createNumberFieldSchema = (fieldMeta: TNumberFieldMeta) => {+ let schema = z.coerce.number({+ invalid_type_error: msg`Please enter a valid number`.id, // Todo: Envelopes - Check that this works+ });++ const { numberFormat, minValue, maxValue } = fieldMeta;++ if (typeof minValue === 'number') {+ schema = schema.min(minValue);+ }++ if (typeof maxValue === 'number') {+ schema = schema.max(maxValue);+ }++ if (numberFormat) {+ const foundRegex = numberFormatValues.find((item) => item.value === numberFormat)?.regex;++ if (!foundRegex) {+ return schema;+ }++ return schema.refine(+ (value) => {+ return foundRegex.test(value.toString());+ },+ {+ message: `Number needs to be formatted as ${numberFormat}`,+ // Todo: Envelopes+ // message: msg`Number needs to be formatted as ${numberFormat}`.id,+ },+ );+ }++ return schema;+};++export type SignFieldNumberDialogProps = {+ fieldMeta: TNumberFieldMeta;+};++export const SignFieldNumberDialog = createCallable<SignFieldNumberDialogProps, number | null>(+ ({ call, fieldMeta }) => {+ const { t } = useLingui();++ const ZSignFieldNumberFormSchema = z.object({+ number: createNumberFieldSchema(fieldMeta),+ });++ const form = useForm<z.infer<typeof ZSignFieldNumberFormSchema>>({+ resolver: zodResolver(ZSignFieldNumberFormSchema),+ defaultValues: {+ number: undefined,+ },+ });++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Number Field</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>Insert a value into the number field</Trans>+ </DialogDescription>+ </DialogHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit((data) => call.end(data.number))}>+ <fieldset+ className="flex h-full flex-col space-y-4"+ disabled={form.formState.isSubmitting}+ >+ <FormField+ control={form.control}+ name="number"+ render={({ field, fieldState }) => (+ <FormItem>+ {fieldMeta.label && <FormLabel>{fieldMeta.label}</FormLabel>}++ <FormControl>+ <Input+ placeholder={fieldMeta.placeholder ?? t`Enter your number here`}+ className={cn('w-full rounded-md', {+ 'border-2 border-red-300 text-left ring-2 ring-red-200 ring-offset-2 ring-offset-red-200 focus-visible:border-red-400 focus-visible:ring-4 focus-visible:ring-red-200 focus-visible:ring-offset-2 focus-visible:ring-offset-red-200':+ fieldState.error,+ })}+ {...field}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="submit">+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-signature-dialog.tsxnew file mode 100644index 000000000..6ce8c8e77--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx@@ -0,0 +1,76 @@+import { useState } from 'react';++import { Trans } from '@lingui/react/macro';+import { createCallable } from 'react-call';++import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import { SignaturePad } from '@documenso/ui/primitives/signature-pad';++import { DocumentSigningDisclosure } from '../general/document-signing/document-signing-disclosure';++export type SignFieldSignatureDialogProps = {+ initialSignature?: string;+ typedSignatureEnabled?: boolean;+ uploadSignatureEnabled?: boolean;+ drawSignatureEnabled?: boolean;+};++export const SignFieldSignatureDialog = createCallable<+ SignFieldSignatureDialogProps,+ string | null+>(+ ({+ call,+ typedSignatureEnabled,+ uploadSignatureEnabled,+ drawSignatureEnabled,+ initialSignature,+ }) => {+ const [localSignature, setLocalSignature] = useState(initialSignature);++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <div>+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Signature Field</Trans>+ </DialogTitle>+ </DialogHeader>++ <SignaturePad+ value={localSignature ?? ''}+ onChange={({ value }) => setLocalSignature(value)}+ typedSignatureEnabled={typedSignatureEnabled}+ uploadSignatureEnabled={uploadSignatureEnabled}+ drawSignatureEnabled={drawSignatureEnabled}+ />+ </div>++ <DocumentSigningDisclosure />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button+ type="button"+ disabled={!localSignature}+ onClick={() => call.end(localSignature || null)}+ >+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/sign-field-text-dialog.tsx b/apps/remix/app/components/dialogs/sign-field-text-dialog.tsxnew file mode 100644index 000000000..1e3b37b09--- /dev/null+++ b/apps/remix/app/components/dialogs/sign-field-text-dialog.tsx@@ -0,0 +1,120 @@+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Plural, useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { createCallable } from 'react-call';+import { useForm } from 'react-hook-form';+import { z } from 'zod';++import type { TTextFieldMeta } from '@documenso/lib/types/field-meta';+import { cn } from '@documenso/ui/lib/utils';+import { Button } from '@documenso/ui/primitives/button';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Textarea } from '@documenso/ui/primitives/textarea';++const ZSignFieldTextFormSchema = z.object({+ text: z.string().min(1, { message: msg`Text is required`.id }),+});++type TSignFieldTextFormSchema = z.infer<typeof ZSignFieldTextFormSchema>;++export type SignFieldTextDialogProps = {+ fieldMeta?: TTextFieldMeta;+};++export const SignFieldTextDialog = createCallable<SignFieldTextDialogProps, string | null>(+ ({ call, fieldMeta }) => {+ const { t } = useLingui();++ const form = useForm<TSignFieldTextFormSchema>({+ resolver: zodResolver(ZSignFieldTextFormSchema),+ defaultValues: {+ text: '',+ },+ });++ return (+ <Dialog open={true} onOpenChange={(value) => (!value ? call.end(null) : null)}>+ <DialogContent position="center">+ <DialogHeader>+ <DialogTitle>+ <Trans>Sign Text Field</Trans>+ </DialogTitle>++ <DialogDescription className="mt-4">+ <Trans>Insert a value into the text field</Trans>+ </DialogDescription>+ </DialogHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit((data) => call.end(data.text))}>+ <fieldset+ className="flex h-full flex-col space-y-4"+ disabled={form.formState.isSubmitting}+ >+ <FormField+ control={form.control}+ name="text"+ render={({ field, fieldState }) => (+ <FormItem>+ {fieldMeta?.label && <FormLabel>{fieldMeta?.label}</FormLabel>}++ <FormControl>+ <Textarea+ id="custom-text"+ placeholder={fieldMeta?.placeholder ?? t`Enter your text here`}+ className={cn('w-full rounded-md', {+ 'border-2 border-red-300 text-left ring-2 ring-red-200 ring-offset-2 ring-offset-red-200 focus-visible:border-red-400 focus-visible:ring-4 focus-visible:ring-red-200 focus-visible:ring-offset-2 focus-visible:ring-offset-red-200':+ fieldState.error,+ })}+ {...field}+ />+ </FormControl>+ <FormMessage />+ {fieldMeta?.characterLimit !== undefined &&+ fieldMeta?.characterLimit > 0 &&+ !fieldState.error && (+ <div className="text-muted-foreground text-sm">+ <Plural+ value={fieldMeta?.characterLimit - (field.value?.length ?? 0)}+ one="# character remaining"+ other="# characters remaining"+ />+ </div>+ )}+ </FormItem>+ )}+ />++ <DialogFooter>+ <Button type="button" variant="secondary" onClick={() => call.end(null)}>+ <Trans>Cancel</Trans>+ </Button>++ <Button type="submit">+ <Trans>Sign</Trans>+ </Button>+ </DialogFooter>+ </fieldset>+ </form>+ </Form>+ </DialogContent>+ </Dialog>+ );+ },+);diff --git a/apps/remix/app/components/dialogs/template-create-dialog.tsx b/apps/remix/app/components/dialogs/template-create-dialog.tsxindex 1e05dadba..76d4e0c8a 100644--- a/apps/remix/app/components/dialogs/template-create-dialog.tsx+++ b/apps/remix/app/components/dialogs/template-create-dialog.tsx@@ -44,7 +44,9 @@ export const TemplateCreateDialog = ({ folderId }: TemplateCreateDialogProps) =>const [showTemplateCreateDialog, setShowTemplateCreateDialog] = useState(false);const [isUploadingFile, setIsUploadingFile] = useState(false);- const onFileDrop = async (file: File) => {+ const onFileDrop = async (files: File[]) => {+ const file = files[0];+if (isUploadingFile) {return;}@@ -54,7 +56,7 @@ export const TemplateCreateDialog = ({ folderId }: TemplateCreateDialogProps) =>try {const response = await putPdfFile(file);- const { id } = await createTemplate({+ const { legacyTemplateId: id } = await createTemplate({title: file.name,templateDocumentDataId: response.id,folderId: folderId,diff --git a/apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx b/apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsxdeleted file mode 100644index 60ff06715..000000000--- a/apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+++ /dev/null@@ -1,46 +0,0 @@-import { useState } from 'react';--import { Trans } from '@lingui/react/macro';-import type { Recipient, Template, TemplateDirectLink } from '@prisma/client';-import { LinkIcon } from 'lucide-react';--import { Button } from '@documenso/ui/primitives/button';--import { TemplateDirectLinkDialog } from '~/components/dialogs/template-direct-link-dialog';--export type TemplateDirectLinkDialogWrapperProps = {- template: Template & { directLink?: TemplateDirectLink | null; recipients: Recipient[] };-};--export const TemplateDirectLinkDialogWrapper = ({- template,-}: TemplateDirectLinkDialogWrapperProps) => {- const [isTemplateDirectLinkOpen, setTemplateDirectLinkOpen] = useState(false);-- return (- <div>- <Button- variant="outline"- className="px-3"- onClick={(e) => {- e.preventDefault();- setTemplateDirectLinkOpen(true);- }}- >- <LinkIcon className="mr-1.5 h-3.5 w-3.5" />-- {template.directLink ? (- <Trans>Manage Direct Link</Trans>- ) : (- <Trans>Create Direct Link</Trans>- )}- </Button>-- <TemplateDirectLinkDialog- template={template}- open={isTemplateDirectLinkOpen}- onOpenChange={setTemplateDirectLinkOpen}- />- </div>- );-};diff --git a/apps/remix/app/components/dialogs/template-direct-link-dialog.tsx b/apps/remix/app/components/dialogs/template-direct-link-dialog.tsxindex d7e60b512..f69d310be 100644--- a/apps/remix/app/components/dialogs/template-direct-link-dialog.tsx+++ b/apps/remix/app/components/dialogs/template-direct-link-dialog.tsx@@ -3,13 +3,15 @@ import { useEffect, useMemo, useState } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';+import { type Recipient, RecipientRole, type TemplateDirectLink } from '@prisma/client';import {- type Recipient,- RecipientRole,- type Template,- type TemplateDirectLink,-} from '@prisma/client';-import { CircleDotIcon, CircleIcon, ClipboardCopyIcon, InfoIcon, LoaderIcon } from 'lucide-react';+ CircleDotIcon,+ CircleIcon,+ ClipboardCopyIcon,+ InfoIcon,+ LinkIcon,+ LoaderIcon,+} from 'lucide-react';import { Link, useRevalidator } from 'react-router';import { P, match } from 'ts-pattern';@@ -31,6 +33,7 @@ import {DialogFooter,DialogHeader,DialogTitle,+ DialogTrigger,} from '@documenso/ui/primitives/dialog';import { Input } from '@documenso/ui/primitives/input';import { Label } from '@documenso/ui/primitives/label';@@ -47,20 +50,19 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@documenso/ui/primitiveimport { useToast } from '@documenso/ui/primitives/use-toast';type TemplateDirectLinkDialogProps = {- template: Template & {- directLink?: Pick<TemplateDirectLink, 'token' | 'enabled'> | null;- recipients: Recipient[];- };- open: boolean;- onOpenChange: (_open: boolean) => void;+ templateId: number;+ directLink?: Pick<TemplateDirectLink, 'token' | 'enabled'> | null;+ recipients: Recipient[];+ trigger?: React.ReactNode;};type TemplateDirectLinkStep = 'ONBOARD' | 'SELECT_RECIPIENT' | 'MANAGE' | 'CONFIRM_DELETE';export const TemplateDirectLinkDialog = ({- template,- open,- onOpenChange,+ templateId,+ directLink,+ recipients,+ trigger,}: TemplateDirectLinkDialogProps) => {const { toast } = useToast();const { quota, remaining } = useLimits();@@ -69,8 +71,9 @@ export const TemplateDirectLinkDialog = ({const [, copy] = useCopyToClipboard();- const [isEnabled, setIsEnabled] = useState(template.directLink?.enabled ?? false);- const [token, setToken] = useState(template.directLink?.token ?? null);+ const [open, setOpen] = useState(false);+ const [isEnabled, setIsEnabled] = useState(directLink?.enabled ?? false);+ const [token, setToken] = useState(directLink?.token ?? null);const [selectedRecipientId, setSelectedRecipientId] = useState<number | null>(null);const [currentStep, setCurrentStep] = useState<TemplateDirectLinkStep>(token ? 'MANAGE' : 'ONBOARD',@@ -80,11 +83,11 @@ export const TemplateDirectLinkDialog = ({const validDirectTemplateRecipients = useMemo(() =>- template.recipients.filter(+ recipients.filter((recipient) =>recipient.role !== RecipientRole.CC && recipient.role !== RecipientRole.ASSISTANT,),- [template.recipients],+ [recipients],);const {@@ -140,7 +143,7 @@ export const TemplateDirectLinkDialog = ({onSuccess: async () => {await revalidate();- onOpenChange(false);+ setOpen(false);setToken(null);toast({@@ -178,7 +181,7 @@ export const TemplateDirectLinkDialog = ({setSelectedRecipientId(recipientId);await createTemplateDirectLink({- templateId: template.id,+ templateId,directRecipientId: recipientId,});};@@ -195,300 +198,311 @@ export const TemplateDirectLinkDialog = ({}, [open]);return (- <Dialog open={open} onOpenChange={(value) => !isLoading && onOpenChange(value)}>- <fieldset disabled={isLoading} className="relative">- <AnimateGenericFadeInOut motionKey={currentStep}>- {match({ token, currentStep })- .with({ token: P.nullish, currentStep: 'ONBOARD' }, () => (- <DialogContent>- <DialogHeader>- <DialogTitle>- <Trans>Create Direct Signing Link</Trans>- </DialogTitle>-- <DialogDescription>- <Trans>Here's how it works:</Trans>- </DialogDescription>- </DialogHeader>-- <ul className="mt-4 space-y-4 pl-12">- {DIRECT_TEMPLATE_DOCUMENTATION.map((step, index) => (- <li className="relative" key={index}>- <div className="absolute -left-12">- <div className="flex h-8 w-8 items-center justify-center rounded-full border-[3px] border-neutral-200 text-sm font-bold">- {index + 1}+ <Dialog open={open} onOpenChange={(value) => !isLoading && setOpen(value)}>+ <DialogTrigger asChild>+ {trigger || (+ <Button variant="outline" className="px-3">+ <LinkIcon className="mr-1.5 h-3.5 w-3.5" />++ {directLink ? <Trans>Manage Direct Link</Trans> : <Trans>Create Direct Link</Trans>}+ </Button>+ )}+ </DialogTrigger>+ <DialogContent hideClose>+ <fieldset disabled={isLoading} className="relative">+ <AnimateGenericFadeInOut motionKey={currentStep}>+ {match({ token, currentStep })+ .with({ token: P.nullish, currentStep: 'ONBOARD' }, () => (+ <DialogContent>+ <DialogHeader>+ <DialogTitle>+ <Trans>Create Direct Signing Link</Trans>+ </DialogTitle>++ <DialogDescription>+ <Trans>Here's how it works:</Trans>+ </DialogDescription>+ </DialogHeader>++ <ul className="mt-4 space-y-4 pl-12">+ {DIRECT_TEMPLATE_DOCUMENTATION.map((step, index) => (+ <li className="relative" key={index}>+ <div className="absolute -left-12">+ <div className="flex h-8 w-8 items-center justify-center rounded-full border-[3px] border-neutral-200 text-sm font-bold">+ {index + 1}+ </div></div>- </div>- <h3 className="font-semibold">{_(step.title)}</h3>- <p className="text-muted-foreground mt-1 text-sm">{_(step.description)}</p>- </li>- ))}- </ul>+ <h3 className="font-semibold">{_(step.title)}</h3>+ <p className="text-muted-foreground mt-1 text-sm">{_(step.description)}</p>+ </li>+ ))}+ </ul>++ {remaining.directTemplates === 0 && (+ <Alert variant="warning">+ <AlertTitle>+ <Trans>+ Direct template link usage exceeded ({quota.directTemplates}/+ {quota.directTemplates})+ </Trans>+ </AlertTitle>+ <AlertDescription>+ <Trans>+ You have reached the maximum limit of {quota.directTemplates} direct+ templates.{' '}+ <Link+ className="mt-1 block underline underline-offset-4"+ to={`/o/${organisation.url}/settings/billing`}+ >+ Upgrade your account to continue!+ </Link>+ </Trans>+ </AlertDescription>+ </Alert>+ )}++ {remaining.directTemplates !== 0 && (+ <DialogFooter className="mx-auto mt-4">+ <Button type="button" onClick={() => setCurrentStep('SELECT_RECIPIENT')}>+ <Trans> Enable direct link signing</Trans>+ </Button>+ </DialogFooter>+ )}+ </DialogContent>+ ))+ .with({ token: P.nullish, currentStep: 'SELECT_RECIPIENT' }, () => (+ <DialogContent className="relative">+ {isCreatingTemplateDirectLink && validDirectTemplateRecipients.length !== 0 && (+ <div className="absolute inset-0 z-50 flex items-center justify-center rounded bg-white/50 dark:bg-black/50">+ <LoaderIcon className="h-6 w-6 animate-spin text-gray-500" />+ </div>+ )}- {remaining.directTemplates === 0 && (- <Alert variant="warning">- <AlertTitle>- <Trans>- Direct template link usage exceeded ({quota.directTemplates}/- {quota.directTemplates})- </Trans>- </AlertTitle>- <AlertDescription>- <Trans>- You have reached the maximum limit of {quota.directTemplates} direct- templates.{' '}- <Link- className="mt-1 block underline underline-offset-4"- to={`/o/${organisation.url}/settings/billing`}- >- Upgrade your account to continue!- </Link>- </Trans>- </AlertDescription>- </Alert>- )}-- {remaining.directTemplates !== 0 && (- <DialogFooter className="mx-auto mt-4">- <Button type="button" onClick={() => setCurrentStep('SELECT_RECIPIENT')}>- <Trans> Enable direct link signing</Trans>- </Button>- </DialogFooter>- )}- </DialogContent>- ))- .with({ token: P.nullish, currentStep: 'SELECT_RECIPIENT' }, () => (- <DialogContent className="relative">- {isCreatingTemplateDirectLink && validDirectTemplateRecipients.length !== 0 && (- <div className="absolute inset-0 z-50 flex items-center justify-center rounded bg-white/50 dark:bg-black/50">- <LoaderIcon className="h-6 w-6 animate-spin text-gray-500" />- </div>- )}-- <DialogHeader>- <DialogTitle>- <Trans>Choose Direct Link Recipient</Trans>- </DialogTitle>-- <DialogDescription>- <Trans>Choose an existing recipient from below to continue</Trans>- </DialogDescription>- </DialogHeader>-- <div className="custom-scrollbar max-h-[60vh] overflow-y-auto rounded-md border">- <Table>- <TableHeader>- <TableRow>- <TableHead>- <Trans>Recipient</Trans>- </TableHead>- <TableHead>- <Trans>Role</Trans>- </TableHead>- <TableHead></TableHead>- </TableRow>- </TableHeader>- <TableBody>- {validDirectTemplateRecipients.length === 0 && (- <TableRow>- <TableCell colSpan={3} className="h-16 text-center">- <p className="text-muted-foreground">- <Trans>No valid recipients found</Trans>- </p>- </TableCell>- </TableRow>- )}+ <DialogHeader>+ <DialogTitle>+ <Trans>Choose Direct Link Recipient</Trans>+ </DialogTitle>- {validDirectTemplateRecipients.map((row) => (- <TableRow- className="cursor-pointer"- key={row.id}- onClick={async () => onRecipientTableRowClick(row.id)}- >- <TableCell>- <div className="text-muted-foreground text-sm">- <p>{row.name}</p>- <p className="text-muted-foreground/70 text-xs">{row.email}</p>- </div>- </TableCell>-- <TableCell className="text-muted-foreground text-sm">- {_(RECIPIENT_ROLES_DESCRIPTION[row.role].roleName)}- </TableCell>-- <TableCell>- {selectedRecipientId === row.id ? (- <CircleDotIcon className="h-5 w-5 text-neutral-300" />- ) : (- <CircleIcon className="h-5 w-5 text-neutral-300" />- )}- </TableCell>+ <DialogDescription>+ <Trans>Choose an existing recipient from below to continue</Trans>+ </DialogDescription>+ </DialogHeader>++ <div className="custom-scrollbar max-h-[60vh] overflow-y-auto rounded-md border">+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>+ <Trans>Recipient</Trans>+ </TableHead>+ <TableHead>+ <Trans>Role</Trans>+ </TableHead>+ <TableHead></TableHead></TableRow>- ))}- </TableBody>- </Table>- </div>-- {/* Prevent creating placeholder direct template recipient if the email already exists. */}- {!template.recipients.some(- (recipient) => recipient.email === DIRECT_TEMPLATE_RECIPIENT_EMAIL,- ) && (- <DialogFooter className="mx-auto">- <div className="flex flex-col items-center justify-center">- {validDirectTemplateRecipients.length !== 0 && (- <p className="text-muted-foreground text-sm">- <Trans>Or</Trans>- </p>- )}-- <Button- type="button"- className="mt-2"- loading={isCreatingTemplateDirectLink && !selectedRecipientId}- onClick={async () =>- createTemplateDirectLink({- templateId: template.id,- })- }- >- <Trans>Create one automatically</Trans>- </Button>- </div>- </DialogFooter>- )}- </DialogContent>- ))- .with({ token: P.string, currentStep: 'MANAGE' }, ({ token }) => (- <DialogContent className="relative">- <DialogHeader>- <DialogTitle>- <Trans>Direct Link Signing</Trans>- </DialogTitle>-- <DialogDescription>- <Trans>Manage the direct link signing for this template</Trans>- </DialogDescription>- </DialogHeader>-- <div>- <div className="flex flex-row items-center justify-between">- <Label className="flex flex-row">- <Trans>Enable Direct Link Signing</Trans>- <Tooltip>- <TooltipTrigger tabIndex={-1} className="ml-2">- <InfoIcon className="h-4 w-4" />- </TooltipTrigger>- <TooltipContent className="text-foreground z-9999 max-w-md p-4">- <Trans>- Disabling direct link signing will prevent anyone from accessing the- link.- </Trans>- </TooltipContent>- </Tooltip>- </Label>-- <Switch- className="mt-2"- checked={isEnabled}- onCheckedChange={(value) => setIsEnabled(value)}- />+ </TableHeader>+ <TableBody>+ {validDirectTemplateRecipients.length === 0 && (+ <TableRow>+ <TableCell colSpan={3} className="h-16 text-center">+ <p className="text-muted-foreground">+ <Trans>No valid recipients found</Trans>+ </p>+ </TableCell>+ </TableRow>+ )}++ {validDirectTemplateRecipients.map((row) => (+ <TableRow+ className="cursor-pointer"+ key={row.id}+ onClick={async () => onRecipientTableRowClick(row.id)}+ >+ <TableCell>+ <div className="text-muted-foreground text-sm">+ <p>{row.name}</p>+ <p className="text-muted-foreground/70 text-xs">{row.email}</p>+ </div>+ </TableCell>++ <TableCell className="text-muted-foreground text-sm">+ {_(RECIPIENT_ROLES_DESCRIPTION[row.role].roleName)}+ </TableCell>++ <TableCell>+ {selectedRecipientId === row.id ? (+ <CircleDotIcon className="h-5 w-5 text-neutral-300" />+ ) : (+ <CircleIcon className="h-5 w-5 text-neutral-300" />+ )}+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table></div>- <div className="mt-2">- <Label htmlFor="copy-direct-link">- <Trans>Copy Shareable Link</Trans>- </Label>-- <div className="relative mt-1">- <Input- id="copy-direct-link"- disabled- value={formatDirectTemplatePath(token).replace(/https?:\/\//, '')}- readOnly- className="pr-12"- />+ {/* Prevent creating placeholder direct template recipient if the email already exists. */}+ {!recipients.some(+ (recipient) => recipient.email === DIRECT_TEMPLATE_RECIPIENT_EMAIL,+ ) && (+ <DialogFooter className="mx-auto">+ <div className="flex flex-col items-center justify-center">+ {validDirectTemplateRecipients.length !== 0 && (+ <p className="text-muted-foreground text-sm">+ <Trans>Or</Trans>+ </p>+ )}- <div className="absolute bottom-0 right-1 top-0 flex items-center justify-center"><Button- variant="none"type="button"- className="h-8 w-8"- onClick={() => void onCopyClick(token)}+ className="mt-2"+ loading={isCreatingTemplateDirectLink && !selectedRecipientId}+ onClick={async () =>+ createTemplateDirectLink({+ templateId,+ })+ }>- <ClipboardCopyIcon className="h-4 w-4 flex-shrink-0" />+ <Trans>Create one automatically</Trans></Button></div>+ </DialogFooter>+ )}+ </DialogContent>+ ))+ .with({ token: P.string, currentStep: 'MANAGE' }, ({ token }) => (+ <DialogContent className="relative">+ <DialogHeader>+ <DialogTitle>+ <Trans>Direct Link Signing</Trans>+ </DialogTitle>++ <DialogDescription>+ <Trans>Manage the direct link signing for this template</Trans>+ </DialogDescription>+ </DialogHeader>++ <div>+ <div className="flex flex-row items-center justify-between">+ <Label className="flex flex-row">+ <Trans>Enable Direct Link Signing</Trans>+ <Tooltip>+ <TooltipTrigger tabIndex={-1} className="ml-2">+ <InfoIcon className="h-4 w-4" />+ </TooltipTrigger>+ <TooltipContent className="text-foreground z-9999 max-w-md p-4">+ <Trans>+ Disabling direct link signing will prevent anyone from accessing the+ link.+ </Trans>+ </TooltipContent>+ </Tooltip>+ </Label>++ <Switch+ className="mt-2"+ checked={isEnabled}+ onCheckedChange={(value) => setIsEnabled(value)}+ />+ </div>++ <div className="mt-2">+ <Label htmlFor="copy-direct-link">+ <Trans>Copy Shareable Link</Trans>+ </Label>++ <div className="relative mt-1">+ <Input+ id="copy-direct-link"+ disabled+ value={formatDirectTemplatePath(token).replace(/https?:\/\//, '')}+ readOnly+ className="pr-12"+ />++ <div className="absolute bottom-0 right-1 top-0 flex items-center justify-center">+ <Button+ variant="none"+ type="button"+ className="h-8 w-8"+ onClick={() => void onCopyClick(token)}+ >+ <ClipboardCopyIcon className="h-4 w-4 flex-shrink-0" />+ </Button>+ </div>+ </div></div></div>- </div>-- <DialogFooter className="mt-4">- <Button- type="button"- variant="destructive"- className="mr-auto w-full sm:w-auto"- loading={isDeletingTemplateDirectLink}- onClick={() => setCurrentStep('CONFIRM_DELETE')}- >- <Trans>Remove</Trans>- </Button>-- <Button- type="button"- loading={isTogglingTemplateAccess}- onClick={async () => {- await toggleTemplateDirectLink({- templateId: template.id,- enabled: isEnabled,- }).catch(() => null);-- onOpenChange(false);- }}- >- <Trans>Save</Trans>- </Button>- </DialogFooter>- </DialogContent>- ))- .with({ token: P.string, currentStep: 'CONFIRM_DELETE' }, () => (- <DialogContent className="relative">- <DialogHeader>- <DialogTitle>- <Trans>Are you sure?</Trans>- </DialogTitle>-- <DialogDescription>- <Trans>- Please note that proceeding will remove direct linking recipient and turn it- into a placeholder.- </Trans>- </DialogDescription>- </DialogHeader>-- <DialogFooter>- <Button- type="button"- variant="secondary"- onClick={() => setCurrentStep('MANAGE')}- >- <Trans>Cancel</Trans>- </Button>-- <Button- type="button"- variant="destructive"- loading={isDeletingTemplateDirectLink}- onClick={() => void deleteTemplateDirectLink({ templateId: template.id })}- >- <Trans>Confirm</Trans>- </Button>- </DialogFooter>- </DialogContent>- ))- .otherwise(() => null)}- </AnimateGenericFadeInOut>- </fieldset>++ <DialogFooter className="mt-4">+ <Button+ type="button"+ variant="destructive"+ className="mr-auto w-full sm:w-auto"+ loading={isDeletingTemplateDirectLink}+ onClick={() => setCurrentStep('CONFIRM_DELETE')}+ >+ <Trans>Remove</Trans>+ </Button>++ <Button+ type="button"+ loading={isTogglingTemplateAccess}+ onClick={async () => {+ await toggleTemplateDirectLink({+ templateId,+ enabled: isEnabled,+ }).catch(() => null);++ setOpen(false);+ }}+ >+ <Trans>Save</Trans>+ </Button>+ </DialogFooter>+ </DialogContent>+ ))+ .with({ token: P.string, currentStep: 'CONFIRM_DELETE' }, () => (+ <DialogContent className="relative">+ <DialogHeader>+ <DialogTitle>+ <Trans>Are you sure?</Trans>+ </DialogTitle>++ <DialogDescription>+ <Trans>+ Please note that proceeding will remove direct linking recipient and turn it+ into a placeholder.+ </Trans>+ </DialogDescription>+ </DialogHeader>++ <DialogFooter>+ <Button+ type="button"+ variant="secondary"+ onClick={() => setCurrentStep('MANAGE')}+ >+ <Trans>Cancel</Trans>+ </Button>++ <Button+ type="button"+ variant="destructive"+ loading={isDeletingTemplateDirectLink}+ onClick={() => void deleteTemplateDirectLink({ templateId })}+ >+ <Trans>Confirm</Trans>+ </Button>+ </DialogFooter>+ </DialogContent>+ ))+ .otherwise(() => null)}+ </AnimateGenericFadeInOut>+ </fieldset>+ </DialogContent></Dialog>);};diff --git a/apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx b/apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsxindex 406b56035..d6ccfa07d 100644--- a/apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx+++ b/apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx@@ -83,7 +83,7 @@ export function TemplateMoveToFolderDialog({},);- const { mutateAsync: moveTemplateToFolder } = trpc.folder.moveTemplateToFolder.useMutation();+ const { mutateAsync: updateTemplate } = trpc.template.updateTemplate.useMutation();useEffect(() => {if (!isOpen) {@@ -96,9 +96,11 @@ export function TemplateMoveToFolderDialog({const onSubmit = async (data: TMoveTemplateFormSchema) => {try {- await moveTemplateToFolder({+ await updateTemplate({templateId,- folderId: data.folderId ?? null,+ data: {+ folderId: data.folderId ?? null,+ },});toast({diff --git a/apps/remix/app/components/dialogs/template-use-dialog.tsx b/apps/remix/app/components/dialogs/template-use-dialog.tsxindex f5822b2f9..93a837545 100644--- a/apps/remix/app/components/dialogs/template-use-dialog.tsx+++ b/apps/remix/app/components/dialogs/template-use-dialog.tsx@@ -384,6 +384,7 @@ export function TemplateUseDialog({className="text-muted-foreground ml-2 flex items-center text-sm"htmlFor="useCustomDocument">+ {/* Todo: Envelopes - How will this work? */}<Trans>Upload custom document</Trans><Tooltip><TooltipTrigger type="button">diff --git a/apps/remix/app/components/embed/authoring/configure-document-view.types.ts b/apps/remix/app/components/embed/authoring/configure-document-view.types.tsindex 42eab5442..415d8e892 100644--- a/apps/remix/app/components/embed/authoring/configure-document-view.types.ts+++ b/apps/remix/app/components/embed/authoring/configure-document-view.types.ts@@ -1,11 +1,11 @@import { z } from 'zod';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import { DocumentDistributionMethod } from '@documenso/prisma/generated/types';import {ZDocumentMetaDateFormatSchema,ZDocumentMetaLanguageSchema,-} from '@documenso/trpc/server/document-router/schema';+} from '@documenso/lib/types/document-meta';+import { DocumentDistributionMethod } from '@documenso/prisma/generated/types';// Define the schema for configurationexport type TConfigureEmbedFormSchema = z.infer<typeof ZConfigureEmbedFormSchema>;diff --git a/apps/remix/app/components/embed/authoring/configure-fields-view.tsx b/apps/remix/app/components/embed/authoring/configure-fields-view.tsxindex 21faee750..704109a90 100644--- a/apps/remix/app/components/embed/authoring/configure-fields-view.tsx+++ b/apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -118,6 +118,7 @@ export const ConfigureFieldsView = ({sendStatus: signer.disabled ? SendStatus.SENT : SendStatus.NOT_SENT,readStatus: signer.disabled ? ReadStatus.OPENED : ReadStatus.NOT_OPENED,signingStatus: signer.disabled ? SigningStatus.SIGNED : SigningStatus.NOT_SIGNED,+ envelopeId: '',}));}, [configData.signers]);diff --git a/apps/remix/app/components/embed/embed-direct-template-client-page.tsx b/apps/remix/app/components/embed/embed-direct-template-client-page.tsxindex db429f7e4..47c473012 100644--- a/apps/remix/app/components/embed/embed-direct-template-client-page.tsx+++ b/apps/remix/app/components/embed/embed-direct-template-client-page.tsx@@ -3,7 +3,7 @@ import { useEffect, useLayoutEffect, useState } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { DocumentMeta, Recipient, Signature, TemplateMeta } from '@prisma/client';+import type { DocumentMeta, Recipient, Signature } from '@prisma/client';import { type DocumentData, type Field, FieldType } from '@prisma/client';import { LucideChevronDown, LucideChevronUp } from 'lucide-react';import { DateTime } from 'luxon';@@ -48,7 +48,7 @@ export type EmbedDirectTemplateClientPageProps = {documentData: DocumentData;recipient: Recipient;fields: Field[];- metadata?: DocumentMeta | TemplateMeta | null;+ metadata?: DocumentMeta | null;hidePoweredBy?: boolean;allowWhiteLabelling?: boolean;};diff --git a/apps/remix/app/components/embed/embed-document-fields.tsx b/apps/remix/app/components/embed/embed-document-fields.tsxindex ea14b3f1f..5c94f4127 100644--- a/apps/remix/app/components/embed/embed-document-fields.tsx+++ b/apps/remix/app/components/embed/embed-document-fields.tsx@@ -1,4 +1,4 @@-import type { DocumentMeta, TemplateMeta } from '@prisma/client';+import type { DocumentMeta } from '@prisma/client';import { type Field, FieldType } from '@prisma/client';import { match } from 'ts-pattern';@@ -33,7 +33,7 @@ import { DocumentSigningTextField } from '~/components/general/document-signing/export type EmbedDocumentFieldsProps = {fields: Field[];metadata?: Pick<- DocumentMeta | TemplateMeta,+ DocumentMeta,| 'timezone'| 'dateFormat'| 'typedSignatureEnabled'diff --git a/apps/remix/app/components/embed/embed-document-signing-page.tsx b/apps/remix/app/components/embed/embed-document-signing-page.tsxindex 2f24dceeb..e795d910e 100644--- a/apps/remix/app/components/embed/embed-document-signing-page.tsx+++ b/apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -3,7 +3,7 @@ import { useEffect, useId, useLayoutEffect, useMemo, useState } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { DocumentMeta, TemplateMeta } from '@prisma/client';+import type { DocumentMeta } from '@prisma/client';import {type DocumentData,type Field,@@ -15,12 +15,14 @@ import { LucideChevronDown, LucideChevronUp } from 'lucide-react';import { useThrottleFn } from '@documenso/lib/client-only/hooks/use-throttle-fn';import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';-import type { DocumentField } from '@documenso/lib/server-only/field/get-fields-for-document';import { isFieldUnsignedAndRequired } from '@documenso/lib/utils/advanced-fields-helpers';import { validateFieldsInserted } from '@documenso/lib/utils/fields';import type { RecipientWithFields } from '@documenso/prisma/types/recipient-with-fields';import { trpc } from '@documenso/trpc/react';-import { DocumentReadOnlyFields } from '@documenso/ui/components/document/document-read-only-fields';+import {+ type DocumentField,+ DocumentReadOnlyFields,+} from '@documenso/ui/components/document/document-read-only-fields';import { FieldToolTip } from '@documenso/ui/components/field/field-tooltip';import { Button } from '@documenso/ui/primitives/button';import { ElementVisible } from '@documenso/ui/primitives/element-visible';@@ -50,7 +52,7 @@ export type EmbedSignDocumentClientPageProps = {recipient: RecipientWithFields;fields: Field[];completedFields: DocumentField[];- metadata?: DocumentMeta | TemplateMeta | null;+ metadata?: DocumentMeta | null;isCompleted?: boolean;hidePoweredBy?: boolean;allowWhitelabelling?: boolean;@@ -275,7 +277,7 @@ export const EmbedSignDocumentClientPage = ({{allowDocumentRejection && (<div className="embed--Actions mb-4 flex w-full flex-row-reverse items-baseline justify-between"><DocumentSigningRejectDialog- document={{ id: documentId }}+ documentId={documentId}token={token}onRejected={onDocumentRejected}/>diff --git a/apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx b/apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsxindex 5867a1a2a..d74b88f2d 100644--- a/apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx+++ b/apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -212,7 +212,7 @@ export const MultiSignDocumentSigningView = ({{allowDocumentRejection && (<div className="embed--Actions mb-4 mt-8 flex w-full flex-row-reverse items-baseline justify-between"><DocumentSigningRejectDialog- document={document}+ documentId={document.id}token={token}onRejected={onRejected}/>diff --git a/apps/remix/app/components/forms/document-preferences-form.tsx b/apps/remix/app/components/forms/document-preferences-form.tsxindex 38d01e252..0ebc08760 100644--- a/apps/remix/app/components/forms/document-preferences-form.tsx+++ b/apps/remix/app/components/forms/document-preferences-form.tsx@@ -17,12 +17,12 @@ import {isValidLanguageCode,} from '@documenso/lib/constants/i18n';import { TIME_ZONES } from '@documenso/lib/constants/time-zones';-import { isPersonalLayout } from '@documenso/lib/utils/organisations';-import { extractTeamSignatureSettings } from '@documenso/lib/utils/teams';import {type TDocumentMetaDateFormat,ZDocumentMetaTimezoneSchema,-} from '@documenso/trpc/server/document-router/schema';+} from '@documenso/lib/types/document-meta';+import { isPersonalLayout } from '@documenso/lib/utils/organisations';+import { extractTeamSignatureSettings } from '@documenso/lib/utils/teams';import { DocumentSignatureSettingsTooltip } from '@documenso/ui/components/document/document-signature-settings-tooltip';import { Alert } from '@documenso/ui/primitives/alert';import { Button } from '@documenso/ui/primitives/button';diff --git a/apps/remix/app/components/forms/editor/constants.ts b/apps/remix/app/components/forms/editor/constants.tsnew file mode 100644index 000000000..732662e18--- /dev/null+++ b/apps/remix/app/components/forms/editor/constants.ts@@ -0,0 +1,31 @@+// export const numberFormatValues = [+// {+// label: '123,456,789.00',+// value: '123,456,789.00',+// },+// {+// label: '123.456.789,00',+// value: '123.456.789,00',+// },+// {+// label: '123456,789.00',+// value: '123456,789.00',+// },+// ];++export const checkboxValidationRules = ['Select at least', 'Select exactly', 'Select at most'];+export const checkboxValidationLength = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];+export const checkboxValidationSigns = [+ {+ label: 'Select at least',+ value: '>=',+ },+ {+ label: 'Select exactly',+ value: '=',+ },+ {+ label: 'Select at most',+ value: '<=',+ },+];diff --git a/apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx b/apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsxnew file mode 100644index 000000000..7f271ddf7--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx@@ -0,0 +1,293 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { t } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { PlusIcon, Trash } from 'lucide-react';+import { useForm, useWatch } from 'react-hook-form';+import { z } from 'zod';++import {+ type TCheckboxFieldMeta as CheckboxFieldMeta,+ ZCheckboxFieldMeta,+} from '@documenso/lib/types/field-meta';+import { Checkbox } from '@documenso/ui/primitives/checkbox';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';+import { Separator } from '@documenso/ui/primitives/separator';++import { checkboxValidationLength, checkboxValidationRules } from './constants';+import {+ EditorGenericReadOnlyField,+ EditorGenericRequiredField,+} from './editor-field-generic-field-forms';++const ZCheckboxFieldFormSchema = ZCheckboxFieldMeta.pick({+ label: true,+ direction: true,+ validationRule: true,+ validationLength: true,+ required: true,+ values: true,+ readOnly: true,+})+ .extend({+ validationLength: z.coerce.number().optional(),+ })+ .refine(+ (data) => {+ // You need to specify both validation rule and length together+ if (data.validationRule && !data.validationLength) {+ return false;+ }+ if (data.validationLength && !data.validationRule) {+ return false;+ }+ return true;+ },+ {+ message: 'You need to specify both the validation rule and the number of options',+ path: ['validationRule'],+ },+ );++type TCheckboxFieldFormSchema = z.infer<typeof ZCheckboxFieldFormSchema>;++type EditorFieldCheckboxFormProps = {+ value: CheckboxFieldMeta | undefined;+ onValueChange: (value: CheckboxFieldMeta) => void;+};++export const EditorFieldCheckboxForm = ({+ value = {+ type: 'checkbox',+ direction: 'vertical',+ },+ onValueChange,+}: EditorFieldCheckboxFormProps) => {+ const form = useForm<TCheckboxFieldFormSchema>({+ resolver: zodResolver(ZCheckboxFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ label: value.label || '',+ direction: value.direction || 'vertical',+ validationRule: value.validationRule || '',+ validationLength: value.validationLength || 0,+ values: value.values || [{ id: 1, checked: false, value: '' }],+ required: value.required || false,+ readOnly: value.readOnly || false,+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ const addValue = () => {+ const currentValues = form.getValues('values') || [];+ const newId =+ currentValues.length > 0 ? Math.max(...currentValues.map((val) => val.id)) + 1 : 1;++ const newValues = [...currentValues, { id: newId, checked: false, value: '' }];+ form.setValue('values', newValues);+ };++ const removeValue = (index: number) => {+ const currentValues = form.getValues('values') || [];++ if (currentValues.length === 1) {+ return;+ }++ const newValues = [...currentValues];+ newValues.splice(index, 1);++ form.setValue('values', newValues);+ };++ useEffect(() => {+ const validatedFormValues = ZCheckboxFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ ...value,+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <FormField+ control={form.control}+ name="direction"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Direction</Trans>+ </FormLabel>+ <FormControl>+ <Select value={field.value} onValueChange={field.onChange}>+ <SelectTrigger className="text-muted-foreground bg-background w-full">+ <SelectValue placeholder={t`Select direction`} />+ </SelectTrigger>+ <SelectContent position="popper">+ <SelectItem value="vertical">+ <Trans>Vertical</Trans>+ </SelectItem>+ <SelectItem value="horizontal">+ <Trans>Horizontal</Trans>+ </SelectItem>+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <div className="flex flex-row items-center justify-start gap-x-4">+ <div className="flex w-2/3 flex-col">+ <FormField+ control={form.control}+ name="validationRule"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Validation</Trans>+ </FormLabel>+ <FormControl>+ <Select {...field} onValueChange={field.onChange}>+ <SelectTrigger className="text-muted-foreground bg-background w-full">+ <SelectValue placeholder={t`Select at least`} />+ </SelectTrigger>+ <SelectContent position="popper">+ {checkboxValidationRules.map((item, index) => (+ <SelectItem key={index} value={item}>+ {item}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ </div>+ <div className="mt-3 flex w-1/3 flex-col">+ <FormField+ control={form.control}+ name="validationLength"+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Select+ value={field.value ? String(field.value) : ''}+ onValueChange={field.onChange}+ >+ <SelectTrigger className="text-muted-foreground bg-background mt-5 w-full">+ <SelectValue placeholder={t`Pick a number`} />+ </SelectTrigger>+ <SelectContent position="popper">+ {checkboxValidationLength.map((item, index) => (+ <SelectItem key={index} value={String(item)}>+ {item}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ </div>+ </div>++ <div className="mt-1">+ <EditorGenericRequiredField formControl={form.control} />+ </div>++ <EditorGenericReadOnlyField formControl={form.control} />++ <section className="space-y-2">+ <div className="-mx-4 mb-4 mt-2">+ <Separator />+ </div>++ <div className="flex flex-row items-center justify-between gap-2">+ <p className="text-sm font-medium">+ <Trans>Checkbox values</Trans>+ </p>++ <button type="button" onClick={addValue}>+ <PlusIcon className="h-4 w-4" />+ </button>+ </div>++ <ul className="space-y-2">+ {(formValues.values || []).map((value, index) => (+ <li key={`checkbox-value-${index}`} className="flex flex-row items-center gap-2">+ <FormField+ control={form.control}+ name={`values.${index}.checked`}+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Checkbox+ className="data-[state=checked]:bg-primary border-foreground/30 h-5 w-5"+ checked={field.value}+ onCheckedChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name={`values.${index}.value`}+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Input className="w-full" {...field} />+ </FormControl>+ </FormItem>+ )}+ />++ <button+ type="button"+ className="flex h-10 w-10 items-center justify-center text-slate-500 hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50"+ onClick={() => removeValue(index)}+ >+ <Trash className="h-5 w-5" />+ </button>+ </li>+ ))}+ </ul>+ </section>+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-date-form.tsx b/apps/remix/app/components/forms/editor/editor-field-date-form.tsxnew file mode 100644index 000000000..b313a261d--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-date-form.tsx@@ -0,0 +1,75 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { useForm, useWatch } from 'react-hook-form';+import type { z } from 'zod';++import {+ DEFAULT_FIELD_FONT_SIZE,+ type TDateFieldMeta as DateFieldMeta,+ ZDateFieldMeta,+} from '@documenso/lib/types/field-meta';+import { Form } from '@documenso/ui/primitives/form/form';++import {+ EditorGenericFontSizeField,+ EditorGenericTextAlignField,+} from './editor-field-generic-field-forms';++const ZDateFieldFormSchema = ZDateFieldMeta.pick({+ fontSize: true,+ textAlign: true,+});++type TDateFieldFormSchema = z.infer<typeof ZDateFieldFormSchema>;++type EditorFieldDateFormProps = {+ value: DateFieldMeta | undefined;+ onValueChange: (value: DateFieldMeta) => void;+};++export const EditorFieldDateForm = ({+ value = {+ type: 'date',+ },+ onValueChange,+}: EditorFieldDateFormProps) => {+ const form = useForm<TDateFieldFormSchema>({+ resolver: zodResolver(ZDateFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ fontSize: value.fontSize || DEFAULT_FIELD_FONT_SIZE,+ textAlign: value.textAlign || 'left',+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ const validatedFormValues = ZDateFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'date',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <EditorGenericFontSizeField formControl={form.control} />++ <EditorGenericTextAlignField formControl={form.control} />+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx b/apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsxnew file mode 100644index 000000000..65c3b8d0c--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx@@ -0,0 +1,240 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { PlusIcon, Trash } from 'lucide-react';+import { useForm, useWatch } from 'react-hook-form';+import { z } from 'zod';++import { type TDropdownFieldMeta as DropdownFieldMeta } from '@documenso/lib/types/field-meta';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';+import { Separator } from '@documenso/ui/primitives/separator';++import {+ EditorGenericReadOnlyField,+ EditorGenericRequiredField,+} from './editor-field-generic-field-forms';++const ZDropdownFieldFormSchema = z+ .object({+ defaultValue: z.string().optional(),+ values: z+ .object({+ value: z.string().min(1, {+ message: msg`Option value cannot be empty`.id,+ }),+ })+ .array()+ .min(1, {+ message: msg`Dropdown must have at least one option`.id,+ })+ .refine(+ (data) => {+ // Todo: Envelopes - This doesn't work.+ console.log({+ data,+ });++ if (data) {+ const values = data.map((item) => item.value);+ return new Set(values).size === values.length;+ }+ return true;+ },+ {+ message: 'Duplicate values are not allowed',+ },+ ),+ required: z.boolean().optional(),+ readOnly: z.boolean().optional(),+ })+ .refine(+ (data) => {+ // Default value must be one of the available options+ if (data.defaultValue && data.values) {+ return data.values.some((item) => item.value === data.defaultValue);+ }+ return true;+ },+ {+ message: 'Default value must be one of the available options',+ path: ['defaultValue'],+ },+ );++type TDropdownFieldFormSchema = z.infer<typeof ZDropdownFieldFormSchema>;++type EditorFieldDropdownFormProps = {+ value: DropdownFieldMeta | undefined;+ onValueChange: (value: DropdownFieldMeta) => void;+};++export const EditorFieldDropdownForm = ({+ value = {+ type: 'dropdown',+ },+ onValueChange,+}: EditorFieldDropdownFormProps) => {+ const { t } = useLingui();++ const form = useForm<TDropdownFieldFormSchema>({+ resolver: zodResolver(ZDropdownFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ defaultValue: value.defaultValue,+ values: value.values || [{ value: 'Option 1' }],+ required: value.required || false,+ readOnly: value.readOnly || false,+ },+ });++ const formValues = useWatch({+ control: form.control,+ });++ const addValue = () => {+ const currentValues = form.getValues('values') || [];+ const newValues = [...currentValues, { value: 'New option' }];++ form.setValue('values', newValues);+ };++ const removeValue = (index: number) => {+ const currentValues = form.getValues('values') || [];++ if (currentValues.length === 1) {+ return;+ }++ const newValues = [...currentValues];+ newValues.splice(index, 1);++ form.setValue('values', newValues);+ };++ useEffect(() => {+ const validatedFormValues = ZDropdownFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'dropdown',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ const { formState } = form;++ useEffect(() => {+ console.log({+ errors: formState.errors,+ formValues,+ });+ }, [formState, formState.errors, formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <FormField+ control={form.control}+ name="defaultValue"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Select default option</Trans>+ </FormLabel>+ <FormControl>+ <Select+ // Todo: Envelopes - This is buggy, removing/adding should update the default value.+ {...field}+ value={field.value}+ onValueChange={(val) => field.onChange(val)}+ >+ <SelectTrigger className="text-muted-foreground bg-background w-full">+ <SelectValue placeholder={t`Default Value`} />+ </SelectTrigger>+ <SelectContent position="popper">+ {(formValues.values || []).map((item, index) => (+ <SelectItem key={index} value={item.value || ''}>+ {item.value}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <div className="mt-1">+ <EditorGenericRequiredField formControl={form.control} />+ </div>++ <EditorGenericReadOnlyField formControl={form.control} />++ <section className="space-y-2">+ <div className="-mx-4 mb-4 mt-2">+ <Separator />+ </div>++ <div className="flex flex-row items-center justify-between gap-2">+ <p className="text-sm font-medium">+ <Trans>Dropdown values</Trans>+ </p>++ <button type="button" onClick={addValue}>+ <PlusIcon className="h-4 w-4" />+ </button>+ </div>++ <ul className="space-y-2">+ {(formValues.values || []).map((value, index) => (+ <li key={`dropdown-value-${index}`} className="flex flex-row gap-2">+ <FormField+ control={form.control}+ name={`values.${index}.value`}+ render={({ field }) => (+ <FormItem className="w-full">+ <FormControl>+ <Input {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <button+ type="button"+ className="flex h-10 w-10 items-center justify-center text-slate-500 hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50"+ onClick={() => removeValue(index)}+ >+ <Trash className="h-5 w-5" />+ </button>+ </li>+ ))}+ </ul>+ </section>+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-email-form.tsx b/apps/remix/app/components/forms/editor/editor-field-email-form.tsxnew file mode 100644index 000000000..5da10652d--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-email-form.tsx@@ -0,0 +1,75 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { useForm, useWatch } from 'react-hook-form';+import type { z } from 'zod';++import {+ DEFAULT_FIELD_FONT_SIZE,+ type TEmailFieldMeta as EmailFieldMeta,+ ZEmailFieldMeta,+} from '@documenso/lib/types/field-meta';+import { Form } from '@documenso/ui/primitives/form/form';++import {+ EditorGenericFontSizeField,+ EditorGenericTextAlignField,+} from './editor-field-generic-field-forms';++const ZEmailFieldFormSchema = ZEmailFieldMeta.pick({+ fontSize: true,+ textAlign: true,+});++type TEmailFieldFormSchema = z.infer<typeof ZEmailFieldFormSchema>;++type EditorFieldEmailFormProps = {+ value: EmailFieldMeta | undefined;+ onValueChange: (value: EmailFieldMeta) => void;+};++export const EditorFieldEmailForm = ({+ value = {+ type: 'email',+ },+ onValueChange,+}: EditorFieldEmailFormProps) => {+ const form = useForm<TEmailFieldFormSchema>({+ resolver: zodResolver(ZEmailFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ fontSize: value.fontSize || DEFAULT_FIELD_FONT_SIZE,+ textAlign: value.textAlign || 'left',+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ const validatedFormValues = ZEmailFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'email',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <EditorGenericFontSizeField formControl={form.control} />++ <EditorGenericTextAlignField formControl={form.control} />+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx b/apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsxnew file mode 100644index 000000000..9e8fd0b7c--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx@@ -0,0 +1,222 @@+import { useEffect } from 'react';++import { Trans, useLingui } from '@lingui/react/macro';+import { type Control, useFormContext } from 'react-hook-form';++import { cn } from '@documenso/ui/lib/utils';+import { Checkbox } from '@documenso/ui/primitives/checkbox';+import {+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';++// Can't seem to get the non-any type to work with correct types.+// Eg Control<{ fontSize?: number } doesn't seem to work when there are required items.+// eslint-disable-next-line @typescript-eslint/no-explicit-any+type FormControlType = Control<any>;++export const EditorGenericFontSizeField = ({+ formControl,+ className,+}: {+ formControl: FormControlType;+ className?: string;+}) => {+ const { t } = useLingui();++ return (+ <FormField+ control={formControl}+ name="fontSize"+ render={({ field }) => (+ <FormItem className={className}>+ <FormLabel>+ <Trans>Font Size</Trans>+ </FormLabel>+ <FormControl>+ <Input+ type="number"+ min={8}+ max={96}+ className="bg-background"+ placeholder={t`Field font size`}+ {...field}+ onChange={(e) => {+ field.onChange(Number(e.target.value));+ }}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ );+};++export const EditorGenericTextAlignField = ({+ formControl,+ className,+}: {+ formControl: FormControlType;+ className?: string;+}) => {+ const { t } = useLingui();++ return (+ <FormField+ control={formControl}+ name="textAlign"+ render={({ field }) => (+ <FormItem className={className}>+ <FormLabel>+ <Trans>Text Align</Trans>+ </FormLabel>+ <FormControl>+ <Select {...field} onValueChange={field.onChange}>+ <SelectTrigger>+ <SelectValue placeholder={t`Select text align`} />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="left">+ <Trans>Left</Trans>+ </SelectItem>+ <SelectItem value="center">+ <Trans>Center</Trans>+ </SelectItem>+ <SelectItem value="right">+ <Trans>Right</Trans>+ </SelectItem>+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ );+};++export const EditorGenericRequiredField = ({+ formControl,+ className,+}: {+ formControl: FormControlType;+ className?: string;+}) => {+ const { watch, setValue } = useFormContext();++ const readOnly = watch('readOnly');++ useEffect(() => {+ if (readOnly) {+ setValue('required', false);+ }+ }, [readOnly]);++ return (+ <FormField+ control={formControl}+ name="required"+ render={({ field }) => (+ <FormItem className={cn('flex items-center space-x-2', className)}>+ <FormControl>+ <div className="flex items-center">+ <Checkbox+ id="field-required"+ checked={field.value}+ onCheckedChange={field.onChange}+ />++ <label className="text-muted-foreground ml-2 text-sm" htmlFor="field-required">+ <Trans>Required Field</Trans>+ </label>+ </div>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ );+};++export const EditorGenericReadOnlyField = ({+ formControl,+ className,+}: {+ formControl: FormControlType;+ className?: string;+}) => {+ const { watch, setValue } = useFormContext();++ const required = watch('required');++ useEffect(() => {+ if (required) {+ setValue('readOnly', false);+ }+ }, [required]);++ return (+ <FormField+ control={formControl}+ name="readOnly"+ render={({ field }) => (+ <FormItem className={cn('flex items-center space-x-2', className)}>+ <FormControl>+ <div className="flex items-center">+ <Checkbox+ id="field-read-only"+ checked={field.value}+ onCheckedChange={field.onChange}+ />++ <label className="text-muted-foreground ml-2 text-sm" htmlFor="field-read-only">+ <Trans>Read Only</Trans>+ </label>+ </div>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ );+};++export const EditorGenericLabelField = ({+ formControl,+ className,+}: {+ formControl: FormControlType;+ className?: string;+}) => {+ const { t } = useLingui();++ return (+ <FormField+ control={formControl}+ name="label"+ render={({ field }) => (+ <FormItem className={className}>+ <FormLabel>+ <Trans>Label</Trans>+ </FormLabel>+ <FormControl>+ <Input placeholder={t`Field label`} {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-initials-form.tsx b/apps/remix/app/components/forms/editor/editor-field-initials-form.tsxnew file mode 100644index 000000000..2f54c9cd4--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-initials-form.tsx@@ -0,0 +1,75 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { useForm, useWatch } from 'react-hook-form';+import type { z } from 'zod';++import {+ DEFAULT_FIELD_FONT_SIZE,+ type TInitialsFieldMeta as InitialsFieldMeta,+ ZInitialsFieldMeta,+} from '@documenso/lib/types/field-meta';+import { Form } from '@documenso/ui/primitives/form/form';++import {+ EditorGenericFontSizeField,+ EditorGenericTextAlignField,+} from './editor-field-generic-field-forms';++const ZInitialsFieldFormSchema = ZInitialsFieldMeta.pick({+ fontSize: true,+ textAlign: true,+});++type TInitialsFieldFormSchema = z.infer<typeof ZInitialsFieldFormSchema>;++type EditorFieldInitialsFormProps = {+ value: InitialsFieldMeta | undefined;+ onValueChange: (value: InitialsFieldMeta) => void;+};++export const EditorFieldInitialsForm = ({+ value = {+ type: 'initials',+ },+ onValueChange,+}: EditorFieldInitialsFormProps) => {+ const form = useForm<TInitialsFieldFormSchema>({+ resolver: zodResolver(ZInitialsFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ fontSize: value.fontSize || DEFAULT_FIELD_FONT_SIZE,+ textAlign: value.textAlign || 'left',+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ const validatedFormValues = ZInitialsFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'initials',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <EditorGenericFontSizeField formControl={form.control} />++ <EditorGenericTextAlignField formControl={form.control} />+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-name-form.tsx b/apps/remix/app/components/forms/editor/editor-field-name-form.tsxnew file mode 100644index 000000000..4c57ed917--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-name-form.tsx@@ -0,0 +1,75 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { useForm, useWatch } from 'react-hook-form';+import type { z } from 'zod';++import {+ DEFAULT_FIELD_FONT_SIZE,+ type TNameFieldMeta as NameFieldMeta,+ ZNameFieldMeta,+} from '@documenso/lib/types/field-meta';+import { Form } from '@documenso/ui/primitives/form/form';++import {+ EditorGenericFontSizeField,+ EditorGenericTextAlignField,+} from './editor-field-generic-field-forms';++const ZNameFieldFormSchema = ZNameFieldMeta.pick({+ fontSize: true,+ textAlign: true,+});++type TNameFieldFormSchema = z.infer<typeof ZNameFieldFormSchema>;++type EditorFieldNameFormProps = {+ value: NameFieldMeta | undefined;+ onValueChange: (value: NameFieldMeta) => void;+};++export const EditorFieldNameForm = ({+ value = {+ type: 'name',+ },+ onValueChange,+}: EditorFieldNameFormProps) => {+ const form = useForm<TNameFieldFormSchema>({+ resolver: zodResolver(ZNameFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ fontSize: value.fontSize || DEFAULT_FIELD_FONT_SIZE,+ textAlign: value.textAlign || 'left',+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ const validatedFormValues = ZNameFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'name',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <EditorGenericFontSizeField formControl={form.control} />++ <EditorGenericTextAlignField formControl={form.control} />+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-number-form.tsx b/apps/remix/app/components/forms/editor/editor-field-number-form.tsxnew file mode 100644index 000000000..e957bdf60--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-number-form.tsx@@ -0,0 +1,277 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { Trans, useLingui } from '@lingui/react/macro';+import { useForm, useWatch } from 'react-hook-form';+import type { z } from 'zod';++import {+ type TNumberFieldMeta as NumberFieldMeta,+ ZNumberFieldMeta,+} from '@documenso/lib/types/field-meta';+import { numberFormatValues } from '@documenso/ui/primitives/document-flow/field-items-advanced-settings/constants';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';+import { Separator } from '@documenso/ui/primitives/separator';++import {+ EditorGenericFontSizeField,+ EditorGenericLabelField,+ EditorGenericReadOnlyField,+ EditorGenericRequiredField,+ EditorGenericTextAlignField,+} from './editor-field-generic-field-forms';++const ZNumberFieldFormSchema = ZNumberFieldMeta.pick({+ label: true,+ placeholder: true,+ value: true,+ numberFormat: true,+ fontSize: true,+ textAlign: true,+ required: true,+ readOnly: true,+ minValue: true,+ maxValue: true,+})+ .refine(+ (data) => {+ // Minimum value cannot be greater than maximum value+ if (typeof data.minValue === 'number' && typeof data.maxValue === 'number') {+ return data.minValue <= data.maxValue;+ }+ return true;+ },+ {+ message: 'Minimum value cannot be greater than maximum value',+ path: ['minValue'],+ },+ )+ .refine(+ (data) => {+ // A read-only field must have a value greater than 0+ if (data.readOnly && data.value !== undefined && data.value !== '') {+ const numberValue = parseFloat(data.value);+ return !isNaN(numberValue) && numberValue > 0;+ }+ return !data.readOnly || (data.value !== undefined && data.value !== '');+ },+ {+ message: 'A read-only field must have a value greater than 0',+ path: ['value'],+ },+ );++type TNumberFieldFormSchema = z.infer<typeof ZNumberFieldFormSchema>;++type EditorFieldNumberFormProps = {+ value: NumberFieldMeta | undefined;+ onValueChange: (value: NumberFieldMeta) => void;+};++export const EditorFieldNumberForm = ({+ value = {+ type: 'number',+ },+ onValueChange,+}: EditorFieldNumberFormProps) => {+ const { t } = useLingui();++ const form = useForm<TNumberFieldFormSchema>({+ resolver: zodResolver(ZNumberFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ label: value.label || '',+ placeholder: value.placeholder || '',+ value: value.value || '',+ numberFormat: value.numberFormat || null,+ fontSize: value.fontSize || 14,+ textAlign: value.textAlign || 'left',+ required: value.required || false,+ readOnly: value.readOnly || false,+ minValue: value.minValue,+ maxValue: value.maxValue,+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ const validatedFormValues = ZNumberFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'number',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <EditorGenericLabelField formControl={form.control} />++ <FormField+ control={form.control}+ name="placeholder"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Placeholder</Trans>+ </FormLabel>+ <FormControl>+ <Input className="bg-background" placeholder={t`Placeholder`} {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="value"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Value</Trans>+ </FormLabel>+ <FormControl>+ <Input className="bg-background" placeholder={t`Value`} {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="numberFormat"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Number format</Trans>+ </FormLabel>+ <FormControl>+ <Select+ value={field.value === null ? '-1' : field.value}+ onValueChange={(value) => field.onChange(value === '-1' ? null : value)}+ >+ <SelectTrigger className="text-muted-foreground bg-background w-full">+ <SelectValue placeholder={t`Field format`} />+ </SelectTrigger>+ <SelectContent position="popper">+ {numberFormatValues.map((item, index) => (+ <SelectItem key={index} value={item.value}>+ {item.label}+ </SelectItem>+ ))}++ <SelectItem value={'-1'}>+ <Trans>None</Trans>+ </SelectItem>+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <div className="flex w-full flex-row gap-x-4">+ <EditorGenericFontSizeField className="w-full" formControl={form.control} />++ <EditorGenericTextAlignField className="w-full" formControl={form.control} />+ </div>++ <div className="mt-1">+ <EditorGenericRequiredField formControl={form.control} />+ </div>++ <EditorGenericReadOnlyField formControl={form.control} />++ {/* Validation section */}+ <section className="space-y-2">+ <div className="-mx-4 mb-4 mt-2">+ <Separator />+ </div>++ <p className="text-sm font-medium">+ <Trans>Validation</Trans>+ </p>++ <div className="flex flex-row gap-x-4">+ <FormField+ control={form.control}+ name="minValue"+ render={({ field }) => (+ <FormItem className="flex-1">+ <FormLabel>+ <Trans>Min</Trans>+ </FormLabel>+ <FormControl>+ <Input+ className="bg-background"+ placeholder="E.g. 0"+ {...field}+ value={field.value ?? ''}+ onChange={(e) =>+ field.onChange(e.target.value === '' ? null : e.target.value)+ }+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="maxValue"+ render={({ field }) => (+ <FormItem className="flex-1">+ <FormLabel>+ <Trans>Max</Trans>+ </FormLabel>+ <FormControl>+ <Input+ className="bg-background"+ placeholder="E.g. 100"+ {...field}+ value={field.value ?? ''}+ onChange={(e) =>+ field.onChange(e.target.value === '' ? null : e.target.value)+ }+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ </div>+ </section>+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-radio-form.tsx b/apps/remix/app/components/forms/editor/editor-field-radio-form.tsxnew file mode 100644index 000000000..8669b3e52--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-radio-form.tsx@@ -0,0 +1,190 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { Trans } from '@lingui/react/macro';+import { PlusIcon, Trash } from 'lucide-react';+import { useForm, useWatch } from 'react-hook-form';+import { z } from 'zod';++import { type TRadioFieldMeta as RadioFieldMeta } from '@documenso/lib/types/field-meta';+import { Checkbox } from '@documenso/ui/primitives/checkbox';+import { Form, FormControl, FormField, FormItem } from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import { Separator } from '@documenso/ui/primitives/separator';++import {+ EditorGenericReadOnlyField,+ EditorGenericRequiredField,+} from './editor-field-generic-field-forms';++const ZRadioFieldFormSchema = z+ .object({+ label: z.string().optional(),+ values: z+ .object({ id: z.number(), checked: z.boolean(), value: z.string() })+ .array()+ .min(1)+ .optional(),+ required: z.boolean().optional(),+ readOnly: z.boolean().optional(),+ })+ .refine(+ (data) => {+ // There cannot be more than one checked option+ if (data.values) {+ const checkedValues = data.values.filter((option) => option.checked);+ return checkedValues.length <= 1;+ }+ return true;+ },+ {+ message: 'There cannot be more than one checked option',+ path: ['values'],+ },+ );++type TRadioFieldFormSchema = z.infer<typeof ZRadioFieldFormSchema>;++export type EditorFieldRadioFormProps = {+ value: RadioFieldMeta | undefined;+ onValueChange: (value: RadioFieldMeta) => void;+};++export const EditorFieldRadioForm = ({+ value = {+ type: 'radio',+ },+ onValueChange,+}: EditorFieldRadioFormProps) => {+ const form = useForm<TRadioFieldFormSchema>({+ resolver: zodResolver(ZRadioFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ label: value.label || '',+ values: value.values || [{ id: 1, checked: false, value: 'Default value' }],+ required: value.required || false,+ readOnly: value.readOnly || false,+ },+ });++ const formValues = useWatch({+ control: form.control,+ });++ const addValue = () => {+ const currentValues = form.getValues('values') || [];+ const newId =+ currentValues.length > 0 ? Math.max(...currentValues.map((val) => val.id)) + 1 : 1;++ const newValues = [...currentValues, { id: newId, checked: false, value: '' }];+ form.setValue('values', newValues);+ };++ const removeValue = (index: number) => {+ const currentValues = form.getValues('values') || [];++ if (currentValues.length === 1) {+ return;+ }++ const newValues = [...currentValues];+ newValues.splice(index, 1);++ form.setValue('values', newValues);+ };++ useEffect(() => {+ const validatedFormValues = ZRadioFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'radio',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2 pb-2">+ <EditorGenericRequiredField formControl={form.control} />++ <EditorGenericReadOnlyField formControl={form.control} />++ <section className="space-y-2">+ <div className="-mx-4 mb-4 mt-2">+ <Separator />+ </div>++ <div className="flex flex-row items-center justify-between gap-2">+ <p className="text-sm font-medium">+ <Trans>Radio values</Trans>+ </p>++ <button type="button" onClick={addValue}>+ <PlusIcon className="h-4 w-4" />+ </button>+ </div>++ <ul className="space-y-2">+ {(formValues.values || []).map((value, index) => (+ <li key={`radio-value-${index}`} className="flex flex-row items-center gap-2">+ <FormField+ control={form.control}+ name={`values.${index}.checked`}+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Checkbox+ className="data-[state=checked]:bg-primary border-foreground/30 h-5 w-5"+ checked={field.value}+ onCheckedChange={(value) => {+ // Uncheck all other values.+ const currentValues = form.getValues('values') || [];++ if (value) {+ const newValues = currentValues.map((val) => ({+ ...val,+ checked: false,+ }));++ form.setValue('values', newValues);+ }++ field.onChange(value);+ }}+ />+ </FormControl>+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name={`values.${index}.value`}+ render={({ field }) => (+ <FormItem>+ <FormControl>+ <Input className="w-full" {...field} />+ </FormControl>+ </FormItem>+ )}+ />++ <button+ type="button"+ className="flex h-10 w-10 items-center justify-center text-slate-500 hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50"+ onClick={() => removeValue(index)}+ >+ <Trash className="h-5 w-5" />+ </button>+ </li>+ ))}+ </ul>+ </section>+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/forms/editor/editor-field-text-form.tsx b/apps/remix/app/components/forms/editor/editor-field-text-form.tsxnew file mode 100644index 000000000..5fd59413e--- /dev/null+++ b/apps/remix/app/components/forms/editor/editor-field-text-form.tsx@@ -0,0 +1,191 @@+import { useEffect } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { Trans, useLingui } from '@lingui/react/macro';+import { useForm, useWatch } from 'react-hook-form';+import { z } from 'zod';++import { type TTextFieldMeta as TextFieldMeta } from '@documenso/lib/types/field-meta';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import { Textarea } from '@documenso/ui/primitives/textarea';++import {+ EditorGenericFontSizeField,+ EditorGenericReadOnlyField,+ EditorGenericRequiredField,+ EditorGenericTextAlignField,+} from './editor-field-generic-field-forms';++const ZTextFieldFormSchema = z+ .object({+ label: z.string().optional(),+ placeholder: z.string().optional(),+ text: z.string().optional(),+ characterLimit: z.coerce.number().min(0).optional(),+ fontSize: z.coerce.number().min(8).max(96).optional(),+ textAlign: z.enum(['left', 'center', 'right']).optional(),+ required: z.boolean().optional(),+ readOnly: z.boolean().optional(),+ })+ .refine(+ (data) => {+ // A read-only field must have text+ return !data.readOnly || (data.text && data.text.length > 0);+ },+ {+ message: 'A read-only field must have text',+ path: ['text'],+ },+ );++type TTextFieldFormSchema = z.infer<typeof ZTextFieldFormSchema>;++type EditorFieldTextFormProps = {+ value: TextFieldMeta | undefined;+ onValueChange: (value: TextFieldMeta) => void;+};++export const EditorFieldTextForm = ({+ value = {+ type: 'text',+ },+ onValueChange,+}: EditorFieldTextFormProps) => {+ const { t } = useLingui();++ const form = useForm<TTextFieldFormSchema>({+ resolver: zodResolver(ZTextFieldFormSchema),+ mode: 'onChange',+ defaultValues: {+ label: value.label || '',+ placeholder: value.placeholder || '',+ text: value.text || '',+ characterLimit: value.characterLimit || 0,+ fontSize: value.fontSize || 14,+ textAlign: value.textAlign || 'left',+ required: value.required || false,+ readOnly: value.readOnly || false,+ },+ });++ const { control } = form;++ const formValues = useWatch({+ control,+ });++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ const validatedFormValues = ZTextFieldFormSchema.safeParse(formValues);++ if (validatedFormValues.success) {+ onValueChange({+ type: 'text',+ ...validatedFormValues.data,+ });+ }+ }, [formValues]);++ return (+ <Form {...form}>+ <form>+ <fieldset className="flex flex-col gap-2">+ <FormField+ control={form.control}+ name="label"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Label</Trans>+ </FormLabel>+ <FormControl>+ <Input placeholder={t`Field label`} {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="placeholder"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Placeholder</Trans>+ </FormLabel>+ <FormControl>+ <Input placeholder={t`Field placeholder`} {...field} />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="text"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Add text</Trans>+ </FormLabel>+ <FormControl>+ <Textarea+ className="h-auto"+ placeholder={t`Add text to the field`}+ {...field}+ rows={1}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="characterLimit"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Character Limit</Trans>+ </FormLabel>+ <FormControl>+ <Input+ type="number"+ min={0}+ className="bg-background"+ placeholder={t`Field character limit`}+ {...field}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />++ <div className="flex w-full flex-row gap-x-4">+ <EditorGenericFontSizeField className="w-full" formControl={form.control} />++ <EditorGenericTextAlignField className="w-full" formControl={form.control} />+ </div>++ <div className="mt-1">+ <EditorGenericRequiredField formControl={form.control} />+ </div>++ <EditorGenericReadOnlyField formControl={form.control} />+ </fieldset>+ </form>+ </Form>+ );+};diff --git a/apps/remix/app/components/general/app-header.tsx b/apps/remix/app/components/general/app-header.tsxindex dce88ac53..1553c6df1 100644--- a/apps/remix/app/components/general/app-header.tsx+++ b/apps/remix/app/components/general/app-header.tsx@@ -60,7 +60,7 @@ export const Header = ({ className, ...props }: HeaderProps) => {><div className="mx-auto flex w-full max-w-screen-xl items-center justify-between gap-x-4 px-4 md:justify-normal md:px-8"><Link- to={`${getRootHref(params, { returnEmptyRootString: true })}`}+ to={getRootHref(params)}className="focus-visible:ring-ring ring-offset-background hidden rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 md:inline"><BrandingLogo className="h-6 w-auto" />diff --git a/apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx b/apps/remix/app/components/general/direct-template/direct-template-signing-form.tsxindex fedea33c0..3ab3046ae 100644--- a/apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx+++ b/apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -55,7 +55,7 @@ import { DocumentSigningRecipientProvider } from '../document-signing/document-sexport type DirectTemplateSigningFormProps = {flowStep: DocumentFlowStep;- directRecipient: Recipient;+ directRecipient: Pick<Recipient, 'authOptions' | 'email' | 'role' | 'name' | 'token'>;directRecipientFields: Field[];template: Omit<TTemplate, 'user'>;onSubmit: (_data: DirectTemplateLocalField[]) => Promise<void>;diff --git a/apps/remix/app/components/general/document-signing/document-signing-auth-provider.tsx b/apps/remix/app/components/general/document-signing/document-signing-auth-provider.tsxindex c3b1be53e..bd962b01d 100644--- a/apps/remix/app/components/general/document-signing/document-signing-auth-provider.tsx+++ b/apps/remix/app/components/general/document-signing/document-signing-auth-provider.tsx@@ -1,6 +1,6 @@import { createContext, useContext, useEffect, useMemo, useState } from 'react';-import { type Document, FieldType, type Passkey, type Recipient } from '@prisma/client';+import { type Envelope, FieldType, type Passkey, type Recipient } from '@prisma/client';import type { SessionUser } from '@documenso/auth/server/lib/session/session';import { MAXIMUM_PASSKEYS } from '@documenso/lib/constants/auth';@@ -24,14 +24,16 @@ type PasskeyData = {isError: boolean;};+type SigningAuthRecipient = Pick<Recipient, 'authOptions' | 'email' | 'role' | 'name' | 'token'>;+export type DocumentSigningAuthContextValue = {executeActionAuthProcedure: (_value: ExecuteActionAuthProcedureOptions) => Promise<void>;- documentAuthOptions: Document['authOptions'];+ documentAuthOptions: Envelope['authOptions'];documentAuthOption: TDocumentAuthOptions;- setDocumentAuthOptions: (_value: Document['authOptions']) => void;- recipient: Recipient;+ setDocumentAuthOptions: (_value: Envelope['authOptions']) => void;+ recipient: SigningAuthRecipient;recipientAuthOption: TRecipientAuthOptions;- setRecipient: (_value: Recipient) => void;+ setRecipient: (_value: SigningAuthRecipient) => void;derivedRecipientAccessAuth: TRecipientAccessAuthTypes[];derivedRecipientActionAuth: TRecipientActionAuthTypes[];isAuthRedirectRequired: boolean;@@ -61,8 +63,8 @@ export const useRequiredDocumentSigningAuthContext = () => {};export interface DocumentSigningAuthProviderProps {- documentAuthOptions: Document['authOptions'];- recipient: Recipient;+ documentAuthOptions: Envelope['authOptions'];+ recipient: SigningAuthRecipient;user?: SessionUser | null;children: React.ReactNode;}diff --git a/apps/remix/app/components/general/document-signing/document-signing-page-view.tsx b/apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxsimilarity index 98%rename from apps/remix/app/components/general/document-signing/document-signing-page-view.tsxrename to apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxindex 6c06cdf44..02755ea44 100644--- a/apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+++ b/apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx@@ -50,7 +50,7 @@ import { useRequiredDocumentSigningAuthContext } from './document-signing-auth-pimport { DocumentSigningCompleteDialog } from './document-signing-complete-dialog';import { DocumentSigningRecipientProvider } from './document-signing-recipient-provider';-export type DocumentSigningPageViewProps = {+export type DocumentSigningPageViewV1Props = {recipient: RecipientWithFields;document: DocumentAndSender;fields: Field[];@@ -60,7 +60,7 @@ export type DocumentSigningPageViewProps = {includeSenderDetails: boolean;};-export const DocumentSigningPageView = ({+export const DocumentSigningPageViewV1 = ({recipient,document,fields,@@ -68,7 +68,7 @@ export const DocumentSigningPageView = ({isRecipientsTurn,allRecipients = [],includeSenderDetails,-}: DocumentSigningPageViewProps) => {+}: DocumentSigningPageViewV1Props) => {const { documentData, documentMeta } = document;const { derivedRecipientAccessAuth, user: authUser } = useRequiredDocumentSigningAuthContext();@@ -231,7 +231,7 @@ export const DocumentSigningPageView = ({</span></div>- <DocumentSigningRejectDialog document={document} token={recipient.token} />+ <DocumentSigningRejectDialog documentId={document.id} token={recipient.token} /></div><div className="relative mt-4 flex w-full flex-col gap-x-6 gap-y-8 sm:mt-8 md:flex-row lg:gap-x-8 lg:gap-y-0">diff --git a/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx b/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxnew file mode 100644index 000000000..6d334994b--- /dev/null+++ b/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx@@ -0,0 +1,174 @@+import { lazy } from 'react';++import { Plural, Trans } from '@lingui/react/macro';+import { motion } from 'framer-motion';+import { ArrowLeftIcon, BanIcon, DownloadCloudIcon } from 'lucide-react';+import { Link } from 'react-router';++import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { FieldToolTip } from '@documenso/ui/components/field/field-tooltip';+import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy';+import { Button } from '@documenso/ui/primitives/button';+import { Separator } from '@documenso/ui/primitives/separator';++import { SignFieldDropdownDialog } from '~/components/dialogs/sign-field-dropdown-dialog';+import { SignFieldEmailDialog } from '~/components/dialogs/sign-field-email-dialog';+import { SignFieldInitialsDialog } from '~/components/dialogs/sign-field-initials-dialog';+import { SignFieldNameDialog } from '~/components/dialogs/sign-field-name-dialog';+import { SignFieldNumberDialog } from '~/components/dialogs/sign-field-number-dialog';+import { SignFieldSignatureDialog } from '~/components/dialogs/sign-field-signature-dialog';+import { SignFieldTextDialog } from '~/components/dialogs/sign-field-text-dialog';++import { EnvelopeItemSelector } from '../envelope-editor/envelope-file-selector';+import EnvelopeSignerForm from '../envelope-signing/envelope-signer-form';+import { EnvelopeSignerHeader } from '../envelope-signing/envelope-signer-header';+import { useRequiredEnvelopeSigningContext } from './envelope-signing-provider';++const EnvelopeSignerPageRenderer = lazy(+ async () => import('../envelope-signing/envelope-signer-page-renderer'),+);++export const DocumentSigningPageViewV2 = () => {+ const { envelopeItems, currentEnvelopeItem, setCurrentEnvelopeItem } = useCurrentEnvelopeRender();++ const { envelope, recipientFields, recipientFieldsRemaining, showPendingFieldTooltip } =+ useRequiredEnvelopeSigningContext();++ return (+ <div className="h-screen w-screen bg-gray-50">+ <SignFieldEmailDialog.Root />+ <SignFieldTextDialog.Root />+ <SignFieldNumberDialog.Root />+ <SignFieldNameDialog.Root />+ <SignFieldInitialsDialog.Root />+ <SignFieldDropdownDialog.Root />+ <SignFieldSignatureDialog.Root />++ <EnvelopeSignerHeader />++ {/* Main Content Area */}+ <div className="flex h-[calc(100vh-73px)] w-screen">+ {/* Left Section - Step Navigation */}+ <div className="hidden w-80 flex-shrink-0 flex-col overflow-y-auto border-r border-gray-200 bg-white py-4 lg:flex">+ <div className="px-4">+ <h3 className="flex items-end justify-between text-sm font-semibold text-gray-900">+ <Trans>Sign Document</Trans>++ <span className="text-muted-foreground ml-2 rounded border bg-gray-50 px-2 py-0.5 text-xs">+ <Trans>{recipientFieldsRemaining.length} fields remaining</Trans>+ </span>+ </h3>++ <div className="bg-muted relative my-4 h-[4px] rounded-md">+ <motion.div+ layout="size"+ layoutId="document-flow-container-step"+ className="bg-documenso absolute inset-y-0 left-0"+ style={{+ width: `${(100 / recipientFields.length) * (recipientFieldsRemaining.length ?? 0)}%`,+ }}+ />+ </div>++ <div className="mt-6 space-y-3">+ <EnvelopeSignerForm />+ </div>+ </div>++ <Separator className="my-6" />++ {/* Quick Actions. */}+ <div className="space-y-3 px-4">+ <h4 className="text-sm font-semibold text-gray-900">+ <Trans>Actions</Trans>+ </h4>++ {/* Todo: Allow selecting which document to download and/or the original */}+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <DownloadCloudIcon className="mr-2 h-4 w-4" />+ <Trans>Download Original</Trans>+ </Button>++ {/* Todo: Envelopes */}+ <Button+ variant="ghost"+ size="sm"+ className="hover:text-destructive w-full justify-start"+ >+ <BanIcon className="mr-2 h-4 w-4" />+ <Trans>Reject Document</Trans>+ </Button>+ </div>++ {/* Footer of left sidebar. */}+ <div className="mt-auto px-4">+ <Button asChild variant="ghost" className="w-full justify-start">+ <Link to="/">+ <ArrowLeftIcon className="mr-2 h-4 w-4" />+ <Trans>Return</Trans>+ </Link>+ </Button>+ </div>+ </div>++ {/* Main Content - Changes based on current step */}+ <div className="flex-1 overflow-y-auto">+ <div className="flex flex-col">+ {/* Horizontal envelope item selector */}+ <div className="flex h-fit space-x-2 overflow-x-auto p-4">+ {envelopeItems.map((doc, i) => (+ <EnvelopeItemSelector+ key={doc.id}+ number={i + 1}+ primaryText={doc.title}+ secondaryText={+ <Plural+ one="1 Field"+ other="# Fields"+ value={+ recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id)+ .length+ }+ />+ }+ isSelected={currentEnvelopeItem?.id === doc.id}+ buttonProps={{ onClick: () => setCurrentEnvelopeItem(doc.id) }}+ />+ ))}+ </div>++ {/* Document View */}+ <div className="mt-4 flex justify-center p-4">+ {currentEnvelopeItem &&+ showPendingFieldTooltip &&+ recipientFieldsRemaining.length > 0 &&+ recipientFieldsRemaining[0]?.envelopeItemId === currentEnvelopeItem?.id && (+ <FieldToolTip+ key={recipientFieldsRemaining[0].id}+ field={recipientFieldsRemaining[0]}+ color="warning"+ >+ <Trans>Click to insert field</Trans>+ </FieldToolTip>+ )}++ {currentEnvelopeItem ? (+ <PDFViewerKonvaLazy+ key={currentEnvelopeItem.id}+ documentDataId={currentEnvelopeItem.documentDataId}+ customPageRenderer={EnvelopeSignerPageRenderer}+ />+ ) : (+ <div className="flex flex-col items-center justify-center py-32">+ <p className="text-foreground text-sm">+ <Trans>No documents found</Trans>+ </p>+ </div>+ )}+ </div>+ </div>+ </div>+ </div>+ </div>+ );+};diff --git a/apps/remix/app/components/general/document-signing/document-signing-recipient-provider.tsx b/apps/remix/app/components/general/document-signing/document-signing-recipient-provider.tsxindex 93a842637..56278c742 100644--- a/apps/remix/app/components/general/document-signing/document-signing-recipient-provider.tsx+++ b/apps/remix/app/components/general/document-signing/document-signing-recipient-provider.tsx@@ -10,7 +10,10 @@ export interface DocumentSigningRecipientContextValue {* In regular mode, this is the actual signer.* In assistant mode, this is the recipient who is helping fill out the document.*/- recipient: Recipient | RecipientWithFields;+ recipient: Pick<+ Recipient | RecipientWithFields,+ 'name' | 'email' | 'token' | 'role' | 'authOptions'+ >;/*** Only present in assistant mode.@@ -29,7 +32,10 @@ const DocumentSigningRecipientContext = createContext<DocumentSigningRecipientCo);export interface DocumentSigningRecipientProviderProps extends PropsWithChildren {- recipient: Recipient | RecipientWithFields;+ recipient: Pick<+ Recipient | RecipientWithFields,+ 'name' | 'email' | 'token' | 'role' | 'authOptions'+ >;targetSigner?: RecipientWithFields | null;}diff --git a/apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx b/apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsxindex baed7a7c5..429833772 100644--- a/apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx+++ b/apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -3,7 +3,6 @@ import { useEffect, useState } from 'react';import { zodResolver } from '@hookform/resolvers/zod';import { msg } from '@lingui/core/macro';import { Trans } from '@lingui/react/macro';-import type { Document } from '@prisma/client';import { useForm } from 'react-hook-form';import { useNavigate } from 'react-router';import { useSearchParams } from 'react-router';@@ -37,13 +36,13 @@ const ZRejectDocumentFormSchema = z.object({type TRejectDocumentFormSchema = z.infer<typeof ZRejectDocumentFormSchema>;export interface DocumentSigningRejectDialogProps {- document: Pick<Document, 'id'>;+ documentId: number;token: string;onRejected?: (reason: string) => void | Promise<void>;}export function DocumentSigningRejectDialog({- document,+ documentId,token,onRejected,}: DocumentSigningRejectDialogProps) {@@ -66,7 +65,7 @@ export function DocumentSigningRejectDialog({const onRejectDocument = async ({ reason }: TRejectDocumentFormSchema) => {try {await rejectDocumentWithToken({- documentId: document.id,+ documentId,token,reason,});diff --git a/apps/remix/app/components/general/document-signing/envelope-signing-provider.tsx b/apps/remix/app/components/general/document-signing/envelope-signing-provider.tsxnew file mode 100644index 000000000..032ebeedb--- /dev/null+++ b/apps/remix/app/components/general/document-signing/envelope-signing-provider.tsx@@ -0,0 +1,290 @@+import { createContext, useContext, useMemo, useState } from 'react';++import {+ type Field,+ FieldType,+ type Recipient,+ RecipientRole,+ SigningStatus,+} from '@prisma/client';++import { isBase64Image } from '@documenso/lib/constants/signatures';+import { DO_NOT_INVALIDATE_QUERY_ON_MUTATION } from '@documenso/lib/constants/trpc';+import type { EnvelopeForSigningResponse } from '@documenso/lib/server-only/envelope/get-envelope-for-recipient-signing';+import { isFieldUnsignedAndRequired } from '@documenso/lib/utils/advanced-fields-helpers';+import { trpc } from '@documenso/trpc/react';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++export type EnvelopeSigningContextValue = {+ fullName: string;+ setFullName: (_value: string) => void;+ email: string;+ setEmail: (_value: string) => void;+ signature: string | null;+ setSignature: (_value: string | null) => void;++ showPendingFieldTooltip: boolean;+ setShowPendingFieldTooltip: (_value: boolean) => void;++ envelopeData: EnvelopeForSigningResponse;+ envelope: EnvelopeForSigningResponse['envelope'];++ recipient: EnvelopeForSigningResponse['recipient'];+ recipientFieldsRemaining: Field[];+ recipientFields: Field[];+ selectedRecipientFields: Field[];+ nextRecipient: EnvelopeForSigningResponse['envelope']['recipients'][number] | null;+ otherRecipientCompletedFields: (Field & {+ recipient: Pick<Recipient, 'name' | 'email' | 'signingStatus' | 'role'>;+ })[];+ assistantRecipients: EnvelopeForSigningResponse['envelope']['recipients'];+ assistantFields: Field[];+ setSelectedAssistantRecipientId: (_value: number | null) => void;+ selectedAssistantRecipient: EnvelopeForSigningResponse['envelope']['recipients'][number] | null;++ signField: (_fieldId: number, _value: TSignEnvelopeFieldValue) => Promise<void>;+};++const EnvelopeSigningContext = createContext<EnvelopeSigningContextValue | null>(null);++export const useEnvelopeSigningContext = () => {+ return useContext(EnvelopeSigningContext);+};++export const useRequiredEnvelopeSigningContext = () => {+ const context = useEnvelopeSigningContext();++ if (!context) {+ throw new Error('Signing context is required');+ }++ return context;+};++export interface EnvelopeSigningProviderProps {+ fullName?: string | null;+ email?: string | null;+ signature?: string | null;+ envelopeData: EnvelopeForSigningResponse;+ children: React.ReactNode;+}++export const EnvelopeSigningProvider = ({+ fullName: initialFullName,+ email: initialEmail,+ signature: initialSignature,+ envelopeData: initialEnvelopeData,+ children,+}: EnvelopeSigningProviderProps) => {+ const [envelopeData, setEnvelopeData] = useState(initialEnvelopeData);++ const { envelope, recipient } = envelopeData;++ const [fullName, setFullName] = useState(initialFullName || '');+ const [email, setEmail] = useState(initialEmail || '');++ const [showPendingFieldTooltip, setShowPendingFieldTooltip] = useState(false);++ const {+ mutateAsync: completeDocument,+ isPending,+ isSuccess,+ } = trpc.recipient.completeDocumentWithToken.useMutation();++ const { mutateAsync: signEnvelopeField } = trpc.envelope.field.sign.useMutation({+ ...DO_NOT_INVALIDATE_QUERY_ON_MUTATION,+ onSuccess: (data) => {+ console.log('signEnvelopeField', data);++ const newRecipientFields = envelopeData.recipient.fields.map((field) =>+ field.id === data.signedField.id ? data.signedField : field,+ );++ setEnvelopeData((prev) => ({+ ...prev,+ recipient: {+ ...prev.recipient,+ fields: newRecipientFields,+ },+ }));+ },+ });++ // Ensure the user signature doesn't show up if it's not allowed.+ const [signature, setSignature] = useState(+ (() => {+ const sig = initialSignature || '';+ const isBase64 = isBase64Image(sig);++ if (+ !sig &&+ (envelope.documentMeta.uploadSignatureEnabled ||+ envelope.documentMeta.drawSignatureEnabled) &&+ envelopeData.recipientSignature?.signatureImageAsBase64+ ) {+ return envelopeData.recipientSignature.signatureImageAsBase64;+ }++ if (+ !sig &&+ envelope.documentMeta.typedSignatureEnabled &&+ envelopeData.recipientSignature?.typedSignature+ ) {+ return envelopeData.recipientSignature.typedSignature;+ }++ if (+ isBase64 &&+ (envelope.documentMeta.uploadSignatureEnabled || envelope.documentMeta.drawSignatureEnabled)+ ) {+ return sig;+ }++ if (!isBase64 && envelope.documentMeta.typedSignatureEnabled) {+ return sig;+ }++ return null;+ })(),+ );++ /**+ * Assistant recipients are those that have a signing order after the assistant.+ */+ const assistantRecipients =+ recipient.role === RecipientRole.ASSISTANT+ ? envelope.recipients.filter((r) => (r.signingOrder ?? 0) > (recipient.signingOrder ?? 0))+ : [];++ /**+ * Assistant fields are those fulfill all of the following:+ * - From recipients that have not signed+ * - After the assistant signing order+ * - Are not signature fields+ */+ const assistantFields =+ recipient.role === RecipientRole.ASSISTANT+ ? assistantRecipients+ .filter((r) => r.signingStatus !== SigningStatus.SIGNED)+ .map((r) => r.fields.filter((field) => field.type !== FieldType.SIGNATURE))+ .flat()+ : [];++ /**+ * The recipient that the assistant has currently selected to sign on behalf of.+ */+ const [selectedAssistantRecipientId, setSelectedAssistantRecipientId] = useState<number | null>(+ assistantRecipients[0]?.id || null,+ );++ const selectedAssistantRecipient = useMemo(() => {+ return envelope.recipients.find((r) => r.id === selectedAssistantRecipientId) || null;+ }, [envelope.recipients, selectedAssistantRecipientId]);++ /**+ * The fields that are still required to be signed by the current recipient.+ */+ const recipientFieldsRemaining = useMemo(() => {+ return envelopeData.recipient.fields.filter((field) => isFieldUnsignedAndRequired(field));+ }, [envelopeData.recipient.fields]);++ /**+ * All the fields for the current recipient.+ */+ const recipientFields = useMemo(() => {+ return envelopeData.recipient.fields;+ }, [envelopeData.recipient.fields]);++ const selectedRecipientFields = useMemo(() => {+ return recipientFields.filter((field) => field.recipientId === selectedAssistantRecipient?.id);+ }, [recipientFields, selectedAssistantRecipient]);++ /**+ * Fields that have been completed by other recipients.+ */+ const otherRecipientCompletedFields = envelope.recipients+ .filter(({ signingStatus }) => signingStatus === SigningStatus.SIGNED)+ .flatMap((recipient) =>+ recipient.fields.map((field) => ({+ ...field,+ recipient: {+ name: recipient.name,+ email: recipient.email,+ signingStatus: recipient.signingStatus,+ role: recipient.role,+ },+ })),+ )+ .filter((field) => field.inserted);++ const nextRecipient = useMemo(() => {+ if (+ !envelope.documentMeta.signingOrder ||+ envelope.documentMeta.signingOrder !== 'SEQUENTIAL'+ ) {+ return null;+ }++ const sortedRecipients = envelope.recipients.sort((a, b) => {+ // Sort by signingOrder first (nulls last), then by id+ if (a.signingOrder === null && b.signingOrder === null) return a.id - b.id;+ if (a.signingOrder === null) return 1;+ if (b.signingOrder === null) return -1;+ if (a.signingOrder === b.signingOrder) return a.id - b.id;+ return a.signingOrder - b.signingOrder;+ });++ const currentIndex = sortedRecipients.findIndex((r) => r.id === recipient.id);++ return currentIndex !== -1 && currentIndex < sortedRecipients.length - 1+ ? sortedRecipients[currentIndex + 1]+ : null;+ }, [envelope.documentMeta?.signingOrder, envelope.recipients, recipient.id]);++ const signField = async (fieldId: number, fieldValue: TSignEnvelopeFieldValue) => {+ console.log('insertField', fieldId, fieldValue);++ await signEnvelopeField({+ token: envelopeData.recipient.token,+ fieldId,+ fieldValue,+ authOptions: undefined,+ });+ };++ return (+ <EnvelopeSigningContext.Provider+ value={{+ fullName,+ setFullName,+ email,+ setEmail,+ signature,+ setSignature,+ envelopeData,+ envelope,++ showPendingFieldTooltip,+ setShowPendingFieldTooltip,++ recipient,+ recipientFieldsRemaining,+ recipientFields,+ nextRecipient,++ otherRecipientCompletedFields,+ assistantRecipients,+ assistantFields,+ setSelectedAssistantRecipientId,+ selectedAssistantRecipient,+ selectedRecipientFields,++ signField,+ }}+ >+ {children}+ </EnvelopeSigningContext.Provider>+ );+};++EnvelopeSigningProvider.displayName = 'EnvelopeSigningProvider';diff --git a/apps/remix/app/components/general/document/document-certificate-qr-view.tsx b/apps/remix/app/components/general/document/document-certificate-qr-view.tsxindex 20d13a007..2fe50c8ce 100644--- a/apps/remix/app/components/general/document/document-certificate-qr-view.tsx+++ b/apps/remix/app/components/general/document/document-certificate-qr-view.tsx@@ -1,10 +1,13 @@import { useEffect, useState } from 'react';import { Trans } from '@lingui/react/macro';-import type { DocumentData } from '@prisma/client';+import type { DocumentData, EnvelopeItem } from '@prisma/client';import { DateTime } from 'luxon';+import { EnvelopeRenderProvider } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { formatDocumentsPath } from '@documenso/lib/utils/teams';import { trpc } from '@documenso/trpc/react';+import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy';import { Button } from '@documenso/ui/primitives/button';import {Dialog,@@ -16,13 +19,16 @@ import {} from '@documenso/ui/primitives/dialog';import { PDFViewer } from '@documenso/ui/primitives/pdf-viewer';+import { EnvelopeRendererFileSelector } from '../envelope-editor/envelope-file-selector';+import EnvelopeGenericPageRenderer from '../envelope-editor/envelope-generic-page-renderer';import { ShareDocumentDownloadButton } from '../share-document-download-button';export type DocumentCertificateQRViewProps = {documentId: number;title: string;- documentData: DocumentData;- password?: string | null;+ internalVersion: number;+ envelopeItems: (EnvelopeItem & { documentData: DocumentData })[];+ documentTeamUrl: string;recipientCount?: number;completedDate?: Date;};@@ -30,31 +36,32 @@ export type DocumentCertificateQRViewProps = {export const DocumentCertificateQRView = ({documentId,title,- documentData,- password,+ internalVersion,+ envelopeItems,+ documentTeamUrl,recipientCount = 0,completedDate,}: DocumentCertificateQRViewProps) => {- const { data: documentUrl } = trpc.shareLink.getDocumentInternalUrlForQRCode.useQuery({+ const { data: documentViaUser } = trpc.document.get.useQuery({documentId,});- const [isDialogOpen, setIsDialogOpen] = useState(() => !!documentUrl);+ const [isDialogOpen, setIsDialogOpen] = useState(() => !!documentViaUser);const formattedDate = completedDate? DateTime.fromJSDate(completedDate).toLocaleString(DateTime.DATETIME_MED): '';useEffect(() => {- if (documentUrl) {+ if (documentViaUser) {setIsDialogOpen(true);}- }, [documentUrl]);+ }, [documentViaUser]);return (<div className="mx-auto w-full max-w-screen-md">{/* Dialog for internal document link */}- {documentUrl && (+ {documentViaUser && (<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}><DialogContent><DialogHeader>@@ -72,7 +79,11 @@ export const DocumentCertificateQRView = ({<DialogFooter className="flex flex-row justify-end gap-2"><Button asChild>- <a href={documentUrl} target="_blank" rel="noopener noreferrer">+ <a+ href={`${formatDocumentsPath(documentTeamUrl)}/${documentViaUser.envelopeId}`}+ target="_blank"+ rel="noopener noreferrer"+ ><Trans>Go to document</Trans></a></Button>@@ -95,11 +106,21 @@ export const DocumentCertificateQRView = ({</div></div>- <ShareDocumentDownloadButton title={title} documentData={documentData} />+ <ShareDocumentDownloadButton title={title} documentData={envelopeItems[0].documentData} /></div><div className="mt-12 w-full">- <PDFViewer key={documentData.id} documentData={documentData} password={password} />+ {internalVersion === 2 ? (+ <EnvelopeRenderProvider envelope={{ envelopeItems }}>+ <EnvelopeRendererFileSelector className="mb-4 p-0" fields={[]} secondaryOverride={''} />++ <PDFViewerKonvaLazy customPageRenderer={EnvelopeGenericPageRenderer} />+ </EnvelopeRenderProvider>+ ) : (+ <>+ <PDFViewer key={envelopeItems[0].id} documentData={envelopeItems[0].documentData} />+ </>+ )}</div></div>);diff --git a/apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx b/apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxindex 84b1dfc4a..117e86873 100644--- a/apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx+++ b/apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx@@ -64,7 +64,7 @@ export const DocumentDropZoneWrapper = ({ children, className }: DocumentDropZonconst response = await putPdfFile(file);- const { id } = await createDocument({+ const { legacyDocumentId: id } = await createDocument({title: file.name,documentDataId: response.id,timezone: userTimezone, // Note: When migrating to v2 document upload remember to pass this through as a 'userTimezone' field.diff --git a/apps/remix/app/components/general/document/document-edit-form.tsx b/apps/remix/app/components/general/document/document-edit-form.tsxindex 023a20a8b..0b731fa35 100644--- a/apps/remix/app/components/general/document/document-edit-form.tsx+++ b/apps/remix/app/components/general/document/document-edit-form.tsx@@ -83,7 +83,7 @@ export const DocumentEditForm = ({},});- const { mutateAsync: addFields } = trpc.field.addFields.useMutation({+ const { mutateAsync: addFields } = trpc.field.setFieldsForDocument.useMutation({...DO_NOT_INVALIDATE_QUERY_ON_MUTATION,onSuccess: ({ fields: newFields }) => {utils.document.get.setData(@@ -230,6 +230,7 @@ export const DocumentEditForm = ({documentId: document.id,recipients: data.signers.map((signer) => ({...signer,+ id: signer.nativeId,// Explicitly set to null to indicate we want to remove auth if required.actionAuth: signer.actionAuth ?? [],})),@@ -253,6 +254,7 @@ export const DocumentEditForm = ({documentId: document.id,recipients: data.signers.map((signer) => ({...signer,+ id: signer.nativeId,// Explicitly set to null to indicate we want to remove auth if required.actionAuth: signer.actionAuth ?? [],})),@@ -292,7 +294,11 @@ export const DocumentEditForm = ({const saveFieldsData = async (data: TAddFieldsFormSchema) => {return addFields({documentId: document.id,- fields: data.fields,+ fields: data.fields.map((field) => ({+ ...field,+ id: field.nativeId,+ envelopeItemId: document.documentData.envelopeItemId,+ })),});};@@ -388,7 +394,7 @@ export const DocumentEditForm = ({duration: 5000,});} else {- await navigate(`${documentRootPath}/${document.id}`);+ await navigate(`${documentRootPath}/${document.envelopeId}`);}} catch (err) {console.error(err);diff --git a/apps/remix/app/components/general/document/document-page-view-button.tsx b/apps/remix/app/components/general/document/document-page-view-button.tsxindex e5fea4d2b..a5636292e 100644--- a/apps/remix/app/components/general/document/document-page-view-button.tsx+++ b/apps/remix/app/components/general/document/document-page-view-button.tsx@@ -1,7 +1,6 @@import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Document, Recipient, Team, User } from '@prisma/client';import { DocumentStatus, RecipientRole, SigningStatus } from '@prisma/client';import { CheckCircle, Download, EyeIcon, Pencil } from 'lucide-react';import { Link } from 'react-router';@@ -9,57 +8,43 @@ import { match } from 'ts-pattern';import { downloadPDF } from '@documenso/lib/client-only/download-pdf';import { useSession } from '@documenso/lib/client-only/providers/session';+import type { TEnvelope } from '@documenso/lib/types/envelope';import { isDocumentCompleted } from '@documenso/lib/utils/document';import { formatDocumentsPath } from '@documenso/lib/utils/teams';-import { trpc as trpcClient } from '@documenso/trpc/client';import { Button } from '@documenso/ui/primitives/button';import { useToast } from '@documenso/ui/primitives/use-toast';export type DocumentPageViewButtonProps = {- document: Document & {- user: Pick<User, 'id' | 'name' | 'email'>;- recipients: Recipient[];- team: Pick<Team, 'id' | 'url'>;- };+ envelope: TEnvelope;};-export const DocumentPageViewButton = ({ document }: DocumentPageViewButtonProps) => {+export const DocumentPageViewButton = ({ envelope }: DocumentPageViewButtonProps) => {const { user } = useSession();const { toast } = useToast();const { _ } = useLingui();- const recipient = document.recipients.find((recipient) => recipient.email === user.email);+ const recipient = envelope.recipients.find((recipient) => recipient.email === user.email);const isRecipient = !!recipient;- const isPending = document.status === DocumentStatus.PENDING;- const isComplete = isDocumentCompleted(document);+ const isPending = envelope.status === DocumentStatus.PENDING;+ const isComplete = isDocumentCompleted(envelope);const isSigned = recipient?.signingStatus === SigningStatus.SIGNED;const role = recipient?.role;- const documentsPath = formatDocumentsPath(document.team.url);- const formatPath = `${documentsPath}/${document.id}/edit`;+ const documentsPath = formatDocumentsPath(envelope.team.url);+ const formatPath = `${documentsPath}/${envelope.id}/edit`;const onDownloadClick = async () => {try {- const documentWithData = await trpcClient.document.get.query(- {- documentId: document.id,- },- {- context: {- teamId: document.team?.id?.toString(),- },- },- );-- const documentData = documentWithData?.documentData;+ // Todo; Envelopes - Support multiple items+ const envelopeItem = envelope.envelopeItems[0];- if (!documentData) {+ if (!envelopeItem.documentData) {throw new Error('No document available');}- await downloadPDF({ documentData, fileName: documentWithData.title });+ await downloadPDF({ documentData: envelopeItem.documentData, fileName: envelopeItem.title });} catch (err) {toast({title: _(msg`Something went wrong`),diff --git a/apps/remix/app/components/general/document/document-page-view-dropdown.tsx b/apps/remix/app/components/general/document/document-page-view-dropdown.tsxindex 326c7553c..fb754c6c3 100644--- a/apps/remix/app/components/general/document/document-page-view-dropdown.tsx+++ b/apps/remix/app/components/general/document/document-page-view-dropdown.tsx@@ -3,7 +3,6 @@ import { useState } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Document, Recipient, Team, User } from '@prisma/client';import { DocumentStatus } from '@prisma/client';import {Copy,@@ -19,7 +18,9 @@ import { Link, useNavigate } from 'react-router';import { downloadPDF } from '@documenso/lib/client-only/download-pdf';import { useSession } from '@documenso/lib/client-only/providers/session';+import type { TEnvelope } from '@documenso/lib/types/envelope';import { isDocumentCompleted } from '@documenso/lib/utils/document';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { formatDocumentsPath } from '@documenso/lib/utils/teams';import { trpc as trpcClient } from '@documenso/trpc/client';import { DocumentShareButton } from '@documenso/ui/components/document/document-share-button';@@ -39,14 +40,10 @@ import { DocumentRecipientLinkCopyDialog } from '~/components/general/document/dimport { useCurrentTeam } from '~/providers/team';export type DocumentPageViewDropdownProps = {- document: Document & {- user: Pick<User, 'id' | 'name' | 'email'>;- recipients: Recipient[];- team: Pick<Team, 'id' | 'url'> | null;- };+ envelope: TEnvelope;};-export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownProps) => {+export const DocumentPageViewDropdown = ({ envelope }: DocumentPageViewDropdownProps) => {const { user } = useSession();const { toast } = useToast();const { _ } = useLingui();@@ -57,14 +54,14 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownPconst [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false);const [isDuplicateDialogOpen, setDuplicateDialogOpen] = useState(false);- const recipient = document.recipients.find((recipient) => recipient.email === user.email);+ const recipient = envelope.recipients.find((recipient) => recipient.email === user.email);- const isOwner = document.user.id === user.id;- const isDraft = document.status === DocumentStatus.DRAFT;- const isPending = document.status === DocumentStatus.PENDING;- const isDeleted = document.deletedAt !== null;- const isComplete = isDocumentCompleted(document);- const isCurrentTeamDocument = team && document.team?.url === team.url;+ const isOwner = envelope.userId === user.id;+ const isDraft = envelope.status === DocumentStatus.DRAFT;+ const isPending = envelope.status === DocumentStatus.PENDING;+ const isDeleted = envelope.deletedAt !== null;+ const isComplete = isDocumentCompleted(envelope);+ const isCurrentTeamDocument = team && envelope.teamId === team.id;const canManageDocument = Boolean(isOwner || isCurrentTeamDocument);const documentsPath = formatDocumentsPath(team.url);@@ -73,7 +70,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownPtry {const documentWithData = await trpcClient.document.get.query({- documentId: document.id,+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),},{context: {@@ -88,7 +85,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownPreturn;}- await downloadPDF({ documentData, fileName: document.title });+ await downloadPDF({ documentData, fileName: envelope.title });} catch (err) {toast({title: _(msg`Something went wrong`),@@ -102,7 +99,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownPtry {const documentWithData = await trpcClient.document.get.query({- documentId: document.id,+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),},{context: {@@ -117,7 +114,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownPreturn;}- await downloadPDF({ documentData, fileName: document.title, version: 'original' });+ await downloadPDF({ documentData, fileName: envelope.title, version: 'original' });} catch (err) {toast({title: _(msg`Something went wrong`),@@ -127,7 +124,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP}};- const nonSignedRecipients = document.recipients.filter((item) => item.signingStatus !== 'SIGNED');+ const nonSignedRecipients = envelope.recipients.filter((item) => item.signingStatus !== 'SIGNED');return (<DropdownMenu>@@ -142,7 +139,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP{(isOwner || isCurrentTeamDocument) && !isComplete && (<DropdownMenuItem asChild>- <Link to={`${documentsPath}/${document.id}/edit`}>+ <Link to={`${documentsPath}/${envelope.id}/edit`}><Edit className="mr-2 h-4 w-4" /><Trans>Edit</Trans></Link>@@ -162,7 +159,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP</DropdownMenuItem><DropdownMenuItem asChild>- <Link to={`${documentsPath}/${document.id}/logs`}>+ <Link to={`${documentsPath}/${envelope.id}/logs`}><ScrollTextIcon className="mr-2 h-4 w-4" /><Trans>Audit Logs</Trans></Link>@@ -184,7 +181,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP{canManageDocument && (<DocumentRecipientLinkCopyDialog- recipients={document.recipients}+ recipients={envelope.recipients}trigger={<DropdownMenuItemdisabled={!isPending || isDeleted}@@ -197,10 +194,16 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP/>)}- <DocumentResendDialog document={document} recipients={nonSignedRecipients} />+ <DocumentResendDialog+ document={{+ ...envelope,+ id: mapSecondaryIdToDocumentId(envelope.secondaryId),+ }}+ recipients={nonSignedRecipients}+ /><DocumentShareButton- documentId={document.id}+ documentId={mapSecondaryIdToDocumentId(envelope.secondaryId)}token={isOwner ? undefined : recipient?.token}trigger={({ loading, disabled }) => (<DropdownMenuItem disabled={disabled || isDraft} onSelect={(e) => e.preventDefault()}>@@ -214,9 +217,9 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP</DropdownMenuContent><DocumentDeleteDialog- id={document.id}- status={document.status}- documentTitle={document.title}+ id={mapSecondaryIdToDocumentId(envelope.secondaryId)}+ status={envelope.status}+ documentTitle={envelope.title}open={isDeleteDialogOpen}canManageDocument={canManageDocument}onOpenChange={setDeleteDialogOpen}@@ -227,7 +230,7 @@ export const DocumentPageViewDropdown = ({ document }: DocumentPageViewDropdownP{isDuplicateDialogOpen && (<DocumentDuplicateDialog- id={document.id}+ id={mapSecondaryIdToDocumentId(envelope.secondaryId)}open={isDuplicateDialogOpen}onOpenChange={setDuplicateDialogOpen}/>diff --git a/apps/remix/app/components/general/document/document-page-view-information.tsx b/apps/remix/app/components/general/document/document-page-view-information.tsxindex 6ca4d784c..d4607ca51 100644--- a/apps/remix/app/components/general/document/document-page-view-information.tsx+++ b/apps/remix/app/components/general/document/document-page-view-information.tsx@@ -3,21 +3,18 @@ import { useMemo } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Document, Recipient, User } from '@prisma/client';import { DateTime } from 'luxon';import { useIsMounted } from '@documenso/lib/client-only/hooks/use-is-mounted';+import type { TEnvelope } from '@documenso/lib/types/envelope';export type DocumentPageViewInformationProps = {userId: number;- document: Document & {- user: Pick<User, 'id' | 'name' | 'email'>;- recipients: Recipient[];- };+ envelope: TEnvelope;};export const DocumentPageViewInformation = ({- document,+ envelope,userId,}: DocumentPageViewInformationProps) => {const isMounted = useIsMounted();@@ -29,23 +26,23 @@ export const DocumentPageViewInformation = ({{description: msg`Uploaded by`,value:- userId === document.userId ? _(msg`You`) : (document.user.name ?? document.user.email),+ userId === envelope.userId ? _(msg`You`) : (envelope.user.name ?? envelope.user.email),},{description: msg`Created`,- value: DateTime.fromJSDate(document.createdAt)+ value: DateTime.fromJSDate(envelope.createdAt).setLocale(i18n.locales?.[0] || i18n.locale).toFormat('MMMM d, yyyy'),},{description: msg`Last modified`,- value: DateTime.fromJSDate(document.updatedAt)+ value: DateTime.fromJSDate(envelope.updatedAt).setLocale(i18n.locales?.[0] || i18n.locale).toRelative(),},];// eslint-disable-next-line react-hooks/exhaustive-deps- }, [isMounted, document, userId]);+ }, [isMounted, envelope, userId]);return (<section className="dark:bg-background text-foreground border-border bg-widget flex flex-col rounded-xl border">diff --git a/apps/remix/app/components/general/document/document-page-view-recipients.tsx b/apps/remix/app/components/general/document/document-page-view-recipients.tsxindex 2e413a8ad..372d4a7df 100644--- a/apps/remix/app/components/general/document/document-page-view-recipients.tsx+++ b/apps/remix/app/components/general/document/document-page-view-recipients.tsx@@ -2,7 +2,6 @@ import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';import { DocumentStatus, RecipientRole, SigningStatus } from '@prisma/client';-import type { Document, Recipient } from '@prisma/client';import {AlertTriangle,CheckIcon,@@ -17,6 +16,7 @@ import { Link } from 'react-router';import { match } from 'ts-pattern';import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles';+import type { TEnvelope } from '@documenso/lib/types/envelope';import { isDocumentCompleted } from '@documenso/lib/utils/document';import { formatSigningLink } from '@documenso/lib/utils/recipients';import { CopyTextButton } from '@documenso/ui/components/common/copy-text-button';@@ -27,20 +27,18 @@ import { PopoverHover } from '@documenso/ui/primitives/popover';import { useToast } from '@documenso/ui/primitives/use-toast';export type DocumentPageViewRecipientsProps = {- document: Document & {- recipients: Recipient[];- };+ envelope: TEnvelope;documentRootPath: string;};export const DocumentPageViewRecipients = ({- document,+ envelope,documentRootPath,}: DocumentPageViewRecipientsProps) => {const { _ } = useLingui();const { toast } = useToast();- const recipients = document.recipients;+ const recipients = envelope.recipients;return (<section className="dark:bg-background border-border bg-widget flex flex-col rounded-xl border">@@ -49,9 +47,9 @@ export const DocumentPageViewRecipients = ({<Trans>Recipients</Trans></h1>- {!isDocumentCompleted(document.status) && (+ {!isDocumentCompleted(envelope.status) && (<Link- to={`${documentRootPath}/${document.id}/edit?step=signers`}+ to={`${documentRootPath}/${envelope.id}/edit?step=signers`}title={_(msg`Modify recipients`)}className="flex flex-row items-center justify-between">@@ -84,7 +82,7 @@ export const DocumentPageViewRecipients = ({/><div className="flex flex-row items-center">- {document.status !== DocumentStatus.DRAFT &&+ {envelope.status !== DocumentStatus.DRAFT &&recipient.signingStatus === SigningStatus.SIGNED && (<Badge variant="default">{match(recipient.role)@@ -95,7 +93,7 @@ export const DocumentPageViewRecipients = ({</>)).with(RecipientRole.CC, () =>- document.status === DocumentStatus.COMPLETED ? (+ envelope.status === DocumentStatus.COMPLETED ? (<><MailIcon className="mr-1 h-3 w-3" /><Trans>Sent</Trans>@@ -130,7 +128,7 @@ export const DocumentPageViewRecipients = ({</Badge>)}- {document.status !== DocumentStatus.DRAFT &&+ {envelope.status !== DocumentStatus.DRAFT &&recipient.signingStatus === SigningStatus.NOT_SIGNED && (<Badge variant="secondary"><Clock className="mr-1 h-3 w-3" />@@ -138,7 +136,7 @@ export const DocumentPageViewRecipients = ({</Badge>)}- {document.status !== DocumentStatus.DRAFT &&+ {envelope.status !== DocumentStatus.DRAFT &&recipient.signingStatus === SigningStatus.REJECTED && (<PopoverHovertrigger={@@ -158,7 +156,7 @@ export const DocumentPageViewRecipients = ({</PopoverHover>)}- {document.status === DocumentStatus.PENDING &&+ {envelope.status === DocumentStatus.PENDING &&recipient.signingStatus === SigningStatus.NOT_SIGNED &&recipient.role !== RecipientRole.CC && (<CopyTextButtondiff --git a/apps/remix/app/components/general/document/document-upload.tsx b/apps/remix/app/components/general/document/document-upload-button.tsxsimilarity index 93%rename from apps/remix/app/components/general/document/document-upload.tsxrename to apps/remix/app/components/general/document/document-upload-button.tsxindex b86a12ecc..580982890 100644--- a/apps/remix/app/components/general/document/document-upload.tsx+++ b/apps/remix/app/components/general/document/document-upload-button.tsx@@ -28,11 +28,11 @@ import { useToast } from '@documenso/ui/primitives/use-toast';import { useCurrentTeam } from '~/providers/team';-export type DocumentUploadDropzoneProps = {+export type DocumentUploadButtonProps = {className?: string;};-export const DocumentUploadDropzone = ({ className }: DocumentUploadDropzoneProps) => {+export const DocumentUploadButton = ({ className }: DocumentUploadButtonProps) => {const { _ } = useLingui();const { toast } = useToast();const { user } = useSession();@@ -75,10 +75,10 @@ export const DocumentUploadDropzone = ({ className }: DocumentUploadDropzonePropconst response = await putPdfFile(file);- const { id } = await createDocument({+ const { legacyDocumentId: id } = await createDocument({title: file.name,documentDataId: response.id,- timezone: userTimezone, // Note: When migrating to v2 document upload remember to pass this through as a 'userTimezone' field.+ timezone: userTimezone,folderId: folderId ?? undefined,});@@ -140,7 +140,7 @@ export const DocumentUploadDropzone = ({ className }: DocumentUploadDropzoneProploading={isLoading}disabled={remaining.documents === 0 || !user.emailVerified}disabledMessage={disabledMessage}- onDrop={onFileDrop}+ onDrop={async (files) => onFileDrop(files[0])}onDropRejected={onFileDropRejected}/></div>diff --git a/apps/remix/app/components/general/document/envelope-upload-button.tsx b/apps/remix/app/components/general/document/envelope-upload-button.tsxnew file mode 100644index 000000000..e3c1510c6--- /dev/null+++ b/apps/remix/app/components/general/document/envelope-upload-button.tsx@@ -0,0 +1,198 @@+import { useMemo, useState } from 'react';++import { msg } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { EnvelopeType } from '@prisma/client';+import { useNavigate } from 'react-router';+import { match } from 'ts-pattern';++import { useLimits } from '@documenso/ee/server-only/limits/provider/client';+import { useCurrentOrganisation } from '@documenso/lib/client-only/providers/organisation';+import { useSession } from '@documenso/lib/client-only/providers/session';+import { APP_DOCUMENT_UPLOAD_SIZE_LIMIT } from '@documenso/lib/constants/app';+import { TIME_ZONES } from '@documenso/lib/constants/time-zones';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { putPdfFile } from '@documenso/lib/universal/upload/put-file';+import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams';+import { trpc } from '@documenso/trpc/react';+import { cn } from '@documenso/ui/lib/utils';+import { DocumentDropzone } from '@documenso/ui/primitives/document-upload';+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from '@documenso/ui/primitives/tooltip';+import { useToast } from '@documenso/ui/primitives/use-toast';++import { useCurrentTeam } from '~/providers/team';++export type EnvelopeUploadButtonProps = {+ className?: string;+ type: EnvelopeType;+ folderId?: string;+};++/**+ * Upload an envelope+ */+export const EnvelopeUploadButton = ({ className, type, folderId }: EnvelopeUploadButtonProps) => {+ const { t } = useLingui();+ const { toast } = useToast();+ const { user } = useSession();++ const team = useCurrentTeam();++ const navigate = useNavigate();+ const organisation = useCurrentOrganisation();++ const userTimezone = TIME_ZONES.find(+ (timezone) => timezone === Intl.DateTimeFormat().resolvedOptions().timeZone,+ );++ const { quota, remaining, refreshLimits } = useLimits();++ const [isLoading, setIsLoading] = useState(false);++ const { mutateAsync: createEnvelope } = trpc.envelope.create.useMutation();++ const disabledMessage = useMemo(() => {+ if (organisation.subscription && remaining.documents === 0) {+ return msg`Document upload disabled due to unpaid invoices`;+ }++ if (remaining.documents === 0) {+ return msg`You have reached your document limit.`;+ }++ if (!user.emailVerified) {+ return msg`Verify your email to upload documents.`;+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [remaining.documents, user.emailVerified, team]);++ const onFileDrop = async (files: File[]) => {+ try {+ setIsLoading(true);++ const result = await Promise.all(+ files.map(async (file) => {+ try {+ const response = await putPdfFile(file);++ return {+ title: file.name,+ documentDataId: response.id,+ };+ } catch (err) {+ console.error(err);+ throw new Error('Failed to upload document');+ }+ }),+ );++ const envelopeItemsToCreate = result.filter(+ (item): item is { title: string; documentDataId: string } => item !== undefined,+ );++ const { id } = await createEnvelope({+ folderId,+ type,+ title: files[0].name,+ items: envelopeItemsToCreate,+ meta: {+ timezone: userTimezone,+ },+ }).catch((error) => {+ console.error(error);++ throw error;+ });++ void refreshLimits();++ const pathPrefix =+ type === EnvelopeType.DOCUMENT+ ? formatDocumentsPath(team.url)+ : formatTemplatesPath(team.url);++ await navigate(`${pathPrefix}/${id}/edit`);++ toast({+ title: type === EnvelopeType.DOCUMENT ? t`Document uploaded` : t`Template uploaded`,+ description:+ type === EnvelopeType.DOCUMENT+ ? t`Your document has been uploaded successfully.`+ : t`Your template has been uploaded successfully.`,+ duration: 5000,+ });+ } catch (err) {+ const error = AppError.parseError(err);++ console.error(err);++ const errorMessage = match(error.code)+ .with('INVALID_DOCUMENT_FILE', () => t`You cannot upload encrypted PDFs`)+ .with(+ AppErrorCode.LIMIT_EXCEEDED,+ () => t`You have reached your document limit for this month. Please upgrade your plan.`,+ )+ .otherwise(() => t`An error occurred while uploading your document.`);++ toast({+ title: t`Error`,+ description: errorMessage,+ variant: 'destructive',+ duration: 7500,+ });+ } finally {+ setIsLoading(false);+ }+ };++ const onFileDropRejected = () => {+ toast({+ title:+ type === EnvelopeType.DOCUMENT+ ? t`Your document failed to upload.`+ : t`Your template failed to upload.`,+ description: t`File cannot be larger than ${APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB`,+ duration: 5000,+ variant: 'destructive',+ });+ };++ return (+ <div className={cn('relative', className)}>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <div>+ <DocumentDropzone+ loading={isLoading}+ disabled={remaining.documents === 0 || !user.emailVerified}+ disabledMessage={disabledMessage}+ onDrop={onFileDrop}+ onDropRejected={onFileDropRejected}+ type="envelope"+ />+ </div>+ </TooltipTrigger>++ {type === EnvelopeType.DOCUMENT &&+ remaining.documents > 0 &&+ Number.isFinite(remaining.documents) && (+ <TooltipContent>+ <p className="text-sm">+ <Trans>+ {remaining.documents} of {quota.documents} documents remaining this month.+ </Trans>+ </p>+ </TooltipContent>+ )}+ </Tooltip>+ </TooltipProvider>+ </div>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsxnew file mode 100644index 000000000..dcb4f23b2--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx@@ -0,0 +1,316 @@+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';++import { msg } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { FieldType } from '@prisma/client';+import {+ CalendarIcon,+ CheckSquareIcon,+ ContactIcon,+ DiscIcon,+ HashIcon,+ ListIcon,+ MailIcon,+ TextIcon,+ UserIcon,+} from 'lucide-react';++import { getBoundingClientRect } from '@documenso/lib/client-only/get-bounding-client-rect';+import { useDocumentElement } from '@documenso/lib/client-only/hooks/use-document-element';+import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';+import { FIELD_META_DEFAULT_VALUES } from '@documenso/lib/types/field-meta';+import { nanoid } from '@documenso/lib/universal/id';+import { canRecipientFieldsBeModified } from '@documenso/lib/utils/recipients';+import { SignatureIcon } from '@documenso/ui/icons/signature';+import { RECIPIENT_COLOR_STYLES } from '@documenso/ui/lib/recipient-colors';+import { cn } from '@documenso/ui/lib/utils';+import { FRIENDLY_FIELD_TYPE } from '@documenso/ui/primitives/document-flow/types';++const MIN_HEIGHT_PX = 12;+const MIN_WIDTH_PX = 36;++const DEFAULT_HEIGHT_PX = MIN_HEIGHT_PX * 2.5;+const DEFAULT_WIDTH_PX = MIN_WIDTH_PX * 2.5;++export const fieldButtonList = [+ {+ type: FieldType.SIGNATURE,+ icon: SignatureIcon,+ name: msg`Signature`,+ className: 'font-signature text-lg',+ },+ {+ type: FieldType.EMAIL,+ icon: MailIcon,+ name: msg`Email`,+ },+ {+ type: FieldType.NAME,+ icon: UserIcon,+ name: msg`Name`,+ },+ {+ type: FieldType.INITIALS,+ icon: ContactIcon,+ name: msg`Initials`,+ },+ {+ type: FieldType.DATE,+ icon: CalendarIcon,+ name: msg`Date`,+ },+ {+ type: FieldType.TEXT,+ icon: TextIcon,+ name: msg`Text`,+ },+ {+ type: FieldType.NUMBER,+ icon: HashIcon,+ name: msg`Number`,+ },+ {+ type: FieldType.RADIO,+ icon: DiscIcon,+ name: msg`Radio`,+ },+ {+ type: FieldType.CHECKBOX,+ icon: CheckSquareIcon,+ name: msg`Checkbox`,+ },+ {+ type: FieldType.DROPDOWN,+ icon: ListIcon,+ name: msg`Dropdown`,+ },+];++type EnvelopeEditorFieldDragDropProps = {+ selectedRecipientId: number | null;+ selectedEnvelopeItemId: string | null;+};++export const EnvelopeEditorFieldDragDrop = ({+ selectedRecipientId,+ selectedEnvelopeItemId,+}: EnvelopeEditorFieldDragDropProps) => {+ const { envelope, editorFields, isTemplate } = useCurrentEnvelopeEditor();++ const { t } = useLingui();++ const [selectedField, setSelectedField] = useState<FieldType | null>(null);++ const { isWithinPageBounds, getPage } = useDocumentElement();++ const isFieldsDisabled = useMemo(() => {+ const selectedSigner = envelope.recipients.find(+ (recipient) => recipient.id === selectedRecipientId,+ );+ const fields = envelope.fields;++ if (!selectedSigner) {+ return true;+ }++ // Allow fields to be modified for templates regardless of anything.+ if (isTemplate) {+ return false;+ }++ return !canRecipientFieldsBeModified(selectedSigner, fields);+ }, [selectedRecipientId, envelope.recipients, envelope.fields]);++ const [isFieldWithinBounds, setIsFieldWithinBounds] = useState(false);+ const [coords, setCoords] = useState({+ x: 0,+ y: 0,+ });++ const fieldBounds = useRef({+ height: 0,+ width: 0,+ });++ const onMouseMove = useCallback(+ (event: MouseEvent) => {+ setIsFieldWithinBounds(+ isWithinPageBounds(+ event,+ PDF_VIEWER_PAGE_SELECTOR,+ fieldBounds.current.width,+ fieldBounds.current.height,+ ),+ );++ setCoords({+ x: event.clientX - fieldBounds.current.width / 2,+ y: event.clientY - fieldBounds.current.height / 2,+ });+ },+ [isWithinPageBounds],+ );++ const onMouseClick = useCallback(+ (event: MouseEvent) => {+ if (!selectedField || !selectedRecipientId || !selectedEnvelopeItemId) {+ return;+ }++ const $page = getPage(event, PDF_VIEWER_PAGE_SELECTOR);++ if (+ !$page ||+ !isWithinPageBounds(+ event,+ PDF_VIEWER_PAGE_SELECTOR,+ fieldBounds.current.width,+ fieldBounds.current.height,+ )+ ) {+ setSelectedField(null);+ return;+ }++ const { top, left, height, width } = getBoundingClientRect($page);++ console.log({+ top,+ left,+ height,+ width,+ rawPageX: event.pageX,+ rawPageY: event.pageY,+ });++ const pageNumber = parseInt($page.getAttribute('data-page-number') ?? '1', 10);++ // Calculate x and y as a percentage of the page width and height+ let pageX = ((event.pageX - left) / width) * 100;+ let pageY = ((event.pageY - top) / height) * 100;++ // Get the bounds as a percentage of the page width and height+ const fieldPageWidth = (fieldBounds.current.width / width) * 100;+ const fieldPageHeight = (fieldBounds.current.height / height) * 100;++ // And center it based on the bounds+ pageX -= fieldPageWidth / 2;+ pageY -= fieldPageHeight / 2;++ const field = {+ formId: nanoid(12),+ envelopeItemId: selectedEnvelopeItemId,+ type: selectedField,+ page: pageNumber,+ positionX: pageX,+ positionY: pageY,+ width: fieldPageWidth,+ height: fieldPageHeight,+ recipientId: selectedRecipientId,+ fieldMeta: structuredClone(FIELD_META_DEFAULT_VALUES[selectedField]),+ };++ editorFields.addField(field);++ setIsFieldWithinBounds(false);+ setSelectedField(null);+ },+ [+ isWithinPageBounds,+ selectedField,+ selectedRecipientId,+ selectedEnvelopeItemId,+ getPage,+ editorFields,+ ],+ );++ useEffect(() => {+ const observer = new MutationObserver((_mutations) => {+ const $page = document.querySelector(PDF_VIEWER_PAGE_SELECTOR);++ if (!$page) {+ return;+ }++ fieldBounds.current = {+ height: Math.max(DEFAULT_HEIGHT_PX),+ width: Math.max(DEFAULT_WIDTH_PX),+ };+ });++ observer.observe(document.body, {+ childList: true,+ subtree: true,+ });++ return () => {+ observer.disconnect();+ };+ }, []);++ useEffect(() => {+ if (selectedField) {+ window.addEventListener('mousemove', onMouseMove);+ window.addEventListener('mouseup', onMouseClick);+ }++ return () => {+ window.removeEventListener('mousemove', onMouseMove);+ window.removeEventListener('mouseup', onMouseClick);+ };+ }, [onMouseClick, onMouseMove, selectedField]);++ return (+ <>+ <div className="grid grid-cols-2 gap-x-2 gap-y-2.5">+ {fieldButtonList.map((field) => (+ <button+ disabled={isFieldsDisabled}+ key={field.type}+ type="button"+ onClick={() => setSelectedField(field.type)}+ onMouseDown={() => setSelectedField(field.type)}+ data-selected={selectedField === field.type ? true : undefined}+ className="group flex h-12 cursor-pointer items-center justify-center rounded-lg border border-gray-200 px-4 transition-colors hover:border-blue-300 hover:bg-blue-50"+ >+ <p+ className={cn(+ 'text-muted-foreground group-data-[selected]:text-foreground flex items-center justify-center gap-x-1.5 text-sm font-normal',+ field.className,+ )}+ >+ {field.type !== FieldType.SIGNATURE && <field.icon className="h-4 w-4" />}+ {t(field.name)}+ </p>+ </button>+ ))}+ </div>++ {selectedField && (+ <div+ className={cn(+ 'text-muted-foreground dark:text-muted-background pointer-events-none fixed z-50 flex cursor-pointer flex-col items-center justify-center rounded-[2px] bg-white ring-2 transition duration-200 [container-type:size]',+ // selectedSignerStyles?.base,+ RECIPIENT_COLOR_STYLES.yellow.base, // Todo: Envelopes+ {+ '-rotate-6 scale-90 opacity-50 dark:bg-black/20': !isFieldWithinBounds,+ 'dark:text-black/60': isFieldWithinBounds,+ },+ )}+ style={{+ top: coords.y,+ left: coords.x,+ height: fieldBounds.current.height,+ width: fieldBounds.current.width,+ }}+ >+ <span className="text-[clamp(0.425rem,25cqw,0.825rem)]">+ {t(FRIENDLY_FIELD_TYPE[selectedField])}+ </span>+ </div>+ )}+ </>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsxnew file mode 100644index 000000000..f2a05a58b--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx@@ -0,0 +1,686 @@+import { useEffect, useMemo, useRef, useState } from 'react';++import { useLingui } from '@lingui/react/macro';+import type { FieldType } from '@prisma/client';+import Konva from 'konva';+import type { Layer } from 'konva/lib/Layer';+import type { KonvaEventObject } from 'konva/lib/Node';+import type { Transformer } from 'konva/lib/shapes/Transformer';+import { CopyPlusIcon, SquareStackIcon, TrashIcon } from 'lucide-react';+import type { RenderParameters } from 'pdfjs-dist/types/src/display/api';+import { usePageContext } from 'react-pdf';++import { getBoundingClientRect } from '@documenso/lib/client-only/get-bounding-client-rect';+import type { TLocalField } from '@documenso/lib/client-only/hooks/use-editor-fields';+import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { FIELD_META_DEFAULT_VALUES } from '@documenso/lib/types/field-meta';+import {+ MIN_FIELD_HEIGHT_PX,+ MIN_FIELD_WIDTH_PX,+ convertPixelToPercentage,+} from '@documenso/lib/universal/field-renderer/field-renderer';+import { renderField } from '@documenso/lib/universal/field-renderer/render-field';+import { canRecipientFieldsBeModified } from '@documenso/lib/utils/recipients';++import { fieldButtonList } from './envelope-editor-fields-drag-drop';++export default function EnvelopeEditorFieldsPageRenderer() {+ const pageContext = usePageContext();++ if (!pageContext) {+ throw new Error('Unable to find Page context.');+ }++ const { _className, page, rotate, scale } = pageContext;++ if (!page) {+ throw new Error('Attempted to render page canvas, but no page was specified.');+ }++ const { t } = useLingui();+ const { envelope, editorFields, getRecipientColorKey } = useCurrentEnvelopeEditor();+ const { currentEnvelopeItem } = useCurrentEnvelopeRender();++ const canvasElement = useRef<HTMLCanvasElement>(null);+ const konvaContainer = useRef<HTMLDivElement>(null);++ const stage = useRef<Konva.Stage | null>(null);+ const pageLayer = useRef<Layer | null>(null);+ const interactiveTransformer = useRef<Transformer | null>(null);++ const [selectedKonvaFieldGroups, setSelectedKonvaFieldGroups] = useState<Konva.Group[]>([]);++ const [isFieldChanging, setIsFieldChanging] = useState(false);+ const [pendingFieldCreation, setPendingFieldCreation] = useState<Konva.Rect | null>(null);++ const viewport = useMemo(+ () => page.getViewport({ scale, rotation: rotate }),+ [page, rotate, scale],+ );++ const localPageFields = useMemo(+ () =>+ editorFields.localFields.filter(+ (field) =>+ field.page === pageContext.pageNumber && field.envelopeItemId === currentEnvelopeItem?.id,+ ),+ [editorFields.localFields, pageContext.pageNumber],+ );++ // Custom renderer from Konva examples.+ useEffect(+ function drawPageOnCanvas() {+ if (!page) {+ return;+ }++ const { current: canvas } = canvasElement;+ const { current: container } = konvaContainer;++ if (!canvas || !container) {+ return;+ }++ const renderContext: RenderParameters = {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ canvasContext: canvas.getContext('2d', { alpha: false }) as CanvasRenderingContext2D,+ viewport,+ };++ const cancellable = page.render(renderContext);+ const runningTask = cancellable;++ cancellable.promise.catch(() => {+ // Intentionally empty+ });++ void cancellable.promise.then(() => {+ createPageCanvas(container);+ });++ return () => {+ runningTask.cancel();+ };+ },+ [page, viewport],+ );++ const handleResizeOrMove = (event: KonvaEventObject<Event>) => {+ console.log('Field resized or moved');++ const { current: container } = canvasElement;++ if (!container) {+ return;+ }++ const isDragEvent = event.type === 'dragend';++ const fieldGroup = event.target as Konva.Group;+ const fieldFormId = fieldGroup.id();++ const {+ width: fieldPixelWidth,+ height: fieldPixelHeight,+ x: fieldX,+ y: fieldY,+ } = fieldGroup.getClientRect({+ skipStroke: true,+ skipShadow: true,+ });++ const { height: pageHeight, width: pageWidth } = getBoundingClientRect(container);++ // Calculate x and y as a percentage of the page width and height+ const positionPercentX = (fieldX / pageWidth) * 100;+ const positionPercentY = (fieldY / pageHeight) * 100;++ // Get the bounds as a percentage of the page width and height+ const fieldPageWidth = (fieldPixelWidth / pageWidth) * 100;+ const fieldPageHeight = (fieldPixelHeight / pageHeight) * 100;++ const fieldUpdates: Partial<TLocalField> = {+ positionX: positionPercentX,+ positionY: positionPercentY,+ };++ // Do not update the width/height unless the field has actually been resized.+ // This is because our calculations will shift the width/height slightly+ // due to the way we convert between pixel and percentage.+ if (!isDragEvent) {+ fieldUpdates.width = fieldPageWidth;+ fieldUpdates.height = fieldPageHeight;+ }++ // Todo: envelopes Use id+ editorFields.updateFieldByFormId(fieldFormId, fieldUpdates);++ // Select the field if it is not already selected.+ if (isDragEvent && interactiveTransformer.current?.nodes().length === 0) {+ setSelectedFields([fieldGroup]);+ }++ pageLayer.current?.batchDraw();+ };++ const renderFieldOnLayer = (field: TLocalField) => {+ if (!pageLayer.current || !interactiveTransformer.current) {+ console.error('Layer not loaded yet');+ return;+ }++ const recipient = envelope.recipients.find((r) => r.id === field.recipientId);+ const isFieldEditable =+ recipient !== undefined && canRecipientFieldsBeModified(recipient, envelope.fields);++ const { fieldGroup, isFirstRender } = renderField({+ pageLayer: pageLayer.current,+ field: {+ renderId: field.formId,+ ...field,+ customText: '',+ inserted: false,+ fieldMeta: field.fieldMeta,+ },+ pageWidth: viewport.width,+ pageHeight: viewport.height,+ color: getRecipientColorKey(field.recipientId),+ editable: isFieldEditable,+ mode: 'edit',+ });++ if (!isFieldEditable) {+ return;+ }++ fieldGroup.off('click');+ fieldGroup.off('transformend');+ fieldGroup.off('dragend');++ // Set up field selection.+ fieldGroup.on('click', () => {+ removePendingField();+ setSelectedFields([fieldGroup]);+ pageLayer.current?.batchDraw();+ });++ fieldGroup.on('transformend', handleResizeOrMove);+ fieldGroup.on('dragend', handleResizeOrMove);+ };++ /**+ * Create the initial Konva page canvas and initialize all fields and interactions.+ */+ const createPageCanvas = (container: HTMLDivElement) => {+ stage.current = new Konva.Stage({+ container,+ width: viewport.width,+ height: viewport.height,+ });++ // Create the main layer for interactive elements.+ pageLayer.current = new Konva.Layer();+ stage.current?.add(pageLayer.current);++ // Initialize snap guides layer+ // snapGuideLayer.current = initializeSnapGuides(stage.current);++ // Add transformer for resizing and rotating.+ interactiveTransformer.current = createInteractiveTransformer(stage.current, pageLayer.current);++ // Render the fields.+ for (const field of localPageFields) {+ renderFieldOnLayer(field);+ }++ // Handle stage click to deselect.+ stage.current?.on('click', (e) => {+ removePendingField();++ if (e.target === stage.current) {+ setSelectedFields([]);+ pageLayer.current?.batchDraw();+ }+ });++ // When an item is dragged, select it automatically.+ const onDragStartOrEnd = (e: KonvaEventObject<Event>) => {+ removePendingField();++ if (!e.target.hasName('field-group')) {+ return;+ }++ setIsFieldChanging(e.type === 'dragstart');++ const itemAlreadySelected = (interactiveTransformer.current?.nodes() || []).includes(+ e.target,+ );++ // Do nothing and allow the transformer to handle it.+ // Required so when multiple items are selected, this won't deselect them.+ if (itemAlreadySelected) {+ return;+ }++ setSelectedFields([e.target]);+ };++ stage.current?.on('dragstart', onDragStartOrEnd);+ stage.current?.on('dragend', onDragStartOrEnd);+ stage.current?.on('transformstart', () => setIsFieldChanging(true));+ stage.current?.on('transformend', () => setIsFieldChanging(false));++ pageLayer.current.batchDraw();+ };++ /**+ * Creates an interactive transformer for the fields.+ *+ * Allows:+ * - Resizing+ * - Moving+ * - Selecting multiple fields+ * - Selecting empty area to create fields+ */+ const createInteractiveTransformer = (stage: Konva.Stage, layer: Konva.Layer) => {+ const transformer = new Konva.Transformer({+ rotateEnabled: false,+ keepRatio: false,+ shouldOverdrawWholeArea: true,+ ignoreStroke: true,+ flipEnabled: false,+ boundBoxFunc: (oldBox, newBox) => {+ // Enforce minimum size+ if (newBox.width < 30 || newBox.height < 20) {+ return oldBox;+ }++ return newBox;+ },+ });++ layer.add(transformer);++ // Add selection rectangle.+ const selectionRectangle = new Konva.Rect({+ fill: 'rgba(24, 160, 251, 0.3)',+ visible: false,+ });+ layer.add(selectionRectangle);++ let x1: number;+ let y1: number;+ let x2: number;+ let y2: number;++ stage.on('mousedown touchstart', (e) => {+ // do nothing if we mousedown on any shape+ if (e.target !== stage) {+ return;+ }++ const pointerPosition = stage.getPointerPosition();++ if (!pointerPosition) {+ return;+ }++ x1 = pointerPosition.x;+ y1 = pointerPosition.y;+ x2 = pointerPosition.x;+ y2 = pointerPosition.y;++ selectionRectangle.setAttrs({+ x: x1,+ y: y1,+ width: 0,+ height: 0,+ visible: true,+ });+ });++ stage.on('mousemove touchmove', () => {+ // do nothing if we didn't start selection+ if (!selectionRectangle.visible()) {+ return;+ }++ selectionRectangle.moveToTop();++ const pointerPosition = stage.getPointerPosition();++ if (!pointerPosition) {+ return;+ }++ x2 = pointerPosition.x;+ y2 = pointerPosition.y;++ selectionRectangle.setAttrs({+ x: Math.min(x1, x2),+ y: Math.min(y1, y2),+ width: Math.abs(x2 - x1),+ height: Math.abs(y2 - y1),+ });+ });++ stage.on('mouseup touchend', () => {+ // do nothing if we didn't start selection+ if (!selectionRectangle.visible()) {+ return;+ }++ // Update visibility in timeout, so we can check it in click event+ setTimeout(() => {+ selectionRectangle.visible(false);+ });++ const stageFieldGroups = stage.find('.field-group') || [];+ const box = selectionRectangle.getClientRect();+ const selectedFieldGroups = stageFieldGroups.filter(+ (shape) => Konva.Util.haveIntersection(box, shape.getClientRect()) && shape.draggable(),+ );+ setSelectedFields(selectedFieldGroups);++ // Create a field if no items are selected or the size is too small.+ if (+ selectedFieldGroups.length === 0 &&+ canvasElement.current &&+ box.width > MIN_FIELD_WIDTH_PX &&+ box.height > MIN_FIELD_HEIGHT_PX &&+ editorFields.selectedRecipient &&+ canRecipientFieldsBeModified(editorFields.selectedRecipient, envelope.fields)+ ) {+ const pendingFieldCreation = new Konva.Rect({+ name: 'pending-field-creation',+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ fill: 'rgba(24, 160, 251, 0.3)',+ });++ layer.add(pendingFieldCreation);+ setPendingFieldCreation(pendingFieldCreation);+ }+ });++ // Clicks should select/deselect shapes+ stage.on('click tap', function (e) {+ // if we are selecting with rect, do nothing+ if (+ selectionRectangle.visible() &&+ selectionRectangle.width() > 0 &&+ selectionRectangle.height() > 0+ ) {+ return;+ }++ // If empty area clicked, remove all selections+ if (e.target === stage) {+ setSelectedFields([]);+ return;+ }++ // Do nothing if field not clicked, or if field is not editable+ if (!e.target.hasName('field-group') || e.target.draggable() === false) {+ return;+ }++ // do we pressed shift or ctrl?+ const metaPressed = e.evt.shiftKey || e.evt.ctrlKey || e.evt.metaKey;+ const isSelected = transformer.nodes().indexOf(e.target) >= 0;++ if (!metaPressed && !isSelected) {+ // if no key pressed and the node is not selected+ // select just one+ setSelectedFields([e.target]);+ } else if (metaPressed && isSelected) {+ // if we pressed keys and node was selected+ // we need to remove it from selection:+ const nodes = transformer.nodes().slice(); // use slice to have new copy of array+ // remove node from array+ nodes.splice(nodes.indexOf(e.target), 1);+ setSelectedFields(nodes);+ } else if (metaPressed && !isSelected) {+ // add the node into selection+ const nodes = transformer.nodes().concat([e.target]);+ setSelectedFields(nodes);+ }+ });++ return transformer;+ };++ /**+ * Render fields when they are added or removed from the localFields.+ */+ useEffect(() => {+ if (!pageLayer.current || !stage.current) {+ return;+ }++ // If doesn't exist in localFields, destroy it since it's been deleted.+ pageLayer.current.find('Group').forEach((group) => {+ if (+ group.name() === 'field-group' &&+ !localPageFields.some((field) => field.formId === group.id())+ ) {+ console.log('Field removed, removing from canvas');+ group.destroy();+ }+ });++ // If it exists, rerender.+ localPageFields.forEach((field) => {+ console.log('Field created/updated, rendering on canvas');+ renderFieldOnLayer(field);+ });++ // If it doesn't exist, render it.+ //++ // Rerender the transformer+ interactiveTransformer.current?.forceUpdate();++ pageLayer.current.batchDraw();+ }, [localPageFields]);++ const setSelectedFields = (nodes: Konva.Node[]) => {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ const fieldGroups = nodes.filter((node) => node.hasName('field-group')) as Konva.Group[];++ interactiveTransformer.current?.nodes(fieldGroups);+ setSelectedKonvaFieldGroups(fieldGroups);++ if (fieldGroups.length === 0 || fieldGroups.length > 1) {+ editorFields.setSelectedField(null);+ }++ // Handle single field selection.+ if (fieldGroups.length === 1) {+ const fieldGroup = fieldGroups[0];++ editorFields.setSelectedField(fieldGroup.id());+ fieldGroup.moveToTop();+ }+ };++ const deletedSelectedFields = () => {+ const fieldFormids = selectedKonvaFieldGroups+ .map((field) => field.id())+ .filter((field) => field !== undefined);++ editorFields.removeFieldsByFormId(fieldFormids);++ setSelectedFields([]);+ };++ const duplicatedSelectedFields = () => {+ const fields = selectedKonvaFieldGroups+ .map((field) => editorFields.getFieldByFormId(field.id()))+ .filter((field) => field !== undefined);++ for (const field of fields) {+ editorFields.duplicateField(field);+ }+ };++ const duplicatedSelectedFieldsOnAllPages = () => {+ const fields = selectedKonvaFieldGroups+ .map((field) => editorFields.getFieldByFormId(field.id()))+ .filter((field) => field !== undefined);++ for (const field of fields) {+ editorFields.duplicateFieldToAllPages(field);+ }++ setSelectedFields([]);+ };++ /**+ * Create a field from a pending field.+ */+ const createFieldFromPendingTemplate = (pendingFieldCreation: Konva.Rect, type: FieldType) => {+ const pixelWidth = pendingFieldCreation.width();+ const pixelHeight = pendingFieldCreation.height();+ const pixelX = pendingFieldCreation.x();+ const pixelY = pendingFieldCreation.y();++ removePendingField();++ if (!canvasElement.current || !currentEnvelopeItem || !editorFields.selectedRecipient) {+ return;+ }++ const { height: pageHeight, width: pageWidth } = getBoundingClientRect(canvasElement.current);++ const { fieldX, fieldY, fieldWidth, fieldHeight } = convertPixelToPercentage({+ width: pixelWidth,+ height: pixelHeight,+ positionX: pixelX,+ positionY: pixelY,+ pageWidth,+ pageHeight,+ });++ editorFields.addField({+ envelopeItemId: currentEnvelopeItem.id,+ page: pageContext.pageNumber,+ type,+ positionX: fieldX,+ positionY: fieldY,+ width: fieldWidth,+ height: fieldHeight,+ recipientId: editorFields.selectedRecipient.id,+ fieldMeta: structuredClone(FIELD_META_DEFAULT_VALUES[type]),+ });+ };++ /**+ * Remove any pending fields or rectangle on the canvas.+ */+ const removePendingField = () => {+ setPendingFieldCreation(null);++ const pendingFieldCreation = pageLayer.current?.find('.pending-field-creation') || [];++ for (const field of pendingFieldCreation) {+ field.destroy();+ }+ };++ if (!currentEnvelopeItem) {+ return null;+ }++ return (+ <div className="relative" key={`${currentEnvelopeItem.id}-renderer-${pageContext.pageNumber}`}>+ {selectedKonvaFieldGroups.length > 0 &&+ interactiveTransformer.current &&+ !isFieldChanging && (+ <div+ style={{+ position: 'absolute',+ top:+ interactiveTransformer.current.y() ++ interactiveTransformer.current.getClientRect().height ++ 5 ++ 'px',+ left:+ interactiveTransformer.current.x() ++ interactiveTransformer.current.getClientRect().width / 2 ++ 'px',+ transform: 'translateX(-50%)',+ gap: '8px',+ pointerEvents: 'auto',+ zIndex: 50,+ }}+ className="group flex items-center justify-evenly gap-x-1 rounded-md border bg-gray-900 p-0.5"+ >+ <button+ title={t`Duplicate`}+ className="rounded-sm p-1.5 text-gray-400 transition-colors hover:bg-white/10 hover:text-gray-100"+ onClick={() => duplicatedSelectedFields()}+ onTouchEnd={() => duplicatedSelectedFields()}+ >+ <CopyPlusIcon className="h-3 w-3" />+ </button>++ <button+ title={t`Duplicate on all pages`}+ className="rounded-sm p-1.5 text-gray-400 transition-colors hover:bg-white/10 hover:text-gray-100"+ onClick={() => duplicatedSelectedFieldsOnAllPages()}+ onTouchEnd={() => duplicatedSelectedFieldsOnAllPages()}+ >+ <SquareStackIcon className="h-3 w-3" />+ </button>++ <button+ title={t`Remove`}+ className="rounded-sm p-1.5 text-gray-400 transition-colors hover:bg-white/10 hover:text-gray-100"+ onClick={() => deletedSelectedFields()}+ onTouchEnd={() => deletedSelectedFields()}+ >+ <TrashIcon className="h-3 w-3" />+ </button>+ </div>+ )}++ {/* Todo: Envelopes - This will not overflow the page when close to edges */}+ {pendingFieldCreation && (+ <div+ style={{+ position: 'absolute',+ top: pendingFieldCreation.y() + pendingFieldCreation.getClientRect().height + 5 + 'px',+ left: pendingFieldCreation.x() + pendingFieldCreation.getClientRect().width / 2 + 'px',+ transform: 'translateX(-50%)',+ zIndex: 50,+ }}+ className="text-muted-foreground grid w-fit grid-cols-5 gap-x-1 gap-y-0.5 rounded-md border bg-white p-1 shadow-sm"+ >+ {fieldButtonList.map((field) => (+ <button+ key={field.type}+ onClick={() => createFieldFromPendingTemplate(pendingFieldCreation, field.type)}+ className="hover:text-foreground col-span-1 w-full flex-shrink-0 rounded-sm px-2 py-1 text-xs hover:bg-gray-100"+ >+ {t(field.name)}+ </button>+ ))}+ </div>+ )}++ <div className="konva-container absolute inset-0 z-10" ref={konvaContainer}></div>++ <canvas+ className={`${_className}__canvas z-0`}+ height={viewport.height}+ ref={canvasElement}+ width={viewport.width}+ />+ </div>+ );+}diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsxnew file mode 100644index 000000000..859619584--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx@@ -0,0 +1,183 @@+import { Trans, useLingui } from '@lingui/react/macro';+import { DocumentStatus, EnvelopeType } from '@prisma/client';+import {+ AlertTriangleIcon,+ Globe2Icon,+ LockIcon,+ RefreshCwIcon,+ SendIcon,+ SettingsIcon,+} from 'lucide-react';+import { Link } from 'react-router';+import { match } from 'ts-pattern';++import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';+import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams';+import { Badge } from '@documenso/ui/primitives/badge';+import { Button } from '@documenso/ui/primitives/button';+import { Separator } from '@documenso/ui/primitives/separator';++import { EnvelopeDistributeDialog } from '~/components/dialogs/envelope-distribute-dialog';+import { EnvelopeRedistributeDialog } from '~/components/dialogs/envelope-redistribute-dialog';+import { TemplateUseDialog } from '~/components/dialogs/template-use-dialog';+import { BrandingLogo } from '~/components/general/branding-logo';+import { EnvelopeEditorSettingsDialog } from '~/components/general/envelope-editor/envelope-editor-settings-dialog';+import { useCurrentTeam } from '~/providers/team';++import { TemplateDirectLinkBadge } from '../template/template-direct-link-badge';+import { EnvelopeItemTitleInput } from './envelope-editor-title-input';++export default function EnvelopeEditorHeader() {+ const { t } = useLingui();++ const team = useCurrentTeam();++ const { envelope, isDocument, isTemplate, updateEnvelope, autosaveError } =+ useCurrentEnvelopeEditor();++ // Todo: Envelopes this probably won't work with embed? Maybe hide the back items when no team?++ const rootPath = isDocument ? formatDocumentsPath(team.url) : formatTemplatesPath(team.url);++ return (+ <nav className="w-full border-b border-gray-200 bg-white px-6 py-3">+ <div className="flex items-center justify-between">+ <div className="flex items-center space-x-4">+ <Link to="/">+ <BrandingLogo className="h-6 w-auto" />+ </Link>+ <Separator orientation="vertical" className="h-6" />+ <div className="flex items-center space-x-2">+ <EnvelopeItemTitleInput+ disabled={envelope.status !== DocumentStatus.DRAFT}+ value={envelope.title}+ onChange={(title) => {+ updateEnvelope({+ title,+ });+ }}+ placeholder={t`Envelope Title`}+ />++ {envelope.type === EnvelopeType.TEMPLATE && (+ <>+ {envelope.templateType === 'PRIVATE' ? (+ <Badge variant="secondary">+ <LockIcon className="mr-2 h-4 w-4 text-blue-600 dark:text-blue-300" />+ <Trans>Private Template</Trans>+ </Badge>+ ) : (+ <Badge variant="default">+ <Globe2Icon className="mr-2 h-4 w-4 text-green-500 dark:text-green-300" />+ <Trans>Public Template</Trans>+ </Badge>+ )}++ {envelope.directLink?.token && (+ <TemplateDirectLinkBadge+ className="py-1"+ token={envelope.directLink.token}+ enabled={envelope.directLink.enabled}+ />+ )}+ </>+ )}++ {envelope.type === EnvelopeType.DOCUMENT &&+ match(envelope.status)+ .with(DocumentStatus.DRAFT, () => (+ <Badge variant="warning">+ <Trans>Draft</Trans>+ </Badge>+ ))+ .with(DocumentStatus.PENDING, () => (+ <Badge variant="secondary">+ <Trans>Pending</Trans>+ </Badge>+ ))+ .with(DocumentStatus.COMPLETED, () => (+ <Badge variant="default">+ <Trans>Completed</Trans>+ </Badge>+ ))+ .with(DocumentStatus.REJECTED, () => (+ <Badge variant="destructive">+ <Trans>Rejected</Trans>+ </Badge>+ ))+ .exhaustive()}++ {autosaveError && (+ <>+ <Badge variant="destructive">+ <AlertTriangleIcon className="mr-2 h-4 w-4" />+ <Trans>Sync failed, changes not saved</Trans>+ </Badge>++ <button+ onClick={() => {+ window.location.reload();+ }}+ >+ <Badge variant="destructive">+ <RefreshCwIcon className="mr-2 h-4 w-4" />+ <Trans>Reload</Trans>+ </Badge>+ </button>+ </>+ )}+ </div>+ </div>++ <div className="flex items-center space-x-2">+ <EnvelopeEditorSettingsDialog+ trigger={+ <Button variant="outline" size="sm">+ <SettingsIcon className="h-4 w-4" />+ </Button>+ }+ />++ {isDocument && (+ <>+ <EnvelopeDistributeDialog+ envelope={envelope}+ trigger={+ <Button size="sm">+ <SendIcon className="mr-2 h-4 w-4" />+ <Trans>Send Document</Trans>+ </Button>+ }+ />++ <EnvelopeRedistributeDialog+ envelope={envelope}+ trigger={+ <Button size="sm">+ <SendIcon className="mr-2 h-4 w-4" />+ <Trans>Resend Document</Trans>+ </Button>+ }+ />+ </>+ )}++ {isTemplate && (+ <TemplateUseDialog+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ templateSigningOrder={envelope.documentMeta?.signingOrder}+ recipients={envelope.recipients}+ documentRootPath={rootPath}+ trigger={+ <Button size="sm">+ <Trans>Use Template</Trans>+ </Button>+ }+ />+ )}+ </div>+ </div>+ </nav>+ );+}diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsxnew file mode 100644index 000000000..0582d1be9--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx@@ -0,0 +1,258 @@+import { lazy, useEffect, useMemo } from 'react';++import type { MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';+import { FieldType, RecipientRole } from '@prisma/client';+import { FileTextIcon } from 'lucide-react';+import { isDeepEqual } from 'remeda';+import { match } from 'ts-pattern';++import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import type {+ TCheckboxFieldMeta,+ TDateFieldMeta,+ TDropdownFieldMeta,+ TEmailFieldMeta,+ TFieldMetaSchema,+ TInitialsFieldMeta,+ TNameFieldMeta,+ TNumberFieldMeta,+ TRadioFieldMeta,+ TTextFieldMeta,+} from '@documenso/lib/types/field-meta';+import { canRecipientFieldsBeModified } from '@documenso/lib/utils/recipients';+import { AnimateGenericFadeInOut } from '@documenso/ui/components/animate/animate-generic-fade-in-out';+import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy';+import { Alert, AlertDescription } from '@documenso/ui/primitives/alert';+import { RecipientSelector } from '@documenso/ui/primitives/recipient-selector';+import { Separator } from '@documenso/ui/primitives/separator';++import { EditorFieldCheckboxForm } from '~/components/forms/editor/editor-field-checkbox-form';+import { EditorFieldDateForm } from '~/components/forms/editor/editor-field-date-form';+import { EditorFieldDropdownForm } from '~/components/forms/editor/editor-field-dropdown-form';+import { EditorFieldEmailForm } from '~/components/forms/editor/editor-field-email-form';+import { EditorFieldInitialsForm } from '~/components/forms/editor/editor-field-initials-form';+import { EditorFieldNameForm } from '~/components/forms/editor/editor-field-name-form';+import { EditorFieldNumberForm } from '~/components/forms/editor/editor-field-number-form';+import { EditorFieldRadioForm } from '~/components/forms/editor/editor-field-radio-form';+import { EditorFieldTextForm } from '~/components/forms/editor/editor-field-text-form';++import { EnvelopeEditorFieldDragDrop } from './envelope-editor-fields-drag-drop';+import { EnvelopeRendererFileSelector } from './envelope-file-selector';++const EnvelopeEditorFieldsPageRenderer = lazy(+ async () => import('./envelope-editor-fields-page-renderer'),+);++const FieldSettingsTypeTranslations: Record<FieldType, MessageDescriptor> = {+ [FieldType.SIGNATURE]: msg`Signature Settings`,+ [FieldType.FREE_SIGNATURE]: msg`Free Signature Settings`,+ [FieldType.TEXT]: msg`Text Settings`,+ [FieldType.DATE]: msg`Date Settings`,+ [FieldType.EMAIL]: msg`Email Settings`,+ [FieldType.NAME]: msg`Name Settings`,+ [FieldType.INITIALS]: msg`Initials Settings`,+ [FieldType.NUMBER]: msg`Number Settings`,+ [FieldType.RADIO]: msg`Radio Settings`,+ [FieldType.CHECKBOX]: msg`Checkbox Settings`,+ [FieldType.DROPDOWN]: msg`Dropdown Settings`,+};++export const EnvelopeEditorPageFields = () => {+ const { envelope, editorFields } = useCurrentEnvelopeEditor();++ const { currentEnvelopeItem } = useCurrentEnvelopeRender();++ const { t } = useLingui();++ const selectedField = useMemo(+ () => structuredClone(editorFields.selectedField),+ [editorFields.selectedField],+ );++ const updateSelectedFieldMeta = (fieldMeta: TFieldMetaSchema) => {+ if (!selectedField) {+ return;+ }++ const isMetaSame = isDeepEqual(selectedField.fieldMeta, fieldMeta);++ // Todo: Envelopes - Clean up console logs.+ if (!isMetaSame) {+ console.log('TRIGGER UPDATE');+ editorFields.updateFieldByFormId(selectedField.formId, {+ fieldMeta,+ });+ } else {+ console.log('DATA IS SAME, NO UPDATE');+ }+ };++ /**+ * Set the selected recipient to the first recipient in the envelope.+ */+ useEffect(() => {+ const firstSelectableRecipient = envelope.recipients.find(+ (recipient) =>+ recipient.role === RecipientRole.SIGNER || recipient.role === RecipientRole.APPROVER,+ );++ editorFields.setSelectedRecipient(firstSelectableRecipient?.id ?? null);+ }, []);++ return (+ <div className="relative flex h-full">+ <div className="flex w-full flex-col">+ {/* Horizontal envelope item selector */}+ <EnvelopeRendererFileSelector fields={editorFields.localFields} />++ {/* Document View */}+ <div className="mt-4 flex justify-center">+ {currentEnvelopeItem !== null ? (+ <PDFViewerKonvaLazy customPageRenderer={EnvelopeEditorFieldsPageRenderer} />+ ) : (+ <div className="flex flex-col items-center justify-center py-32">+ <FileTextIcon className="text-muted-foreground h-10 w-10" />+ <p className="text-foreground mt-1 text-sm">+ <Trans>No documents found</Trans>+ </p>+ <p className="text-muted-foreground mt-1 text-sm">+ <Trans>Please upload a document to continue</Trans>+ </p>+ </div>+ )}+ </div>+ </div>++ {/* Right Section - Form Fields Panel */}+ {currentEnvelopeItem && (+ <div className="sticky top-0 h-[calc(100vh-73px)] w-80 flex-shrink-0 overflow-y-auto border-l border-gray-200 bg-white py-4">+ {/* Recipient selector section. */}+ <section className="px-4">+ <h3 className="mb-2 text-sm font-semibold text-gray-900">+ <Trans>Selected Recipient</Trans>+ </h3>++ {envelope.recipients.length === 0 ? (+ <Alert variant="warning">+ <AlertDescription>+ <Trans>You need at least one recipient to add fields</Trans>+ </AlertDescription>+ </Alert>+ ) : (+ <RecipientSelector+ selectedRecipient={editorFields.selectedRecipient}+ onSelectedRecipientChange={(recipient) =>+ editorFields.setSelectedRecipient(recipient.id)+ }+ recipients={envelope.recipients}+ className="w-full"+ align="end"+ />+ )}++ {editorFields.selectedRecipient &&+ !canRecipientFieldsBeModified(editorFields.selectedRecipient, envelope.fields) && (+ <Alert className="mt-4" variant="warning">+ <AlertDescription>+ <Trans>+ This recipient can no longer be modified as they have signed a field, or+ completed the document.+ </Trans>+ </AlertDescription>+ </Alert>+ )}+ </section>++ <Separator className="my-4" />++ {/* Add fields section. */}+ <section className="px-4">+ <h3 className="mb-2 text-sm font-semibold text-gray-900">+ <Trans>Add Fields</Trans>+ </h3>++ <EnvelopeEditorFieldDragDrop+ selectedRecipientId={editorFields.selectedRecipient?.id ?? null}+ selectedEnvelopeItemId={currentEnvelopeItem?.id ?? null}+ />+ </section>++ {/* Field details section. */}+ <AnimateGenericFadeInOut key={editorFields.selectedField?.formId}>+ {selectedField && selectedField.type !== FieldType.SIGNATURE && (+ <section>+ <Separator className="my-4" />++ <div className="[&_label]:text-foreground/70 px-4 [&_label]:text-xs">+ <h3 className="text-sm font-semibold">+ {t(FieldSettingsTypeTranslations[selectedField.type])}+ </h3>++ {match(selectedField.type)+ .with(FieldType.CHECKBOX, () => (+ <EditorFieldCheckboxForm+ value={selectedField?.fieldMeta as TCheckboxFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.DATE, () => (+ <EditorFieldDateForm+ value={selectedField?.fieldMeta as TDateFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.DROPDOWN, () => (+ <EditorFieldDropdownForm+ value={selectedField?.fieldMeta as TDropdownFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.EMAIL, () => (+ <EditorFieldEmailForm+ value={selectedField?.fieldMeta as TEmailFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.INITIALS, () => (+ <EditorFieldInitialsForm+ value={selectedField?.fieldMeta as TInitialsFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.NAME, () => (+ <EditorFieldNameForm+ value={selectedField?.fieldMeta as TNameFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.NUMBER, () => (+ <EditorFieldNumberForm+ value={selectedField?.fieldMeta as TNumberFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.RADIO, () => (+ <EditorFieldRadioForm+ value={selectedField?.fieldMeta as TRadioFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .with(FieldType.TEXT, () => (+ <EditorFieldTextForm+ value={selectedField?.fieldMeta as TTextFieldMeta | undefined}+ onValueChange={(value) => updateSelectedFieldMeta(value)}+ />+ ))+ .otherwise(() => null)}+ </div>+ </section>+ )}+ </AnimateGenericFadeInOut>+ </div>+ )}+ </div>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview-renderer.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview-renderer.tsxnew file mode 100644index 000000000..2e296dfea--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview-renderer.tsx@@ -0,0 +1,176 @@+import { useEffect, useMemo, useRef } from 'react';++import Konva from 'konva';+import type { Layer } from 'konva/lib/Layer';+import type { RenderParameters } from 'pdfjs-dist/types/src/display/api';+import { usePageContext } from 'react-pdf';++import type { TLocalField } from '@documenso/lib/client-only/hooks/use-editor-fields';+import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { renderField } from '@documenso/lib/universal/field-renderer/render-field';++export default function EnvelopeEditorPagePreviewRenderer() {+ const pageContext = usePageContext();++ if (!pageContext) {+ throw new Error('Unable to find Page context.');+ }++ const { _className, page, rotate, scale } = pageContext;++ if (!page) {+ throw new Error('Attempted to render page canvas, but no page was specified.');+ }++ const { editorFields, getRecipientColorKey } = useCurrentEnvelopeEditor();+ const { currentEnvelopeItem } = useCurrentEnvelopeRender();++ const canvasElement = useRef<HTMLCanvasElement>(null);+ const konvaContainer = useRef<HTMLDivElement>(null);++ const stage = useRef<Konva.Stage | null>(null);+ const pageLayer = useRef<Layer | null>(null);++ const viewport = useMemo(+ () => page.getViewport({ scale, rotation: rotate }),+ [page, rotate, scale],+ );++ const localPageFields = useMemo(+ () =>+ editorFields.localFields.filter(+ (field) =>+ field.page === pageContext.pageNumber && field.envelopeItemId === currentEnvelopeItem?.id,+ ),+ [editorFields.localFields, pageContext.pageNumber],+ );++ // Custom renderer from Konva examples.+ useEffect(+ function drawPageOnCanvas() {+ if (!page) {+ return;+ }++ const { current: canvas } = canvasElement;+ const { current: container } = konvaContainer;++ if (!canvas || !container) {+ return;+ }++ const renderContext: RenderParameters = {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ canvasContext: canvas.getContext('2d', { alpha: false }) as CanvasRenderingContext2D,+ viewport,+ };++ const cancellable = page.render(renderContext);+ const runningTask = cancellable;++ cancellable.promise.catch(() => {+ // Intentionally empty+ });++ void cancellable.promise.then(() => {+ createPageCanvas(container);+ });++ return () => {+ runningTask.cancel();+ };+ },+ [page, viewport],+ );++ const renderFieldOnLayer = (field: TLocalField) => {+ if (!pageLayer.current) {+ console.error('Layer not loaded yet');+ return;+ }++ renderField({+ pageLayer: pageLayer.current,+ field: {+ renderId: field.formId,+ ...field,+ customText: '',+ inserted: false,+ fieldMeta: field.fieldMeta,+ },+ pageWidth: viewport.width,+ pageHeight: viewport.height,+ color: getRecipientColorKey(field.recipientId),+ editable: false,+ mode: 'export',+ });+ };++ /**+ * Create the initial Konva page canvas and initialize all fields and interactions.+ */+ const createPageCanvas = (container: HTMLDivElement) => {+ stage.current = new Konva.Stage({+ container,+ width: viewport.width,+ height: viewport.height,+ });++ // Create the main layer for interactive elements.+ pageLayer.current = new Konva.Layer();+ stage.current?.add(pageLayer.current);++ // Render the fields.+ for (const field of localPageFields) {+ renderFieldOnLayer(field);+ }++ pageLayer.current.batchDraw();+ };++ /**+ * Render fields when they are added or removed from the localFields.+ */+ useEffect(() => {+ if (!pageLayer.current || !stage.current) {+ return;+ }++ // If doesn't exist in localFields, destroy it since it's been deleted.+ pageLayer.current.find('Group').forEach((group) => {+ if (+ group.name() === 'field-group' &&+ !localPageFields.some((field) => field.formId === group.id())+ ) {+ console.log('Field removed, removing from canvas');+ group.destroy();+ }+ });++ // If it exists, rerender.+ localPageFields.forEach((field) => {+ console.log('Field created/updated, rendering on canvas');+ renderFieldOnLayer(field);+ });++ pageLayer.current.batchDraw();+ }, [localPageFields]);++ if (!currentEnvelopeItem) {+ return null;+ }++ return (+ <div className="relative" key={`${currentEnvelopeItem.id}-renderer-${pageContext.pageNumber}`}>+ <div className="konva-container absolute inset-0 z-10" ref={konvaContainer}></div>++ <canvas+ className={`${_className}__canvas z-0`}+ height={viewport.height}+ ref={canvasElement}+ width={viewport.width}+ />+ </div>+ );+}diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsxnew file mode 100644index 000000000..f67e52975--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx@@ -0,0 +1,158 @@+import { lazy, useEffect, useState } from 'react';++import { Trans } from '@lingui/react/macro';+import { FileTextIcon } from 'lucide-react';++import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { AnimateGenericFadeInOut } from '@documenso/ui/components/animate/animate-generic-fade-in-out';+import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy';+import { Alert, AlertDescription, AlertTitle } from '@documenso/ui/primitives/alert';+import { RecipientSelector } from '@documenso/ui/primitives/recipient-selector';+import { Separator } from '@documenso/ui/primitives/separator';++import { EnvelopeRendererFileSelector } from './envelope-file-selector';++const EnvelopeEditorPagePreviewRenderer = lazy(+ async () => import('./envelope-editor-page-preview-renderer'),+);++export const EnvelopeEditorPagePreview = () => {+ const { envelope, editorFields } = useCurrentEnvelopeEditor();++ const { currentEnvelopeItem } = useCurrentEnvelopeRender();++ const [selectedPreviewMode, setSelectedPreviewMode] = useState<'recipient' | 'signed'>(+ 'recipient',+ );++ /**+ * Set the selected recipient to the first recipient in the envelope.+ */+ useEffect(() => {+ editorFields.setSelectedRecipient(envelope.recipients[0]?.id ?? null);+ }, []);++ return (+ <div className="relative flex h-full">+ <div className="flex w-full flex-col">+ {/* Horizontal envelope item selector */}+ <EnvelopeRendererFileSelector fields={editorFields.localFields} />++ {/* Document View */}+ <div className="mt-4 flex flex-col items-center justify-center">+ <Alert variant="warning" className="mb-4 max-w-[800px]">+ <AlertTitle>+ <Trans>Preview Mode</Trans>+ </AlertTitle>+ <AlertDescription>+ <Trans>Preview what the signed document will look like with placeholder data</Trans>+ </AlertDescription>+ </Alert>++ {currentEnvelopeItem !== null ? (+ <PDFViewerKonvaLazy customPageRenderer={EnvelopeEditorPagePreviewRenderer} />+ ) : (+ <div className="flex flex-col items-center justify-center py-32">+ <FileTextIcon className="text-muted-foreground h-10 w-10" />+ <p className="text-foreground mt-1 text-sm">+ <Trans>No documents found</Trans>+ </p>+ <p className="text-muted-foreground mt-1 text-sm">+ <Trans>Please upload a document to continue</Trans>+ </p>+ </div>+ )}+ </div>+ </div>++ {/* Right Section - Form Fields Panel */}+ {currentEnvelopeItem && false && (+ <div className="sticky top-0 h-[calc(100vh-73px)] w-80 flex-shrink-0 overflow-y-auto border-l border-gray-200 bg-white py-4">+ {/* Add fields section. */}+ <section className="px-4">+ {/* <h3 className="mb-2 text-sm font-semibold text-gray-900">+ <Trans>Preivew Mode</Trans>+ </h3> */}++ <Alert variant="neutral">+ <AlertTitle>+ <Trans>Preview Mode</Trans>+ </AlertTitle>+ <AlertDescription>+ <Trans>Preview what the signed document will look like with placeholder data</Trans>+ </AlertDescription>+ </Alert>++ {/* <Alert variant="neutral">+ <RadioGroup+ className="gap-y-1"+ value={selectedPreviewMode}+ onValueChange={(value) => setSelectedPreviewMode(value as 'recipient' | 'signed')}+ >+ <div className="flex items-center">+ <RadioGroupItem+ id="document-signed-preview"+ className="pointer-events-none h-3 w-3"+ value="signed"+ />+ <Label+ htmlFor="document-signed-preview"+ className="text-foreground ml-1.5 text-xs font-normal"+ >+ <Trans>Document Signed Preview</Trans>+ </Label>+ </div>++ <div className="flex items-center">+ <RadioGroupItem+ id="recipient-preview"+ className="pointer-events-none h-3 w-3"+ value="recipient"+ />+ <Label+ htmlFor="recipient-preview"+ className="text-foreground ml-1.5 text-xs font-normal"+ >+ <Trans>Recipient Preview</Trans>+ </Label>+ </div>+ </RadioGroup>+ </Alert>++ <div>Preview what a recipient will see</div>++ <div>Preview the signed document</div> */}+ </section>++ {false && (+ <AnimateGenericFadeInOut key={selectedPreviewMode}>+ {selectedPreviewMode === 'recipient' && (+ <>+ <Separator className="my-4" />++ {/* Recipient selector section. */}+ <section className="px-4">+ <h3 className="mb-2 text-sm font-semibold text-gray-900">+ <Trans>Selected Recipient</Trans>+ </h3>++ <RecipientSelector+ selectedRecipient={editorFields.selectedRecipient}+ onSelectedRecipientChange={(recipient) =>+ editorFields.setSelectedRecipient(recipient.id)+ }+ recipients={envelope.recipients}+ className="w-full"+ align="end"+ />+ </section>+ </>+ )}+ </AnimateGenericFadeInOut>+ )}+ </div>+ )}+ </div>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsxnew file mode 100644index 000000000..a1593e158--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx@@ -0,0 +1,348 @@+import { useMemo, useState } from 'react';++import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd';+import type { DropResult } from '@hello-pangea/dnd';+import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';+import { DocumentStatus } from '@prisma/client';+import { FileWarningIcon, GripVerticalIcon, Loader2 } from 'lucide-react';+import { X } from 'lucide-react';+import { Link } from 'react-router';++import {+ useCurrentEnvelopeEditor,+ useDebounceFunction,+} from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { nanoid } from '@documenso/lib/universal/id';+import { putPdfFile } from '@documenso/lib/universal/upload/put-file';+import { canEnvelopeItemsBeModified } from '@documenso/lib/utils/envelope';+import { trpc } from '@documenso/trpc/react';+import { Button } from '@documenso/ui/primitives/button';+import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from '@documenso/ui/primitives/card';+import { DocumentDropzone } from '@documenso/ui/primitives/document-dropzone';++import { EnvelopeItemDeleteDialog } from '~/components/dialogs/envelope-item-delete-dialog';+import { useCurrentTeam } from '~/providers/team';++import { EnvelopeEditorRecipientForm } from './envelope-editor-recipient-form';+import { EnvelopeItemTitleInput } from './envelope-editor-title-input';++type LocalFile = {+ id: string;+ title: string;+ envelopeItemId: string | null;+ isUploading: boolean;+ isError: boolean;+};++export const EnvelopeEditorPageUpload = () => {+ const team = useCurrentTeam();+ const { t } = useLingui();++ const { envelope, setLocalEnvelope } = useCurrentEnvelopeEditor();++ const [localFiles, setLocalFiles] = useState<LocalFile[]>(+ envelope.envelopeItems+ .sort((a, b) => a.order - b.order)+ .map((item) => ({+ id: item.id,+ title: item.title,+ envelopeItemId: item.id,+ isUploading: false,+ isError: false,+ })),+ );++ const { mutateAsync: createEnvelopeItems, isPending: isCreatingEnvelopeItems } =+ trpc.envelope.item.createMany.useMutation({+ onSuccess: (data) => {+ const createdEnvelopes = data.createdEnvelopeItems.filter(+ (item) => !envelope.envelopeItems.find((envelopeItem) => envelopeItem.id === item.id),+ );++ setLocalEnvelope({+ envelopeItems: [...envelope.envelopeItems, ...createdEnvelopes],+ });+ },+ });++ const { mutateAsync: updateEnvelopeItems } = trpc.envelope.item.updateMany.useMutation({+ onSuccess: (data) => {+ setLocalEnvelope({+ envelopeItems: envelope.envelopeItems.map((originalItem) => {+ const updatedItem = data.updatedEnvelopeItems.find((item) => item.id === originalItem.id);++ if (updatedItem) {+ return {+ ...originalItem,+ ...updatedItem,+ };+ }++ return originalItem;+ }),+ });+ },+ });++ const canItemsBeModified = useMemo(+ () => canEnvelopeItemsBeModified(envelope, envelope.recipients),+ [envelope, envelope.recipients],+ );++ const onFileDrop = async (files: File[]) => {+ const newUploadingFiles: (LocalFile & { file: File })[] = files.map((file) => ({+ id: nanoid(),+ envelopeItemId: null,+ title: file.name,+ file,+ isUploading: true,+ isError: false,+ }));++ setLocalFiles((prev) => [...prev, ...newUploadingFiles]);++ const result = await Promise.all(+ files.map(async (file, index) => {+ try {+ const response = await putPdfFile(file);++ // Mark as uploaded (remove from uploading state)+ return {+ title: file.name,+ documentDataId: response.id,+ };+ } catch (_error) {+ setLocalFiles((prev) =>+ prev.map((uploadingFile) =>+ uploadingFile.id === newUploadingFiles[index].id+ ? { ...uploadingFile, isError: true, isUploading: false }+ : uploadingFile,+ ),+ );+ }+ }),+ );++ const envelopeItemsToCreate = result.filter(+ (item): item is { title: string; documentDataId: string } => item !== undefined,+ );++ const { createdEnvelopeItems } = await createEnvelopeItems({+ envelopeId: envelope.id,+ items: envelopeItemsToCreate,+ }).catch((error) => {+ console.error(error);++ // Set error state on files in batch upload.+ setLocalFiles((prev) =>+ prev.map((uploadingFile) =>+ uploadingFile.id === newUploadingFiles.find((file) => file.id === uploadingFile.id)?.id+ ? { ...uploadingFile, isError: true, isUploading: false }+ : uploadingFile,+ ),+ );++ throw error;+ });++ setLocalFiles((prev) => {+ const filteredFiles = prev.filter(+ (uploadingFile) =>+ uploadingFile.id !== newUploadingFiles.find((file) => file.id === uploadingFile.id)?.id,+ );++ return filteredFiles.concat(+ createdEnvelopeItems.map((item) => ({+ id: item.id,+ envelopeItemId: item.id,+ title: item.title,+ isUploading: false,+ isError: false,+ })),+ );+ });+ };++ /**+ * Hide the envelope item from the list on deletion.+ */+ const onFileDelete = (envelopeItemId: string) => {+ setLocalFiles((prev) => prev.filter((uploadingFile) => uploadingFile.id !== envelopeItemId));++ setLocalEnvelope({+ envelopeItems: envelope.envelopeItems.filter((item) => item.id !== envelopeItemId),+ });+ };++ /**+ * Handle drag end for reordering files.+ */+ const onDragEnd = (result: DropResult) => {+ if (!result.destination) {+ return;+ }++ const items = Array.from(localFiles);+ const [reorderedItem] = items.splice(result.source.index, 1);+ items.splice(result.destination.index, 0, reorderedItem);++ setLocalFiles(items);+ debouncedUpdateEnvelopeItems(items);+ };++ // Todo: Envelopes - Sync into envelopes data+ const debouncedUpdateEnvelopeItems = useDebounceFunction((files: LocalFile[]) => {+ void updateEnvelopeItems({+ envelopeId: envelope.id,+ data: files+ .filter((item) => item.envelopeItemId)+ .map((item, index) => ({+ envelopeItemId: item.envelopeItemId || '',+ order: index + 1,+ title: item.title,+ })),+ });+ }, 1000);++ const onEnvelopeItemTitleChange = (envelopeItemId: string, title: string) => {+ const newLocalFilesValue = localFiles.map((uploadingFile) =>+ uploadingFile.envelopeItemId === envelopeItemId ? { ...uploadingFile, title } : uploadingFile,+ );++ setLocalFiles(newLocalFilesValue);+ debouncedUpdateEnvelopeItems(newLocalFilesValue);+ };++ return (+ <div className="mx-auto max-w-4xl space-y-6 p-8">+ <Card backdropBlur={false} className="border">+ <CardHeader className="pb-3">+ <CardTitle>Documents</CardTitle>+ <CardDescription>Add and configure multiple documents</CardDescription>+ </CardHeader>++ <CardContent>+ <DocumentDropzone+ onDrop={onFileDrop}+ allowMultiple+ className="pb-4 pt-6"+ disabled={!canItemsBeModified}+ disabledMessage={msg`Cannot upload items after the document has been sent`}+ disabledHeading={msg`Upload disabled`}+ />++ {/* Uploaded Files List */}+ <div className="mt-4">+ <DragDropContext onDragEnd={onDragEnd}>+ <Droppable droppableId="files">+ {(provided) => (+ <div {...provided.droppableProps} ref={provided.innerRef} className="space-y-2">+ {localFiles.map((localFile, index) => (+ <Draggable+ key={localFile.id}+ isDragDisabled={isCreatingEnvelopeItems || !canItemsBeModified}+ draggableId={localFile.id}+ index={index}+ >+ {(provided, snapshot) => (+ <div+ ref={provided.innerRef}+ {...provided.draggableProps}+ style={provided.draggableProps.style}+ className={`flex items-center justify-between rounded-lg bg-gray-50 p-3 transition-shadow ${+ snapshot.isDragging ? 'shadow-md' : ''+ }`}+ >+ <div className="flex items-center space-x-3">+ <div+ {...provided.dragHandleProps}+ className="cursor-grab active:cursor-grabbing"+ >+ <GripVerticalIcon className="h-5 w-5 flex-shrink-0 opacity-40" />+ </div>++ <div>+ {localFile.envelopeItemId !== null ? (+ <EnvelopeItemTitleInput+ disabled={envelope.status !== DocumentStatus.DRAFT}+ value={localFile.title}+ placeholder={t`Document Title`}+ onChange={(title) => {+ onEnvelopeItemTitleChange(localFile.envelopeItemId!, title);+ }}+ />+ ) : (+ <p className="text-sm font-medium">{localFile.title}</p>+ )}++ <div className="text-xs text-gray-500">+ {localFile.isUploading ? (+ <Trans>Uploading</Trans>+ ) : localFile.isError ? (+ <Trans>Something went wrong while uploading this file</Trans>+ ) : // <div className="text-xs text-gray-500">2.4 MB • 3 pages</div>+ null}+ </div>+ </div>+ </div>+ <div className="flex items-center space-x-2">+ {localFile.isUploading && (+ <div className="flex h-6 w-10 items-center justify-center">+ <Loader2 className="h-4 w-4 animate-spin text-gray-500" />+ </div>+ )}++ {localFile.isError && (+ <div className="flex h-6 w-10 items-center justify-center">+ <FileWarningIcon className="text-destructive h-4 w-4" />+ </div>+ )}++ {!localFile.isUploading && localFile.envelopeItemId && (+ <EnvelopeItemDeleteDialog+ canItemBeDeleted={canItemsBeModified}+ envelopeId={envelope.id}+ envelopeItemId={localFile.envelopeItemId}+ envelopeItemTitle={localFile.title}+ onDelete={onFileDelete}+ trigger={+ <Button variant="ghost" size="sm">+ <X className="h-4 w-4" />+ </Button>+ }+ />+ )}+ </div>+ </div>+ )}+ </Draggable>+ ))}+ {provided.placeholder}+ </div>+ )}+ </Droppable>+ </DragDropContext>+ </div>+ </CardContent>+ </Card>++ {/* Recipients Section */}+ <EnvelopeEditorRecipientForm />++ <div className="flex justify-end">+ <Button asChild>+ <Link to={`/t/${team.url}/documents/${envelope.id}/edit?step=addFields`}>+ <Trans>Add Fields</Trans>+ </Link>+ </Button>+ </div>+ </div>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsxnew file mode 100644index 000000000..87662ac89--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx@@ -0,0 +1,941 @@+import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';++import {+ DragDropContext,+ Draggable,+ type DropResult,+ Droppable,+ type SensorAPI,+} from '@hello-pangea/dnd';+import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';+import { DocumentSigningOrder, EnvelopeType, RecipientRole, SendStatus } from '@prisma/client';+import { motion } from 'framer-motion';+import { GripVerticalIcon, HelpCircleIcon, PlusIcon, TrashIcon } from 'lucide-react';+import { useFieldArray, useForm, useWatch } from 'react-hook-form';+import { prop, sortBy } from 'remeda';+import { z } from 'zod';++import { useLimits } from '@documenso/ee/server-only/limits/provider/client';+import { useDebouncedValue } from '@documenso/lib/client-only/hooks/use-debounced-value';+import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { useCurrentOrganisation } from '@documenso/lib/client-only/providers/organisation';+import { useSession } from '@documenso/lib/client-only/providers/session';+import {+ ZRecipientActionAuthTypesSchema,+ ZRecipientAuthOptionsSchema,+} from '@documenso/lib/types/document-auth';+import { nanoid } from '@documenso/lib/universal/id';+import { canRecipientBeModified as utilCanRecipientBeModified } from '@documenso/lib/utils/recipients';+import { trpc } from '@documenso/trpc/react';+import { AnimateGenericFadeInOut } from '@documenso/ui/components/animate/animate-generic-fade-in-out';+import { RecipientActionAuthSelect } from '@documenso/ui/components/recipient/recipient-action-auth-select';+import {+ RecipientAutoCompleteInput,+ type RecipientAutoCompleteOption,+} from '@documenso/ui/components/recipient/recipient-autocomplete-input';+import { RecipientRoleSelect } from '@documenso/ui/components/recipient/recipient-role-select';+import { cn } from '@documenso/ui/lib/utils';+import { Button } from '@documenso/ui/primitives/button';+import {+ Card,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+} from '@documenso/ui/primitives/card';+import { Checkbox } from '@documenso/ui/primitives/checkbox';+import { SigningOrderConfirmation } from '@documenso/ui/primitives/document-flow/signing-order-confirmation';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { FormErrorMessage } from '@documenso/ui/primitives/form/form-error-message';+import { Input } from '@documenso/ui/primitives/input';+import { Tooltip, TooltipContent, TooltipTrigger } from '@documenso/ui/primitives/tooltip';+import { useToast } from '@documenso/ui/primitives/use-toast';++const ZEnvelopeRecipientsForm = z.object({+ signers: z.array(+ z.object({+ formId: z.string().min(1),+ id: z.number().optional(),+ email: z+ .string()+ .email({ message: msg`Invalid email`.id })+ .min(1),+ name: z.string(),+ role: z.nativeEnum(RecipientRole),+ signingOrder: z.number().optional(),+ actionAuth: z.array(ZRecipientActionAuthTypesSchema).optional().default([]),+ }),+ ),+ // Todo: Envelopes - These aren't synced to the server+ signingOrder: z.nativeEnum(DocumentSigningOrder),+ allowDictateNextSigner: z.boolean().default(false),+});++type TEnvelopeRecipientsForm = z.infer<typeof ZEnvelopeRecipientsForm>;++export const EnvelopeEditorRecipientForm = () => {+ const { envelope, setRecipientsDebounced } = useCurrentEnvelopeEditor();++ const organisation = useCurrentOrganisation();++ const { t } = useLingui();+ const { toast } = useToast();+ const { remaining } = useLimits();+ const { user } = useSession();++ const [recipientSearchQuery, setRecipientSearchQuery] = useState('');++ const debouncedRecipientSearchQuery = useDebouncedValue(recipientSearchQuery, 500);++ const initialId = useId();+ const $sensorApi = useRef<SensorAPI | null>(null);+ const isFirstRender = useRef(true);+ const { recipients, fields } = envelope;++ const { data: recipientSuggestionsData, isLoading } = trpc.recipient.suggestions.find.useQuery(+ {+ query: debouncedRecipientSearchQuery,+ },+ {+ enabled: debouncedRecipientSearchQuery.length > 1,+ },+ );++ const recipientSuggestions = recipientSuggestionsData?.results || [];++ const defaultRecipients = [+ {+ formId: initialId,+ name: '',+ email: '',+ role: RecipientRole.SIGNER,+ signingOrder: 1,+ actionAuth: [],+ },+ ];++ const form = useForm<TEnvelopeRecipientsForm>({+ resolver: zodResolver(ZEnvelopeRecipientsForm),+ mode: 'onChange', // Used for autosave purposes, maybe can try onBlur instead?+ defaultValues: {+ signers:+ recipients.length > 0+ ? sortBy(+ recipients.map((recipient, index) => ({+ id: recipient.id,+ formId: String(recipient.id),+ name: recipient.name,+ email: recipient.email,+ role: recipient.role,+ signingOrder: recipient.signingOrder ?? index + 1,+ actionAuth:+ ZRecipientAuthOptionsSchema.parse(recipient.authOptions)?.actionAuth ?? undefined,+ })),+ [prop('signingOrder'), 'asc'],+ [prop('id'), 'asc'],+ )+ : defaultRecipients,+ signingOrder: envelope.documentMeta.signingOrder,+ allowDictateNextSigner: envelope.documentMeta.allowDictateNextSigner,+ },+ });++ // Always show advanced settings if any recipient has auth options.+ const alwaysShowAdvancedSettings = useMemo(() => {+ const recipientHasAuthOptions = recipients.find((recipient) => {+ const recipientAuthOptions = ZRecipientAuthOptionsSchema.parse(recipient.authOptions);++ return (+ recipientAuthOptions.accessAuth.length > 0 || recipientAuthOptions.actionAuth.length > 0+ );+ });++ const formHasActionAuth = form+ .getValues('signers')+ .find((signer) => signer.actionAuth.length > 0);++ return recipientHasAuthOptions !== undefined || formHasActionAuth !== undefined;+ }, [recipients, form]);++ const [showAdvancedSettings, setShowAdvancedSettings] = useState(alwaysShowAdvancedSettings);+ const [showSigningOrderConfirmation, setShowSigningOrderConfirmation] = useState(false);++ const {+ setValue,+ formState: { errors, isSubmitting },+ control,+ watch,+ } = form;++ const formValues = useWatch({+ control,+ });++ const watchedSigners = watch('signers');+ const isSigningOrderSequential = watch('signingOrder') === DocumentSigningOrder.SEQUENTIAL;++ const hasAssistantRole = useMemo(() => {+ return watchedSigners.some((signer) => signer.role === RecipientRole.ASSISTANT);+ }, [watchedSigners]);++ const normalizeSigningOrders = (signers: typeof watchedSigners) => {+ return signers+ .sort((a, b) => (a.signingOrder ?? 0) - (b.signingOrder ?? 0))+ .map((signer, index) => ({ ...signer, signingOrder: index + 1 }));+ };++ const {+ append: appendSigner,+ fields: signers,+ remove: removeSigner,+ } = useFieldArray({+ control,+ name: 'signers',+ keyName: 'nativeId',+ });++ const emptySigners = useCallback(+ () => form.getValues('signers').filter((signer) => signer.email === ''),+ [form],+ );++ const emptySignerIndex = watchedSigners.findIndex((signer) => !signer.name && !signer.email);+ const isUserAlreadyARecipient = watchedSigners.some(+ (signer) => signer.email.toLowerCase() === user?.email?.toLowerCase(),+ );++ const hasDocumentBeenSent = recipients.some(+ (recipient) => recipient.sendStatus === SendStatus.SENT,+ );++ const canRecipientBeModified = (recipientId?: number) => {+ if (envelope.type === EnvelopeType.TEMPLATE) {+ return true;+ }++ if (recipientId === undefined) {+ return true;+ }++ const recipient = recipients.find((recipient) => recipient.id === recipientId);++ if (!recipient) {+ return false;+ }++ return utilCanRecipientBeModified(recipient, fields);+ };++ const onAddSigner = () => {+ appendSigner({+ formId: nanoid(12),+ name: '',+ email: '',+ role: RecipientRole.SIGNER,+ actionAuth: [],+ signingOrder: signers.length > 0 ? (signers[signers.length - 1]?.signingOrder ?? 0) + 1 : 1,+ });+ };++ const onRemoveSigner = (index: number) => {+ const signer = signers[index];++ if (!canRecipientBeModified(signer.id)) {+ toast({+ title: t`Cannot remove signer`,+ description: t`This signer has already signed the document.`,+ variant: 'destructive',+ });++ return;+ }++ const formStateIndex = form.getValues('signers').findIndex((s) => s.formId === signer.formId);+ if (formStateIndex !== -1) {+ removeSigner(formStateIndex);++ const updatedSigners = form.getValues('signers').filter((s) => s.formId !== signer.formId);++ form.setValue('signers', normalizeSigningOrders(updatedSigners), {+ shouldValidate: true,+ shouldDirty: true,+ });+ }+ };++ const onAddSelfSigner = () => {+ if (emptySignerIndex !== -1) {+ setValue(`signers.${emptySignerIndex}.name`, user?.name ?? '', {+ shouldValidate: true,+ shouldDirty: true,+ });+ setValue(`signers.${emptySignerIndex}.email`, user?.email ?? '', {+ shouldValidate: true,+ shouldDirty: true,+ });++ form.setFocus(`signers.${emptySignerIndex}.email`);+ } else {+ appendSigner(+ {+ formId: nanoid(12),+ name: user?.name ?? '',+ email: user?.email ?? '',+ role: RecipientRole.SIGNER,+ actionAuth: [],+ signingOrder:+ signers.length > 0 ? (signers[signers.length - 1]?.signingOrder ?? 0) + 1 : 1,+ },+ {+ shouldFocus: true,+ },+ );++ void form.trigger('signers');+ }+ };++ const handleRecipientAutoCompleteSelect = (+ index: number,+ suggestion: RecipientAutoCompleteOption,+ ) => {+ setValue(`signers.${index}.email`, suggestion.email);+ setValue(`signers.${index}.name`, suggestion.name || '');+ };++ const onDragEnd = useCallback(+ async (result: DropResult) => {+ if (!result.destination) return;++ const items = Array.from(watchedSigners);+ const [reorderedSigner] = items.splice(result.source.index, 1);++ // Find next valid position+ let insertIndex = result.destination.index;+ while (insertIndex < items.length && !canRecipientBeModified(items[insertIndex].id)) {+ insertIndex++;+ }++ items.splice(insertIndex, 0, reorderedSigner);++ const updatedSigners = items.map((signer, index) => ({+ ...signer,+ signingOrder: !canRecipientBeModified(signer.id) ? signer.signingOrder : index + 1,+ }));++ form.setValue('signers', updatedSigners, {+ shouldValidate: true,+ shouldDirty: true,+ });++ const lastSigner = updatedSigners[updatedSigners.length - 1];+ if (lastSigner.role === RecipientRole.ASSISTANT) {+ toast({+ title: t`Warning: Assistant as last signer`,+ description: t`Having an assistant as the last signer means they will be unable to take any action as there are no subsequent signers to assist.`,+ });+ }++ await form.trigger('signers');+ },+ [form, canRecipientBeModified, watchedSigners, toast],+ );++ const handleRoleChange = useCallback(+ (index: number, role: RecipientRole) => {+ const currentSigners = form.getValues('signers');+ const signingOrder = form.getValues('signingOrder');++ // Handle parallel to sequential conversion for assistants+ if (role === RecipientRole.ASSISTANT && signingOrder === DocumentSigningOrder.PARALLEL) {+ form.setValue('signingOrder', DocumentSigningOrder.SEQUENTIAL, {+ shouldValidate: true,+ shouldDirty: true,+ });+ toast({+ title: t`Signing order is enabled.`,+ description: t`You cannot add assistants when signing order is disabled.`,+ variant: 'destructive',+ });+ return;+ }++ const updatedSigners = currentSigners.map((signer, idx) => ({+ ...signer,+ role: idx === index ? role : signer.role,+ signingOrder: !canRecipientBeModified(signer.id) ? signer.signingOrder : idx + 1,+ }));++ form.setValue('signers', updatedSigners, {+ shouldValidate: true,+ shouldDirty: true,+ });++ if (role === RecipientRole.ASSISTANT && index === updatedSigners.length - 1) {+ toast({+ title: t`Warning: Assistant as last signer`,+ description: t`Having an assistant as the last signer means they will be unable to take any action as there are no subsequent signers to assist.`,+ });+ }+ },+ [form, toast, canRecipientBeModified],+ );++ const handleSigningOrderChange = useCallback(+ (index: number, newOrderString: string) => {+ const trimmedOrderString = newOrderString.trim();+ if (!trimmedOrderString) {+ return;+ }++ const newOrder = Number(trimmedOrderString);+ if (!Number.isInteger(newOrder) || newOrder < 1) {+ return;+ }++ const currentSigners = form.getValues('signers');+ const signer = currentSigners[index];++ // Remove signer from current position and insert at new position+ const remainingSigners = currentSigners.filter((_, idx) => idx !== index);+ const newPosition = Math.min(Math.max(0, newOrder - 1), currentSigners.length - 1);+ remainingSigners.splice(newPosition, 0, signer);++ const updatedSigners = remainingSigners.map((s, idx) => ({+ ...s,+ signingOrder: !canRecipientBeModified(s.id) ? s.signingOrder : idx + 1,+ }));++ form.setValue('signers', updatedSigners, {+ shouldValidate: true,+ shouldDirty: true,+ });++ if (signer.role === RecipientRole.ASSISTANT && newPosition === remainingSigners.length - 1) {+ toast({+ title: t`Warning: Assistant as last signer`,+ description: t`Having an assistant as the last signer means they will be unable to take any action as there are no subsequent signers to assist.`,+ });+ }+ },+ [form, canRecipientBeModified, toast],+ );++ const handleSigningOrderDisable = useCallback(() => {+ setShowSigningOrderConfirmation(false);++ const currentSigners = form.getValues('signers');+ const updatedSigners = currentSigners.map((signer) => ({+ ...signer,+ role: signer.role === RecipientRole.ASSISTANT ? RecipientRole.SIGNER : signer.role,+ }));++ form.setValue('signers', updatedSigners, {+ shouldValidate: true,+ shouldDirty: true,+ });+ form.setValue('signingOrder', DocumentSigningOrder.PARALLEL, {+ shouldValidate: true,+ shouldDirty: true,+ });+ form.setValue('allowDictateNextSigner', false, {+ shouldValidate: true,+ shouldDirty: true,+ });+ }, [form]);++ // Dupecode/Inefficient: Done because native isValid won't work for our usecase.+ useEffect(() => {+ if (isFirstRender.current) {+ isFirstRender.current = false;+ return;+ }++ const validatedFormValues = ZEnvelopeRecipientsForm.safeParse(formValues);++ if (validatedFormValues.success) {+ console.log('validatedFormValues', validatedFormValues);++ setRecipientsDebounced(validatedFormValues.data.signers);++ // Todo: Envelopes - Need to save the other data as well+ // setEnvelope+ }+ }, [formValues]);++ return (+ <Card backdropBlur={false} className="border">+ <CardHeader className="flex flex-row justify-between">+ <div>+ <CardTitle>Recipients</CardTitle>+ <CardDescription className="mt-1.5">Add recipients to your document</CardDescription>+ </div>++ <div className="flex flex-row items-center space-x-2">+ <Button+ variant="outline"+ className="flex flex-row items-center"+ size="sm"+ disabled={isSubmitting || isUserAlreadyARecipient}+ onClick={() => onAddSelfSigner()}+ >+ <Trans>Add Myself</Trans>+ </Button>++ <Button+ variant="outline"+ type="button"+ className="flex-1"+ size="sm"+ disabled={isSubmitting || signers.length >= remaining.recipients}+ onClick={() => onAddSigner()}+ >+ <PlusIcon className="-ml-1 mr-1 h-5 w-5" />+ <Trans>Add Signer</Trans>+ </Button>+ </div>+ </CardHeader>++ <CardContent>+ <AnimateGenericFadeInOut motionKey={showAdvancedSettings ? 'Show' : 'Hide'}>+ <Form {...form}>+ <div className="-mt-2 mb-2 space-y-4 rounded-md bg-gray-50/80 p-4">+ {!alwaysShowAdvancedSettings && organisation.organisationClaim.flags.cfr21 && (+ <div className="flex flex-row items-center">+ <Checkbox+ id="showAdvancedRecipientSettings"+ className="h-5 w-5"+ checked={showAdvancedSettings}+ onCheckedChange={(value) => setShowAdvancedSettings(Boolean(value))}+ />++ <label+ className="text-muted-foreground ml-2 text-sm"+ htmlFor="showAdvancedRecipientSettings"+ >+ <Trans>Show advanced settings</Trans>+ </label>+ </div>+ )}++ <FormField+ control={form.control}+ name="signingOrder"+ render={({ field }) => (+ <FormItem className="flex flex-row items-center space-x-2 space-y-0">+ <FormControl>+ <Checkbox+ {...field}+ id="signingOrder"+ checked={field.value === DocumentSigningOrder.SEQUENTIAL}+ onCheckedChange={(checked) => {+ if (!checked && hasAssistantRole) {+ setShowSigningOrderConfirmation(true);+ return;+ }++ field.onChange(+ checked+ ? DocumentSigningOrder.SEQUENTIAL+ : DocumentSigningOrder.PARALLEL,+ );++ // If sequential signing is turned off, disable dictate next signer+ if (!checked) {+ form.setValue('allowDictateNextSigner', false, {+ shouldValidate: true,+ shouldDirty: true,+ });+ }+ }}+ disabled={+ isSubmitting || hasDocumentBeenSent || emptySigners().length !== 0+ }+ />+ </FormControl>++ <div className="flex items-center text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">+ <FormLabel+ htmlFor="signingOrder"+ className="text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"+ >+ <Trans>Enable signing order</Trans>+ </FormLabel>++ <Tooltip>+ <TooltipTrigger asChild>+ <span className="text-muted-foreground ml-1 cursor-help">+ <HelpCircleIcon className="h-3.5 w-3.5" />+ </span>+ </TooltipTrigger>+ <TooltipContent className="max-w-80 p-4">+ <p>+ <Trans>Add 2 or more signers to enable signing order.</Trans>+ </p>+ </TooltipContent>+ </Tooltip>+ </div>+ </FormItem>+ )}+ />++ {isSigningOrderSequential && (+ <FormField+ control={form.control}+ name="allowDictateNextSigner"+ render={({ field: { value, ...field } }) => (+ <FormItem className="flex flex-row items-center space-x-2 space-y-0">+ <FormControl>+ <Checkbox+ {...field}+ id="allowDictateNextSigner"+ checked={value}+ onCheckedChange={(checked) => {+ field.onChange(checked);+ }}+ disabled={+ isSubmitting || hasDocumentBeenSent || !isSigningOrderSequential+ }+ />+ </FormControl>++ <div className="flex items-center text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">+ <FormLabel+ htmlFor="allowDictateNextSigner"+ className="text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"+ >+ <Trans>Allow signers to dictate next signer</Trans>+ </FormLabel>++ <Tooltip>+ <TooltipTrigger asChild>+ <span className="text-muted-foreground ml-1 cursor-help">+ <HelpCircleIcon className="h-3.5 w-3.5" />+ </span>+ </TooltipTrigger>+ <TooltipContent className="max-w-80 p-4">+ <p>+ <Trans>+ When enabled, signers can choose who should sign next in the+ sequence instead of following the predefined order.+ </Trans>+ </p>+ </TooltipContent>+ </Tooltip>+ </div>+ </FormItem>+ )}+ />+ )}+ </div>++ <DragDropContext+ onDragEnd={onDragEnd}+ sensors={[+ (api: SensorAPI) => {+ $sensorApi.current = api;+ },+ ]}+ >+ <Droppable droppableId="signers">+ {(provided) => (+ <div+ {...provided.droppableProps}+ ref={provided.innerRef}+ className="flex w-full flex-col gap-y-2"+ >+ {signers.map((signer, index) => (+ <Draggable+ key={`${signer.id}-${signer.signingOrder}`}+ draggableId={signer['nativeId']}+ index={index}+ isDragDisabled={+ !isSigningOrderSequential ||+ isSubmitting ||+ !canRecipientBeModified(signer.id) ||+ !signer.signingOrder+ }+ >+ {(provided, snapshot) => (+ <div+ ref={provided.innerRef}+ {...provided.draggableProps}+ {...provided.dragHandleProps}+ className={cn('py-1', {+ 'bg-widget-foreground pointer-events-none rounded-md pt-2':+ snapshot.isDragging,+ })}+ >+ <motion.fieldset+ data-native-id={signer.id}+ disabled={isSubmitting || !canRecipientBeModified(signer.id)}+ className={cn('grid grid-cols-10 items-end gap-2 pb-2', {+ 'border-b pt-2': showAdvancedSettings,+ 'grid-cols-12 pr-3': isSigningOrderSequential,+ })}+ >+ {isSigningOrderSequential && (+ <FormField+ control={form.control}+ name={`signers.${index}.signingOrder`}+ render={({ field }) => (+ <FormItem+ className={cn(+ 'col-span-1 mt-auto flex items-center gap-x-1 space-y-0',+ {+ 'mb-6':+ form.formState.errors.signers?.[index] &&+ !form.formState.errors.signers[index]?.signingOrder,+ },+ )}+ >+ <GripVerticalIcon className="h-5 w-5 flex-shrink-0 opacity-40" />+ <FormControl>+ <Input+ type="number"+ max={signers.length}+ data-testid="signing-order-input"+ className={cn(+ 'w-full text-center',+ '[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',+ )}+ {...field}+ onChange={(e) => {+ field.onChange(e);+ handleSigningOrderChange(index, e.target.value);+ }}+ onBlur={(e) => {+ field.onBlur();+ handleSigningOrderChange(index, e.target.value);+ }}+ disabled={+ snapshot.isDragging ||+ isSubmitting ||+ !canRecipientBeModified(signer.id)+ }+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ )}++ <FormField+ control={form.control}+ name={`signers.${index}.email`}+ render={({ field }) => (+ <FormItem+ className={cn('relative', {+ 'mb-6':+ form.formState.errors.signers?.[index] &&+ !form.formState.errors.signers[index]?.email,+ 'col-span-4': !showAdvancedSettings,+ 'col-span-5': showAdvancedSettings,+ })}+ >+ {!showAdvancedSettings && index === 0 && (+ <FormLabel required>+ <Trans>Email</Trans>+ </FormLabel>+ )}++ <FormControl>+ <RecipientAutoCompleteInput+ type="email"+ placeholder={t`Email`}+ value={field.value}+ disabled={+ snapshot.isDragging ||+ isSubmitting ||+ !canRecipientBeModified(signer.id)+ }+ options={recipientSuggestions}+ onSelect={(suggestion) =>+ handleRecipientAutoCompleteSelect(index, suggestion)+ }+ onSearchQueryChange={(query) => {+ field.onChange(query);+ setRecipientSearchQuery(query);+ }}+ loading={isLoading}+ data-testid="signer-email-input"+ maxLength={254}+ />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name={`signers.${index}.name`}+ render={({ field }) => (+ <FormItem+ className={cn({+ 'mb-6':+ form.formState.errors.signers?.[index] &&+ !form.formState.errors.signers[index]?.name,+ 'col-span-4': !showAdvancedSettings,+ 'col-span-5': showAdvancedSettings,+ })}+ >+ {!showAdvancedSettings && index === 0 && (+ <FormLabel>+ <Trans>Name</Trans>+ </FormLabel>+ )}++ <FormControl>+ <RecipientAutoCompleteInput+ type="text"+ placeholder={t`Name`}+ {...field}+ disabled={+ snapshot.isDragging ||+ isSubmitting ||+ !canRecipientBeModified(signer.id)+ }+ options={recipientSuggestions}+ onSelect={(suggestion) =>+ handleRecipientAutoCompleteSelect(index, suggestion)+ }+ onSearchQueryChange={(query) => {+ field.onChange(query);+ setRecipientSearchQuery(query);+ }}+ loading={isLoading}+ maxLength={255}+ />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ {showAdvancedSettings &&+ organisation.organisationClaim.flags.cfr21 && (+ <FormField+ control={form.control}+ name={`signers.${index}.actionAuth`}+ render={({ field }) => (+ <FormItem+ className={cn('col-span-8', {+ 'mb-6':+ form.formState.errors.signers?.[index] &&+ !form.formState.errors.signers[index]?.actionAuth,+ 'col-span-10': isSigningOrderSequential,+ })}+ >+ <FormControl>+ <RecipientActionAuthSelect+ {...field}+ onValueChange={field.onChange}+ disabled={+ snapshot.isDragging ||+ isSubmitting ||+ !canRecipientBeModified(signer.id)+ }+ />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ )}++ <div className="col-span-2 flex gap-x-2">+ <FormField+ control={form.control}+ name={`signers.${index}.role`}+ render={({ field }) => (+ <FormItem+ className={cn('mt-auto', {+ 'mb-6':+ form.formState.errors.signers?.[index] &&+ !form.formState.errors.signers[index]?.role,+ })}+ >+ <FormControl>+ <RecipientRoleSelect+ {...field}+ isAssistantEnabled={isSigningOrderSequential}+ onValueChange={(value) => {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ handleRoleChange(index, value as RecipientRole);+ }}+ disabled={+ snapshot.isDragging ||+ isSubmitting ||+ !canRecipientBeModified(signer.id)+ }+ />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <button+ type="button"+ className={cn(+ 'mt-auto inline-flex h-10 w-10 items-center justify-center hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50',+ {+ 'mb-6': form.formState.errors.signers?.[index],+ },+ )}+ data-testid="remove-signer-button"+ disabled={+ snapshot.isDragging ||+ isSubmitting ||+ !canRecipientBeModified(signer.id) ||+ signers.length === 1+ }+ onClick={() => onRemoveSigner(index)}+ >+ <TrashIcon className="h-4 w-4" />+ </button>+ </div>+ </motion.fieldset>+ </div>+ )}+ </Draggable>+ ))}++ {provided.placeholder}+ </div>+ )}+ </Droppable>+ </DragDropContext>++ <FormErrorMessage+ className="mt-2"+ // Dirty hack to handle errors when .root is populated for an array type+ error={'signers__root' in errors && errors['signers__root']}+ />+ </Form>+ </AnimateGenericFadeInOut>++ <SigningOrderConfirmation+ open={showSigningOrderConfirmation}+ onOpenChange={setShowSigningOrderConfirmation}+ onConfirm={handleSigningOrderDisable}+ />+ </CardContent>+ </Card>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxnew file mode 100644index 000000000..22f700175--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx@@ -0,0 +1,832 @@+import { useEffect, useState } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';+import {+ DocumentDistributionMethod,+ DocumentVisibility,+ EnvelopeType,+ SendStatus,+} from '@prisma/client';+import type * as DialogPrimitive from '@radix-ui/react-dialog';+import { InfoIcon, MailIcon, SettingsIcon, ShieldIcon } from 'lucide-react';+import { useForm } from 'react-hook-form';+import { match } from 'ts-pattern';+import { z } from 'zod';++import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { useCurrentOrganisation } from '@documenso/lib/client-only/providers/organisation';+import { DATE_FORMATS, DEFAULT_DOCUMENT_DATE_FORMAT } from '@documenso/lib/constants/date-formats';+import {+ DOCUMENT_DISTRIBUTION_METHODS,+ DOCUMENT_SIGNATURE_TYPES,+} from '@documenso/lib/constants/document';+import {+ SUPPORTED_LANGUAGES,+ SUPPORTED_LANGUAGE_CODES,+ isValidLanguageCode,+} from '@documenso/lib/constants/i18n';+import { DEFAULT_DOCUMENT_TIME_ZONE, TIME_ZONES } from '@documenso/lib/constants/time-zones';+import { AppError } from '@documenso/lib/errors/app-error';+import {+ ZDocumentAccessAuthTypesSchema,+ ZDocumentActionAuthTypesSchema,+} from '@documenso/lib/types/document-auth';+import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';+import {+ type TDocumentMetaDateFormat,+ ZDocumentMetaDateFormatSchema,+ ZDocumentMetaTimezoneSchema,+} from '@documenso/lib/types/document-meta';+import { extractDocumentAuthMethods } from '@documenso/lib/utils/document-auth';+import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';+import {+ DocumentSignatureType,+ canAccessTeamDocument,+ extractTeamSignatureSettings,+} from '@documenso/lib/utils/teams';+import { trpc } from '@documenso/trpc/react';+import { DocumentEmailCheckboxes } from '@documenso/ui/components/document/document-email-checkboxes';+import {+ DocumentGlobalAuthAccessSelect,+ DocumentGlobalAuthAccessTooltip,+} from '@documenso/ui/components/document/document-global-auth-access-select';+import {+ DocumentGlobalAuthActionSelect,+ DocumentGlobalAuthActionTooltip,+} from '@documenso/ui/components/document/document-global-auth-action-select';+import { DocumentSendEmailMessageHelper } from '@documenso/ui/components/document/document-send-email-message-helper';+import { DocumentSignatureSettingsTooltip } from '@documenso/ui/components/document/document-signature-settings-tooltip';+import {+ DocumentVisibilitySelect,+ DocumentVisibilityTooltip,+} from '@documenso/ui/components/document/document-visibility-select';+import { cn } from '@documenso/ui/lib/utils';+import { Button } from '@documenso/ui/primitives/button';+import { CardDescription, CardHeader, CardTitle } from '@documenso/ui/primitives/card';+import { Combobox } from '@documenso/ui/primitives/combobox';+import {+ Dialog,+ DialogClose,+ DialogContent,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+} from '@documenso/ui/primitives/dialog';+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormLabel,+ FormMessage,+} from '@documenso/ui/primitives/form/form';+import { Input } from '@documenso/ui/primitives/input';+import { MultiSelectCombobox } from '@documenso/ui/primitives/multi-select-combobox';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@documenso/ui/primitives/select';+import { Textarea } from '@documenso/ui/primitives/textarea';+import { Tooltip, TooltipContent, TooltipTrigger } from '@documenso/ui/primitives/tooltip';+import { useToast } from '@documenso/ui/primitives/use-toast';++import { useCurrentTeam } from '~/providers/team';++export const ZAddSettingsFormSchema = z.object({+ externalId: z.string().optional(),+ visibility: z.nativeEnum(DocumentVisibility).optional(),+ globalAccessAuth: z+ .array(z.union([ZDocumentAccessAuthTypesSchema, z.literal('-1')]))+ .transform((val) => (val.length === 1 && val[0] === '-1' ? [] : val))+ .optional()+ .default([]),+ globalActionAuth: z.array(ZDocumentActionAuthTypesSchema).optional().default([]),+ meta: z.object({+ subject: z.string(),+ message: z.string(),+ timezone: ZDocumentMetaTimezoneSchema.default(DEFAULT_DOCUMENT_TIME_ZONE),+ dateFormat: ZDocumentMetaDateFormatSchema.default(DEFAULT_DOCUMENT_DATE_FORMAT),+ distributionMethod: z+ .nativeEnum(DocumentDistributionMethod)+ .optional()+ .default(DocumentDistributionMethod.EMAIL),+ redirectUrl: z+ .string()+ .optional()+ .refine((value) => value === undefined || value === '' || isValidRedirectUrl(value), {+ message:+ 'Please enter a valid URL, make sure you include http:// or https:// part of the url.',+ }),+ language: z+ .union([z.string(), z.enum(SUPPORTED_LANGUAGE_CODES)])+ .optional()+ .default('en'),+ emailId: z.string().nullable(),+ emailReplyTo: z.preprocess(+ (val) => (val === '' ? undefined : val),+ z.string().email().optional(),+ ),+ emailSettings: ZDocumentEmailSettingsSchema,+ signatureTypes: z.array(z.nativeEnum(DocumentSignatureType)).min(1, {+ message: msg`At least one signature type must be enabled`.id,+ }),+ }),+});++type EnvelopeEditorSettingsTabType = 'general' | 'email' | 'security';++const tabs = [+ {+ id: 'general',+ title: msg`General`,+ icon: SettingsIcon,+ description: msg`Configure document settings and options before sending.`,+ },+ {+ id: 'email',+ title: msg`Email`,+ icon: MailIcon,+ description: msg`Configure email settings for the document`,+ },+ {+ id: 'security',+ title: msg`Security`,+ icon: ShieldIcon,+ description: msg`Configure security settings for the document`,+ },+] as const;++type TAddSettingsFormSchema = z.infer<typeof ZAddSettingsFormSchema>;++type EnvelopeEditorSettingsDialogProps = {+ trigger?: React.ReactNode;+} & Omit<DialogPrimitive.DialogProps, 'children'>;++export const EnvelopeEditorSettingsDialog = ({+ trigger,+ ...props+}: EnvelopeEditorSettingsDialogProps) => {+ const { t, i18n } = useLingui();+ const { toast } = useToast();++ const { envelope } = useCurrentEnvelopeEditor();++ const team = useCurrentTeam();+ const organisation = useCurrentOrganisation();++ const [open, setOpen] = useState(false);+ const [activeTab, setActiveTab] = useState<EnvelopeEditorSettingsTabType>('general');++ const { documentAuthOption } = extractDocumentAuthMethods({+ documentAuth: envelope.authOptions,+ });++ const form = useForm<TAddSettingsFormSchema>({+ resolver: zodResolver(ZAddSettingsFormSchema),+ defaultValues: {+ externalId: envelope.externalId || '', // Todo: String or undefined?+ visibility: envelope.visibility || '',+ globalAccessAuth: documentAuthOption?.globalAccessAuth || [],+ globalActionAuth: documentAuthOption?.globalActionAuth || [],++ meta: {+ subject: envelope.documentMeta.subject ?? '',+ message: envelope.documentMeta.message ?? '',+ timezone: envelope.documentMeta.timezone ?? DEFAULT_DOCUMENT_TIME_ZONE,+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ dateFormat: (envelope.documentMeta.dateFormat ??+ DEFAULT_DOCUMENT_DATE_FORMAT) as TDocumentMetaDateFormat,+ distributionMethod:+ envelope.documentMeta.distributionMethod || DocumentDistributionMethod.EMAIL,+ redirectUrl: envelope.documentMeta.redirectUrl ?? '',+ language: envelope.documentMeta.language ?? 'en',+ emailId: envelope.documentMeta.emailId ?? null,+ emailReplyTo: envelope.documentMeta.emailReplyTo ?? undefined,+ emailSettings: ZDocumentEmailSettingsSchema.parse(envelope.documentMeta.emailSettings),+ signatureTypes: extractTeamSignatureSettings(envelope.documentMeta),+ },+ },+ });++ const { mutateAsync: updateEnvelope } = trpc.envelope.update.useMutation();++ // Todo: Envelopes - Extract into provider.+ const envelopeHasBeenSent =+ envelope.type === EnvelopeType.DOCUMENT &&+ envelope.recipients.some((recipient) => recipient.sendStatus === SendStatus.SENT);++ const emailSettings = form.watch('meta.emailSettings');++ const { data: emailData, isLoading: isLoadingEmails } =+ trpc.enterprise.organisation.email.find.useQuery({+ organisationId: organisation.id,+ perPage: 100,+ });++ const emails = emailData?.data || [];++ // Todo: Envelopes this doesn't make sense (look at previous)+ const canUpdateVisibility = canAccessTeamDocument(team.currentTeamRole, envelope.visibility);++ const onFormSubmit = async (data: TAddSettingsFormSchema) => {+ const { timezone, dateFormat, redirectUrl, language, signatureTypes } = data.meta;++ const parsedGlobalAccessAuth = z+ .array(ZDocumentAccessAuthTypesSchema)+ .safeParse(data.globalAccessAuth);++ try {+ await updateEnvelope({+ envelopeId: envelope.id,+ envelopeType: envelope.type,+ data: {+ externalId: data.externalId || null,+ visibility: data.visibility,+ globalAccessAuth: parsedGlobalAccessAuth.success ? parsedGlobalAccessAuth.data : [],+ globalActionAuth: data.globalActionAuth ?? [],+ },+ meta: {+ timezone,+ dateFormat,+ redirectUrl,+ language: isValidLanguageCode(language) ? language : undefined,+ typedSignatureEnabled: signatureTypes.includes(DocumentSignatureType.TYPE),+ uploadSignatureEnabled: signatureTypes.includes(DocumentSignatureType.UPLOAD),+ drawSignatureEnabled: signatureTypes.includes(DocumentSignatureType.DRAW),+ },+ });++ setOpen(false);++ toast({+ title: t`Success`,+ description: t`Envelope updated`,+ duration: 5000,+ });+ } catch (err) {+ const error = AppError.parseError(err);++ console.error(error);++ toast({+ title: t`An unknown error occurred`,+ description: t`We encountered an unknown error while attempting to update the envelope. Please try again later.`,+ variant: 'destructive',+ });+ }+ };++ useEffect(() => {+ if (+ !form.formState.touchedFields.meta?.timezone &&+ !envelopeHasBeenSent &&+ !envelope.documentMeta.timezone+ ) {+ form.setValue('meta.timezone', Intl.DateTimeFormat().resolvedOptions().timeZone);+ }+ }, [+ envelopeHasBeenSent,+ form,+ form.setValue,+ form.formState.touchedFields.meta?.timezone,+ envelope.documentMeta.timezone,+ ]);++ useEffect(() => {+ form.reset();+ setActiveTab('general');+ }, [open, form]);++ // Todo: Envelopes - Show error indicator if error is in different tab.++ const selectedTab = tabs.find((tab) => tab.id === activeTab);++ if (!selectedTab) {+ return null;+ }++ return (+ <Dialog+ {...props}+ open={open}+ onOpenChange={(value) => !form.formState.isSubmitting && setOpen(value)}+ >+ <DialogTrigger onClick={(e) => e.stopPropagation()} asChild={true}>+ {trigger ?? (+ <Button className="flex-shrink-0" variant="secondary">+ <Trans>Settings</Trans>+ </Button>+ )}+ </DialogTrigger>++ <DialogContent className="flex w-full !max-w-5xl flex-row gap-0 p-0">+ {/* Sidebar. */}+ <div className="flex w-80 flex-col border-r bg-gray-50">+ <DialogHeader className="p-6 pb-4">+ <DialogTitle>Document Settings</DialogTitle>+ </DialogHeader>++ <nav className="col-span-12 mb-8 flex flex-wrap items-center justify-start gap-x-2 gap-y-4 px-4 md:col-span-3 md:w-full md:flex-col md:items-start md:gap-y-2">+ {tabs.map((tab) => (+ <Button+ key={tab.id}+ onClick={() => setActiveTab(tab.id)}+ variant="ghost"+ className={cn('w-full justify-start', {+ 'bg-secondary': activeTab === tab.id,+ })}+ >+ <tab.icon className="mr-2 h-5 w-5" />+ {t(tab.title)}+ </Button>+ ))}+ </nav>+ </div>++ {/* Content. */}+ <div className="flex w-full flex-col">+ <CardHeader className="border-b pb-4">+ <CardTitle>{t(selectedTab?.title ?? '')}</CardTitle>+ <CardDescription>{t(selectedTab?.description ?? '')}</CardDescription>+ </CardHeader>++ <Form {...form}>+ <form onSubmit={form.handleSubmit(onFormSubmit)}>+ <fieldset+ className="flex min-h-[45rem] w-full flex-col space-y-6 px-6 pt-6"+ disabled={form.formState.isSubmitting}+ key={activeTab}+ >+ {match(activeTab)+ .with('general', () => (+ <>+ <FormField+ control={form.control}+ name="meta.language"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="inline-flex items-center">+ <Trans>Language</Trans>+ <Tooltip>+ <TooltipTrigger>+ <InfoIcon className="mx-2 h-4 w-4" />+ </TooltipTrigger>++ <TooltipContent className="text-foreground max-w-md space-y-2 p-4">+ <Trans>+ Controls the language for the document, including the language+ to be used for email notifications, and the final certificate+ that is generated and attached to the document.+ </Trans>+ </TooltipContent>+ </Tooltip>+ </FormLabel>++ <FormControl>+ <Select+ value={field.value}+ disabled={field.disabled}+ onValueChange={field.onChange}+ >+ <SelectTrigger className="bg-background">+ <SelectValue />+ </SelectTrigger>++ <SelectContent>+ {Object.entries(SUPPORTED_LANGUAGES).map(([code, language]) => (+ <SelectItem key={code} value={code}>+ {language.full}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="meta.signatureTypes"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Allowed Signature Types</Trans>+ <DocumentSignatureSettingsTooltip />+ </FormLabel>++ <FormControl>+ <MultiSelectCombobox+ options={Object.values(DOCUMENT_SIGNATURE_TYPES).map((option) => ({+ label: t(option.label),+ value: option.value,+ }))}+ selectedValues={field.value}+ onChange={field.onChange}+ className="bg-background w-full"+ emptySelectionPlaceholder="Select signature types"+ />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="meta.dateFormat"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Date Format</Trans>+ </FormLabel>++ <FormControl>+ <Select+ value={field.value}+ onValueChange={field.onChange}+ disabled={envelopeHasBeenSent}+ >+ <SelectTrigger className="bg-background">+ <SelectValue />+ </SelectTrigger>++ <SelectContent>+ {DATE_FORMATS.map((format) => (+ <SelectItem key={format.key} value={format.value}>+ {format.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="meta.timezone"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Time Zone</Trans>+ </FormLabel>++ <FormControl>+ <Combobox+ className="bg-background"+ options={TIME_ZONES}+ value={field.value}+ onChange={(value) => value && field.onChange(value)}+ disabled={envelopeHasBeenSent}+ />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="externalId"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>External ID</Trans>{' '}+ <Tooltip>+ <TooltipTrigger>+ <InfoIcon className="mx-2 h-4 w-4" />+ </TooltipTrigger>++ <TooltipContent className="text-muted-foreground max-w-xs">+ <Trans>+ Add an external ID to the document. This can be used to identify+ the document in external systems.+ </Trans>+ </TooltipContent>+ </Tooltip>+ </FormLabel>++ <FormControl>+ <Input className="bg-background" {...field} />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="meta.redirectUrl"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Redirect URL</Trans>{' '}+ <Tooltip>+ <TooltipTrigger>+ <InfoIcon className="mx-2 h-4 w-4" />+ </TooltipTrigger>++ <TooltipContent className="text-muted-foreground max-w-xs">+ <Trans>+ Add a URL to redirect the user to once the document is signed+ </Trans>+ </TooltipContent>+ </Tooltip>+ </FormLabel>++ <FormControl>+ <Input className="bg-background" {...field} />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ <FormField+ control={form.control}+ name="meta.distributionMethod"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Document Distribution Method</Trans>+ <Tooltip>+ <TooltipTrigger>+ <InfoIcon className="mx-2 h-4 w-4" />+ </TooltipTrigger>++ <TooltipContent className="text-foreground max-w-md space-y-2 p-4">+ <h2>+ <strong>+ <Trans>Document Distribution Method</Trans>+ </strong>+ </h2>++ <p>+ <Trans>+ This is how the document will reach the recipients once the+ document is ready for signing.+ </Trans>+ </p>++ <ul className="ml-3.5 list-outside list-disc space-y-0.5 py-2">+ <li>+ <Trans>+ <strong>Email</strong> - The recipient will be emailed the+ document to sign, approve, etc.+ </Trans>+ </li>+ <li>+ <Trans>+ <strong>None</strong> - We will generate links which you can+ send to the recipients manually.+ </Trans>+ </li>+ </ul>++ <Trans>+ <strong>Note</strong> - If you use Links in combination with+ direct templates, you will need to manually send the links to+ the remaining recipients.+ </Trans>+ </TooltipContent>+ </Tooltip>+ </FormLabel>++ <FormControl>+ <Select {...field} onValueChange={field.onChange}>+ <SelectTrigger className="bg-background text-muted-foreground">+ <SelectValue data-testid="documentDistributionMethodSelectValue" />+ </SelectTrigger>++ <SelectContent position="popper">+ {Object.values(DOCUMENT_DISTRIBUTION_METHODS).map(+ ({ value, description }) => (+ <SelectItem key={value} value={value}>+ {i18n._(description)}+ </SelectItem>+ ),+ )}+ </SelectContent>+ </Select>+ </FormControl>+ </FormItem>+ )}+ />+ </>+ ))+ .with('email', () => (+ <>+ {organisation.organisationClaim.flags.emailDomains && (+ <FormField+ control={form.control}+ name="meta.emailId"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Email Sender</Trans>+ </FormLabel>++ <FormControl>+ <Select+ {...field}+ value={field.value === null ? '-1' : field.value}+ onValueChange={(value) =>+ field.onChange(value === '-1' ? null : value)+ }+ >+ <SelectTrigger+ loading={isLoadingEmails}+ className="bg-background"+ >+ <SelectValue />+ </SelectTrigger>++ <SelectContent>+ {emails.map((email) => (+ <SelectItem key={email.id} value={email.id}>+ {email.email}+ </SelectItem>+ ))}++ <SelectItem value={'-1'}>Documenso</SelectItem>+ </SelectContent>+ </Select>+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />+ )}++ <FormField+ control={form.control}+ name="meta.emailReplyTo"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>Reply To Email</Trans>{' '}+ <span className="text-muted-foreground">(Optional)</span>+ </FormLabel>++ <FormControl>+ <Input {...field} />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="meta.subject"+ render={({ field }) => (+ <FormItem>+ <FormLabel>+ <Trans>+ Subject <span className="text-muted-foreground">(Optional)</span>+ </Trans>+ </FormLabel>++ <FormControl>+ <Input {...field} />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="meta.message"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Message</Trans>{' '}+ <span className="text-muted-foreground">(Optional)</span>+ <Tooltip>+ <TooltipTrigger>+ <InfoIcon className="mx-2 h-4 w-4" />+ </TooltipTrigger>+ <TooltipContent className="text-muted-foreground p-4">+ <DocumentSendEmailMessageHelper />+ </TooltipContent>+ </Tooltip>+ </FormLabel>++ <FormControl>+ <Textarea className="bg-background h-16 resize-none" {...field} />+ </FormControl>++ <FormMessage />+ </FormItem>+ )}+ />++ <DocumentEmailCheckboxes+ value={emailSettings}+ onChange={(value) => form.setValue('meta.emailSettings', value)}+ />+ </>+ ))+ .with('security', () => (+ <>+ {organisation.organisationClaim.flags.cfr21 && (+ <FormField+ control={form.control}+ name="globalActionAuth"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Recipient action authentication</Trans>+ <DocumentGlobalAuthActionTooltip />+ </FormLabel>++ <FormControl>+ <DocumentGlobalAuthActionSelect+ value={field.value}+ disabled={field.disabled}+ onValueChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />+ )}++ <FormField+ control={form.control}+ name="globalAccessAuth"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Document access</Trans>+ <DocumentGlobalAuthAccessTooltip />+ </FormLabel>++ <FormControl>+ <DocumentGlobalAuthAccessSelect+ value={field.value}+ disabled={field.disabled}+ onValueChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />++ <FormField+ control={form.control}+ name="visibility"+ render={({ field }) => (+ <FormItem>+ <FormLabel className="flex flex-row items-center">+ <Trans>Document visibility</Trans>+ <DocumentVisibilityTooltip />+ </FormLabel>++ <FormControl>+ <DocumentVisibilitySelect+ canUpdateVisibility={canUpdateVisibility}+ currentTeamMemberRole={team.currentTeamRole}+ {...field}+ onValueChange={field.onChange}+ />+ </FormControl>+ </FormItem>+ )}+ />+ </>+ ))+ .exhaustive()}+ </fieldset>++ <div className="flex flex-row justify-end gap-4 p-6">+ <DialogClose asChild>+ <Button variant="secondary" disabled={form.formState.isSubmitting}>+ <Trans>Cancel</Trans>+ </Button>+ </DialogClose>++ <Button type="submit" loading={form.formState.isSubmitting}>+ <Trans>Update</Trans>+ </Button>+ </div>+ </form>+ </Form>+ </div>+ </DialogContent>+ </Dialog>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-title-input.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-title-input.tsxnew file mode 100644index 000000000..5f389a41a--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-title-input.tsx@@ -0,0 +1,85 @@+import { useEffect, useRef, useState } from 'react';++import { ZDocumentTitleSchema } from '@documenso/trpc/server/document-router/schema';+import { cn } from '@documenso/ui/lib/utils';++export type EnvelopeItemTitleInputProps = {+ value: string;+ onChange: (value: string) => void;+ className?: string;+ placeholder?: string;+ disabled?: boolean;+};++export const EnvelopeItemTitleInput = ({+ value,+ onChange,+ className,+ placeholder,+ disabled,+}: EnvelopeItemTitleInputProps) => {+ const [envelopeItemTitle, setEnvelopeItemTitle] = useState(value);+ const [isError, setIsError] = useState(false);++ const [inputWidth, setInputWidth] = useState(200);+ const inputRef = useRef<HTMLInputElement>(null);+ const measureRef = useRef<HTMLSpanElement>(null);++ // Update input width based on content+ useEffect(() => {+ if (measureRef.current) {+ const width = measureRef.current.offsetWidth;+ setInputWidth(Math.max(width + 16, 100)); // Add padding and minimum width+ }+ }, [envelopeItemTitle]);++ const handleTitleChange = (title: string) => {+ if (title === '') {+ setIsError(true);+ }++ setEnvelopeItemTitle(title);++ const parsedTitle = ZDocumentTitleSchema.safeParse(title);++ if (!parsedTitle.success) {+ setIsError(true);+ return;+ }++ setIsError(false);++ onChange(parsedTitle.data);+ };++ return (+ <div className="relative">+ {/* Hidden span to measure text width */}+ <span+ ref={measureRef}+ className="pointer-events-none absolute left-0 top-0 whitespace-nowrap text-sm font-medium text-gray-600 opacity-0"+ style={{ font: 'inherit' }}+ >+ {envelopeItemTitle || placeholder}+ </span>+ <input+ data-1p-ignore+ autoComplete="off"+ ref={inputRef}+ type="text"+ value={envelopeItemTitle}+ onChange={(e) => handleTitleChange(e.target.value)}+ disabled={disabled}+ style={{ width: `${inputWidth}px` }}+ className={cn(+ 'text-foreground hover:outline-muted-foreground focus:outline-muted-foreground rounded-sm border-0 bg-transparent p-1 text-sm font-medium outline-none hover:outline hover:outline-1 focus:outline focus:outline-1',+ className,+ {+ 'outline-red-500': isError,+ },+ )}+ placeholder={placeholder}+ />+ </div>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor.tsxnew file mode 100644index 000000000..1fb98a3e7--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor.tsx@@ -0,0 +1,356 @@+import { useEffect, useState } from 'react';++import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';+import { motion } from 'framer-motion';+import {+ ArrowLeftIcon,+ CopyPlusIcon,+ DownloadCloudIcon,+ EyeIcon,+ LinkIcon,+ MousePointer,+ SendIcon,+ SettingsIcon,+ Trash2Icon,+ Upload,+} from 'lucide-react';+import { useNavigate, useSearchParams } from 'react-router';+import { Link } from 'react-router';+import { match } from 'ts-pattern';++import { useCurrentEnvelopeEditor } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import {+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';+import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams';+import { AnimateGenericFadeInOut } from '@documenso/ui/components/animate/animate-generic-fade-in-out';+import { Button } from '@documenso/ui/primitives/button';+import { Separator } from '@documenso/ui/primitives/separator';+import { SpinnerBox } from '@documenso/ui/primitives/spinner';++import { DocumentDeleteDialog } from '~/components/dialogs/document-delete-dialog';+import { EnvelopeDistributeDialog } from '~/components/dialogs/envelope-distribute-dialog';+import { EnvelopeDuplicateDialog } from '~/components/dialogs/envelope-duplicate-dialog';+import { EnvelopeRedistributeDialog } from '~/components/dialogs/envelope-redistribute-dialog';+import { TemplateDeleteDialog } from '~/components/dialogs/template-delete-dialog';+import { TemplateDirectLinkDialog } from '~/components/dialogs/template-direct-link-dialog';+import { EnvelopeEditorSettingsDialog } from '~/components/general/envelope-editor/envelope-editor-settings-dialog';+import { useCurrentTeam } from '~/providers/team';++import EnvelopeEditorHeader from './envelope-editor-header';+import { EnvelopeEditorPageFields } from './envelope-editor-page-fields';+import { EnvelopeEditorPagePreview } from './envelope-editor-page-preview';+import { EnvelopeEditorPageUpload } from './envelope-editor-page-upload';++type EnvelopeEditorStep = 'upload' | 'addFields' | 'preview';++const envelopeEditorSteps = [+ {+ id: 'upload',+ order: 1,+ title: msg`Document & Recipients`,+ icon: Upload,+ description: msg`Upload documents and add recipients`,+ },+ {+ id: 'addFields',+ order: 2,+ title: msg`Add Fields`,+ icon: MousePointer,+ description: msg`Place and configure form fields in the document`,+ },+ {+ id: 'preview',+ order: 3,+ title: msg`Preview`,+ icon: EyeIcon,+ description: msg`Preview the document before sending`,+ },+];++export default function EnvelopeEditor() {+ const { t } = useLingui();++ const navigate = useNavigate();+ const team = useCurrentTeam();++ const { envelope, isDocument, isTemplate, isAutosaving, flushAutosave } =+ useCurrentEnvelopeEditor();++ const [searchParams, setSearchParams] = useSearchParams();+ const [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false);+ const [isStepLoading, setIsStepLoading] = useState(false);++ const [currentStep, setCurrentStep] = useState<EnvelopeEditorStep>(() => {+ const searchParamStep = searchParams.get('step') as EnvelopeEditorStep | undefined;++ // Empty URL param equals upload, otherwise use the step URL param+ if (!searchParamStep) {+ return 'upload';+ }++ const validSteps: EnvelopeEditorStep[] = ['upload', 'addFields', 'preview'];++ if (validSteps.includes(searchParamStep)) {+ return searchParamStep;+ }++ return 'upload';+ });++ const documentsPath = formatDocumentsPath(team.url);+ const templatesPath = formatTemplatesPath(team.url);++ const navigateToStep = (step: EnvelopeEditorStep) => {+ setCurrentStep(step);++ flushAutosave();++ if (!isStepLoading && isAutosaving) {+ setIsStepLoading(true);+ }++ // Update URL params: empty for upload, otherwise set the step+ if (step === 'upload') {+ setSearchParams((prev) => {+ const newParams = new URLSearchParams(prev);+ newParams.delete('step');+ return newParams;+ });+ } else {+ setSearchParams((prev) => {+ const newParams = new URLSearchParams(prev);+ newParams.set('step', step);+ return newParams;+ });+ }+ };++ useEffect(() => {+ if (!isAutosaving) {+ setIsStepLoading(false);+ }+ }, [isAutosaving]);++ const currentStepData =+ envelopeEditorSteps.find((step) => step.id === currentStep) || envelopeEditorSteps[0];++ return (+ <div className="h-screen w-screen bg-gray-50">+ <EnvelopeEditorHeader />++ {/* Main Content Area */}+ <div className="flex h-[calc(100vh-73px)] w-screen">+ {/* Left Section - Step Navigation */}+ <div className="flex w-80 flex-shrink-0 flex-col overflow-y-auto border-r border-gray-200 bg-white py-4">+ {/* Left section step selector. */}+ <div className="px-4">+ <h3 className="flex items-end justify-between text-sm font-semibold text-gray-900">+ {isDocument ? <Trans>Document Editor</Trans> : <Trans>Template Editor</Trans>}++ <span className="text-muted-foreground ml-2 rounded border bg-gray-50 px-2 py-0.5 text-xs">+ Step {currentStepData.order}/{envelopeEditorSteps.length}+ </span>+ </h3>++ <div className="bg-muted relative my-4 h-[4px] rounded-md">+ <motion.div+ layout="size"+ layoutId="document-flow-container-step"+ className="bg-documenso absolute inset-y-0 left-0"+ style={{+ width: `${(100 / envelopeEditorSteps.length) * (currentStepData.order ?? 0)}%`,+ }}+ />+ </div>++ <div className="space-y-3">+ {envelopeEditorSteps.map((step) => {+ const Icon = step.icon;+ const isActive = currentStep === step.id;++ return (+ <div+ key={step.id}+ className={`cursor-pointer rounded-lg p-3 transition-colors ${+ isActive+ ? 'border border-green-200 bg-green-50'+ : 'border border-gray-200 hover:bg-gray-50'+ }`}+ onClick={() => navigateToStep(step.id as EnvelopeEditorStep)}+ >+ <div className="flex items-center space-x-3">+ <div+ className={`rounded border p-2 ${+ isActive ? 'border-green-200 bg-green-50' : 'border-gray-100 bg-gray-100'+ }`}+ >+ <Icon+ className={`h-4 w-4 ${isActive ? 'text-green-600' : 'text-gray-600'}`}+ />+ </div>+ <div>+ <div+ className={`text-sm font-medium ${+ isActive ? 'text-green-900' : 'text-gray-700'+ }`}+ >+ {t(step.title)}+ </div>+ <div className="text-xs text-gray-500">{t(step.description)}</div>+ </div>+ </div>+ </div>+ );+ })}+ </div>+ </div>++ <Separator className="my-6" />++ {/* Quick Actions. */}+ <div className="space-y-3 px-4">+ <h4 className="text-sm font-semibold text-gray-900">+ <Trans>Quick Actions</Trans>+ </h4>+ {isDocument && (+ <EnvelopeDistributeDialog+ envelope={envelope}+ trigger={+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <SendIcon className="mr-2 h-4 w-4" />+ <Trans>Send Document</Trans>+ </Button>+ }+ />+ )}++ {isDocument && (+ <EnvelopeRedistributeDialog+ envelope={envelope}+ trigger={+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <SendIcon className="mr-2 h-4 w-4" />+ <Trans>Resend Document</Trans>+ </Button>+ }+ />+ )}++ <EnvelopeEditorSettingsDialog+ trigger={+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <SettingsIcon className="mr-2 h-4 w-4" />+ {isDocument ? <Trans>Document Settings</Trans> : <Trans>Template Settings</Trans>}+ </Button>+ }+ />++ {/* Todo: Envelopes */}+ {/* <Button variant="ghost" size="sm" className="w-full justify-start">+ <FileText className="mr-2 h-4 w-4" />+ Save as Template+ </Button> */}++ {isTemplate && (+ <TemplateDirectLinkDialog+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ directLink={envelope.directLink}+ recipients={envelope.recipients}+ trigger={+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <LinkIcon className="mr-2 h-4 w-4" />+ <Trans>Direct Link</Trans>+ </Button>+ }+ />+ )}++ <EnvelopeDuplicateDialog+ envelopeId={envelope.id}+ envelopeType={envelope.type}+ trigger={+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <CopyPlusIcon className="mr-2 h-4 w-4" />+ {isDocument ? (+ <Trans>Duplicate Document</Trans>+ ) : (+ <Trans>Duplicate Template</Trans>+ )}+ </Button>+ }+ />++ {/* Todo: Allow selecting which document to download and/or the original */}+ <Button variant="ghost" size="sm" className="w-full justify-start">+ <DownloadCloudIcon className="mr-2 h-4 w-4" />+ <Trans>Download PDF</Trans>+ </Button>++ <Button+ variant="ghost"+ size="sm"+ className="w-full justify-start"+ onClick={() => setDeleteDialogOpen(true)}+ >+ <Trash2Icon className="mr-2 h-4 w-4" />+ {isDocument ? <Trans>Delete Document</Trans> : <Trans>Delete Template</Trans>}+ </Button>+ </div>++ {isDocument ? (+ <DocumentDeleteDialog+ id={mapSecondaryIdToDocumentId(envelope.secondaryId)}+ status={envelope.status}+ documentTitle={envelope.title}+ canManageDocument={true}+ open={isDeleteDialogOpen}+ onOpenChange={setDeleteDialogOpen}+ onDelete={async () => {+ await navigate(documentsPath);+ }}+ />+ ) : (+ <TemplateDeleteDialog+ id={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ open={isDeleteDialogOpen}+ onOpenChange={setDeleteDialogOpen}+ onDelete={async () => {+ await navigate(templatesPath);+ }}+ />+ )}++ {/* Footer of left sidebar. */}+ <div className="mt-auto px-4">+ <Button variant="ghost" className="w-full justify-start" asChild>+ <Link to={isDocument ? documentsPath : templatesPath}>+ <ArrowLeftIcon className="mr-2 h-4 w-4" />+ {isDocument ? (+ <Trans>Return to documents</Trans>+ ) : (+ <Trans>Return to templates</Trans>+ )}+ </Link>+ </Button>+ </div>+ </div>++ {/* Main Content - Changes based on current step */}+ <div className="flex-1 overflow-y-auto">+ <p>{isAutosaving ? 'Autosaving...' : 'Not autosaving'}</p>+ <AnimateGenericFadeInOut key={currentStep}>+ {match({ currentStep, isStepLoading })+ .with({ isStepLoading: true }, () => <SpinnerBox className="py-32" />)+ .with({ currentStep: 'upload' }, () => <EnvelopeEditorPageUpload />)+ .with({ currentStep: 'addFields' }, () => <EnvelopeEditorPageFields />)+ .with({ currentStep: 'preview' }, () => <EnvelopeEditorPagePreview />)+ .exhaustive()}+ </AnimateGenericFadeInOut>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx b/apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsxnew file mode 100644index 000000000..bf6c09a8e--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx@@ -0,0 +1,87 @@+import { Plural } from '@lingui/react/macro';++import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { cn } from '@documenso/ui/lib/utils';++type EnvelopeItemSelectorProps = {+ number: number;+ primaryText: React.ReactNode;+ secondaryText: React.ReactNode;+ isSelected: boolean;+ buttonProps: React.ButtonHTMLAttributes<HTMLButtonElement>;+};++export const EnvelopeItemSelector = ({+ number,+ primaryText,+ secondaryText,+ isSelected,+ buttonProps,+}: EnvelopeItemSelectorProps) => {+ return (+ <button+ className={`flex min-w-0 cursor-pointer items-center space-x-3 rounded-lg border px-4 py-3 transition-colors ${+ isSelected+ ? 'border-blue-200 bg-blue-50 text-blue-900'+ : 'border-gray-200 bg-gray-50 hover:bg-gray-100'+ }`}+ {...buttonProps}+ >+ <div+ className={`flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium ${+ isSelected ? 'bg-blue-100 text-blue-600' : 'bg-gray-200 text-gray-600'+ }`}+ >+ {number}+ </div>+ <div className="min-w-0 text-left">+ <div className="truncate text-sm font-medium">{primaryText}</div>+ <div className="text-xs text-gray-500">{secondaryText}</div>+ </div>+ <div+ className={cn('h-2 w-2 rounded-full', {+ 'bg-blue-500': isSelected,+ })}+ ></div>+ </button>+ );+};++type EnvelopeRendererFileSelectorProps = {+ fields: { envelopeItemId: string }[];+ className?: string;+ secondaryOverride?: React.ReactNode;+};++export const EnvelopeRendererFileSelector = ({+ fields,+ className,+ secondaryOverride,+}: EnvelopeRendererFileSelectorProps) => {+ const { envelopeItems, currentEnvelopeItem, setCurrentEnvelopeItem } = useCurrentEnvelopeRender();++ return (+ <div className={cn('flex h-fit space-x-2 overflow-x-auto p-4', className)}>+ {envelopeItems.map((doc, i) => (+ <EnvelopeItemSelector+ key={doc.id}+ number={i + 1}+ primaryText={doc.title}+ secondaryText={+ secondaryOverride ?? (+ <Plural+ one="1 Field"+ other="# Fields"+ value={fields.filter((field) => field.envelopeItemId === doc.id).length}+ />+ )+ }+ isSelected={currentEnvelopeItem?.id === doc.id}+ buttonProps={{+ onClick: () => setCurrentEnvelopeItem(doc.id),+ }}+ />+ ))}+ </div>+ );+};diff --git a/apps/remix/app/components/general/envelope-editor/envelope-generic-page-renderer.tsx b/apps/remix/app/components/general/envelope-editor/envelope-generic-page-renderer.tsxnew file mode 100644index 000000000..792c0dbee--- /dev/null+++ b/apps/remix/app/components/general/envelope-editor/envelope-generic-page-renderer.tsx@@ -0,0 +1,181 @@+import { useEffect, useMemo, useRef } from 'react';++import { useLingui } from '@lingui/react/macro';+import Konva from 'konva';+import type { Layer } from 'konva/lib/Layer';+import type { RenderParameters } from 'pdfjs-dist/types/src/display/api';+import { usePageContext } from 'react-pdf';++import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import type { TEnvelope } from '@documenso/lib/types/envelope';+import { renderField } from '@documenso/lib/universal/field-renderer/render-field';++export default function EnvelopeGenericPageRenderer() {+ const pageContext = usePageContext();++ if (!pageContext) {+ throw new Error('Unable to find Page context.');+ }++ const { _className, page, rotate, scale } = pageContext;++ if (!page) {+ throw new Error('Attempted to render page canvas, but no page was specified.');+ }++ const { t } = useLingui();+ const { currentEnvelopeItem, fields } = useCurrentEnvelopeRender();++ const canvasElement = useRef<HTMLCanvasElement>(null);+ const konvaContainer = useRef<HTMLDivElement>(null);++ const stage = useRef<Konva.Stage | null>(null);+ const pageLayer = useRef<Layer | null>(null);++ const viewport = useMemo(+ () => page.getViewport({ scale, rotation: rotate }),+ [page, rotate, scale],+ );++ const localPageFields = useMemo(+ () =>+ fields.filter(+ (field) =>+ field.page === pageContext.pageNumber && field.envelopeItemId === currentEnvelopeItem?.id,+ ),+ [fields, pageContext.pageNumber],+ );++ // Custom renderer from Konva examples.+ useEffect(+ function drawPageOnCanvas() {+ if (!page) {+ return;+ }++ const { current: canvas } = canvasElement;+ const { current: container } = konvaContainer;++ if (!canvas || !container) {+ return;+ }++ const renderContext: RenderParameters = {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ canvasContext: canvas.getContext('2d', { alpha: false }) as CanvasRenderingContext2D,+ viewport,+ };++ const cancellable = page.render(renderContext);+ const runningTask = cancellable;++ cancellable.promise.catch(() => {+ // Intentionally empty+ });++ void cancellable.promise.then(() => {+ createPageCanvas(container);+ });++ return () => {+ runningTask.cancel();+ };+ },+ [page, viewport],+ );++ const renderFieldOnLayer = (field: TEnvelope['fields'][number]) => {+ if (!pageLayer.current) {+ console.error('Layer not loaded yet');+ return;+ }++ renderField({+ pageLayer: pageLayer.current,+ field: {+ renderId: field.id.toString(),+ ...field,+ customText: '',+ width: Number(field.width),+ height: Number(field.height),+ positionX: Number(field.positionX),+ positionY: Number(field.positionY),+ inserted: false,+ fieldMeta: field.fieldMeta,+ },+ pageWidth: viewport.width,+ pageHeight: viewport.height,+ // color: getRecipientColorKey(field.recipientId),+ color: 'purple', // Todo+ editable: false,+ mode: 'sign',+ });+ };++ /**+ * Create the initial Konva page canvas and initialize all fields and interactions.+ */+ const createPageCanvas = (container: HTMLDivElement) => {+ stage.current = new Konva.Stage({+ container,+ width: viewport.width,+ height: viewport.height,+ });++ // Create the main layer for interactive elements.+ pageLayer.current = new Konva.Layer();+ stage.current?.add(pageLayer.current);++ // Render the fields.+ for (const field of localPageFields) {+ renderFieldOnLayer(field);+ }++ pageLayer.current.batchDraw();+ };++ /**+ * Render fields when they are added or removed from the localFields.+ */+ useEffect(() => {+ if (!pageLayer.current || !stage.current) {+ return;+ }++ // If doesn't exist in localFields, destroy it since it's been deleted.+ pageLayer.current.find('Group').forEach((group) => {+ if (+ group.name() === 'field-group' &&+ !localPageFields.some((field) => field.id.toString() === group.id())+ ) {+ console.log('Field removed, removing from canvas');+ group.destroy();+ }+ });++ // If it exists, rerender.+ localPageFields.forEach((field) => {+ console.log('Field created/updated, rendering on canvas');+ renderFieldOnLayer(field);+ });++ pageLayer.current.batchDraw();+ }, [localPageFields]);++ if (!currentEnvelopeItem) {+ return null;+ }++ return (+ <div className="relative" key={`${currentEnvelopeItem.id}-renderer-${pageContext.pageNumber}`}>+ <div className="konva-container absolute inset-0 z-10" ref={konvaContainer}></div>++ <canvas+ className={`${_className}__canvas z-0`}+ height={viewport.height}+ ref={canvasElement}+ width={viewport.width}+ />+ </div>+ );+}diff --git a/apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx b/apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsxnew file mode 100644index 000000000..10e781520--- /dev/null+++ b/apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx@@ -0,0 +1,59 @@+import { useMemo } from 'react';++import { Trans } from '@lingui/react/macro';+import { FieldType } from '@prisma/client';++import { Input } from '@documenso/ui/primitives/input';+import { Label } from '@documenso/ui/primitives/label';+import { SignaturePadDialog } from '@documenso/ui/primitives/signature-pad/signature-pad-dialog';++import { useRequiredEnvelopeSigningContext } from '../document-signing/envelope-signing-provider';++export default function EnvelopeSignerForm() {+ const { fullName, signature, setFullName, setSignature, envelope, recipientFields } =+ useRequiredEnvelopeSigningContext();++ const hasSignatureField = useMemo(() => {+ return recipientFields.some((field) => field.type === FieldType.SIGNATURE);+ }, [recipientFields]);++ const isSubmitting = false;++ return (+ <fieldset disabled={isSubmitting} className="flex flex-1 flex-col gap-4">+ <div className="flex flex-1 flex-col gap-y-4">+ <div>+ <Label htmlFor="full-name">+ <Trans>Full Name</Trans>+ </Label>++ <Input+ type="text"+ id="full-name"+ className="bg-background mt-2"+ value={fullName}+ onChange={(e) => setFullName(e.target.value.trimStart())}+ />+ </div>++ {hasSignatureField && (+ <div>+ <Label htmlFor="Signature">+ <Trans>Signature</Trans>+ </Label>++ <SignaturePadDialog+ className="mt-2"+ disabled={isSubmitting}+ value={signature ?? ''}+ onChange={(v) => setSignature(v ?? '')}+ typedSignatureEnabled={envelope.documentMeta.typedSignatureEnabled}+ uploadSignatureEnabled={envelope.documentMeta.uploadSignatureEnabled}+ drawSignatureEnabled={envelope.documentMeta.drawSignatureEnabled}+ />+ </div>+ )}+ </div>+ </fieldset>+ );+}diff --git a/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx b/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsxnew file mode 100644index 000000000..0c5cef923--- /dev/null+++ b/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx@@ -0,0 +1,131 @@+import { Plural, Trans, useLingui } from '@lingui/react/macro';+import { Link, useNavigate } from 'react-router';++import { useAnalytics } from '@documenso/lib/client-only/hooks/use-analytics';+import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import type { TRecipientAccessAuth } from '@documenso/lib/types/document-auth';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';+import { trpc } from '@documenso/trpc/react';+import { Badge } from '@documenso/ui/primitives/badge';+import { Separator } from '@documenso/ui/primitives/separator';++import { BrandingLogo } from '~/components/general/branding-logo';++import { DocumentSigningCompleteDialog } from '../document-signing/document-signing-complete-dialog';+import { useRequiredEnvelopeSigningContext } from '../document-signing/envelope-signing-provider';++export const EnvelopeSignerHeader = () => {+ const { t } = useLingui();++ const navigate = useNavigate();+ const analytics = useAnalytics();++ const { envelope, setShowPendingFieldTooltip, recipientFieldsRemaining, recipient } =+ useRequiredEnvelopeSigningContext();++ const { currentEnvelopeItem, setCurrentEnvelopeItem } = useCurrentEnvelopeRender();++ const {+ mutateAsync: completeDocument,+ isPending,+ isSuccess,+ } = trpc.recipient.completeDocumentWithToken.useMutation();++ const handleOnNextFieldClick = () => {+ const nextField = recipientFieldsRemaining[0];++ if (!nextField) {+ setShowPendingFieldTooltip(false);+ return;+ }++ if (nextField.envelopeItemId !== currentEnvelopeItem?.id) {+ setCurrentEnvelopeItem(nextField.envelopeItemId);+ }++ const fieldTooltip = document.querySelector(`#field-tooltip`);++ if (fieldTooltip) {+ fieldTooltip.scrollIntoView({ behavior: 'smooth', block: 'center' });+ }++ setShowPendingFieldTooltip(true);+ };++ const handleOnCompleteClick = async (+ nextSigner?: { name: string; email: string },+ accessAuthOptions?: TRecipientAccessAuth,+ ) => {+ const payload = {+ token: recipient.token,+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),+ authOptions: accessAuthOptions,+ ...(nextSigner?.email && nextSigner?.name ? { nextSigner } : {}),+ };++ await completeDocument(payload);++ analytics.capture('App: Recipient has completed signing', {+ signerId: recipient.id,+ documentId: envelope.id,+ timestamp: new Date().toISOString(),+ });++ if (envelope.documentMeta.redirectUrl) {+ window.location.href = envelope.documentMeta.redirectUrl;+ } else {+ await navigate(`/sign/${recipient.token}/complete`);+ }+ };++ return (+ <nav className="w-full border-b border-gray-200 bg-white px-6 py-3">+ <div className="flex items-center justify-between">+ <div className="flex items-center space-x-4">+ <Link to="/">+ <BrandingLogo className="h-6 w-auto" />+ </Link>+ <Separator orientation="vertical" className="h-6" />++ <div className="flex items-center space-x-2">+ <h1 className="whitespace-nowrap text-sm font-medium text-gray-600">+ {envelope.title}+ </h1>++ <Badge variant="secondary">+ <Trans>Approver</Trans>+ </Badge>+ </div>+ </div>++ <div className="flex items-center space-x-2">+ <p className="text-muted-foreground mr-2 flex-shrink-0 text-sm">+ <Plural+ one="1 Field Remaining"+ other="# Fields Remaining"+ value={recipientFieldsRemaining.length}+ />+ </p>++ <DocumentSigningCompleteDialog+ isSubmitting={isPending}+ onSignatureComplete={handleOnCompleteClick}+ documentTitle={envelope.title}+ fields={recipientFieldsRemaining}+ fieldsValidated={handleOnNextFieldClick}+ recipient={recipient}+ // Todo: Envelopes+ allowDictateNextSigner={envelope.documentMeta.allowDictateNextSigner}+ // defaultNextSigner={+ // nextRecipient+ // ? { name: nextRecipient.name, email: nextRecipient.email }+ // : undefined+ // }+ // Todo: Envelopes - use+ // buttonSize="sm"+ />+ </div>+ </div>+ </nav>+ );+};diff --git a/apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx b/apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsxnew file mode 100644index 000000000..3bb71188d--- /dev/null+++ b/apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx@@ -0,0 +1,417 @@+import { useEffect, useMemo, useRef } from 'react';++import { useLingui } from '@lingui/react/macro';+import { type Field, FieldType } from '@prisma/client';+import Konva from 'konva';+import type { Layer } from 'konva/lib/Layer';+import type { KonvaEventObject } from 'konva/lib/Node';+import type { RenderParameters } from 'pdfjs-dist/types/src/display/api';+import { usePageContext } from 'react-pdf';+import { match } from 'ts-pattern';++import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { ZFullFieldSchema } from '@documenso/lib/types/field';+import { createSpinner } from '@documenso/lib/universal/field-renderer/field-generic-items';+import { renderField } from '@documenso/lib/universal/field-renderer/render-field';+import { isFieldUnsignedAndRequired } from '@documenso/lib/utils/advanced-fields-helpers';+import { extractInitials } from '@documenso/lib/utils/recipient-formatter';+import type { TRecipientColor } from '@documenso/ui/lib/recipient-colors';++import { handleDropdownFieldClick } from '~/utils/field-signing/dropdown-field';+import { handleEmailFieldClick } from '~/utils/field-signing/email-field';+import { handleInitialsFieldClick } from '~/utils/field-signing/initial-field';+import { handleNameFieldClick } from '~/utils/field-signing/name-field';+import { handleNumberFieldClick } from '~/utils/field-signing/number-field';+import { handleSignatureFieldClick } from '~/utils/field-signing/signature-field';+import { handleTextFieldClick } from '~/utils/field-signing/text-field';++import { useRequiredEnvelopeSigningContext } from '../document-signing/envelope-signing-provider';++export default function EnvelopeSignerPageRenderer() {+ const pageContext = usePageContext();++ if (!pageContext) {+ throw new Error('Unable to find Page context.');+ }++ const { _className, page, rotate, scale } = pageContext;++ if (!page) {+ throw new Error('Attempted to render page canvas, but no page was specified.');+ }++ const { t } = useLingui();++ const { currentEnvelopeItem } = useCurrentEnvelopeRender();++ const {+ envelopeData,+ recipientFields,+ recipientFieldsRemaining,+ showPendingFieldTooltip,+ signField,+ email,+ setEmail,+ fullName,+ setFullName,+ signature,+ setSignature,+ } = useRequiredEnvelopeSigningContext();++ console.log({ fullName });++ const { envelope } = envelopeData;++ const canvasElement = useRef<HTMLCanvasElement>(null);+ const konvaContainer = useRef<HTMLDivElement>(null);++ const stage = useRef<Konva.Stage | null>(null);+ const pageLayer = useRef<Layer | null>(null);++ const viewport = useMemo(+ () => page.getViewport({ scale, rotation: rotate }),+ [page, rotate, scale],+ );++ const localPageFields = useMemo(+ () =>+ recipientFields.filter(+ (field) =>+ field.page === pageContext.pageNumber && field.envelopeItemId === currentEnvelopeItem?.id,+ ),+ [recipientFields, pageContext.pageNumber],+ );++ // Custom renderer from Konva examples.+ useEffect(+ function drawPageOnCanvas() {+ if (!page) {+ return;+ }++ const { current: canvas } = canvasElement;+ const { current: container } = konvaContainer;++ if (!canvas || !container) {+ return;+ }++ const renderContext: RenderParameters = {+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ canvasContext: canvas.getContext('2d', { alpha: false }) as CanvasRenderingContext2D,+ viewport,+ };++ const cancellable = page.render(renderContext);+ const runningTask = cancellable;++ cancellable.promise.catch(() => {+ // Intentionally empty+ });++ void cancellable.promise.then(() => {+ createPageCanvas(container);+ });++ return () => {+ runningTask.cancel();+ };+ },+ [page, viewport],+ );++ const renderFieldOnLayer = (unparsedField: Field) => {+ if (!pageLayer.current) {+ console.error('Layer not loaded yet');+ return;+ }++ const fieldToRender = ZFullFieldSchema.parse(unparsedField);++ let color: TRecipientColor = 'green';++ if (fieldToRender.fieldMeta?.readOnly) {+ color = 'readOnly';+ } else if (showPendingFieldTooltip && isFieldUnsignedAndRequired(fieldToRender)) {+ color = 'orange';+ }++ const { fieldGroup } = renderField({+ pageLayer: pageLayer.current,+ field: {+ renderId: fieldToRender.id.toString(),+ ...fieldToRender,+ width: Number(fieldToRender.width),+ height: Number(fieldToRender.height),+ positionX: Number(fieldToRender.positionX),+ positionY: Number(fieldToRender.positionY),+ },+ pageWidth: viewport.width,+ pageHeight: viewport.height,+ color,+ mode: 'sign',+ });++ const handleFieldGroupClick = (e: KonvaEventObject<Event>) => {+ const currentTarget = e.currentTarget as Konva.Group;+ const target = e.target;++ const { width: fieldWidth, height: fieldHeight } = fieldGroup.getClientRect();++ const foundField = recipientFields.find((f) => f.id === unparsedField.id);+ const foundLoadingGroup = currentTarget.findOne('.loading-spinner-group');++ if (!foundField || foundLoadingGroup || foundField.fieldMeta?.readOnly) {+ return;+ }++ const loadingSpinnerGroup = createSpinner({+ fieldWidth,+ fieldHeight,+ });++ fieldGroup.add(loadingSpinnerGroup);++ const parsedFoundField = ZFullFieldSchema.parse(foundField);++ match(parsedFoundField)+ /**+ * CHECKBOX FIELD.+ */+ .with({ type: FieldType.CHECKBOX }, (field) => {+ const { fieldMeta } = field;++ const { values } = fieldMeta;++ const checkedValues = (values || [])+ .map((v) => ({+ ...v,+ checked: v.id === target.getAttr('internalCheckboxId') ? !v.checked : v.checked,+ }))+ .filter((v) => v.checked);++ void signField(field.id, {+ type: FieldType.CHECKBOX,+ value: checkedValues.map((v) => v.id),+ }).finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * RADIO FIELD.+ */+ .with({ type: FieldType.RADIO }, (field) => {+ const { fieldMeta } = foundField;++ const checkedValue = target.getAttr('internalRadioValue');++ // Uncheck the value if it's already pressed.+ const value = field.inserted && checkedValue === field.customText ? null : checkedValue;++ void signField(field.id, {+ type: FieldType.RADIO,+ value,+ }).finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * NUMBER FIELD.+ */+ .with({ type: FieldType.NUMBER }, (field) => {+ handleNumberFieldClick({ field, number: null })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload);+ }+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * TEXT FIELD.+ */+ .with({ type: FieldType.TEXT }, (field) => {+ handleTextFieldClick({ field, text: null })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload);+ }+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * EMAIL FIELD.+ */+ .with({ type: FieldType.EMAIL }, (field) => {+ handleEmailFieldClick({ field, email })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload); // Todo: Envelopes - Handle errors+ }++ if (payload?.value) {+ setEmail(payload.value);+ }+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * INITIALS FIELD.+ */+ .with({ type: FieldType.INITIALS }, (field) => {+ const initials = fullName ? extractInitials(fullName) : null;++ handleInitialsFieldClick({ field, initials })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload);+ }+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * NAME FIELD.+ */+ .with({ type: FieldType.NAME }, (field) => {+ handleNameFieldClick({ field, name: fullName })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload);+ }++ if (payload?.value) {+ setFullName(payload.value);+ }+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * DROPDOWN FIELD.+ */+ .with({ type: FieldType.DROPDOWN }, (field) => {+ handleDropdownFieldClick({ field, text: null })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload);+ }++ loadingSpinnerGroup.destroy();+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * DATE FIELD.+ */+ .with({ type: FieldType.DATE }, (field) => {+ void signField(field.id, {+ type: FieldType.DATE,+ value: !field.inserted,+ }).finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ /**+ * SIGNATURE FIELD.+ */+ .with({ type: FieldType.SIGNATURE }, (field) => {+ // Todo: Envelopes - Reauth+ handleSignatureFieldClick({+ field,+ signature,+ typedSignatureEnabled: envelope.documentMeta.typedSignatureEnabled,+ uploadSignatureEnabled: envelope.documentMeta.uploadSignatureEnabled,+ drawSignatureEnabled: envelope.documentMeta.drawSignatureEnabled,+ })+ .then(async (payload) => {+ if (payload) {+ await signField(field.id, payload);+ }++ if (payload?.value) {+ setSignature(payload.value);+ }+ })+ .finally(() => {+ loadingSpinnerGroup.destroy();+ });+ })+ .exhaustive();++ console.log('Field clicked');+ };++ fieldGroup.off('click');+ fieldGroup.on('click', handleFieldGroupClick);+ };++ /**+ * Create the initial Konva page canvas and initialize all fields and interactions.+ */+ const createPageCanvas = (container: HTMLDivElement) => {+ stage.current = new Konva.Stage({+ container,+ width: viewport.width,+ height: viewport.height,+ });++ // Create the main layer for interactive elements.+ pageLayer.current = new Konva.Layer();+ stage.current?.add(pageLayer.current);++ console.log({+ localPageFields,+ });++ // Render the fields.+ for (const field of localPageFields) {+ renderFieldOnLayer(field);+ }++ pageLayer.current.batchDraw();+ };++ /**+ * Render fields when they are changed or inserted.+ */+ useEffect(() => {+ if (!pageLayer.current || !stage.current) {+ return;+ }++ localPageFields.forEach((field) => {+ console.log('Field changed/inserted, rendering on canvas');+ renderFieldOnLayer(field);+ });++ pageLayer.current.batchDraw();+ }, [localPageFields, showPendingFieldTooltip, fullName, signature, email]);++ if (!currentEnvelopeItem) {+ return null;+ }++ return (+ <div className="relative" key={`${currentEnvelopeItem.id}-renderer-${pageContext.pageNumber}`}>+ <div className="konva-container absolute inset-0 z-10 w-full" ref={konvaContainer}></div>++ <canvas+ className={`${_className}__canvas z-0`}+ height={viewport.height}+ ref={canvasElement}+ width={viewport.width}+ />+ </div>+ );+}diff --git a/apps/remix/app/components/general/folder/folder-grid.tsx b/apps/remix/app/components/general/folder/folder-grid.tsxindex fa511fe53..6d6e6a2f4 100644--- a/apps/remix/app/components/general/folder/folder-grid.tsx+++ b/apps/remix/app/components/general/folder/folder-grid.tsx@@ -15,7 +15,7 @@ import { FolderDeleteDialog } from '~/components/dialogs/folder-delete-dialog';import { FolderMoveDialog } from '~/components/dialogs/folder-move-dialog';import { FolderUpdateDialog } from '~/components/dialogs/folder-update-dialog';import { TemplateCreateDialog } from '~/components/dialogs/template-create-dialog';-import { DocumentUploadDropzone } from '~/components/general/document/document-upload';+import { DocumentUploadButton } from '~/components/general/document/document-upload-button';import { FolderCard, FolderCardEmpty } from '~/components/general/folder/folder-card';import { useCurrentTeam } from '~/providers/team';@@ -97,8 +97,11 @@ export const FolderGrid = ({ type, parentId }: FolderGridProps) => {</div><div className="flex gap-4 sm:flex-row sm:justify-end">+ {/* Todo: Envelopes - Feature flag */}+ {/* <EnvelopeUploadButton type={type} folderId={parentId || undefined} /> */}+{type === FolderType.DOCUMENT ? (- <DocumentUploadDropzone />+ <DocumentUploadButton />) : (<TemplateCreateDialog folderId={parentId ?? undefined} />)}diff --git a/apps/remix/app/components/general/share-document-download-button.tsx b/apps/remix/app/components/general/share-document-download-button.tsxindex 5ee7d0453..af92fb895 100644--- a/apps/remix/app/components/general/share-document-download-button.tsx+++ b/apps/remix/app/components/general/share-document-download-button.tsx@@ -15,6 +15,7 @@ export type ShareDocumentDownloadButtonProps = {documentData: DocumentData;};+// Todo: Envelopes - Support multiple item downloads.export const ShareDocumentDownloadButton = ({title,documentData,diff --git a/apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx b/apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxindex dbca5a8ea..c0942f693 100644--- a/apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+++ b/apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx@@ -42,7 +42,7 @@ export const TemplateDropZoneWrapper = ({ children, className }: TemplateDropZonconst documentData = await putPdfFile(file);- const { id } = await createTemplate({+ const { legacyTemplateId: id } = await createTemplate({title: file.name,templateDocumentDataId: documentData.id,folderId: folderId ?? undefined,diff --git a/apps/remix/app/components/general/template/template-edit-form.tsx b/apps/remix/app/components/general/template/template-edit-form.tsxindex 41002b54e..683f82054 100644--- a/apps/remix/app/components/general/template/template-edit-form.tsx+++ b/apps/remix/app/components/general/template/template-edit-form.tsx@@ -100,7 +100,7 @@ export const TemplateEditForm = ({},});- const { mutateAsync: addTemplateFields } = trpc.field.addTemplateFields.useMutation({+ const { mutateAsync: addTemplateFields } = trpc.field.setFieldsForTemplate.useMutation({...DO_NOT_INVALIDATE_QUERY_ON_MUTATION,onSuccess: (newData) => {utils.template.getTemplateById.setData(@@ -193,7 +193,10 @@ export const TemplateEditForm = ({setRecipients({templateId: template.id,- recipients: data.signers,+ recipients: data.signers.map((signer) => ({+ ...signer,+ id: signer.nativeId,+ })),}),]);@@ -237,7 +240,11 @@ export const TemplateEditForm = ({const saveFieldsData = async (data: TAddTemplateFieldsFormSchema) => {return addTemplateFields({templateId: template.id,- fields: data.fields,+ fields: data.fields.map((field) => ({+ ...field,+ id: field.nativeId,+ envelopeItemId: template.templateDocumentData.envelopeItemId,+ })),});};diff --git a/apps/remix/app/components/general/template/template-page-view-information.tsx b/apps/remix/app/components/general/template/template-page-view-information.tsxindex 7d0d662c5..0b320cd11 100644--- a/apps/remix/app/components/general/template/template-page-view-information.tsx+++ b/apps/remix/app/components/general/template/template-page-view-information.tsx@@ -3,14 +3,17 @@ import { useMemo } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Template, User } from '@prisma/client';+import type { User } from '@prisma/client';import { DateTime } from 'luxon';import { useIsMounted } from '@documenso/lib/client-only/hooks/use-is-mounted';export type TemplatePageViewInformationProps = {userId: number;- template: Template & {+ template: {+ userId: number;+ createdAt: Date;+ updatedAt: Date;user: Pick<User, 'id' | 'name' | 'email'>;};};diff --git a/apps/remix/app/components/general/template/template-page-view-recent-activity.tsx b/apps/remix/app/components/general/template/template-page-view-recent-activity.tsxindex 9b39a27a8..d0cb239de 100644--- a/apps/remix/app/components/general/template/template-page-view-recent-activity.tsx+++ b/apps/remix/app/components/general/template/template-page-view-recent-activity.tsx@@ -113,7 +113,7 @@ export const TemplatePageViewRecentActivity = ({</div><Link- to={`${documentRootPath}/${document.id}`}+ to={`${documentRootPath}/${document.envelopeId}`}className="text-muted-foreground dark:text-muted-foreground/70 flex-auto truncate py-0.5 text-xs leading-5">{match(document.source)diff --git a/apps/remix/app/components/general/template/template-page-view-recipients.tsx b/apps/remix/app/components/general/template/template-page-view-recipients.tsxindex 3896baf11..4dc67de49 100644--- a/apps/remix/app/components/general/template/template-page-view-recipients.tsx+++ b/apps/remix/app/components/general/template/template-page-view-recipients.tsx@@ -1,7 +1,7 @@import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Recipient, Template } from '@prisma/client';+import type { Recipient } from '@prisma/client';import { PenIcon, PlusIcon } from 'lucide-react';import { Link } from 'react-router';@@ -11,20 +11,18 @@ import { extractInitials } from '@documenso/lib/utils/recipient-formatter';import { AvatarWithText } from '@documenso/ui/primitives/avatar';export type TemplatePageViewRecipientsProps = {- template: Template & {- recipients: Recipient[];- };+ recipients: Recipient[];+ envelopeId: string;templateRootPath: string;};export const TemplatePageViewRecipients = ({- template,+ recipients,+ envelopeId,templateRootPath,}: TemplatePageViewRecipientsProps) => {const { _ } = useLingui();- const recipients = template.recipients;-return (<section className="dark:bg-background border-border bg-widget flex flex-col rounded-xl border"><div className="flex flex-row items-center justify-between px-4 py-3">@@ -33,7 +31,7 @@ export const TemplatePageViewRecipients = ({</h1><Link- to={`${templateRootPath}/${template.id}/edit?step=signers`}+ to={`${templateRootPath}/${envelopeId}/edit?step=signers`}title={_(msg`Modify recipients`)}className="flex flex-row items-center justify-between">diff --git a/apps/remix/app/components/tables/admin-dashboard-users-table.tsx b/apps/remix/app/components/tables/admin-dashboard-users-table.tsxindex 6c3919b4c..c409f7d2c 100644--- a/apps/remix/app/components/tables/admin-dashboard-users-table.tsx+++ b/apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState, useTransition } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';-import type { Document, Role, Subscription } from '@prisma/client';+import type { Role, Subscription } from '@prisma/client';import { Edit, Loader } from 'lucide-react';import { Link } from 'react-router';@@ -20,7 +20,7 @@ type UserData = {email: string;roles: Role[];subscriptions?: SubscriptionLite[] | null;- documents: DocumentLite[];+ documentCount: number;};type SubscriptionLite = Pick<@@ -28,8 +28,6 @@ type SubscriptionLite = Pick<'id' | 'status' | 'planId' | 'priceId' | 'createdAt' | 'periodEnd'>;-type DocumentLite = Pick<Document, 'id'>;-type AdminDashboardUsersTableProps = {users: UserData[];totalPages: number;@@ -74,10 +72,7 @@ export const AdminDashboardUsersTable = ({},{header: _(msg`Documents`),- accessorKey: 'documents',- cell: ({ row }) => {- return <div>{row.original.documents?.length}</div>;- },+ accessorKey: 'documentCount',},{header: '',diff --git a/apps/remix/app/components/tables/admin-document-jobs-table.tsx b/apps/remix/app/components/tables/admin-document-jobs-table.tsxnew file mode 100644index 000000000..7528b00eb--- /dev/null+++ b/apps/remix/app/components/tables/admin-document-jobs-table.tsx@@ -0,0 +1,136 @@+import { useMemo } from 'react';++import { useLingui } from '@lingui/react/macro';+import { Trans } from '@lingui/react/macro';+import { useSearchParams } from 'react-router';++import { useUpdateSearchParams } from '@documenso/lib/client-only/hooks/use-update-search-params';+import { ZUrlSearchParamsSchema } from '@documenso/lib/types/search-params';+import { trpc } from '@documenso/trpc/react';+import { Button } from '@documenso/ui/primitives/button';+import type { DataTableColumnDef } from '@documenso/ui/primitives/data-table';+import { DataTable } from '@documenso/ui/primitives/data-table';+import { DataTablePagination } from '@documenso/ui/primitives/data-table-pagination';+import { Skeleton } from '@documenso/ui/primitives/skeleton';+import { TableCell } from '@documenso/ui/primitives/table';++export const AdminDocumentJobsTable = ({ envelopeId }: { envelopeId: string }) => {+ const { t, i18n } = useLingui();++ const [searchParams] = useSearchParams();+ const updateSearchParams = useUpdateSearchParams();++ const parsedSearchParams = ZUrlSearchParamsSchema.parse(Object.fromEntries(searchParams ?? []));++ const { data, isLoading, isLoadingError, refetch, isFetching } =+ trpc.admin.document.findJobs.useQuery({+ envelopeId: envelopeId,+ page: parsedSearchParams.page,+ perPage: parsedSearchParams.perPage,+ });++ const onPaginationChange = (page: number, perPage: number) => {+ updateSearchParams({+ page,+ perPage,+ });+ };++ const results = data ?? {+ data: [],+ perPage: 10,+ currentPage: 1,+ totalPages: 1,+ };++ const columns = useMemo(() => {+ return [+ {+ header: t`Name`,+ accessorKey: 'name',+ },+ {+ header: t`Status`,+ accessorKey: 'status',+ },+ {+ header: t`Submitted`,+ accessorKey: 'submittedAt',+ cell: ({ row }) => i18n.date(row.original.submittedAt),+ },+ {+ header: t`Retried`,+ accessorKey: 'retried',+ },+ {+ header: t`Last Retried`,+ accessorKey: 'lastRetriedAt',+ cell: ({ row }) =>+ row.original.lastRetriedAt ? i18n.date(row.original.lastRetriedAt) : 'N/A',+ },+ {+ header: t`Completed`,+ accessorKey: 'completedAt',+ cell: ({ row }) => (row.original.completedAt ? i18n.date(row.original.completedAt) : 'N/A'),+ },+ ] satisfies DataTableColumnDef<(typeof results)['data'][number]>[];+ }, []);++ return (+ <div className="space-y-4">+ <div className="flex items-center justify-between">+ <h2 className="text-lg font-semibold">+ <Trans>Background Jobs</Trans>+ </h2>++ <Button variant="outline" size="sm" loading={isFetching} onClick={async () => refetch()}>+ <Trans>Reload</Trans>+ </Button>+ </div>++ <DataTable+ columns={columns}+ data={results.data}+ perPage={results.perPage}+ currentPage={results.currentPage}+ totalPages={results.totalPages}+ onPaginationChange={onPaginationChange}+ error={{+ enable: isLoadingError,+ }}+ skeleton={{+ enable: isLoading,+ rows: 3,+ component: (+ <>+ <TableCell className="py-4 pr-4">+ <Skeleton className="h-4 w-20 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-4 w-12 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-4 w-12 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-4 w-12 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-4 w-12 rounded-full" />+ </TableCell>+ <TableCell>+ <Skeleton className="h-4 w-12 rounded-full" />+ </TableCell>+ </>+ ),+ }}+ >+ {(table) =>+ results.totalPages > 1 && (+ <DataTablePagination additionalInformation="VisibleCount" table={table} />+ )+ }+ </DataTable>+ </div>+ );+};diff --git a/apps/remix/app/components/tables/documents-table-action-button.tsx b/apps/remix/app/components/tables/documents-table-action-button.tsxindex c1d68c133..4106a471c 100644--- a/apps/remix/app/components/tables/documents-table-action-button.tsx+++ b/apps/remix/app/components/tables/documents-table-action-button.tsx@@ -40,7 +40,7 @@ export const DocumentsTableActionButton = ({ row }: DocumentsTableActionButtonPrconst isCurrentTeamDocument = team && row.team?.url === team.url;const documentsPath = formatDocumentsPath(team.url);- const formatPath = `${documentsPath}/${row.id}/edit`;+ const formatPath = `${documentsPath}/${row.envelopeId}/edit`;const onDownloadClick = async () => {try {diff --git a/apps/remix/app/components/tables/documents-table-action-dropdown.tsx b/apps/remix/app/components/tables/documents-table-action-dropdown.tsxindex 8114c6cc1..e4ac5dbbb 100644--- a/apps/remix/app/components/tables/documents-table-action-dropdown.tsx+++ b/apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -72,7 +72,7 @@ export const DocumentsTableActionDropdown = ({const canManageDocument = Boolean(isOwner || isCurrentTeamDocument);const documentsPath = formatDocumentsPath(team.url);- const formatPath = `${documentsPath}/${row.id}/edit`;+ const formatPath = `${documentsPath}/${row.envelopeId}/edit`;const onDownloadClick = async () => {try {@@ -139,32 +139,35 @@ export const DocumentsTableActionDropdown = ({<Trans>Action</Trans></DropdownMenuLabel>- {!isDraft && recipient && recipient?.role !== RecipientRole.CC && (- <DropdownMenuItem disabled={!recipient || isComplete} asChild>- <Link to={`/sign/${recipient?.token}`}>- {recipient?.role === RecipientRole.VIEWER && (- <>- <EyeIcon className="mr-2 h-4 w-4" />- <Trans>View</Trans>- </>- )}-- {recipient?.role === RecipientRole.SIGNER && (- <>- <Pencil className="mr-2 h-4 w-4" />- <Trans>Sign</Trans>- </>- )}-- {recipient?.role === RecipientRole.APPROVER && (- <>- <CheckCircle className="mr-2 h-4 w-4" />- <Trans>Approve</Trans>- </>- )}- </Link>- </DropdownMenuItem>- )}+ {!isDraft &&+ recipient &&+ recipient?.role !== RecipientRole.CC &&+ recipient?.role !== RecipientRole.ASSISTANT && (+ <DropdownMenuItem disabled={!recipient || isComplete} asChild>+ <Link to={`/sign/${recipient?.token}`}>+ {recipient?.role === RecipientRole.VIEWER && (+ <>+ <EyeIcon className="mr-2 h-4 w-4" />+ <Trans>View</Trans>+ </>+ )}++ {recipient?.role === RecipientRole.SIGNER && (+ <>+ <Pencil className="mr-2 h-4 w-4" />+ <Trans>Sign</Trans>+ </>+ )}++ {recipient?.role === RecipientRole.APPROVER && (+ <>+ <CheckCircle className="mr-2 h-4 w-4" />+ <Trans>Approve</Trans>+ </>+ )}+ </Link>+ </DropdownMenuItem>+ )}<DropdownMenuItem disabled={!canManageDocument || isComplete} asChild><Link to={formatPath}>diff --git a/apps/remix/app/components/tables/documents-table-title.tsx b/apps/remix/app/components/tables/documents-table-title.tsxindex 0705b60b3..42ea9983e 100644--- a/apps/remix/app/components/tables/documents-table-title.tsx+++ b/apps/remix/app/components/tables/documents-table-title.tsx@@ -28,7 +28,7 @@ export const DataTableTitle = ({ row, teamUrl }: DataTableTitleProps) => {}).with({ isOwner: true }, { isCurrentTeamDocument: true }, () => (<Link- to={`${documentsPath}/${row.id}`}+ to={`${documentsPath}/${row.envelopeId}`}title={row.title}className="block max-w-[10rem] truncate font-medium hover:underline md:max-w-[20rem]">diff --git a/apps/remix/app/components/tables/documents-table.tsx b/apps/remix/app/components/tables/documents-table.tsxindex a003f4d0d..ebd4574c5 100644--- a/apps/remix/app/components/tables/documents-table.tsx+++ b/apps/remix/app/components/tables/documents-table.tsx@@ -180,7 +180,7 @@ const DataTableTitle = ({ row, teamUrl }: DataTableTitleProps) => {const isCurrentTeamDocument = teamUrl && row.team?.url === teamUrl;const documentsPath = formatDocumentsPath(teamUrl);- const formatPath = `${documentsPath}/${row.id}`;+ const formatPath = `${documentsPath}/${row.envelopeId}`;return match({isOwner,diff --git a/apps/remix/app/components/tables/settings-public-profile-templates-table.tsx b/apps/remix/app/components/tables/settings-public-profile-templates-table.tsxindex d3c89cdab..499753133 100644--- a/apps/remix/app/components/tables/settings-public-profile-templates-table.tsx+++ b/apps/remix/app/components/tables/settings-public-profile-templates-table.tsx@@ -3,8 +3,7 @@ import { useMemo, useState } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { TemplateDirectLink } from '@prisma/client';-import { TemplateType } from '@prisma/client';+import { type TemplateDirectLink, TemplateType } from '@prisma/client';import { EditIcon, FileIcon, LinkIcon, MoreHorizontalIcon, Trash2Icon } from 'lucide-react';import { useCopyToClipboard } from '@documenso/lib/client-only/hooks/use-copy-to-clipboard';diff --git a/apps/remix/app/components/tables/templates-table-action-dropdown.tsx b/apps/remix/app/components/tables/templates-table-action-dropdown.tsxindex 91f8ec9b2..4ca675b8e 100644--- a/apps/remix/app/components/tables/templates-table-action-dropdown.tsx+++ b/apps/remix/app/components/tables/templates-table-action-dropdown.tsx@@ -1,7 +1,7 @@import { useState } from 'react';import { Trans } from '@lingui/react/macro';-import type { Recipient, Template, TemplateDirectLink } from '@prisma/client';+import type { Recipient, TemplateDirectLink } from '@prisma/client';import { Copy, Edit, FolderIcon, MoreHorizontal, Share2Icon, Trash2, Upload } from 'lucide-react';import { Link } from 'react-router';@@ -21,7 +21,13 @@ import { TemplateDuplicateDialog } from '../dialogs/template-duplicate-dialog';import { TemplateMoveToFolderDialog } from '../dialogs/template-move-to-folder-dialog';export type TemplatesTableActionDropdownProps = {- row: Template & {+ row: {+ id: number;+ userId: number;+ teamId: number;+ title: string;+ folderId?: string | null;+ envelopeId: string;directLink?: Pick<TemplateDirectLink, 'token' | 'enabled'> | null;recipients: Recipient[];};@@ -39,14 +45,13 @@ export const TemplatesTableActionDropdown = ({const { user } = useSession();const [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false);- const [isTemplateDirectLinkDialogOpen, setTemplateDirectLinkDialogOpen] = useState(false);const [isDuplicateDialogOpen, setDuplicateDialogOpen] = useState(false);const [isMoveToFolderDialogOpen, setMoveToFolderDialogOpen] = useState(false);const isOwner = row.userId === user.id;const isTeamTemplate = row.teamId === teamId;- const formatPath = `${templateRootPath}/${row.id}/edit`;+ const formatPath = `${templateRootPath}/${row.envelopeId}/edit`;return (<DropdownMenu>@@ -72,10 +77,20 @@ export const TemplatesTableActionDropdown = ({<Trans>Duplicate</Trans></DropdownMenuItem>- <DropdownMenuItem onClick={() => setTemplateDirectLinkDialogOpen(true)}>- <Share2Icon className="mr-2 h-4 w-4" />- <Trans>Direct link</Trans>- </DropdownMenuItem>+ <TemplateDirectLinkDialog+ templateId={row.id}+ recipients={row.recipients}+ directLink={row.directLink}+ trigger={+ <div+ data-testid="template-direct-link"+ className="hover:bg-accent hover:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors"+ >+ <Share2Icon className="mr-2 h-4 w-4" />+ <Trans>Direct link</Trans>+ </div>+ }+ /><DropdownMenuItem onClick={() => setMoveToFolderDialogOpen(true)}><FolderIcon className="mr-2 h-4 w-4" />@@ -108,12 +123,6 @@ export const TemplatesTableActionDropdown = ({onOpenChange={setDuplicateDialogOpen}/>- <TemplateDirectLinkDialog- template={row}- open={isTemplateDirectLinkDialogOpen}- onOpenChange={setTemplateDirectLinkDialogOpen}- />-<TemplateDeleteDialogid={row.id}open={isDeleteDialogOpen}diff --git a/apps/remix/app/components/tables/templates-table.tsx b/apps/remix/app/components/tables/templates-table.tsxindex f1423970a..d41ffac48 100644--- a/apps/remix/app/components/tables/templates-table.tsx+++ b/apps/remix/app/components/tables/templates-table.tsx@@ -56,7 +56,7 @@ export const TemplatesTable = ({const formatTemplateLink = (row: TemplatesTableRow) => {const path = formatTemplatesPath(team.url);- return `${path}/${row.id}`;+ return `${path}/${row.envelopeId}`;};const columns = useMemo(() => {diff --git a/apps/remix/app/routes/_authenticated+/_layout.tsx b/apps/remix/app/routes/_authenticated+/_layout.tsxindex faa605a71..55f8d66fb 100644--- a/apps/remix/app/routes/_authenticated+/_layout.tsx+++ b/apps/remix/app/routes/_authenticated+/_layout.tsx@@ -7,6 +7,7 @@ import { OrganisationProvider } from '@documenso/lib/client-only/providers/organimport { useSession } from '@documenso/lib/client-only/providers/session';import { getSiteSettings } from '@documenso/lib/server-only/site-settings/get-site-settings';import { SITE_SETTINGS_BANNER_ID } from '@documenso/lib/server-only/site-settings/schemas/banner';+import { cn } from '@documenso/ui/lib/utils';import { Button } from '@documenso/ui/primitives/button';import { AppBanner } from '~/components/general/app-banner';@@ -42,7 +43,7 @@ export async function loader({ request }: Route.LoaderArgs) {};}-export default function Layout({ loaderData, params }: Route.ComponentProps) {+export default function Layout({ loaderData, params, matches }: Route.ComponentProps) {const { banner } = loaderData;const { user, organisations } = useSession();@@ -71,6 +72,13 @@ export default function Layout({ loaderData, params }: Route.ComponentProps) {const orgNotFound = params.orgUrl && !currentOrganisation;const teamNotFound = params.teamUrl && !currentTeam;+ // Hide the header for editor routes.+ const hideHeader = matches.some(+ (match) =>+ match?.id === 'routes/_authenticated+/t.$teamUrl+/documents.$id.edit' ||+ match?.id === 'routes/_authenticated+/t.$teamUrl+/templates.$id.edit',+ );+if (orgNotFound || teamNotFound) {return (<GenericErrorLayout@@ -110,9 +118,13 @@ export default function Layout({ loaderData, params }: Route.ComponentProps) {{banner && <AppBanner banner={banner} />}- <Header />+ {!hideHeader && <Header />}- <main className="mt-8 pb-8 md:mt-12 md:pb-12">+ <main+ className={cn({+ 'mt-8 pb-8 md:mt-12 md:pb-12': !hideHeader,+ })}+ ><Outlet /></main></TeamProvider>diff --git a/apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx b/apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsxindex 623ac0938..8827315a9 100644--- a/apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+++ b/apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx@@ -1,11 +1,11 @@import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import { SigningStatus } from '@prisma/client';+import { EnvelopeType, SigningStatus } from '@prisma/client';import { DateTime } from 'luxon';import { Link, redirect } from 'react-router';-import { getEntireDocument } from '@documenso/lib/server-only/admin/get-entire-document';+import { unsafeGetEntireEnvelope } from '@documenso/lib/server-only/admin/get-entire-document';import { trpc } from '@documenso/trpc/react';import {Accordion,@@ -25,24 +25,31 @@ import { useToast } from '@documenso/ui/primitives/use-toast';import { AdminDocumentDeleteDialog } from '~/components/dialogs/admin-document-delete-dialog';import { DocumentStatus } from '~/components/general/document/document-status';+import { AdminDocumentJobsTable } from '~/components/tables/admin-document-jobs-table';import { AdminDocumentRecipientItemTable } from '~/components/tables/admin-document-recipient-item-table';import type { Route } from './+types/documents.$id';export async function loader({ params }: Route.LoaderArgs) {- const id = Number(params.id);+ const id = params.id;- if (isNaN(id)) {+ if (!id || !id.startsWith('envelope_')) {throw redirect('/admin/documents');}- const document = await getEntireDocument({ id });+ const envelope = await unsafeGetEntireEnvelope({+ id: {+ type: 'envelopeId',+ id,+ },+ type: EnvelopeType.DOCUMENT,+ });- return { document };+ return { envelope };}export default function AdminDocumentDetailsPage({ loaderData }: Route.ComponentProps) {- const { document } = loaderData;+ const { envelope } = loaderData;const { _, i18n } = useLingui();const { toast } = useToast();@@ -51,8 +58,8 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Componenttrpc.admin.document.reseal.useMutation({onSuccess: () => {toast({- title: _(msg`Success`),- description: _(msg`Document resealed`),+ title: _(msg`Sealing job started`),+ description: _(msg`See the background jobs tab for the status`),});},onError: () => {@@ -68,11 +75,11 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Component<div><div className="flex items-start justify-between"><div className="flex items-center gap-x-4">- <h1 className="text-2xl font-semibold">{document.title}</h1>- <DocumentStatus status={document.status} />+ <h1 className="text-2xl font-semibold">{envelope.title}</h1>+ <DocumentStatus status={envelope.status} /></div>- {document.deletedAt && (+ {envelope.deletedAt && (<Badge size="large" variant="destructive"><Trans>Deleted</Trans></Badge>@@ -81,11 +88,11 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Component<div className="text-muted-foreground mt-4 text-sm"><div>- <Trans>Created on</Trans>: {i18n.date(document.createdAt, DateTime.DATETIME_MED)}+ <Trans>Created on</Trans>: {i18n.date(envelope.createdAt, DateTime.DATETIME_MED)}</div><div>- <Trans>Last updated at</Trans>: {i18n.date(document.updatedAt, DateTime.DATETIME_MED)}+ <Trans>Last updated at</Trans>: {i18n.date(envelope.updatedAt, DateTime.DATETIME_MED)}</div></div>@@ -102,12 +109,12 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Component<Buttonvariant="outline"loading={isResealDocumentLoading}- disabled={document.recipients.some(+ disabled={envelope.recipients.some((recipient) =>recipient.signingStatus !== SigningStatus.SIGNED &&recipient.signingStatus !== SigningStatus.REJECTED,)}- onClick={() => resealDocument({ id: document.id })}+ onClick={() => resealDocument({ id: envelope.id })}><Trans>Reseal document</Trans></Button>@@ -123,7 +130,7 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Component</TooltipProvider><Button variant="outline" asChild>- <Link to={`/admin/users/${document.userId}`}>+ <Link to={`/admin/users/${envelope.userId}`}><Trans>Go to owner</Trans></Link></Button>@@ -136,7 +143,7 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Component<div className="mt-4"><Accordion type="multiple" className="space-y-4">- {document.recipients.map((recipient) => (+ {envelope.recipients.map((recipient) => (<AccordionItemkey={recipient.id}value={recipient.id.toString()}@@ -161,7 +168,13 @@ export default function AdminDocumentDetailsPage({ loaderData }: Route.Component<hr className="my-4" />- {document && <AdminDocumentDeleteDialog document={document} />}+ <div className="mt-4">+ <AdminDocumentJobsTable envelopeId={envelope.id} />+ </div>++ <hr className="my-4" />++ {envelope && <AdminDocumentDeleteDialog envelopeId={envelope.id} />}</div>);}diff --git a/apps/remix/app/routes/_authenticated+/admin+/documents._index.tsx b/apps/remix/app/routes/_authenticated+/admin+/documents._index.tsxindex 27b7509f2..0504fed76 100644--- a/apps/remix/app/routes/_authenticated+/admin+/documents._index.tsx+++ b/apps/remix/app/routes/_authenticated+/admin+/documents._index.tsx@@ -64,7 +64,7 @@ export default function AdminDocumentsPage() {cell: ({ row }) => {return (<Link- to={`/admin/documents/${row.original.id}`}+ to={`/admin/documents/${row.original.envelopeId}`}className="block max-w-[5rem] truncate font-medium hover:underline md:max-w-[10rem]">{row.original.title}diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxindex 84c9c6883..671e812dd 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx@@ -1,21 +1,25 @@-import { useLingui } from '@lingui/react';-import { Plural, Trans } from '@lingui/react/macro';-import { DocumentStatus, TeamMemberRole } from '@prisma/client';+import { msg } from '@lingui/core/macro';+import { Plural, Trans, useLingui } from '@lingui/react/macro';+import { DocumentStatus } from '@prisma/client';import { ChevronLeft, Users2 } from 'lucide-react';-import { Link, redirect } from 'react-router';+import { Link } from 'react-router';import { match } from 'ts-pattern';-import { getSession } from '@documenso/auth/server/lib/utils/get-session';+import { EnvelopeRenderProvider } from '@documenso/lib/client-only/providers/envelope-render-provider';import { useSession } from '@documenso/lib/client-only/providers/session';-import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';-import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';-import { DocumentVisibility } from '@documenso/lib/types/document-visibility';-import { logDocumentAccess } from '@documenso/lib/utils/logger';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { formatDocumentsPath } from '@documenso/lib/utils/teams';-import { DocumentReadOnlyFields } from '@documenso/ui/components/document/document-read-only-fields';+import { trpc } from '@documenso/trpc/react';+import {+ DocumentReadOnlyFields,+ mapFieldsWithRecipients,+} from '@documenso/ui/components/document/document-read-only-fields';+import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy';import { Badge } from '@documenso/ui/primitives/badge';+import { Button } from '@documenso/ui/primitives/button';import { Card, CardContent } from '@documenso/ui/primitives/card';import { PDFViewer } from '@documenso/ui/primitives/pdf-viewer';+import { Spinner } from '@documenso/ui/primitives/spinner';import { DocumentPageViewButton } from '~/components/general/document/document-page-view-button';import { DocumentPageViewDropdown } from '~/components/general/document/document-page-view-dropdown';@@ -27,90 +31,66 @@ import {DocumentStatus as DocumentStatusComponent,FRIENDLY_STATUS_MAP,} from '~/components/general/document/document-status';+import { EnvelopeRendererFileSelector } from '~/components/general/envelope-editor/envelope-file-selector';+import EnvelopeGenericPageRenderer from '~/components/general/envelope-editor/envelope-generic-page-renderer';+import { GenericErrorLayout } from '~/components/general/generic-error-layout';import { StackAvatarsWithTooltip } from '~/components/general/stack-avatars-with-tooltip';-import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';+import { useCurrentTeam } from '~/providers/team';import type { Route } from './+types/documents.$id._index';-export async function loader({ params, request }: Route.LoaderArgs) {- const { user } = await getSession(request);-- const teamUrl = params.teamUrl;-- if (!teamUrl) {- throw new Response('Not Found', { status: 404 });- }-- const team = await getTeamByUrl({ userId: user.id, teamUrl });-- const { id } = params;-- const documentId = Number(id);-- const documentRootPath = formatDocumentsPath(team.url);-- if (!documentId || Number.isNaN(documentId)) {- throw redirect(documentRootPath);- }+export default function DocumentPage({ params }: Route.ComponentProps) {+ const { t } = useLingui();+ const { user } = useSession();- const document = await getDocumentWithDetailsById({- documentId,- userId: user.id,- teamId: team.id,- }).catch(() => null);+ const team = useCurrentTeam();- // Todo: 401 or 404 page.- if (!document) {- throw redirect(documentRootPath);- }+ const {+ data: envelope,+ isLoading: isLoadingEnvelope,+ isError: isErrorEnvelope,+ } = trpc.envelope.get.useQuery({+ envelopeId: params.id,+ });- const documentVisibility = document?.visibility;- const currentTeamMemberRole = team.currentTeamRole;- const isRecipient = document?.recipients.find((recipient) => recipient.email === user.email);-- let canAccessDocument = true;-- if (!isRecipient && document?.userId !== user.id) {- canAccessDocument = match([documentVisibility, currentTeamMemberRole])- .with([DocumentVisibility.EVERYONE, TeamMemberRole.ADMIN], () => true)- .with([DocumentVisibility.EVERYONE, TeamMemberRole.MANAGER], () => true)- .with([DocumentVisibility.EVERYONE, TeamMemberRole.MEMBER], () => true)- .with([DocumentVisibility.MANAGER_AND_ABOVE, TeamMemberRole.ADMIN], () => true)- .with([DocumentVisibility.MANAGER_AND_ABOVE, TeamMemberRole.MANAGER], () => true)- .with([DocumentVisibility.ADMIN, TeamMemberRole.ADMIN], () => true)- .otherwise(() => false);+ if (isLoadingEnvelope) {+ return (+ <div className="text-foreground flex w-screen flex-col items-center justify-center gap-2 py-64">+ <Spinner />+ <Trans>Loading</Trans>+ </div>+ );}- if (!document || !document.documentData || !canAccessDocument) {- throw redirect(documentRootPath);+ if (isErrorEnvelope || !envelope) {+ return (+ <GenericErrorLayout+ errorCode={404}+ errorCodeMap={{+ 404: {+ heading: msg`Not found`,+ subHeading: msg`404 Not found`,+ message: msg`The document you are looking for may have been removed, renamed or may have never+ existed.`,+ },+ }}+ primaryButton={+ <Button asChild>+ <Link to={`/t/${team.url}/documents`}>+ <Trans>Go back</Trans>+ </Link>+ </Button>+ }+ />+ );}- logDocumentAccess({- request,- documentId,- userId: user.id,- });-- return superLoaderJson({- document,- documentRootPath,- });-}--export default function DocumentPage() {- const loaderData = useSuperLoaderData<typeof loader>();-- const { _ } = useLingui();- const { user } = useSession();-- const { document, documentRootPath } = loaderData;-- const { recipients, documentData, documentMeta } = document;+ const documentRootPath = formatDocumentsPath(team.url);return (<div className="mx-auto -mt-4 w-full max-w-screen-xl px-4 md:px-8">- {document.status === DocumentStatus.PENDING && (- <DocumentRecipientLinkCopyDialog recipients={recipients} />+ {envelope.status === DocumentStatus.PENDING && (+ <DocumentRecipientLinkCopyDialog recipients={envelope.recipients} />)}<Link to={documentRootPath} className="flex items-center text-[#7AC455] hover:opacity-80">@@ -122,35 +102,35 @@ export default function DocumentPage() {<div><h1className="mt-4 block max-w-[20rem] truncate text-2xl font-semibold md:max-w-[30rem] md:text-3xl"- title={document.title}+ title={envelope.title}>- {document.title}+ {envelope.title}</h1><div className="mt-2.5 flex items-center gap-x-6"><DocumentStatusComponentinheritColor- status={document.status}+ status={envelope.status}className="text-muted-foreground"/>- {recipients.length > 0 && (+ {envelope.recipients.length > 0 && (<div className="text-muted-foreground flex items-center"><Users2 className="mr-2 h-5 w-5" /><StackAvatarsWithTooltip- recipients={recipients}- documentStatus={document.status}+ recipients={envelope.recipients}+ documentStatus={envelope.status}position="bottom"><span>- <Trans>{recipients.length} Recipient(s)</Trans>+ <Trans>{envelope.recipients.length} Recipient(s)</Trans></span></StackAvatarsWithTooltip></div>)}- {document.deletedAt && (+ {envelope.deletedAt && (<Badge variant="destructive"><Trans>Document deleted</Trans></Badge>@@ -165,33 +145,47 @@ export default function DocumentPage() {gradient><CardContent className="p-2">- <PDFViewer document={document} key={documentData.id} documentData={documentData} />+ {envelope.internalVersion === 2 ? (+ <EnvelopeRenderProvider envelope={envelope} fields={envelope.fields}>+ <EnvelopeRendererFileSelector fields={envelope.fields} className="mb-4 p-0" />++ <PDFViewerKonvaLazy customPageRenderer={EnvelopeGenericPageRenderer} />+ </EnvelopeRenderProvider>+ ) : (+ <>+ {envelope.status !== DocumentStatus.COMPLETED && (+ <DocumentReadOnlyFields+ fields={mapFieldsWithRecipients(envelope.fields, envelope.recipients)}+ documentMeta={envelope.documentMeta || undefined}+ showRecipientTooltip={true}+ showRecipientColors={true}+ recipientIds={envelope.recipients.map((recipient) => recipient.id)}+ />+ )}++ <PDFViewer+ document={envelope}+ key={envelope.envelopeItems[0].id}+ documentData={envelope.envelopeItems[0].documentData}+ />+ </>+ )}</CardContent></Card>- {document.status !== DocumentStatus.COMPLETED && (- <DocumentReadOnlyFields- fields={document.fields}- documentMeta={documentMeta || undefined}- showRecipientTooltip={true}- showRecipientColors={true}- recipientIds={recipients.map((recipient) => recipient.id)}- />- )}-<div className="col-span-12 lg:col-span-6 xl:col-span-5"><div className="space-y-6"><section className="border-border bg-widget flex flex-col rounded-xl border pb-4 pt-6"><div className="flex flex-row items-center justify-between px-4"><h3 className="text-foreground text-2xl font-semibold">- {_(FRIENDLY_STATUS_MAP[document.status].labelExtended)}+ {t(FRIENDLY_STATUS_MAP[envelope.status].labelExtended)}</h3>- <DocumentPageViewDropdown document={document} />+ <DocumentPageViewDropdown envelope={envelope} /></div><p className="text-muted-foreground mt-2 px-4 text-sm">- {match(document.status)+ {match(envelope.status).with(DocumentStatus.COMPLETED, () => (<Trans>This document has been signed by all recipients</Trans>))@@ -202,7 +196,7 @@ export default function DocumentPage() {<Trans>This document is currently a draft and has not been sent</Trans>)).with(DocumentStatus.PENDING, () => {- const pendingRecipients = recipients.filter(+ const pendingRecipients = envelope.recipients.filter((recipient) => recipient.signingStatus === 'NOT_SIGNED',);@@ -218,18 +212,21 @@ export default function DocumentPage() {</p><div className="mt-4 border-t px-4 pt-4">- <DocumentPageViewButton document={document} />+ <DocumentPageViewButton envelope={envelope} /></div></section>{/* Document information section. */}- <DocumentPageViewInformation document={document} userId={user.id} />+ <DocumentPageViewInformation envelope={envelope} userId={user.id} />{/* Recipients section. */}- <DocumentPageViewRecipients document={document} documentRootPath={documentRootPath} />+ <DocumentPageViewRecipients envelope={envelope} documentRootPath={documentRootPath} />{/* Recent activity section. */}- <DocumentPageViewRecentActivity documentId={document.id} userId={user.id} />+ <DocumentPageViewRecentActivity+ documentId={mapSecondaryIdToDocumentId(envelope.secondaryId)}+ userId={user.id}+ /></div></div></div>diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsxnew file mode 100644index 000000000..1929aa4d9--- /dev/null+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx@@ -0,0 +1,90 @@+import { msg } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { EnvelopeType } from '@prisma/client';+import { ChevronLeftIcon } from 'lucide-react';+import { Link, Outlet, isRouteErrorResponse, redirect } from 'react-router';++import { getSession } from '@documenso/auth/server/lib/utils/get-session';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';+import { Button } from '@documenso/ui/primitives/button';++import { GenericErrorLayout } from '~/components/general/generic-error-layout';++import type { Route } from './+types/settings._layout';++/**+ * This file is very similar for templates as well. Any changes here should also be adjusted there as well.+ *+ * File: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+ */+export async function loader({ request, params }: Route.LoaderArgs) {+ const { id } = params;++ const documentId = Number(id);++ // If ID is a number, redirect to use envelope ID instead.+ if (!Number.isNaN(documentId)) {+ const { user } = await getSession(request);++ const team = await getTeamByUrl({+ userId: user.id,+ teamUrl: params.teamUrl,+ });++ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,+ userId: user.id,+ teamId: team.id,+ }).catch((err) => {+ const error = AppError.parseError(err);++ if (error.code === AppErrorCode.NOT_FOUND) {+ throw new Response('Not Found', { status: 404 });+ }++ throw err;+ });++ const url = new URL(request.url);++ throw redirect(url.pathname.replace(`/documents/${id}`, `/documents/${envelope.id}`));+ }+}++export default function DocumentsLayout() {+ return <Outlet />;+}++export function ErrorBoundary({ error, params }: Route.ErrorBoundaryProps) {+ const errorCode = isRouteErrorResponse(error) ? error.status : 500;++ const errorCodeMap = {+ 404: {+ subHeading: msg`404 Document not found`,+ heading: msg`Oops! Something went wrong.`,+ message: msg`The document you are looking for could not be found.`,+ },+ };++ return (+ <GenericErrorLayout+ errorCode={errorCode}+ errorCodeMap={errorCodeMap}+ secondaryButton={null}+ primaryButton={+ <Button asChild className="w-32">+ <Link to={`/t/${params.teamUrl}/documents`}>+ <ChevronLeftIcon className="mr-2 h-4 w-4" />+ <Trans>Go Back</Trans>+ </Link>+ </Button>+ }+ />+ );+}diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxindex bc449625b..1b9072780 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx@@ -1,157 +1,107 @@-import { Plural, Trans } from '@lingui/react/macro';-import { TeamMemberRole } from '@prisma/client';-import { ChevronLeft, Users2 } from 'lucide-react';-import { Link, redirect } from 'react-router';-import { match } from 'ts-pattern';+import { useEffect } from 'react';-import { getSession } from '@documenso/auth/server/lib/utils/get-session';-import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';-import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';-import { DocumentVisibility } from '@documenso/lib/types/document-visibility';-import { isDocumentCompleted } from '@documenso/lib/utils/document';-import { logDocumentAccess } from '@documenso/lib/utils/logger';-import { formatDocumentsPath } from '@documenso/lib/utils/teams';+import { msg } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { EnvelopeType } from '@prisma/client';+import { Link, useNavigate } from 'react-router';-import { DocumentEditForm } from '~/components/general/document/document-edit-form';-import { DocumentStatus } from '~/components/general/document/document-status';-import { LegacyFieldWarningPopover } from '~/components/general/legacy-field-warning-popover';-import { StackAvatarsWithTooltip } from '~/components/general/stack-avatars-with-tooltip';-import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';+import { EnvelopeEditorProvider } from '@documenso/lib/client-only/providers/envelope-editor-provider';+import { EnvelopeRenderProvider } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams';+import { trpc } from '@documenso/trpc/react';+import { Button } from '@documenso/ui/primitives/button';+import { Spinner } from '@documenso/ui/primitives/spinner';-import type { Route } from './+types/documents.$id.edit';--export async function loader({ params, request }: Route.LoaderArgs) {- const { user } = await getSession(request);-- const teamUrl = params.teamUrl;-- if (!teamUrl) {- throw new Response('Not Found', { status: 404 });- }-- const team = await getTeamByUrl({ userId: user.id, teamUrl });-- const { id } = params;-- const documentId = Number(id);-- const documentRootPath = formatDocumentsPath(team.url);+import EnvelopeEditor from '~/components/general/envelope-editor/envelope-editor';+import { GenericErrorLayout } from '~/components/general/generic-error-layout';+import { useCurrentTeam } from '~/providers/team';- if (!documentId || Number.isNaN(documentId)) {- throw redirect(documentRootPath);- }-- const document = await getDocumentWithDetailsById({- documentId,- userId: user.id,- teamId: team.id,- }).catch(() => null);-- if (document?.teamId && !team?.url) {- throw redirect(documentRootPath);- }-- const documentVisibility = document?.visibility;- const currentTeamMemberRole = team.currentTeamRole;- const isRecipient = document?.recipients.find((recipient) => recipient.email === user.email);- let canAccessDocument = true;+import type { Route } from './+types/documents.$id.edit';- if (!isRecipient && document?.userId !== user.id) {- canAccessDocument = match([documentVisibility, currentTeamMemberRole])- .with([DocumentVisibility.EVERYONE, TeamMemberRole.ADMIN], () => true)- .with([DocumentVisibility.EVERYONE, TeamMemberRole.MANAGER], () => true)- .with([DocumentVisibility.EVERYONE, TeamMemberRole.MEMBER], () => true)- .with([DocumentVisibility.MANAGER_AND_ABOVE, TeamMemberRole.ADMIN], () => true)- .with([DocumentVisibility.MANAGER_AND_ABOVE, TeamMemberRole.MANAGER], () => true)- .with([DocumentVisibility.ADMIN, TeamMemberRole.ADMIN], () => true)- .otherwise(() => false);- }+export default function EnvelopeEditorPage({ params }: Route.ComponentProps) {+ const navigate = useNavigate();+ const team = useCurrentTeam();++ const {+ data: envelope,+ isLoading: isLoadingEnvelope,+ isError: isErrorEnvelope,+ } = trpc.envelope.get.useQuery(+ {+ envelopeId: params.id,+ },+ {+ retry: false,+ },+ );- if (!document) {- throw redirect(documentRootPath);+ /**+ * Need to handle redirecting to legacy editor on the client side to reduce server+ * requests for the majority use case.+ */+ useEffect(() => {+ if (!envelope) {+ return;+ }++ const pathPrefix =+ envelope.type === EnvelopeType.DOCUMENT+ ? formatDocumentsPath(team.url)+ : formatTemplatesPath(team.url);++ if (envelope.teamId !== team.id) {+ void navigate(pathPrefix, { replace: true });+ } else if (envelope.internalVersion !== 2) {+ void navigate(`${pathPrefix}/${envelope.id}/legacy_editor`, { replace: true });+ }+ }, [envelope, team, navigate]);++ if (envelope && (envelope.teamId !== team.id || envelope.internalVersion !== 2)) {+ return (+ <div className="text-foreground flex h-screen w-screen flex-col items-center justify-center gap-2">+ <Spinner />+ <Trans>Redirecting</Trans>+ </div>+ );}- if (team && !canAccessDocument) {- throw redirect(documentRootPath);+ if (isLoadingEnvelope) {+ return (+ <div className="text-foreground flex h-screen w-screen flex-col items-center justify-center gap-2">+ <Spinner />+ <Trans>Loading</Trans>+ </div>+ );}- if (isDocumentCompleted(document.status)) {- throw redirect(`${documentRootPath}/${documentId}`);+ if (isErrorEnvelope || !envelope) {+ return (+ <GenericErrorLayout+ errorCode={404}+ errorCodeMap={{+ 404: {+ heading: msg`Not found`,+ subHeading: msg`404 Not found`,+ message: msg`The document you are looking for may have been removed, renamed or may have never+ existed.`,+ },+ }}+ primaryButton={+ <Button asChild>+ <Link to={`/t/${team.url}/documents`}>+ <Trans>Go home</Trans>+ </Link>+ </Button>+ }+ />+ );}- logDocumentAccess({- request,- documentId,- userId: user.id,- });-- return superLoaderJson({- document: {- ...document,- folder: null,- },- documentRootPath,- });-}--export default function DocumentEditPage() {- const { document, documentRootPath } = useSuperLoaderData<typeof loader>();-- const { recipients } = document;-return (- <div className="mx-auto -mt-4 w-full max-w-screen-xl px-4 md:px-8">- <Link to={documentRootPath} className="flex items-center text-[#7AC455] hover:opacity-80">- <ChevronLeft className="mr-2 inline-block h-5 w-5" />- <Trans>Documents</Trans>- </Link>-- <div className="mt-4 flex w-full items-end justify-between">- <div className="flex-1">- <h1- className="block max-w-[20rem] truncate text-2xl font-semibold md:max-w-[30rem] md:text-3xl"- title={document.title}- >- {document.title}- </h1>-- <div className="mt-2.5 flex items-center gap-x-6">- <DocumentStatus- inheritColor- status={document.status}- className="text-muted-foreground"- />-- {recipients.length > 0 && (- <div className="text-muted-foreground flex items-center">- <Users2 className="mr-2 h-5 w-5" />-- <StackAvatarsWithTooltip- recipients={recipients}- documentStatus={document.status}- position="bottom"- >- <span>- <Plural one="1 Recipient" other="# Recipients" value={recipients.length} />- </span>- </StackAvatarsWithTooltip>- </div>- )}- </div>- </div>-- {document.useLegacyFieldInsertion && (- <div>- <LegacyFieldWarningPopover type="document" documentId={document.id} />- </div>- )}- </div>-- <DocumentEditForm- className="mt-6"- initialDocument={document}- documentRootPath={documentRootPath}- />- </div>+ <EnvelopeEditorProvider initialEnvelope={envelope}>+ <EnvelopeRenderProvider envelope={envelope}>+ <EnvelopeEditor />+ </EnvelopeRenderProvider>+ </EnvelopeEditorProvider>);}diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxnew file mode 100644index 000000000..670db608e--- /dev/null+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx@@ -0,0 +1,139 @@+import { Plural, Trans } from '@lingui/react/macro';+import { ChevronLeft, Users2 } from 'lucide-react';+import { Link, redirect } from 'react-router';++import { getSession } from '@documenso/auth/server/lib/utils/get-session';+import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';+import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';+import { isDocumentCompleted } from '@documenso/lib/utils/document';+import { logDocumentAccess } from '@documenso/lib/utils/logger';+import { canAccessTeamDocument, formatDocumentsPath } from '@documenso/lib/utils/teams';++import { DocumentEditForm } from '~/components/general/document/document-edit-form';+import { DocumentStatus } from '~/components/general/document/document-status';+import { LegacyFieldWarningPopover } from '~/components/general/legacy-field-warning-popover';+import { StackAvatarsWithTooltip } from '~/components/general/stack-avatars-with-tooltip';+import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';++import type { Route } from './+types/documents.$id.edit';++export async function loader({ params, request }: Route.LoaderArgs) {+ const { id, teamUrl } = params;++ if (!id || !teamUrl) {+ throw new Response('Not Found', { status: 404 });+ }++ const { user } = await getSession(request);++ const team = await getTeamByUrl({ userId: user.id, teamUrl });++ const documentRootPath = formatDocumentsPath(team.url);++ const document = await getDocumentWithDetailsById({+ id: {+ type: 'envelopeId',+ id,+ },+ userId: user.id,+ teamId: team.id,+ }).catch(() => null);++ if (!document) {+ throw new Response('Not Found', { status: 404 });+ }++ const documentVisibility = document.visibility;+ const currentTeamMemberRole = team.currentTeamRole;+ const isRecipient = document.recipients.find((recipient) => recipient.email === user.email);++ let canAccessDocument = true;++ if (!isRecipient && document.userId !== user.id) {+ canAccessDocument = canAccessTeamDocument(currentTeamMemberRole, documentVisibility);+ }++ if (!canAccessDocument) {+ throw new Response('Not Found', { status: 404 });+ }++ if (isDocumentCompleted(document.status)) {+ throw redirect(`${documentRootPath}/${id}`);+ }++ logDocumentAccess({+ request,+ documentId: document.id,+ userId: user.id,+ });++ return superLoaderJson({+ document: {+ ...document,+ folder: null,+ },+ documentRootPath,+ });+}++export default function DocumentEditPage() {+ const { document, documentRootPath } = useSuperLoaderData<typeof loader>();++ const { recipients } = document;++ return (+ <div className="mx-auto -mt-4 w-full max-w-screen-xl px-4 md:px-8">+ <Link to={documentRootPath} className="flex items-center text-[#7AC455] hover:opacity-80">+ <ChevronLeft className="mr-2 inline-block h-5 w-5" />+ <Trans>Documents</Trans>+ </Link>++ <div className="mt-4 flex w-full items-end justify-between">+ <div className="flex-1">+ <h1+ className="block max-w-[20rem] truncate text-2xl font-semibold md:max-w-[30rem] md:text-3xl"+ title={document.title}+ >+ {document.title}+ </h1>++ <div className="mt-2.5 flex items-center gap-x-6">+ <DocumentStatus+ inheritColor+ status={document.status}+ className="text-muted-foreground"+ />++ {recipients.length > 0 && (+ <div className="text-muted-foreground flex items-center">+ <Users2 className="mr-2 h-5 w-5" />++ <StackAvatarsWithTooltip+ recipients={recipients}+ documentStatus={document.status}+ position="bottom"+ >+ <span>+ <Plural one="1 Recipient" other="# Recipients" value={recipients.length} />+ </span>+ </StackAvatarsWithTooltip>+ </div>+ )}+ </div>+ </div>++ {document.useLegacyFieldInsertion && (+ <div>+ <LegacyFieldWarningPopover type="document" documentId={document.id} />+ </div>+ )}+ </div>++ <DocumentEditForm+ className="mt-6"+ initialDocument={document}+ documentRootPath={documentRootPath}+ />+ </div>+ );+}diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxindex b27ded2bb..7cf5cf731 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsx@@ -2,15 +2,15 @@ import type { MessageDescriptor } from '@lingui/core';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { Recipient } from '@prisma/client';+import { EnvelopeType, type Recipient } from '@prisma/client';import { ChevronLeft } from 'lucide-react';import { DateTime } from 'luxon';-import { Link, redirect } from 'react-router';+import { Link } from 'react-router';import { getSession } from '@documenso/auth/server/lib/utils/get-session';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';-import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { logDocumentAccess } from '@documenso/lib/utils/logger';import { formatDocumentsPath } from '@documenso/lib/utils/teams';import { Card } from '@documenso/ui/primitives/card';@@ -26,45 +26,54 @@ import { DocumentLogsTable } from '~/components/tables/document-logs-table';import type { Route } from './+types/documents.$id.logs';export async function loader({ params, request }: Route.LoaderArgs) {- const { user } = await getSession(request);+ const { id, teamUrl } = params;- const team = await getTeamByUrl({ userId: user.id, teamUrl: params.teamUrl });+ if (!id || !teamUrl) {+ throw new Response('Not Found', { status: 404 });+ }- const { id } = params;+ const { user } = await getSession(request);- const documentId = Number(id);+ const team = await getTeamByUrl({ userId: user.id, teamUrl });const documentRootPath = formatDocumentsPath(team.url);- if (!documentId || Number.isNaN(documentId)) {- throw redirect(documentRootPath);- }-- const document = await getDocumentById({- documentId,+ const envelope = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,}).catch(() => null);- if (!document || !document.documentData) {- throw redirect(documentRootPath);+ if (!envelope) {+ throw new Response('Not Found', { status: 404 });}- const recipients = await getRecipientsForDocument({- documentId,- userId: user.id,- teamId: team?.id,- });-logDocumentAccess({request,- documentId,+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),userId: user.id,});return {- document,- recipients,+ // Only return necessary data+ document: {+ id: mapSecondaryIdToDocumentId(envelope.secondaryId),+ envelopeId: envelope.id,+ title: envelope.title,+ status: envelope.status,+ user: {+ name: envelope.user.name,+ email: envelope.user.email,+ },+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ documentMeta: envelope.documentMeta,+ },+ recipients: envelope.recipients,documentRootPath,};}@@ -123,7 +132,7 @@ export default function DocumentsLogsPage({ loaderData }: Route.ComponentProps)return (<div className="mx-auto -mt-4 w-full max-w-screen-xl px-4 md:px-8"><Link- to={`${documentRootPath}/${document.id}`}+ to={`${documentRootPath}/${document.envelopeId}`}className="flex items-center text-[#7AC455] hover:opacity-80"><ChevronLeft className="mr-2 inline-block h-5 w-5" />diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsxindex eac87bae7..f3385db68 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx@@ -108,6 +108,7 @@ export default function DocumentsPage() {}}, [data?.stats]);+ // Todo: Envelopes - Change the dropzone wrapper to create to V2 documents after we're ready.return (<DocumentDropZoneWrapper><div className="mx-auto w-full max-w-screen-xl px-4 md:px-8">diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.public-profile.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.public-profile.tsxindex f6c6d36e4..e4453d960 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.public-profile.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.public-profile.tsx@@ -2,8 +2,7 @@ import { useEffect, useMemo, useState } from 'react';import { useLingui } from '@lingui/react/macro';import { Trans } from '@lingui/react/macro';-import type { TemplateDirectLink } from '@prisma/client';-import { TemplateType } from '@prisma/client';+import { type TemplateDirectLink, TemplateType } from '@prisma/client';import { getSession } from '@documenso/auth/server/lib/utils/get-session';import { useSession } from '@documenso/lib/client-only/providers/session';diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsxindex 2b65d8df6..df2649398 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx@@ -1,20 +1,27 @@-import { Trans } from '@lingui/react/macro';+import { msg } from '@lingui/core/macro';+import { Trans, useLingui } from '@lingui/react/macro';import { DocumentSigningOrder, SigningStatus } from '@prisma/client';import { ChevronLeft, LucideEdit } from 'lucide-react';-import { Link, redirect, useNavigate } from 'react-router';+import { Link, useNavigate } from 'react-router';-import { getSession } from '@documenso/auth/server/lib/utils/get-session';-import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';-import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';+import { EnvelopeRenderProvider } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { useSession } from '@documenso/lib/client-only/providers/session';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams';+import { trpc } from '@documenso/trpc/react';import { DocumentReadOnlyFields } from '@documenso/ui/components/document/document-read-only-fields';+import PDFViewerKonvaLazy from '@documenso/ui/components/pdf-viewer/pdf-viewer-konva-lazy';import { Button } from '@documenso/ui/primitives/button';import { Card, CardContent } from '@documenso/ui/primitives/card';import { PDFViewer } from '@documenso/ui/primitives/pdf-viewer';+import { Spinner } from '@documenso/ui/primitives/spinner';import { TemplateBulkSendDialog } from '~/components/dialogs/template-bulk-send-dialog';-import { TemplateDirectLinkDialogWrapper } from '~/components/dialogs/template-direct-link-dialog-wrapper';+import { TemplateDirectLinkDialog } from '~/components/dialogs/template-direct-link-dialog';import { TemplateUseDialog } from '~/components/dialogs/template-use-dialog';+import { EnvelopeRendererFileSelector } from '~/components/general/envelope-editor/envelope-file-selector';+import EnvelopeGenericPageRenderer from '~/components/general/envelope-editor/envelope-generic-page-renderer';+import { GenericErrorLayout } from '~/components/general/generic-error-layout';import { TemplateDirectLinkBadge } from '~/components/general/template/template-direct-link-badge';import { TemplatePageViewDocumentsTable } from '~/components/general/template/template-page-view-documents-table';import { TemplatePageViewInformation } from '~/components/general/template/template-page-view-information';@@ -22,55 +29,65 @@ import { TemplatePageViewRecentActivity } from '~/components/general/template/teimport { TemplatePageViewRecipients } from '~/components/general/template/template-page-view-recipients';import { TemplateType } from '~/components/general/template/template-type';import { TemplatesTableActionDropdown } from '~/components/tables/templates-table-action-dropdown';-import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';+import { useCurrentTeam } from '~/providers/team';import type { Route } from './+types/templates.$id._index';-export async function loader({ params, request }: Route.LoaderArgs) {- const { user } = await getSession(request);-- const team = await getTeamByUrl({ userId: user.id, teamUrl: params.teamUrl });+export default function TemplatePage({ params }: Route.ComponentProps) {+ const { t } = useLingui();+ const { user } = useSession();+ const navigate = useNavigate();- const { id } = params;+ const team = useCurrentTeam();- const templateId = Number(id);- const templateRootPath = formatTemplatesPath(team.url);- const documentRootPath = formatDocumentsPath(team.url);+ const {+ data: envelope,+ isLoading: isLoadingEnvelope,+ isError: isErrorEnvelope,+ } = trpc.envelope.get.useQuery({+ envelopeId: params.id,+ });- if (!templateId || Number.isNaN(templateId)) {- throw redirect(templateRootPath);+ if (isLoadingEnvelope) {+ return (+ <div className="text-foreground flex w-screen flex-col items-center justify-center gap-2 py-64">+ <Spinner />+ <Trans>Loading</Trans>+ </div>+ );}- const template = await getTemplateById({- id: templateId,- userId: user.id,- teamId: team?.id,- }).catch(() => null);-- if (!template || !template.templateDocumentData || (template?.teamId && !team.url)) {- throw redirect(templateRootPath);+ if (isErrorEnvelope || !envelope) {+ return (+ <GenericErrorLayout+ errorCode={404}+ errorCodeMap={{+ 404: {+ heading: msg`Not found`,+ subHeading: msg`404 Not found`,+ message: msg`The template you are looking for may have been removed, renamed or may have never+ existed.`,+ },+ }}+ primaryButton={+ <Button asChild>+ <Link to={`/t/${team.url}/templates`}>+ <Trans>Go back</Trans>+ </Link>+ </Button>+ }+ />+ );}- return superLoaderJson({- user,- team,- template,- templateRootPath,- documentRootPath,- });-}--export default function TemplatePage() {- const { user, team, template, templateRootPath, documentRootPath } =- useSuperLoaderData<typeof loader>();-- const { templateDocumentData, fields, recipients, templateMeta } = template;-- const navigate = useNavigate();+ const documentRootPath = formatDocumentsPath(team.url);+ const templateRootPath = formatTemplatesPath(team.url);// Remap to fit the DocumentReadOnlyFields component.- const readOnlyFields = fields.map((field) => {- const recipient = recipients.find((recipient) => recipient.id === field.recipientId) || {+ const readOnlyFields = envelope.fields.map((field) => {+ const recipient = envelope.recipients.find(+ (recipient) => recipient.id === field.recipientId,+ ) || {name: '',email: '',signingStatus: SigningStatus.NOT_SIGNED,@@ -83,10 +100,10 @@ export default function TemplatePage() {};});- const mockedDocumentMeta = templateMeta+ const mockedDocumentMeta = envelope.documentMeta? {- ...templateMeta,- signingOrder: templateMeta.signingOrder || DocumentSigningOrder.SEQUENTIAL,+ ...envelope.documentMeta,+ signingOrder: envelope.documentMeta.signingOrder || DocumentSigningOrder.SEQUENTIAL,documentId: 0,}: undefined;@@ -102,31 +119,42 @@ export default function TemplatePage() {<div><h1className="mt-4 block max-w-[20rem] truncate text-2xl font-semibold md:max-w-[30rem] md:text-3xl"- title={template.title}+ title={envelope.title}>- {template.title}+ {envelope.title}</h1><div className="mt-2.5 flex items-center">- <TemplateType inheritColor className="text-muted-foreground" type={template.type} />+ <TemplateType+ inheritColor+ className="text-muted-foreground"+ type={envelope.templateType}+ />- {template.directLink?.token && (+ {envelope.directLink?.token && (<TemplateDirectLinkBadgeclassName="ml-4"- token={template.directLink.token}- enabled={template.directLink.enabled}+ token={envelope.directLink.token}+ enabled={envelope.directLink.enabled}/>)}</div></div><div className="mt-2 flex flex-row space-x-4 sm:mt-0 sm:self-end">- <TemplateDirectLinkDialogWrapper template={template} />+ <TemplateDirectLinkDialog+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ directLink={envelope.directLink}+ recipients={envelope.recipients}+ />- <TemplateBulkSendDialog templateId={template.id} recipients={template.recipients} />+ <TemplateBulkSendDialog+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ recipients={envelope.recipients}+ /><Button className="w-full" asChild>- <Link to={`${templateRootPath}/${template.id}/edit`}>+ <Link to={`${templateRootPath}/${envelope.id}/edit`}><LucideEdit className="mr-1.5 h-3.5 w-3.5" /><Trans>Edit Template</Trans></Link>@@ -140,19 +168,33 @@ export default function TemplatePage() {gradient><CardContent className="p-2">- <PDFViewer document={template} key={template.id} documentData={templateDocumentData} />+ {envelope.internalVersion === 2 ? (+ <EnvelopeRenderProvider envelope={envelope} fields={envelope.fields}>+ <EnvelopeRendererFileSelector fields={envelope.fields} className="mb-4 p-0" />++ <PDFViewerKonvaLazy customPageRenderer={EnvelopeGenericPageRenderer} />+ </EnvelopeRenderProvider>+ ) : (+ <>+ <DocumentReadOnlyFields+ fields={readOnlyFields}+ showFieldStatus={false}+ showRecipientTooltip={true}+ showRecipientColors={true}+ recipientIds={envelope.recipients.map((recipient) => recipient.id)}+ documentMeta={mockedDocumentMeta}+ />++ <PDFViewer+ document={envelope}+ key={envelope.envelopeItems[0].id}+ documentData={envelope.envelopeItems[0].documentData}+ />+ </>+ )}</CardContent></Card>- <DocumentReadOnlyFields- fields={readOnlyFields}- showFieldStatus={false}- showRecipientTooltip={true}- showRecipientColors={true}- recipientIds={recipients.map((recipient) => recipient.id)}- documentMeta={mockedDocumentMeta}- />-<div className="col-span-12 lg:col-span-6 xl:col-span-5"><div className="space-y-6"><section className="border-border bg-widget flex flex-col rounded-xl border pb-4 pt-6">@@ -163,7 +205,11 @@ export default function TemplatePage() {<div><TemplatesTableActionDropdown- row={template}+ row={{+ ...envelope,+ id: mapSecondaryIdToTemplateId(envelope.secondaryId),+ envelopeId: envelope.id,+ }}teamId={team?.id}templateRootPath={templateRootPath}onDelete={async () => navigate(templateRootPath)}@@ -177,9 +223,9 @@ export default function TemplatePage() {<div className="mt-4 border-t px-4 pt-4"><TemplateUseDialog- templateId={template.id}- templateSigningOrder={template.templateMeta?.signingOrder}- recipients={template.recipients}+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ templateSigningOrder={envelope.documentMeta?.signingOrder}+ recipients={envelope.recipients}documentRootPath={documentRootPath}trigger={<Button className="w-full">@@ -191,15 +237,19 @@ export default function TemplatePage() {</section>{/* Template information section. */}- <TemplatePageViewInformation template={template} userId={user.id} />+ <TemplatePageViewInformation template={envelope} userId={user.id} />{/* Recipients section. */}- <TemplatePageViewRecipients template={template} templateRootPath={templateRootPath} />+ <TemplatePageViewRecipients+ recipients={envelope.recipients}+ envelopeId={envelope.id}+ templateRootPath={templateRootPath}+ />{/* Recent activity section. */}<TemplatePageViewRecentActivitydocumentRootPath={documentRootPath}- templateId={template.id}+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}/></div></div>@@ -210,7 +260,9 @@ export default function TemplatePage() {<Trans>Documents created from template</Trans></h1>- <TemplatePageViewDocumentsTable templateId={template.id} />+ <TemplatePageViewDocumentsTable+ templateId={mapSecondaryIdToTemplateId(envelope.secondaryId)}+ /></div></div>);diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsxnew file mode 100644index 000000000..bb3a21df0--- /dev/null+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx@@ -0,0 +1,90 @@+import { msg } from '@lingui/core/macro';+import { Trans } from '@lingui/react/macro';+import { EnvelopeType } from '@prisma/client';+import { ChevronLeftIcon } from 'lucide-react';+import { Link, Outlet, isRouteErrorResponse, redirect } from 'react-router';++import { getSession } from '@documenso/auth/server/lib/utils/get-session';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';+import { Button } from '@documenso/ui/primitives/button';++import { GenericErrorLayout } from '~/components/general/generic-error-layout';++import type { Route } from './+types/settings._layout';++/**+ * This file is very similar for documents as well. Any changes here should also be adjusted there as well.+ *+ * File: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+ */+export async function loader({ request, params }: Route.LoaderArgs) {+ const { id } = params;++ const templateId = Number(id);++ // If ID is a number, redirect to use envelope ID instead.+ if (!Number.isNaN(templateId)) {+ const { user } = await getSession(request);++ const team = await getTeamByUrl({+ userId: user.id,+ teamUrl: params.teamUrl,+ });++ const envelope = await getEnvelopeById({+ id: {+ type: 'templateId',+ id: templateId,+ },+ type: EnvelopeType.TEMPLATE,+ userId: user.id,+ teamId: team.id,+ }).catch((err) => {+ const error = AppError.parseError(err);++ if (error.code === AppErrorCode.NOT_FOUND) {+ throw new Response('Not Found', { status: 404 });+ }++ throw err;+ });++ const url = new URL(request.url);++ throw redirect(url.pathname.replace(`/templates/${id}`, `/templates/${envelope.id}`));+ }+}++export default function TemplatesLayout() {+ return <Outlet />;+}++export function ErrorBoundary({ error, params }: Route.ErrorBoundaryProps) {+ const errorCode = isRouteErrorResponse(error) ? error.status : 500;++ const errorCodeMap = {+ 404: {+ subHeading: msg`404 Template not found`,+ heading: msg`Oops! Something went wrong.`,+ message: msg`The template you are looking for could not be found.`,+ },+ };++ return (+ <GenericErrorLayout+ errorCode={errorCode}+ errorCodeMap={errorCodeMap}+ secondaryButton={null}+ primaryButton={+ <Button asChild className="w-32">+ <Link to={`/t/${params.teamUrl}/templates`}>+ <ChevronLeftIcon className="mr-2 h-4 w-4" />+ <Trans>Go Back</Trans>+ </Link>+ </Button>+ }+ />+ );+}diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsxindex e3bd0eae3..3c48b8461 100644--- a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx@@ -1,108 +1,3 @@-import { Trans } from '@lingui/react/macro';-import { ChevronLeft } from 'lucide-react';-import { Link, redirect } from 'react-router';+import EnvelopeEditorPage from './documents.$id.edit';-import { getSession } from '@documenso/auth/server/lib/utils/get-session';-import { type TGetTeamByUrlResponse, getTeamByUrl } from '@documenso/lib/server-only/team/get-team';-import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';-import { formatTemplatesPath } from '@documenso/lib/utils/teams';--import { TemplateDirectLinkDialogWrapper } from '~/components/dialogs/template-direct-link-dialog-wrapper';-import { LegacyFieldWarningPopover } from '~/components/general/legacy-field-warning-popover';-import { TemplateDirectLinkBadge } from '~/components/general/template/template-direct-link-badge';-import { TemplateEditForm } from '~/components/general/template/template-edit-form';-import { TemplateType } from '~/components/general/template/template-type';-import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';--import type { Route } from './+types/templates.$id.edit';--export async function loader({ params, request }: Route.LoaderArgs) {- const { user } = await getSession(request);-- const team: TGetTeamByUrlResponse = await getTeamByUrl({- userId: user.id,- teamUrl: params.teamUrl,- });-- const { id } = params;-- const templateId = Number(id);- const templateRootPath = formatTemplatesPath(team?.url);-- if (!templateId || Number.isNaN(templateId)) {- throw redirect(templateRootPath);- }-- const template = await getTemplateById({- id: templateId,- userId: user.id,- teamId: team?.id,- }).catch(() => null);-- if (!template || !template.templateDocumentData) {- throw redirect(templateRootPath);- }-- return superLoaderJson({- template: {- ...template,- folder: null,- },- templateRootPath,- });-}--export default function TemplateEditPage() {- const { template, templateRootPath } = useSuperLoaderData<typeof loader>();-- return (- <div className="mx-auto -mt-4 max-w-screen-xl px-4 md:px-8">- <div className="flex flex-col justify-between sm:flex-row">- <div>- <Link- to={`${templateRootPath}/${template.id}`}- className="flex items-center text-[#7AC455] hover:opacity-80"- >- <ChevronLeft className="mr-2 inline-block h-5 w-5" />- <Trans>Template</Trans>- </Link>-- <h1- className="mt-4 block max-w-[20rem] truncate text-2xl font-semibold md:max-w-[30rem] md:text-3xl"- title={template.title}- >- {template.title}- </h1>-- <div className="mt-2.5 flex items-center">- <TemplateType inheritColor className="text-muted-foreground" type={template.type} />-- {template.directLink?.token && (- <TemplateDirectLinkBadge- className="ml-4"- token={template.directLink.token}- enabled={template.directLink.enabled}- />- )}- </div>- </div>-- <div className="mt-2 flex items-center gap-2 sm:mt-0 sm:self-end">- <TemplateDirectLinkDialogWrapper template={template} />-- {template.useLegacyFieldInsertion && (- <div>- <LegacyFieldWarningPopover type="template" templateId={template.id} />- </div>- )}- </div>- </div>-- <TemplateEditForm- className="mt-6"- initialTemplate={template}- templateRootPath={templateRootPath}- />- </div>- );-}+export default EnvelopeEditorPage;diff --git a/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsxnew file mode 100644index 000000000..80d2ccc9e--- /dev/null+++ b/apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx@@ -0,0 +1,111 @@+import { Trans } from '@lingui/react/macro';+import { ChevronLeft } from 'lucide-react';+import { Link, redirect } from 'react-router';++import { getSession } from '@documenso/auth/server/lib/utils/get-session';+import { getTeamByUrl } from '@documenso/lib/server-only/team/get-team';+import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';+import { formatTemplatesPath } from '@documenso/lib/utils/teams';++import { TemplateDirectLinkDialog } from '~/components/dialogs/template-direct-link-dialog';+import { LegacyFieldWarningPopover } from '~/components/general/legacy-field-warning-popover';+import { TemplateDirectLinkBadge } from '~/components/general/template/template-direct-link-badge';+import { TemplateEditForm } from '~/components/general/template/template-edit-form';+import { TemplateType } from '~/components/general/template/template-type';+import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';++import type { Route } from './+types/templates.$id.edit';++export async function loader({ params, request }: Route.LoaderArgs) {+ const { id, teamUrl } = params;++ if (!id || !teamUrl) {+ throw new Response('Not Found', { status: 404 });+ }++ const { user } = await getSession(request);++ const team = await getTeamByUrl({ userId: user.id, teamUrl });++ const templateRootPath = formatTemplatesPath(team.url);++ const template = await getTemplateById({+ id: {+ type: 'envelopeId',+ id,+ },+ userId: user.id,+ teamId: team.id,+ }).catch(() => null);++ if (!template || !template.templateDocumentData) {+ throw redirect(templateRootPath);+ }++ return superLoaderJson({+ template: {+ ...template,+ folder: null,+ },+ templateRootPath,+ });+}++export default function TemplateEditPage() {+ const { template, templateRootPath } = useSuperLoaderData<typeof loader>();++ return (+ <div className="mx-auto -mt-4 max-w-screen-xl px-4 md:px-8">+ <div className="flex flex-col justify-between sm:flex-row">+ <div>+ <Link+ to={`${templateRootPath}/${template.envelopeId}`}+ className="flex items-center text-[#7AC455] hover:opacity-80"+ >+ <ChevronLeft className="mr-2 inline-block h-5 w-5" />+ <Trans>Template</Trans>+ </Link>++ <h1+ className="mt-4 block max-w-[20rem] truncate text-2xl font-semibold md:max-w-[30rem] md:text-3xl"+ title={template.title}+ >+ {template.title}+ </h1>++ <div className="mt-2.5 flex items-center">+ <TemplateType inheritColor className="text-muted-foreground" type={template.type} />++ {template.directLink?.token && (+ <TemplateDirectLinkBadge+ className="ml-4"+ token={template.directLink.token}+ enabled={template.directLink.enabled}+ />+ )}+ </div>+ </div>++ <div className="mt-2 flex items-center gap-2 sm:mt-0 sm:self-end">+ <TemplateDirectLinkDialog+ templateId={template.id}+ directLink={template.directLink}+ recipients={template.recipients}+ />++ {template.useLegacyFieldInsertion && (+ <div>+ <LegacyFieldWarningPopover type="template" templateId={template.id} />+ </div>+ )}+ </div>+ </div>++ <TemplateEditForm+ className="mt-6"+ initialTemplate={template}+ templateRootPath={templateRootPath}+ />+ </div>+ );+}diff --git a/apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx b/apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsxindex d2f625bbc..aa1fc66e5 100644--- a/apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+++ b/apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx@@ -1,14 +1,16 @@import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';+import { EnvelopeType } from '@prisma/client';import { DateTime } from 'luxon';import { redirect } from 'react-router';import { DOCUMENT_STATUS } from '@documenso/lib/constants/document';import { APP_I18N_OPTIONS, ZSupportedLanguageCodeSchema } from '@documenso/lib/constants/i18n';import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles';-import { getEntireDocument } from '@documenso/lib/server-only/admin/get-entire-document';+import { unsafeGetEntireEnvelope } from '@documenso/lib/server-only/admin/get-entire-document';import { decryptSecondaryData } from '@documenso/lib/server-only/crypto/decrypt';import { findDocumentAuditLogs } from '@documenso/lib/server-only/document/find-document-audit-logs';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { getTranslations } from '@documenso/lib/utils/i18n';import { Card, CardContent } from '@documenso/ui/primitives/card';@@ -39,20 +41,24 @@ export async function loader({ request }: Route.LoaderArgs) {const documentId = Number(rawDocumentId);- const document = await getEntireDocument({- id: documentId,+ const envelope = await unsafeGetEntireEnvelope({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,}).catch(() => null);- if (!document) {+ if (!envelope) {throw redirect('/');}- const documentLanguage = ZSupportedLanguageCodeSchema.parse(document.documentMeta?.language);+ const documentLanguage = ZSupportedLanguageCodeSchema.parse(envelope.documentMeta?.language);const { data: auditLogs } = await findDocumentAuditLogs({documentId: documentId,- userId: document.userId,- teamId: document.teamId,+ userId: envelope.userId,+ teamId: envelope.teamId,perPage: 100_000,});@@ -60,7 +66,21 @@ export async function loader({ request }: Route.LoaderArgs) {return {auditLogs,- document,+ document: {+ id: mapSecondaryIdToDocumentId(envelope.secondaryId),+ title: envelope.title,+ status: envelope.status,+ envelopeId: envelope.id,+ user: {+ name: envelope.user.name,+ email: envelope.user.email,+ },+ recipients: envelope.recipients,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ deletedAt: envelope.deletedAt,+ documentMeta: envelope.documentMeta,+ },documentLanguage,messages,};@@ -90,9 +110,9 @@ export default function AuditLog({ loaderData }: Route.ComponentProps) {<Card><CardContent className="grid grid-cols-2 gap-4 p-6 text-sm print:text-xs"><p>- <span className="font-medium">{_(msg`Document ID`)}</span>+ <span className="font-medium">{_(msg`Envelope ID`)}</span>- <span className="mt-1 block break-words">{document.id}</span>+ <span className="mt-1 block break-words">{document.envelopeId}</span></p><p>diff --git a/apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx b/apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsxindex ff14ccd32..34af24655 100644--- a/apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx+++ b/apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx@@ -1,6 +1,6 @@import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';-import { FieldType, SigningStatus } from '@prisma/client';+import { EnvelopeType, FieldType, SigningStatus } from '@prisma/client';import { DateTime } from 'luxon';import { redirect } from 'react-router';import { prop, sortBy } from 'remeda';@@ -14,12 +14,13 @@ import {RECIPIENT_ROLES_DESCRIPTION,RECIPIENT_ROLE_SIGNING_REASONS,} from '@documenso/lib/constants/recipient-roles';-import { getEntireDocument } from '@documenso/lib/server-only/admin/get-entire-document';+import { unsafeGetEntireEnvelope } from '@documenso/lib/server-only/admin/get-entire-document';import { decryptSecondaryData } from '@documenso/lib/server-only/crypto/decrypt';import { getDocumentCertificateAuditLogs } from '@documenso/lib/server-only/document/get-document-certificate-audit-logs';import { getOrganisationClaimByTeamId } from '@documenso/lib/server-only/organisation/get-organisation-claims';import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';import { extractDocumentAuthMethods } from '@documenso/lib/utils/document-auth';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { getTranslations } from '@documenso/lib/utils/i18n';import { Card, CardContent } from '@documenso/ui/primitives/card';import {@@ -55,26 +56,45 @@ export async function loader({ request }: Route.LoaderArgs) {const documentId = Number(rawDocumentId);- const document = await getEntireDocument({- id: documentId,+ const envelope = await unsafeGetEntireEnvelope({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,}).catch(() => null);- if (!document) {+ if (!envelope) {throw redirect('/');}- const organisationClaim = await getOrganisationClaimByTeamId({ teamId: document.teamId });+ const organisationClaim = await getOrganisationClaimByTeamId({ teamId: envelope.teamId });- const documentLanguage = ZSupportedLanguageCodeSchema.parse(document.documentMeta?.language);+ const documentLanguage = ZSupportedLanguageCodeSchema.parse(envelope.documentMeta?.language);const auditLogs = await getDocumentCertificateAuditLogs({- id: documentId,+ envelopeId: envelope.id,});const messages = await getTranslations(documentLanguage);return {- document,+ document: {+ id: mapSecondaryIdToDocumentId(envelope.secondaryId),+ title: envelope.title,+ status: envelope.status,+ user: {+ name: envelope.user.name,+ email: envelope.user.email,+ },+ qrToken: envelope.qrToken,+ authOptions: envelope.authOptions,+ recipients: envelope.recipients,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ deletedAt: envelope.deletedAt,+ documentMeta: envelope.documentMeta,+ },hidePoweredBy: organisationClaim.flags.hidePoweredBy,documentLanguage,auditLogs,diff --git a/apps/remix/app/routes/_recipient+/_layout.tsx b/apps/remix/app/routes/_recipient+/_layout.tsxindex cc4c589c6..caf6a16bf 100644--- a/apps/remix/app/routes/_recipient+/_layout.tsx+++ b/apps/remix/app/routes/_recipient+/_layout.tsx@@ -3,6 +3,7 @@ import { ChevronLeft } from 'lucide-react';import { Link, Outlet, isRouteErrorResponse } from 'react-router';import { useOptionalSession } from '@documenso/lib/client-only/providers/session';+import { cn } from '@documenso/ui/lib/utils';import { Button } from '@documenso/ui/primitives/button';import { Header as AuthenticatedHeader } from '~/components/general/app-header';@@ -16,14 +17,23 @@ import type { Route } from './+types/_layout';** Such as direct template access, or signing.*/-export default function RecipientLayout() {+export default function RecipientLayout({ matches }: Route.ComponentProps) {const { sessionData } = useOptionalSession();+ // Hide the header for signing routes.+ const hideHeader = matches.some(+ (match) => match?.id === 'routes/_recipient+/sign.$token+/_index',+ );+return (<div className="min-h-screen">- {sessionData?.user && <AuthenticatedHeader />}+ {!hideHeader && sessionData?.user && <AuthenticatedHeader />}- <main className="mb-8 mt-8 px-4 md:mb-12 md:mt-12 md:px-8">+ <main+ className={cn({+ 'mb-8 mt-8 px-4 md:mb-12 md:mt-12 md:px-8': !hideHeader,+ })}+ ><Outlet /></main></div>diff --git a/apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx b/apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxindex 06d3018cc..dc7722c5a 100644--- a/apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+++ b/apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx@@ -7,9 +7,13 @@ import { match } from 'ts-pattern';import signingCelebration from '@documenso/assets/images/signing-celebration.png';import { getOptionalSession } from '@documenso/auth/server/lib/utils/get-session';+import { EnvelopeRenderProvider } from '@documenso/lib/client-only/providers/envelope-render-provider';import { useOptionalSession } from '@documenso/lib/client-only/providers/session';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { getDocumentAndSenderByToken } from '@documenso/lib/server-only/document/get-document-by-token';import { viewedDocument } from '@documenso/lib/server-only/document/viewed-document';+import { getEnvelopeForRecipientSigning } from '@documenso/lib/server-only/envelope/get-envelope-for-recipient-signing';+import { getEnvelopeRequiredAccessData } from '@documenso/lib/server-only/envelope/get-envelope-required-access-data';import { getCompletedFieldsForToken } from '@documenso/lib/server-only/field/get-completed-fields-for-token';import { getFieldsForToken } from '@documenso/lib/server-only/field/get-fields-for-token';import { getIsRecipientsTurnToSign } from '@documenso/lib/server-only/recipient/get-is-recipient-turn';@@ -21,17 +25,21 @@ import { getTeamSettings } from '@documenso/lib/server-only/team/get-team-settinimport { getUserByEmail } from '@documenso/lib/server-only/user/get-user-by-email';import { DocumentAccessAuth } from '@documenso/lib/types/document-auth';import { extractDocumentAuthMethods } from '@documenso/lib/utils/document-auth';+import { prisma } from '@documenso/prisma';import { SigningCard3D } from '@documenso/ui/components/signing-card';+import { Header as AuthenticatedHeader } from '~/components/general/app-header';import { DocumentSigningAuthPageView } from '~/components/general/document-signing/document-signing-auth-page';import { DocumentSigningAuthProvider } from '~/components/general/document-signing/document-signing-auth-provider';-import { DocumentSigningPageView } from '~/components/general/document-signing/document-signing-page-view';+import { DocumentSigningPageViewV1 } from '~/components/general/document-signing/document-signing-page-view-v1';+import { DocumentSigningPageViewV2 } from '~/components/general/document-signing/document-signing-page-view-v2';import { DocumentSigningProvider } from '~/components/general/document-signing/document-signing-provider';+import { EnvelopeSigningProvider } from '~/components/general/document-signing/envelope-signing-provider';import { superLoaderJson, useSuperLoaderData } from '~/utils/super-json-loader';import type { Route } from './+types/_index';-export async function loader({ params, request }: Route.LoaderArgs) {+const handleV1Loader = async ({ params, request }: Route.LoaderArgs) => {const { requestMetadata } = getOptionalLoaderContext();const { user } = await getOptionalSession(request);@@ -113,11 +121,11 @@ export async function loader({ params, request }: Route.LoaderArgs) {.then((user) => !!user).catch(() => false);- return superLoaderJson({+ return {isDocumentAccessValid: false,recipientEmail: recipient.email,recipientHasAccount,- } as const);+ } as const;}await viewedDocument({@@ -143,7 +151,7 @@ export async function loader({ params, request }: Route.LoaderArgs) {const settings = await getTeamSettings({ teamId: document.teamId });- return superLoaderJson({+ return {isDocumentAccessValid: true,document,fields,@@ -154,13 +162,152 @@ export async function loader({ params, request }: Route.LoaderArgs) {recipientSignature,isRecipientsTurn,includeSenderDetails: settings.includeSenderDetails,+ } as const;+};++const handleV2Loader = async ({ params, request }: Route.LoaderArgs) => {+ const { token } = params;++ const { requestMetadata } = getOptionalLoaderContext();++ const { user } = await getOptionalSession(request);++ const envelopeForSigning = await getEnvelopeForRecipientSigning({+ token,+ userId: user?.id,+ })+ .then((envelopeForSigning) => {+ return {+ isDocumentAccessValid: true,+ ...envelopeForSigning,+ } as const;+ })+ .catch(async (e) => {+ const error = AppError.parseError(e);++ if (error.code === AppErrorCode.UNAUTHORIZED) {+ const requiredAccessData = await getEnvelopeRequiredAccessData({ token });++ return {+ isDocumentAccessValid: false,+ ...requiredAccessData,+ } as const;+ }++ throw new Response('Not Found', { status: 404 });+ });++ if (!envelopeForSigning.isDocumentAccessValid) {+ return envelopeForSigning;+ }++ const { envelope, recipient, isCompleted, isRejected, isRecipientsTurn } = envelopeForSigning;++ if (!isRecipientsTurn) {+ throw redirect(`/sign/${token}/waiting`);+ }++ const { derivedRecipientAccessAuth } = extractDocumentAuthMethods({+ documentAuth: envelope.authOptions,+ recipientAuth: recipient.authOptions,+ });++ const isAccessAuthValid = derivedRecipientAccessAuth.every((accesssAuth) =>+ match(accesssAuth)+ .with(DocumentAccessAuth.ACCOUNT, () => user && user.email === recipient.email)+ .with(DocumentAccessAuth.TWO_FACTOR_AUTH, () => true) // Allow without account requirement+ .exhaustive(),+ );++ let recipientHasAccount: boolean | null = null;++ if (!isAccessAuthValid) {+ recipientHasAccount = await getUserByEmail({ email: recipient.email })+ .then((user) => !!user)+ .catch(() => false);++ return {+ isDocumentAccessValid: false,+ recipientEmail: recipient.email,+ recipientHasAccount,+ } as const;+ }++ await viewedDocument({+ token,+ requestMetadata,+ recipientAccessAuth: derivedRecipientAccessAuth,+ }).catch(() => null);++ if (isRejected) {+ throw redirect(`/sign/${token}/rejected`);+ }++ if (isCompleted) {+ throw redirect(envelope.documentMeta.redirectUrl || `/sign/${token}/complete`);+ }++ return {+ isDocumentAccessValid: true,+ envelopeForSigning,+ } as const;+};++export async function loader(loaderArgs: Route.LoaderArgs) {+ const { token } = loaderArgs.params;++ if (!token) {+ throw new Response('Not Found', { status: 404 });+ }++ // Not efficient but works for now until we remove v1.+ const foundRecipient = await prisma.recipient.findFirst({+ where: {+ token,+ },+ select: {+ envelope: {+ select: {+ internalVersion: true,+ },+ },+ },+ });++ if (!foundRecipient) {+ throw new Response('Not Found', { status: 404 });+ }++ if (foundRecipient.envelope.internalVersion === 2) {+ const payloadV2 = await handleV2Loader(loaderArgs);++ return superLoaderJson({+ version: 2,+ payload: payloadV2,+ } as const);+ }++ const payloadV1 = await handleV1Loader(loaderArgs);++ return superLoaderJson({+ version: 1,+ payload: payloadV1,} as const);}export default function SigningPage() {const data = useSuperLoaderData<typeof loader>();+ if (data.version === 2) {+ return <SigningPageV2 data={data.payload} />;+ }++ return <SigningPageV1 data={data.payload} />;+}++const SigningPageV1 = ({ data }: { data: Awaited<ReturnType<typeof handleV1Loader>> }) => {const { sessionData } = useOptionalSession();+const user = sessionData?.user;if (!data.isDocumentAccessValid) {@@ -248,16 +395,107 @@ export default function SigningPage() {recipient={recipient}user={user}>- <DocumentSigningPageView- recipient={recipientWithFields}- document={document}- fields={fields}- completedFields={completedFields}- isRecipientsTurn={isRecipientsTurn}- allRecipients={allRecipients}- includeSenderDetails={includeSenderDetails}- />+ <>+ {sessionData?.user && <AuthenticatedHeader />}++ <div className="mb-8 mt-8 px-4 md:mb-12 md:mt-12 md:px-8">+ <DocumentSigningPageViewV1+ recipient={recipientWithFields}+ document={document}+ fields={fields}+ completedFields={completedFields}+ isRecipientsTurn={isRecipientsTurn}+ allRecipients={allRecipients}+ includeSenderDetails={includeSenderDetails}+ />+ </div>+ </></DocumentSigningAuthProvider></DocumentSigningProvider>);-}+};++const SigningPageV2 = ({ data }: { data: Awaited<ReturnType<typeof handleV2Loader>> }) => {+ const { sessionData } = useOptionalSession();+ const user = sessionData?.user;++ if (!data.isDocumentAccessValid) {+ return (+ <DocumentSigningAuthPageView+ email={data.recipientEmail}+ emailHasAccount={!!data.recipientHasAccount}+ />+ );+ }++ const { envelope, recipientSignature, recipient } = data.envelopeForSigning;++ if (envelope.deletedAt || envelope.status === DocumentStatus.REJECTED) {+ return (+ <div className="-mx-4 flex max-w-[100vw] flex-col items-center overflow-x-hidden px-4 pt-16 md:-mx-8 md:px-8 lg:pt-16 xl:pt-24">+ <SigningCard3D+ name={recipient.name}+ signature={recipientSignature || undefined}+ signingCelebrationImage={signingCelebration}+ />++ <div className="relative mt-2 flex w-full flex-col items-center">+ <div className="mt-8 flex items-center text-center text-red-600">+ <Clock8 className="mr-2 h-5 w-5" />+ <span className="text-sm">+ <Trans>Document Cancelled</Trans>+ </span>+ </div>++ <h2 className="mt-6 max-w-[35ch] text-center text-2xl font-semibold leading-normal md:text-3xl lg:text-4xl">+ <Trans>+ <span className="mt-1.5 block">"{envelope.title}"</span>+ is no longer available to sign+ </Trans>+ </h2>++ <p className="text-muted-foreground/60 mt-2.5 max-w-[60ch] text-center text-sm font-medium md:text-base">+ <Trans>This document has been cancelled by the owner.</Trans>+ </p>++ {user ? (+ <Link to="/" className="text-documenso-700 hover:text-documenso-600 mt-36">+ <Trans>Go Back Home</Trans>+ </Link>+ ) : (+ <p className="text-muted-foreground/60 mt-36 text-sm">+ <Trans>+ Want to send slick signing links like this one?{' '}+ <Link+ to="https://documenso.com"+ className="text-documenso-700 hover:text-documenso-600"+ >+ Check out Documenso.+ </Link>+ </Trans>+ </p>+ )}+ </div>+ </div>+ );+ }++ return (+ <EnvelopeSigningProvider+ envelopeData={data.envelopeForSigning}+ email={recipient.email}+ fullName={user?.email === recipient.email ? user?.name : recipient.name}+ signature={user?.email === recipient.email ? user?.signature : undefined}+ >+ <DocumentSigningAuthProvider+ documentAuthOptions={envelope.authOptions}+ recipient={recipient}+ user={user}+ >+ <EnvelopeRenderProvider envelope={envelope}>+ <DocumentSigningPageViewV2 />+ </EnvelopeRenderProvider>+ </DocumentSigningAuthProvider>+ </EnvelopeSigningProvider>+ );+};diff --git a/apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx b/apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxindex 5376f2af6..6fa5897cd 100644--- a/apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx+++ b/apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx@@ -3,7 +3,7 @@ import { useEffect } from 'react';import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import { type Document, DocumentStatus, FieldType, RecipientRole } from '@prisma/client';+import { DocumentStatus, FieldType, RecipientRole } from '@prisma/client';import { CheckCircle2, Clock8, FileSearch } from 'lucide-react';import { Link, useRevalidator } from 'react-router';import { match } from 'ts-pattern';@@ -19,6 +19,7 @@ import { getRecipientSignatures } from '@documenso/lib/server-only/recipient/getimport { getUserByEmail } from '@documenso/lib/server-only/user/get-user-by-email';import { isDocumentCompleted } from '@documenso/lib/utils/document';import { env } from '@documenso/lib/utils/env';+import type { Document } from '@documenso/prisma/types/document-legacy-schema';import DocumentDialog from '@documenso/ui/components/document/document-dialog';import { DocumentDownloadButton } from '@documenso/ui/components/document/document-download-button';import { DocumentShareButton } from '@documenso/ui/components/document/document-share-button';diff --git a/apps/remix/app/routes/_recipient+/sign.$token+/waiting.tsx b/apps/remix/app/routes/_recipient+/sign.$token+/waiting.tsxindex fbbc02ce6..bf7b97bf7 100644--- a/apps/remix/app/routes/_recipient+/sign.$token+/waiting.tsx+++ b/apps/remix/app/routes/_recipient+/sign.$token+/waiting.tsx@@ -1,11 +1,11 @@import { Trans } from '@lingui/react/macro';import type { Team } from '@prisma/client';-import { DocumentStatus } from '@prisma/client';+import { DocumentStatus, EnvelopeType } from '@prisma/client';import { Link, redirect } from 'react-router';import { getOptionalSession } from '@documenso/auth/server/lib/utils/get-session';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';import { getDocumentAndSenderByToken } from '@documenso/lib/server-only/document/get-document-by-token';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { getRecipientByToken } from '@documenso/lib/server-only/recipient/get-recipient-by-token';import { getTeamById } from '@documenso/lib/server-only/team/get-team';import { formatDocumentsPath } from '@documenso/lib/utils/teams';@@ -40,12 +40,16 @@ export async function loader({ params, request }: Route.LoaderArgs) {let team: Team | null = null;if (user) {- isOwnerOrTeamMember = await getDocumentById({- documentId: document.id,+ isOwnerOrTeamMember = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: document.teamId ?? undefined,})- .then((document) => !!document)+ .then((envelope) => !!envelope).catch(() => false);if (document.teamId) {diff --git a/apps/remix/app/routes/_share+/share.$slug.tsx b/apps/remix/app/routes/_share+/share.$slug.tsxindex c0a3f75b2..ac09db5fb 100644--- a/apps/remix/app/routes/_share+/share.$slug.tsx+++ b/apps/remix/app/routes/_share+/share.$slug.tsx@@ -81,9 +81,10 @@ export default function SharePage() {<DocumentCertificateQRViewdocumentId={document.id}title={document.title}- documentData={document.documentData}- password={document.documentMeta?.password}- recipientCount={document.recipients?.length ?? 0}+ documentTeamUrl={document.documentTeamUrl}+ internalVersion={document.internalVersion}+ envelopeItems={document.envelopeItems}+ recipientCount={document.recipientCount}completedDate={document.completedAt ?? undefined}/>);diff --git a/apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx b/apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsxindex 9bb820ec3..377fd5961 100644--- a/apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx+++ b/apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -54,7 +54,10 @@ export const loader = async ({ request, params }: Route.LoaderArgs) => {}const document = await getDocumentWithDetailsById({- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },userId: result?.userId,teamId: result?.teamId ?? undefined,}).catch(() => null);@@ -232,6 +235,7 @@ export default function EmbeddingAuthoringDocumentEditPage() {.map<any>((f) => ({...f,id: f.nativeId,+ envelopeItemId: document.documentData.envelopeItemId,pageX: f.pageX,pageY: f.pageY,width: f.pageWidth,diff --git a/apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx b/apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsxindex dbf88ad1c..d5af3c59c 100644--- a/apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx+++ b/apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx@@ -54,7 +54,10 @@ export const loader = async ({ request, params }: Route.LoaderArgs) => {}const template = await getTemplateById({- id: templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },userId: result?.userId,teamId: result?.teamId ?? undefined,}).catch(() => null);@@ -227,11 +230,10 @@ export default function EmbeddingAuthoringTemplateEditPage() {signingOrder: signer.signingOrder,fields: fields.filter((field) => field.signerEmail === signer.email)- // There's a gnarly discriminated union that makes this hard to satisfy, we're casting for the second- // eslint-disable-next-line @typescript-eslint/no-explicit-any- .map<any>((f) => ({+ .map((f) => ({...f,id: f.nativeId,+ envelopeItemId: template.templateDocumentData.envelopeItemId,pageX: f.pageX,pageY: f.pageY,width: f.pageWidth,diff --git a/apps/remix/app/utils/field-signing/dropdown-field.ts b/apps/remix/app/utils/field-signing/dropdown-field.tsnew file mode 100644index 000000000..730e61964--- /dev/null+++ b/apps/remix/app/utils/field-signing/dropdown-field.ts@@ -0,0 +1,48 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldDropdown } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldDropdownDialog } from '~/components/dialogs/sign-field-dropdown-dialog';++type HandleDropdownFieldClickOptions = {+ field: TFieldDropdown;+ text: string | null;+};++export const handleDropdownFieldClick = async (+ options: HandleDropdownFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.DROPDOWN }> | null> => {+ const { field, text } = options;++ if (field.type !== FieldType.DROPDOWN || !field.fieldMeta) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.DROPDOWN,+ value: null,+ };+ }++ let textToInsert = text;++ if (!textToInsert) {+ textToInsert = await SignFieldDropdownDialog.call({+ fieldMeta: field.fieldMeta,+ });+ }++ if (!textToInsert) {+ return null;+ }++ return {+ type: FieldType.DROPDOWN,+ value: textToInsert,+ };+};diff --git a/apps/remix/app/utils/field-signing/email-field.ts b/apps/remix/app/utils/field-signing/email-field.tsnew file mode 100644index 000000000..637b44dbb--- /dev/null+++ b/apps/remix/app/utils/field-signing/email-field.ts@@ -0,0 +1,46 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldEmail } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldEmailDialog } from '~/components/dialogs/sign-field-email-dialog';++type HandleEmailFieldClickOptions = {+ field: TFieldEmail;+ email: string | null;+};++export const handleEmailFieldClick = async (+ options: HandleEmailFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.EMAIL }> | null> => {+ const { field, email } = options;++ if (field.type !== FieldType.EMAIL) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.EMAIL,+ value: null,+ };+ }++ let emailToInsert = email;++ if (!emailToInsert) {+ emailToInsert = await SignFieldEmailDialog.call({});+ }++ if (!emailToInsert) {+ return null;+ }++ return {+ type: FieldType.EMAIL,+ value: emailToInsert,+ };+};diff --git a/apps/remix/app/utils/field-signing/initial-field.ts b/apps/remix/app/utils/field-signing/initial-field.tsnew file mode 100644index 000000000..84a072c41--- /dev/null+++ b/apps/remix/app/utils/field-signing/initial-field.ts@@ -0,0 +1,46 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldInitials } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldInitialsDialog } from '~/components/dialogs/sign-field-initials-dialog';++type HandleInitialsFieldClickOptions = {+ field: TFieldInitials;+ initials: string | null;+};++export const handleInitialsFieldClick = async (+ options: HandleInitialsFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.INITIALS }> | null> => {+ const { field, initials } = options;++ if (field.type !== FieldType.INITIALS) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.INITIALS,+ value: null,+ };+ }++ let initialsToInsert = initials;++ if (!initialsToInsert) {+ initialsToInsert = await SignFieldInitialsDialog.call({});+ }++ if (!initialsToInsert) {+ return null;+ }++ return {+ type: FieldType.INITIALS,+ value: initials,+ };+};diff --git a/apps/remix/app/utils/field-signing/name-field.ts b/apps/remix/app/utils/field-signing/name-field.tsnew file mode 100644index 000000000..a18a04bcf--- /dev/null+++ b/apps/remix/app/utils/field-signing/name-field.ts@@ -0,0 +1,48 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldName } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldNameDialog } from '~/components/dialogs/sign-field-name-dialog';++type HandleNameFieldClickOptions = {+ field: TFieldName;+ name: string | null;+};++export const handleNameFieldClick = async (+ options: HandleNameFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.NAME }> | null> => {+ const { field, name } = options;++ if (field.type !== FieldType.NAME) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.NAME,+ value: null,+ };+ }++ let nameToInsert = name;++ if (!nameToInsert) {+ nameToInsert = await SignFieldNameDialog.call({+ // Props here.+ });+ }++ if (!nameToInsert) {+ return null;+ }++ return {+ type: FieldType.NAME,+ value: nameToInsert,+ };+};diff --git a/apps/remix/app/utils/field-signing/number-field.ts b/apps/remix/app/utils/field-signing/number-field.tsnew file mode 100644index 000000000..ce4042ca8--- /dev/null+++ b/apps/remix/app/utils/field-signing/number-field.ts@@ -0,0 +1,48 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldNumber } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldNumberDialog } from '~/components/dialogs/sign-field-number-dialog';++type HandleNumberFieldClickOptions = {+ field: TFieldNumber;+ number: number | null;+};++export const handleNumberFieldClick = async (+ options: HandleNumberFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.NUMBER }> | null> => {+ const { field, number } = options;++ if (field.type !== FieldType.NUMBER) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.NUMBER,+ value: null,+ };+ }++ let numberToInsert = number;++ if (!numberToInsert) {+ numberToInsert = await SignFieldNumberDialog.call({+ fieldMeta: field.fieldMeta,+ });+ }++ if (!numberToInsert) {+ return null;+ }++ return {+ type: FieldType.NUMBER,+ value: numberToInsert,+ };+};diff --git a/apps/remix/app/utils/field-signing/signature-field.ts b/apps/remix/app/utils/field-signing/signature-field.tsnew file mode 100644index 000000000..467b54998--- /dev/null+++ b/apps/remix/app/utils/field-signing/signature-field.ts@@ -0,0 +1,56 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldSignature } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldSignatureDialog } from '~/components/dialogs/sign-field-signature-dialog';++type HandleSignatureFieldClickOptions = {+ field: TFieldSignature;+ signature: string | null;+ typedSignatureEnabled?: boolean;+ uploadSignatureEnabled?: boolean;+ drawSignatureEnabled?: boolean;+};++export const handleSignatureFieldClick = async (+ options: HandleSignatureFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.SIGNATURE }> | null> => {+ const { field, signature, typedSignatureEnabled, uploadSignatureEnabled, drawSignatureEnabled } =+ options;++ if (field.type !== FieldType.SIGNATURE) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.SIGNATURE,+ value: null,+ isBase64: false,+ };+ }++ let signatureToInsert = signature;++ if (!signatureToInsert) {+ signatureToInsert = await SignFieldSignatureDialog.call({+ typedSignatureEnabled,+ uploadSignatureEnabled,+ drawSignatureEnabled,+ });+ }++ if (!signatureToInsert) {+ return null;+ }++ return {+ type: FieldType.SIGNATURE,+ value: signatureToInsert,+ isBase64: signatureToInsert.startsWith('data:image'),+ };+};diff --git a/apps/remix/app/utils/field-signing/text-field.ts b/apps/remix/app/utils/field-signing/text-field.tsnew file mode 100644index 000000000..6b9c0723e--- /dev/null+++ b/apps/remix/app/utils/field-signing/text-field.ts@@ -0,0 +1,48 @@+import { FieldType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { TFieldText } from '@documenso/lib/types/field';+import type { TSignEnvelopeFieldValue } from '@documenso/trpc/server/envelope-router/sign-envelope-field.types';++import { SignFieldTextDialog } from '~/components/dialogs/sign-field-text-dialog';++type HandleTextFieldClickOptions = {+ field: TFieldText;+ text: string | null;+};++export const handleTextFieldClick = async (+ options: HandleTextFieldClickOptions,+): Promise<Extract<TSignEnvelopeFieldValue, { type: typeof FieldType.TEXT }> | null> => {+ const { field, text } = options;++ if (field.type !== FieldType.TEXT) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid field type',+ });+ }++ if (field.inserted) {+ return {+ type: FieldType.TEXT,+ value: null,+ };+ }++ let textToInsert = text;++ if (!textToInsert) {+ textToInsert = await SignFieldTextDialog.call({+ fieldMeta: field.fieldMeta,+ });+ }++ if (!textToInsert) {+ return null;+ }++ return {+ type: FieldType.TEXT,+ value: textToInsert,+ };+};diff --git a/apps/remix/package.json b/apps/remix/package.jsonindex 832bbde71..db93a6d7f 100644--- a/apps/remix/package.json+++ b/apps/remix/package.json@@ -14,6 +14,7 @@"with:env": "dotenv -e ../../.env -e ../../.env.local --"},"dependencies": {+ "@cantoo/pdf-lib": "^2.3.2","@documenso/api": "*","@documenso/assets": "*","@documenso/auth": "*",@@ -46,6 +47,7 @@"input-otp": "^1.2.4","isbot": "^5.1.17","jsonwebtoken": "^9.0.2",+ "konva": "^10.0.2","lucide-react": "^0.279.0","luxon": "^3.4.0","papaparse": "^5.4.1",@@ -53,7 +55,7 @@"posthog-js": "^1.245.0","posthog-node": "^4.17.0","react": "^18",- "react-call": "^1.3.0",+ "react-call": "^1.7.0","react-dom": "^18","react-dropzone": "^14.2.3","react-hook-form": "^7.43.9",diff --git a/apps/remix/server/api/files.ts b/apps/remix/server/api/files.tsindex c8af41546..440189c5a 100644--- a/apps/remix/server/api/files.ts+++ b/apps/remix/server/api/files.ts@@ -1,6 +1,6 @@+import { PDFDocument } from '@cantoo/pdf-lib';import { sValidator } from '@hono/standard-validator';import { Hono } from 'hono';-import { PDFDocument } from 'pdf-lib';import { APP_DOCUMENT_UPLOAD_SIZE_LIMIT } from '@documenso/lib/constants/app';import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';diff --git a/apps/remix/server/redirects.ts b/apps/remix/server/redirects.tsindex 45570bcc4..2c971d78d 100644--- a/apps/remix/server/redirects.ts+++ b/apps/remix/server/redirects.ts@@ -1,15 +1,6 @@import type { Context } from 'hono';-import { getSession } from '@documenso/auth/server/lib/utils/get-session';-import { buildTeamWhereQuery } from '@documenso/lib/utils/teams';-import { prisma } from '@documenso/prisma';--function extractIdFromPath(path: string, prefix: string): string | null {- const regex = new RegExp(`^${prefix}/([^/]+)`);- const match = path.match(regex);- return match ? match[1] : null;-}-+// eslint-disable-next-line @typescript-eslint/require-awaitexport const handleRedirects = async (c: Context): Promise<string | null> => {const { req } = c;const path = req.path;@@ -24,152 +15,5 @@ export const handleRedirects = async (c: Context): Promise<string | null> => {return '/';}- // Document folder routes.- if (path.startsWith('/documents/f/')) {- const folderId = extractIdFromPath(path, '/documents/f');-- if (!folderId) {- return '/';- }-- const teamUrl = await hasAccessToFolder(c, folderId);-- if (folderId && teamUrl) {- return `/t/${teamUrl}/documents/f/${folderId}`;- }- }-- // Document routes.- if (path.startsWith('/documents/')) {- const rawDocumentId = extractIdFromPath(path, '/documents');-- const documentId = Number(rawDocumentId);-- if (!documentId || isNaN(documentId)) {- return '/';- }-- const teamUrl = await hasAccessToDocument(c, documentId);-- if (!teamUrl) {- return '/';- }-- const queryString = req.url.split('?')[1];- const redirectPath = `/t/${teamUrl}${path}${queryString ? `?${queryString}` : ''}`;-- return redirectPath;- }-- // Template folder routes.- if (path.startsWith('/templates/f/')) {- const folderId = extractIdFromPath(path, '/templates/f');-- if (!folderId) {- return '/';- }-- const teamUrl = await hasAccessToFolder(c, folderId);-- if (folderId && teamUrl) {- return `/t/${teamUrl}/templates/f/${folderId}`;- }- }-- if (path.startsWith('/templates/')) {- const rawTemplateId = extractIdFromPath(path, '/templates');- const templateId = Number(rawTemplateId);-- if (!templateId || isNaN(templateId)) {- return '/';- }-- const teamUrl = await hasAccessToTemplate(c, templateId);-- if (!teamUrl) {- return '/';- }-- const queryString = req.url.split('?')[1];- const redirectPath = `/t/${teamUrl}${path}${queryString ? `?${queryString}` : ''}`;-- return redirectPath;- }-return null;};--async function hasAccessToDocument(c: Context, documentId: number): Promise<string | null> {- const session = await getSession(c);-- const userId = session.user.id;-- const document = await prisma.document.findUnique({- where: {- id: documentId,- team: buildTeamWhereQuery({- userId,- teamId: undefined,- }),- },- select: {- team: {- select: {- url: true,- },- },- },- });-- return document ? document.team.url : null;-}--async function hasAccessToFolder(c: Context, folderId: string): Promise<string | null> {- const session = await getSession(c);-- const userId = session.user.id;-- const folder = await prisma.folder.findUnique({- where: {- id: folderId,- team: buildTeamWhereQuery({- userId,- teamId: undefined,- }),- },- select: {- team: {- select: {- url: true,- },- },- },- });-- return folder ? folder.team.url : null;-}--async function hasAccessToTemplate(c: Context, templateId: number): Promise<string | null> {- const session = await getSession(c);-- const userId = session.user.id;-- const template = await prisma.template.findUnique({- where: {- id: templateId,- team: buildTeamWhereQuery({- userId,- teamId: undefined,- }),- },- select: {- team: {- select: {- url: true,- },- },- },- });-- return template ? template.team.url : null;-}diff --git a/package-lock.json b/package-lock.jsonindex f40167d8c..06ddac27d 100644--- a/package-lock.json+++ b/package-lock.json@@ -91,6 +91,7 @@"name": "@documenso/remix","version": "1.12.10","dependencies": {+ "@cantoo/pdf-lib": "^2.3.2","@documenso/api": "*","@documenso/assets": "*","@documenso/auth": "*",@@ -123,6 +124,7 @@"input-otp": "^1.2.4","isbot": "^5.1.17","jsonwebtoken": "^9.0.2",+ "konva": "^10.0.2","lucide-react": "^0.279.0","luxon": "^3.4.0","papaparse": "^5.4.1",@@ -130,7 +132,7 @@"posthog-js": "^1.245.0","posthog-node": "^4.17.0","react": "^18",- "react-call": "^1.3.0",+ "react-call": "^1.7.0","react-dom": "^18","react-dropzone": "^14.2.3","react-hook-form": "^7.43.9",@@ -2347,6 +2349,21 @@"integrity": "sha512-RN9M76x7N11QRihKovEglEjjVCQEA9PRBVnDgk9xw8JHLrcUrp4FpAVSPSH91cNbcTft3u2vpLN4GMbiKY9PJw==","license": "(Apache-2.0 AND BSD-3-Clause)"},+ "node_modules/@cantoo/pdf-lib": {+ "version": "2.5.3",+ "resolved": "https://registry.npmjs.org/@cantoo/pdf-lib/-/pdf-lib-2.5.3.tgz",+ "integrity": "sha512-SBQp8i/XdWNUhLutn5P67Pwj4X9vU046BRpfOMODJZuYVrgChtsTfgdnlW2O7x8gdXs8j7NoTaWI/b78E2oVmQ==",+ "license": "MIT",+ "dependencies": {+ "@pdf-lib/standard-fonts": "^1.0.0",+ "@pdf-lib/upng": "^1.0.1",+ "color": "^4.2.3",+ "crypto-js": "^4.2.0",+ "node-html-better-parser": ">=1.4.0",+ "pako": "^1.0.11",+ "tslib": ">=2"+ }+ },"node_modules/@chevrotain/cst-dts-gen": {"version": "10.5.0","resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz",@@ -16931,9 +16948,9 @@}},"node_modules/detect-libc": {- "version": "2.0.4",- "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz",- "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==",+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.1.tgz",+ "integrity": "sha512-ecqj/sy1jcK1uWrwpR67UhYrIFQ+5WlGxth34WquCbamhFA6hkkwiu37o6J5xCHdo1oixJRfVRw+ywV+Hq/0Aw==","license": "Apache-2.0","engines": {"node": ">=8"@@ -19108,9 +19125,9 @@"license": "W3C"},"node_modules/follow-redirects": {- "version": "1.15.9",- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",- "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",+ "version": "1.15.11",+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",+ "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==","funding": [{"type": "individual",@@ -20825,6 +20842,22 @@"htmlparser2": "9.0.0"}},+ "node_modules/html-entities": {+ "version": "2.6.0",+ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz",+ "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/mdevils"+ },+ {+ "type": "patreon",+ "url": "https://patreon.com/mdevils"+ }+ ],+ "license": "MIT"+ },"node_modules/html-react-parser": {"version": "4.0.0","resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-4.0.0.tgz",@@ -22563,6 +22596,26 @@"node": ">=6"}},+ "node_modules/konva": {+ "version": "10.0.2",+ "resolved": "https://registry.npmjs.org/konva/-/konva-10.0.2.tgz",+ "integrity": "sha512-NrZED6YG5BX5h3Xu8EZgLqhQ/+ZhxANYXmlIhMOfpBf+0ToExcdwE+Y46LyJOO/JR7FVeR3YTqon3eirnuo44A==",+ "funding": [+ {+ "type": "patreon",+ "url": "https://www.patreon.com/lavrton"+ },+ {+ "type": "opencollective",+ "url": "https://opencollective.com/konva"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/lavrton"+ }+ ],+ "license": "MIT"+ },"node_modules/kysely": {"version": "0.26.3","resolved": "https://registry.npmjs.org/kysely/-/kysely-0.26.3.tgz",@@ -26140,6 +26193,15 @@"node-gyp-build-test": "build-test.js"}},+ "node_modules/node-html-better-parser": {+ "version": "1.5.8",+ "resolved": "https://registry.npmjs.org/node-html-better-parser/-/node-html-better-parser-1.5.8.tgz",+ "integrity": "sha512-t/wAKvaTSKco43X+yf9+76RiMt18MtMmzd4wc7rKj+fWav6DV4ajDEKdWlLzSE8USDF5zr/06uGj0Wr/dGAFtw==",+ "license": "MIT",+ "dependencies": {+ "html-entities": "^2.3.2"+ }+ },"node_modules/node-mock-http": {"version": "1.0.0","resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.0.tgz",@@ -26922,6 +26984,12 @@"node": ">=6"}},+ "node_modules/parenthesis": {+ "version": "3.1.8",+ "resolved": "https://registry.npmjs.org/parenthesis/-/parenthesis-3.1.8.tgz",+ "integrity": "sha512-KF/U8tk54BgQewkJPvB4s/US3VQY68BRDpH638+7O/n58TpnwiwnOtGIOsT2/i+M78s61BBpeC83STB88d8sqw==",+ "license": "MIT"+ },"node_modules/parse-css-color": {"version": "0.2.1","resolved": "https://registry.npmjs.org/parse-css-color/-/parse-css-color-0.2.1.tgz",@@ -27130,24 +27198,6 @@"dev": true,"license": "MIT"},- "node_modules/pdf-lib": {- "version": "1.17.1",- "resolved": "https://registry.npmjs.org/pdf-lib/-/pdf-lib-1.17.1.tgz",- "integrity": "sha512-V/mpyJAoTsN4cnP31vc0wfNA1+p20evqqnap0KLoRUN0Yk/p3wN52DOEsL4oBFcLdb76hlpKPtzJIgo67j/XLw==",- "license": "MIT",- "dependencies": {- "@pdf-lib/standard-fonts": "^1.0.0",- "@pdf-lib/upng": "^1.0.1",- "pako": "^1.0.11",- "tslib": "^1.11.1"- }- },- "node_modules/pdf-lib/node_modules/tslib": {- "version": "1.14.1",- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",- "license": "0BSD"- },"node_modules/pdfjs-dist": {"version": "3.11.174","resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz",@@ -31673,6 +31723,32 @@"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==","license": "MIT"},+ "node_modules/skia-canvas": {+ "version": "3.0.8",+ "resolved": "https://registry.npmjs.org/skia-canvas/-/skia-canvas-3.0.8.tgz",+ "integrity": "sha512-FSYKxp8Ng2vOeeOBiyPhnn6ui6FirPJXMyjk4PKl8N/OWzVrkMawUgY9zubIWHMdYtyWFn0gfX3QlRwg6HBmdg==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "detect-libc": "^2.1.1",+ "follow-redirects": "^1.15.11",+ "https-proxy-agent": "^7.0.6",+ "string-split-by": "^1.0.0"+ }+ },+ "node_modules/skia-canvas/node_modules/https-proxy-agent": {+ "version": "7.0.6",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",+ "license": "MIT",+ "dependencies": {+ "agent-base": "^7.1.2",+ "debug": "4"+ },+ "engines": {+ "node": ">= 14"+ }+ },"node_modules/slash": {"version": "3.0.0","resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",@@ -32017,6 +32093,15 @@"node": ">=0.6.19"}},+ "node_modules/string-split-by": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/string-split-by/-/string-split-by-1.0.0.tgz",+ "integrity": "sha512-KaJKY+hfpzNyet/emP81PJA9hTVSfxNLS9SFTWxdCnnW1/zOOwiV248+EfoX7IQFcBaOp4G5YE6xTJMF+pLg6A==",+ "license": "MIT",+ "dependencies": {+ "parenthesis": "^3.1.5"+ }+ },"node_modules/string-width": {"version": "4.2.3","resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",@@ -36098,8 +36183,7 @@"@documenso/lib": "*","@documenso/prisma": "*","@playwright/test": "1.52.0",- "@types/node": "^20",- "pdf-lib": "^1.17.1"+ "@types/node": "^20"}},"packages/app-tests/node_modules/@playwright/test": {@@ -36638,7 +36722,6 @@"micro": "^10.0.1","nanoid": "^5.1.5","oslo": "^0.17.0",- "pdf-lib": "^1.17.1","pg": "^8.11.3","pino": "^9.7.0","pino-pretty": "^13.0.0",@@ -36648,6 +36731,7 @@"react": "^18","remeda": "^2.17.3","sharp": "0.32.6",+ "skia-canvas": "^3.0.8","stripe": "^12.7.0","ts-pattern": "^5.0.5","zod": "3.24.1"@@ -36709,7 +36793,6 @@"dependencies": {"@documenso/pdf-sign": "^0.1.0","@documenso/tsconfig": "*",- "pdf-lib": "^1.17.1","ts-pattern": "^5.0.5"},"devDependencies": {diff --git a/package.json b/package.jsonindex f8f8ba379..436975780 100644--- a/package.json+++ b/package.json@@ -44,22 +44,22 @@"@commitlint/cli": "^17.7.1","@commitlint/config-conventional": "^17.7.0","@lingui/cli": "^5.2.0",+ "@prisma/client": "^6.8.2","dotenv": "^16.5.0","dotenv-cli": "^8.0.0","eslint": "^8.40.0","eslint-config-custom": "*","husky": "^9.0.11","lint-staged": "^15.2.2",+ "nodemailer": "^6.10.1","playwright": "1.52.0","prettier": "^3.3.3",- "rimraf": "^5.0.1",- "turbo": "^1.9.3",- "vite": "^6.3.5",- "@prisma/client": "^6.8.2","prisma": "^6.8.2","prisma-extension-kysely": "^3.0.0","prisma-kysely": "^1.8.0",- "nodemailer": "^6.10.1"+ "rimraf": "^5.0.1",+ "turbo": "^1.9.3",+ "vite": "^6.3.5"},"name": "@documenso/root","workspaces": [diff --git a/packages/api/v1/implementation.ts b/packages/api/v1/implementation.tsindex 08556154a..88db75e33 100644--- a/packages/api/v1/implementation.ts+++ b/packages/api/v1/implementation.ts@@ -1,5 +1,4 @@-import type { Prisma } from '@prisma/client';-import { DocumentDataType, SigningStatus } from '@prisma/client';+import { DocumentDataType, EnvelopeType, SigningStatus } from '@prisma/client';import { tsr } from '@ts-rest/serverless/fetch';import { match } from 'ts-pattern';@@ -10,27 +9,24 @@ import '@documenso/lib/constants/time-zones';import { DEFAULT_DOCUMENT_TIME_ZONE, TIME_ZONES } from '@documenso/lib/constants/time-zones';import { AppError } from '@documenso/lib/errors/app-error';import { createDocumentData } from '@documenso/lib/server-only/document-data/create-document-data';-import { upsertDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';-import { createDocument } from '@documenso/lib/server-only/document/create-document';+import { updateDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';import { deleteDocument } from '@documenso/lib/server-only/document/delete-document';import { findDocuments } from '@documenso/lib/server-only/document/find-documents';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';import { resendDocument } from '@documenso/lib/server-only/document/resend-document';import { sendDocument } from '@documenso/lib/server-only/document/send-document';-import { updateDocument as updateDocumentSettings } from '@documenso/lib/server-only/document/update-document';-import { deleteField } from '@documenso/lib/server-only/field/delete-field';-import { getFieldById } from '@documenso/lib/server-only/field/get-field-by-id';-import { getFieldsForDocument } from '@documenso/lib/server-only/field/get-fields-for-document';-import { updateField } from '@documenso/lib/server-only/field/update-field';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';+import {+ getEnvelopeById,+ getEnvelopeWhereInput,+} from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { deleteDocumentField } from '@documenso/lib/server-only/field/delete-document-field';+import { updateDocumentFields } from '@documenso/lib/server-only/field/update-document-fields';import { insertFormValuesInPdf } from '@documenso/lib/server-only/pdf/insert-form-values-in-pdf';-import { deleteRecipient } from '@documenso/lib/server-only/recipient/delete-recipient';-import { getRecipientByIdV1Api } from '@documenso/lib/server-only/recipient/get-recipient-by-id-v1-api';+import { deleteDocumentRecipient } from '@documenso/lib/server-only/recipient/delete-document-recipient';import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document';import { setDocumentRecipients } from '@documenso/lib/server-only/recipient/set-document-recipients';import { updateDocumentRecipients } from '@documenso/lib/server-only/recipient/update-document-recipients';import { createDocumentFromTemplate } from '@documenso/lib/server-only/template/create-document-from-template';-import { createDocumentFromTemplateLegacy } from '@documenso/lib/server-only/template/create-document-from-template-legacy';-import { createTemplate } from '@documenso/lib/server-only/template/create-template';import { deleteTemplate } from '@documenso/lib/server-only/template/delete-template';import { findTemplates } from '@documenso/lib/server-only/template/find-templates';import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';@@ -52,7 +48,10 @@ import {} from '@documenso/lib/universal/upload/server-actions';import { isDocumentCompleted } from '@documenso/lib/utils/document';import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';-import { buildTeamWhereQuery } from '@documenso/lib/utils/teams';+import {+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import { ApiContractV1 } from './contract';@@ -67,13 +66,23 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {page,perPage,userId: user.id,- teamId: team?.id,+ teamId: team.id,});return {status: 200,body: {- documents,+ documents: documents.map((document) => ({+ id: mapSecondaryIdToDocumentId(document.secondaryId),+ externalId: document.externalId,+ userId: document.userId,+ teamId: document.teamId,+ title: document.title,+ status: document.status,+ createdAt: document.createdAt,+ updatedAt: document.updatedAt,+ completedAt: document.completedAt,+ })),totalPages,},};@@ -89,23 +98,43 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {});try {- const document = await getDocumentById({- documentId: Number(documentId),+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'documentId',+ id: Number(documentId),+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,});- const recipients = await getRecipientsForDocument({- documentId: Number(documentId),- userId: user.id,- teamId: team?.id,+ const envelope = await prisma.envelope.findFirstOrThrow({+ where: envelopeWhereInput,+ include: {+ recipients: {+ orderBy: {+ id: 'asc',+ },+ },+ fields: {+ include: {+ signature: true,+ recipient: {+ select: {+ name: true,+ email: true,+ signingStatus: true,+ },+ },+ },+ orderBy: {+ id: 'asc',+ },+ },+ },});- const fields = await getFieldsForDocument({- documentId: Number(documentId),- userId: user.id,- teamId: team?.id,- });+ const { fields, recipients } = envelope;const parsedMetaFields = fields.map((field) => {let parsedMetaOrNull = null;@@ -126,12 +155,32 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};});+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);+return {status: 200,body: {- ...document,+ id: legacyDocumentId,+ externalId: envelope.externalId,+ userId: envelope.userId,+ teamId: envelope.teamId,+ title: envelope.title,+ status: envelope.status,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ completedAt: envelope.completedAt,recipients: recipients.map((recipient) => ({- ...recipient,+ id: recipient.id,+ documentId: legacyDocumentId,+ email: recipient.email,+ name: recipient.name,+ role: recipient.role,+ signingOrder: recipient.signingOrder,+ token: recipient.token,+ signedAt: recipient.signedAt,+ readStatus: recipient.readStatus,+ signingStatus: recipient.signingStatus,+ sendStatus: recipient.sendStatus,signingUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`,})),fields: parsedMetaFields,@@ -158,31 +207,38 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {});try {- if (process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT !== 's3') {+ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: Number(documentId),+ },+ type: EnvelopeType.DOCUMENT,+ userId: user.id,+ teamId: team.id,+ }).catch(() => null);++ const firstDocumentData = envelope?.envelopeItems[0]?.documentData;++ if (!envelope || !firstDocumentData) {return {- status: 500,+ status: 404,body: {- message: 'Please make sure the storage transport is set to S3.',+ message: 'Document not found',},};}- const document = await getDocumentById({- documentId: Number(documentId),- userId: user.id,- teamId: team?.id,- });-- if (!document || !document.documentDataId) {+ // This error is done AFTER the get envelope so we can test access controls without S3.+ if (process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT !== 's3') {return {- status: 404,+ status: 500,body: {- message: 'Document not found',+ message: 'Document downloads are only available when S3 storage is configured.',},};}- if (DocumentDataType.S3_PATH !== document.documentData.type) {+ if (DocumentDataType.S3_PATH !== firstDocumentData.type) {return {status: 400,body: {@@ -191,7 +247,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- if (!downloadOriginalDocument && !isDocumentCompleted(document.status)) {+ if (!downloadOriginalDocument && !isDocumentCompleted(envelope.status)) {return {status: 400,body: {@@ -200,8 +256,17 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}+ if (envelope.envelopeItems.length !== 1) {+ return {+ status: 400,+ body: {+ message: 'API V1 does not support items',+ },+ };+ }+const { url } = await getPresignGetUrl(- downloadOriginalDocument ? document.documentData.initialData : document.documentData.data,+ downloadOriginalDocument ? firstDocumentData.initialData : firstDocumentData.data,);return {@@ -228,13 +293,19 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {});try {- const document = await getDocumentById({- documentId: Number(documentId),+ const legacyDocumentId = Number(documentId);++ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: legacyDocumentId,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,});- if (!document) {+ if (!envelope) {return {status: 404,body: {@@ -244,15 +315,28 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {}const deletedDocument = await deleteDocument({- id: document.id,+ id: {+ type: 'documentId',+ id: legacyDocumentId,+ },userId: user.id,- teamId: team?.id,+ teamId: team.id,requestMetadata: metadata,});return {status: 200,- body: deletedDocument,+ body: {+ id: legacyDocumentId,+ externalId: deletedDocument.externalId,+ userId: deletedDocument.userId,+ teamId: deletedDocument.teamId,+ title: deletedDocument.title,+ status: deletedDocument.status,+ createdAt: deletedDocument.createdAt,+ updatedAt: deletedDocument.updatedAt,+ completedAt: deletedDocument.completedAt,+ },};} catch (err) {return {@@ -325,53 +409,51 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {type: DocumentDataType.S3_PATH,});- const document = await createDocument({- title: body.title,- externalId: body.externalId || null,+ const envelope = await createEnvelope({userId: user.id,- teamId: team?.id,- formValues: body.formValues,- folderId: body.folderId,- documentDataId: documentData.id,- requestMetadata: metadata,- });-- await upsertDocumentMeta({- documentId: document.id,- userId: user.id,- teamId: team?.id,- subject: body.meta.subject,- message: body.meta.message,- timezone,- dateFormat: dateFormat?.value,- redirectUrl: body.meta.redirectUrl,- signingOrder: body.meta.signingOrder,- allowDictateNextSigner: body.meta.allowDictateNextSigner,- language: body.meta.language,- typedSignatureEnabled: body.meta.typedSignatureEnabled,- uploadSignatureEnabled: body.meta.uploadSignatureEnabled,- drawSignatureEnabled: body.meta.drawSignatureEnabled,- distributionMethod: body.meta.distributionMethod,- emailSettings: body.meta.emailSettings,+ teamId: team.id,+ internalVersion: 1,+ data: {+ title: body.title,+ type: EnvelopeType.DOCUMENT,+ externalId: body.externalId || undefined,+ formValues: body.formValues,+ folderId: body.folderId,+ envelopeItems: [+ {+ documentDataId: documentData.id,+ },+ ],+ globalAccessAuth: body.authOptions?.globalAccessAuth,+ globalActionAuth: body.authOptions?.globalActionAuth,+ },+ meta: {+ subject: body.meta.subject,+ message: body.meta.message,+ timezone,+ dateFormat: dateFormat?.value,+ redirectUrl: body.meta.redirectUrl,+ signingOrder: body.meta.signingOrder,+ allowDictateNextSigner: body.meta.allowDictateNextSigner,+ language: body.meta.language,+ typedSignatureEnabled: body.meta.typedSignatureEnabled,+ uploadSignatureEnabled: body.meta.uploadSignatureEnabled,+ drawSignatureEnabled: body.meta.drawSignatureEnabled,+ distributionMethod: body.meta.distributionMethod,+ emailSettings: body.meta.emailSettings,+ },requestMetadata: metadata,});- if (body.authOptions) {- await updateDocumentSettings({- documentId: document.id,- userId: user.id,- teamId: team?.id,- data: {- ...body.authOptions,- },- requestMetadata: metadata,- });- }+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);const { recipients } = await setDocumentRecipients({userId: user.id,- teamId: team?.id,- documentId: document.id,+ teamId: team.id,+ id: {+ type: 'documentId',+ id: legacyDocumentId,+ },recipients: body.recipients,requestMetadata: metadata,});@@ -380,7 +462,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {status: 200,body: {uploadUrl: url,- documentId: document.id,+ documentId: legacyDocumentId,recipients: recipients.map((recipient) => ({recipientId: recipient.id,name: recipient.name,@@ -388,7 +470,6 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {token: recipient.token,role: recipient.role,signingOrder: recipient.signingOrder,-signingUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`,})),},@@ -403,7 +484,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {}}),- createTemplate: authenticatedMiddleware(async (args, user, team) => {+ createTemplate: authenticatedMiddleware(async (args, user, team, { metadata }) => {const { body } = args;const {title,@@ -465,26 +546,36 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {type: DocumentDataType.S3_PATH,});- const createdTemplate = await createTemplate({+ const createdTemplate = await createEnvelope({userId: user.id,teamId: team.id,- templateDocumentDataId: templateDocumentData.id,+ internalVersion: 1,data: {+ type: EnvelopeType.TEMPLATE,+ envelopeItems: [+ {+ documentDataId: templateDocumentData.id,+ },+ ],+ templateType: type,title,folderId,- externalId,+ externalId: externalId ?? undefined,visibility,globalAccessAuth,globalActionAuth,publicTitle,publicDescription,- type,},meta,+ requestMetadata: metadata,});const fullTemplate = await getTemplateById({- id: createdTemplate.id,+ id: {+ type: 'envelopeId',+ id: createdTemplate.id,+ },userId: user.id,teamId: team.id,});@@ -517,14 +608,28 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {try {const deletedTemplate = await deleteTemplate({- id: Number(templateId),+ id: {+ type: 'templateId',+ id: Number(templateId),+ },userId: user.id,- teamId: team?.id,+ teamId: team.id,});+ const legacyTemplateId = mapSecondaryIdToTemplateId(deletedTemplate.secondaryId);+return {status: 200,- body: deletedTemplate,+ body: {+ id: legacyTemplateId,+ externalId: deletedTemplate.externalId,+ type: deletedTemplate.templateType,+ title: deletedTemplate.title,+ userId: deletedTemplate.userId,+ teamId: deletedTemplate.teamId,+ createdAt: deletedTemplate.createdAt,+ updatedAt: deletedTemplate.updatedAt,+ },};} catch (err) {return {@@ -547,15 +652,24 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {try {const template = await getTemplateById({- id: Number(templateId),+ id: {+ type: 'templateId',+ id: Number(templateId),+ },userId: user.id,- teamId: team?.id,+ teamId: team.id,});return {status: 200,body: {...template,+ templateMeta: template.templateMeta+ ? {+ ...template.templateMeta,+ templateId: template.id,+ }+ : null,Field: template.fields.map((field) => ({...field,fieldMeta: field.fieldMeta ? ZFieldMetaSchema.parse(field.fieldMeta) : null,@@ -577,16 +691,25 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {page,perPage,userId: user.id,- teamId: team?.id,+ teamId: team.id,});return {status: 200,body: {templates: templates.map((template) => ({- ...template,+ id: mapSecondaryIdToTemplateId(template.secondaryId),+ externalId: template.externalId,+ type: template.templateType,+ title: template.title,+ userId: template.userId,+ teamId: template.teamId,+ createdAt: template.createdAt,+ updatedAt: template.updatedAt,+ directLink: template.directLink,Field: template.fields.map((field) => ({...field,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),fieldMeta: field.fieldMeta ? ZFieldMetaSchema.parse(field.fieldMeta) : null,})),Recipient: template.recipients,@@ -609,7 +732,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {},});- const { remaining } = await getServerLimits({ userId: user.id, teamId: team?.id });+ const { remaining } = await getServerLimits({ userId: user.id, teamId: team.id });if (remaining.documents <= 0) {return {@@ -624,17 +747,71 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {const fileName = body.title.endsWith('.pdf') ? body.title : `${body.title}.pdf`;- const document = await createDocumentFromTemplateLegacy({- templateId,+ const template = await getEnvelopeById({+ id: {+ type: 'templateId',+ id: templateId,+ },+ type: EnvelopeType.TEMPLATE,userId: user.id,- teamId: team?.id,- recipients: body.recipients,+ teamId: team.id,+ });++ if (template.envelopeItems.length !== 1) {+ throw new Error('API V1 does not support templates with multiple documents');+ }++ // V1 API request schema uses indices for recipients+ // So we remap the recipients to attach the IDs+ const mappedRecipients = body.recipients.map((recipient, index) => {+ const existingRecipient = template.recipients.at(index);++ if (!existingRecipient) {+ throw new Error('Recipient not found.');+ }++ return {+ id: existingRecipient.id,+ name: recipient.name,+ email: recipient.email,+ signingOrder: recipient.signingOrder,+ role: recipient.role, // You probably shouldn't be able to change the role.+ };+ });++ const createdEnvelope = await createDocumentFromTemplate({+ id: {+ type: 'templateId',+ id: templateId,+ },+ externalId: body.externalId || null,+ userId: user.id,+ teamId: team.id,+ recipients: mappedRecipients,+ override: {+ ...body.meta,+ title: body.title,+ },+ requestMetadata: metadata,});- let documentDataId = document.documentDataId;+ const envelopeItems = await prisma.envelopeItem.findMany({+ where: {+ envelopeId: createdEnvelope.id,+ },+ include: {+ documentData: true,+ },+ });++ const firstEnvelopeItemData = envelopeItems[0].documentData;++ if (!firstEnvelopeItemData) {+ throw new Error('Document data not found.');+ }if (body.formValues) {- const pdf = await getFileServerSide(document.documentData);+ const pdf = await getFileServerSide(firstEnvelopeItemData);const prefilled = await insertFormValuesInPdf({pdf: Buffer.from(pdf),@@ -647,50 +824,34 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {arrayBuffer: async () => Promise.resolve(prefilled),});- documentDataId = newDocumentData.id;- }-- await updateDocument({- documentId: document.id,- userId: user.id,- teamId: team?.id,- data: {- title: fileName,- externalId: body.externalId || null,- formValues: body.formValues,- documentData: {- connect: {- id: documentDataId,- },+ await prisma.envelopeItem.update({+ where: {+ id: firstEnvelopeItemData.id,+ },+ data: {+ title: body.title || fileName,+ documentDataId: newDocumentData.id,},- },- });-- if (body.meta) {- await upsertDocumentMeta({- documentId: document.id,- userId: user.id,- teamId: team?.id,- ...body.meta,- requestMetadata: metadata,});}- if (body.authOptions) {- await updateDocumentSettings({- documentId: document.id,- userId: user.id,- teamId: team?.id,- data: body.authOptions,- requestMetadata: metadata,+ if (body.authOptions || body.formValues) {+ await prisma.envelope.update({+ where: {+ id: createdEnvelope.id,+ },+ data: {+ formValues: body.formValues,+ authOptions: body.authOptions,+ },});}return {status: 200,body: {- documentId: document.id,- recipients: document.recipients.map((recipient) => ({+ documentId: mapSecondaryIdToDocumentId(createdEnvelope.secondaryId),+ recipients: createdEnvelope.recipients.map((recipient) => ({recipientId: recipient.id,name: recipient.name,email: recipient.email,@@ -715,7 +876,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {},});- const { remaining } = await getServerLimits({ userId: user.id, teamId: team?.id });+ const { remaining } = await getServerLimits({ userId: user.id, teamId: team.id });if (remaining.documents <= 0) {return {@@ -728,14 +889,17 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {const templateId = Number(params.templateId);- let document: Awaited<ReturnType<typeof createDocumentFromTemplate>> | null = null;+ let envelope: Awaited<ReturnType<typeof createDocumentFromTemplate>> | null = null;try {- document = await createDocumentFromTemplate({- templateId,+ envelope = await createDocumentFromTemplate({+ id: {+ type: 'templateId',+ id: templateId,+ },externalId: body.externalId || null,userId: user.id,- teamId: team?.id,+ teamId: team.id,recipients: body.recipients,prefillFields: body.prefillFields,folderId: body.folderId,@@ -749,10 +913,23 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {return AppError.toRestAPIError(err);}+ if (envelope.envelopeItems.length !== 1) {+ throw new Error('API V1 does not support envelopes');+ }++ const firstEnvelopeDocumentData = await prisma.envelopeItem.findFirstOrThrow({+ where: {+ envelopeId: envelope.id,+ },+ include: {+ documentData: true,+ },+ });+if (body.formValues) {- const fileName = document.title.endsWith('.pdf') ? document.title : `${document.title}.pdf`;+ const fileName = envelope.title.endsWith('.pdf') ? envelope.title : `${envelope.title}.pdf`;- const pdf = await getFileServerSide(document.documentData);+ const pdf = await getFileServerSide(firstEnvelopeDocumentData.documentData);const prefilled = await insertFormValuesInPdf({pdf: Buffer.from(pdf),@@ -765,15 +942,20 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {arrayBuffer: async () => Promise.resolve(prefilled),});- await updateDocument({- documentId: document.id,- userId: user.id,- teamId: team?.id,+ await prisma.envelope.update({+ where: {+ id: envelope.id,+ },data: {formValues: body.formValues,- documentData: {- connect: {- id: newDocumentData.id,+ envelopeItems: {+ update: {+ where: {+ id: firstEnvelopeDocumentData.id,+ },+ data: {+ documentDataId: newDocumentData.id,+ },},},},@@ -781,20 +963,23 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {}if (body.authOptions) {- await updateDocumentSettings({- documentId: document.id,- userId: user.id,- teamId: team?.id,- data: body.authOptions,- requestMetadata: metadata,+ await prisma.envelope.update({+ where: {+ id: envelope.id,+ },+ data: {+ authOptions: body.authOptions,+ },});}+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);+return {status: 200,body: {- documentId: document.id,- recipients: document.recipients.map((recipient) => ({+ documentId: legacyDocumentId,+ recipients: envelope.recipients.map((recipient) => ({recipientId: recipient.id,name: recipient.name,email: recipient.email,@@ -819,13 +1004,19 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {});try {- const document = await getDocumentById({- documentId: Number(documentId),+ const legacyDocumentId = Number(documentId);++ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: legacyDocumentId,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,});- if (!document) {+ if (!envelope) {return {status: 404,body: {@@ -834,7 +1025,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- if (isDocumentCompleted(document.status)) {+ if (isDocumentCompleted(envelope.status)) {return {status: 400,body: {@@ -843,14 +1034,17 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- const emailSettings = extractDerivedDocumentEmailSettings(document.documentMeta);+ const emailSettings = extractDerivedDocumentEmailSettings(envelope.documentMeta);// Update document email settings if sendCompletionEmails is providedif (typeof sendCompletionEmails === 'boolean') {- await upsertDocumentMeta({- documentId: document.id,+ await updateDocumentMeta({+ id: {+ type: 'envelopeId',+ id: envelope.id,+ },userId: user.id,- teamId: team?.id,+ teamId: team.id,emailSettings: {...emailSettings,documentCompleted: sendCompletionEmails,@@ -861,9 +1055,12 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {}const { recipients, ...sentDocument } = await sendDocument({- documentId: document.id,+ id: {+ type: 'envelopeId',+ id: envelope.id,+ },userId: user.id,- teamId: team?.id,+ teamId: team.id,sendEmail,requestMetadata: metadata,});@@ -872,7 +1069,15 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {status: 200,body: {message: 'Document sent for signing successfully',- ...sentDocument,+ id: mapSecondaryIdToDocumentId(sentDocument.secondaryId),+ externalId: sentDocument.externalId,+ userId: sentDocument.userId,+ teamId: sentDocument.teamId,+ title: sentDocument.title,+ status: sentDocument.status,+ createdAt: sentDocument.createdAt,+ updatedAt: sentDocument.updatedAt,+ completedAt: sentDocument.completedAt,recipients: recipients.map((recipient) => ({...recipient,signingUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`,@@ -902,9 +1107,12 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {try {await resendDocument({userId: user.id,- documentId: Number(documentId),+ id: {+ type: 'documentId',+ id: Number(documentId),+ },recipients,- teamId: team?.id,+ teamId: team.id,requestMetadata: metadata,});@@ -934,13 +1142,19 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {},});- const document = await getDocumentById({- documentId: Number(documentId),+ const legacyDocumentId = Number(documentId);++ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: legacyDocumentId,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,});- if (!document) {+ if (!envelope) {return {status: 404,body: {@@ -949,7 +1163,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- if (isDocumentCompleted(document.status)) {+ if (isDocumentCompleted(envelope.status)) {return {status: 400,body: {@@ -961,7 +1175,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {const recipients = await getRecipientsForDocument({documentId: Number(documentId),userId: user.id,- teamId: team?.id,+ teamId: team.id,});const recipientAlreadyExists = recipients.some((recipient) => recipient.email === email);@@ -977,9 +1191,12 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {try {const { recipients: newRecipients } = await setDocumentRecipients({- documentId: Number(documentId),+ id: {+ type: 'documentId',+ id: Number(documentId),+ },userId: user.id,- teamId: team?.id,+ teamId: team.id,recipients: [...recipients.map((recipient) => ({email: recipient.email,@@ -1034,13 +1251,19 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {},});- const document = await getDocumentById({- documentId: Number(documentId),+ const legacyDocumentId = Number(documentId);++ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: legacyDocumentId,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,});- if (!document) {+ if (!envelope) {return {status: 404,body: {@@ -1049,7 +1272,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- if (isDocumentCompleted(document.status)) {+ if (isDocumentCompleted(envelope.status)) {return {status: 400,body: {@@ -1061,7 +1284,10 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {const updatedRecipient = await updateDocumentRecipients({userId: user.id,teamId: team.id,- documentId: Number(documentId),+ id: {+ type: 'envelopeId',+ id: envelope.id,+ },recipients: [{id: Number(recipientId),@@ -1106,46 +1332,21 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {},});- const document = await getDocumentById({- documentId: Number(documentId),+ const deletedRecipient = await deleteDocumentRecipient({userId: user.id,- teamId: team?.id,- });-- if (!document) {- return {- status: 404,- body: {- message: 'Document not found',- },- };- }-- if (isDocumentCompleted(document.status)) {- return {- status: 400,- body: {- message: 'Document is already completed',- },- };- }-- const deletedRecipient = await deleteRecipient({- documentId: Number(documentId),+ teamId: team.id,recipientId: Number(recipientId),- userId: user.id,- teamId: team?.id,- requestMetadata: metadata.requestMetadata,- }).catch(() => null);-- if (!deletedRecipient) {- return {- status: 400,- body: {- message: 'Unable to delete recipient',+ requestMetadata: {+ requestMetadata: metadata.requestMetadata,+ source: 'apiV1',+ auth: 'api',+ auditUser: {+ id: team.id,+ email: team.name,+ name: team.name,},- };- }+ },+ });return {status: 200,@@ -1168,22 +1369,46 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {const fields = Array.isArray(args.body) ? args.body : [args.body];- const document = await prisma.document.findFirst({- select: { id: true, status: true },- where: {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'documentId',id: Number(documentId),- team: buildTeamWhereQuery({ teamId: team.id, userId: user.id }),},+ type: EnvelopeType.DOCUMENT,+ teamId: team.id,+ userId: user.id,});- if (!document) {+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,+ select: {+ id: true,+ secondaryId: true,+ status: true,+ envelopeItems: {+ select: { id: true },+ },+ },+ });++ if (!envelope) {return {status: 404,body: { message: 'Document not found' },};}- if (isDocumentCompleted(document.status)) {+ const firstEnvelopeItemId = envelope.envelopeItems[0].id;++ if (!firstEnvelopeItemId) {+ throw new Error('Missing envelope item ID');+ }++ if (envelope.envelopeItems.length !== 1) {+ throw new Error('API V1 does not support multiple documents');+ }++ if (isDocumentCompleted(envelope.status)) {return {status: 400,body: { message: 'Document is already completed' },@@ -1209,10 +1434,12 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {throw new Error('Invalid page number');}- const recipient = await getRecipientByIdV1Api({- id: Number(recipientId),- documentId: Number(documentId),- }).catch(() => null);+ const recipient = await prisma.recipient.findFirst({+ where: {+ id: Number(recipientId),+ envelopeId: envelope.id,+ },+ });if (!recipient) {throw new Error('Recipient not found');@@ -1259,7 +1486,8 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {const field = await tx.field.create({data: {- documentId: Number(documentId),+ envelopeId: envelope.id,+ envelopeItemId: firstEnvelopeItemId,recipientId: Number(recipientId),type,page: pageNumber,@@ -1279,9 +1507,9 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: 'FIELD_CREATED',- documentId: Number(documentId),+ envelopeId: envelope.id,user: {- id: team?.id ?? user.id,+ id: team.id ?? user.id,email: team?.name ?? user.email,name: team ? '' : user.name,},@@ -1297,7 +1525,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {return {id: field.id,- documentId: Number(field.documentId),+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),recipientId: field.recipientId ?? -1,type: field.type,pageNumber: field.page,@@ -1337,13 +1565,17 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {},});- const document = await getDocumentById({- documentId: Number(documentId),+ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: Number(documentId),+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,- teamId: team?.id,+ teamId: team.id,});- if (!document) {+ if (!envelope) {return {status: 404,body: {@@ -1352,7 +1584,19 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- if (isDocumentCompleted(document.status)) {+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);++ const firstEnvelopeItemId = envelope.envelopeItems[0].id;++ if (!firstEnvelopeItemId) {+ throw new Error('Missing document data');+ }++ if (envelope.envelopeItems.length > 1) {+ throw new Error('API V1 does not support multiple documents');+ }++ if (isDocumentCompleted(envelope.status)) {return {status: 400,body: {@@ -1361,10 +1605,12 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- const recipient = await getRecipientByIdV1Api({- id: Number(recipientId),- documentId: Number(documentId),- }).catch(() => null);+ const recipient = await prisma.recipient.findFirst({+ where: {+ id: Number(recipientId),+ envelopeId: envelope.id,+ },+ });if (!recipient) {return {@@ -1384,128 +1630,84 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {};}- const updatedField = await updateField({- fieldId: Number(fieldId),+ const { fields } = await updateDocumentFields({userId: user.id,- teamId: team?.id,- documentId: Number(documentId),- recipientId: recipientId ? Number(recipientId) : undefined,- type,- pageNumber,- pageX,- pageY,- pageWidth,- pageHeight,- requestMetadata: metadata.requestMetadata,- fieldMeta: fieldMeta ? ZFieldMetaSchema.parse(fieldMeta) : undefined,+ teamId: team.id,+ documentId: legacyDocumentId,+ fields: [+ {+ id: Number(fieldId),+ type,+ pageNumber,+ pageX,+ pageY,+ width: pageWidth,+ height: pageHeight,+ fieldMeta: fieldMeta ? ZFieldMetaSchema.parse(fieldMeta) : undefined,+ },+ ],+ requestMetadata: {+ requestMetadata: metadata.requestMetadata,+ source: 'apiV1',+ auth: 'api',+ auditUser: {+ id: team.id,+ email: team.name,+ name: team.name,+ },+ },});- const remappedField = {- id: updatedField.id,- documentId: updatedField.documentId,- recipientId: updatedField.recipientId ?? -1,- type: updatedField.type,- pageNumber: updatedField.page,- pageX: Number(updatedField.positionX),- pageY: Number(updatedField.positionY),- pageWidth: Number(updatedField.width),- pageHeight: Number(updatedField.height),- customText: updatedField.customText,- inserted: updatedField.inserted,- };+ const updatedField = fields[0];return {status: 200,body: {- ...remappedField,- documentId: Number(documentId),+ id: updatedField.id,+ documentId: legacyDocumentId,+ recipientId: updatedField.recipientId ?? -1,+ type: updatedField.type,+ pageNumber: updatedField.page,+ pageX: Number(updatedField.positionX),+ pageY: Number(updatedField.positionY),+ pageWidth: Number(updatedField.width),+ pageHeight: Number(updatedField.height),+ customText: updatedField.customText,+ inserted: updatedField.inserted,},};}),deleteField: authenticatedMiddleware(async (args, user, team, { logger, metadata }) => {- const { id: documentId, fieldId } = args.params;+ // Note: documentId isn't actually used anywhere, so we just return it.+ const { id: unverifiedDocumentId, fieldId } = args.params;logger.info({input: {- id: documentId,+ id: unverifiedDocumentId,fieldId,},});- const document = await getDocumentById({- documentId: Number(documentId),- userId: user.id,- teamId: team.id,- });-- if (!document) {- return {- status: 404,- body: {- message: 'Document not found',- },- };- }-- if (isDocumentCompleted(document.status)) {- return {- status: 400,- body: {- message: 'Document is already completed',- },- };- }-- const field = await getFieldById({- userId: user.id,- teamId: team?.id,- fieldId: Number(fieldId),- }).catch(() => null);-- if (!field) {- return {- status: 404,- body: {- message: 'Field not found',- },- };- }-- const recipient = await getRecipientByIdV1Api({- id: Number(field.recipientId),- documentId: Number(documentId),- }).catch(() => null);-- if (recipient?.signingStatus === SigningStatus.SIGNED) {- return {- status: 400,- body: {- message: 'Recipient has already signed the document',- },- };- }-- const deletedField = await deleteField({- documentId: Number(documentId),+ const deletedField = await deleteDocumentField({fieldId: Number(fieldId),userId: user.id,- teamId: team?.id,- requestMetadata: metadata.requestMetadata,- }).catch(() => null);-- if (!deletedField) {- return {- status: 400,- body: {- message: 'Unable to delete field',+ teamId: team.id,+ requestMetadata: {+ requestMetadata: metadata.requestMetadata,+ source: 'apiV1',+ auth: 'api',+ auditUser: {+ id: team.id,+ email: team.name,+ name: team.name,},- };- }+ },+ });const remappedField = {id: deletedField.id,- documentId: deletedField.documentId,+ documentId: Number(unverifiedDocumentId),recipientId: deletedField.recipientId ?? -1,type: deletedField.type,pageNumber: deletedField.page,@@ -1519,32 +1721,7 @@ export const ApiContractV1Implementation = tsr.router(ApiContractV1, {return {status: 200,- body: {- ...remappedField,- documentId: Number(documentId),- },+ body: remappedField,};}),});--const updateDocument = async ({- documentId,- userId,- teamId,- data,-}: {- documentId: number;- data: Prisma.DocumentUpdateInput;- userId: number;- teamId: number;-}) => {- return await prisma.document.update({- where: {- id: documentId,- team: buildTeamWhereQuery({ teamId, userId }),- },- data: {- ...data,- },- });-};diff --git a/packages/api/v1/schema.ts b/packages/api/v1/schema.tsindex 5b4b33f7b..7155c0ad3 100644--- a/packages/api/v1/schema.ts+++ b/packages/api/v1/schema.ts@@ -8,8 +8,8 @@ import {RecipientRole,SendStatus,SigningStatus,- TemplateType,} from '@prisma/client';+import { TemplateType } from '@prisma/client';import { z } from 'zod';import { DATE_FORMATS, DEFAULT_DOCUMENT_DATE_FORMAT } from '@documenso/lib/constants/date-formats';@@ -49,7 +49,6 @@ export const ZSuccessfulDocumentResponseSchema = z.object({teamId: z.number().nullish(),title: z.string(),status: z.string(),- documentDataId: z.string(),createdAt: z.date(),updatedAt: z.date(),completedAt: z.date().nullable(),@@ -545,7 +544,6 @@ export const ZTemplateSchema = z.object({title: z.string(),userId: z.number(),teamId: z.number().nullish(),- templateDocumentDataId: z.string(),createdAt: z.date(),updatedAt: z.date(),});diff --git a/packages/app-tests/e2e/api/v1/document-sending.spec.ts b/packages/app-tests/e2e/api/v1/document-sending.spec.tsindex 503c7335a..4723b4690 100644--- a/packages/app-tests/e2e/api/v1/document-sending.spec.ts+++ b/packages/app-tests/e2e/api/v1/document-sending.spec.ts@@ -2,6 +2,7 @@ import { expect, test } from '@playwright/test';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import { seedPendingDocumentWithFullFields } from '@documenso/prisma/seed/documents';import { seedUser } from '@documenso/prisma/seed/users';@@ -25,7 +26,7 @@ test.describe('Document API', () => {// Test with sendCompletionEmails: falseconst response = await request.post(- `${NEXT_PUBLIC_WEBAPP_URL()}/api/v1/documents/${document.id}/send`,+ `${NEXT_PUBLIC_WEBAPP_URL()}/api/v1/documents/${mapSecondaryIdToDocumentId(document.secondaryId)}/send`,{headers: {Authorization: `Bearer ${token}`,@@ -41,7 +42,7 @@ test.describe('Document API', () => {expect(response.status()).toBe(200);// Verify email settings were updated- const updatedDocument = await prisma.document.findUnique({+ const updatedDocument = await prisma.envelope.findUnique({where: { id: document.id },include: { documentMeta: true },});@@ -53,7 +54,7 @@ test.describe('Document API', () => {// Test with sendCompletionEmails: trueconst response2 = await request.post(- `${NEXT_PUBLIC_WEBAPP_URL()}/api/v1/documents/${document.id}/send`,+ `${NEXT_PUBLIC_WEBAPP_URL()}/api/v1/documents/${mapSecondaryIdToDocumentId(document.secondaryId)}/send`,{headers: {Authorization: `Bearer ${token}`,@@ -69,7 +70,7 @@ test.describe('Document API', () => {expect(response2.status()).toBe(200);// Verify email settings were updated- const updatedDocument2 = await prisma.document.findUnique({+ const updatedDocument2 = await prisma.envelope.findUnique({where: { id: document.id },include: { documentMeta: true },});@@ -93,16 +94,16 @@ test.describe('Document API', () => {// Set initial email settingsawait prisma.documentMeta.upsert({- where: { documentId: document.id },+ where: { id: document.documentMetaId },create: {- documentId: document.id,+ id: document.documentMetaId,emailSettings: {documentCompleted: true,ownerDocumentCompleted: false,},},update: {- documentId: document.id,+ id: document.documentMetaId,emailSettings: {documentCompleted: true,ownerDocumentCompleted: false,@@ -118,7 +119,7 @@ test.describe('Document API', () => {});const response = await request.post(- `${NEXT_PUBLIC_WEBAPP_URL()}/api/v1/documents/${document.id}/send`,+ `${NEXT_PUBLIC_WEBAPP_URL()}/api/v1/documents/${mapSecondaryIdToDocumentId(document.secondaryId)}/send`,{headers: {Authorization: `Bearer ${token}`,@@ -134,7 +135,7 @@ test.describe('Document API', () => {expect(response.status()).toBe(200);// Verify email settings were not modified- const updatedDocument = await prisma.document.findUnique({+ const updatedDocument = await prisma.envelope.findUnique({where: { id: document.id },include: { documentMeta: true },});diff --git a/packages/app-tests/e2e/api/v1/template-field-prefill.spec.ts b/packages/app-tests/e2e/api/v1/template-field-prefill.spec.tsindex b67645820..799e08c7d 100644--- a/packages/app-tests/e2e/api/v1/template-field-prefill.spec.ts+++ b/packages/app-tests/e2e/api/v1/template-field-prefill.spec.ts@@ -3,6 +3,11 @@ import { expect, test } from '@playwright/test';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';import type { TCheckboxFieldMeta, TRadioFieldMeta } from '@documenso/lib/types/field-meta';+import {+ mapDocumentIdToSecondaryId,+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import { FieldType, RecipientRole } from '@documenso/prisma/client';import { seedBlankTemplate } from '@documenso/prisma/seed/templates';@@ -35,10 +40,12 @@ test.describe('Template Field Prefill API v1', () => {},});+ const firstEnvelopeItem = template.envelopeItems[0];+// 4. Create a recipient for the templateconst recipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: '[email protected]',name: 'Test Recipient',role: RecipientRole.SIGNER,@@ -53,7 +60,8 @@ test.describe('Template Field Prefill API v1', () => {// Add TEXT fieldconst textField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.TEXT,page: 1,@@ -73,7 +81,8 @@ test.describe('Template Field Prefill API v1', () => {// Add NUMBER fieldconst numberField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.NUMBER,page: 1,@@ -93,7 +102,8 @@ test.describe('Template Field Prefill API v1', () => {// Add RADIO fieldconst radioField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.RADIO,page: 1,@@ -117,7 +127,8 @@ test.describe('Template Field Prefill API v1', () => {// Add CHECKBOX fieldconst checkboxField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.CHECKBOX,page: 1,@@ -141,7 +152,8 @@ test.describe('Template Field Prefill API v1', () => {// Add DROPDOWN fieldconst dropdownField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.DROPDOWN,page: 1,@@ -166,11 +178,13 @@ test.describe('Template Field Prefill API v1', () => {});// 7. Navigate to the template- await page.goto(`${WEBAPP_BASE_URL}/templates/${template.id}`);+ await page.goto(+ `${WEBAPP_BASE_URL}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}`,+ );// 8. Create a document from the template with prefilled fieldsconst response = await request.post(- `${WEBAPP_BASE_URL}/api/v1/templates/${template.id}/generate-document`,+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/generate-document`,{headers: {Authorization: `Bearer ${token}`,@@ -229,9 +243,9 @@ test.describe('Template Field Prefill API v1', () => {expect(responseData.documentId).toBeDefined();// 9. Verify the document was created with prefilled fields- const document = await prisma.document.findUnique({+ const document = await prisma.envelope.findUnique({where: {- id: responseData.documentId,+ secondaryId: mapDocumentIdToSecondaryId(responseData.documentId),},include: {fields: true,@@ -240,6 +254,10 @@ test.describe('Template Field Prefill API v1', () => {expect(document).not.toBeNull();+ if (!document) {+ throw new Error('Document not found');+ }+// 10. Verify each field has the correct prefilled valuesconst documentTextField = document?.fields.find((field) => field.type === FieldType.TEXT && field.fieldMeta?.type === 'text',@@ -297,14 +315,14 @@ test.describe('Template Field Prefill API v1', () => {// 11. Sign in as the recipient and verify the prefilled fields are visibleconst documentRecipient = await prisma.recipient.findFirst({where: {- documentId: document?.id,+ envelopeId: document?.id,email: '[email protected]',},});// Send the document to the recipientconst sendResponse = await request.post(- `${WEBAPP_BASE_URL}/api/v1/documents/${document?.id}/send`,+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(document.secondaryId)}/send`,{headers: {Authorization: `Bearer ${token}`,@@ -367,10 +385,12 @@ test.describe('Template Field Prefill API v1', () => {},});+ const firstEnvelopeItem = template.envelopeItems[0];+// 4. Create a recipient for the templateconst recipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: '[email protected]',name: 'Test Recipient',role: RecipientRole.SIGNER,@@ -385,7 +405,8 @@ test.describe('Template Field Prefill API v1', () => {// Add TEXT fieldawait prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.TEXT,page: 1,@@ -405,7 +426,8 @@ test.describe('Template Field Prefill API v1', () => {// Add NUMBER fieldawait prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.NUMBER,page: 1,@@ -429,11 +451,13 @@ test.describe('Template Field Prefill API v1', () => {});// 7. Navigate to the template- await page.goto(`${WEBAPP_BASE_URL}/templates/${template.id}`);+ await page.goto(+ `${WEBAPP_BASE_URL}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}`,+ );// 8. Create a document from the template without prefilled fieldsconst response = await request.post(- `${WEBAPP_BASE_URL}/api/v1/templates/${template.id}/generate-document`,+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/generate-document`,{headers: {Authorization: `Bearer ${token}`,@@ -461,9 +485,9 @@ test.describe('Template Field Prefill API v1', () => {expect(responseData.documentId).toBeDefined();// 9. Verify the document was created with default fields- const document = await prisma.document.findUnique({+ const document = await prisma.envelope.findUnique({where: {- id: responseData.documentId,+ secondaryId: mapDocumentIdToSecondaryId(responseData.documentId),},include: {fields: true,@@ -472,6 +496,10 @@ test.describe('Template Field Prefill API v1', () => {expect(document).not.toBeNull();+ if (!document) {+ throw new Error('Document not found');+ }+// 10. Verify fields have their default valuesconst documentTextField = document?.fields.find((field) => field.type === FieldType.TEXT);expect(documentTextField?.fieldMeta).toMatchObject({@@ -488,7 +516,7 @@ test.describe('Template Field Prefill API v1', () => {// 11. Sign in as the recipient and verify the default fields are visibleconst documentRecipient = await prisma.recipient.findFirst({where: {- documentId: document?.id,+ envelopeId: document?.id,email: '[email protected]',},});@@ -496,7 +524,7 @@ test.describe('Template Field Prefill API v1', () => {expect(documentRecipient).not.toBeNull();const sendResponse = await request.post(- `${WEBAPP_BASE_URL}/api/v1/documents/${document?.id}/send`,+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(document.secondaryId)}/send`,{headers: {Authorization: `Bearer ${token}`,@@ -539,10 +567,12 @@ test.describe('Template Field Prefill API v1', () => {},});+ const firstEnvelopeItem = template.envelopeItems[0];+// 4. Create a recipient for the templateconst recipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: '[email protected]',name: 'Test Recipient',role: RecipientRole.SIGNER,@@ -556,7 +586,8 @@ test.describe('Template Field Prefill API v1', () => {// 5. Add a field to the templateconst field = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.RADIO,page: 1,@@ -579,7 +610,7 @@ test.describe('Template Field Prefill API v1', () => {// 6. Try to create a document with invalid prefill valueconst response = await request.post(- `${WEBAPP_BASE_URL}/api/v1/templates/${template.id}/generate-document`,+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/generate-document`,{headers: {Authorization: `Bearer ${token}`,diff --git a/packages/app-tests/e2e/api/v1/test-unauthorized-api-access.spec.ts b/packages/app-tests/e2e/api/v1/test-unauthorized-api-access.spec.tsindex 875c89d4b..5efb1a076 100644--- a/packages/app-tests/e2e/api/v1/test-unauthorized-api-access.spec.ts+++ b/packages/app-tests/e2e/api/v1/test-unauthorized-api-access.spec.ts@@ -2,15 +2,19 @@ import { expect, test } from '@playwright/test';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';+import {+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';-import { FieldType } from '@documenso/prisma/client';+import { DocumentDataType, FieldType } from '@documenso/prisma/client';import {seedBlankDocument,seedCompletedDocument,seedDraftDocument,seedPendingDocumentWithFullFields,} from '@documenso/prisma/seed/documents';-import { seedBlankTemplate } from '@documenso/prisma/seed/templates';+import { seedBlankTemplate, seedTemplate } from '@documenso/prisma/seed/templates';import { seedUser } from '@documenso/prisma/seed/users';const WEBAPP_BASE_URL = NEXT_PUBLIC_WEBAPP_URL();@@ -20,521 +24,1125 @@ test.describe.configure({});test.describe('Document Access API V1', () => {- test('should block unauthorized access to documents not owned by the user', async ({- request,- }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document GET endpoint', () => {+ test('should block unauthorized access to documents not owned by the user', async ({+ request,+ }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const documentA = await seedBlankDocument(userA, teamA.id);++ // User B cannot access User A's document+ const resB = await request.get(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(404);});- const documentA = await seedBlankDocument(userA, teamA.id);+ test('should allow authorized access to documents owned by the user', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const documentA = await seedBlankDocument(userA, teamA.id);++ // User A can access their own document+ const resA = await request.get(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );- // User B cannot access User A's document- const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },+ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);});-- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(404);});- test('should block unauthorized access to document download endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document download endpoint', () => {+ test('should block unauthorized access to document download endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const documentA = await seedCompletedDocument(userA, teamA.id, ['[email protected]'], {+ createDocumentOptions: { title: 'Document 1 - Completed' },+ });++ const resB = await request.get(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/download`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const res = await resB.json();- const documentA = await seedCompletedDocument(userA, teamA.id, ['[email protected]'], {- createDocumentOptions: { title: 'Document 1 - Completed' },+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(404);});- const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/download`, {- headers: { Authorization: `Bearer ${tokenB}` },- });+ test('should allow authorized access to document download endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const documentA = await seedCompletedDocument(userA, teamA.id, ['[email protected]'], {+ createDocumentOptions: { title: 'Document 1 - Completed' },+ });++ await prisma.documentData.update({+ where: {+ id: documentA.envelopeItems[0].documentDataId,+ },+ data: {+ type: DocumentDataType.S3_PATH,+ },+ });- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(500);- });+ const resA = await request.get(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/download`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );- test('should block unauthorized access to document delete endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ const res = await resA.json();- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ if (res.message === 'Document downloads are only available when S3 storage is configured.') {+ expect(resA.ok()).toBeFalsy();+ expect(resA.status()).toBe(500);+ } else {+ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ }});+ });- const documentA = await seedBlankDocument(userA, teamA.id);+ test.describe('Document delete endpoint', () => {+ test('should block unauthorized access to document delete endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();- const resB = await request.delete(`${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },- });+ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(404);- });+ const documentA = await seedBlankDocument(userA, teamA.id);- test('should block unauthorized access to document send endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ const resB = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(404);});- const { document: documentA } = await seedPendingDocumentWithFullFields({- owner: userA,- recipients: ['[email protected]'],- teamId: teamA.id,- });+ test('should allow authorized access to document delete endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const documentA = await seedBlankDocument(userA, teamA.id);++ const resA = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );- const resB = await request.post(`${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/send`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {},+ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);});-- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(500);});- test('should block unauthorized access to document resend endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document send endpoint', () => {+ test('should block unauthorized access to document send endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const { document: documentA } = await seedPendingDocumentWithFullFields({+ owner: userA,+ recipients: ['[email protected]'],+ teamId: teamA.id,+ });++ const resB = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/send`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {},+ },+ );- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(500);});- const { user: recipientUser } = await seedUser();+ test('should allow authorized access to document send endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const { document: documentA } = await seedPendingDocumentWithFullFields({+ owner: userA,+ recipients: ['[email protected]'],+ teamId: teamA.id,+ });++ const resA = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/send`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {},+ },+ );- const { document: documentA, recipients } = await seedPendingDocumentWithFullFields({- owner: userA,- recipients: [recipientUser.email],- teamId: teamA.id,+ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);});+ });++ test.describe('Document resend endpoint', () => {+ test('should block unauthorized access to document resend endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const { user: recipientUser } = await seedUser();++ const { document: documentA, recipients } = await seedPendingDocumentWithFullFields({+ owner: userA,+ recipients: [recipientUser.email],+ teamId: teamA.id,+ });++ const resB = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/resend`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ recipients: [recipients[0].id],+ },+ },+ );- const resB = await request.post(`${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/resend`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- recipients: [recipients[0].id],- },+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(500);});- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(500);+ test('should allow authorized access to document resend endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const { user: recipientUser } = await seedUser();++ const { document: documentA, recipients } = await seedPendingDocumentWithFullFields({+ owner: userA,+ recipients: [recipientUser.email],+ teamId: teamA.id,+ });++ const resA = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/resend`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ recipients: [recipients[0].id],+ },+ },+ );++ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ });});- test('should block unauthorized access to document recipients endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document recipients POST endpoint', () => {+ test('should block unauthorized access to document recipients endpoint', async ({+ request,+ }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const documentA = await seedBlankDocument(userA, teamA.id);++ const resB = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/recipients`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { name: 'Test', email: '[email protected]' },+ },+ );- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(401);});- const documentA = await seedBlankDocument(userA, teamA.id);-- const resB = await request.post(- `${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/recipients`,- {- headers: { Authorization: `Bearer ${tokenB}` },- data: { name: 'Test', email: '[email protected]' },- },- );+ test('should allow authorized access to document recipients endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const documentA = await seedBlankDocument(userA, teamA.id);++ const resA = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/recipients`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { name: 'Test', email: '[email protected]' },+ },+ );- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(401);+ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ });});- test('should block unauthorized access to PATCH on recipients endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document recipients PATCH endpoint', () => {+ test('should block unauthorized access to PATCH on recipients endpoint', async ({+ request,+ }) => {+ const { user: userA, team: teamA } = await seedUser();- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });- const { user: userRecipient } = await seedUser();+ const { user: userRecipient } = await seedUser();- const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);+ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });++ const patchRes = await request.patch(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/recipients/${recipient!.id}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ name: 'New Name',+ email: '[email protected]',+ role: 'SIGNER',+ signingOrder: null,+ authOptions: {+ accessAuth: [],+ actionAuth: [],+ },+ },+ },+ );- const recipient = await prisma.recipient.findFirst({- where: {- documentId: documentA.id,- email: userRecipient.email,- },+ expect(patchRes.ok()).toBeFalsy();+ expect(patchRes.status()).toBe(401);});- const patchRes = await request.patch(- `${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/recipients/${recipient!.id}`,- {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- name: 'New Name',- email: '[email protected]',- role: 'SIGNER',- signingOrder: null,- authOptions: {- accessAuth: [],- actionAuth: [],+ test('should allow authorized access to PATCH on recipients endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const { user: userRecipient } = await seedUser();++ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });++ const patchRes = await request.patch(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/recipients/${recipient!.id}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ name: 'New Name',+ email: '[email protected]',+ role: 'SIGNER',+ signingOrder: null,+ authOptions: {+ accessAuth: [],+ actionAuth: [],+ },},},- },- );+ );- expect(patchRes.ok()).toBeFalsy();- expect(patchRes.status()).toBe(401);+ expect(patchRes.ok()).toBeTruthy();+ expect(patchRes.status()).toBe(200);+ });});- test('should block unauthorized access to DELETE on recipients endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document recipients DELETE endpoint', () => {+ test('should block unauthorized access to DELETE on recipients endpoint', async ({+ request,+ }) => {+ const { user: userA, team: teamA } = await seedUser();- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });- const { user: userRecipient } = await seedUser();+ const { user: userRecipient } = await seedUser();- const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);+ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });- const recipient = await prisma.recipient.findFirst({- where: {- documentId: documentA.id,- email: userRecipient.email,- },+ const deleteRes = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/recipients/${recipient!.id}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {},+ },+ );++ expect(deleteRes.ok()).toBeFalsy();+ expect(deleteRes.status()).toBe(401);});- const deleteRes = await request.delete(- `${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/recipients/${recipient!.id}`,- {- headers: { Authorization: `Bearer ${tokenB}` },- data: {},- },- );+ test('should allow authorized access to DELETE on recipients endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const { user: userRecipient } = await seedUser();++ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });++ const deleteRes = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/recipients/${recipient!.id}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {},+ },+ );- expect(deleteRes.ok()).toBeFalsy();- expect(deleteRes.status()).toBe(401);+ expect(deleteRes.ok()).toBeTruthy();+ expect(deleteRes.status()).toBe(200);+ });});- test('should block unauthorized access to document fields endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document fields POST endpoint', () => {+ test('should block unauthorized access to document fields endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const { user: recipientUser } = await seedUser();++ const documentA = await seedDraftDocument(userA, teamA.id, [recipientUser.email]);++ const documentRecipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: recipientUser.email,+ },+ });++ const resB = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/fields`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ recipientId: documentRecipient!.id,+ type: 'SIGNATURE',+ pageNumber: 1,+ pageX: 1,+ pageY: 1,+ pageWidth: 1,+ pageHeight: 1,+ },+ },+ );- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(404);});- const { user: recipientUser } = await seedUser();+ test('should allow authorized access to document fields endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });- const documentA = await seedDraftDocument(userA, teamA.id, [recipientUser.email]);+ const { user: recipientUser } = await seedUser();- const documentRecipient = await prisma.recipient.findFirst({- where: {- documentId: documentA.id,- email: recipientUser.email,- },+ const documentA = await seedDraftDocument(userA, teamA.id, [recipientUser.email]);++ const documentRecipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: recipientUser.email,+ },+ });++ const resA = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/fields`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ recipientId: documentRecipient!.id,+ type: 'SIGNATURE',+ pageNumber: 1,+ pageX: 1,+ pageY: 1,+ pageWidth: 1,+ pageHeight: 1,+ },+ },+ );++ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);});+ });++ test.describe('Template GET endpoint', () => {+ test('should block unauthorized access to template get endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const templateA = await seedBlankTemplate(userA, teamA.id);++ const resB = await request.get(+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(templateA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const resB = await request.post(`${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/fields`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- recipientId: documentRecipient!.id,- type: 'SIGNATURE',- pageNumber: 1,- pageX: 1,- pageY: 1,- pageWidth: 1,- pageHeight: 1,- },+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(404);});- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(404);+ test('should allow authorized access to template get endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const templateA = await seedBlankTemplate(userA, teamA.id);++ const resA = await request.get(+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(templateA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );++ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ });});- test('should block unauthorized access to template get endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Template DELETE endpoint', () => {+ test('should block unauthorized access to template delete endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const templateA = await seedBlankTemplate(userA, teamA.id);- const templateA = await seedBlankTemplate(userA, teamA.id);+ const resB = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(templateA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/templates/${templateA.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },+ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(404);});- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(404);+ test('should allow authorized access to template delete endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const templateA = await seedBlankTemplate(userA, teamA.id);++ const resA = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(templateA.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );++ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ });});- test('should block unauthorized access to template delete endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Document fields PATCH endpoint', () => {+ test('should block unauthorized access to PATCH on fields endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });- const templateA = await seedBlankTemplate(userA, teamA.id);+ const { user: userRecipient } = await seedUser();+ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);- const resB = await request.delete(`${WEBAPP_BASE_URL}/api/v1/templates/${templateA.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },+ const firstEnvelopeItem = documentA.envelopeItems[0];++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: documentA.id,+ envelopeItemId: firstEnvelopeItem.id,+ recipientId: recipient!.id,+ type: FieldType.TEXT,+ page: 1,+ positionX: 5,+ positionY: 5,+ width: 10,+ height: 5,+ customText: '',+ inserted: false,+ fieldMeta: {+ type: 'text',+ label: 'Default Text Field',+ },+ },+ });++ const patchRes = await request.patch(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/fields/${field.id}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ recipientId: recipient!.id,+ type: FieldType.TEXT,+ pageNumber: 1,+ pageX: 99,+ pageY: 99,+ pageWidth: 99,+ pageHeight: 99,+ fieldMeta: {+ type: 'text',+ label: 'My new field',+ },+ },+ },+ );+ expect(patchRes.ok()).toBeFalsy();+ expect(patchRes.status()).toBe(401);});- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(404);- });+ test('should allow authorized access to PATCH on fields endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });- test('should block unauthorized access to PATCH on fields endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();-- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });-- const { user: userRecipient } = await seedUser();- const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);-- const recipient = await prisma.recipient.findFirst({- where: {- documentId: documentA.id,- email: userRecipient.email,- },- });-- const field = await prisma.field.create({- data: {- documentId: documentA.id,- recipientId: recipient!.id,- type: FieldType.TEXT,- page: 1,- positionX: 5,- positionY: 5,- width: 10,- height: 5,- customText: '',- inserted: false,- fieldMeta: {- type: 'text',- label: 'Default Text Field',- },- },- });-- const patchRes = await request.patch(- `${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/fields/${field.id}`,- {- headers: { Authorization: `Bearer ${tokenB}` },+ const { user: userRecipient } = await seedUser();+ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const firstEnvelopeItem = documentA.envelopeItems[0];++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });++ const field = await prisma.field.create({data: {+ envelopeId: documentA.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient!.id,type: FieldType.TEXT,- pageNumber: 1,- pageX: 99,- pageY: 99,- pageWidth: 99,- pageHeight: 99,+ page: 1,+ positionX: 5,+ positionY: 5,+ width: 10,+ height: 5,+ customText: '',+ inserted: false,fieldMeta: {type: 'text',- label: 'My new field',+ label: 'Default Text Field',+ },+ },+ });++ const patchRes = await request.patch(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/fields/${field.id}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ recipientId: recipient!.id,+ type: FieldType.TEXT,+ pageNumber: 1,+ pageX: 99,+ pageY: 99,+ pageWidth: 99,+ pageHeight: 99,+ fieldMeta: {+ type: 'text',+ label: 'My new field',+ },},},- },- );- expect(patchRes.ok()).toBeFalsy();- expect(patchRes.status()).toBe(401);+ );+ expect(patchRes.ok()).toBeTruthy();+ expect(patchRes.status()).toBe(200);+ });});- test('should block unauthorized access to DELETE on fields endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();-- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });-- const { user: userRecipient } = await seedUser();- const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);-- const recipient = await prisma.recipient.findFirst({- where: {- documentId: documentA.id,- email: userRecipient.email,- },- });-- const field = await prisma.field.create({- data: {- documentId: documentA.id,- recipientId: recipient!.id,- type: FieldType.NUMBER,- page: 1,- positionX: 5,- positionY: 5,- width: 10,- height: 5,- customText: '',- inserted: false,- fieldMeta: {- type: 'number',- label: 'Default Number Field',- },- },- });-- const deleteRes = await request.delete(- `${WEBAPP_BASE_URL}/api/v1/documents/${documentA.id}/fields/${field.id}`,- {- headers: { Authorization: `Bearer ${tokenB}` },- data: {},- },- );+ test.describe('Document fields DELETE endpoint', () => {+ test('should block unauthorized access to DELETE on fields endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();- expect(deleteRes.ok()).toBeFalsy();- expect(deleteRes.status()).toBe(401);- });+ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });- test('should block unauthorized access to documents list endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ const { user: userRecipient } = await seedUser();+ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const firstEnvelopeItem = documentA.envelopeItems[0];- await seedBlankDocument(userA, teamA.id);+ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });- const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/documents`, {- headers: { Authorization: `Bearer ${tokenB}` },+ const field = await prisma.field.create({+ data: {+ envelopeId: documentA.id,+ envelopeItemId: firstEnvelopeItem.id,+ recipientId: recipient!.id,+ type: FieldType.NUMBER,+ page: 1,+ positionX: 5,+ positionY: 5,+ width: 10,+ height: 5,+ customText: '',+ inserted: false,+ fieldMeta: {+ type: 'number',+ label: 'Default Number Field',+ },+ },+ });++ const deleteRes = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/fields/${field.id}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {},+ },+ );++ expect(deleteRes.ok()).toBeFalsy();+ expect(deleteRes.status()).toBe(401);});- const reqData = await resB.json();+ test('should allow authorized access to DELETE on fields endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });- expect(resB.ok()).toBeTruthy();- expect(resB.status()).toBe(200);- expect(reqData.documents.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(- true,- );- expect(reqData.documents.length).toBe(0);- expect(reqData.totalPages).toBe(0);- });+ const { user: userRecipient } = await seedUser();+ const documentA = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);- test('should block unauthorized access to templates list endpoint', async ({ request }) => {- const { user: userA, team: teamA } = await seedUser();+ const firstEnvelopeItem = documentA.envelopeItems[0];- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,- });+ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: documentA.id,+ email: userRecipient.email,+ },+ });- await seedBlankTemplate(userA, teamA.id);+ const field = await prisma.field.create({+ data: {+ envelopeId: documentA.id,+ envelopeItemId: firstEnvelopeItem.id,+ recipientId: recipient!.id,+ type: FieldType.NUMBER,+ page: 1,+ positionX: 5,+ positionY: 5,+ width: 10,+ height: 5,+ customText: '',+ inserted: false,+ fieldMeta: {+ type: 'number',+ label: 'Default Number Field',+ },+ },+ });- const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/templates`, {- headers: { Authorization: `Bearer ${tokenB}` },+ const deleteRes = await request.delete(+ `${WEBAPP_BASE_URL}/api/v1/documents/${mapSecondaryIdToDocumentId(documentA.secondaryId)}/fields/${field.id}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {},+ },+ );++ expect(deleteRes.ok()).toBeTruthy();+ expect(deleteRes.status()).toBe(200);});+ });++ test.describe('Documents list endpoint', () => {+ test('should block unauthorized access to documents list endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ await seedBlankDocument(userA, teamA.id);++ const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/documents`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ });++ const reqData = await resB.json();- const reqData = await resB.json();+ expect(resB.ok()).toBeTruthy();+ expect(resB.status()).toBe(200);+ expect(reqData.documents.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(+ true,+ );+ expect(reqData.documents.length).toBe(0);+ expect(reqData.totalPages).toBe(0);+ });- expect(resB.ok()).toBeTruthy();- expect(resB.status()).toBe(200);- expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId !== userA.id)).toBe(- true,- );- expect(reqData.templates.length).toBe(0);- expect(reqData.totalPages).toBe(0);+ test('should allow authorized access to documents list endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ await seedBlankDocument(userA, teamA.id);++ const resA = await request.get(`${WEBAPP_BASE_URL}/api/v1/documents`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ });++ const reqData = await resA.json();++ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ expect(reqData.documents.length).toBeGreaterThan(0);+ expect(reqData.documents.every((doc: { userId: number }) => doc.userId === userA.id)).toBe(+ true,+ );+ });});- test('should block unauthorized access to create-document-from-template endpoint', async ({- request,- }) => {- const { user: userA, team: teamA } = await seedUser();+ test.describe('Templates list endpoint', () => {+ test('should block unauthorized access to templates list endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });- const { user: userB, team: teamB } = await seedUser();- const { token: tokenB } = await createApiToken({- userId: userB.id,- teamId: teamB.id,- tokenName: 'userB',- expiresIn: null,+ await seedBlankTemplate(userA, teamA.id);++ const resB = await request.get(`${WEBAPP_BASE_URL}/api/v1/templates`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ });++ const reqData = await resB.json();++ expect(resB.ok()).toBeTruthy();+ expect(resB.status()).toBe(200);+ expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId !== userA.id)).toBe(+ true,+ );+ expect(reqData.templates.length).toBe(0);+ expect(reqData.totalPages).toBe(0);});- const templateA = await seedBlankTemplate(userA, teamA.id);+ test('should allow authorized access to templates list endpoint', async ({ request }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ await seedBlankTemplate(userA, teamA.id);++ const resA = await request.get(`${WEBAPP_BASE_URL}/api/v1/templates`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ });++ const reqData = await resA.json();++ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ expect(reqData.templates.length).toBeGreaterThan(0);+ expect(reqData.templates.every((tpl: { userId: number }) => tpl.userId === userA.id)).toBe(+ true,+ );+ });+ });- const resB = await request.post(- `${WEBAPP_BASE_URL}/api/v1/templates/${templateA.id}/create-document`,- {- headers: {- Authorization: `Bearer ${tokenB}`,- 'Content-Type': 'application/json',+ test.describe('Create document from template endpoint', () => {+ test('should block unauthorized access to create-document-from-template endpoint', async ({+ request,+ }) => {+ const { user: userA, team: teamA } = await seedUser();++ const { user: userB, team: teamB } = await seedUser();+ const { token: tokenB } = await createApiToken({+ userId: userB.id,+ teamId: teamB.id,+ tokenName: 'userB',+ expiresIn: null,+ });++ const templateA = await seedTemplate({+ teamId: teamA.id,+ userId: userA.id,+ });++ const resB = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(templateA.secondaryId)}/create-document`,+ {+ headers: {+ Authorization: `Bearer ${tokenB}`,+ 'Content-Type': 'application/json',+ },+ data: {+ title: 'Should not work',+ recipients: [{ name: 'Test user', email: '[email protected]' }],+ meta: {+ subject: 'Test',+ message: 'Test',+ timezone: 'UTC',+ dateFormat: 'yyyy-MM-dd',+ redirectUrl: 'https://example.com',+ },+ },},- data: {- title: 'Should not work',- recipients: [{ name: 'Test user', email: '[email protected]' }],- meta: {- subject: 'Test',- message: 'Test',- timezone: 'UTC',- dateFormat: 'yyyy-MM-dd',- redirectUrl: 'https://example.com',+ );++ expect(resB.ok()).toBeFalsy();+ expect(resB.status()).toBe(401);+ });++ test('should allow authorized access to create-document-from-template endpoint', async ({+ request,+ }) => {+ const { user: userA, team: teamA } = await seedUser();+ const { token: tokenA } = await createApiToken({+ userId: userA.id,+ teamId: teamA.id,+ tokenName: 'userA',+ expiresIn: null,+ });++ const templateA = await seedTemplate({+ teamId: teamA.id,+ userId: userA.id,+ });++ const resA = await request.post(+ `${WEBAPP_BASE_URL}/api/v1/templates/${mapSecondaryIdToTemplateId(templateA.secondaryId)}/create-document`,+ {+ headers: {+ Authorization: `Bearer ${tokenA}`,+ 'Content-Type': 'application/json',+ },+ data: {+ title: 'Should work',+ recipients: [{ name: 'Test user', email: '[email protected]' }],+ meta: {+ subject: 'Test',+ message: 'Test',+ timezone: 'UTC',+ dateFormat: 'yyyy-MM-dd',+ redirectUrl: 'https://example.com',+ },},},- },- );+ );- expect(resB.ok()).toBeFalsy();- expect(resB.status()).toBe(401);+ expect(resA.ok()).toBeTruthy();+ expect(resA.status()).toBe(200);+ });});});diff --git a/packages/app-tests/e2e/api/v2/template-field-prefill.spec.ts b/packages/app-tests/e2e/api/v2/template-field-prefill.spec.tsindex ec83008aa..f0835a000 100644--- a/packages/app-tests/e2e/api/v2/template-field-prefill.spec.ts+++ b/packages/app-tests/e2e/api/v2/template-field-prefill.spec.ts@@ -3,6 +3,11 @@ import { expect, test } from '@playwright/test';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';import type { TCheckboxFieldMeta, TRadioFieldMeta } from '@documenso/lib/types/field-meta';+import {+ mapDocumentIdToSecondaryId,+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import { FieldType, RecipientRole } from '@documenso/prisma/client';import { seedBlankTemplate } from '@documenso/prisma/seed/templates';@@ -35,10 +40,12 @@ test.describe('Template Field Prefill API v2', () => {},});+ const firstEnvelopeItem = template.envelopeItems[0];+// 4. Create a recipient for the templateconst recipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: '[email protected]',name: 'Test Recipient',role: RecipientRole.SIGNER,@@ -53,7 +60,8 @@ test.describe('Template Field Prefill API v2', () => {// Add TEXT fieldconst textField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.TEXT,page: 1,@@ -73,7 +81,8 @@ test.describe('Template Field Prefill API v2', () => {// Add NUMBER fieldconst numberField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.NUMBER,page: 1,@@ -93,7 +102,8 @@ test.describe('Template Field Prefill API v2', () => {// Add RADIO fieldconst radioField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.RADIO,page: 1,@@ -117,7 +127,8 @@ test.describe('Template Field Prefill API v2', () => {// Add CHECKBOX fieldconst checkboxField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.CHECKBOX,page: 1,@@ -141,7 +152,8 @@ test.describe('Template Field Prefill API v2', () => {// Add DROPDOWN fieldconst dropdownField = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.DROPDOWN,page: 1,@@ -166,7 +178,9 @@ test.describe('Template Field Prefill API v2', () => {});// 7. Navigate to the template- await page.goto(`${WEBAPP_BASE_URL}/templates/${template.id}`);+ await page.goto(+ `${WEBAPP_BASE_URL}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}`,+ );// 8. Create a document from the template with prefilled fields using v2 APIconst response = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/use`, {@@ -175,7 +189,7 @@ test.describe('Template Field Prefill API v2', () => {'Content-Type': 'application/json',},data: {- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),recipients: [{id: recipient.id,@@ -226,9 +240,9 @@ test.describe('Template Field Prefill API v2', () => {expect(responseData.id).toBeDefined();// 9. Verify the document was created with prefilled fields- const document = await prisma.document.findUnique({+ const document = await prisma.envelope.findUnique({where: {- id: responseData.id,+ secondaryId: mapDocumentIdToSecondaryId(responseData.id),},include: {fields: true,@@ -237,6 +251,10 @@ test.describe('Template Field Prefill API v2', () => {expect(document).not.toBeNull();+ if (!document) {+ throw new Error('Document not found');+ }+// 10. Verify each field has the correct prefilled valuesconst documentTextField = document?.fields.find((field) => field.type === FieldType.TEXT && field.fieldMeta?.type === 'text',@@ -297,7 +315,7 @@ test.describe('Template Field Prefill API v2', () => {'Content-Type': 'application/json',},data: {- documentId: document?.id,+ documentId: mapSecondaryIdToDocumentId(document?.secondaryId),meta: {subject: 'Test Subject',message: 'Test Message',@@ -311,7 +329,7 @@ test.describe('Template Field Prefill API v2', () => {// 11. Sign in as the recipient and verify the prefilled fields are visibleconst documentRecipient = await prisma.recipient.findFirst({where: {- documentId: document?.id,+ envelopeId: document?.id,email: '[email protected]',},});@@ -364,10 +382,12 @@ test.describe('Template Field Prefill API v2', () => {},});+ const firstEnvelopeItem = template.envelopeItems[0];+// 4. Create a recipient for the templateconst recipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: '[email protected]',name: 'Test Recipient',role: RecipientRole.SIGNER,@@ -382,7 +402,8 @@ test.describe('Template Field Prefill API v2', () => {// Add TEXT fieldawait prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.TEXT,page: 1,@@ -402,7 +423,8 @@ test.describe('Template Field Prefill API v2', () => {// Add NUMBER fieldawait prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.NUMBER,page: 1,@@ -426,7 +448,9 @@ test.describe('Template Field Prefill API v2', () => {});// 7. Navigate to the template- await page.goto(`${WEBAPP_BASE_URL}/templates/${template.id}`);+ await page.goto(+ `${WEBAPP_BASE_URL}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}`,+ );// 8. Create a document from the template without prefilled fields using v2 APIconst response = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/use`, {@@ -435,7 +459,7 @@ test.describe('Template Field Prefill API v2', () => {'Content-Type': 'application/json',},data: {- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),recipients: [{id: recipient.id,@@ -454,9 +478,9 @@ test.describe('Template Field Prefill API v2', () => {expect(responseData.id).toBeDefined();// 9. Verify the document was created with default fields- const document = await prisma.document.findUnique({+ const document = await prisma.envelope.findUnique({where: {- id: responseData.id,+ secondaryId: mapDocumentIdToSecondaryId(responseData.id),},include: {fields: true,@@ -465,6 +489,10 @@ test.describe('Template Field Prefill API v2', () => {expect(document).not.toBeNull();+ if (!document) {+ throw new Error('Document not found');+ }+// 10. Verify fields have their default valuesconst documentTextField = document?.fields.find((field) => field.type === FieldType.TEXT);expect(documentTextField?.fieldMeta).toMatchObject({@@ -484,7 +512,7 @@ test.describe('Template Field Prefill API v2', () => {'Content-Type': 'application/json',},data: {- documentId: document?.id,+ documentId: mapSecondaryIdToDocumentId(document?.secondaryId),meta: {subject: 'Test Subject',message: 'Test Message',@@ -498,7 +526,7 @@ test.describe('Template Field Prefill API v2', () => {// 11. Sign in as the recipient and verify the default fields are visibleconst documentRecipient = await prisma.recipient.findFirst({where: {- documentId: document?.id,+ envelopeId: document?.id,email: '[email protected]',},});@@ -531,10 +559,12 @@ test.describe('Template Field Prefill API v2', () => {},});+ const firstEnvelopeItem = template.envelopeItems[0];+// 4. Create a recipient for the templateconst recipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: '[email protected]',name: 'Test Recipient',role: RecipientRole.SIGNER,@@ -548,7 +578,8 @@ test.describe('Template Field Prefill API v2', () => {// 5. Add a field to the templateconst field = await prisma.field.create({data: {- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: recipient.id,type: FieldType.RADIO,page: 1,@@ -576,7 +607,7 @@ test.describe('Template Field Prefill API v2', () => {'Content-Type': 'application/json',},data: {- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),recipients: [{id: recipient.id,diff --git a/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts b/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.tsindex 73ef577b7..d45ea4512 100644--- a/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts+++ b/packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts@@ -4,6 +4,10 @@ import type { Team, User } from '@prisma/client';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';import { nanoid } from '@documenso/lib/universal/id';+import {+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import {DocumentVisibility,@@ -29,7 +33,7 @@ test.describe.configure({mode: 'parallel',});-test.describe('Unauthorized Access - Document API V2', () => {+test.describe('Document API V2', () => {let userA: User, teamA: Team, userB: User, teamB: Team, tokenA: string, tokenB: string;test.beforeEach(async () => {@@ -50,227 +54,386 @@ test.describe('Unauthorized Access - Document API V2', () => {}));});- test('should block unauthorized access to document list endpoint', async ({ request }) => {- await seedCompletedDocument(userA, teamA.id, ['[email protected]']);+ test.describe('Document list endpoint', () => {+ test('should block unauthorized access to document list endpoint', async ({ request }) => {+ await seedCompletedDocument(userA, teamA.id, ['[email protected]']);++ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);- const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document`, {- headers: { Authorization: `Bearer ${tokenB}` },+ const data = await res.json();+ expect(data.data.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(true);});- expect(res.ok()).toBeTruthy();- expect(res.status()).toBe(200);+ test('should allow authorized access to document list endpoint', async ({ request }) => {+ await seedCompletedDocument(userA, teamA.id, ['[email protected]']);- const data = await res.json();- expect(data.data.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(true);- });+ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ });- test('should block unauthorized access to document detail endpoint', async ({ request }) => {- const doc = await seedBlankDocument(userA, teamA.id);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);- const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document/${doc.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },+ const data = await res.json();+ expect(data.data.length).toBeGreaterThan(0);+ expect(data.data.every((doc: { userId: number }) => doc.userId === userA.id)).toBe(true);});-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);});- test('should block unauthorized access to document update endpoint', async ({ request }) => {- const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);+ test.describe('Document detail endpoint', () => {+ test('should block unauthorized access to document detail endpoint', async ({ request }) => {+ const doc = await seedBlankDocument(userA, teamA.id);++ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/${mapSecondaryIdToDocumentId(doc.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/update`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { documentId: doc.id, data: { title: 'Updated Title' } },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to document detail endpoint', async ({ request }) => {+ const doc = await seedBlankDocument(userA, teamA.id);++ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/${mapSecondaryIdToDocumentId(doc.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document delete endpoint', async ({ request }) => {- const doc = await seedDraftDocument(userA, teamA.id, []);+ test.describe('Document update endpoint', () => {+ test('should block unauthorized access to document update endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/update`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ data: { title: 'Updated Title' },+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { documentId: doc.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(401);+ test('should allow authorized access to document update endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/update`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ data: { title: 'Updated Title' },+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document move endpoint', async ({ request }) => {- const doc = await seedDraftDocument(userA, teamA.id, []);+ test.describe('Document delete endpoint', () => {+ test('should block unauthorized access to document delete endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, []);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { documentId: mapSecondaryIdToDocumentId(doc.secondaryId) },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/move`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { documentId: doc.id, teamId: teamB.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(401);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to document delete endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, []);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { documentId: mapSecondaryIdToDocumentId(doc.secondaryId) },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document distribute endpoint', async ({ request }) => {- const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);+ test.describe('Document distribute endpoint', () => {+ test('should block unauthorized access to document distribute endpoint', async ({+ request,+ }) => {+ const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/distribute`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { documentId: doc.id },+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/distribute`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { documentId: mapSecondaryIdToDocumentId(doc.secondaryId) },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(500);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(500);+ test('should allow authorized access to document distribute endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/distribute`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { documentId: mapSecondaryIdToDocumentId(doc.secondaryId) },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document redistribute endpoint', async ({- request,- }) => {- const doc = await seedPendingDocument(userA, teamA.id, []);-- const userRecipient = await prisma.recipient.create({- data: {- email: '[email protected]',- name: 'Test',- token: nanoid(),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.SENT,- signingStatus: SigningStatus.NOT_SIGNED,- signedAt: null,- document: {- connect: {- id: doc.id,+ test.describe('Document redistribute endpoint', () => {+ test('should block unauthorized access to document redistribute endpoint', async ({+ request,+ }) => {+ const doc = await seedPendingDocument(userA, teamA.id, []);++ const userRecipient = await prisma.recipient.create({+ data: {+ email: '[email protected]',+ name: 'Test',+ token: nanoid(),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ signedAt: null,+ envelopeId: doc.id,+ fields: {+ create: {+ page: 1,+ type: FieldType.NAME,+ inserted: true,+ customText: '',+ positionX: new Prisma.Decimal(1),+ positionY: new Prisma.Decimal(1),+ width: new Prisma.Decimal(1),+ height: new Prisma.Decimal(1),+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ },},},- fields: {- create: {- page: 1,- type: FieldType.NAME,- inserted: true,- customText: '',- positionX: new Prisma.Decimal(1),- positionY: new Prisma.Decimal(1),- width: new Prisma.Decimal(1),- height: new Prisma.Decimal(1),- documentId: doc.id,- },+ });++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: userRecipient.email,},- },- });+ });- const recipient = await prisma.recipient.findFirst({- where: {- documentId: doc.id,- email: userRecipient.email,- },- });+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/redistribute`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipients: [recipient!.id],+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/redistribute`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { documentId: doc.id, recipients: [recipient!.id] },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(500);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(500);- });+ test('should allow authorized access to document redistribute endpoint', async ({+ request,+ }) => {+ const doc = await seedPendingDocument(userA, teamA.id, []);++ const userRecipient = await prisma.recipient.create({+ data: {+ email: '[email protected]',+ name: 'Test',+ token: nanoid(),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ signedAt: null,+ envelopeId: doc.id,+ fields: {+ create: {+ page: 1,+ type: FieldType.NAME,+ inserted: true,+ customText: '',+ positionX: new Prisma.Decimal(1),+ positionY: new Prisma.Decimal(1),+ width: new Prisma.Decimal(1),+ height: new Prisma.Decimal(1),+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ },+ },+ },+ });++ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: userRecipient.email,+ },+ });- test('should block unauthorized access to document duplicate endpoint', async ({ request }) => {- const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/redistribute`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipients: [recipient!.id],+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/duplicate`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { documentId: doc.id },+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);});- test('should block unauthorized access to document field endpoint', async ({ request }) => {- const { user: userRecipient } = await seedUser();+ test.describe('Document duplicate endpoint', () => {+ test('should block unauthorized access to document duplicate endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);- const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/duplicate`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { documentId: mapSecondaryIdToDocumentId(doc.secondaryId) },+ });- const recipient = await prisma.recipient.findFirst({- where: {- documentId: doc.id,- email: userRecipient.email,- },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- const field = await prisma.field.create({- data: {- documentId: doc.id,- recipientId: recipient!.id,- type: 'TEXT',- page: 1,- positionX: 1,- positionY: 1,- width: 1,- height: 1,- customText: '',- inserted: false,- fieldMeta: { type: 'text', label: 'Test' },- },- });+ test('should allow authorized access to document duplicate endpoint', async ({ request }) => {+ const doc = await seedDraftDocument(userA, teamA.id, ['[email protected]']);- const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/${field.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },- });+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/duplicate`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { documentId: mapSecondaryIdToDocumentId(doc.secondaryId) },+ });++ const asdf = await res.json();+ console.log({+ asdf,+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document field create endpoint', async ({- request,- }) => {- const { user: userRecipient } = await seedUser();+ test.describe('Document field GET endpoint', () => {+ test('should block unauthorized access to document field endpoint', async ({ request }) => {+ const { user: userRecipient } = await seedUser();- const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);+ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },- });+ const recipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: userRecipient.email,+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/create`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- documentId: doc.id,- field: {+ const field = await prisma.field.create({+ data: {+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,recipientId: recipient!.id,type: 'TEXT',- pageNumber: 791.77,- pageX: 7845.22,- pageY: 6843.16,- width: 3932.15,- height: 8879.89,- fieldMeta: { type: 'text', label: 'Test Field' },+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test' },},- },+ });++ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/${field.id}`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect([404, 401, 500]).toContain(res.status());- });+ test('should allow authorized access to document field endpoint', async ({ request }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirstOrThrow({+ where: {+ envelopeId: doc.id,+ email: userRecipient.email,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient.id,+ type: 'TEXT',+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test' },+ },+ });- test('should block unauthorized access to document field create-many endpoint', async ({- request,- }) => {- const { user: userRecipient } = await seedUser();+ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/${field.id}`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ });- const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);+ const asdf = await res.json();+ console.log({+ asdf,+ });- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/create-many`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- documentId: doc.id,- fields: [- {+ test.describe('Document field create endpoint', () => {+ test('should block unauthorized access to document field create endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/create`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ field: {recipientId: recipient!.id,type: 'TEXT',pageNumber: 791.77,@@ -278,86 +441,156 @@ test.describe('Unauthorized Access - Document API V2', () => {pageY: 6843.16,width: 3932.15,height: 8879.89,- fieldMeta: { type: 'text', label: 'First test field' },+ fieldMeta: { type: 'text', label: 'Test Field' },},- {+ },+ });++ expect(res.ok()).toBeFalsy();+ expect([404, 401, 500]).toContain(res.status());+ });++ test('should allow authorized access to document field create endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/create`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ field: {recipientId: recipient!.id,type: 'TEXT',pageNumber: 791.77,- pageX: 845.22,- pageY: 843.16,- width: 932.15,- height: 879.89,- fieldMeta: { type: 'text', label: 'Second test field' },+ pageX: 7845.22,+ pageY: 6843.16,+ width: 3932.15,+ height: 8879.89,+ fieldMeta: { type: 'text', label: 'Test Field' },},- ],- },- });+ },+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document field update endpoint', async ({- request,- }) => {- const { user: userRecipient } = await seedUser();-- const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);-- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },- });-- const field = await prisma.field.create({- data: {- documentId: doc.id,- recipientId: recipient!.id,- type: 'TEXT',- page: 1,- positionX: 1,- positionY: 1,- width: 1,- height: 1,- customText: '',- inserted: false,- fieldMeta: { type: 'text', label: 'A text field' },- },- });-- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/update`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- documentId: doc.id,- field: {- id: field.id,- type: FieldType.TEXT,- fieldMeta: { type: 'text', label: 'An updated text field' },+ test.describe('Document field create-many endpoint', () => {+ test('should block unauthorized access to document field create-many endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/create-many`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ fields: [+ {+ recipientId: recipient!.id,+ type: 'TEXT',+ pageNumber: 791.77,+ pageX: 7845.22,+ pageY: 6843.16,+ width: 3932.15,+ height: 8879.89,+ fieldMeta: { type: 'text', label: 'First test field' },+ },+ {+ recipientId: recipient!.id,+ type: 'TEXT',+ pageNumber: 791.77,+ pageX: 845.22,+ pageY: 843.16,+ width: 932.15,+ height: 879.89,+ fieldMeta: { type: 'text', label: 'Second test field' },+ },+ ],},- },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ test('should allow authorized access to document field create-many endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);- test('should block unauthorized access to document field update-many endpoint', async ({- request,- }) => {- const { user: userRecipient } = await seedUser();+ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });- const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/create-many`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ fields: [+ {+ recipientId: recipient!.id,+ type: 'TEXT',+ pageNumber: 791.77,+ pageX: 7845.22,+ pageY: 6843.16,+ width: 3932.15,+ height: 8879.89,+ fieldMeta: { type: 'text', label: 'First test field' },+ },+ {+ recipientId: recipient!.id,+ type: 'TEXT',+ pageNumber: 791.77,+ pageX: 845.22,+ pageY: 843.16,+ width: 932.15,+ height: 879.89,+ fieldMeta: { type: 'text', label: 'Second test field' },+ },+ ],+ },+ });- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});+ });- const fields = await prisma.field.createManyAndReturn({- data: [- {- documentId: doc.id,+ test.describe('Document field update endpoint', () => {+ test('should block unauthorized access to document field update endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,recipientId: recipient!.id,- type: FieldType.TEXT,+ type: 'TEXT',page: 1,positionX: 1,positionY: 1,@@ -365,12 +598,43 @@ test.describe('Unauthorized Access - Document API V2', () => {height: 1,customText: '',inserted: false,- fieldMeta: { type: 'text', label: 'Test' },+ fieldMeta: { type: 'text', label: 'A text field' },},- {- documentId: doc.id,+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/update`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ field: {+ id: field.id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'An updated text field' },+ },+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to document field update endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,recipientId: recipient!.id,- type: FieldType.NUMBER,+ type: 'TEXT',page: 1,positionX: 1,positionY: 1,@@ -378,289 +642,181 @@ test.describe('Unauthorized Access - Document API V2', () => {height: 1,customText: '',inserted: false,- fieldMeta: { type: 'text', label: 'Test' },+ fieldMeta: { type: 'text', label: 'A text field' },+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/update`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ field: {+ id: field.id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'An updated text field' },+ },},- ],+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});+ });++ test.describe('Document field update-many endpoint', () => {+ test('should block unauthorized access to document field update-many endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/update-many`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- documentId: doc.id,- fields: [+ const fields = await prisma.field.createManyAndReturn({+ data: [{- id: fields[0].id,+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient!.id,type: FieldType.TEXT,- fieldMeta: { type: 'text', label: 'Updated first test field' },+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test' },},{- id: fields[1].id,+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient!.id,type: FieldType.NUMBER,- fieldMeta: { type: 'number', label: 'Updated second test field' },+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test' },},],- },- });-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });-- test('should block unauthorized access to document field delete endpoint', async ({- request,- }) => {- const { user: userRecipient } = await seedUser();+ });- const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);-- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },- });-- const field = await prisma.field.create({- data: {- documentId: doc.id,- recipientId: recipient!.id,- type: FieldType.TEXT,- page: 1,- positionX: 1,- positionY: 1,- width: 1,- height: 1,- customText: '',- inserted: false,- fieldMeta: { type: 'text', label: 'Test' },- },- });+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/update-many`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ fields: [+ {+ id: fields[0].id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'Updated first test field' },+ },+ {+ id: fields[1].id,+ type: FieldType.NUMBER,+ fieldMeta: { type: 'number', label: 'Updated second test field' },+ },+ ],+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { fieldId: field.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });-- test('should block unauthorized access to template field create endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/create`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- field: {- recipientId: recipient.id,- type: FieldType.TEXT,- pageNumber: 5735.12,- pageX: 936.28,- pageY: 594.41,- width: 589.39,- height: 122.23,- fieldMeta: { type: 'text', label: 'Test' },- },- },- });+ test('should allow authorized access to document field update-many endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);- test('should block unauthorized access to template field get field endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const field = await prisma.field.create({- data: {- templateId: template.id,- recipientId: recipient.id,- type: FieldType.TEXT,- page: 1,- positionX: 936.28,- positionY: 594.41,- width: 589.39,- height: 122.23,- customText: '',- inserted: false,- fieldMeta: { type: 'text', label: 'New test field' },- },- });-- const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/${field.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },- });-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });- test('should block unauthorized access to template field create-many endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const secondRecipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test 2',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/create-many`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- fields: [+ const fields = await prisma.field.createManyAndReturn({+ data: [{- recipientId: recipient.id,+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient!.id,type: FieldType.TEXT,- pageNumber: 1,- pageX: 1,- pageY: 1,+ page: 1,+ positionX: 1,+ positionY: 1,width: 1,height: 1,+ customText: '',+ inserted: false,fieldMeta: { type: 'text', label: 'Test' },},{- recipientId: secondRecipient.id,+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient!.id,type: FieldType.NUMBER,- pageNumber: 1,- pageX: 1,- pageY: 1,+ page: 1,+ positionX: 1,+ positionY: 1,width: 1,height: 1,- fieldMeta: { type: 'number', label: 'Test 2' },+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test' },},],- },- });+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });-- test('should block unauthorized access to template field update endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const field = await prisma.field.create({- data: {- templateId: template.id,- recipientId: recipient.id,- type: FieldType.TEXT,- page: 1,- positionX: 1,- positionY: 1,- width: 1,- height: 1,- customText: '',- inserted: false,- fieldMeta: { type: 'text', label: 'Test field to update' },- },- });-- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/update`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- field: {- id: field.id,- type: FieldType.TEXT,- fieldMeta: { type: 'text', label: 'Updated field' },+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/update-many`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ fields: [+ {+ id: fields[0].id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'Updated first test field' },+ },+ {+ id: fields[1].id,+ type: FieldType.NUMBER,+ fieldMeta: { type: 'number', label: 'Updated second test field' },+ },+ ],},- },- });+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template field update-many endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const field = await prisma.field.createManyAndReturn({- data: [- {- templateId: template.id,- recipientId: recipient.id,- type: 'TEXT',+ test.describe('Document field delete endpoint', () => {+ test('should block unauthorized access to document field delete endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient!.id,+ type: FieldType.TEXT,page: 1,positionX: 1,positionY: 1,@@ -668,668 +824,1895 @@ test.describe('Unauthorized Access - Document API V2', () => {height: 1,customText: '',inserted: false,- fieldMeta: { type: 'text', label: 'Test field to update' },+ fieldMeta: { type: 'text', label: 'Test' },},- {- templateId: template.id,- recipientId: recipient.id,- type: FieldType.NUMBER,- page: 1,- positionX: 1,- positionY: 1,- width: 1,+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { fieldId: field.id },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to document field delete endpoint', async ({+ request,+ }) => {+ const { user: userRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [userRecipient.email]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: doc.id,+ envelopeItemId: doc.envelopeItems[0].id,+ recipientId: recipient!.id,+ type: FieldType.TEXT,+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,height: 1,customText: '',inserted: false,- fieldMeta: { type: 'number', label: 'Test field to update' },+ fieldMeta: { type: 'text', label: 'Test' },},- ],+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/field/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { fieldId: field.id },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/update-many`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- fields: [- {- id: field[0].id,+ test.describe('Template field create endpoint', () => {+ test('should block unauthorized access to template field create endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/create`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ field: {+ recipientId: recipient.id,+ type: FieldType.TEXT,+ pageNumber: 5735.12,+ pageX: 936.28,+ pageY: 594.41,+ width: 589.39,+ height: 122.23,+ fieldMeta: { type: 'text', label: 'Test' },+ },+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template field create endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/create`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ field: {+ recipientId: recipient.id,+ type: FieldType.TEXT,+ pageNumber: 5735.12,+ pageX: 936.28,+ pageY: 594.41,+ width: 589.39,+ height: 122.23,+ fieldMeta: { type: 'text', label: 'Test' },+ },+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Template field GET endpoint', () => {+ test('should block unauthorized access to template field get field endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: FieldType.TEXT,+ page: 1,+ positionX: 936.28,+ positionY: 594.41,+ width: 589.39,+ height: 122.23,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'New test field' },+ },+ });++ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/${field.id}`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template field get field endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: FieldType.TEXT,+ page: 1,+ positionX: 936.28,+ positionY: 594.41,+ width: 589.39,+ height: 122.23,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'New test field' },+ },+ });++ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/${field.id}`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Template field create-many endpoint', () => {+ test('should block unauthorized access to template field create-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const secondRecipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test 2',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/create-many`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ fields: [+ {+ recipientId: recipient.id,+ type: FieldType.TEXT,+ pageNumber: 1,+ pageX: 1,+ pageY: 1,+ width: 1,+ height: 1,+ fieldMeta: { type: 'text', label: 'Test' },+ },+ {+ recipientId: secondRecipient.id,+ type: FieldType.NUMBER,+ pageNumber: 1,+ pageX: 1,+ pageY: 1,+ width: 1,+ height: 1,+ fieldMeta: { type: 'number', label: 'Test 2' },+ },+ ],+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template field create-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const secondRecipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test 2',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/create-many`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ fields: [+ {+ recipientId: recipient.id,+ type: FieldType.TEXT,+ pageNumber: 1,+ pageX: 1,+ pageY: 1,+ width: 1,+ height: 1,+ fieldMeta: { type: 'text', label: 'Test' },+ },+ {+ recipientId: secondRecipient.id,+ type: FieldType.NUMBER,+ pageNumber: 1,+ pageX: 1,+ pageY: 1,+ width: 1,+ height: 1,+ fieldMeta: { type: 'number', label: 'Test 2' },+ },+ ],+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Template field update endpoint', () => {+ test('should block unauthorized access to template field update endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: FieldType.TEXT,+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test field to update' },+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/update`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ field: {+ id: field.id,type: FieldType.TEXT,- fieldMeta: { type: 'text', label: 'Updated first field - text' },+ fieldMeta: { type: 'text', label: 'Updated field' },+ },+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template field update endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: FieldType.TEXT,+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test field to update' },+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/update`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ field: {+ id: field.id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'Updated field' },+ },+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Template field update-many endpoint', () => {+ test('should block unauthorized access to template field update-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.createManyAndReturn({+ data: [+ {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: 'TEXT',+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test field to update' },},{- id: field[1].id,+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,type: FieldType.NUMBER,- fieldMeta: { type: 'number', label: 'Updated second field - number' },+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'number', label: 'Test field to update' },},],- },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/update-many`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ fields: [+ {+ id: field[0].id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'Updated first field - text' },+ },+ {+ id: field[1].id,+ type: FieldType.NUMBER,+ fieldMeta: { type: 'number', label: 'Updated second field - number' },+ },+ ],+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to template field update-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.createManyAndReturn({+ data: [+ {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: 'TEXT',+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test field to update' },+ },+ {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: FieldType.NUMBER,+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'number', label: 'Test field to update' },+ },+ ],+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/update-many`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ fields: [+ {+ id: field[0].id,+ type: FieldType.TEXT,+ fieldMeta: { type: 'text', label: 'Updated first field - text' },+ },+ {+ id: field[1].id,+ type: FieldType.NUMBER,+ fieldMeta: { type: 'number', label: 'Updated second field - number' },+ },+ ],+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template field delete endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const field = await prisma.field.create({- data: {- templateId: template.id,- recipientId: recipient.id,- type: 'TEXT',- page: 1,- positionX: 1,- positionY: 1,- width: 1,- height: 1,- customText: '',- inserted: false,- fieldMeta: { type: 'text', label: 'Test field to delete' },- },- });-- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { fieldId: field.id },- });-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test.describe('Template field delete endpoint', () => {+ test('should block unauthorized access to template field delete endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: 'TEXT',+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test field to delete' },+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { fieldId: field.id },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template field delete endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const field = await prisma.field.create({+ data: {+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,+ recipientId: recipient.id,+ type: 'TEXT',+ page: 1,+ positionX: 1,+ positionY: 1,+ width: 1,+ height: 1,+ customText: '',+ inserted: false,+ fieldMeta: { type: 'text', label: 'Test field to delete' },+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/field/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { fieldId: field.id },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document recipient get endpoint', async ({- request,- }) => {- const { user: recipientUser } = await seedUser();+ test.describe('Document recipient GET endpoint', () => {+ test('should block unauthorized access to document recipient get endpoint', async ({+ request,+ }) => {+ const { user: recipientUser } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);- const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);+ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/${recipient!.id}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- const res = await request.get(- `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/${recipient!.id}`,- {+ test('should allow authorized access to document recipient get endpoint', async ({+ request,+ }) => {+ const { user: recipientUser } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/${recipient!.id}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Document recipient create endpoint', () => {+ test('should block unauthorized access to document recipient create endpoint', async ({+ request,+ }) => {+ const doc = await seedDraftDocument(userA, teamA.id, []);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/create`, {headers: { Authorization: `Bearer ${tokenB}` },- },- );+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipient: {+ name: 'Test',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to document recipient create endpoint', async ({+ request,+ }) => {+ const doc = await seedDraftDocument(userA, teamA.id, []);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/create`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipient: {+ name: 'Test',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document recipient create endpoint', async ({- request,- }) => {- const doc = await seedDraftDocument(userA, teamA.id, []);+ test.describe('Document recipient create-many endpoint', () => {+ test('should block unauthorized access to document recipient create-many endpoint', async ({+ request,+ }) => {+ const doc = await seedDraftDocument(userA, teamA.id, []);++ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/create-many`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipients: [+ {+ name: 'Test',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ {+ name: 'Test 2',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ ],+ },+ },+ );++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to document recipient create-many endpoint', async ({+ request,+ }) => {+ const doc = await seedDraftDocument(userA, teamA.id, []);++ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/create-many`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipients: [+ {+ name: 'Test',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ {+ name: 'Test 2',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ ],+ },+ },+ );++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Document recipient update endpoint', () => {+ test('should block unauthorized access to document recipient update endpoint', async ({+ request,+ }) => {+ const { user: recipientUser } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/update`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipient: {+ id: recipient!.id,+ name: 'Updated recipient',+ },+ },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to document recipient update endpoint', async ({+ request,+ }) => {+ const { user: recipientUser } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/update`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipient: {+ id: recipient!.id,+ name: 'Updated recipient',+ },+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Document recipient update-many endpoint', () => {+ test('should block unauthorized access to document recipient update-many endpoint', async ({+ request,+ }) => {+ const { user: firstRecipient } = await seedUser();+ const { user: secondRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [firstRecipient, secondRecipient]);++ const firstDocumentRecipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: firstRecipient.email,+ },+ });++ const secondDocumentRecipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: secondRecipient.email,+ },+ });++ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/update-many`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipients: [+ {+ id: firstDocumentRecipient!.id,+ name: 'Updated first recipient',+ },+ {+ id: secondDocumentRecipient!.id,+ name: 'Updated second recipient',+ },+ ],+ },+ },+ );++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to document recipient update-many endpoint', async ({+ request,+ }) => {+ const { user: firstRecipient } = await seedUser();+ const { user: secondRecipient } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [firstRecipient, secondRecipient]);++ const firstDocumentRecipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: firstRecipient.email,+ },+ });++ const secondDocumentRecipient = await prisma.recipient.findFirst({+ where: {+ envelopeId: doc.id,+ email: secondRecipient.email,+ },+ });++ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/update-many`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ documentId: mapSecondaryIdToDocumentId(doc.secondaryId),+ recipients: [+ {+ id: firstDocumentRecipient!.id,+ name: 'Updated first recipient',+ },+ {+ id: secondDocumentRecipient!.id,+ name: 'Updated second recipient',+ },+ ],+ },+ },+ );++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Document recipient delete endpoint', () => {+ test('should block unauthorized access to document recipient delete endpoint', async ({+ request,+ }) => {+ const { user: recipientUser } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { recipientId: recipient!.id },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to document recipient delete endpoint', async ({+ request,+ }) => {+ const { user: recipientUser } = await seedUser();++ const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);++ const recipient = await prisma.recipient.findFirst({+ where: { envelopeId: doc.id },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { recipientId: recipient!.id },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });+ });++ test.describe('Template recipient GET endpoint', () => {+ test('should block unauthorized access to template recipient get endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const templateRecipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test wuth',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });++ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/${templateRecipient.id}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template recipient get endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const templateRecipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test wuth',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/create`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- documentId: doc.id,- recipient: {- name: 'Test',- email: '[email protected]',- role: RecipientRole.SIGNER,+ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/${templateRecipient.id}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },},- },- });+ );- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to document recipient create-many endpoint', async ({- request,- }) => {- const doc = await seedDraftDocument(userA, teamA.id, []);+ test.describe('Template recipient create endpoint', () => {+ test('should block unauthorized access to template recipient create endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const res = await request.post(- `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/create-many`,- {+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/create`, {headers: { Authorization: `Bearer ${tokenB}` },data: {- documentId: doc.id,- recipients: [- {- name: 'Test',- email: '[email protected]',- role: RecipientRole.SIGNER,- },- {- name: 'Test 2',- email: '[email protected]',- role: RecipientRole.SIGNER,- },- ],+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipient: {+ name: 'Test',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },},- },- );+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });- test('should block unauthorized access to document recipient update endpoint', async ({- request,- }) => {- const { user: recipientUser } = await seedUser();+ test('should allow authorized access to template recipient create endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/create`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipient: {+ name: 'Test',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ },+ });- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});+ });++ test.describe('Template recipient create-many endpoint', () => {+ test('should block unauthorized access to template recipient create-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/update`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- documentId: doc.id,- recipient: {- id: recipient!.id,- name: 'Updated recipient',+ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/create-many`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipients: [+ {+ name: 'Test first recipient',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ {+ name: 'Test second recipient',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ ],+ },},- },- });+ );- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });- test('should block unauthorized access to document recipient update-many endpoint', async ({- request,- }) => {- const { user: firstRecipient } = await seedUser();- const { user: secondRecipient } = await seedUser();+ test('should allow authorized access to template recipient create-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const doc = await seedDraftDocument(userA, teamA.id, [firstRecipient, secondRecipient]);+ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/create-many`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipients: [+ {+ name: 'Test first recipient',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ {+ name: 'Test second recipient',+ email: '[email protected]',+ role: RecipientRole.SIGNER,+ },+ ],+ },+ },+ );- const firstDocumentRecipient = await prisma.recipient.findFirst({- where: { documentId: doc.id, email: firstRecipient.email },+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});+ });- const secondDocumentRecipient = await prisma.recipient.findFirst({- where: { documentId: doc.id, email: secondRecipient.email },- });+ test.describe('Template recipient update endpoint', () => {+ test('should block unauthorized access to template recipient update endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });- const res = await request.post(- `${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/update-many`,- {+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/update`, {headers: { Authorization: `Bearer ${tokenB}` },data: {- documentId: doc.id,- recipients: [- {- id: firstDocumentRecipient!.id,- name: 'Updated first recipient',- },- {- id: secondDocumentRecipient!.id,- name: 'Updated second recipient',- },- ],+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipient: {+ id: recipient.id,+ name: 'Updated test name',+ },},- },- );+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });- test('should block unauthorized access to document recipient delete endpoint', async ({- request,- }) => {- const { user: recipientUser } = await seedUser();+ test('should allow authorized access to template recipient update endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const doc = await seedDraftDocument(userA, teamA.id, [recipientUser]);+ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ });- const recipient = await prisma.recipient.findFirst({- where: { documentId: doc.id },- });+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/update`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipient: {+ id: recipient.id,+ name: 'Updated test name',+ },+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/document/recipient/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { recipientId: recipient!.id },+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);});-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);});- test('should block unauthorized access to template recipient get endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const templateRecipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test wuth',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const res = await request.get(- `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/${templateRecipient.id}`,- {- headers: { Authorization: `Bearer ${tokenB}` },- },- );-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ test.describe('Template recipient update-many endpoint', () => {+ test('should block unauthorized access to template recipient update-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- test('should block unauthorized access to template recipient create endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ const recipients = await prisma.recipient.createManyAndReturn({+ data: [+ {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test 2',+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ ],+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/create`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- recipient: {- name: 'Test',- email: '[email protected]',- role: RecipientRole.SIGNER,+ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/update-many`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipients: [+ {+ id: recipients[0].id,+ name: 'Updated test first recipient name',+ },+ {+ id: recipients[1].id,+ name: 'Updated test second recipient name',+ },+ ],+ },},- },+ );++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ test('should allow authorized access to template recipient update-many endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- test('should block unauthorized access to template recipient create-many endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ const recipients = await prisma.recipient.createManyAndReturn({+ data: [+ {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test 2',+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ ],+ });- const res = await request.post(- `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/create-many`,- {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- recipients: [- {- name: 'Test first recipient',- email: '[email protected]',- role: RecipientRole.SIGNER,- },- {- name: 'Test second recipient',- email: '[email protected]',- role: RecipientRole.SIGNER,- },- ],+ const res = await request.post(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/update-many`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipients: [+ {+ id: recipients[0].id,+ name: 'Updated test first recipient name',+ },+ {+ id: recipients[1].id,+ name: 'Updated test second recipient name',+ },+ ],+ },},- },- );-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ );- test('should block unauthorized access to template recipient update endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);-- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });-- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/update`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- recipient: {- id: recipient.id,- name: 'Updated test name',- },- },- });-- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template recipient update-many endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template recipient delete endpoint', () => {+ test('should block unauthorized access to template recipient delete endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const recipients = await prisma.recipient.createManyAndReturn({- data: [- {- templateId: template.id,+ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,email: '[email protected]',name: 'Test',+ role: RecipientRole.SIGNER,token: nanoid(12),readStatus: ReadStatus.NOT_OPENED,sendStatus: SendStatus.NOT_SENT,signingStatus: SigningStatus.NOT_SIGNED,},- {- templateId: template.id,- email: '[email protected]',- name: 'Test 2',+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { recipientId: recipient.id },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);+ });++ test('should allow authorized access to template recipient delete endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ email: '[email protected]',+ name: 'Test',+ role: RecipientRole.SIGNER,token: nanoid(12),readStatus: ReadStatus.NOT_OPENED,sendStatus: SendStatus.NOT_SENT,signingStatus: SigningStatus.NOT_SIGNED,},- ],- });+ });- const res = await request.post(- `${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/update-many`,- {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- recipients: [- {- id: recipients[0].id,- name: 'Updated test first recipient name',- },- {- id: recipients[1].id,- name: 'Updated test second recipient name',- },- ],- },- },- );+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { recipientId: recipient.id },+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template recipient delete endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template list endpoint', () => {+ test('should block unauthorized access to template list endpoint', async ({ request }) => {+ await seedBlankTemplate(userA, teamA.id);- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- email: '[email protected]',- name: 'Test',- role: RecipientRole.SIGNER,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,- },- });+ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/recipient/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { recipientId: recipient.id },- });+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ const data = await res.json();+ expect(data.data.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(true);+ });- test('should block unauthorized access to template list endpoint', async ({ request }) => {- await seedBlankTemplate(userA, teamA.id);+ test('should allow authorized access to template list endpoint', async ({ request }) => {+ await seedBlankTemplate(userA, teamA.id);- const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template`, {- headers: { Authorization: `Bearer ${tokenB}` },- });+ const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ });- expect(res.ok()).toBeTruthy();- expect(res.status()).toBe(200);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);- const data = await res.json();- expect(data.data.every((doc: { userId: number }) => doc.userId !== userA.id)).toBe(true);+ const data = await res.json();+ expect(data.data.length).toBeGreaterThan(0);+ expect(data.data.every((doc: { userId: number }) => doc.userId === userA.id)).toBe(true);+ });});- test('should block unauthorized access to template get endpoint', async ({ request }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template GET endpoint', () => {+ test('should block unauthorized access to template get endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const res = await request.get(`${WEBAPP_BASE_URL}/api/v2-beta/template/${template.id}`, {- headers: { Authorization: `Bearer ${tokenB}` },+ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/${mapSecondaryIdToTemplateId(template.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenB}` },+ },+ );++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to template get endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const res = await request.get(+ `${WEBAPP_BASE_URL}/api/v2-beta/template/${mapSecondaryIdToTemplateId(template.secondaryId)}`,+ {+ headers: { Authorization: `Bearer ${tokenA}` },+ },+ );++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template update endpoint', async ({ request }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template update endpoint', () => {+ test('should block unauthorized access to template update endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/update`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/update`, {+ headers: { Authorization: `Bearer ${tokenB}` },data: {- title: 'Updated template title',- visibility: DocumentVisibility.MANAGER_AND_ABOVE,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ data: {+ title: 'Updated template title',+ visibility: DocumentVisibility.MANAGER_AND_ABOVE,+ },},- },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to template update endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/update`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ data: {+ title: 'Updated template title',+ visibility: DocumentVisibility.MANAGER_AND_ABOVE,+ },+ },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template duplicate endpoint', async ({ request }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template duplicate endpoint', () => {+ test('should block unauthorized access to template duplicate endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/duplicate`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/duplicate`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { templateId: template.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(500);+ test('should allow authorized access to template duplicate endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/duplicate`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template delete endpoint', async ({ request }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template delete endpoint', () => {+ test('should block unauthorized access to template delete endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { templateId: template.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(500);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(500);+ test('should allow authorized access to template delete endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template use endpoint', async ({ request }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template use endpoint', () => {+ test('should block unauthorized access to template use endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const { user: firstRecipientUser } = await seedUser();+ const { user: secondRecipientUser } = await seedUser();++ const updatedTemplate = await prisma.envelope.update({+ where: { id: template.id },+ data: {+ recipients: {+ create: [+ {+ name: firstRecipientUser.name || '',+ email: firstRecipientUser.email,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ {+ name: secondRecipientUser.name || '',+ email: secondRecipientUser.email,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ ],+ },+ },+ include: {+ recipients: true,+ },+ });++ const recipientAId = updatedTemplate.recipients.find(+ (recipient) => recipient.email === firstRecipientUser.email,+ )?.id;+ const recipientBId = updatedTemplate.recipients.find(+ (recipient) => recipient.email === secondRecipientUser.email,+ )?.id;- const { user: firstRecipientUser } = await seedUser();- const { user: secondRecipientUser } = await seedUser();+ if (!recipientAId || !recipientBId) {+ throw new Error('Recipient IDs not found');+ }- const updatedTemplate = await prisma.template.update({- where: { id: template.id },- data: {- recipients: {- create: [+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/use`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipients: [{- name: firstRecipientUser.name || '',+ id: recipientAId,+ name: firstRecipientUser.name,email: firstRecipientUser.email,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,+ role: RecipientRole.SIGNER,},{- name: secondRecipientUser.name || '',+ id: recipientBId,+ name: secondRecipientUser.name,email: secondRecipientUser.email,- token: nanoid(12),- readStatus: ReadStatus.NOT_OPENED,- sendStatus: SendStatus.NOT_SENT,- signingStatus: SigningStatus.NOT_SIGNED,+ role: RecipientRole.SIGNER,},],},- },- include: {- recipients: true,- },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- const recipientAId = updatedTemplate.recipients.find(- (recipient) => recipient.email === firstRecipientUser.email,- )?.id;- const recipientBId = updatedTemplate.recipients.find(- (recipient) => recipient.email === secondRecipientUser.email,- )?.id;+ test('should allow authorized access to template use endpoint', async ({ request }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- if (!recipientAId || !recipientBId) {- throw new Error('Recipient IDs not found');- }+ const { user: firstRecipientUser } = await seedUser();+ const { user: secondRecipientUser } = await seedUser();- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/use`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: {- templateId: template.id,- recipients: [- {- id: recipientAId,- name: firstRecipientUser.name,- email: firstRecipientUser.email,- role: RecipientRole.SIGNER,- },- {- id: recipientBId,- name: secondRecipientUser.name,- email: secondRecipientUser.email,- role: RecipientRole.SIGNER,+ const updatedTemplate = await prisma.envelope.update({+ where: { id: template.id },+ data: {+ recipients: {+ create: [+ {+ name: firstRecipientUser.name || '',+ email: firstRecipientUser.email,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ {+ name: secondRecipientUser.name || '',+ email: secondRecipientUser.email,+ token: nanoid(12),+ readStatus: ReadStatus.NOT_OPENED,+ sendStatus: SendStatus.NOT_SENT,+ signingStatus: SigningStatus.NOT_SIGNED,+ },+ ],},- ],- },- });+ },+ include: {+ recipients: true,+ },+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);- });+ const recipientAId = updatedTemplate.recipients.find(+ (recipient) => recipient.email === firstRecipientUser.email,+ )?.id;+ const recipientBId = updatedTemplate.recipients.find(+ (recipient) => recipient.email === secondRecipientUser.email,+ )?.id;- test('should block unauthorized access to template direct create endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ if (!recipientAId || !recipientBId) {+ throw new Error('Recipient IDs not found');+ }- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/create`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { templateId: template.id },- });+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/use`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: {+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),+ recipients: [+ {+ id: recipientAId,+ name: firstRecipientUser.name,+ email: firstRecipientUser.email,+ role: RecipientRole.SIGNER,+ },+ {+ id: recipientBId,+ name: secondRecipientUser.name,+ email: secondRecipientUser.email,+ role: RecipientRole.SIGNER,+ },+ ],+ },+ });- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template direct delete endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template direct create endpoint', () => {+ test('should block unauthorized access to template direct create endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- name: 'Test',- email: '[email protected]',- token: nanoid(12),- },- });+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/create`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });- await prisma.templateDirectLink.create({- data: {- templateId: template.id,- enabled: true,- token: nanoid(12),- directTemplateRecipientId: recipient.id,- },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/delete`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { templateId: template.id },- });+ test('should allow authorized access to template direct create endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/create`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template direct toggle endpoint', async ({- request,- }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template direct delete endpoint', () => {+ test('should block unauthorized access to template direct delete endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);- const recipient = await prisma.recipient.create({- data: {- templateId: template.id,- name: 'Test',- email: '[email protected]',- token: nanoid(12),- },- });+ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ name: 'Test',+ email: '[email protected]',+ token: nanoid(12),+ },+ });- await prisma.templateDirectLink.create({- data: {- templateId: template.id,- enabled: true,- token: nanoid(12),- directTemplateRecipientId: recipient.id,- },- });+ await prisma.templateDirectLink.create({+ data: {+ envelopeId: template.id,+ enabled: true,+ token: nanoid(12),+ directTemplateRecipientId: recipient.id,+ },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/toggle`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { templateId: template.id, enabled: false },+ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/delete`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });++ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to template direct delete endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ name: 'Test',+ email: '[email protected]',+ token: nanoid(12),+ },+ });++ await prisma.templateDirectLink.create({+ data: {+ envelopeId: template.id,+ enabled: true,+ token: nanoid(12),+ directTemplateRecipientId: recipient.id,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/delete`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId) },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});- test('should block unauthorized access to template move endpoint', async ({ request }) => {- const template = await seedBlankTemplate(userA, teamA.id);+ test.describe('Template direct toggle endpoint', () => {+ test('should block unauthorized access to template direct toggle endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ name: 'Test',+ email: '[email protected]',+ token: nanoid(12),+ },+ });++ await prisma.templateDirectLink.create({+ data: {+ envelopeId: template.id,+ enabled: true,+ token: nanoid(12),+ directTemplateRecipientId: recipient.id,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/toggle`, {+ headers: { Authorization: `Bearer ${tokenB}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId), enabled: false },+ });- const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/move`, {- headers: { Authorization: `Bearer ${tokenB}` },- data: { templateId: template.id, teamId: teamB.id },+ expect(res.ok()).toBeFalsy();+ expect(res.status()).toBe(404);});- expect(res.ok()).toBeFalsy();- expect(res.status()).toBe(404);+ test('should allow authorized access to template direct toggle endpoint', async ({+ request,+ }) => {+ const template = await seedBlankTemplate(userA, teamA.id);++ const recipient = await prisma.recipient.create({+ data: {+ envelopeId: template.id,+ name: 'Test',+ email: '[email protected]',+ token: nanoid(12),+ },+ });++ await prisma.templateDirectLink.create({+ data: {+ envelopeId: template.id,+ enabled: true,+ token: nanoid(12),+ directTemplateRecipientId: recipient.id,+ },+ });++ const res = await request.post(`${WEBAPP_BASE_URL}/api/v2-beta/template/direct/toggle`, {+ headers: { Authorization: `Bearer ${tokenA}` },+ data: { templateId: mapSecondaryIdToTemplateId(template.secondaryId), enabled: false },+ });++ expect(res.ok()).toBeTruthy();+ expect(res.status()).toBe(200);+ });});});diff --git a/packages/app-tests/e2e/document-auth/access-auth.spec.ts b/packages/app-tests/e2e/document-auth/access-auth.spec.tsindex 87783a1cf..c8a643e36 100644--- a/packages/app-tests/e2e/document-auth/access-auth.spec.ts+++ b/packages/app-tests/e2e/document-auth/access-auth.spec.ts@@ -19,7 +19,7 @@ test('[DOCUMENT_AUTH]: should grant access when not required', async ({ page })const recipients = await prisma.recipient.findMany({where: {- documentId: document.id,+ envelopeId: document.id,},});@@ -52,7 +52,7 @@ test('[DOCUMENT_AUTH]: should allow or deny access when required', async ({ pageconst recipients = await prisma.recipient.findMany({where: {- documentId: document.id,+ envelopeId: document.id,},});diff --git a/packages/app-tests/e2e/document-auth/next-recipient-dictation.spec.ts b/packages/app-tests/e2e/document-auth/next-recipient-dictation.spec.tsindex a925388df..e63b0ed47 100644--- a/packages/app-tests/e2e/document-auth/next-recipient-dictation.spec.ts+++ b/packages/app-tests/e2e/document-auth/next-recipient-dictation.spec.ts@@ -85,7 +85,7 @@ test('[NEXT_RECIPIENT_DICTATION]: should allow updating next recipient when dictawait page.waitForURL(`${signUrl}/complete`);// Verify document and recipient states- const updatedDocument = await prisma.document.findUniqueOrThrow({+ const updatedDocument = await prisma.envelope.findUniqueOrThrow({where: { id: document.id },include: {recipients: {@@ -172,7 +172,7 @@ test('[NEXT_RECIPIENT_DICTATION]: should not show dictation UI when disabled', a// Verify document and recipient states- const updatedDocument = await prisma.document.findUniqueOrThrow({+ const updatedDocument = await prisma.envelope.findUniqueOrThrow({where: { id: document.id },include: {recipients: {@@ -259,7 +259,7 @@ test('[NEXT_RECIPIENT_DICTATION]: should work with parallel signing flow', async// Verify final document and recipient statesawait expect(async () => {- const updatedDocument = await prisma.document.findUniqueOrThrow({+ const updatedDocument = await prisma.envelope.findUniqueOrThrow({where: { id: document.id },include: {recipients: {@@ -295,19 +295,13 @@ test('[NEXT_RECIPIENT_DICTATION]: should allow assistant to dictate next signer'{ signingOrder: 2, role: RecipientRole.SIGNER },{ signingOrder: 3, role: RecipientRole.SIGNER },],- updateDocumentOptions: {- documentMeta: {- upsert: {- create: {- allowDictateNextSigner: true,- signingOrder: DocumentSigningOrder.SEQUENTIAL,- },- update: {- allowDictateNextSigner: true,- signingOrder: DocumentSigningOrder.SEQUENTIAL,- },- },- },+ });++ await prisma.documentMeta.update({+ where: { id: document.documentMetaId },+ data: {+ allowDictateNextSigner: true,+ signingOrder: DocumentSigningOrder.SEQUENTIAL,},});@@ -362,7 +356,7 @@ test('[NEXT_RECIPIENT_DICTATION]: should allow assistant to dictate next signer'// Verify document and recipient statesawait expect(async () => {- const updatedDocument = await prisma.document.findUniqueOrThrow({+ const updatedDocument = await prisma.envelope.findUniqueOrThrow({where: { id: document.id },include: {recipients: {diff --git a/packages/app-tests/e2e/document-flow/autosave-fields-step.spec.ts b/packages/app-tests/e2e/document-flow/autosave-fields-step.spec.tsindex 73859de20..48e26c954 100644--- a/packages/app-tests/e2e/document-flow/autosave-fields-step.spec.ts+++ b/packages/app-tests/e2e/document-flow/autosave-fields-step.spec.ts@@ -1,7 +1,7 @@import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';-import { getFieldsForDocument } from '@documenso/lib/server-only/field/get-fields-for-document';+import { prisma } from '@documenso/prisma';import { seedBlankDocument } from '@documenso/prisma/seed/documents';import { seedUser } from '@documenso/prisma/seed/users';@@ -14,7 +14,7 @@ const setupDocumentAndNavigateToFieldsStep = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/documents/${document.id}/edit`,+ redirectPath: `/t/${team.url}/documents/${document.id}/edit`,});await page.getByRole('button', { name: 'Continue' }).click();@@ -84,10 +84,8 @@ test.describe('AutoSave Fields Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedFields = await getFieldsForDocument({- documentId: document.id,- userId: user.id,- teamId: team.id,+ const retrievedFields = await getFieldsForEnvelope({+ envelopeId: document.id,});expect(retrievedFields.length).toBe(3);@@ -149,10 +147,8 @@ test.describe('AutoSave Fields Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedFields = await getFieldsForDocument({- documentId: document.id,- userId: user.id,- teamId: team.id,+ const retrievedFields = await getFieldsForEnvelope({+ envelopeId: document.id,});expect(retrievedFields.length).toBe(2);@@ -213,10 +209,8 @@ test.describe('AutoSave Fields Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedFields = await getFieldsForDocument({- documentId: document.id,- userId: user.id,- teamId: team.id,+ const retrievedFields = await getFieldsForEnvelope({+ envelopeId: document.id,});expect(retrievedFields.length).toBe(4);@@ -260,10 +254,8 @@ test.describe('AutoSave Fields Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedFields = await getFieldsForDocument({- documentId: document.id,- userId: user.id,- teamId: team.id,+ const retrievedFields = await getFieldsForEnvelope({+ envelopeId: document.id,});expect(retrievedFields.length).toBe(2);@@ -291,3 +283,28 @@ test.describe('AutoSave Fields Step', () => {}).toPass();});});++const getFieldsForEnvelope = async ({ envelopeId }: { envelopeId: string }) => {+ const fields = await prisma.field.findMany({+ where: {+ envelope: {+ id: envelopeId,+ },+ },+ include: {+ signature: true,+ recipient: {+ select: {+ name: true,+ email: true,+ signingStatus: true,+ },+ },+ },+ orderBy: {+ id: 'asc',+ },+ });++ return fields;+};diff --git a/packages/app-tests/e2e/document-flow/autosave-settings-step.spec.ts b/packages/app-tests/e2e/document-flow/autosave-settings-step.spec.tsindex bd999b79b..9f267e448 100644--- a/packages/app-tests/e2e/document-flow/autosave-settings-step.spec.ts+++ b/packages/app-tests/e2e/document-flow/autosave-settings-step.spec.ts@@ -1,7 +1,8 @@import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';+import { EnvelopeType } from '@prisma/client';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { seedBlankDocument } from '@documenso/prisma/seed/documents';import { seedUser } from '@documenso/prisma/seed/users';@@ -17,7 +18,7 @@ const setupDocument = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/documents/${document.id}/edit`,+ redirectPath: `/t/${team.url}/documents/${document.id}/edit`,});return { user, team, document };@@ -41,8 +42,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -63,8 +68,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -85,8 +94,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -107,8 +120,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -129,8 +146,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -152,8 +173,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -173,8 +198,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -195,8 +224,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -227,8 +260,12 @@ test.describe('AutoSave Settings Step', () => {await triggerAutosave(page);await expect(async () => {- const retrieved = await getDocumentById({- documentId: document.id,+ const retrieved = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});diff --git a/packages/app-tests/e2e/document-flow/autosave-signers-step.spec.ts b/packages/app-tests/e2e/document-flow/autosave-signers-step.spec.tsindex 49836bfb7..6b6bbf3e6 100644--- a/packages/app-tests/e2e/document-flow/autosave-signers-step.spec.ts+++ b/packages/app-tests/e2e/document-flow/autosave-signers-step.spec.ts@@ -1,8 +1,10 @@import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';+import { EnvelopeType } from '@prisma/client';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { seedBlankDocument } from '@documenso/prisma/seed/documents';import { seedUser } from '@documenso/prisma/seed/users';@@ -17,7 +19,7 @@ const setupDocumentAndNavigateToSignersStep = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/documents/${document.id}/edit`,+ redirectPath: `/t/${team.url}/documents/${document.id}/edit`,});await page.getByRole('button', { name: 'Continue' }).click();@@ -47,7 +49,7 @@ test.describe('AutoSave Signers Step', () => {await expect(async () => {const retrievedRecipients = await getRecipientsForDocument({- documentId: document.id,+ documentId: mapSecondaryIdToDocumentId(document.secondaryId),userId: user.id,teamId: team.id,});@@ -71,7 +73,7 @@ test.describe('AutoSave Signers Step', () => {await expect(async () => {const retrievedRecipients = await getRecipientsForDocument({- documentId: document.id,+ documentId: mapSecondaryIdToDocumentId(document.secondaryId),userId: user.id,teamId: team.id,});@@ -99,7 +101,7 @@ test.describe('AutoSave Signers Step', () => {await expect(async () => {const retrievedRecipients = await getRecipientsForDocument({- documentId: document.id,+ documentId: mapSecondaryIdToDocumentId(document.secondaryId),userId: user.id,teamId: team.id,});@@ -145,14 +147,18 @@ test.describe('AutoSave Signers Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedDocumentData = await getDocumentById({- documentId: document.id,+ const retrievedDocumentData = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});const retrievedRecipients = await getRecipientsForDocument({- documentId: document.id,+ documentId: mapSecondaryIdToDocumentId(document.secondaryId),userId: user.id,teamId: team.id,});diff --git a/packages/app-tests/e2e/document-flow/autosave-subject-step.spec.ts b/packages/app-tests/e2e/document-flow/autosave-subject-step.spec.tsindex 3ba3ee5d9..64e9a41bf 100644--- a/packages/app-tests/e2e/document-flow/autosave-subject-step.spec.ts+++ b/packages/app-tests/e2e/document-flow/autosave-subject-step.spec.ts@@ -1,7 +1,8 @@import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';+import { EnvelopeType } from '@prisma/client';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { seedBlankDocument } from '@documenso/prisma/seed/documents';import { seedUser } from '@documenso/prisma/seed/users';@@ -16,7 +17,7 @@ export const setupDocumentAndNavigateToSubjectStep = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/documents/${document.id}/edit`,+ redirectPath: `/t/${team.url}/documents/${document.id}/edit`,});await page.getByRole('button', { name: 'Continue' }).click();@@ -59,8 +60,12 @@ test.describe('AutoSave Subject Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedDocumentData = await getDocumentById({- documentId: document.id,+ const retrievedDocumentData = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -81,8 +86,12 @@ test.describe('AutoSave Subject Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedDocumentData = await getDocumentById({- documentId: document.id,+ const retrievedDocumentData = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -105,8 +114,12 @@ test.describe('AutoSave Subject Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedDocumentData = await getDocumentById({- documentId: document.id,+ const retrievedDocumentData = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});@@ -156,8 +169,12 @@ test.describe('AutoSave Subject Step', () => {await triggerAutosave(page);await expect(async () => {- const retrievedDocumentData = await getDocumentById({- documentId: document.id,+ const retrievedDocumentData = await getEnvelopeById({+ id: {+ type: 'envelopeId',+ id: document.id,+ },+ type: EnvelopeType.DOCUMENT,userId: user.id,teamId: team.id,});diff --git a/packages/app-tests/e2e/document-flow/duplicate-recipients-simple.spec.ts b/packages/app-tests/e2e/document-flow/duplicate-recipients-simple.spec.tsindex 02674af1d..ea0bfd43e 100644--- a/packages/app-tests/e2e/document-flow/duplicate-recipients-simple.spec.ts+++ b/packages/app-tests/e2e/document-flow/duplicate-recipients-simple.spec.ts@@ -50,7 +50,7 @@ test('[DOCUMENT_FLOW]: Simple duplicate recipients test', async ({ page }) => {await page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));await expect(page.getByRole('link', { name: document.title })).toBeVisible();});diff --git a/packages/app-tests/e2e/document-flow/duplicate-recipients.spec.ts b/packages/app-tests/e2e/document-flow/duplicate-recipients.spec.tsindex 0f23d6ac7..0811db244 100644--- a/packages/app-tests/e2e/document-flow/duplicate-recipients.spec.ts+++ b/packages/app-tests/e2e/document-flow/duplicate-recipients.spec.ts@@ -69,7 +69,7 @@ const completeDocumentFlowWithDuplicateRecipients = async (options: {await page.getByRole('button', { name: 'Send' }).click();// Wait for send confirmation- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(`/t/${team.url}/documents`);await expect(page.getByRole('link', { name: document.title })).toBeVisible();};@@ -157,7 +157,7 @@ test.describe('[DOCUMENT_FLOW]: Duplicate Recipients', () => {await page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));await expect(page.getByRole('link', { name: document.title })).toBeVisible();});@@ -188,7 +188,7 @@ test.describe('[DOCUMENT_FLOW]: Duplicate Recipients', () => {const recipients = await prisma.recipient.findMany({where: {- documentId: document.id,+ envelopeId: document.id,},});@@ -286,7 +286,7 @@ test.describe('[DOCUMENT_FLOW]: Duplicate Recipients', () => {await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));await expect(page.getByRole('link', { name: document.title })).toBeVisible();});@@ -348,7 +348,7 @@ test.describe('[DOCUMENT_FLOW]: Duplicate Recipients', () => {await page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));await expect(page.getByRole('link', { name: document.title })).toBeVisible();});diff --git a/packages/app-tests/e2e/document-flow/stepper-component.spec.ts b/packages/app-tests/e2e/document-flow/stepper-component.spec.tsindex 06251175e..1192492f0 100644--- a/packages/app-tests/e2e/document-flow/stepper-component.spec.ts+++ b/packages/app-tests/e2e/document-flow/stepper-component.spec.ts@@ -9,7 +9,6 @@ import {import { DateTime } from 'luxon';import path from 'node:path';-import { getRecipientByEmail } from '@documenso/lib/server-only/recipient/get-recipient-by-email';import { prisma } from '@documenso/prisma';import {seedBlankDocument,@@ -23,7 +22,7 @@ import { signSignaturePad } from '../fixtures/signature';// Can't use the function in server-only/document due to it indirectly using// require imports.const getDocumentByToken = async (token: string) => {- return await prisma.document.findFirstOrThrow({+ return await prisma.envelope.findFirstOrThrow({where: {recipients: {some: {@@ -59,7 +58,7 @@ test('[DOCUMENT_FLOW]: should be able to upload a PDF document', async ({ page }await fileChooser.setFiles(path.join(__dirname, '../../../../assets/example.pdf'));// Wait to be redirected to the edit page.- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));});test('[DOCUMENT_FLOW]: should be able to create a document', async ({ page }) => {@@ -115,7 +114,7 @@ test('[DOCUMENT_FLOW]: should be able to create a document', async ({ page }) =>await page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));// Assert document was createdawait expect(page.getByRole('link', { name: documentTitle })).toBeVisible();@@ -200,7 +199,7 @@ test('[DOCUMENT_FLOW]: should be able to create a document with multiple recipieawait page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));// Assert document was createdawait expect(page.getByRole('link', { name: documentTitle })).toBeVisible();@@ -298,7 +297,7 @@ test('[DOCUMENT_FLOW]: should be able to create a document with multiple recipieawait page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));// Assert document was createdawait expect(page.getByRole('link', { name: 'Test Title' })).toBeVisible();@@ -437,14 +436,18 @@ test('[DOCUMENT_FLOW]: should be able to create, send with redirect url, sign a// Assert document was createdawait expect(page.getByRole('link', { name: documentTitle })).toBeVisible();await page.getByRole('link', { name: documentTitle }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));const url = page.url().split('/');const documentId = url[url.length - 1];- const { token } = await getRecipientByEmail({- email: '[email protected]',- documentId: Number(documentId),+ const { token } = await prisma.recipient.findFirstOrThrow({+ where: {+ envelope: {+ id: documentId,+ },+ email: '[email protected]',+ },});await page.goto(`/sign/${token}`);@@ -500,7 +503,7 @@ test('[DOCUMENT_FLOW]: should be able to sign a document with custom date', asynrecipient: {email: '[email protected]',},- documentId: Number(document.id),+ envelopeId: document.id,},});@@ -583,11 +586,11 @@ test('[DOCUMENT_FLOW]: should be able to create and sign a document with 3 recipawait page.waitForTimeout(2500);await page.getByRole('button', { name: 'Send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));await expect(page.getByRole('link', { name: documentTitle })).toBeVisible();- const createdDocument = await prisma.document.findFirst({+ const createdDocument = await prisma.envelope.findFirst({where: { title: documentTitle },include: { recipients: true },});@@ -602,13 +605,13 @@ test('[DOCUMENT_FLOW]: should be able to create and sign a document with 3 recipexpect(recipient).not.toBeNull();const fields = await prisma.field.findMany({- where: { recipientId: recipient?.id, documentId: createdDocument?.id },+ where: { recipientId: recipient?.id, envelopeId: createdDocument?.id },});const recipientField = fields[0];if (i > 0) {const previousRecipient = await prisma.recipient.findFirst({- where: { email: `user${i}@example.com`, documentId: createdDocument?.id },+ where: { email: `user${i}@example.com`, envelopeId: createdDocument?.id },});expect(previousRecipient?.signingStatus).toBe(SigningStatus.SIGNED);@@ -636,7 +639,7 @@ test('[DOCUMENT_FLOW]: should be able to create and sign a document with 3 recip// Wait for the document to be signed.await page.waitForTimeout(10000);- const finalDocument = await prisma.document.findFirst({+ const finalDocument = await prisma.envelope.findFirst({where: { id: createdDocument?.id },});@@ -648,18 +651,20 @@ test('[DOCUMENT_FLOW]: should prevent out-of-order signing in sequential mode',}) => {const { user, team } = await seedUser();- const { recipients } = await seedPendingDocumentWithFullFields({+ const { document, recipients } = await seedPendingDocumentWithFullFields({teamId: team.id,owner: user,fields: [FieldType.SIGNATURE],recipientsCreateOptions: [{ signingOrder: 1 }, { signingOrder: 2 }, { signingOrder: 3 }],- updateDocumentOptions: {- documentMeta: {- create: {- signingOrder: DocumentSigningOrder.SEQUENTIAL,- },- },+ });++ await prisma.documentMeta.update({+ where: {+ id: document.documentMetaId,+ },+ data: {+ signingOrder: DocumentSigningOrder.SEQUENTIAL,},});diff --git a/packages/app-tests/e2e/documents/test-unauthorized-document-access.spec.ts b/packages/app-tests/e2e/documents/test-unauthorized-document-access.spec.tsindex b574025b2..1570c8c36 100644--- a/packages/app-tests/e2e/documents/test-unauthorized-document-access.spec.ts+++ b/packages/app-tests/e2e/documents/test-unauthorized-document-access.spec.ts@@ -28,7 +28,7 @@ test.describe('Unauthorized Access to Documents', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/documents/${document.id}`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});test('should block unauthorized access to the draft document edit page', async ({ page }) => {@@ -44,7 +44,7 @@ test.describe('Unauthorized Access to Documents', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/documents/${document.id}/edit`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});test('should block unauthorized access to the pending document page', async ({ page }) => {@@ -61,7 +61,7 @@ test.describe('Unauthorized Access to Documents', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/documents/${document.id}`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});test('should block unauthorized access to pending document edit page', async ({ page }) => {@@ -78,7 +78,7 @@ test.describe('Unauthorized Access to Documents', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/documents/${document.id}/edit`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});test('should block unauthorized access to completed document page', async ({ page }) => {@@ -95,6 +95,6 @@ test.describe('Unauthorized Access to Documents', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/documents/${document.id}`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});});diff --git a/packages/app-tests/e2e/features/include-document-certificate.spec.ts b/packages/app-tests/e2e/features/include-document-certificate.spec.tsindex b447b09c2..e1ab6f915 100644--- a/packages/app-tests/e2e/features/include-document-certificate.spec.ts+++ b/packages/app-tests/e2e/features/include-document-certificate.spec.ts@@ -1,6 +1,6 @@+import { PDFDocument } from '@cantoo/pdf-lib';import { expect, test } from '@playwright/test';import { DocumentStatus, FieldType } from '@prisma/client';-import { PDFDocument } from 'pdf-lib';import { getDocumentByToken } from '@documenso/lib/server-only/document/get-document-by-token';import { getFile } from '@documenso/lib/universal/upload/get-file';@@ -28,7 +28,9 @@ test.describe('Signing Certificate Tests', () => {const documentData = await prisma.documentData.findFirstOrThrow({where: {- id: document.documentDataId,+ envelopeItem: {+ envelopeId: document.id,+ },},}).then(async (data) => getFile(data));@@ -65,12 +67,21 @@ test.describe('Signing Certificate Tests', () => {await page.waitForTimeout(2500);// Get the completed document- const completedDocument = await prisma.document.findFirstOrThrow({+ const completedDocument = await prisma.envelope.findFirstOrThrow({where: { id: document.id },- include: { documentData: true },+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ },});- const completedDocumentData = await getFile(completedDocument.documentData);+ // Todo: Envelopes+ const firstDocumentData = completedDocument.envelopeItems[0].documentData;++ const completedDocumentData = await getFile(firstDocumentData);// Load the PDF and check number of pagesconst pdfDoc = await PDFDocument.load(completedDocumentData);@@ -110,7 +121,9 @@ test.describe('Signing Certificate Tests', () => {const documentData = await prisma.documentData.findFirstOrThrow({where: {- id: document.documentDataId,+ envelopeItem: {+ envelopeId: document.id,+ },},}).then(async (data) => getFile(data));@@ -145,12 +158,21 @@ test.describe('Signing Certificate Tests', () => {await page.waitForTimeout(2500);// Get the completed document- const completedDocument = await prisma.document.findFirstOrThrow({+ const completedDocument = await prisma.envelope.findFirstOrThrow({where: { id: document.id },- include: { documentData: true },+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ },});- const completedDocumentData = await getFile(completedDocument.documentData);+ // Todo: Envelopes+ const firstDocumentData = completedDocument.envelopeItems[0].documentData;++ const completedDocumentData = await getFile(firstDocumentData);// Load the PDF and check number of pagesconst completedPdf = await PDFDocument.load(completedDocumentData);@@ -190,7 +212,9 @@ test.describe('Signing Certificate Tests', () => {const documentData = await prisma.documentData.findFirstOrThrow({where: {- id: document.documentDataId,+ envelopeItem: {+ envelopeId: document.id,+ },},}).then(async (data) => getFile(data));@@ -225,12 +249,18 @@ test.describe('Signing Certificate Tests', () => {await page.waitForTimeout(2500);// Get the completed document- const completedDocument = await prisma.document.findFirstOrThrow({+ const completedDocument = await prisma.envelope.findFirstOrThrow({where: { id: document.id },- include: { documentData: true },+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ },});- const completedDocumentData = await getFile(completedDocument.documentData);+ const completedDocumentData = await getFile(completedDocument.envelopeItems[0].documentData);// Load the PDF and check number of pagesconst completedPdf = await PDFDocument.load(completedDocumentData);diff --git a/packages/app-tests/e2e/folders/team-account-folders.spec.ts b/packages/app-tests/e2e/folders/team-account-folders.spec.tsindex 281848adb..390c880f8 100644--- a/packages/app-tests/e2e/folders/team-account-folders.spec.ts+++ b/packages/app-tests/e2e/folders/team-account-folders.spec.ts@@ -44,12 +44,6 @@ test('[TEAMS]: can create document folder', async ({ page }) => {test('[TEAMS]: can create document subfolder within a document folder', async ({ page }) => {const { team, teamOwner } = await seedTeamDocuments();- await apiSignin({- page,- email: teamOwner.email,- redirectPath: `/t/${team.url}`,- });-const teamFolder = await seedBlankFolder(teamOwner, team.id, {createFolderOptions: {name: 'Team Folder',@@ -57,7 +51,11 @@ test('[TEAMS]: can create document subfolder within a document folder', async ({},});- await page.goto(`/t/${team.url}/documents/f/${teamFolder.id}`);+ await apiSignin({+ page,+ email: teamOwner.email,+ redirectPath: `/t/${team.url}/documents/f/${teamFolder.id}`,+ });await page.getByTestId('folder-create-button').click();@@ -383,12 +381,10 @@ test('[TEAMS]: can create a template inside a template folder', async ({ page })await page.waitForTimeout(3000);- await page.getByRole('button', { name: 'Create' }).click();-- await page.waitForTimeout(1000);-+ // Expect redirect.await expect(page.getByText('documenso-supporter-pledge.pdf')).toBeVisible();+ // Return to folder and verify file is visible.await page.goto(`/t/${team.url}/templates/f/${folder.id}`);await expect(page.getByText('documenso-supporter-pledge.pdf')).toBeVisible();});diff --git a/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts b/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.tsindex f577ab3e1..795fec9ff 100644--- a/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts+++ b/packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts@@ -96,7 +96,7 @@ test('[ORGANISATIONS]: manage document preferences', async ({ page }) => {const documentMeta = await prisma.documentMeta.findFirstOrThrow({where: {- documentId: document.id,+ id: document.documentMetaId,},});@@ -272,7 +272,7 @@ test('[ORGANISATIONS]: manage email preferences', async ({ page }) => {const teamOverrideDocumentMeta = await prisma.documentMeta.findFirstOrThrow({where: {- documentId: teamOverrideDocument.id,+ id: teamOverrideDocument.documentMetaId,},});@@ -317,7 +317,7 @@ test('[ORGANISATIONS]: manage email preferences', async ({ page }) => {const documentMeta = await prisma.documentMeta.findFirstOrThrow({where: {- documentId: document.id,+ id: document.documentMetaId,},});diff --git a/packages/app-tests/e2e/teams/search-documents.spec.ts b/packages/app-tests/e2e/teams/search-documents.spec.tsindex feda585d3..d878c6988 100644--- a/packages/app-tests/e2e/teams/search-documents.spec.ts+++ b/packages/app-tests/e2e/teams/search-documents.spec.ts@@ -146,6 +146,7 @@ test('[TEAMS]: search does not reveal documents from other teams', async ({ pageredirectPath: `/t/${teamA.url}/documents`,});+ await page.waitForTimeout(100);await page.getByPlaceholder('Search documents...').fill('Unique');await page.waitForURL(/query=Unique/);diff --git a/packages/app-tests/e2e/teams/team-signature-settings.spec.ts b/packages/app-tests/e2e/teams/team-signature-settings.spec.tsindex bebf91371..5af05f6e4 100644--- a/packages/app-tests/e2e/teams/team-signature-settings.spec.ts+++ b/packages/app-tests/e2e/teams/team-signature-settings.spec.ts@@ -1,5 +1,9 @@import { expect, test } from '@playwright/test';+import {+ mapSecondaryIdToDocumentId,+ mapSecondaryIdToTemplateId,+} from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import {seedTeamDocumentWithMeta,@@ -21,7 +25,9 @@ test('[TEAMS]: check that default team signature settings are all enabled', asynconst document = await seedTeamDocumentWithMeta(team);// Create a document and check the settings- await page.goto(`/t/${team.url}/documents/${document.id}/edit`);+ await page.goto(+ `/t/${team.url}/documents/${mapSecondaryIdToDocumentId(document.secondaryId)}/edit`,+ );// Verify that the settings matchawait page.getByRole('button', { name: 'Advanced Options' }).click();@@ -154,7 +160,7 @@ test('[TEAMS]: check signature modes work for templates', async ({ page }) => {const template = await seedTeamTemplateWithMeta(team);- await page.goto(`/t/${team.url}/templates/${template.id}`);+ await page.goto(`/t/${team.url}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}`);await page.getByRole('button', { name: 'Use' }).click();// Check the send document checkbox to true@@ -162,9 +168,10 @@ test('[TEAMS]: check signature modes work for templates', async ({ page }) => {await page.getByRole('button', { name: 'Create and send' }).click();await page.waitForTimeout(1000);- const document = await prisma.document.findFirst({+ const document = await prisma.envelope.findFirst({where: {- templateId: template.id,+ // Created from template+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),},include: {documentMeta: true,diff --git a/packages/app-tests/e2e/templates-flow/duplicate-recipients.spec.ts b/packages/app-tests/e2e/templates-flow/duplicate-recipients.spec.tsindex 98056ab82..7a93e3d21 100644--- a/packages/app-tests/e2e/templates-flow/duplicate-recipients.spec.ts+++ b/packages/app-tests/e2e/templates-flow/duplicate-recipients.spec.ts@@ -1,5 +1,5 @@import { type Page, expect, test } from '@playwright/test';-import type { Team, Template } from '@prisma/client';+import type { Envelope, Team } from '@prisma/client';import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';import { prisma } from '@documenso/prisma';@@ -14,7 +14,7 @@ import { apiSignin } from '../fixtures/authentication';const completeTemplateFlowWithDuplicateRecipients = async (options: {page: Page;team: Team;- template: Template;+ template: Envelope;}) => {const { page, team, template } = options;// Step 1: Settings - Continue with defaults@@ -131,20 +131,20 @@ test.describe('[TEMPLATE_FLOW]: Duplicate Recipients', () => {// Create documentawait page.getByRole('button', { name: 'Create and send' }).click();- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));// Get the document ID from URL for database queriesconst url = page.url();- const documentIdMatch = url.match(/\/documents\/(\d+)/);+ const documentIdMatch = url.match(/\/documents\/envelope_(.*)/);- const documentId = documentIdMatch ? parseInt(documentIdMatch[1]) : null;+ const envelopeId = documentIdMatch ? documentIdMatch[1] : null;- expect(documentId).not.toBeNull();+ expect(envelopeId).not.toBeNull();// Get recipients directly from databaseconst recipients = await prisma.recipient.findMany({where: {- documentId: documentId!,+ envelopeId: `envelope_${envelopeId}`,},});diff --git a/packages/app-tests/e2e/templates-flow/template-autosave-fields-step.spec.ts b/packages/app-tests/e2e/templates-flow/template-autosave-fields-step.spec.tsindex 0680d3e40..e54a0ddf5 100644--- a/packages/app-tests/e2e/templates-flow/template-autosave-fields-step.spec.ts+++ b/packages/app-tests/e2e/templates-flow/template-autosave-fields-step.spec.ts@@ -2,6 +2,7 @@ import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';import { seedBlankTemplate } from '@documenso/prisma/seed/templates';import { seedUser } from '@documenso/prisma/seed/users';@@ -14,7 +15,7 @@ const setupTemplateAndNavigateToFieldsStep = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/templates/${template.id}/edit`,+ redirectPath: `/t/${team.url}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/edit`,});await page.getByRole('button', { name: 'Continue' }).click();@@ -85,7 +86,10 @@ test.describe('AutoSave Fields Step', () => {await expect(async () => {const retrievedFields = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -152,7 +156,10 @@ test.describe('AutoSave Fields Step', () => {await expect(async () => {const retrievedFields = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -218,7 +225,11 @@ test.describe('AutoSave Fields Step', () => {await expect(async () => {const retrievedFields = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },+userId: user.id,teamId: team.id,});@@ -270,7 +281,10 @@ test.describe('AutoSave Fields Step', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});diff --git a/packages/app-tests/e2e/templates-flow/template-autosave-settings-step.spec.ts b/packages/app-tests/e2e/templates-flow/template-autosave-settings-step.spec.tsindex 620fb93db..a9540aab8 100644--- a/packages/app-tests/e2e/templates-flow/template-autosave-settings-step.spec.ts+++ b/packages/app-tests/e2e/templates-flow/template-autosave-settings-step.spec.ts@@ -2,6 +2,7 @@ import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';import { seedBlankTemplate } from '@documenso/prisma/seed/templates';import { seedUser } from '@documenso/prisma/seed/users';@@ -16,7 +17,7 @@ const setupTemplate = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/templates/${template.id}/edit`,+ redirectPath: `/t/${team.url}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/edit`,});return { user, team, template };@@ -41,7 +42,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -65,7 +69,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -87,7 +94,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -109,7 +119,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -131,7 +144,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -154,7 +170,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -175,7 +194,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -197,7 +219,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});@@ -229,7 +254,10 @@ test.describe('AutoSave Settings Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});diff --git a/packages/app-tests/e2e/templates-flow/template-autosave-signers-step.spec.ts b/packages/app-tests/e2e/templates-flow/template-autosave-signers-step.spec.tsindex 943b6834f..345e09834 100644--- a/packages/app-tests/e2e/templates-flow/template-autosave-signers-step.spec.ts+++ b/packages/app-tests/e2e/templates-flow/template-autosave-signers-step.spec.ts@@ -1,8 +1,11 @@import type { Page } from '@playwright/test';import { expect, test } from '@playwright/test';+import { EnvelopeType } from '@prisma/client';-import { getRecipientsForTemplate } from '@documenso/lib/server-only/recipient/get-recipients-for-template';+import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';+import { prisma } from '@documenso/prisma';import { seedBlankTemplate } from '@documenso/prisma/seed/templates';import { seedUser } from '@documenso/prisma/seed/users';@@ -17,7 +20,7 @@ const setupTemplateAndNavigateToSignersStep = async (page: Page) => {await apiSignin({page,email: user.email,- redirectPath: `/templates/${template.id}/edit`,+ redirectPath: `/t/${team.url}/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/edit`,});await page.getByRole('button', { name: 'Continue' }).click();@@ -47,7 +50,7 @@ test.describe('AutoSave Signers Step - Templates', () => {await expect(async () => {const retrievedRecipients = await getRecipientsForTemplate({- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),userId: user.id,teamId: team.id,});@@ -71,7 +74,7 @@ test.describe('AutoSave Signers Step - Templates', () => {await expect(async () => {const retrievedRecipients = await getRecipientsForTemplate({- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),userId: user.id,teamId: team.id,});@@ -99,7 +102,7 @@ test.describe('AutoSave Signers Step - Templates', () => {await expect(async () => {const retrievedRecipients = await getRecipientsForTemplate({- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),userId: user.id,teamId: team.id,});@@ -152,13 +155,16 @@ test.describe('AutoSave Signers Step - Templates', () => {await expect(async () => {const retrievedTemplate = await getTemplateById({- id: template.id,+ id: {+ type: 'envelopeId',+ id: template.id,+ },userId: user.id,teamId: team.id,});const retrievedRecipients = await getRecipientsForTemplate({- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),userId: user.id,teamId: team.id,});@@ -172,3 +178,36 @@ test.describe('AutoSave Signers Step - Templates', () => {}).toPass();});});++export interface GetRecipientsForTemplateOptions {+ templateId: number;+ userId: number;+ teamId: number;+}++const getRecipientsForTemplate = async ({+ templateId,+ userId,+ teamId,+}: GetRecipientsForTemplateOptions) => {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'templateId',+ id: templateId,+ },+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const recipients = await prisma.recipient.findMany({+ where: {+ envelope: envelopeWhereInput,+ },+ orderBy: {+ id: 'asc',+ },+ });++ return recipients;+};diff --git a/packages/app-tests/e2e/templates-flow/template-settings-step.spec.ts b/packages/app-tests/e2e/templates-flow/template-settings-step.spec.tsindex f0a86347e..8f3ab1c5d 100644--- a/packages/app-tests/e2e/templates-flow/template-settings-step.spec.ts+++ b/packages/app-tests/e2e/templates-flow/template-settings-step.spec.ts@@ -1,6 +1,7 @@import { expect, test } from '@playwright/test';import { TeamMemberRole } from '@prisma/client';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';import { seedTeam, seedTeamMember } from '@documenso/prisma/seed/teams';import { seedBlankTemplate } from '@documenso/prisma/seed/templates';import { seedUser } from '@documenso/prisma/seed/users';@@ -118,8 +119,10 @@ test('[TEMPLATE_FLOW] team member visibility permissions', async ({ page }) => {redirectPath: `/t/${team.url}/templates/${template.id}/edit`,});- // Regular member should not be able to modify visibility when set to managers and above- await expect(page.getByTestId('documentVisibilitySelectValue')).toBeDisabled();+ // A regular member should not be able to see the template.+ // They should be redirected to the templates page.+ await expect(page.getByText('Not Found').first()).toBeVisible();+ await page.goto(`/t/${team.url}/templates`);// Create a new template with 'everyone' visibilityconst everyoneTemplate = await seedBlankTemplate(owner, team.id, {@@ -130,7 +133,9 @@ test('[TEMPLATE_FLOW] team member visibility permissions', async ({ page }) => {});// Navigate to the new template- await page.goto(`/t/${team.url}/templates/${everyoneTemplate.id}/edit`);+ await page.goto(+ `/t/${team.url}/templates/${mapSecondaryIdToTemplateId(everyoneTemplate.secondaryId)}/edit`,+ );// Regular member should be able to see but not modify visibilityawait expect(page.getByTestId('documentVisibilitySelectValue')).toBeDisabled();diff --git a/packages/app-tests/e2e/templates-flow/template-signers-step.spec.ts b/packages/app-tests/e2e/templates-flow/template-signers-step.spec.tsindex 2d7f118a7..3cf60f1aa 100644--- a/packages/app-tests/e2e/templates-flow/template-signers-step.spec.ts+++ b/packages/app-tests/e2e/templates-flow/template-signers-step.spec.ts@@ -29,7 +29,7 @@ import { apiSignin } from '../fixtures/authentication';// await apiSignin({// page,// email: user.email,-// redirectPath: `/templates/${template.id}/edit`,+// redirectPath: `/templates/${mapSecondaryIdToTemplateId(template.secondaryId)}/edit`,// });// // Save the settings by going to the next step.diff --git a/packages/app-tests/e2e/templates/create-document-from-template.spec.ts b/packages/app-tests/e2e/templates/create-document-from-template.spec.tsindex df5d1aa87..988ecb345 100644--- a/packages/app-tests/e2e/templates/create-document-from-template.spec.ts+++ b/packages/app-tests/e2e/templates/create-document-from-template.spec.ts@@ -75,11 +75,11 @@ test('[TEMPLATE]: should create a document from a template', async ({ page }) =>await page.getByRole('button', { name: 'Create as draft' }).click();// Review that the document was created with the correct values.- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));- const documentId = Number(page.url().split('/').pop());+ const documentId = page.url().split('/').pop();- const document = await prisma.document.findFirstOrThrow({+ const document = await prisma.envelope.findFirstOrThrow({where: {id: documentId,},@@ -178,11 +178,11 @@ test('[TEMPLATE]: should create a team document from a team template', async ({await page.getByRole('button', { name: 'Create as draft' }).click();// Review that the document was created with the correct values.- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));- const documentId = Number(page.url().split('/').pop());+ const documentId = page.url().split('/').pop();- const document = await prisma.document.findFirstOrThrow({+ const document = await prisma.envelope.findFirstOrThrow({where: {id: documentId,},@@ -284,34 +284,40 @@ test('[TEMPLATE]: should create a document from a template with custom document'await page.getByRole('button', { name: 'Create as draft' }).click();// Review that the document was created with the custom document data- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));- const documentId = Number(page.url().split('/').pop());+ const documentId = page.url().split('/').pop();- const document = await prisma.document.findFirstOrThrow({+ const document = await prisma.envelope.findFirstOrThrow({where: {id: documentId,},include: {- documentData: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },},});+ const firstDocumentData = document.envelopeItems[0].documentData;+const expectedDocumentDataType =process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT === 's3'? DocumentDataType.S3_PATH: DocumentDataType.BYTES_64;expect(document.title).toEqual('TEMPLATE_WITH_CUSTOM_DOC');- expect(document.documentData.type).toEqual(expectedDocumentDataType);+ expect(firstDocumentData.type).toEqual(expectedDocumentDataType);if (expectedDocumentDataType === DocumentDataType.BYTES_64) {- expect(document.documentData.data).toEqual(pdfContent);- expect(document.documentData.initialData).toEqual(pdfContent);+ expect(firstDocumentData.data).toEqual(pdfContent);+ expect(firstDocumentData.initialData).toEqual(pdfContent);} else {// For S3, we expect the data/initialData to be the S3 path (non-empty string)- expect(document.documentData.data).toBeTruthy();- expect(document.documentData.initialData).toBeTruthy();+ expect(firstDocumentData.data).toBeTruthy();+ expect(firstDocumentData.initialData).toBeTruthy();}});@@ -377,16 +383,20 @@ test('[TEMPLATE]: should create a team document from a template with custom docuawait page.getByRole('button', { name: 'Create as draft' }).click();// Review that the document was created with the custom document data- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));- const documentId = Number(page.url().split('/').pop());+ const documentId = page.url().split('/').pop();- const document = await prisma.document.findFirstOrThrow({+ const document = await prisma.envelope.findFirstOrThrow({where: {id: documentId,},include: {- documentData: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },},});@@ -395,17 +405,19 @@ test('[TEMPLATE]: should create a team document from a template with custom docu? DocumentDataType.S3_PATH: DocumentDataType.BYTES_64;+ const firstDocumentData = document.envelopeItems[0].documentData;+expect(document.teamId).toEqual(team.id);expect(document.title).toEqual('TEAM_TEMPLATE_WITH_CUSTOM_DOC');- expect(document.documentData.type).toEqual(expectedDocumentDataType);+ expect(firstDocumentData.type).toEqual(expectedDocumentDataType);if (expectedDocumentDataType === DocumentDataType.BYTES_64) {- expect(document.documentData.data).toEqual(pdfContent);- expect(document.documentData.initialData).toEqual(pdfContent);+ expect(firstDocumentData.data).toEqual(pdfContent);+ expect(firstDocumentData.initialData).toEqual(pdfContent);} else {// For S3, we expect the data/initialData to be the S3 path (non-empty string)- expect(document.documentData.data).toBeTruthy();- expect(document.documentData.initialData).toBeTruthy();+ expect(firstDocumentData.data).toBeTruthy();+ expect(firstDocumentData.initialData).toBeTruthy();}});@@ -451,34 +463,44 @@ test('[TEMPLATE]: should create a document from a template using template documeawait page.getByRole('button', { name: 'Create as draft' }).click();// Review that the document was created with the template's document data- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));- const documentId = Number(page.url().split('/').pop());+ const documentId = page.url().split('/').pop();- const document = await prisma.document.findFirstOrThrow({+ const document = await prisma.envelope.findFirstOrThrow({where: {id: documentId,},include: {- documentData: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },},});- const templateWithData = await prisma.template.findFirstOrThrow({+ const firstDocumentData = document.envelopeItems[0].documentData;++ const templateWithData = await prisma.envelope.findFirstOrThrow({where: {id: template.id,},include: {- templateDocumentData: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },},});expect(document.title).toEqual('TEMPLATE_WITH_ORIGINAL_DOC');- expect(document.documentData.data).toEqual(templateWithData.templateDocumentData.data);- expect(document.documentData.initialData).toEqual(- templateWithData.templateDocumentData.initialData,+ expect(firstDocumentData.data).toEqual(templateWithData.envelopeItems[0].documentData.data);+ expect(firstDocumentData.initialData).toEqual(+ templateWithData.envelopeItems[0].documentData.initialData,);- expect(document.documentData.type).toEqual(templateWithData.templateDocumentData.type);+ expect(firstDocumentData.type).toEqual(templateWithData.envelopeItems[0].documentData.type);});test('[TEMPLATE]: should persist document visibility when creating from template', async ({@@ -532,14 +554,21 @@ test('[TEMPLATE]: should persist document visibility when creating from templateawait page.getByRole('button', { name: 'Create as draft' }).click();// Review that the document was created with the correct visibility- await page.waitForURL(new RegExp(`/t/${team.url}/documents/\\d+`));+ await page.waitForURL(new RegExp(`/t/${team.url}/documents/envelope_.*`));- const documentId = Number(page.url().split('/').pop());+ const documentId = page.url().split('/').pop();- const document = await prisma.document.findFirstOrThrow({+ const document = await prisma.envelope.findFirstOrThrow({where: {id: documentId,},+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ },});expect(document.title).toEqual('TEMPLATE_WITH_VISIBILITY');diff --git a/packages/app-tests/e2e/templates/direct-templates.spec.ts b/packages/app-tests/e2e/templates/direct-templates.spec.tsindex 80adfc34d..5e17a81ca 100644--- a/packages/app-tests/e2e/templates/direct-templates.spec.ts+++ b/packages/app-tests/e2e/templates/direct-templates.spec.ts@@ -77,7 +77,7 @@ test('[DIRECT_TEMPLATES]: toggle direct template link', async ({ page }) => {// Navigate to template settings and disable access.await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}${formatTemplatesPath(template.team?.url)}`);await page.getByRole('cell', { name: 'Use Template' }).getByRole('button').nth(1).click();- await page.getByRole('menuitem', { name: 'Direct link' }).click();+ await page.getByTestId('template-direct-link').click();await page.getByRole('switch').click();await page.getByRole('button', { name: 'Save' }).click();await expect(page.getByText('Direct link signing has been').first()).toBeVisible();@@ -111,7 +111,7 @@ test('[DIRECT_TEMPLATES]: delete direct template link', async ({ page }) => {// Navigate to template settings and delete the access.await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}${formatTemplatesPath(template.team?.url)}`);await page.getByRole('cell', { name: 'Use Template' }).getByRole('button').nth(1).click();- await page.getByRole('menuitem', { name: 'Direct link' }).click();+ await page.getByTestId('template-direct-link').click();await page.getByRole('button', { name: 'Remove' }).click();await page.getByRole('button', { name: 'Confirm' }).click();await expect(page.getByText('Direct template link deleted').first()).toBeVisible();@@ -171,6 +171,7 @@ test('[DIRECT_TEMPLATES]: use direct template link with 1 recipient', async ({ pawait page.goto(formatDirectTemplatePath(template.directLink?.token || ''));await expect(page.getByRole('heading', { name: 'General' })).toBeVisible();+ await page.waitForTimeout(100);await page.getByPlaceholder('[email protected]').fill(seedTestEmail());await page.getByRole('button', { name: 'Continue' }).click();diff --git a/packages/app-tests/e2e/templates/test-unauthorized-template-access.spec.ts b/packages/app-tests/e2e/templates/test-unauthorized-template-access.spec.tsindex 33e38bca8..2cb219f1f 100644--- a/packages/app-tests/e2e/templates/test-unauthorized-template-access.spec.ts+++ b/packages/app-tests/e2e/templates/test-unauthorized-template-access.spec.ts@@ -24,7 +24,7 @@ test.describe('Unauthorized Access to Templates', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/templates/${template.id}`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});test('should block unauthorized access to the template edit page', async ({ page }) => {@@ -40,6 +40,6 @@ test.describe('Unauthorized Access to Templates', () => {});await page.goto(`${NEXT_PUBLIC_WEBAPP_URL()}/t/${team.url}/templates/${template.id}/edit`);- await expect(page.getByRole('heading', { name: 'Oops! Something went wrong.' })).toBeVisible();+ await expect(page.getByRole('heading', { name: 'Team not found' })).toBeVisible();});});diff --git a/packages/app-tests/package.json b/packages/app-tests/package.jsonindex c54263a24..2df81aa87 100644--- a/packages/app-tests/package.json+++ b/packages/app-tests/package.json@@ -12,13 +12,12 @@"keywords": [],"author": "","devDependencies": {- "@playwright/test": "1.52.0",- "@types/node": "^20","@documenso/lib": "*","@documenso/prisma": "*",- "pdf-lib": "^1.17.1"+ "@playwright/test": "1.52.0",+ "@types/node": "^20"},"dependencies": {"start-server-and-test": "^2.0.12"}-}\ No newline at end of file+}diff --git a/packages/ee/server-only/limits/server.ts b/packages/ee/server-only/limits/server.tsindex fcaa805f7..883146e0c 100644--- a/packages/ee/server-only/limits/server.ts+++ b/packages/ee/server-only/limits/server.ts@@ -1,4 +1,4 @@-import { DocumentSource, SubscriptionStatus } from '@prisma/client';+import { DocumentSource, EnvelopeType, SubscriptionStatus } from '@prisma/client';import { DateTime } from 'luxon';import { IS_BILLING_ENABLED } from '@documenso/lib/constants/app';@@ -84,8 +84,9 @@ export const getServerLimits = async ({}const [documents, directTemplates] = await Promise.all([- prisma.document.count({+ prisma.envelope.count({where: {+ type: EnvelopeType.DOCUMENT,team: {organisationId: organisation.id,},@@ -97,8 +98,9 @@ export const getServerLimits = async ({},},}),- prisma.template.count({+ prisma.envelope.count({where: {+ type: EnvelopeType.TEMPLATE,team: {organisationId: organisation.id,},diff --git a/packages/lib/advanced-fields-validation/validate-number.ts b/packages/lib/advanced-fields-validation/validate-number.tsindex d53c63e23..6d768e068 100644--- a/packages/lib/advanced-fields-validation/validate-number.ts+++ b/packages/lib/advanced-fields-validation/validate-number.ts@@ -1,4 +1,5 @@-// import { numberFormatValues } from '@documenso/ui/primitives/document-flow/field-items-advanced-settings/constants';+import { numberFormatValues } from '@documenso/ui/primitives/document-flow/field-items-advanced-settings/constants';+import type { TNumberFieldMeta as NumberFieldMeta } from '../types/field-meta';export const validateNumberField = (@@ -10,16 +11,16 @@ export const validateNumberField = (const { minValue, maxValue, readOnly, required, numberFormat, fontSize } = fieldMeta || {};- const formatRegex: { [key: string]: RegExp } = {- '123,456,789.00': /^(?:\d{1,3}(?:,\d{3})*|\d+)(?:\.\d{1,2})?$/,- '123.456.789,00': /^(?:\d{1,3}(?:\.\d{3})*|\d+)(?:,\d{1,2})?$/,- '123456,789.00': /^(?:\d+)(?:,\d{1,3}(?:\.\d{1,2})?)?$/,- };+ if (numberFormat) {+ const foundRegex = numberFormatValues.find((item) => item.value === numberFormat)?.regex;- const isValidFormat = numberFormat ? formatRegex[numberFormat].test(value) : true;+ if (!foundRegex) {+ errors.push(`Invalid number format - ${numberFormat}`);+ }- if (!isValidFormat) {- errors.push(`Value ${value} does not match the number format - ${numberFormat}`);+ if (foundRegex && !foundRegex.test(value)) {+ errors.push(`Value ${value} does not match the number format - ${numberFormat}`);+ }}const numberValue = parseFloat(value);@@ -32,19 +33,19 @@ export const validateNumberField = (errors.push(`Value is not a valid number`);}- if (minValue !== undefined && minValue > 0 && numberValue < minValue) {+ if (typeof minValue === 'number' && minValue > 0 && numberValue < minValue) {errors.push(`Value ${value} is less than the minimum value of ${minValue}`);}- if (maxValue !== undefined && maxValue > 0 && numberValue > maxValue) {+ if (typeof maxValue === 'number' && maxValue > 0 && numberValue > maxValue) {errors.push(`Value ${value} is greater than the maximum value of ${maxValue}`);}- if (minValue !== undefined && maxValue !== undefined && minValue > maxValue) {+ if (typeof minValue === 'number' && typeof maxValue === 'number' && minValue > maxValue) {errors.push('Minimum value cannot be greater than maximum value');}- if (maxValue !== undefined && minValue !== undefined && maxValue < minValue) {+ if (typeof maxValue === 'number' && typeof minValue === 'number' && maxValue < minValue) {errors.push('Maximum value cannot be less than minimum value');}diff --git a/packages/lib/client-only/hooks/use-copy-share-link.ts b/packages/lib/client-only/hooks/use-copy-share-link.tsindex 4638e4e49..a8bef34af 100644--- a/packages/lib/client-only/hooks/use-copy-share-link.ts+++ b/packages/lib/client-only/hooks/use-copy-share-link.ts@@ -1,5 +1,5 @@import { trpc } from '@documenso/trpc/react';-import type { TCreateOrGetShareLinkMutationSchema } from '@documenso/trpc/server/share-link-router/schema';+import type { TShareDocumentRequest } from '@documenso/trpc/server/document-router/share-document.types';import { useCopyToClipboard } from './use-copy-to-clipboard';@@ -12,14 +12,14 @@ export function useCopyShareLink({ onSuccess, onError }: UseCopyShareLinkOptionsconst [, copyToClipboard] = useCopyToClipboard();const { mutateAsync: createOrGetShareLink, isPending: isCreatingShareLink } =- trpc.shareLink.createOrGetShareLink.useMutation();+ trpc.document.share.useMutation();/*** Copy a newly created, or pre-existing share link to the user's clipboard.** @param payload The payload to create or get a share link.*/- const createAndCopyShareLink = async (payload: TCreateOrGetShareLinkMutationSchema) => {+ const createAndCopyShareLink = async (payload: TShareDocumentRequest) => {const valueToCopy = createOrGetShareLink(payload).then((result) => `${window.location.origin}/share/${result.slug}`,);diff --git a/packages/lib/client-only/hooks/use-editor-fields.ts b/packages/lib/client-only/hooks/use-editor-fields.tsnew file mode 100644index 000000000..d6316d46c--- /dev/null+++ b/packages/lib/client-only/hooks/use-editor-fields.ts@@ -0,0 +1,281 @@+import { useCallback, useEffect, useMemo, useState } from 'react';++import { zodResolver } from '@hookform/resolvers/zod';+import type { Recipient } from '@prisma/client';+import { FieldType } from '@prisma/client';+import { useFieldArray, useForm } from 'react-hook-form';+import { z } from 'zod';++import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';+import { nanoid } from '@documenso/lib/universal/id';++import type { TEnvelope } from '../../types/envelope';++export const ZLocalFieldSchema = z.object({+ // This is the actual ID of the field if created.+ id: z.number().optional(),+ // This is the local client side ID of the field.+ formId: z.string().min(1),+ // This is the ID of the envelope item to put the field on.+ envelopeItemId: z.string(),+ type: z.nativeEnum(FieldType),+ recipientId: z.number(),+ page: z.number().min(1),+ positionX: z.number().min(0),+ positionY: z.number().min(0),+ width: z.number().min(0),+ height: z.number().min(0),+ fieldMeta: ZFieldMetaSchema,+});++export type TLocalField = z.infer<typeof ZLocalFieldSchema>;++const ZEditorFieldsFormSchema = z.object({+ fields: z.array(ZLocalFieldSchema),+});++export type TEditorFieldsFormSchema = z.infer<typeof ZEditorFieldsFormSchema>;++type EditorFieldsProps = {+ envelope: TEnvelope;+ handleFieldsUpdate: (fields: TLocalField[]) => unknown;+};++type UseEditorFieldsResponse = {+ localFields: TLocalField[];++ // Selected field+ selectedField: TLocalField | undefined;+ setSelectedField: (formId: string | null) => void;++ // Field operations+ addField: (field: Omit<TLocalField, 'formId'>) => TLocalField;+ removeFieldsByFormId: (formIds: string[]) => void;+ updateFieldByFormId: (formId: string, updates: Partial<TLocalField>) => void;+ duplicateField: (field: TLocalField, recipientId?: number) => TLocalField;+ duplicateFieldToAllPages: (field: TLocalField, recipientId?: number) => TLocalField[];++ // Field utilities+ getFieldByFormId: (formId: string) => TLocalField | undefined;+ getFieldsByRecipient: (recipientId: number) => TLocalField[];++ // Selected recipient+ selectedRecipient: Recipient | null;+ setSelectedRecipient: (recipientId: number | null) => void;+};++export const useEditorFields = ({+ envelope,+ handleFieldsUpdate,+}: EditorFieldsProps): UseEditorFieldsResponse => {+ const [selectedFieldFormId, setSelectedFieldFormId] = useState<string | null>(null);+ const [selectedRecipientId, setSelectedRecipientId] = useState<number | null>(null);++ const form = useForm<TEditorFieldsFormSchema>({+ defaultValues: {+ fields: envelope.fields.map(+ (field): TLocalField => ({+ id: field.id,+ formId: nanoid(),+ envelopeItemId: field.envelopeItemId,+ page: field.page,+ type: field.type,+ positionX: Number(field.positionX),+ positionY: Number(field.positionY),+ width: Number(field.width),+ height: Number(field.height),+ recipientId: field.recipientId,+ fieldMeta: field.fieldMeta ? ZFieldMetaSchema.parse(field.fieldMeta) : undefined,+ }),+ ),+ },+ resolver: zodResolver(ZEditorFieldsFormSchema),+ });++ const {+ append,+ remove,+ update,+ fields: localFields,+ } = useFieldArray({+ control: form.control,+ name: 'fields',+ keyName: 'react-hook-form-id',+ });++ const triggerFieldsUpdate = () => {+ void handleFieldsUpdate(form.getValues().fields);+ };++ const setSelectedField = (formId: string | null, bypassCheck = false) => {+ if (!formId) {+ setSelectedFieldFormId(null);+ return;+ }++ const foundField = localFields.find((field) => field.formId === formId);+ const recipient = envelope.recipients.find(+ (recipient) => recipient.id === foundField?.recipientId,+ );++ if (recipient) {+ setSelectedRecipient(recipient.id);+ }++ if (bypassCheck) {+ console.log(3);+ setSelectedFieldFormId(formId);+ return;+ }++ setSelectedFieldFormId(foundField?.formId ?? null);+ };++ const addField = useCallback(+ (fieldData: Omit<TLocalField, 'formId'>): TLocalField => {+ const field: TLocalField = {+ ...fieldData,+ formId: nanoid(12),+ };++ append(field);+ triggerFieldsUpdate();+ setSelectedField(field.formId, true);+ return field;+ },+ [append, triggerFieldsUpdate, setSelectedField],+ );++ const removeFieldsByFormId = useCallback(+ (formIds: string[]) => {+ const indexes = formIds+ .map((formId) => localFields.findIndex((field) => field.formId === formId))+ .filter((index) => index !== -1);++ if (indexes.length > 0) {+ remove(indexes);+ triggerFieldsUpdate();+ }+ },+ [localFields, remove, triggerFieldsUpdate],+ );++ const updateFieldByFormId = useCallback(+ (formId: string, updates: Partial<TLocalField>) => {+ const index = localFields.findIndex((field) => field.formId === formId);++ if (index !== -1) {+ update(index, { ...localFields[index], ...updates });+ triggerFieldsUpdate();+ }+ },+ [localFields, update, triggerFieldsUpdate],+ );++ const duplicateField = useCallback(+ (field: TLocalField): TLocalField => {+ const newField: TLocalField = {+ ...structuredClone(field),+ id: undefined,+ formId: nanoid(12),+ recipientId: field.recipientId,+ positionX: field.positionX + 3,+ positionY: field.positionY + 3,+ };++ append(newField);+ triggerFieldsUpdate();+ return newField;+ },+ [append, triggerFieldsUpdate],+ );++ const duplicateFieldToAllPages = useCallback(+ (field: TLocalField): TLocalField[] => {+ const pages = Array.from(document.querySelectorAll('[data-page-number]'));+ const newFields: TLocalField[] = [];++ pages.forEach((_, index) => {+ const pageNumber = index + 1;++ if (pageNumber === field.page) {+ return;+ }++ const newField: TLocalField = {+ ...structuredClone(field),+ id: undefined,+ formId: nanoid(12),+ page: pageNumber,+ };++ append(newField);+ newFields.push(newField);+ });++ triggerFieldsUpdate();+ return newFields;+ },+ [append, triggerFieldsUpdate],+ );++ const getFieldByFormId = useCallback(+ (formId: string): TLocalField | undefined => {+ return localFields.find((field) => field.formId === formId) as TLocalField | undefined;+ },+ [localFields],+ );++ const getFieldsByRecipient = useCallback(+ (recipientId: number): TLocalField[] => {+ return localFields.filter((field) => field.recipientId === recipientId);+ },+ [localFields],+ );++ const selectedRecipient = useMemo(() => {+ return envelope.recipients.find((recipient) => recipient.id === selectedRecipientId) || null;+ }, [selectedRecipientId, envelope.recipients]);++ const selectedField = useMemo(() => {+ return localFields.find((field) => field.formId === selectedFieldFormId);+ }, [selectedFieldFormId, localFields]);++ /**+ * Keep the selected field form ID in sync with the local fields.+ */+ useEffect(() => {+ const foundField = localFields.find((field) => field.formId === selectedFieldFormId);+ setSelectedFieldFormId(foundField?.formId ?? null);+ }, [selectedFieldFormId, localFields]);++ const setSelectedRecipient = (recipientId: number | null) => {+ const foundRecipient = envelope.recipients.find((recipient) => recipient.id === recipientId);++ setSelectedRecipientId(foundRecipient?.id ?? null);+ };++ return {+ // Core state+ localFields,++ // Field operations+ addField,+ removeFieldsByFormId,+ updateFieldByFormId,+ duplicateField,+ duplicateFieldToAllPages,++ // Field utilities+ getFieldByFormId,+ getFieldsByRecipient,++ // Selected field+ selectedField,+ setSelectedField,++ // Selected recipient+ selectedRecipient,+ setSelectedRecipient,+ };+};diff --git a/packages/lib/client-only/hooks/use-envelope-autosave.ts b/packages/lib/client-only/hooks/use-envelope-autosave.tsnew file mode 100644index 000000000..3d8abd9a5--- /dev/null+++ b/packages/lib/client-only/hooks/use-envelope-autosave.ts@@ -0,0 +1,90 @@+import { useCallback, useEffect, useRef, useState } from 'react';++export function useEnvelopeAutosave<T>(saveFn: (data: T) => Promise<void>, delay = 1000) {+ const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const lastArgsRef = useRef<T | null>(null);+ const pendingPromiseRef = useRef<Promise<void> | null>(null);++ const [isPending, setIsPending] = useState(false);+ const [isCommiting, setIsCommiting] = useState(false);++ const triggerSave = useCallback(+ (data: T) => {+ lastArgsRef.current = data;++ // A debounce or promise means something is pending+ setIsPending(true);++ if (timeoutRef.current) clearTimeout(timeoutRef.current);++ // eslint-disable-next-line @typescript-eslint/no-misused-promises+ timeoutRef.current = setTimeout(async () => {+ if (!lastArgsRef.current) {+ return;+ }++ const args = lastArgsRef.current;+ lastArgsRef.current = null;+ timeoutRef.current = null;++ setIsCommiting(true);+ pendingPromiseRef.current = saveFn(args);++ try {+ await pendingPromiseRef.current;+ } finally {+ // eslint-disable-next-line require-atomic-updates+ pendingPromiseRef.current = null;+ setIsCommiting(false);+ setIsPending(false);+ }+ }, delay);+ },+ [saveFn, delay],+ );++ const flush = useCallback(async () => {+ if (timeoutRef.current) {+ clearTimeout(timeoutRef.current);+ timeoutRef.current = null;+ }++ if (pendingPromiseRef.current) {+ // Already running → wait for it+ await pendingPromiseRef.current;+ return;+ }++ if (lastArgsRef.current) {+ const args = lastArgsRef.current;+ lastArgsRef.current = null;++ setIsCommiting(true);+ setIsPending(true);++ pendingPromiseRef.current = saveFn(args);+ try {+ await pendingPromiseRef.current;+ } finally {+ // eslint-disable-next-line require-atomic-updates+ pendingPromiseRef.current = null;+ setIsCommiting(false);+ setIsPending(false);+ }+ }+ }, [saveFn]);++ useEffect(() => {+ const handleBeforeUnload = () => {+ if (timeoutRef.current || pendingPromiseRef.current) {+ void flush();+ }+ };++ window.addEventListener('beforeunload', handleBeforeUnload);++ return () => window.removeEventListener('beforeunload', handleBeforeUnload);+ }, [flush]);++ return { triggerSave, flush, isPending, isCommiting };+}diff --git a/packages/lib/client-only/hooks/use-field-page-coords.ts b/packages/lib/client-only/hooks/use-field-page-coords.tsindex f490939b8..e212e7328 100644--- a/packages/lib/client-only/hooks/use-field-page-coords.ts+++ b/packages/lib/client-only/hooks/use-field-page-coords.ts@@ -5,7 +5,9 @@ import type { Field } from '@prisma/client';import { getBoundingClientRect } from '@documenso/lib/client-only/get-bounding-client-rect';import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';-export const useFieldPageCoords = (field: Field) => {+export const useFieldPageCoords = (+ field: Pick<Field, 'positionX' | 'positionY' | 'width' | 'height' | 'page'>,+) => {const [coords, setCoords] = useState({x: 0,y: 0,diff --git a/packages/lib/client-only/providers/envelope-editor-provider.tsx b/packages/lib/client-only/providers/envelope-editor-provider.tsxnew file mode 100644index 000000000..9344dc84c--- /dev/null+++ b/packages/lib/client-only/providers/envelope-editor-provider.tsx@@ -0,0 +1,286 @@+import React, { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';++import { useLingui } from '@lingui/react/macro';+import { EnvelopeType } from '@prisma/client';++import { trpc } from '@documenso/trpc/react';+import type { TSetEnvelopeRecipientsRequest } from '@documenso/trpc/server/envelope-router/set-envelope-recipients.types';+import type { RecipientColorStyles, TRecipientColor } from '@documenso/ui/lib/recipient-colors';+import {+ AVAILABLE_RECIPIENT_COLORS,+ getRecipientColorStyles,+} from '@documenso/ui/lib/recipient-colors';+import { useToast } from '@documenso/ui/primitives/use-toast';++import type { TDocumentEmailSettings } from '../../types/document-email';+import type { TEnvelope } from '../../types/envelope';+import { useEditorFields } from '../hooks/use-editor-fields';+import type { TLocalField } from '../hooks/use-editor-fields';+import { useEnvelopeAutosave } from '../hooks/use-envelope-autosave';++export const useDebounceFunction = <Args extends unknown[]>(+ callback: (...args: Args) => void,+ delay: number,+) => {+ const timeoutRef = useRef<NodeJS.Timeout>();++ return useCallback(+ (...args: Args) => {+ if (timeoutRef.current) {+ clearTimeout(timeoutRef.current);+ }++ timeoutRef.current = setTimeout(() => {+ callback(...args);+ }, delay);+ },+ [callback, delay],+ );+};++type EnvelopeEditorProviderValue = {+ envelope: TEnvelope;+ isDocument: boolean;+ isTemplate: boolean;+ setLocalEnvelope: (localEnvelope: Partial<TEnvelope>) => void;++ updateEnvelope: (envelopeUpdates: Partial<TEnvelope>) => void;+ setRecipientsDebounced: (recipients: TSetEnvelopeRecipientsRequest['recipients']) => void;+ setRecipientsAsync: (recipients: TSetEnvelopeRecipientsRequest['recipients']) => Promise<void>;++ getFieldColor: (field: TLocalField) => RecipientColorStyles;+ getRecipientColorKey: (recipientId: number) => TRecipientColor;++ editorFields: ReturnType<typeof useEditorFields>;++ isAutosaving: boolean;+ flushAutosave: () => void;+ autosaveError: boolean;++ // refetchEnvelope: () => Promise<void>;+ // updateEnvelope: (envelope: TEnvelope) => Promise<void>;+};++interface EnvelopeEditorProviderProps {+ children: React.ReactNode;+ initialEnvelope: TEnvelope;+}++const EnvelopeEditorContext = createContext<EnvelopeEditorProviderValue | null>(null);++export const useCurrentEnvelopeEditor = () => {+ const context = useContext(EnvelopeEditorContext);++ if (!context) {+ throw new Error('useCurrentEnvelopeEditor must be used within a EnvelopeEditorProvider');+ }++ return context;+};++export const EnvelopeEditorProvider = ({+ children,+ initialEnvelope,+}: EnvelopeEditorProviderProps) => {+ const { t } = useLingui();+ const { toast } = useToast();++ const [envelope, setEnvelope] = useState(initialEnvelope);++ const [autosaveError, setAutosaveError] = useState<boolean>(false);++ const envelopeUpdateMutationQuery = trpc.envelope.update.useMutation({+ onSuccess: (response, input) => {+ console.log(input.meta?.emailSettings);+ setEnvelope({+ ...envelope,+ ...response,+ documentMeta: {+ ...envelope.documentMeta,+ ...input.meta,+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ emailSettings: (input.meta?.emailSettings ||+ null) as unknown as TDocumentEmailSettings | null,+ },+ });++ setAutosaveError(false);+ },+ onError: (error) => {+ setAutosaveError(true);++ toast({+ title: t`Save failed`,+ description: t`We encountered an error while attempting to save your changes. Your changes cannot be saved at this time.`,+ variant: 'destructive',+ duration: 7500,+ });+ },+ });++ const envelopeFieldSetMutationQuery = trpc.envelope.field.set.useMutation({+ onSuccess: () => {+ setAutosaveError(false);+ },+ onError: (error) => {+ setAutosaveError(true);++ toast({+ title: t`Save failed`,+ description: t`We encountered an error while attempting to save your changes. Your changes cannot be saved at this time.`,+ variant: 'destructive',+ duration: 7500,+ });+ },+ });++ const envelopeRecipientSetMutationQuery = trpc.envelope.recipient.set.useMutation({+ onSuccess: () => {+ setAutosaveError(false);+ },+ onError: (error) => {+ setAutosaveError(true);++ toast({+ title: t`Save failed`,+ description: t`We encountered an error while attempting to save your changes. Your changes cannot be saved at this time.`,+ variant: 'destructive',+ duration: 7500,+ });+ },+ });++ const {+ triggerSave: setRecipientsDebounced,+ flush: setRecipientsAsync,+ isPending: isRecipientsMutationPending,+ } = useEnvelopeAutosave(async (recipients: TSetEnvelopeRecipientsRequest['recipients']) => {+ await envelopeRecipientSetMutationQuery.mutateAsync({+ envelopeId: envelope.id,+ envelopeType: envelope.type,+ recipients,+ });+ }, 1000);++ const {+ triggerSave: setFieldsDebounced,+ flush: setFieldsAsync,+ isPending: isFieldsMutationPending,+ } = useEnvelopeAutosave(async (fields: TLocalField[]) => {+ await envelopeFieldSetMutationQuery.mutateAsync({+ envelopeId: envelope.id,+ envelopeType: envelope.type,+ fields,+ });+ }, 1000);++ const {+ triggerSave: setEnvelopeDebounced,+ flush: setEnvelopeAsync,+ isPending: isEnvelopeMutationPending,+ } = useEnvelopeAutosave(async (envelopeUpdates: Partial<TEnvelope>) => {+ await envelopeUpdateMutationQuery.mutateAsync({+ envelopeId: envelope.id,+ envelopeType: envelope.type,+ data: {+ ...envelopeUpdates,+ },+ });+ }, 1000);++ /**+ * Updates the local envelope and debounces the update to the server.+ */+ const updateEnvelope = (envelopeUpdates: Partial<TEnvelope>) => {+ setEnvelope((prev) => ({ ...prev, ...envelopeUpdates }));+ setEnvelopeDebounced(envelopeUpdates);+ };++ const editorFields = useEditorFields({+ envelope,+ handleFieldsUpdate: (fields) => setFieldsDebounced(fields),+ });++ const getFieldColor = useCallback(+ (field: TLocalField) => {+ // Todo: Envelopes - Local recipients+ const recipientIndex = envelope.recipients.findIndex(+ (recipient) => recipient.id === field.recipientId,+ );++ return getRecipientColorStyles(Math.max(recipientIndex, 0));+ },+ [envelope.recipients], // Todo: Envelopes - Local recipients+ );++ const getRecipientColorKey = useCallback(+ (recipientId: number) => {+ // Todo: Envelopes - Local recipients+ const recipientIndex = envelope.recipients.findIndex(+ (recipient) => recipient.id === recipientId,+ );++ return AVAILABLE_RECIPIENT_COLORS[Math.max(recipientIndex, 0)];+ },+ [envelope.recipients], // Todo: Envelopes - Local recipients+ );++ const { refetch: reloadEnvelope, isLoading: isReloadingEnvelope } = trpc.envelope.get.useQuery(+ {+ envelopeId: envelope.id,+ },+ {+ initialData: envelope,+ },+ );++ const setLocalEnvelope = (localEnvelope: Partial<TEnvelope>) => {+ setEnvelope((prev) => ({ ...prev, ...localEnvelope }));+ };++ const isAutosaving = useMemo(() => {+ return (+ envelopeFieldSetMutationQuery.isPending ||+ envelopeRecipientSetMutationQuery.isPending ||+ envelopeUpdateMutationQuery.isPending ||+ isFieldsMutationPending ||+ isRecipientsMutationPending ||+ isEnvelopeMutationPending+ );+ }, [+ envelopeFieldSetMutationQuery.isPending,+ envelopeRecipientSetMutationQuery.isPending,+ envelopeUpdateMutationQuery.isPending,+ isFieldsMutationPending,+ isRecipientsMutationPending,+ isEnvelopeMutationPending,+ ]);++ const flushAutosave = () => {+ void setFieldsAsync();+ void setRecipientsAsync();+ void setEnvelopeAsync();+ };++ return (+ <EnvelopeEditorContext.Provider+ value={{+ envelope,+ isDocument: envelope.type === EnvelopeType.DOCUMENT,+ isTemplate: envelope.type === EnvelopeType.TEMPLATE,+ setLocalEnvelope,+ getFieldColor,+ getRecipientColorKey,+ updateEnvelope,+ setRecipientsDebounced,+ setRecipientsAsync,+ editorFields,+ autosaveError,+ flushAutosave,+ isAutosaving,+ }}+ >+ {children}+ </EnvelopeEditorContext.Provider>+ );+};diff --git a/packages/lib/client-only/providers/envelope-render-provider.tsx b/packages/lib/client-only/providers/envelope-render-provider.tsxnew file mode 100644index 000000000..a60c4d5ed--- /dev/null+++ b/packages/lib/client-only/providers/envelope-render-provider.tsx@@ -0,0 +1,148 @@+import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';+import React from 'react';++import type { DocumentData } from '@prisma/client';++import type { TEnvelope } from '../../types/envelope';+import { getFile } from '../../universal/upload/get-file';++type FileData =+ | {+ status: 'loading' | 'error';+ }+ | {+ file: Uint8Array;+ status: 'loaded';+ };++type EnvelopeRenderItem = TEnvelope['envelopeItems'][number];++type EnvelopeRenderProviderValue = {+ getPdfBuffer: (documentDataId: string) => FileData | null;+ envelopeItems: EnvelopeRenderItem[];+ currentEnvelopeItem: EnvelopeRenderItem | null;+ setCurrentEnvelopeItem: (envelopeItemId: string) => void;+ fields: TEnvelope['fields'];+};++interface EnvelopeRenderProviderProps {+ children: React.ReactNode;+ envelope: Pick<TEnvelope, 'envelopeItems'>;++ /**+ * Optional fields which are passed down to renderers for custom rendering needs.+ *+ * Only pass if the CustomRenderer you are passing in wants fields.+ */+ fields?: TEnvelope['fields'];+}++const EnvelopeRenderContext = createContext<EnvelopeRenderProviderValue | null>(null);++export const useCurrentEnvelopeRender = () => {+ const context = useContext(EnvelopeRenderContext);++ if (!context) {+ throw new Error('useCurrentEnvelopeRender must be used within a EnvelopeRenderProvider');+ }++ return context;+};++/**+ * Manages fetching and storing PDF files to render on the client.+ */+export const EnvelopeRenderProvider = ({+ children,+ envelope,+ fields,+}: EnvelopeRenderProviderProps) => {+ // Indexed by documentDataId.+ const [files, setFiles] = useState<Record<string, FileData>>({});++ const [currentItem, setItem] = useState<EnvelopeRenderItem | null>(null);++ const envelopeItems = useMemo(+ () => envelope.envelopeItems.sort((a, b) => a.order - b.order),+ [envelope.envelopeItems],+ );++ const loadEnvelopeItemPdfFile = async (documentData: DocumentData) => {+ if (files[documentData.id]?.status === 'loading') {+ return;+ }++ if (!files[documentData.id]) {+ setFiles((prev) => ({+ ...prev,+ [documentData.id]: {+ status: 'loading',+ },+ }));+ }++ try {+ const file = await getFile(documentData);++ setFiles((prev) => ({+ ...prev,+ [documentData.id]: {+ file,+ status: 'loaded',+ },+ }));+ } catch (error) {+ console.error(error);++ setFiles((prev) => ({+ ...prev,+ [documentData.id]: {+ status: 'error',+ },+ }));+ }+ };++ const getPdfBuffer = useCallback(+ (documentDataId: string) => {+ return files[documentDataId] || null;+ },+ [files],+ );++ const setCurrentEnvelopeItem = (envelopeItemId: string) => {+ const foundItem = envelope.envelopeItems.find((item) => item.id === envelopeItemId);++ setItem(foundItem ?? null);+ };++ // Set the selected item to the first item if none is set.+ useEffect(() => {+ if (!currentItem && envelopeItems.length > 0) {+ setCurrentEnvelopeItem(envelopeItems[0].id);+ }+ }, [currentItem, envelopeItems]);++ // Look for any missing pdf files and load them.+ useEffect(() => {+ const missingFiles = envelope.envelopeItems.filter((item) => !files[item.documentDataId]);++ for (const item of missingFiles) {+ void loadEnvelopeItemPdfFile(item.documentData);+ }+ }, [envelope.envelopeItems]);++ return (+ <EnvelopeRenderContext.Provider+ value={{+ getPdfBuffer,+ envelopeItems,+ currentEnvelopeItem: currentItem,+ setCurrentEnvelopeItem,+ fields: fields ?? [],+ }}+ >+ {children}+ </EnvelopeRenderContext.Provider>+ );+};diff --git a/packages/lib/constants/teams.ts b/packages/lib/constants/teams.tsindex 3a2fecbc1..8d7ffb768 100644--- a/packages/lib/constants/teams.ts+++ b/packages/lib/constants/teams.ts@@ -1,4 +1,4 @@-import { OrganisationGroupType, TeamMemberRole } from '@prisma/client';+import { DocumentVisibility, OrganisationGroupType, TeamMemberRole } from '@prisma/client';export const TEAM_URL_ROOT_REGEX = new RegExp('^/t/[^/]+/?$');export const TEAM_URL_REGEX = new RegExp('^/t/[^/]+');@@ -33,6 +33,16 @@ export const TEAM_MEMBER_ROLE_PERMISSIONS_MAP = {MANAGE_TEAM: [TeamMemberRole.ADMIN, TeamMemberRole.MANAGER],} satisfies Record<string, TeamMemberRole[]>;+export const TEAM_DOCUMENT_VISIBILITY_MAP = {+ [TeamMemberRole.ADMIN]: [+ DocumentVisibility.ADMIN,+ DocumentVisibility.MANAGER_AND_ABOVE,+ DocumentVisibility.EVERYONE,+ ],+ [TeamMemberRole.MANAGER]: [DocumentVisibility.MANAGER_AND_ABOVE, DocumentVisibility.EVERYONE],+ [TeamMemberRole.MEMBER]: [DocumentVisibility.EVERYONE],+} satisfies Record<TeamMemberRole, DocumentVisibility[]>;+/*** A hierarchy of team member roles to determine which role has higher permission than another.*diff --git a/packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.ts b/packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsindex c17d7fc48..35beaee67 100644--- a/packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.ts+++ b/packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.ts@@ -1,7 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';-import { ReadStatus, SendStatus, SigningStatus } from '@prisma/client';+import { EnvelopeType, ReadStatus, SendStatus, SigningStatus } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import DocumentCancelTemplate from '@documenso/email/templates/document-cancel';@@ -11,6 +11,7 @@ import { getI18nInstance } from '../../../client-only/providers/i18n-server';import { NEXT_PUBLIC_WEBAPP_URL } from '../../../constants/app';import { getEmailContext } from '../../../server-only/email/get-email-context';import { extractDerivedDocumentEmailSettings } from '../../../types/document-email';+import { unsafeBuildEnvelopeIdQuery } from '../../../utils/envelope';import { renderEmailWithI18N } from '../../../utils/render-email-with-i18n';import type { JobRunIO } from '../../client/_internal/job';import type { TSendDocumentCancelledEmailsJobDefinition } from './send-document-cancelled-emails';@@ -24,10 +25,14 @@ export const run = async ({}) => {const { documentId, cancellationReason } = payload;- const document = await prisma.document.findFirstOrThrow({- where: {- id: documentId,- },+ const envelope = await prisma.envelope.findFirstOrThrow({+ where: unsafeBuildEnvelopeIdQuery(+ {+ type: 'documentId',+ id: documentId,+ },+ EnvelopeType.DOCUMENT,+ ),include: {user: {select: {@@ -52,12 +57,12 @@ export const run = async ({emailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});- const { documentMeta, user: documentOwner } = document;+ const { documentMeta, user: documentOwner } = envelope;// Check if document cancellation emails are enabledconst isEmailEnabled = extractDerivedDocumentEmailSettings(documentMeta).documentDeleted;@@ -69,7 +74,7 @@ export const run = async ({const i18n = await getI18nInstance(emailLanguage);// Send cancellation emails to all recipients who have been sent the document or viewed it- const recipientsToNotify = document.recipients.filter(+ const recipientsToNotify = envelope.recipients.filter((recipient) =>(recipient.sendStatus === SendStatus.SENT || recipient.readStatus === ReadStatus.OPENED) &&recipient.signingStatus !== SigningStatus.REJECTED,@@ -79,7 +84,7 @@ export const run = async ({await Promise.all(recipientsToNotify.map(async (recipient) => {const template = createElement(DocumentCancelTemplate, {- documentName: document.title,+ documentName: envelope.title,inviterName: documentOwner.name || undefined,inviterEmail: documentOwner.email,assetBaseUrl: NEXT_PUBLIC_WEBAPP_URL(),@@ -102,7 +107,7 @@ export const run = async ({},from: senderEmail,replyTo: replyToEmail,- subject: i18n._(msg`Document "${document.title}" Cancelled`),+ subject: i18n._(msg`Document "${envelope.title}" Cancelled`),html,text,});diff --git a/packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.ts b/packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsindex 7f201f0ef..66791ee29 100644--- a/packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.ts+++ b/packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.ts@@ -1,6 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';+import { EnvelopeType } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import { DocumentRecipientSignedEmailTemplate } from '@documenso/email/templates/document-recipient-signed';@@ -10,6 +11,7 @@ import { getI18nInstance } from '../../../client-only/providers/i18n-server';import { NEXT_PUBLIC_WEBAPP_URL } from '../../../constants/app';import { getEmailContext } from '../../../server-only/email/get-email-context';import { extractDerivedDocumentEmailSettings } from '../../../types/document-email';+import { unsafeBuildEnvelopeIdQuery } from '../../../utils/envelope';import { renderEmailWithI18N } from '../../../utils/render-email-with-i18n';import type { JobRunIO } from '../../client/_internal/job';import type { TSendRecipientSignedEmailJobDefinition } from './send-recipient-signed-email';@@ -23,9 +25,15 @@ export const run = async ({}) => {const { documentId, recipientId } = payload;- const document = await prisma.document.findFirst({+ const envelope = await prisma.envelope.findFirst({where: {- id: documentId,+ ...unsafeBuildEnvelopeIdQuery(+ {+ type: 'documentId',+ id: documentId,+ },+ EnvelopeType.DOCUMENT,+ ),recipients: {some: {id: recipientId,@@ -49,25 +57,25 @@ export const run = async ({},});- if (!document) {+ if (!envelope) {throw new Error('Document not found');}- if (document.recipients.length === 0) {+ if (envelope.recipients.length === 0) {throw new Error('Document has no recipients');}const isRecipientSignedEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientSigned;if (!isRecipientSignedEmailEnabled) {return;}- const [recipient] = document.recipients;+ const [recipient] = envelope.recipients;const { email: recipientEmail, name: recipientName } = recipient;- const { user: owner } = document;+ const { user: owner } = envelope;const recipientReference = recipientName || recipientEmail;@@ -80,9 +88,9 @@ export const run = async ({emailType: 'INTERNAL',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';@@ -90,7 +98,7 @@ export const run = async ({const i18n = await getI18nInstance(emailLanguage);const template = createElement(DocumentRecipientSignedEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,recipientName,recipientEmail,assetBaseUrl,@@ -112,7 +120,7 @@ export const run = async ({address: owner.email,},from: senderEmail,- subject: i18n._(msg`${recipientReference} has signed "${document.title}"`),+ subject: i18n._(msg`${recipientReference} has signed "${envelope.title}"`),html,text,});diff --git a/packages/lib/jobs/definitions/emails/send-rejection-emails.handler.ts b/packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsindex f162ca134..25ee6402e 100644--- a/packages/lib/jobs/definitions/emails/send-rejection-emails.handler.ts+++ b/packages/lib/jobs/definitions/emails/send-rejection-emails.handler.ts@@ -1,7 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';-import { SendStatus, SigningStatus } from '@prisma/client';+import { EnvelopeType, SendStatus, SigningStatus } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import DocumentRejectedEmail from '@documenso/email/templates/document-rejected';@@ -13,6 +13,7 @@ import { NEXT_PUBLIC_WEBAPP_URL } from '../../../constants/app';import { DOCUMENSO_INTERNAL_EMAIL } from '../../../constants/email';import { getEmailContext } from '../../../server-only/email/get-email-context';import { extractDerivedDocumentEmailSettings } from '../../../types/document-email';+import { unsafeBuildEnvelopeIdQuery } from '../../../utils/envelope';import { renderEmailWithI18N } from '../../../utils/render-email-with-i18n';import { formatDocumentsPath } from '../../../utils/teams';import type { JobRunIO } from '../../client/_internal/job';@@ -27,11 +28,15 @@ export const run = async ({}) => {const { documentId, recipientId } = payload;- const [document, recipient] = await Promise.all([- prisma.document.findFirstOrThrow({- where: {- id: documentId,- },+ const [envelope, recipient] = await Promise.all([+ prisma.envelope.findFirstOrThrow({+ where: unsafeBuildEnvelopeIdQuery(+ {+ type: 'documentId',+ id: documentId,+ },+ EnvelopeType.DOCUMENT,+ ),include: {user: {select: {@@ -58,10 +63,10 @@ export const run = async ({}),]);- const { user: documentOwner } = document;+ const { user: documentOwner } = envelope;const isEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientSigningRequest;if (!isEmailEnabled) {@@ -72,9 +77,9 @@ export const run = async ({emailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});const i18n = await getI18nInstance(emailLanguage);@@ -83,8 +88,8 @@ export const run = async ({await io.runTask('send-rejection-confirmation-email', async () => {const recipientTemplate = createElement(DocumentRejectionConfirmedEmail, {recipientName: recipient.name,- documentName: document.title,- documentOwnerName: document.user.name || document.user.email,+ documentName: envelope.title,+ documentOwnerName: envelope.user.name || envelope.user.email,reason: recipient.rejectionReason || '',assetBaseUrl: NEXT_PUBLIC_WEBAPP_URL(),});@@ -105,7 +110,7 @@ export const run = async ({},from: senderEmail,replyTo: replyToEmail,- subject: i18n._(msg`Document "${document.title}" - Rejection Confirmed`),+ subject: i18n._(msg`Document "${envelope.title}" - Rejection Confirmed`),html,text,});@@ -115,9 +120,9 @@ export const run = async ({await io.runTask('send-owner-notification-email', async () => {const ownerTemplate = createElement(DocumentRejectedEmail, {recipientName: recipient.name,- documentName: document.title,- documentUrl: `${NEXT_PUBLIC_WEBAPP_URL()}${formatDocumentsPath(document.team?.url)}/${- document.id+ documentName: envelope.title,+ documentUrl: `${NEXT_PUBLIC_WEBAPP_URL()}${formatDocumentsPath(envelope.team?.url)}/${+ envelope.id}`,rejectionReason: recipient.rejectionReason || '',assetBaseUrl: NEXT_PUBLIC_WEBAPP_URL(),@@ -138,7 +143,7 @@ export const run = async ({address: documentOwner.email,},from: DOCUMENSO_INTERNAL_EMAIL, // Purposefully using internal email here.- subject: i18n._(msg`Document "${document.title}" - Rejected by ${recipient.name}`),+ subject: i18n._(msg`Document "${envelope.title}" - Rejected by ${recipient.name}`),html,text,});diff --git a/packages/lib/jobs/definitions/emails/send-signing-email.handler.ts b/packages/lib/jobs/definitions/emails/send-signing-email.handler.tsindex 7d62ed1d2..58b9b1f80 100644--- a/packages/lib/jobs/definitions/emails/send-signing-email.handler.ts+++ b/packages/lib/jobs/definitions/emails/send-signing-email.handler.ts@@ -4,6 +4,7 @@ import { msg } from '@lingui/core/macro';import {DocumentSource,DocumentStatus,+ EnvelopeType,OrganisationType,RecipientRole,SendStatus,@@ -23,6 +24,7 @@ import { getEmailContext } from '../../../server-only/email/get-email-context';import { DOCUMENT_AUDIT_LOG_TYPE } from '../../../types/document-audit-logs';import { extractDerivedDocumentEmailSettings } from '../../../types/document-email';import { createDocumentAuditLogData } from '../../../utils/document-audit-logs';+import { unsafeBuildEnvelopeIdQuery } from '../../../utils/envelope';import { renderCustomEmailTemplate } from '../../../utils/render-custom-email-template';import { renderEmailWithI18N } from '../../../utils/render-email-with-i18n';import type { JobRunIO } from '../../client/_internal/job';@@ -37,7 +39,7 @@ export const run = async ({}) => {const { userId, documentId, recipientId, requestMetadata } = payload;- const [user, document, recipient] = await Promise.all([+ const [user, envelope, recipient] = await Promise.all([prisma.user.findFirstOrThrow({where: {id: userId,@@ -48,9 +50,15 @@ export const run = async ({name: true,},}),- prisma.document.findFirstOrThrow({+ prisma.envelope.findFirstOrThrow({where: {- id: documentId,+ ...unsafeBuildEnvelopeIdQuery(+ {+ type: 'documentId',+ id: documentId,+ },+ EnvelopeType.DOCUMENT,+ ),status: DocumentStatus.PENDING,},include: {@@ -70,14 +78,14 @@ export const run = async ({}),]);- const { documentMeta, team } = document;+ const { documentMeta, team } = envelope;if (recipient.role === RecipientRole.CC) {return;}const isRecipientSigningRequestEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientSigningRequest;if (!isRecipientSigningRequestEmailEnabled) {@@ -89,13 +97,13 @@ export const run = async ({emailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});- const customEmail = document?.documentMeta;- const isDirectTemplate = document.source === DocumentSource.TEMPLATE_DIRECT_LINK;+ const customEmail = envelope?.documentMeta;+ const isDirectTemplate = envelope.source === DocumentSource.TEMPLATE_DIRECT_LINK;const recipientEmailType = RECIPIENT_ROLE_TO_EMAIL_TYPE[recipient.role];@@ -113,7 +121,7 @@ export const run = async ({if (selfSigner) {emailMessage = i18n._(- msg`You have initiated the document ${`"${document.title}"`} that requires you to ${recipientActionVerb} it.`,+ msg`You have initiated the document ${`"${envelope.title}"`} that requires you to ${recipientActionVerb} it.`,);emailSubject = i18n._(msg`Please ${recipientActionVerb} your document`);}@@ -136,8 +144,8 @@ export const run = async ({emailMessage = i18n._(settings.includeSenderDetails- ? msg`${inviterName} on behalf of "${team.name}" has invited you to ${recipientActionVerb} the document "${document.title}".`- : msg`${team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`,+ ? msg`${inviterName} on behalf of "${team.name}" has invited you to ${recipientActionVerb} the document "${envelope.title}".`+ : msg`${team.name} has invited you to ${recipientActionVerb} the document "${envelope.title}".`,);}}@@ -145,14 +153,14 @@ export const run = async ({const customEmailTemplate = {'signer.name': name,'signer.email': email,- 'document.name': document.title,+ 'document.name': envelope.title,};const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const signDocumentLink = `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`;const template = createElement(DocumentInviteEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,inviterName: user.name || undefined,inviterEmail:organisationType === OrganisationType.ORGANISATION@@ -210,7 +218,7 @@ export const run = async ({await prisma.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,- documentId: document.id,+ envelopeId: envelope.id,user,requestMetadata,data: {diff --git a/packages/lib/jobs/definitions/internal/bulk-send-template.handler.ts b/packages/lib/jobs/definitions/internal/bulk-send-template.handler.tsindex 98e6daba9..f7fc5b3f7 100644--- a/packages/lib/jobs/definitions/internal/bulk-send-template.handler.ts+++ b/packages/lib/jobs/definitions/internal/bulk-send-template.handler.ts@@ -37,7 +37,10 @@ export const run = async ({const { userId, teamId, templateId, csvContent, sendImmediately, requestMetadata } = payload;const template = await getTemplateById({- id: templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },userId,teamId,});@@ -99,9 +102,12 @@ export const run = async ({}}- const document = await io.runTask(`create-document-${rowIndex}`, async () => {+ const envelope = await io.runTask(`create-document-${rowIndex}`, async () => {return await createDocumentFromTemplate({- templateId: template.id,+ id: {+ type: 'templateId',+ id: template.id,+ },userId,teamId,recipients: recipients.map((recipient, index) => {@@ -124,7 +130,10 @@ export const run = async ({if (sendImmediately) {await io.runTask(`send-document-${rowIndex}`, async () => {await sendDocument({- documentId: document.id,+ id: {+ type: 'envelopeId',+ id: envelope.id,+ },userId,teamId,requestMetadata: {diff --git a/packages/lib/jobs/definitions/internal/seal-document.handler.ts b/packages/lib/jobs/definitions/internal/seal-document.handler.tsindex 8ee0382ba..f6ebb6672 100644--- a/packages/lib/jobs/definitions/internal/seal-document.handler.ts+++ b/packages/lib/jobs/definitions/internal/seal-document.handler.ts@@ -1,7 +1,14 @@-import { DocumentStatus, RecipientRole, SigningStatus, WebhookTriggerEvents } from '@prisma/client';+import { PDFDocument } from '@cantoo/pdf-lib';+import type { DocumentData, DocumentMeta, Envelope, EnvelopeItem, Field } from '@prisma/client';+import {+ DocumentStatus,+ EnvelopeType,+ RecipientRole,+ SigningStatus,+ WebhookTriggerEvents,+} from '@prisma/client';import { nanoid } from 'nanoid';import path from 'node:path';-import { PDFDocument } from 'pdf-lib';import { prisma } from '@documenso/prisma';import { signPdf } from '@documenso/signing';@@ -14,7 +21,8 @@ import { getCertificatePdf } from '../../../server-only/htmltopdf/get-certificatimport { addRejectionStampToPdf } from '../../../server-only/pdf/add-rejection-stamp-to-pdf';import { flattenAnnotations } from '../../../server-only/pdf/flatten-annotations';import { flattenForm } from '../../../server-only/pdf/flatten-form';-import { insertFieldInPDF } from '../../../server-only/pdf/insert-field-in-pdf';+import { insertFieldInPDFV1 } from '../../../server-only/pdf/insert-field-in-pdf-v1';+import { insertFieldInPDFV2 } from '../../../server-only/pdf/insert-field-in-pdf-v2';import { legacy_insertFieldInPDF } from '../../../server-only/pdf/legacy-insert-field-in-pdf';import { normalizeSignatureAppearances } from '../../../server-only/pdf/normalize-signature-appearances';import { getTeamSettings } from '../../../server-only/team/get-team-settings';@@ -22,7 +30,7 @@ import { triggerWebhook } from '../../../server-only/webhooks/trigger/trigger-weimport { DOCUMENT_AUDIT_LOG_TYPE } from '../../../types/document-audit-logs';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../../types/webhook-payload';import { prefixedId } from '../../../universal/id';import { getFileServerSide } from '../../../universal/upload/get-file.server';@@ -30,6 +38,7 @@ import { putPdfFileServerSide } from '../../../universal/upload/put-file.server'import { fieldsContainUnsignedRequiredField } from '../../../utils/advanced-fields-helpers';import { isDocumentCompleted } from '../../../utils/document';import { createDocumentAuditLogData } from '../../../utils/document-audit-logs';+import { mapDocumentIdToSecondaryId, mapSecondaryIdToDocumentId } from '../../../utils/envelope';import type { JobRunIO } from '../../client/_internal/job';import type { TSealDocumentJobDefinition } from './seal-document';@@ -42,24 +51,39 @@ export const run = async ({}) => {const { documentId, sendEmail = true, isResealing = false, requestMetadata } = payload;- const document = await prisma.document.findFirstOrThrow({+ const envelope = await prisma.envelope.findFirstOrThrow({where: {- id: documentId,+ type: EnvelopeType.DOCUMENT,+ secondaryId: mapDocumentIdToSecondaryId(documentId),},include: {documentMeta: true,recipients: true,+ envelopeItems: {+ include: {+ documentData: true,+ field: {+ include: {+ signature: true,+ },+ },+ },+ },},});+ if (envelope.envelopeItems.length === 0) {+ throw new Error('At least one envelope item required');+ }+const settings = await getTeamSettings({- userId: document.userId,- teamId: document.teamId,+ userId: envelope.userId,+ teamId: envelope.teamId,});const isComplete =- document.recipients.some((recipient) => recipient.signingStatus === SigningStatus.REJECTED) ||- document.recipients.every((recipient) => recipient.signingStatus === SigningStatus.SIGNED);+ envelope.recipients.some((recipient) => recipient.signingStatus === SigningStatus.REJECTED) ||+ envelope.recipients.every((recipient) => recipient.signingStatus === SigningStatus.SIGNED);if (!isComplete) {throw new AppError(AppErrorCode.UNKNOWN_ERROR, {@@ -71,28 +95,28 @@ export const run = async ({// after it has already run through the update task further below.// eslint-disable-next-line @typescript-eslint/require-awaitconst documentStatus = await io.runTask('get-document-status', async () => {- return document.status;+ return envelope.status;});// This is the same case as above.- // eslint-disable-next-line @typescript-eslint/require-await- const documentDataId = await io.runTask('get-document-data-id', async () => {- return document.documentDataId;- });-- const documentData = await prisma.documentData.findFirst({- where: {- id: documentDataId,+ let envelopeItems = await io.runTask(+ 'get-document-data-id',+ // eslint-disable-next-line @typescript-eslint/require-await+ async () => {+ // eslint-disable-next-line unused-imports/no-unused-vars+ return envelope.envelopeItems.map(({ field, ...rest }) => ({+ ...rest,+ }));},- });+ );- if (!documentData) {- throw new Error(`Document ${document.id} has no document data`);+ if (envelopeItems.length < 1) {+ throw new Error(`Document ${envelope.id} has no envelope items`);}const recipients = await prisma.recipient.findMany({where: {- documentId: document.id,+ envelopeId: envelope.id,role: {not: RecipientRole.CC,},@@ -111,7 +135,7 @@ export const run = async ({const fields = await prisma.field.findMany({where: {- documentId: document.id,+ envelopeId: envelope.id,},include: {signature: true,@@ -120,19 +144,25 @@ export const run = async ({// Skip the field check if the document is rejectedif (!isRejected && fieldsContainUnsignedRequiredField(fields)) {- throw new Error(`Document ${document.id} has unsigned required fields`);+ throw new Error(`Document ${envelope.id} has unsigned required fields`);}if (isResealing) {// If we're resealing we want to use the initial data for the document// so we aren't placing fields on top of eachother.- documentData.data = documentData.initialData;+ envelopeItems = envelopeItems.map((envelopeItem) => ({+ ...envelopeItem,+ documentData: {+ ...envelopeItem.documentData,+ data: envelopeItem.documentData.initialData,+ },+ }));}- if (!document.qrToken) {- await prisma.document.update({+ if (!envelope.qrToken) {+ await prisma.envelope.update({where: {- id: document.id,+ id: envelope.id,},data: {qrToken: prefixedId('qr'),@@ -140,97 +170,38 @@ export const run = async ({});}- const pdfData = await getFileServerSide(documentData);-- const certificateData = settings.includeSigningCertificate- ? await getCertificatePdf({- documentId,- language: document.documentMeta?.language,- }).catch((e) => {- console.log('Failed to get certificate PDF');- console.error(e);-- return null;- })- : null;-- const auditLogData = settings.includeAuditLog- ? await getAuditLogsPdf({- documentId,- language: document.documentMeta?.language,- }).catch((e) => {- console.log('Failed to get audit logs PDF');- console.error(e);-- return null;- })- : null;-- const newDataId = await io.runTask('decorate-and-sign-pdf', async () => {- const pdfDoc = await PDFDocument.load(pdfData);+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);- // Normalize and flatten layers that could cause issues with the signature- normalizeSignatureAppearances(pdfDoc);- await flattenForm(pdfDoc);- flattenAnnotations(pdfDoc);-- // Add rejection stamp if the document is rejected- if (isRejected && rejectionReason) {- await addRejectionStampToPdf(pdfDoc, rejectionReason);- }-- if (certificateData) {- const certificateDoc = await PDFDocument.load(certificateData);-- const certificatePages = await pdfDoc.copyPages(- certificateDoc,- certificateDoc.getPageIndices(),- );-- certificatePages.forEach((page) => {- pdfDoc.addPage(page);- });- }-- if (auditLogData) {- const auditLogDoc = await PDFDocument.load(auditLogData);-- const auditLogPages = await pdfDoc.copyPages(auditLogDoc, auditLogDoc.getPageIndices());-- auditLogPages.forEach((page) => {- pdfDoc.addPage(page);- });- }-- for (const field of fields) {- if (field.inserted) {- document.useLegacyFieldInsertion- ? await legacy_insertFieldInPDF(pdfDoc, field)- : await insertFieldInPDF(pdfDoc, field);- }- }-- // Re-flatten the form to handle our checkbox and radio fields that- // create native arcoFields- await flattenForm(pdfDoc);-- const pdfBytes = await pdfDoc.save();- const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });-- const { name } = path.parse(document.title);-- // Add suffix based on document status- const suffix = isRejected ? '_rejected.pdf' : '_signed.pdf';-- const documentData = await putPdfFileServerSide({- name: `${name}${suffix}`,- type: 'application/pdf',- arrayBuffer: async () => Promise.resolve(pdfBuffer),- });-- return documentData.id;+ const { certificateData, auditLogData } = await getCertificateAndAuditLogData({+ legacyDocumentId,+ documentMeta: envelope.documentMeta,+ settings,});+ const newDocumentData = await Promise.all(+ envelopeItems.map(async (envelopeItem) =>+ io.runTask('decorate-and-sign-pdf', async () => {+ const envelopeItemFields = envelope.envelopeItems.find(+ (item) => item.id === envelopeItem.id,+ )?.field;++ if (!envelopeItemFields) {+ throw new Error(`Envelope item fields not found for envelope item ${envelopeItem.id}`);+ }++ return decorateAndSignPdf({+ envelope,+ envelopeItem,+ envelopeItemFields,+ isRejected,+ rejectionReason,+ certificateData,+ auditLogData,+ });+ }),+ ),+ );+const postHog = PostHogServerClient();if (postHog) {@@ -238,7 +209,7 @@ export const run = async ({distinctId: nanoid(),event: 'App: Document Sealed',properties: {- documentId: document.id,+ documentId: envelope.id,isRejected,},});@@ -246,15 +217,26 @@ export const run = async ({await io.runTask('update-document', async () => {await prisma.$transaction(async (tx) => {- const newData = await tx.documentData.findFirstOrThrow({- where: {- id: newDataId,- },- });+ for (const { oldDocumentDataId, newDocumentDataId } of newDocumentData) {+ const newData = await tx.documentData.findFirstOrThrow({+ where: {+ id: newDocumentDataId,+ },+ });++ await tx.documentData.update({+ where: {+ id: oldDocumentDataId,+ },+ data: {+ data: newData.data,+ },+ });+ }- await tx.document.update({+ await tx.envelope.update({where: {- id: document.id,+ id: envelope.id,},data: {status: isRejected ? DocumentStatus.REJECTED : DocumentStatus.COMPLETED,@@ -262,19 +244,10 @@ export const run = async ({},});- await tx.documentData.update({- where: {- id: documentData.id,- },- data: {- data: newData.data,- },- });-await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_COMPLETED,- documentId: document.id,+ envelopeId: envelope.id,requestMetadata,user: null,data: {@@ -289,21 +262,23 @@ export const run = async ({await io.runTask('send-completed-email', async () => {let shouldSendCompletedEmail = sendEmail && !isResealing && !isRejected;- if (isResealing && !isDocumentCompleted(document.status)) {+ if (isResealing && !isDocumentCompleted(envelope.status)) {shouldSendCompletedEmail = sendEmail;}if (shouldSendCompletedEmail) {- await sendCompletedEmail({ documentId, requestMetadata });+ await sendCompletedEmail({+ id: { type: 'envelopeId', id: envelope.id },+ requestMetadata,+ });}});- const updatedDocument = await prisma.document.findFirstOrThrow({+ const updatedEnvelope = await prisma.envelope.findFirstOrThrow({where: {- id: document.id,+ id: envelope.id,},include: {- documentData: true,documentMeta: true,recipients: true,},@@ -313,8 +288,148 @@ export const run = async ({event: isRejected? WebhookTriggerEvents.DOCUMENT_REJECTED: WebhookTriggerEvents.DOCUMENT_COMPLETED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(updatedDocument)),- userId: updatedDocument.userId,- teamId: updatedDocument.teamId ?? undefined,+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(updatedEnvelope)),+ userId: updatedEnvelope.userId,+ teamId: updatedEnvelope.teamId ?? undefined,});};++type DecorateAndSignPdfOptions = {+ envelope: Pick<Envelope, 'id' | 'title' | 'useLegacyFieldInsertion' | 'internalVersion'>;+ envelopeItem: EnvelopeItem & { documentData: DocumentData };+ envelopeItemFields: Field[];+ isRejected: boolean;+ rejectionReason: string;+ certificateData: Buffer | null;+ auditLogData: Buffer | null;+};++/**+ * Fetch, normalize, flatten and insert fields into a PDF document.+ */+const decorateAndSignPdf = async ({+ envelope,+ envelopeItem,+ envelopeItemFields,+ isRejected,+ rejectionReason,+ certificateData,+ auditLogData,+}: DecorateAndSignPdfOptions) => {+ const pdfData = await getFileServerSide(envelopeItem.documentData);++ const pdfDoc = await PDFDocument.load(pdfData);++ // Normalize and flatten layers that could cause issues with the signature+ normalizeSignatureAppearances(pdfDoc);+ await flattenForm(pdfDoc);+ flattenAnnotations(pdfDoc);++ // Add rejection stamp if the document is rejected+ if (isRejected && rejectionReason) {+ await addRejectionStampToPdf(pdfDoc, rejectionReason);+ }++ if (certificateData) {+ const certificateDoc = await PDFDocument.load(certificateData);++ const certificatePages = await pdfDoc.copyPages(+ certificateDoc,+ certificateDoc.getPageIndices(),+ );++ certificatePages.forEach((page) => {+ pdfDoc.addPage(page);+ });+ }++ if (auditLogData) {+ const auditLogDoc = await PDFDocument.load(auditLogData);++ const auditLogPages = await pdfDoc.copyPages(auditLogDoc, auditLogDoc.getPageIndices());++ auditLogPages.forEach((page) => {+ pdfDoc.addPage(page);+ });+ }++ for (const field of envelopeItemFields) {+ if (field.inserted) {+ if (envelope.internalVersion === 2) {+ await insertFieldInPDFV2(pdfDoc, field);+ } else if (envelope.useLegacyFieldInsertion) {+ await legacy_insertFieldInPDF(pdfDoc, field);+ } else {+ await insertFieldInPDFV1(pdfDoc, field);+ }+ }+ }++ // Re-flatten the form to handle our checkbox and radio fields that+ // create native arcoFields+ await flattenForm(pdfDoc);++ const pdfBytes = await pdfDoc.save();++ const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });++ const { name } = path.parse(envelopeItem.title);++ // Add suffix based on document status+ const suffix = isRejected ? '_rejected.pdf' : '_signed.pdf';++ const newDocumentData = await putPdfFileServerSide({+ name: `${name}${suffix}`,+ type: 'application/pdf',+ arrayBuffer: async () => Promise.resolve(pdfBuffer),+ });++ return {+ oldDocumentDataId: envelopeItem.documentData.id,+ newDocumentDataId: newDocumentData.id,+ };+};++export const getCertificateAndAuditLogData = async ({+ legacyDocumentId,+ documentMeta,+ settings,+}: {+ legacyDocumentId: number;+ documentMeta: DocumentMeta;+ settings: { includeSigningCertificate: boolean; includeAuditLog: boolean };+}) => {+ const getCertificateDataPromise = settings.includeSigningCertificate+ ? getCertificatePdf({+ documentId: legacyDocumentId,+ language: documentMeta.language,+ }).catch((e) => {+ console.log('Failed to get certificate PDF');+ console.error(e);++ return null;+ })+ : null;++ const getAuditLogDataPromise = settings.includeAuditLog+ ? getAuditLogsPdf({+ documentId: legacyDocumentId,+ language: documentMeta.language,+ }).catch((e) => {+ console.log('Failed to get audit logs PDF');+ console.error(e);++ return null;+ })+ : null;++ const [certificateData, auditLogData] = await Promise.all([+ getCertificateDataPromise,+ getAuditLogDataPromise,+ ]);++ return {+ certificateData,+ auditLogData,+ };+};diff --git a/packages/lib/package.json b/packages/lib/package.jsonindex f422ec2f9..eaab3057b 100644--- a/packages/lib/package.json+++ b/packages/lib/package.json@@ -43,7 +43,6 @@"micro": "^10.0.1","nanoid": "^5.1.5","oslo": "^0.17.0",- "pdf-lib": "^1.17.1","pg": "^8.11.3","pino": "^9.7.0","pino-pretty": "^13.0.0",@@ -53,6 +52,7 @@"react": "^18","remeda": "^2.17.3","sharp": "0.32.6",+ "skia-canvas": "^3.0.8","stripe": "^12.7.0","ts-pattern": "^5.0.5","zod": "3.24.1"diff --git a/packages/lib/server-only/2fa/email/generate-2fa-credentials-from-email.ts b/packages/lib/server-only/2fa/email/generate-2fa-credentials-from-email.tsindex d379f854c..7e67b5eb0 100644--- a/packages/lib/server-only/2fa/email/generate-2fa-credentials-from-email.ts+++ b/packages/lib/server-only/2fa/email/generate-2fa-credentials-from-email.ts@@ -7,7 +7,7 @@ import { DOCUMENSO_ENCRYPTION_KEY } from '../../../constants/crypto';const ISSUER = 'Documenso Email 2FA';export type GenerateTwoFactorCredentialsFromEmailOptions = {- documentId: number;+ envelopeId: string;email: string;};@@ -18,14 +18,14 @@ export type GenerateTwoFactorCredentialsFromEmailOptions = {* @returns Object containing the token and the 6-digit code*/export const generateTwoFactorCredentialsFromEmail = ({- documentId,+ envelopeId,email,}: GenerateTwoFactorCredentialsFromEmailOptions) => {if (!DOCUMENSO_ENCRYPTION_KEY) {throw new Error('Missing DOCUMENSO_ENCRYPTION_KEY');}- const identity = `email-2fa|v1|email:${email}|id:${documentId}`;+ const identity = `email-2fa|v1|email:${email}|id:${envelopeId}`;const secret = hmac(sha256, DOCUMENSO_ENCRYPTION_KEY, identity);diff --git a/packages/lib/server-only/2fa/email/generate-2fa-token-from-email.ts b/packages/lib/server-only/2fa/email/generate-2fa-token-from-email.tsindex 9e5328291..f3ac4fdbd 100644--- a/packages/lib/server-only/2fa/email/generate-2fa-token-from-email.ts+++ b/packages/lib/server-only/2fa/email/generate-2fa-token-from-email.ts@@ -3,17 +3,17 @@ import { generateHOTP } from 'oslo/otp';import { generateTwoFactorCredentialsFromEmail } from './generate-2fa-credentials-from-email';export type GenerateTwoFactorTokenFromEmailOptions = {- documentId: number;+ envelopeId: string;email: string;period?: number;};export const generateTwoFactorTokenFromEmail = async ({email,- documentId,+ envelopeId,period = 30_000,}: GenerateTwoFactorTokenFromEmailOptions) => {- const { secret } = generateTwoFactorCredentialsFromEmail({ email, documentId });+ const { secret } = generateTwoFactorCredentialsFromEmail({ email, envelopeId });const counter = Math.floor(Date.now() / period);diff --git a/packages/lib/server-only/2fa/email/send-2fa-token-email.ts b/packages/lib/server-only/2fa/email/send-2fa-token-email.tsindex 64e52ab5c..6bbd96542 100644--- a/packages/lib/server-only/2fa/email/send-2fa-token-email.ts+++ b/packages/lib/server-only/2fa/email/send-2fa-token-email.ts@@ -1,6 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';+import { EnvelopeType } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import { AccessAuth2FAEmailTemplate } from '@documenso/email/templates/access-auth-2fa';@@ -11,6 +12,7 @@ import { NEXT_PUBLIC_WEBAPP_URL } from '../../../constants/app';import { AppError, AppErrorCode } from '../../../errors/app-error';import { DOCUMENT_AUDIT_LOG_TYPE } from '../../../types/document-audit-logs';import { createDocumentAuditLogData } from '../../../utils/document-audit-logs';+import { unsafeBuildEnvelopeIdQuery } from '../../../utils/envelope';import { renderEmailWithI18N } from '../../../utils/render-email-with-i18n';import { getEmailContext } from '../../email/get-email-context';import { TWO_FACTOR_EMAIL_EXPIRATION_MINUTES } from './constants';@@ -18,13 +20,19 @@ import { generateTwoFactorTokenFromEmail } from './generate-2fa-token-from-emailexport type Send2FATokenEmailOptions = {token: string;- documentId: number;+ envelopeId: string;};-export const send2FATokenEmail = async ({ token, documentId }: Send2FATokenEmailOptions) => {- const document = await prisma.document.findFirst({+export const send2FATokenEmail = async ({ token, envelopeId }: Send2FATokenEmailOptions) => {+ const envelope = await prisma.envelope.findFirst({where: {- id: documentId,+ ...unsafeBuildEnvelopeIdQuery(+ {+ type: 'envelopeId',+ id: envelopeId,+ },+ EnvelopeType.DOCUMENT,+ ),recipients: {some: {token,@@ -47,13 +55,13 @@ export const send2FATokenEmail = async ({ token, documentId }: Send2FATokenEmail},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- const [recipient] = document.recipients;+ const [recipient] = envelope.recipients;if (!recipient) {throw new AppError(AppErrorCode.NOT_FOUND, {@@ -62,7 +70,7 @@ export const send2FATokenEmail = async ({ token, documentId }: Send2FATokenEmail}const twoFactorTokenToken = await generateTwoFactorTokenFromEmail({- documentId,+ envelopeId,email: recipient.email,});@@ -70,9 +78,9 @@ export const send2FATokenEmail = async ({ token, documentId }: Send2FATokenEmailemailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});const i18n = await getI18nInstance(emailLanguage);@@ -80,7 +88,7 @@ export const send2FATokenEmail = async ({ token, documentId }: Send2FATokenEmailconst subject = i18n._(msg`Your two-factor authentication code`);const template = createElement(AccessAuth2FAEmailTemplate, {- documentTitle: document.title,+ documentTitle: envelope.title,userName: recipient.name,userEmail: recipient.email,code: twoFactorTokenToken,@@ -110,7 +118,7 @@ export const send2FATokenEmail = async ({ token, documentId }: Send2FATokenEmailawait tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_ACCESS_AUTH_2FA_REQUESTED,- documentId: document.id,+ envelopeId: envelope.id,data: {recipientEmail: recipient.email,recipientName: recipient.name,diff --git a/packages/lib/server-only/2fa/email/validate-2fa-token-from-email.ts b/packages/lib/server-only/2fa/email/validate-2fa-token-from-email.tsindex c278812ea..5388fd17e 100644--- a/packages/lib/server-only/2fa/email/validate-2fa-token-from-email.ts+++ b/packages/lib/server-only/2fa/email/validate-2fa-token-from-email.ts@@ -3,7 +3,7 @@ import { generateHOTP } from 'oslo/otp';import { generateTwoFactorCredentialsFromEmail } from './generate-2fa-credentials-from-email';export type ValidateTwoFactorTokenFromEmailOptions = {- documentId: number;+ envelopeId: string;email: string;code: string;period?: number;@@ -11,13 +11,13 @@ export type ValidateTwoFactorTokenFromEmailOptions = {};export const validateTwoFactorTokenFromEmail = async ({- documentId,+ envelopeId,email,code,period = 30_000,window = 1,}: ValidateTwoFactorTokenFromEmailOptions) => {- const { secret } = generateTwoFactorCredentialsFromEmail({ email, documentId });+ const { secret } = generateTwoFactorCredentialsFromEmail({ email, envelopeId });let now = Date.now();diff --git a/packages/lib/server-only/admin/admin-find-documents.ts b/packages/lib/server-only/admin/admin-find-documents.tsnew file mode 100644index 000000000..78f85b238--- /dev/null+++ b/packages/lib/server-only/admin/admin-find-documents.ts@@ -0,0 +1,98 @@+import { EnvelopeType, type Prisma } from '@prisma/client';++import { prisma } from '@documenso/prisma';++import type { FindResultResponse } from '../../types/search-params';++export interface AdminFindDocumentsOptions {+ query?: string;+ page?: number;+ perPage?: number;+}++export const adminFindDocuments = async ({+ query,+ page = 1,+ perPage = 10,+}: AdminFindDocumentsOptions) => {+ let termFilters: Prisma.EnvelopeWhereInput | undefined = !query+ ? undefined+ : {+ title: {+ contains: query,+ mode: 'insensitive',+ },+ };++ if (query && query.startsWith('envelope_')) {+ termFilters = {+ id: {+ equals: query,+ },+ };+ }++ if (query && query.startsWith('document_')) {+ termFilters = {+ secondaryId: {+ equals: query,+ },+ };+ }++ if (query) {+ const isQueryAnInteger = !isNaN(parseInt(query));++ if (isQueryAnInteger) {+ termFilters = {+ secondaryId: {+ equals: `document_${query}`,+ },+ };+ }+ }++ const [data, count] = await Promise.all([+ prisma.envelope.findMany({+ where: {+ type: EnvelopeType.DOCUMENT,+ ...termFilters,+ },+ skip: Math.max(page - 1, 0) * perPage,+ take: perPage,+ orderBy: {+ createdAt: 'desc',+ },+ include: {+ user: {+ select: {+ id: true,+ name: true,+ email: true,+ },+ },+ recipients: true,+ team: {+ select: {+ id: true,+ url: true,+ },+ },+ },+ }),+ prisma.envelope.count({+ where: {+ type: EnvelopeType.DOCUMENT,+ ...termFilters,+ },+ }),+ ]);++ return {+ data,+ count,+ currentPage: Math.max(page, 1),+ perPage,+ totalPages: Math.ceil(count / perPage),+ } satisfies FindResultResponse<typeof data>;+};diff --git a/packages/lib/server-only/document/super-delete-document.ts b/packages/lib/server-only/admin/admin-super-delete-document.tssimilarity index 81%rename from packages/lib/server-only/document/super-delete-document.tsrename to packages/lib/server-only/admin/admin-super-delete-document.tsindex ab6321c5e..8fe77bc7a 100644--- a/packages/lib/server-only/document/super-delete-document.ts+++ b/packages/lib/server-only/admin/admin-super-delete-document.ts@@ -17,15 +17,18 @@ import { createDocumentAuditLogData } from '../../utils/document-audit-logs';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { getEmailContext } from '../email/get-email-context';-export type SuperDeleteDocumentOptions = {- id: number;+export type AdminSuperDeleteDocumentOptions = {+ envelopeId: string;requestMetadata?: RequestMetadata;};-export const superDeleteDocument = async ({ id, requestMetadata }: SuperDeleteDocumentOptions) => {- const document = await prisma.document.findUnique({+export const adminSuperDeleteDocument = async ({+ envelopeId,+ requestMetadata,+}: AdminSuperDeleteDocumentOptions) => {+ const envelope = await prisma.envelope.findUnique({where: {- id,+ id: envelopeId,},include: {recipients: true,@@ -40,7 +43,7 @@ export const superDeleteDocument = async ({ id, requestMetadata }: SuperDeleteDo},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});@@ -50,38 +53,38 @@ export const superDeleteDocument = async ({ id, requestMetadata }: SuperDeleteDoemailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});- const { status, user } = document;+ const { status, user } = envelope;const isDocumentDeletedEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).documentDeleted;// if the document is pending, send cancellation emails to all recipientsif (status === DocumentStatus.PENDING &&- document.recipients.length > 0 &&+ envelope.recipients.length > 0 &&isDocumentDeletedEmailEnabled) {await Promise.all(- document.recipients.map(async (recipient) => {+ envelope.recipients.map(async (recipient) => {if (recipient.sendStatus !== SendStatus.SENT) {return;}const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const template = createElement(DocumentCancelTemplate, {- documentName: document.title,+ documentName: envelope.title,inviterName: user.name || undefined,inviterEmail: user.email,assetBaseUrl,});- const lang = document.documentMeta?.language ?? settings.documentLanguage;+ const lang = envelope.documentMeta?.language ?? settings.documentLanguage;const [html, text] = await Promise.all([renderEmailWithI18N(template, { lang, branding }),@@ -113,7 +116,7 @@ export const superDeleteDocument = async ({ id, requestMetadata }: SuperDeleteDoreturn await prisma.$transaction(async (tx) => {await tx.documentAuditLog.create({data: createDocumentAuditLogData({- documentId: id,+ envelopeId,type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_DELETED,user,requestMetadata,@@ -123,6 +126,6 @@ export const superDeleteDocument = async ({ id, requestMetadata }: SuperDeleteDo}),});- return await tx.document.delete({ where: { id } });+ return await tx.envelope.delete({ where: { id: envelopeId } });});};diff --git a/packages/lib/server-only/admin/get-all-documents.ts b/packages/lib/server-only/admin/get-all-documents.tsdeleted file mode 100644index d31dd6785..000000000--- a/packages/lib/server-only/admin/get-all-documents.ts+++ /dev/null@@ -1,58 +0,0 @@-import type { Prisma } from '@prisma/client';--import { prisma } from '@documenso/prisma';--import type { FindResultResponse } from '../../types/search-params';--export interface FindDocumentsOptions {- query?: string;- page?: number;- perPage?: number;-}--export const findDocuments = async ({ query, page = 1, perPage = 10 }: FindDocumentsOptions) => {- const termFilters: Prisma.DocumentWhereInput | undefined = !query- ? undefined- : {- title: {- contains: query,- mode: 'insensitive',- },- };-- const [data, count] = await Promise.all([- prisma.document.findMany({- where: {- ...termFilters,- },- skip: Math.max(page - 1, 0) * perPage,- take: perPage,- orderBy: {- createdAt: 'desc',- },- include: {- user: {- select: {- id: true,- name: true,- email: true,- },- },- recipients: true,- },- }),- prisma.document.count({- where: {- ...termFilters,- },- }),- ]);-- return {- data,- count,- currentPage: Math.max(page, 1),- perPage,- totalPages: Math.ceil(count / perPage),- } satisfies FindResultResponse<typeof data>;-};diff --git a/packages/lib/server-only/admin/get-documents-stats.ts b/packages/lib/server-only/admin/get-documents-stats.tsindex e91344f34..08e7bf93a 100644--- a/packages/lib/server-only/admin/get-documents-stats.ts+++ b/packages/lib/server-only/admin/get-documents-stats.ts@@ -1,8 +1,13 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-document-status';export const getDocumentStats = async () => {- const counts = await prisma.document.groupBy({+ const counts = await prisma.envelope.groupBy({+ where: {+ type: EnvelopeType.DOCUMENT,+ },by: ['status'],_count: {_all: true,diff --git a/packages/lib/server-only/admin/get-entire-document.ts b/packages/lib/server-only/admin/get-entire-document.tsindex c50bdb5c4..ea350a4b6 100644--- a/packages/lib/server-only/admin/get-entire-document.ts+++ b/packages/lib/server-only/admin/get-entire-document.ts@@ -1,14 +1,22 @@+import type { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';-export type GetEntireDocumentOptions = {- id: number;+import { AppError, AppErrorCode } from '../../errors/app-error';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';++export type unsafeGetEntireEnvelopeOptions = {+ id: EnvelopeIdOptions;+ type: EnvelopeType;};-export const getEntireDocument = async ({ id }: GetEntireDocumentOptions) => {- const document = await prisma.document.findFirstOrThrow({- where: {- id,- },+/**+ * An unauthenticated function that returns the whole envelope+ */+export const unsafeGetEntireEnvelope = async ({ id, type }: unsafeGetEntireEnvelopeOptions) => {+ const envelope = await prisma.envelope.findFirst({+ where: unsafeBuildEnvelopeIdQuery(id, type),include: {documentMeta: true,user: {@@ -30,5 +38,11 @@ export const getEntireDocument = async ({ id }: GetEntireDocumentOptions) => {},});- return document;+ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ return envelope;};diff --git a/packages/lib/server-only/admin/get-signing-volume.ts b/packages/lib/server-only/admin/get-signing-volume.tsindex 8ed734ecc..ce9352a92 100644--- a/packages/lib/server-only/admin/get-signing-volume.ts+++ b/packages/lib/server-only/admin/get-signing-volume.ts@@ -1,4 +1,4 @@-import { DocumentStatus, SubscriptionStatus } from '@prisma/client';+import { DocumentStatus, EnvelopeType, SubscriptionStatus } from '@prisma/client';import { kyselyPrisma, sql } from '@documenso/prisma';@@ -31,22 +31,23 @@ export async function getSigningVolume({.selectFrom('Subscription as s').innerJoin('Organisation as o', 's.organisationId', 'o.id').leftJoin('Team as t', 'o.id', 't.organisationId')- .leftJoin('Document as d', (join) =>+ .leftJoin('Envelope as e', (join) =>join- .onRef('t.id', '=', 'd.teamId')- .on('d.status', '=', sql.lit(DocumentStatus.COMPLETED))- .on('d.deletedAt', 'is', null),+ .onRef('t.id', '=', 'e.teamId')+ .on('e.status', '=', sql.lit(DocumentStatus.COMPLETED))+ .on('e.deletedAt', 'is', null),).where(sql`s.status = ${SubscriptionStatus.ACTIVE}::"SubscriptionStatus"`).where((eb) =>eb.or([eb('o.name', 'ilike', `%${search}%`), eb('t.name', 'ilike', `%${search}%`)]),)+ .where('e.type', '=', EnvelopeType.DOCUMENT).select(['s.id as id','s.createdAt as createdAt','s.planId as planId',sql<string>`COALESCE(o.name, 'Unknown')`.as('name'),- sql<number>`COUNT(DISTINCT d.id)`.as('signingVolume'),+ sql<number>`COUNT(DISTINCT e.id)`.as('signingVolume'),]).groupBy(['s.id', 'o.name']);diff --git a/packages/lib/server-only/admin/get-users-stats.ts b/packages/lib/server-only/admin/get-users-stats.tsindex a86d1f4e3..c866d67af 100644--- a/packages/lib/server-only/admin/get-users-stats.ts+++ b/packages/lib/server-only/admin/get-users-stats.ts@@ -32,12 +32,13 @@ type GetUserWithDocumentMonthlyGrowthQueryResult = Array<{export const getUserWithSignedDocumentMonthlyGrowth = async () => {const result = await prisma.$queryRaw<GetUserWithDocumentMonthlyGrowthQueryResult>`SELECT- DATE_TRUNC('month', "Document"."createdAt") AS "month",- COUNT(DISTINCT "Document"."userId") as "count",- COUNT(DISTINCT CASE WHEN "Document"."status" = 'COMPLETED' THEN "Document"."userId" END) as "signed_count"- FROM "Document"- INNER JOIN "Team" ON "Document"."teamId" = "Team"."id"+ DATE_TRUNC('month', "Envelope"."createdAt") AS "month",+ COUNT(DISTINCT "Envelope"."userId") as "count",+ COUNT(DISTINCT CASE WHEN "Envelope"."status" = 'COMPLETED' THEN "Envelope"."userId" END) as "signed_count"+ FROM "Envelope"+ INNER JOIN "Team" ON "Envelope"."teamId" = "Team"."id"INNER JOIN "Organisation" ON "Team"."organisationId" = "Organisation"."id"+ WHERE "Envelope"."type" = 'DOCUMENT'::"EnvelopeType"GROUP BY "month"ORDER BY "month" DESCLIMIT 12diff --git a/packages/lib/server-only/document-meta/upsert-document-meta.ts b/packages/lib/server-only/document-meta/upsert-document-meta.tsindex 08ceadcba..92949a307 100644--- a/packages/lib/server-only/document-meta/upsert-document-meta.ts+++ b/packages/lib/server-only/document-meta/upsert-document-meta.ts@@ -1,4 +1,8 @@-import type { DocumentDistributionMethod, DocumentSigningOrder } from '@prisma/client';+import {+ type DocumentDistributionMethod,+ type DocumentSigningOrder,+ EnvelopeType,+} from '@prisma/client';import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';@@ -11,16 +15,16 @@ import { prisma } from '@documenso/prisma';import type { SupportedLanguageCodes } from '../../constants/i18n';import { AppError, AppErrorCode } from '../../errors/app-error';import type { TDocumentEmailSettings } from '../../types/document-email';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type CreateDocumentMetaOptions = {userId: number;teamId: number;- documentId: number;+ id: EnvelopeIdOptions;subject?: string;message?: string;timezone?: string;- password?: string;dateFormat?: string;redirectUrl?: string;emailId?: string | null;@@ -36,15 +40,14 @@ export type CreateDocumentMetaOptions = {requestMetadata: ApiRequestMetadata;};-export const upsertDocumentMeta = async ({+export const updateDocumentMeta = async ({+ id,userId,teamId,subject,message,timezone,dateFormat,- documentId,- password,redirectUrl,signingOrder,allowDictateNextSigner,@@ -58,26 +61,27 @@ export const upsertDocumentMeta = async ({language,requestMetadata,}: CreateDocumentMetaOptions) => {- const { documentWhereInput, team } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput, team } = await getEnvelopeWhereInput({+ id,+ type: null, // Allow updating both documents and templates meta.userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {documentMeta: true,},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- const { documentMeta: originalDocumentMeta } = document;+ const { documentMeta: originalDocumentMeta } = envelope;// Validate the emailId belongs to the organisation.if (emailId) {@@ -96,33 +100,13 @@ export const upsertDocumentMeta = async ({}return await prisma.$transaction(async (tx) => {- const upsertedDocumentMeta = await tx.documentMeta.upsert({+ const upsertedDocumentMeta = await tx.documentMeta.update({where: {- documentId,- },- create: {- subject,- message,- password,- dateFormat,- timezone,- documentId,- redirectUrl,- signingOrder,- allowDictateNextSigner,- emailId,- emailReplyTo,- emailSettings,- distributionMethod,- typedSignatureEnabled,- uploadSignatureEnabled,- drawSignatureEnabled,- language,+ id: envelope.documentMetaId,},- update: {+ data: {subject,message,- password,dateFormat,timezone,redirectUrl,@@ -141,11 +125,12 @@ export const upsertDocumentMeta = async ({const changes = diffDocumentMetaChanges(originalDocumentMeta ?? {}, upsertedDocumentMeta);- if (changes.length > 0) {+ // Create audit logs only for document type envelopes.+ if (changes.length > 0 && envelope.type === EnvelopeType.DOCUMENT) {await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_META_UPDATED,- documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {changes: diffDocumentMetaChanges(originalDocumentMeta ?? {}, upsertedDocumentMeta),diff --git a/packages/lib/server-only/document/complete-document-with-token.ts b/packages/lib/server-only/document/complete-document-with-token.tsindex b143b2645..2b3a1d70d 100644--- a/packages/lib/server-only/document/complete-document-with-token.ts+++ b/packages/lib/server-only/document/complete-document-with-token.ts@@ -1,6 +1,7 @@import {DocumentSigningOrder,DocumentStatus,+ EnvelopeType,RecipientRole,SendStatus,SigningStatus,@@ -22,9 +23,11 @@ import type { TRecipientAccessAuth, TRecipientActionAuth } from '../../types/docimport { DocumentAuth } from '../../types/document-auth';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../types/webhook-payload';import { extractDocumentAuthMethods } from '../../utils/document-auth';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapSecondaryIdToDocumentId, unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';import { getIsRecipientsTurnToSign } from '../recipient/get-is-recipient-turn';import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';import { isRecipientAuthorized } from './is-recipient-authorized';@@ -32,7 +35,7 @@ import { sendPendingEmail } from './send-pending-email';export type CompleteDocumentWithTokenOptions = {token: string;- documentId: number;+ id: EnvelopeIdOptions;userId?: number;authOptions?: TRecipientActionAuth;accessAuthOptions?: TRecipientAccessAuth;@@ -43,10 +46,17 @@ export type CompleteDocumentWithTokenOptions = {};};-const getDocument = async ({ token, documentId }: CompleteDocumentWithTokenOptions) => {- return await prisma.document.findFirstOrThrow({+export const completeDocumentWithToken = async ({+ token,+ id,+ userId,+ accessAuthOptions,+ requestMetadata,+ nextSigner,+}: CompleteDocumentWithTokenOptions) => {+ const envelope = await prisma.envelope.findFirstOrThrow({where: {- id: documentId,+ ...unsafeBuildEnvelopeIdQuery(id, EnvelopeType.DOCUMENT),recipients: {some: {token,@@ -62,27 +72,18 @@ const getDocument = async ({ token, documentId }: CompleteDocumentWithTokenOptio},},});-};-export const completeDocumentWithToken = async ({- token,- documentId,- userId,- accessAuthOptions,- requestMetadata,- nextSigner,-}: CompleteDocumentWithTokenOptions) => {- const document = await getDocument({ token, documentId });+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);- if (document.status !== DocumentStatus.PENDING) {- throw new Error(`Document ${document.id} must be pending`);+ if (envelope.status !== DocumentStatus.PENDING) {+ throw new Error(`Document ${envelope.id} must be pending`);}- if (document.recipients.length === 0) {- throw new Error(`Document ${document.id} has no recipient with token ${token}`);+ if (envelope.recipients.length === 0) {+ throw new Error(`Document ${envelope.id} has no recipient with token ${token}`);}- const [recipient] = document.recipients;+ const [recipient] = envelope.recipients;if (recipient.signingStatus === SigningStatus.SIGNED) {throw new Error(`Recipient ${recipient.id} has already signed`);@@ -95,7 +96,7 @@ export const completeDocumentWithToken = async ({});}- if (document.documentMeta?.signingOrder === DocumentSigningOrder.SEQUENTIAL) {+ if (envelope.documentMeta?.signingOrder === DocumentSigningOrder.SEQUENTIAL) {const isRecipientsTurn = await getIsRecipientsTurnToSign({ token: recipient.token });if (!isRecipientsTurn) {@@ -107,7 +108,7 @@ export const completeDocumentWithToken = async ({const fields = await prisma.field.findMany({where: {- documentId: document.id,+ envelopeId: envelope.id,recipientId: recipient.id,},});@@ -118,7 +119,7 @@ export const completeDocumentWithToken = async ({// Check ACCESS AUTH 2FA validation during document completionconst { derivedRecipientAccessAuth } = extractDocumentAuthMethods({- documentAuth: document.authOptions,+ documentAuth: envelope.authOptions,recipientAuth: recipient.authOptions,});@@ -131,7 +132,7 @@ export const completeDocumentWithToken = async ({const isValid = await isRecipientAuthorized({type: 'ACCESS_2FA',- documentAuthOptions: document.authOptions,+ documentAuthOptions: envelope.authOptions,recipient: recipient,userId, // Can be undefined for non-account recipientsauthOptions: accessAuthOptions,@@ -141,7 +142,7 @@ export const completeDocumentWithToken = async ({await prisma.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_ACCESS_AUTH_2FA_FAILED,- documentId: document.id,+ envelopeId: envelope.id,data: {recipientId: recipient.id,recipientName: recipient.name,@@ -158,7 +159,7 @@ export const completeDocumentWithToken = async ({await prisma.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_ACCESS_AUTH_2FA_VALIDATED,- documentId: document.id,+ envelopeId: envelope.id,data: {recipientId: recipient.id,recipientName: recipient.name,@@ -180,14 +181,14 @@ export const completeDocumentWithToken = async ({});const authOptions = extractDocumentAuthMethods({- documentAuth: document.authOptions,+ documentAuth: envelope.authOptions,recipientAuth: recipient.authOptions,});await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_COMPLETED,- documentId: document.id,+ envelopeId: envelope.id,user: {name: recipient.name,email: recipient.email,@@ -207,7 +208,7 @@ export const completeDocumentWithToken = async ({await jobs.triggerJob({name: 'send.recipient.signed.email',payload: {- documentId: document.id,+ documentId: legacyDocumentId,recipientId: recipient.id,},});@@ -221,7 +222,7 @@ export const completeDocumentWithToken = async ({role: true,},where: {- documentId: document.id,+ envelopeId: envelope.id,signingStatus: {not: SigningStatus.SIGNED,},@@ -235,17 +236,17 @@ export const completeDocumentWithToken = async ({});if (pendingRecipients.length > 0) {- await sendPendingEmail({ documentId, recipientId: recipient.id });+ await sendPendingEmail({ id, recipientId: recipient.id });- if (document.documentMeta?.signingOrder === DocumentSigningOrder.SEQUENTIAL) {+ if (envelope.documentMeta?.signingOrder === DocumentSigningOrder.SEQUENTIAL) {const [nextRecipient] = pendingRecipients;await prisma.$transaction(async (tx) => {- if (nextSigner && document.documentMeta?.allowDictateNextSigner) {+ if (nextSigner && envelope.documentMeta?.allowDictateNextSigner) {await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_UPDATED,- documentId: document.id,+ envelopeId: envelope.id,user: {name: recipient.name,email: recipient.email,@@ -277,7 +278,7 @@ export const completeDocumentWithToken = async ({where: { id: nextRecipient.id },data: {sendStatus: SendStatus.SENT,- ...(nextSigner && document.documentMeta?.allowDictateNextSigner+ ...(nextSigner && envelope.documentMeta?.allowDictateNextSigner? {name: nextSigner.name,email: nextSigner.email,@@ -289,8 +290,8 @@ export const completeDocumentWithToken = async ({await jobs.triggerJob({name: 'send.signing.requested.email',payload: {- userId: document.userId,- documentId: document.id,+ userId: envelope.userId,+ documentId: legacyDocumentId,recipientId: nextRecipient.id,requestMetadata,},@@ -299,9 +300,9 @@ export const completeDocumentWithToken = async ({}}- const haveAllRecipientsSigned = await prisma.document.findFirst({+ const haveAllRecipientsSigned = await prisma.envelope.findFirst({where: {- id: document.id,+ id: envelope.id,recipients: {every: {OR: [{ signingStatus: SigningStatus.SIGNED }, { role: RecipientRole.CC }],@@ -314,15 +315,16 @@ export const completeDocumentWithToken = async ({await jobs.triggerJob({name: 'internal.seal-document',payload: {- documentId: document.id,+ documentId: legacyDocumentId,requestMetadata,},});}- const updatedDocument = await prisma.document.findFirstOrThrow({+ const updatedDocument = await prisma.envelope.findFirstOrThrow({where: {- id: document.id,+ id: envelope.id,+ type: EnvelopeType.DOCUMENT,},include: {documentMeta: true,@@ -332,7 +334,7 @@ export const completeDocumentWithToken = async ({await triggerWebhook({event: WebhookTriggerEvents.DOCUMENT_SIGNED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(updatedDocument)),+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(updatedDocument)),userId: updatedDocument.userId,teamId: updatedDocument.teamId ?? undefined,});diff --git a/packages/lib/server-only/document/create-document-v2.ts b/packages/lib/server-only/document/create-document-v2.tsdeleted file mode 100644index 4fe6103d8..000000000--- a/packages/lib/server-only/document/create-document-v2.ts+++ /dev/null@@ -1,278 +0,0 @@-import type { DocumentVisibility, TemplateMeta } from '@prisma/client';-import {- DocumentSource,- FolderType,- RecipientRole,- SendStatus,- SigningStatus,- WebhookTriggerEvents,-} from '@prisma/client';--import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { normalizePdf as makeNormalizedPdf } from '@documenso/lib/server-only/pdf/normalize-pdf';-import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';-import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';-import { nanoid, prefixedId } from '@documenso/lib/universal/id';-import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';-import { prisma } from '@documenso/prisma';-import type { TCreateDocumentTemporaryRequest } from '@documenso/trpc/server/document-router/create-document-temporary.types';--import type { TDocumentAccessAuthTypes, TDocumentActionAuthTypes } from '../../types/document-auth';-import type { TDocumentFormValues } from '../../types/document-form-values';-import {- ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,-} from '../../types/webhook-payload';-import { getFileServerSide } from '../../universal/upload/get-file.server';-import { putPdfFileServerSide } from '../../universal/upload/put-file.server';-import { extractDerivedDocumentMeta } from '../../utils/document';-import { createDocumentAuthOptions, createRecipientAuthOptions } from '../../utils/document-auth';-import { determineDocumentVisibility } from '../../utils/document-visibility';-import { buildTeamWhereQuery } from '../../utils/teams';-import { getMemberRoles } from '../team/get-member-roles';-import { getTeamSettings } from '../team/get-team-settings';-import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';--export type CreateDocumentOptions = {- userId: number;- teamId: number;- documentDataId: string;- normalizePdf?: boolean;- data: {- title: string;- externalId?: string;- visibility?: DocumentVisibility;- globalAccessAuth?: TDocumentAccessAuthTypes[];- globalActionAuth?: TDocumentActionAuthTypes[];- formValues?: TDocumentFormValues;- recipients: TCreateDocumentTemporaryRequest['recipients'];- folderId?: string;- };- meta?: Partial<Omit<TemplateMeta, 'id' | 'templateId'>>;- requestMetadata: ApiRequestMetadata;-};--export const createDocumentV2 = async ({- userId,- teamId,- documentDataId,- normalizePdf,- data,- meta,- requestMetadata,-}: CreateDocumentOptions) => {- const { title, formValues, folderId } = data;-- const team = await prisma.team.findFirst({- where: buildTeamWhereQuery({ teamId, userId }),- include: {- organisation: {- select: {- organisationClaim: true,- },- },- },- });-- if (!team) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Team not found',- });- }-- if (folderId) {- const folder = await prisma.folder.findUnique({- where: {- id: folderId,- type: FolderType.DOCUMENT,- team: buildTeamWhereQuery({ teamId, userId }),- },- });-- if (!folder) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }- }-- const settings = await getTeamSettings({- userId,- teamId,- });-- if (normalizePdf) {- const documentData = await prisma.documentData.findFirst({- where: {- id: documentDataId,- },- });-- if (documentData) {- const buffer = await getFileServerSide(documentData);-- const normalizedPdf = await makeNormalizedPdf(Buffer.from(buffer));-- const newDocumentData = await putPdfFileServerSide({- name: title.endsWith('.pdf') ? title : `${title}.pdf`,- type: 'application/pdf',- arrayBuffer: async () => Promise.resolve(normalizedPdf),- });-- // eslint-disable-next-line require-atomic-updates- documentDataId = newDocumentData.id;- }- }-- const authOptions = createDocumentAuthOptions({- globalAccessAuth: data?.globalAccessAuth || [],- globalActionAuth: data?.globalActionAuth || [],- });-- const recipientsHaveActionAuth = data.recipients?.some(- (recipient) => recipient.actionAuth && recipient.actionAuth.length > 0,- );-- // Check if user has permission to set the global action auth.- if (- (authOptions.globalActionAuth.length > 0 || recipientsHaveActionAuth) &&- !team.organisation.organisationClaim.flags.cfr21- ) {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'You do not have permission to set the action auth',- });- }-- const { teamRole } = await getMemberRoles({- teamId,- reference: {- type: 'User',- id: userId,- },- });-- const visibility = determineDocumentVisibility(settings.documentVisibility, teamRole);-- const emailId = meta?.emailId;-- // Validate that the email ID belongs to the organisation.- if (emailId) {- const email = await prisma.organisationEmail.findFirst({- where: {- id: emailId,- organisationId: team.organisationId,- },- });-- if (!email) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Email not found',- });- }- }-- return await prisma.$transaction(async (tx) => {- const document = await tx.document.create({- data: {- title,- qrToken: prefixedId('qr'),- externalId: data.externalId,- documentDataId,- userId,- teamId,- authOptions,- visibility,- folderId,- formValues,- source: DocumentSource.DOCUMENT,- documentMeta: {- create: extractDerivedDocumentMeta(settings, meta),- },- },- });-- await Promise.all(- (data.recipients || []).map(async (recipient) => {- const recipientAuthOptions = createRecipientAuthOptions({- accessAuth: recipient.accessAuth ?? [],- actionAuth: recipient.actionAuth ?? [],- });-- await tx.recipient.create({- data: {- documentId: document.id,- name: recipient.name,- email: recipient.email,- role: recipient.role,- signingOrder: recipient.signingOrder,- token: nanoid(),- sendStatus: recipient.role === RecipientRole.CC ? SendStatus.SENT : SendStatus.NOT_SENT,- signingStatus:- recipient.role === RecipientRole.CC ? SigningStatus.SIGNED : SigningStatus.NOT_SIGNED,- authOptions: recipientAuthOptions,- fields: {- createMany: {- data: (recipient.fields || []).map((field) => ({- documentId: document.id,- type: field.type,- page: field.pageNumber,- positionX: field.pageX,- positionY: field.pageY,- width: field.width,- height: field.height,- customText: '',- inserted: false,- fieldMeta: field.fieldMeta,- })),- },- },- },- });- }),- );-- // Todo: Is it necessary to create a full audit logs with all fields and recipients audit logs?-- await tx.documentAuditLog.create({- data: createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,- documentId: document.id,- metadata: requestMetadata,- data: {- title,- source: {- type: DocumentSource.DOCUMENT,- },- },- }),- });-- const createdDocument = await tx.document.findFirst({- where: {- id: document.id,- },- include: {- documentData: true,- documentMeta: true,- recipients: true,- fields: true,- folder: true,- },- });-- if (!createdDocument) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document not found',- });- }-- await triggerWebhook({- event: WebhookTriggerEvents.DOCUMENT_CREATED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(createdDocument)),- userId,- teamId,- });-- return createdDocument;- });-};diff --git a/packages/lib/server-only/document/create-document.ts b/packages/lib/server-only/document/create-document.tsdeleted file mode 100644index 1f1bab522..000000000--- a/packages/lib/server-only/document/create-document.ts+++ /dev/null@@ -1,171 +0,0 @@-import { DocumentSource, WebhookTriggerEvents } from '@prisma/client';-import type { DocumentVisibility } from '@prisma/client';--import { normalizePdf as makeNormalizedPdf } from '@documenso/lib/server-only/pdf/normalize-pdf';-import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';-import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';-import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';-import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import {- ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,-} from '../../types/webhook-payload';-import { prefixedId } from '../../universal/id';-import { getFileServerSide } from '../../universal/upload/get-file.server';-import { putPdfFileServerSide } from '../../universal/upload/put-file.server';-import { extractDerivedDocumentMeta } from '../../utils/document';-import { determineDocumentVisibility } from '../../utils/document-visibility';-import { buildTeamWhereQuery } from '../../utils/teams';-import { getTeamById } from '../team/get-team';-import { getTeamSettings } from '../team/get-team-settings';-import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';--export type CreateDocumentOptions = {- title: string;- externalId?: string | null;- userId: number;- teamId: number;- documentDataId: string;- formValues?: Record<string, string | number | boolean>;- normalizePdf?: boolean;- timezone?: string;- userTimezone?: string;- requestMetadata: ApiRequestMetadata;- folderId?: string;-};--export const createDocument = async ({- userId,- title,- externalId,- documentDataId,- teamId,- normalizePdf,- formValues,- requestMetadata,- timezone,- userTimezone,- folderId,-}: CreateDocumentOptions) => {- const team = await getTeamById({ userId, teamId });-- const settings = await getTeamSettings({- userId,- teamId,- });-- let folderVisibility: DocumentVisibility | undefined;-- if (folderId) {- const folder = await prisma.folder.findFirst({- where: {- id: folderId,- team: buildTeamWhereQuery({- teamId,- userId,- }),- },- select: {- visibility: true,- },- });-- if (!folder) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }-- folderVisibility = folder.visibility;- }-- if (normalizePdf) {- const documentData = await prisma.documentData.findFirst({- where: {- id: documentDataId,- },- });-- if (documentData) {- const buffer = await getFileServerSide(documentData);-- const normalizedPdf = await makeNormalizedPdf(Buffer.from(buffer));-- const newDocumentData = await putPdfFileServerSide({- name: title.endsWith('.pdf') ? title : `${title}.pdf`,- type: 'application/pdf',- arrayBuffer: async () => Promise.resolve(normalizedPdf),- });-- // eslint-disable-next-line require-atomic-updates- documentDataId = newDocumentData.id;- }- }-- // userTimezone is last because it's always passed in regardless of the organisation/team settings- // for uploads from the frontend- const timezoneToUse = timezone || settings.documentTimezone || userTimezone;-- return await prisma.$transaction(async (tx) => {- const document = await tx.document.create({- data: {- title,- qrToken: prefixedId('qr'),- externalId,- documentDataId,- userId,- teamId,- folderId,- visibility:- folderVisibility ??- determineDocumentVisibility(settings.documentVisibility, team.currentTeamRole),- formValues,- source: DocumentSource.DOCUMENT,- documentMeta: {- create: extractDerivedDocumentMeta(settings, {- timezone: timezoneToUse,- }),- },- },- });-- await tx.documentAuditLog.create({- data: createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,- documentId: document.id,- metadata: requestMetadata,- data: {- title,- source: {- type: DocumentSource.DOCUMENT,- },- },- }),- });-- const createdDocument = await tx.document.findFirst({- where: {- id: document.id,- },- include: {- documentMeta: true,- recipients: true,- },- });-- if (!createdDocument) {- throw new Error('Document not found');- }-- await triggerWebhook({- event: WebhookTriggerEvents.DOCUMENT_CREATED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(createdDocument)),- userId,- teamId,- });-- return createdDocument;- });-};diff --git a/packages/lib/server-only/document/delete-document.ts b/packages/lib/server-only/document/delete-document.tsindex 94c039311..72b910798 100644--- a/packages/lib/server-only/document/delete-document.ts+++ b/packages/lib/server-only/document/delete-document.ts@@ -1,8 +1,8 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';-import type { Document, DocumentMeta, Recipient, User } from '@prisma/client';-import { DocumentStatus, SendStatus, WebhookTriggerEvents } from '@prisma/client';+import type { DocumentMeta, Envelope, Recipient, User } from '@prisma/client';+import { DocumentStatus, EnvelopeType, SendStatus, WebhookTriggerEvents } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import DocumentCancelTemplate from '@documenso/email/templates/document-cancel';@@ -15,18 +15,19 @@ import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';import { extractDerivedDocumentEmailSettings } from '../../types/document-email';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../types/webhook-payload';import type { ApiRequestMetadata } from '../../universal/extract-request-metadata';import { isDocumentCompleted } from '../../utils/document';import { createDocumentAuditLogData } from '../../utils/document-audit-logs';+import { type EnvelopeIdOptions, unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { getEmailContext } from '../email/get-email-context';import { getMemberRoles } from '../team/get-member-roles';import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';export type DeleteDocumentOptions = {- id: number;+ id: EnvelopeIdOptions;userId: number;teamId: number;requestMetadata: ApiRequestMetadata;@@ -50,24 +51,23 @@ export const deleteDocument = async ({});}- const document = await prisma.document.findUnique({- where: {- id,- },+ // Note: This is an unsafe request, we validate the ownership later in the function.+ const envelope = await prisma.envelope.findUnique({+ where: unsafeBuildEnvelopeIdQuery(id, EnvelopeType.DOCUMENT),include: {recipients: true,documentMeta: true,},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}const isUserTeamMember = await getMemberRoles({- teamId: document.teamId,+ teamId: envelope.teamId,reference: {type: 'User',id: userId,@@ -76,8 +76,8 @@ export const deleteDocument = async ({.then(() => true).catch(() => false);- const isUserOwner = document.userId === userId;- const userRecipient = document.recipients.find((recipient) => recipient.email === user.email);+ const isUserOwner = envelope.userId === userId;+ const userRecipient = envelope.recipients.find((recipient) => recipient.email === user.email);if (!isUserOwner && !isUserTeamMember && !userRecipient) {throw new AppError(AppErrorCode.UNAUTHORIZED, {@@ -88,7 +88,7 @@ export const deleteDocument = async ({// Handle hard or soft deleting the actual document if user has permission.if (isUserOwner || isUserTeamMember) {await handleDocumentOwnerDelete({- document,+ envelope,user,requestMetadata,});@@ -113,27 +113,16 @@ export const deleteDocument = async ({await triggerWebhook({event: WebhookTriggerEvents.DOCUMENT_CANCELLED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(document)),+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(envelope)),userId,teamId,});- // Return partial document for API v1 response.- return {- id: document.id,- userId: document.userId,- teamId: document.teamId,- title: document.title,- status: document.status,- documentDataId: document.documentDataId,- createdAt: document.createdAt,- updatedAt: document.updatedAt,- completedAt: document.completedAt,- };+ return envelope;};type HandleDocumentOwnerDeleteOptions = {- document: Document & {+ envelope: Envelope & {recipients: Recipient[];documentMeta: DocumentMeta | null;};@@ -142,11 +131,11 @@ type HandleDocumentOwnerDeleteOptions = {};const handleDocumentOwnerDelete = async ({- document,+ envelope,user,requestMetadata,}: HandleDocumentOwnerDeleteOptions) => {- if (document.deletedAt) {+ if (envelope.deletedAt) {return;}@@ -154,17 +143,17 @@ const handleDocumentOwnerDelete = async ({emailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});// Soft delete completed documents.- if (isDocumentCompleted(document.status)) {+ if (isDocumentCompleted(envelope.status)) {return await prisma.$transaction(async (tx) => {await tx.documentAuditLog.create({data: createDocumentAuditLogData({- documentId: document.id,+ envelopeId: envelope.id,type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_DELETED,metadata: requestMetadata,data: {@@ -173,9 +162,9 @@ const handleDocumentOwnerDelete = async ({}),});- return await tx.document.update({+ return await tx.envelope.update({where: {- id: document.id,+ id: envelope.id,},data: {deletedAt: new Date().toISOString(),@@ -185,12 +174,12 @@ const handleDocumentOwnerDelete = async ({}// Hard delete draft and pending documents.- const deletedDocument = await prisma.$transaction(async (tx) => {+ const deletedEnvelope = await prisma.$transaction(async (tx) => {// Currently redundant since deleting a document will delete the audit logs.// However may be useful if we disassociate audit logs and documents if required.await tx.documentAuditLog.create({data: createDocumentAuditLogData({- documentId: document.id,+ envelopeId: envelope.id,type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_DELETED,metadata: requestMetadata,data: {@@ -199,9 +188,9 @@ const handleDocumentOwnerDelete = async ({}),});- return await tx.document.delete({+ return await tx.envelope.delete({where: {- id: document.id,+ id: envelope.id,status: {not: DocumentStatus.COMPLETED,},@@ -209,17 +198,17 @@ const handleDocumentOwnerDelete = async ({});});- const isDocumentDeleteEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ const isEnvelopeDeleteEmailEnabled = extractDerivedDocumentEmailSettings(+ envelope.documentMeta,).documentDeleted;- if (!isDocumentDeleteEmailEnabled) {- return deletedDocument;+ if (!isEnvelopeDeleteEmailEnabled) {+ return deletedEnvelope;}// Send cancellation emails to recipients.await Promise.all(- document.recipients.map(async (recipient) => {+ envelope.recipients.map(async (recipient) => {if (recipient.sendStatus !== SendStatus.SENT) {return;}@@ -227,7 +216,7 @@ const handleDocumentOwnerDelete = async ({const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const template = createElement(DocumentCancelTemplate, {- documentName: document.title,+ documentName: envelope.title,inviterName: user.name || undefined,inviterEmail: user.email,assetBaseUrl,@@ -258,5 +247,5 @@ const handleDocumentOwnerDelete = async ({}),);- return deletedDocument;+ return deletedEnvelope;};diff --git a/packages/lib/server-only/document/duplicate-document-by-id.ts b/packages/lib/server-only/document/duplicate-document-by-id.tsdeleted file mode 100644index 18d0b4ec6..000000000--- a/packages/lib/server-only/document/duplicate-document-by-id.ts+++ /dev/null@@ -1,152 +0,0 @@-import type { Prisma, Recipient } from '@prisma/client';-import { DocumentSource, WebhookTriggerEvents } from '@prisma/client';-import { omit } from 'remeda';--import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import {- ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,-} from '../../types/webhook-payload';-import { nanoid, prefixedId } from '../../universal/id';-import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';-import { getDocumentWhereInput } from './get-document-by-id';--export interface DuplicateDocumentOptions {- documentId: number;- userId: number;- teamId: number;-}--export const duplicateDocument = async ({- documentId,- userId,- teamId,-}: DuplicateDocumentOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,- userId,- teamId,- });-- const document = await prisma.document.findFirst({- where: documentWhereInput,- select: {- title: true,- userId: true,- documentData: {- select: {- data: true,- initialData: true,- type: true,- },- },- authOptions: true,- visibility: true,- documentMeta: true,- recipients: {- select: {- email: true,- name: true,- role: true,- signingOrder: true,- fields: true,- },- },- },- });-- if (!document) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document not found',- });- }-- const documentData = await prisma.documentData.create({- data: {- type: document.documentData.type,- data: document.documentData.initialData,- initialData: document.documentData.initialData,- },- });-- let documentMeta: Prisma.DocumentCreateArgs['data']['documentMeta'] | undefined = undefined;-- if (document.documentMeta) {- documentMeta = {- create: {- ...omit(document.documentMeta, ['id', 'documentId']),- emailSettings: document.documentMeta.emailSettings || undefined,- },- };- }-- const createdDocument = await prisma.document.create({- data: {- userId: document.userId,- teamId: teamId,- title: document.title,- documentDataId: documentData.id,- authOptions: document.authOptions || undefined,- visibility: document.visibility,- qrToken: prefixedId('qr'),- documentMeta,- source: DocumentSource.DOCUMENT,- },- include: {- recipients: true,- documentMeta: true,- },- });-- const recipientsToCreate = document.recipients.map((recipient) => ({- documentId: createdDocument.id,- email: recipient.email,- name: recipient.name,- role: recipient.role,- signingOrder: recipient.signingOrder,- token: nanoid(),- fields: {- createMany: {- data: recipient.fields.map((field) => ({- documentId: createdDocument.id,- type: field.type,- page: field.page,- positionX: field.positionX,- positionY: field.positionY,- width: field.width,- height: field.height,- customText: '',- inserted: false,- fieldMeta: field.fieldMeta as PrismaJson.FieldMeta,- })),- },- },- }));-- const recipients: Recipient[] = [];-- for (const recipientData of recipientsToCreate) {- const newRecipient = await prisma.recipient.create({- data: recipientData,- });-- recipients.push(newRecipient);- }-- await triggerWebhook({- event: WebhookTriggerEvents.DOCUMENT_CREATED,- data: ZWebhookDocumentSchema.parse({- ...mapDocumentToWebhookDocumentPayload(createdDocument),- recipients,- documentMeta: createdDocument.documentMeta,- }),- userId: userId,- teamId: teamId,- });-- return {- documentId: createdDocument.id,- };-};diff --git a/packages/lib/server-only/document/find-document-audit-logs.ts b/packages/lib/server-only/document/find-document-audit-logs.tsindex 0dc1fa305..6706efe21 100644--- a/packages/lib/server-only/document/find-document-audit-logs.ts+++ b/packages/lib/server-only/document/find-document-audit-logs.ts@@ -1,4 +1,4 @@-import type { DocumentAuditLog, Prisma } from '@prisma/client';+import { type DocumentAuditLog, EnvelopeType, type Prisma } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -6,7 +6,7 @@ import { AppError, AppErrorCode } from '../../errors/app-error';import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';import type { FindResultResponse } from '../../types/search-params';import { parseDocumentAuditLogData } from '../../utils/document-audit-logs';-import { getDocumentWhereInput } from './get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface FindDocumentAuditLogsOptions {userId: number;@@ -35,22 +35,26 @@ export const findDocumentAuditLogs = async ({const orderByColumn = orderBy?.column ?? 'createdAt';const orderByDirection = orderBy?.direction ?? 'desc';- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND);}const whereClause: Prisma.DocumentAuditLogWhereInput = {- documentId,+ envelopeId: envelope.id,};// Filter events down to what we consider recent activity.diff --git a/packages/lib/server-only/document/find-documents.ts b/packages/lib/server-only/document/find-documents.tsindex 97dd07582..d839c2f38 100644--- a/packages/lib/server-only/document/find-documents.ts+++ b/packages/lib/server-only/document/find-documents.ts@@ -1,5 +1,5 @@-import type { Document, DocumentSource, Prisma, Team, TeamEmail, User } from '@prisma/client';-import { RecipientRole, SigningStatus, TeamMemberRole } from '@prisma/client';+import type { DocumentSource, Envelope, Prisma, Team, TeamEmail, User } from '@prisma/client';+import { EnvelopeType, RecipientRole, SigningStatus, TeamMemberRole } from '@prisma/client';import { DateTime } from 'luxon';import { match } from 'ts-pattern';@@ -22,7 +22,7 @@ export type FindDocumentsOptions = {page?: number;perPage?: number;orderBy?: {- column: keyof Omit<Document, 'document'>;+ column: keyof Pick<Envelope, 'createdAt'>;direction: 'asc' | 'desc';};period?: PeriodSelectorValue;@@ -69,7 +69,7 @@ export const findDocuments = async ({const orderByDirection = orderBy?.direction ?? 'desc';const teamMemberRole = team?.currentTeamRole ?? null;- const searchFilter: Prisma.DocumentWhereInput = {+ const searchFilter: Prisma.EnvelopeWhereInput = {OR: [{ title: { contains: query, mode: 'insensitive' } },{ externalId: { contains: query, mode: 'insensitive' } },@@ -111,7 +111,7 @@ export const findDocuments = async ({},];- let filters: Prisma.DocumentWhereInput | null = findDocumentsFilter(status, user, folderId);+ let filters: Prisma.EnvelopeWhereInput | null = findDocumentsFilter(status, user, folderId);if (team) {filters = findTeamDocumentsFilter(status, team, visibilityFilters, folderId);@@ -127,7 +127,7 @@ export const findDocuments = async ({};}- let deletedFilter: Prisma.DocumentWhereInput = {+ let deletedFilter: Prisma.EnvelopeWhereInput = {AND: {OR: [{@@ -180,7 +180,7 @@ export const findDocuments = async ({};}- const whereAndClause: Prisma.DocumentWhereInput['AND'] = [+ const whereAndClause: Prisma.EnvelopeWhereInput['AND'] = [{ ...filters },{ ...deletedFilter },{ ...searchFilter },@@ -198,7 +198,8 @@ export const findDocuments = async ({});}- const whereClause: Prisma.DocumentWhereInput = {+ const whereClause: Prisma.EnvelopeWhereInput = {+ type: EnvelopeType.DOCUMENT,AND: whereAndClause,};@@ -225,7 +226,7 @@ export const findDocuments = async ({}const [data, count] = await Promise.all([- prisma.document.findMany({+ prisma.envelope.findMany({where: whereClause,skip: Math.max(page - 1, 0) * perPage,take: perPage,@@ -249,7 +250,7 @@ export const findDocuments = async ({},},}),- prisma.document.count({+ prisma.envelope.count({where: whereClause,}),]);@@ -275,7 +276,7 @@ const findDocumentsFilter = (user: Pick<User, 'id' | 'email' | 'name'>,folderId?: string | null,) => {- return match<ExtendedDocumentStatus, Prisma.DocumentWhereInput>(status)+ return match<ExtendedDocumentStatus, Prisma.EnvelopeWhereInput>(status).with(ExtendedDocumentStatus.ALL, () => ({OR: [{@@ -414,14 +415,14 @@ const findDocumentsFilter = (const findTeamDocumentsFilter = (status: ExtendedDocumentStatus,team: Team & { teamEmail: TeamEmail | null },- visibilityFilters: Prisma.DocumentWhereInput[],+ visibilityFilters: Prisma.EnvelopeWhereInput[],folderId?: string,) => {const teamEmail = team.teamEmail?.email ?? null;- return match<ExtendedDocumentStatus, Prisma.DocumentWhereInput | null>(status)+ return match<ExtendedDocumentStatus, Prisma.EnvelopeWhereInput | null>(status).with(ExtendedDocumentStatus.ALL, () => {- const filter: Prisma.DocumentWhereInput = {+ const filter: Prisma.EnvelopeWhereInput = {// Filter to display all documents that belong to the team.OR: [{@@ -483,7 +484,7 @@ const findTeamDocumentsFilter = (};}).with(ExtendedDocumentStatus.DRAFT, () => {- const filter: Prisma.DocumentWhereInput = {+ const filter: Prisma.EnvelopeWhereInput = {OR: [{teamId: team.id,@@ -508,7 +509,7 @@ const findTeamDocumentsFilter = (return filter;}).with(ExtendedDocumentStatus.PENDING, () => {- const filter: Prisma.DocumentWhereInput = {+ const filter: Prisma.EnvelopeWhereInput = {OR: [{teamId: team.id,@@ -550,7 +551,7 @@ const findTeamDocumentsFilter = (return filter;}).with(ExtendedDocumentStatus.COMPLETED, () => {- const filter: Prisma.DocumentWhereInput = {+ const filter: Prisma.EnvelopeWhereInput = {status: ExtendedDocumentStatus.COMPLETED,OR: [{@@ -582,7 +583,7 @@ const findTeamDocumentsFilter = (return filter;}).with(ExtendedDocumentStatus.REJECTED, () => {- const filter: Prisma.DocumentWhereInput = {+ const filter: Prisma.EnvelopeWhereInput = {status: ExtendedDocumentStatus.REJECTED,OR: [{diff --git a/packages/lib/server-only/document/get-document-by-access-token.ts b/packages/lib/server-only/document/get-document-by-access-token.tsindex e7ccdfbf8..444d7d678 100644--- a/packages/lib/server-only/document/get-document-by-access-token.ts+++ b/packages/lib/server-only/document/get-document-by-access-token.ts@@ -1,5 +1,9 @@+import { DocumentStatus, EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';+import { mapSecondaryIdToDocumentId } from '../../utils/envelope';+export type GetDocumentByAccessTokenOptions = {token: string;};@@ -9,30 +13,62 @@ export const getDocumentByAccessToken = async ({ token }: GetDocumentByAccessTokthrow new Error('Missing token');}- const result = await prisma.document.findFirstOrThrow({+ const result = await prisma.envelope.findFirstOrThrow({where: {+ type: EnvelopeType.DOCUMENT,+ status: DocumentStatus.COMPLETED,qrToken: token,},+ // Do not provide extra information that is not needed.select: {id: true,+ secondaryId: true,+ internalVersion: true,title: true,completedAt: true,- documentData: {+ team: {+ select: {+ url: true,+ },+ },+ envelopeItems: {select: {id: true,- type: true,- data: true,- initialData: true,+ title: true,+ order: true,+ documentDataId: true,+ envelopeId: true,+ documentData: {+ select: {+ id: true,+ type: true,+ data: true,+ initialData: true,+ },+ },},},- documentMeta: {+ _count: {select: {- password: true,+ recipients: true,},},- recipients: true,},});- return result;+ const firstDocumentData = result.envelopeItems[0].documentData;++ if (!firstDocumentData) {+ throw new Error('Missing document data');+ }++ return {+ id: mapSecondaryIdToDocumentId(result.secondaryId),+ internalVersion: result.internalVersion,+ title: result.title,+ completedAt: result.completedAt,+ envelopeItems: result.envelopeItems,+ recipientCount: result._count.recipients,+ documentTeamUrl: result.team.url,+ };};diff --git a/packages/lib/server-only/document/get-document-by-id.ts b/packages/lib/server-only/document/get-document-by-id.tsdeleted file mode 100644index 542e6e3cb..000000000--- a/packages/lib/server-only/document/get-document-by-id.ts+++ /dev/null@@ -1,156 +0,0 @@-import type { Prisma } from '@prisma/client';-import { DocumentStatus, TeamMemberRole } from '@prisma/client';-import { match } from 'ts-pattern';--import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import { DocumentVisibility } from '../../types/document-visibility';-import { getTeamById } from '../team/get-team';--export type GetDocumentByIdOptions = {- documentId: number;- userId: number;- teamId: number;- folderId?: string;-};--export const getDocumentById = async ({- documentId,- userId,- teamId,- folderId,-}: GetDocumentByIdOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,- userId,- teamId,- });-- const document = await prisma.document.findFirst({- where: {- ...documentWhereInput,- folderId,- },- include: {- documentData: true,- documentMeta: true,- user: {- select: {- id: true,- name: true,- email: true,- },- },- recipients: {- select: {- email: true,- },- },- team: {- select: {- id: true,- url: true,- },- },- },- });-- if (!document) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document could not be found',- });- }-- return document;-};--export type GetDocumentWhereInputOptions = {- documentId: number;- userId: number;- teamId: number;-};--/**- * Generate the where input for a given Prisma document query.- *- * This will return a query that allows a user to get a document if they have valid access to it.- */-export const getDocumentWhereInput = async ({- documentId,- userId,- teamId,-}: GetDocumentWhereInputOptions) => {- const team = await getTeamById({ teamId, userId });-- const user = await prisma.user.findFirstOrThrow({- where: {- id: userId,- },- });-- const teamVisibilityFilters = match(team.currentTeamRole)- .with(TeamMemberRole.ADMIN, () => [- DocumentVisibility.EVERYONE,- DocumentVisibility.MANAGER_AND_ABOVE,- DocumentVisibility.ADMIN,- ])- .with(TeamMemberRole.MANAGER, () => [- DocumentVisibility.EVERYONE,- DocumentVisibility.MANAGER_AND_ABOVE,- ])- .otherwise(() => [DocumentVisibility.EVERYONE]);-- const documentOrInput: Prisma.DocumentWhereInput[] = [- // Allow access if they own the document.- {- userId,- },- // Or, if they belong to the team that the document is associated with.- {- visibility: {- in: teamVisibilityFilters,- },- teamId: team.id,- },- // Or, if they are a recipient of the document.- {- status: {- not: DocumentStatus.DRAFT,- },- recipients: {- some: {- email: user.email,- },- },- },- ];-- // Allow access to documents sent to or from the team email.- if (team.teamEmail) {- documentOrInput.push(- {- recipients: {- some: {- email: team.teamEmail.email,- },- },- },- {- user: {- email: team.teamEmail.email,- },- },- );- }-- const documentWhereInput: Prisma.DocumentWhereUniqueInput = {- id: documentId,- OR: documentOrInput,- };-- return {- documentWhereInput,- team,- };-};diff --git a/packages/lib/server-only/document/get-document-by-token.ts b/packages/lib/server-only/document/get-document-by-token.tsindex d2f18f56e..10781c297 100644--- a/packages/lib/server-only/document/get-document-by-token.ts+++ b/packages/lib/server-only/document/get-document-by-token.ts@@ -1,8 +1,10 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';-import type { DocumentWithRecipient } from '@documenso/prisma/types/document-with-recipient';import { AppError, AppErrorCode } from '../../errors/app-error';import type { TDocumentAuthMethods } from '../../types/document-auth';+import { mapSecondaryIdToDocumentId } from '../../utils/envelope';import { isRecipientAuthorized } from './is-recipient-authorized';export interface GetDocumentAndSenderByTokenOptions {@@ -39,8 +41,9 @@ export const getDocumentByToken = async ({ token }: GetDocumentByTokenOptions) =throw new Error('Missing token');}- const result = await prisma.document.findFirstOrThrow({+ const result = await prisma.envelope.findFirstOrThrow({where: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {token,@@ -64,8 +67,9 @@ export const getDocumentAndSenderByToken = async ({throw new Error('Missing token');}- const result = await prisma.document.findFirstOrThrow({+ const result = await prisma.envelope.findFirstOrThrow({where: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {token,@@ -80,13 +84,17 @@ export const getDocumentAndSenderByToken = async ({name: true,},},- documentData: true,documentMeta: true,recipients: {where: {token,},},+ envelopeItems: {+ select: {+ documentData: true,+ },+ },team: {select: {name: true,@@ -102,6 +110,12 @@ export const getDocumentAndSenderByToken = async ({},});+ const firstDocumentData = result.envelopeItems[0].documentData;++ if (!firstDocumentData) {+ throw new Error('Missing document data');+ }+const recipient = result.recipients[0];// Sanity check, should not be possible.@@ -127,6 +141,8 @@ export const getDocumentAndSenderByToken = async ({});}+ const legacyDocumentId = mapSecondaryIdToDocumentId(result.secondaryId);+return {...result,user: {@@ -134,64 +150,8 @@ export const getDocumentAndSenderByToken = async ({email: result.user.email,name: result.user.name,},+ documentData: firstDocumentData,+ id: legacyDocumentId,+ envelopeId: result.id,};};--/**- * Get a Document and a Recipient by the recipient token.- */-export const getDocumentAndRecipientByToken = async ({- token,- userId,- accessAuth,- requireAccessAuth = true,-}: GetDocumentAndRecipientByTokenOptions): Promise<DocumentWithRecipient> => {- if (!token) {- throw new Error('Missing token');- }-- const result = await prisma.document.findFirstOrThrow({- where: {- recipients: {- some: {- token,- },- },- },- include: {- recipients: {- where: {- token,- },- },- documentData: true,- },- });-- const [recipient] = result.recipients;-- // Sanity check, should not be possible.- if (!recipient) {- throw new Error('Missing recipient');- }-- let documentAccessValid = true;-- if (requireAccessAuth) {- documentAccessValid = await isRecipientAuthorized({- type: 'ACCESS',- documentAuthOptions: result.authOptions,- recipient,- userId,- authOptions: accessAuth,- });- }-- if (!documentAccessValid) {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'Invalid access values',- });- }-- return result;-};diff --git a/packages/lib/server-only/document/get-document-certificate-audit-logs.ts b/packages/lib/server-only/document/get-document-certificate-audit-logs.tsindex 3ace2687f..7723fd1d5 100644--- a/packages/lib/server-only/document/get-document-certificate-audit-logs.ts+++ b/packages/lib/server-only/document/get-document-certificate-audit-logs.ts@@ -4,15 +4,15 @@ import { DOCUMENT_AUDIT_LOG_TYPE, DOCUMENT_EMAIL_TYPE } from '../../types/documeimport { parseDocumentAuditLogData } from '../../utils/document-audit-logs';export type GetDocumentCertificateAuditLogsOptions = {- id: number;+ envelopeId: string;};export const getDocumentCertificateAuditLogs = async ({- id,+ envelopeId,}: GetDocumentCertificateAuditLogsOptions) => {const rawAuditLogs = await prisma.documentAuditLog.findMany({where: {- documentId: id,+ envelopeId,type: {in: [DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_COMPLETED,diff --git a/packages/lib/server-only/document/get-document-meta-by-document-id.ts b/packages/lib/server-only/document/get-document-meta-by-document-id.tsdeleted file mode 100644index 575ba5d6e..000000000--- a/packages/lib/server-only/document/get-document-meta-by-document-id.ts+++ /dev/null@@ -1,13 +0,0 @@-import { prisma } from '@documenso/prisma';--export interface GetDocumentMetaByDocumentIdOptions {- id: number;-}--export const getDocumentMetaByDocumentId = async ({ id }: GetDocumentMetaByDocumentIdOptions) => {- return await prisma.documentMeta.findFirstOrThrow({- where: {- documentId: id,- },- });-};diff --git a/packages/lib/server-only/document/get-document-with-details-by-id.ts b/packages/lib/server-only/document/get-document-with-details-by-id.tsindex 2a93156a7..6612ced39 100644--- a/packages/lib/server-only/document/get-document-with-details-by-id.ts+++ b/packages/lib/server-only/document/get-document-with-details-by-id.ts@@ -1,67 +1,66 @@-import { prisma } from '@documenso/prisma';+import { EnvelopeType } from '@prisma/client';-import { AppError, AppErrorCode } from '../../errors/app-error';-import { getDocumentWhereInput } from './get-document-by-id';+import { type EnvelopeIdOptions, mapSecondaryIdToDocumentId } from '../../utils/envelope';+import { getEnvelopeById } from '../envelope/get-envelope-by-id';export type GetDocumentWithDetailsByIdOptions = {- documentId: number;+ id: EnvelopeIdOptions;userId: number;teamId: number;};export const getDocumentWithDetailsById = async ({- documentId,+ id,userId,teamId,}: GetDocumentWithDetailsByIdOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const envelope = await getEnvelopeById({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: {- ...documentWhereInput,- },- include: {- documentData: true,- documentMeta: true,- recipients: true,- folder: true,- fields: {- include: {- signature: true,- recipient: {- select: {- name: true,- email: true,- signingStatus: true,- },- },- },- },- team: {- select: {- id: true,- url: true,- },- },- user: {- select: {- id: true,- name: true,- email: true,- },- },- },- });+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);++ const firstDocumentData = envelope.envelopeItems[0].documentData;- if (!document) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document not found',- });+ if (!firstDocumentData) {+ throw new Error('Document data not found');}- return document;+ return {+ ...envelope,+ envelopeId: envelope.id,+ documentData: {+ ...firstDocumentData,+ envelopeItemId: envelope.envelopeItems[0].id,+ },+ id: legacyDocumentId,+ fields: envelope.fields.map((field) => ({+ ...field,+ documentId: legacyDocumentId,+ templateId: null,+ })),+ user: {+ id: envelope.userId,+ name: envelope.user.name,+ email: envelope.user.email,+ },+ team: {+ id: envelope.teamId,+ url: envelope.team.url,+ },+ recipients: envelope.recipients.map((recipient) => ({+ ...recipient,+ documentId: legacyDocumentId,+ templateId: null,+ })),+ documentDataId: firstDocumentData.id,+ documentMeta: {+ ...envelope.documentMeta,+ documentId: legacyDocumentId,+ password: null,+ },+ };};diff --git a/packages/lib/server-only/document/get-recipient-or-sender-by-share-link-slug.ts b/packages/lib/server-only/document/get-recipient-or-sender-by-share-link-slug.tsindex 2beaf5d1b..b6e2a18b8 100644--- a/packages/lib/server-only/document/get-recipient-or-sender-by-share-link-slug.ts+++ b/packages/lib/server-only/document/get-recipient-or-sender-by-share-link-slug.ts@@ -7,7 +7,7 @@ export type GetRecipientOrSenderByShareLinkSlugOptions = {export const getRecipientOrSenderByShareLinkSlug = async ({slug,}: GetRecipientOrSenderByShareLinkSlugOptions) => {- const { documentId, email } = await prisma.documentShareLink.findFirstOrThrow({+ const { envelopeId, email } = await prisma.documentShareLink.findFirstOrThrow({where: {slug,},@@ -15,7 +15,7 @@ export const getRecipientOrSenderByShareLinkSlug = async ({const sender = await prisma.user.findFirst({where: {- documents: { some: { id: documentId } },+ envelopes: { some: { id: envelopeId } },email,},select: {@@ -31,7 +31,7 @@ export const getRecipientOrSenderByShareLinkSlug = async ({const recipient = await prisma.recipient.findFirst({where: {- documentId,+ envelopeId,email,},select: {diff --git a/packages/lib/server-only/document/get-stats.ts b/packages/lib/server-only/document/get-stats.tsindex 487e7a24a..58612cf7f 100644--- a/packages/lib/server-only/document/get-stats.ts+++ b/packages/lib/server-only/document/get-stats.ts@@ -1,4 +1,4 @@-import { TeamMemberRole } from '@prisma/client';+import { EnvelopeType, TeamMemberRole } from '@prisma/client';import type { Prisma, User } from '@prisma/client';import { SigningStatus } from '@prisma/client';import { DocumentVisibility } from '@prisma/client';@@ -25,7 +25,7 @@ export const getStats = async ({folderId,...options}: GetStatsInput) => {- let createdAt: Prisma.DocumentWhereInput['createdAt'];+ let createdAt: Prisma.EnvelopeWhereInput['createdAt'];if (period) {const daysAgo = parseInt(period.replace(/d$/, ''), 10);@@ -90,13 +90,13 @@ export const getStats = async ({type GetCountsOption = {user: Pick<User, 'id' | 'email'>;- createdAt: Prisma.DocumentWhereInput['createdAt'];+ createdAt: Prisma.EnvelopeWhereInput['createdAt'];search?: string;folderId?: string | null;};const getCounts = async ({ user, createdAt, search, folderId }: GetCountsOption) => {- const searchFilter: Prisma.DocumentWhereInput = {+ const searchFilter: Prisma.EnvelopeWhereInput = {OR: [{ title: { contains: search, mode: 'insensitive' } },{ recipients: { some: { name: { contains: search, mode: 'insensitive' } } } },@@ -108,12 +108,13 @@ const getCounts = async ({ user, createdAt, search, folderId }: GetCountsOption)return Promise.all([// Owner counts.- prisma.document.groupBy({+ prisma.envelope.groupBy({by: ['status'],_count: {_all: true,},where: {+ type: EnvelopeType.DOCUMENT,userId: user.id,createdAt,deletedAt: null,@@ -121,12 +122,13 @@ const getCounts = async ({ user, createdAt, search, folderId }: GetCountsOption)},}),// Not signed counts.- prisma.document.groupBy({+ prisma.envelope.groupBy({by: ['status'],_count: {_all: true,},where: {+ type: EnvelopeType.DOCUMENT,status: ExtendedDocumentStatus.PENDING,recipients: {some: {@@ -140,12 +142,13 @@ const getCounts = async ({ user, createdAt, search, folderId }: GetCountsOption)},}),// Has signed counts.- prisma.document.groupBy({+ prisma.envelope.groupBy({by: ['status'],_count: {_all: true,},where: {+ type: EnvelopeType.DOCUMENT,createdAt,user: {email: {@@ -186,7 +189,7 @@ type GetTeamCountsOption = {senderIds?: number[];currentUserEmail: string;userId: number;- createdAt: Prisma.DocumentWhereInput['createdAt'];+ createdAt: Prisma.EnvelopeWhereInput['createdAt'];currentTeamMemberRole?: TeamMemberRole;search?: string;folderId?: string | null;@@ -197,14 +200,14 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {const senderIds = options.senderIds ?? [];- const userIdWhereClause: Prisma.DocumentWhereInput['userId'] =+ const userIdWhereClause: Prisma.EnvelopeWhereInput['userId'] =senderIds.length > 0? {in: senderIds,}: undefined;- const searchFilter: Prisma.DocumentWhereInput = {+ const searchFilter: Prisma.EnvelopeWhereInput = {OR: [{ title: { contains: options.search, mode: 'insensitive' } },{ recipients: { some: { name: { contains: options.search, mode: 'insensitive' } } } },@@ -212,7 +215,8 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {],};- let ownerCountsWhereInput: Prisma.DocumentWhereInput = {+ let ownerCountsWhereInput: Prisma.EnvelopeWhereInput = {+ type: EnvelopeType.DOCUMENT,userId: userIdWhereClause,createdAt,teamId,@@ -223,7 +227,7 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {let notSignedCountsGroupByArgs = null;let hasSignedCountsGroupByArgs = null;- const visibilityFiltersWhereInput: Prisma.DocumentWhereInput = {+ const visibilityFiltersWhereInput: Prisma.EnvelopeWhereInput = {AND: [{ deletedAt: null },{@@ -267,6 +271,7 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {if (teamEmail) {ownerCountsWhereInput = {+ type: EnvelopeType.DOCUMENT,userId: userIdWhereClause,createdAt,OR: [@@ -288,6 +293,7 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {_all: true,},where: {+ type: EnvelopeType.DOCUMENT,userId: userIdWhereClause,createdAt,folderId,@@ -301,7 +307,7 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {},deletedAt: null,},- } satisfies Prisma.DocumentGroupByArgs;+ } satisfies Prisma.EnvelopeGroupByArgs;hasSignedCountsGroupByArgs = {by: ['status'],@@ -309,6 +315,7 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {_all: true,},where: {+ type: EnvelopeType.DOCUMENT,userId: userIdWhereClause,createdAt,folderId,@@ -336,18 +343,18 @@ const getTeamCounts = async (options: GetTeamCountsOption) => {},],},- } satisfies Prisma.DocumentGroupByArgs;+ } satisfies Prisma.EnvelopeGroupByArgs;}return Promise.all([- prisma.document.groupBy({+ prisma.envelope.groupBy({by: ['status'],_count: {_all: true,},where: ownerCountsWhereInput,}),- notSignedCountsGroupByArgs ? prisma.document.groupBy(notSignedCountsGroupByArgs) : [],- hasSignedCountsGroupByArgs ? prisma.document.groupBy(hasSignedCountsGroupByArgs) : [],+ notSignedCountsGroupByArgs ? prisma.envelope.groupBy(notSignedCountsGroupByArgs) : [],+ hasSignedCountsGroupByArgs ? prisma.envelope.groupBy(hasSignedCountsGroupByArgs) : [],]);};diff --git a/packages/lib/server-only/document/is-recipient-authorized.ts b/packages/lib/server-only/document/is-recipient-authorized.tsindex c8d54d2a4..d19880372 100644--- a/packages/lib/server-only/document/is-recipient-authorized.ts+++ b/packages/lib/server-only/document/is-recipient-authorized.ts@@ -1,4 +1,4 @@-import type { Document, Recipient } from '@prisma/client';+import type { Envelope, Recipient } from '@prisma/client';import { verifyAuthenticationResponse } from '@simplewebauthn/server';import { match } from 'ts-pattern';@@ -17,8 +17,8 @@ import { extractDocumentAuthMethods } from '../../utils/document-auth';type IsRecipientAuthorizedOptions = {// !: Probably find a better name than 'ACCESS_2FA' if requirements change.type: 'ACCESS' | 'ACCESS_2FA' | 'ACTION';- documentAuthOptions: Document['authOptions'];- recipient: Pick<Recipient, 'authOptions' | 'email' | 'documentId'>;+ documentAuthOptions: Envelope['authOptions'];+ recipient: Pick<Recipient, 'authOptions' | 'email' | 'envelopeId'>;/*** The ID of the user who initiated the request.@@ -125,14 +125,8 @@ export const isRecipientAuthorized = async ({}if (type === 'ACCESS_2FA' && method === 'email') {- if (!recipient.documentId) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document ID is required for email 2FA verification',- });- }-return await validateTwoFactorTokenFromEmail({- documentId: recipient.documentId,+ envelopeId: recipient.envelopeId,email: recipient.email,code: token,window: 10, // 5 minutes worth of tokensdiff --git a/packages/lib/server-only/document/reject-document-with-token.ts b/packages/lib/server-only/document/reject-document-with-token.tsindex 2de1d0e81..831feccf2 100644--- a/packages/lib/server-only/document/reject-document-with-token.ts+++ b/packages/lib/server-only/document/reject-document-with-token.ts@@ -1,4 +1,4 @@-import { SigningStatus } from '@prisma/client';+import { EnvelopeType, SigningStatus } from '@prisma/client';import { jobs } from '@documenso/lib/jobs/client';import { prisma } from '@documenso/prisma';@@ -7,17 +7,19 @@ import { AppError, AppErrorCode } from '../../errors/app-error';import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';import type { RequestMetadata } from '../../universal/extract-request-metadata';import { createDocumentAuditLogData } from '../../utils/document-audit-logs';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapSecondaryIdToDocumentId, unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';export type RejectDocumentWithTokenOptions = {token: string;- documentId: number;+ id: EnvelopeIdOptions;reason: string;requestMetadata?: RequestMetadata;};export async function rejectDocumentWithToken({token,- documentId,+ id,reason,requestMetadata,}: RejectDocumentWithTokenOptions) {@@ -25,16 +27,16 @@ export async function rejectDocumentWithToken({const recipient = await prisma.recipient.findFirst({where: {token,- documentId,+ envelope: unsafeBuildEnvelopeIdQuery(id, EnvelopeType.DOCUMENT),},include: {- document: true,+ envelope: true,},});- const document = recipient?.document;+ const envelope = recipient?.envelope;- if (!recipient || !document) {+ if (!recipient || !envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document or recipient not found',});@@ -54,7 +56,7 @@ export async function rejectDocumentWithToken({}),prisma.documentAuditLog.create({data: createDocumentAuditLogData({- documentId,+ envelopeId: envelope.id,type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_REJECTED,user: {name: recipient.name,@@ -72,11 +74,13 @@ export async function rejectDocumentWithToken({}),]);+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);+// Trigger the seal document job to process the document asynchronouslyawait jobs.triggerJob({name: 'internal.seal-document',payload: {- documentId,+ documentId: legacyDocumentId,requestMetadata,},});@@ -86,7 +90,7 @@ export async function rejectDocumentWithToken({name: 'send.signing.rejected.emails',payload: {recipientId: recipient.id,- documentId,+ documentId: legacyDocumentId,},});@@ -94,7 +98,7 @@ export async function rejectDocumentWithToken({await jobs.triggerJob({name: 'send.document.cancelled.emails',payload: {- documentId,+ documentId: legacyDocumentId,cancellationReason: reason,requestMetadata,},diff --git a/packages/lib/server-only/document/resend-document.ts b/packages/lib/server-only/document/resend-document.tsindex 66e6fb09f..6307eff5a 100644--- a/packages/lib/server-only/document/resend-document.ts+++ b/packages/lib/server-only/document/resend-document.ts@@ -1,7 +1,13 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';-import { DocumentStatus, OrganisationType, RecipientRole, SigningStatus } from '@prisma/client';+import {+ DocumentStatus,+ EnvelopeType,+ OrganisationType,+ RecipientRole,+ SigningStatus,+} from '@prisma/client';import { mailer } from '@documenso/email/mailer';import { DocumentInviteEmailTemplate } from '@documenso/email/templates/document-invite';@@ -19,12 +25,13 @@ import { getI18nInstance } from '../../client-only/providers/i18n-server';import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';import { extractDerivedDocumentEmailSettings } from '../../types/document-email';import { isDocumentCompleted } from '../../utils/document';+import type { EnvelopeIdOptions } from '../../utils/envelope';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { getEmailContext } from '../email/get-email-context';-import { getDocumentWhereInput } from './get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type ResendDocumentOptions = {- documentId: number;+ id: EnvelopeIdOptions;userId: number;recipients: number[];teamId: number;@@ -32,7 +39,7 @@ export type ResendDocumentOptions = {};export const resendDocument = async ({- documentId,+ id,userId,recipients,teamId,@@ -42,16 +49,22 @@ export const resendDocument = async ({where: {id: userId,},+ select: {+ id: true,+ email: true,+ name: true,+ },});- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findUnique({- where: documentWhereInput,+ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,include: {recipients: true,documentMeta: true,@@ -64,31 +77,29 @@ export const resendDocument = async ({},});- const customEmail = document?.documentMeta;-- if (!document) {+ if (!envelope) {throw new Error('Document not found');}- if (document.recipients.length === 0) {+ if (envelope.recipients.length === 0) {throw new Error('Document has no recipients');}- if (document.status === DocumentStatus.DRAFT) {+ if (envelope.status === DocumentStatus.DRAFT) {throw new Error('Can not send draft document');}- if (isDocumentCompleted(document.status)) {+ if (isDocumentCompleted(envelope.status)) {throw new Error('Can not send completed document');}- const recipientsToRemind = document.recipients.filter(+ const recipientsToRemind = envelope.recipients.filter((recipient) =>recipients.includes(recipient.id) && recipient.signingStatus === SigningStatus.NOT_SIGNED,);const isRecipientSigningRequestEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientSigningRequest;if (!isRecipientSigningRequestEmailEnabled) {@@ -100,9 +111,9 @@ export const resendDocument = async ({emailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});await Promise.all(@@ -122,42 +133,42 @@ export const resendDocument = async ({._(RECIPIENT_ROLES_DESCRIPTION[recipient.role].actionVerb).toLowerCase();- let emailMessage = customEmail?.message || '';+ let emailMessage = envelope.documentMeta.message || '';let emailSubject = i18n._(msg`Reminder: Please ${recipientActionVerb} this document`);if (selfSigner) {emailMessage = i18n._(- msg`You have initiated the document ${`"${document.title}"`} that requires you to ${recipientActionVerb} it.`,+ msg`You have initiated the document ${`"${envelope.title}"`} that requires you to ${recipientActionVerb} it.`,);emailSubject = i18n._(msg`Reminder: Please ${recipientActionVerb} your document`);}if (organisationType === OrganisationType.ORGANISATION) {emailSubject = i18n._(- msg`Reminder: ${document.team.name} invited you to ${recipientActionVerb} a document`,+ msg`Reminder: ${envelope.team.name} invited you to ${recipientActionVerb} a document`,);emailMessage =- customEmail?.message ||+ envelope.documentMeta.message ||i18n._(- msg`${user.name || user.email} on behalf of "${document.team.name}" has invited you to ${recipientActionVerb} the document "${document.title}".`,+ msg`${user.name || user.email} on behalf of "${envelope.team.name}" has invited you to ${recipientActionVerb} the document "${envelope.title}".`,);}const customEmailTemplate = {'signer.name': name,'signer.email': email,- 'document.name': document.title,+ 'document.name': envelope.title,};const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const signDocumentLink = `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`;const template = createElement(DocumentInviteEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,inviterName: user.name || undefined,inviterEmail:organisationType === OrganisationType.ORGANISATION- ? document.team?.teamEmail?.email || user.email+ ? envelope.team?.teamEmail?.email || user.email: user.email,assetBaseUrl,signDocumentLink,@@ -165,7 +176,7 @@ export const resendDocument = async ({role: recipient.role,selfSigner,organisationType,- teamName: document.team?.name,+ teamName: envelope.team?.name,});const [html, text] = await Promise.all([@@ -189,9 +200,9 @@ export const resendDocument = async ({},from: senderEmail,replyTo: replyToEmail,- subject: customEmail?.subject+ subject: envelope.documentMeta.subject? renderCustomEmailTemplate(- i18n._(msg`Reminder: ${customEmail.subject}`),+ i18n._(msg`Reminder: ${envelope.documentMeta.subject}`),customEmailTemplate,): emailSubject,@@ -202,7 +213,7 @@ export const resendDocument = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,- documentId: document.id,+ envelopeId: envelope.id,metadata: requestMetadata,data: {emailType: recipientEmailType,diff --git a/packages/lib/server-only/document/seal-document.ts b/packages/lib/server-only/document/seal-document.tsdeleted file mode 100644index 6db44eb73..000000000--- a/packages/lib/server-only/document/seal-document.ts+++ /dev/null@@ -1,267 +0,0 @@-import { DocumentStatus, RecipientRole, SigningStatus, WebhookTriggerEvents } from '@prisma/client';-import { nanoid } from 'nanoid';-import path from 'node:path';-import { PDFDocument } from 'pdf-lib';--import PostHogServerClient from '@documenso/lib/server-only/feature-flags/get-post-hog-server-client';-import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';-import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';-import { prisma } from '@documenso/prisma';-import { signPdf } from '@documenso/signing';--import {- ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,-} from '../../types/webhook-payload';-import type { RequestMetadata } from '../../universal/extract-request-metadata';-import { getFileServerSide } from '../../universal/upload/get-file.server';-import { putPdfFileServerSide } from '../../universal/upload/put-file.server';-import { fieldsContainUnsignedRequiredField } from '../../utils/advanced-fields-helpers';-import { getAuditLogsPdf } from '../htmltopdf/get-audit-logs-pdf';-import { getCertificatePdf } from '../htmltopdf/get-certificate-pdf';-import { addRejectionStampToPdf } from '../pdf/add-rejection-stamp-to-pdf';-import { flattenAnnotations } from '../pdf/flatten-annotations';-import { flattenForm } from '../pdf/flatten-form';-import { insertFieldInPDF } from '../pdf/insert-field-in-pdf';-import { legacy_insertFieldInPDF } from '../pdf/legacy-insert-field-in-pdf';-import { normalizeSignatureAppearances } from '../pdf/normalize-signature-appearances';-import { getTeamSettings } from '../team/get-team-settings';-import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';-import { sendCompletedEmail } from './send-completed-email';--export type SealDocumentOptions = {- documentId: number;- sendEmail?: boolean;- isResealing?: boolean;- requestMetadata?: RequestMetadata;-};--export const sealDocument = async ({- documentId,- sendEmail = true,- isResealing = false,- requestMetadata,-}: SealDocumentOptions) => {- const document = await prisma.document.findFirstOrThrow({- where: {- id: documentId,- },- include: {- documentData: true,- documentMeta: true,- recipients: true,- },- });-- const { documentData } = document;-- if (!documentData) {- throw new Error(`Document ${document.id} has no document data`);- }-- const settings = await getTeamSettings({- userId: document.userId,- teamId: document.teamId,- });-- const recipients = await prisma.recipient.findMany({- where: {- documentId: document.id,- role: {- not: RecipientRole.CC,- },- },- });-- // Determine if the document has been rejected by checking if any recipient has rejected it- const rejectedRecipient = recipients.find(- (recipient) => recipient.signingStatus === SigningStatus.REJECTED,- );-- const isRejected = Boolean(rejectedRecipient);-- // Get the rejection reason from the rejected recipient- const rejectionReason = rejectedRecipient?.rejectionReason ?? '';-- // If the document is not rejected, ensure all recipients have signed- if (- !isRejected &&- recipients.some((recipient) => recipient.signingStatus !== SigningStatus.SIGNED)- ) {- throw new Error(`Document ${document.id} has unsigned recipients`);- }-- const fields = await prisma.field.findMany({- where: {- documentId: document.id,- },- include: {- signature: true,- },- });-- // Skip the field check if the document is rejected- if (!isRejected && fieldsContainUnsignedRequiredField(fields)) {- throw new Error(`Document ${document.id} has unsigned required fields`);- }-- if (isResealing) {- // If we're resealing we want to use the initial data for the document- // so we aren't placing fields on top of eachother.- documentData.data = documentData.initialData;- }-- // !: Need to write the fields onto the document as a hard copy- const pdfData = await getFileServerSide(documentData);-- const certificateData = settings.includeSigningCertificate- ? await getCertificatePdf({- documentId,- language: document.documentMeta?.language,- }).catch((e) => {- console.log('Failed to get certificate PDF');- console.error(e);-- return null;- })- : null;-- const auditLogData = settings.includeAuditLog- ? await getAuditLogsPdf({- documentId,- language: document.documentMeta?.language,- }).catch((e) => {- console.log('Failed to get audit logs PDF');- console.error(e);-- return null;- })- : null;-- const doc = await PDFDocument.load(pdfData);-- // Normalize and flatten layers that could cause issues with the signature- normalizeSignatureAppearances(doc);- await flattenForm(doc);- flattenAnnotations(doc);-- // Add rejection stamp if the document is rejected- if (isRejected && rejectionReason) {- await addRejectionStampToPdf(doc, rejectionReason);- }-- if (certificateData) {- const certificate = await PDFDocument.load(certificateData);-- const certificatePages = await doc.copyPages(certificate, certificate.getPageIndices());-- certificatePages.forEach((page) => {- doc.addPage(page);- });- }-- if (auditLogData) {- const auditLog = await PDFDocument.load(auditLogData);-- const auditLogPages = await doc.copyPages(auditLog, auditLog.getPageIndices());-- auditLogPages.forEach((page) => {- doc.addPage(page);- });- }-- for (const field of fields) {- document.useLegacyFieldInsertion- ? await legacy_insertFieldInPDF(doc, field)- : await insertFieldInPDF(doc, field);- }-- // Re-flatten post-insertion to handle fields that create arcoFields- await flattenForm(doc);-- const pdfBytes = await doc.save();-- const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });-- const { name } = path.parse(document.title);-- // Add suffix based on document status- const suffix = isRejected ? '_rejected.pdf' : '_signed.pdf';-- const { data: newData } = await putPdfFileServerSide({- name: `${name}${suffix}`,- type: 'application/pdf',- arrayBuffer: async () => Promise.resolve(pdfBuffer),- });-- const postHog = PostHogServerClient();-- if (postHog) {- postHog.capture({- distinctId: nanoid(),- event: 'App: Document Sealed',- properties: {- documentId: document.id,- isRejected,- },- });- }-- await prisma.$transaction(async (tx) => {- await tx.document.update({- where: {- id: document.id,- },- data: {- status: isRejected ? DocumentStatus.REJECTED : DocumentStatus.COMPLETED,- completedAt: new Date(),- },- });-- await tx.documentData.update({- where: {- id: documentData.id,- },- data: {- data: newData,- },- });-- await tx.documentAuditLog.create({- data: createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_COMPLETED,- documentId: document.id,- requestMetadata,- user: null,- data: {- transactionId: nanoid(),- ...(isRejected ? { isRejected: true, rejectionReason } : {}),- },- }),- });- });-- if (sendEmail && !isResealing) {- await sendCompletedEmail({ documentId, requestMetadata });- }-- const updatedDocument = await prisma.document.findFirstOrThrow({- where: {- id: document.id,- },- include: {- documentData: true,- documentMeta: true,- recipients: true,- },- });-- await triggerWebhook({- event: isRejected- ? WebhookTriggerEvents.DOCUMENT_REJECTED- : WebhookTriggerEvents.DOCUMENT_COMPLETED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(updatedDocument)),- userId: document.userId,- teamId: document.teamId ?? undefined,- });-};diff --git a/packages/lib/server-only/document/search-documents-with-keyword.ts b/packages/lib/server-only/document/search-documents-with-keyword.tsindex 600d07df9..d1eabe77e 100644--- a/packages/lib/server-only/document/search-documents-with-keyword.ts+++ b/packages/lib/server-only/document/search-documents-with-keyword.ts@@ -1,5 +1,6 @@-import type { Document, Recipient, User } from '@prisma/client';-import { DocumentStatus, DocumentVisibility, TeamMemberRole } from '@prisma/client';+import { DocumentStatus, EnvelopeType } from '@prisma/client';+import type { Envelope, Recipient, User } from '@prisma/client';+import { DocumentVisibility, TeamMemberRole } from '@prisma/client';import { match } from 'ts-pattern';import {@@ -9,6 +10,8 @@ import {} from '@documenso/lib/utils/teams';import { prisma } from '@documenso/prisma';+import { mapSecondaryIdToDocumentId } from '../../utils/envelope';+export type SearchDocumentsWithKeywordOptions = {query: string;userId: number;@@ -26,8 +29,9 @@ export const searchDocumentsWithKeyword = async ({},});- const documents = await prisma.document.findMany({+ const envelopes = await prisma.envelope.findMany({where: {+ type: EnvelopeType.DOCUMENT,OR: [{title: {@@ -128,26 +132,26 @@ export const searchDocumentsWithKeyword = async ({take: limit,});- const isOwner = (document: Document, user: User) => document.userId === user.id;+ const isOwner = (envelope: Envelope, user: User) => envelope.userId === user.id;const getSigningLink = (recipients: Recipient[], user: User) =>`/sign/${recipients.find((r) => r.email === user.email)?.token}`;- const maskedDocuments = documents- .filter((document) => {- if (!document.teamId || isOwner(document, user)) {+ const maskedDocuments = envelopes+ .filter((envelope) => {+ if (!envelope.teamId || isOwner(envelope, user)) {return true;}const teamMemberRole = getHighestTeamRoleInGroup(- document.team.teamGroups.filter((tg) => tg.teamId === document.teamId),+ envelope.team.teamGroups.filter((tg) => tg.teamId === envelope.teamId),);if (!teamMemberRole) {return false;}- const canAccessDocument = match([document.visibility, teamMemberRole])+ const canAccessDocument = match([envelope.visibility, teamMemberRole]).with([DocumentVisibility.EVERYONE, TeamMemberRole.ADMIN], () => true).with([DocumentVisibility.EVERYONE, TeamMemberRole.MANAGER], () => true).with([DocumentVisibility.EVERYONE, TeamMemberRole.MEMBER], () => true)@@ -158,23 +162,29 @@ export const searchDocumentsWithKeyword = async ({return canAccessDocument;})- .map((document) => {- const { recipients, ...documentWithoutRecipient } = document;+ .map((envelope) => {+ const { recipients, ...documentWithoutRecipient } = envelope;let documentPath;- if (isOwner(document, user)) {- documentPath = `${formatDocumentsPath(document.team?.url)}/${document.id}`;- } else if (document.teamId && document.team.teamGroups.length > 0) {- documentPath = `${formatDocumentsPath(document.team.url)}/${document.id}`;+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);++ if (isOwner(envelope, user)) {+ documentPath = `${formatDocumentsPath(envelope.team.url)}/${legacyDocumentId}`;+ } else if (envelope.teamId && envelope.team.teamGroups.length > 0) {+ documentPath = `${formatDocumentsPath(envelope.team.url)}/${legacyDocumentId}`;} else {documentPath = getSigningLink(recipients, user);}return {...documentWithoutRecipient,+ team: {+ id: envelope.teamId,+ url: envelope.team.url,+ },path: documentPath,- value: [document.id, document.title, ...document.recipients.map((r) => r.email)].join(' '),+ value: [envelope.id, envelope.title, ...envelope.recipients.map((r) => r.email)].join(' '),};});diff --git a/packages/lib/server-only/document/send-completed-email.ts b/packages/lib/server-only/document/send-completed-email.tsindex b5e5ba256..017929a3b 100644--- a/packages/lib/server-only/document/send-completed-email.ts+++ b/packages/lib/server-only/document/send-completed-email.ts@@ -1,7 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';-import { DocumentSource } from '@prisma/client';+import { DocumentSource, EnvelopeType } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import { DocumentCompletedEmailTemplate } from '@documenso/email/templates/document-completed';@@ -14,23 +14,33 @@ import { extractDerivedDocumentEmailSettings } from '../../types/document-email'import type { RequestMetadata } from '../../universal/extract-request-metadata';import { getFileServerSide } from '../../universal/upload/get-file.server';import { createDocumentAuditLogData } from '../../utils/document-audit-logs';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';import { renderCustomEmailTemplate } from '../../utils/render-custom-email-template';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { formatDocumentsPath } from '../../utils/teams';import { getEmailContext } from '../email/get-email-context';export interface SendDocumentOptions {- documentId: number;+ id: EnvelopeIdOptions;requestMetadata?: RequestMetadata;}-export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDocumentOptions) => {- const document = await prisma.document.findUnique({- where: {- id: documentId,- },+export const sendCompletedEmail = async ({ id, requestMetadata }: SendDocumentOptions) => {+ const envelope = await prisma.envelope.findUnique({+ where: unsafeBuildEnvelopeIdQuery(id, EnvelopeType.DOCUMENT),include: {- documentData: true,+ envelopeItems: {+ include: {+ documentData: {+ select: {+ type: true,+ id: true,+ data: true,+ },+ },+ },+ },documentMeta: true,recipients: true,user: {@@ -49,13 +59,13 @@ export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDo},});- if (!document) {+ if (!envelope) {throw new Error('Document not found');}- const isDirectTemplate = document?.source === DocumentSource.TEMPLATE_DIRECT_LINK;+ const isDirectTemplate = envelope?.source === DocumentSource.TEMPLATE_DIRECT_LINK;- if (document.recipients.length === 0) {+ if (envelope.recipients.length === 0) {throw new Error('Document has no recipients');}@@ -63,28 +73,37 @@ export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDoemailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});- const { user: owner } = document;+ const { user: owner } = envelope;- const completedDocument = await getFileServerSide(document.documentData);+ const completedDocumentEmailAttachments = await Promise.all(+ envelope.envelopeItems.map(async (document) => {+ const file = await getFileServerSide(document.documentData);++ return {+ fileName: document.title.endsWith('.pdf') ? document.title : document.title + '.pdf',+ content: Buffer.from(file),+ };+ }),+ );const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';let documentOwnerDownloadLink = `${NEXT_PUBLIC_WEBAPP_URL()}${formatDocumentsPath(- document.team?.url,- )}/${document.id}`;+ envelope.team?.url,+ )}/${envelope.id}`;- if (document.team?.url) {- documentOwnerDownloadLink = `${NEXT_PUBLIC_WEBAPP_URL()}/t/${document.team.url}/documents/${- document.id+ if (envelope.team?.url) {+ documentOwnerDownloadLink = `${NEXT_PUBLIC_WEBAPP_URL()}/t/${envelope.team.url}/documents/${+ envelope.id}`;}- const emailSettings = extractDerivedDocumentEmailSettings(document.documentMeta);+ const emailSettings = extractDerivedDocumentEmailSettings(envelope.documentMeta);const isDocumentCompletedEmailEnabled = emailSettings.documentCompleted;const isOwnerDocumentCompletedEmailEnabled = emailSettings.ownerDocumentCompleted;@@ -95,11 +114,11 @@ export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDo// - Recipient emails are disabledif (isOwnerDocumentCompletedEmailEnabled &&- (!document.recipients.find((recipient) => recipient.email === owner.email) ||+ (!envelope.recipients.find((recipient) => recipient.email === owner.email) ||!isDocumentCompletedEmailEnabled)) {const template = createElement(DocumentCompletedEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,assetBaseUrl,downloadLink: documentOwnerDownloadLink,});@@ -127,18 +146,13 @@ export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDosubject: i18n._(msg`Signing Complete!`),html,text,- attachments: [- {- filename: document.title.endsWith('.pdf') ? document.title : document.title + '.pdf',- content: Buffer.from(completedDocument),- },- ],+ attachments: completedDocumentEmailAttachments,});await prisma.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,- documentId: document.id,+ envelopeId: envelope.id,user: null,requestMetadata,data: {@@ -158,22 +172,22 @@ export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDo}await Promise.all(- document.recipients.map(async (recipient) => {+ envelope.recipients.map(async (recipient) => {const customEmailTemplate = {'signer.name': recipient.name,'signer.email': recipient.email,- 'document.name': document.title,+ 'document.name': envelope.title,};const downloadLink = `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}/complete`;const template = createElement(DocumentCompletedEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,assetBaseUrl,downloadLink: recipient.email === owner.email ? documentOwnerDownloadLink : downloadLink,customBody:- isDirectTemplate && document.documentMeta?.message- ? renderCustomEmailTemplate(document.documentMeta.message, customEmailTemplate)+ isDirectTemplate && envelope.documentMeta?.message+ ? renderCustomEmailTemplate(envelope.documentMeta.message, customEmailTemplate): undefined,});@@ -198,23 +212,18 @@ export const sendCompletedEmail = async ({ documentId, requestMetadata }: SendDofrom: senderEmail,replyTo: replyToEmail,subject:- isDirectTemplate && document.documentMeta?.subject- ? renderCustomEmailTemplate(document.documentMeta.subject, customEmailTemplate)+ isDirectTemplate && envelope.documentMeta?.subject+ ? renderCustomEmailTemplate(envelope.documentMeta.subject, customEmailTemplate): i18n._(msg`Signing Complete!`),html,text,- attachments: [- {- filename: document.title.endsWith('.pdf') ? document.title : document.title + '.pdf',- content: Buffer.from(completedDocument),- },- ],+ attachments: completedDocumentEmailAttachments,});await prisma.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.EMAIL_SENT,- documentId: document.id,+ envelopeId: envelope.id,user: null,requestMetadata,data: {diff --git a/packages/lib/server-only/document/send-delete-email.ts b/packages/lib/server-only/document/send-delete-email.tsindex e76ac636b..ff8bfe29c 100644--- a/packages/lib/server-only/document/send-delete-email.ts+++ b/packages/lib/server-only/document/send-delete-email.ts@@ -14,14 +14,15 @@ import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { getEmailContext } from '../email/get-email-context';export interface SendDeleteEmailOptions {- documentId: number;+ envelopeId: string;reason: string;}-export const sendDeleteEmail = async ({ documentId, reason }: SendDeleteEmailOptions) => {- const document = await prisma.document.findFirst({+// Note: Currently only sent by Admin function+export const sendDeleteEmail = async ({ envelopeId, reason }: SendDeleteEmailOptions) => {+ const envelope = await prisma.envelope.findFirst({where: {- id: documentId,+ id: envelopeId,},include: {user: {@@ -35,14 +36,14 @@ export const sendDeleteEmail = async ({ documentId, reason }: SendDeleteEmailOpt},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}const isDocumentDeletedEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).documentDeleted;if (!isDocumentDeletedEmailEnabled) {@@ -53,17 +54,17 @@ export const sendDeleteEmail = async ({ documentId, reason }: SendDeleteEmailOptemailType: 'INTERNAL',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});- const { email, name } = document.user;+ const { email, name } = envelope.user;const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const template = createElement(DocumentSuperDeleteEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,reason,assetBaseUrl,});diff --git a/packages/lib/server-only/document/send-document.tsx b/packages/lib/server-only/document/send-document.tssimilarity index 61%rename from packages/lib/server-only/document/send-document.tsxrename to packages/lib/server-only/document/send-document.tsindex 22dbcb071..dab9e032d 100644--- a/packages/lib/server-only/document/send-document.tsx+++ b/packages/lib/server-only/document/send-document.ts@@ -1,6 +1,8 @@+import type { DocumentData, Envelope, EnvelopeItem } from '@prisma/client';import {DocumentSigningOrder,DocumentStatus,+ EnvelopeType,RecipientRole,SendStatus,SigningStatus,@@ -16,17 +18,18 @@ import { jobs } from '../../jobs/client';import { extractDerivedDocumentEmailSettings } from '../../types/document-email';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../types/webhook-payload';import { getFileServerSide } from '../../universal/upload/get-file.server';import { putPdfFileServerSide } from '../../universal/upload/put-file.server';import { isDocumentCompleted } from '../../utils/document';+import { type EnvelopeIdOptions, mapSecondaryIdToDocumentId } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';import { insertFormValuesInPdf } from '../pdf/insert-form-values-in-pdf';import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';-import { getDocumentWhereInput } from './get-document-by-id';export type SendDocumentOptions = {- documentId: number;+ id: EnvelopeIdOptions;userId: number;teamId: number;sendEmail?: boolean;@@ -34,93 +37,81 @@ export type SendDocumentOptions = {};export const sendDocument = async ({- documentId,+ id,userId,teamId,sendEmail,requestMetadata,}: SendDocumentOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: {orderBy: [{ signingOrder: { sort: 'asc', nulls: 'last' } }, { id: 'asc' }],},documentMeta: true,- documentData: true,+ envelopeItems: {+ select: {+ id: true,+ documentData: {+ select: {+ type: true,+ id: true,+ data: true,+ initialData: true,+ },+ },+ },+ },},});- if (!document) {+ if (!envelope) {throw new Error('Document not found');}- if (document.recipients.length === 0) {+ if (envelope.recipients.length === 0) {throw new Error('Document has no recipients');}- if (isDocumentCompleted(document.status)) {+ if (isDocumentCompleted(envelope.status)) {throw new Error('Can not send completed document');}- const signingOrder = document.documentMeta?.signingOrder || DocumentSigningOrder.PARALLEL;+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);++ const signingOrder = envelope.documentMeta?.signingOrder || DocumentSigningOrder.PARALLEL;- let recipientsToNotify = document.recipients;+ let recipientsToNotify = envelope.recipients;if (signingOrder === DocumentSigningOrder.SEQUENTIAL) {// Get the currently active recipient.- recipientsToNotify = document.recipients+ recipientsToNotify = envelope.recipients.filter((r) => r.signingStatus === SigningStatus.NOT_SIGNED && r.role !== RecipientRole.CC).slice(0, 1);// Secondary filter so we aren't resending if the current active recipient has already- // received the document.+ // received the envelope.recipientsToNotify.filter((r) => r.sendStatus !== SendStatus.SENT);}- const { documentData } = document;-- if (!documentData.data) {- throw new Error('Document data not found');+ if (envelope.envelopeItems.length === 0) {+ throw new Error('Missing envelope items');}- if (document.formValues) {- const file = await getFileServerSide(documentData);-- const prefilled = await insertFormValuesInPdf({- pdf: Buffer.from(file),- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions- formValues: document.formValues as Record<string, string | number | boolean>,- });-- let fileName = document.title;-- if (!document.title.endsWith('.pdf')) {- fileName = `${document.title}.pdf`;- }-- const newDocumentData = await putPdfFileServerSide({- name: fileName,- type: 'application/pdf',- arrayBuffer: async () => Promise.resolve(prefilled),- });-- const result = await prisma.document.update({- where: {- id: document.id,- },- data: {- documentDataId: newDocumentData.id,- },- });-- Object.assign(document, result);+ if (envelope.formValues) {+ await Promise.all(+ envelope.envelopeItems.map(async (envelopeItem) => {+ await injectFormValuesIntoDocument(envelope, envelopeItem);+ }),+ );}// Commented out server side checks for minimum 1 signature per signer now since we need to@@ -133,7 +124,7 @@ export const sendDocument = async ({// const fieldsWithSignerEmail = fields.map((field) => ({// ...field,// signerEmail:- // document.Recipient.find((recipient) => recipient.id === field.recipientId)?.email ?? '',+ // envelope.Recipient.find((recipient) => recipient.id === field.recipientId)?.email ?? '',// }));// const everySignerHasSignature = document?.Recipient.every(@@ -148,7 +139,7 @@ export const sendDocument = async ({// throw new Error('Some signers have not been assigned a signature field.');// }- const allRecipientsHaveNoActionToTake = document.recipients.every(+ const allRecipientsHaveNoActionToTake = envelope.recipients.every((recipient) =>recipient.role === RecipientRole.CC || recipient.signingStatus === SigningStatus.SIGNED,);@@ -157,15 +148,15 @@ export const sendDocument = async ({await jobs.triggerJob({name: 'internal.seal-document',payload: {- documentId,+ documentId: legacyDocumentId,requestMetadata: requestMetadata?.requestMetadata,},});// Keep the return type the same for the `sendDocument` method- return await prisma.document.findFirstOrThrow({+ return await prisma.envelope.findFirstOrThrow({where: {- id: documentId,+ id: envelope.id,},include: {documentMeta: true,@@ -174,21 +165,21 @@ export const sendDocument = async ({});}- const updatedDocument = await prisma.$transaction(async (tx) => {- if (document.status === DocumentStatus.DRAFT) {+ const updatedEnvelope = await prisma.$transaction(async (tx) => {+ if (envelope.status === DocumentStatus.DRAFT) {await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_SENT,- documentId: document.id,+ envelopeId: envelope.id,metadata: requestMetadata,data: {},}),});}- return await tx.document.update({+ return await tx.envelope.update({where: {- id: documentId,+ id: envelope.id,},data: {status: DocumentStatus.PENDING,@@ -201,7 +192,7 @@ export const sendDocument = async ({});const isRecipientSigningRequestEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientSigningRequest;// Only send email if one of the following is true:@@ -218,7 +209,7 @@ export const sendDocument = async ({name: 'send.signing.requested.email',payload: {userId,- documentId,+ documentId: legacyDocumentId,recipientId: recipient.id,requestMetadata: requestMetadata?.requestMetadata,},@@ -229,10 +220,44 @@ export const sendDocument = async ({await triggerWebhook({event: WebhookTriggerEvents.DOCUMENT_SENT,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(updatedDocument)),+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(updatedEnvelope)),userId,teamId,});- return updatedDocument;+ return updatedEnvelope;+};++const injectFormValuesIntoDocument = async (+ envelope: Envelope,+ envelopeItem: Pick<EnvelopeItem, 'id'> & { documentData: DocumentData },+) => {+ const file = await getFileServerSide(envelopeItem.documentData);++ const prefilled = await insertFormValuesInPdf({+ pdf: Buffer.from(file),+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions+ formValues: envelope.formValues as Record<string, string | number | boolean>,+ });++ let fileName = envelope.title;++ if (!envelope.title.endsWith('.pdf')) {+ fileName = `${envelope.title}.pdf`;+ }++ const newDocumentData = await putPdfFileServerSide({+ name: fileName,+ type: 'application/pdf',+ arrayBuffer: async () => Promise.resolve(prefilled),+ });++ await prisma.envelopeItem.update({+ where: {+ id: envelopeItem.id,+ },+ data: {+ documentDataId: newDocumentData.id,+ },+ });};diff --git a/packages/lib/server-only/document/send-pending-email.ts b/packages/lib/server-only/document/send-pending-email.tsindex 663ba0554..82911a795 100644--- a/packages/lib/server-only/document/send-pending-email.ts+++ b/packages/lib/server-only/document/send-pending-email.ts@@ -1,6 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';+import { EnvelopeType } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import { DocumentPendingEmailTemplate } from '@documenso/email/templates/document-pending';@@ -9,18 +10,20 @@ import { prisma } from '@documenso/prisma';import { getI18nInstance } from '../../client-only/providers/i18n-server';import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';import { extractDerivedDocumentEmailSettings } from '../../types/document-email';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { getEmailContext } from '../email/get-email-context';export interface SendPendingEmailOptions {- documentId: number;+ id: EnvelopeIdOptions;recipientId: number;}-export const sendPendingEmail = async ({ documentId, recipientId }: SendPendingEmailOptions) => {- const document = await prisma.document.findFirst({+export const sendPendingEmail = async ({ id, recipientId }: SendPendingEmailOptions) => {+ const envelope = await prisma.envelope.findFirst({where: {- id: documentId,+ ...unsafeBuildEnvelopeIdQuery(id, EnvelopeType.DOCUMENT),recipients: {some: {id: recipientId,@@ -37,11 +40,11 @@ export const sendPendingEmail = async ({ documentId, recipientId }: SendPendingE},});- if (!document) {+ if (!envelope) {throw new Error('Document not found');}- if (document.recipients.length === 0) {+ if (envelope.recipients.length === 0) {throw new Error('Document has no recipients');}@@ -49,27 +52,27 @@ export const sendPendingEmail = async ({ documentId, recipientId }: SendPendingEemailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});const isDocumentPendingEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).documentPending;if (!isDocumentPendingEmailEnabled) {return;}- const [recipient] = document.recipients;+ const [recipient] = envelope.recipients;const { email, name } = recipient;const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const template = createElement(DocumentPendingEmailTemplate, {- documentName: document.title,+ documentName: envelope.title,assetBaseUrl,});diff --git a/packages/lib/server-only/document/update-document.ts b/packages/lib/server-only/document/update-document.tsdeleted file mode 100644index 0c1586498..000000000--- a/packages/lib/server-only/document/update-document.ts+++ /dev/null@@ -1,248 +0,0 @@-import { DocumentVisibility } from '@prisma/client';-import { DocumentStatus, TeamMemberRole } from '@prisma/client';-import { isDeepEqual } from 'remeda';-import { match } from 'ts-pattern';--import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';-import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';-import type { CreateDocumentAuditLogDataResponse } from '@documenso/lib/utils/document-audit-logs';-import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';-import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import type { TDocumentAccessAuthTypes, TDocumentActionAuthTypes } from '../../types/document-auth';-import { createDocumentAuthOptions, extractDocumentAuthMethods } from '../../utils/document-auth';-import { getDocumentWhereInput } from './get-document-by-id';--export type UpdateDocumentOptions = {- userId: number;- teamId: number;- documentId: number;- data?: {- title?: string;- externalId?: string | null;- visibility?: DocumentVisibility | null;- globalAccessAuth?: TDocumentAccessAuthTypes[];- globalActionAuth?: TDocumentActionAuthTypes[];- useLegacyFieldInsertion?: boolean;- };- requestMetadata: ApiRequestMetadata;-};--export const updateDocument = async ({- userId,- teamId,- documentId,- data,- requestMetadata,-}: UpdateDocumentOptions) => {- const { documentWhereInput, team } = await getDocumentWhereInput({- documentId,- userId,- teamId,- });-- const document = await prisma.document.findFirst({- where: documentWhereInput,- include: {- team: {- select: {- organisation: {- select: {- organisationClaim: true,- },- },- },- },- },- });-- if (!document) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document not found',- });- }-- const isDocumentOwner = document.userId === userId;- const requestedVisibility = data?.visibility;-- if (!isDocumentOwner) {- match(team.currentTeamRole)- .with(TeamMemberRole.ADMIN, () => true)- .with(TeamMemberRole.MANAGER, () => {- const allowedVisibilities: DocumentVisibility[] = [- DocumentVisibility.EVERYONE,- DocumentVisibility.MANAGER_AND_ABOVE,- ];-- if (- !allowedVisibilities.includes(document.visibility) ||- (requestedVisibility && !allowedVisibilities.includes(requestedVisibility))- ) {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'You do not have permission to update the document visibility',- });- }- })- .with(TeamMemberRole.MEMBER, () => {- if (- document.visibility !== DocumentVisibility.EVERYONE ||- (requestedVisibility && requestedVisibility !== DocumentVisibility.EVERYONE)- ) {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'You do not have permission to update the document visibility',- });- }- })- .otherwise(() => {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'You do not have permission to update the document',- });- });- }-- // If no data just return the document since this function is normally chained after a meta update.- if (!data || Object.values(data).length === 0) {- return document;- }-- const { documentAuthOption } = extractDocumentAuthMethods({- documentAuth: document.authOptions,- });-- const documentGlobalAccessAuth = documentAuthOption?.globalAccessAuth ?? null;- const documentGlobalActionAuth = documentAuthOption?.globalActionAuth ?? null;-- // If the new global auth values aren't passed in, fallback to the current document values.- const newGlobalAccessAuth =- data?.globalAccessAuth === undefined ? documentGlobalAccessAuth : data.globalAccessAuth;- const newGlobalActionAuth =- data?.globalActionAuth === undefined ? documentGlobalActionAuth : data.globalActionAuth;-- // Check if user has permission to set the global action auth.- if (newGlobalActionAuth.length > 0 && !document.team.organisation.organisationClaim.flags.cfr21) {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'You do not have permission to set the action auth',- });- }-- const isTitleSame = data.title === undefined || data.title === document.title;- const isExternalIdSame = data.externalId === undefined || data.externalId === document.externalId;- const isGlobalAccessSame =- documentGlobalAccessAuth === undefined ||- isDeepEqual(documentGlobalAccessAuth, newGlobalAccessAuth);- const isGlobalActionSame =- documentGlobalActionAuth === undefined ||- isDeepEqual(documentGlobalActionAuth, newGlobalActionAuth);- const isDocumentVisibilitySame =- data.visibility === undefined || data.visibility === document.visibility;-- const auditLogs: CreateDocumentAuditLogDataResponse[] = [];-- if (!isTitleSame && document.status !== DocumentStatus.DRAFT) {- throw new AppError(AppErrorCode.INVALID_BODY, {- message: 'You cannot update the title if the document has been sent',- });- }-- if (!isTitleSame) {- auditLogs.push(- createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_TITLE_UPDATED,- documentId,- metadata: requestMetadata,- data: {- from: document.title,- to: data.title || '',- },- }),- );- }-- if (!isExternalIdSame) {- auditLogs.push(- createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_EXTERNAL_ID_UPDATED,- documentId,- metadata: requestMetadata,- data: {- from: document.externalId,- to: data.externalId || '',- },- }),- );- }-- if (!isGlobalAccessSame) {- auditLogs.push(- createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_GLOBAL_AUTH_ACCESS_UPDATED,- documentId,- metadata: requestMetadata,- data: {- from: documentGlobalAccessAuth,- to: newGlobalAccessAuth,- },- }),- );- }-- if (!isGlobalActionSame) {- auditLogs.push(- createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_GLOBAL_AUTH_ACTION_UPDATED,- documentId,- metadata: requestMetadata,- data: {- from: documentGlobalActionAuth,- to: newGlobalActionAuth,- },- }),- );- }-- if (!isDocumentVisibilitySame) {- auditLogs.push(- createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_VISIBILITY_UPDATED,- documentId,- metadata: requestMetadata,- data: {- from: document.visibility,- to: data.visibility || '',- },- }),- );- }-- // Early return if nothing is required.- if (auditLogs.length === 0 && data.useLegacyFieldInsertion === undefined) {- return document;- }-- return await prisma.$transaction(async (tx) => {- const authOptions = createDocumentAuthOptions({- globalAccessAuth: newGlobalAccessAuth,- globalActionAuth: newGlobalActionAuth,- });-- const updatedDocument = await tx.document.update({- where: {- id: documentId,- },- data: {- title: data.title,- externalId: data.externalId,- visibility: data.visibility as DocumentVisibility,- useLegacyFieldInsertion: data.useLegacyFieldInsertion,- authOptions,- },- });-- await tx.documentAuditLog.createMany({- data: auditLogs,- });-- return updatedDocument;- });-};diff --git a/packages/lib/server-only/document/validate-field-auth.ts b/packages/lib/server-only/document/validate-field-auth.tsindex cbb9bf55f..abc7c2c73 100644--- a/packages/lib/server-only/document/validate-field-auth.ts+++ b/packages/lib/server-only/document/validate-field-auth.ts@@ -1,4 +1,4 @@-import type { Document, Field, Recipient } from '@prisma/client';+import type { Envelope, Field, Recipient } from '@prisma/client';import { FieldType } from '@prisma/client';import { AppError, AppErrorCode } from '../../errors/app-error';@@ -6,8 +6,8 @@ import type { TRecipientActionAuth } from '../../types/document-auth';import { isRecipientAuthorized } from './is-recipient-authorized';export type ValidateFieldAuthOptions = {- documentAuthOptions: Document['authOptions'];- recipient: Pick<Recipient, 'authOptions' | 'email' | 'documentId'>;+ documentAuthOptions: Envelope['authOptions'];+ recipient: Pick<Recipient, 'authOptions' | 'email' | 'envelopeId'>;field: Field;userId?: number;authOptions?: TRecipientActionAuth;diff --git a/packages/lib/server-only/document/viewed-document.ts b/packages/lib/server-only/document/viewed-document.tsindex a9faf992a..4a7ee0ef8 100644--- a/packages/lib/server-only/document/viewed-document.ts+++ b/packages/lib/server-only/document/viewed-document.ts@@ -1,4 +1,4 @@-import { ReadStatus, SendStatus } from '@prisma/client';+import { EnvelopeType, ReadStatus, SendStatus } from '@prisma/client';import { WebhookTriggerEvents } from '@prisma/client';import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';@@ -9,7 +9,7 @@ import { prisma } from '@documenso/prisma';import type { TDocumentAccessAuthTypes } from '../../types/document-auth';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../types/webhook-payload';import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';@@ -27,19 +27,30 @@ export const viewedDocument = async ({const recipient = await prisma.recipient.findFirst({where: {token,+ envelope: {+ type: EnvelopeType.DOCUMENT,+ },+ },+ include: {+ envelope: {+ include: {+ documentMeta: true,+ recipients: true,+ },+ },},});- if (!recipient || !recipient.documentId) {+ if (!recipient) {return;}- const { documentId } = recipient;+ const { envelope } = recipient;await prisma.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_VIEWED,- documentId,+ envelopeId: envelope.id,user: {name: recipient.name,email: recipient.email,@@ -75,7 +86,7 @@ export const viewedDocument = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_OPENED,- documentId,+ envelopeId: envelope.id,user: {name: recipient.name,email: recipient.email,@@ -92,24 +103,10 @@ export const viewedDocument = async ({});});- const document = await prisma.document.findFirst({- where: {- id: documentId,- },- include: {- documentMeta: true,- recipients: true,- },- });-- if (!document) {- throw new Error('Document not found');- }-await triggerWebhook({event: WebhookTriggerEvents.DOCUMENT_OPENED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(document)),- userId: document.userId,- teamId: document.teamId ?? undefined,+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(envelope)),+ userId: envelope.userId,+ teamId: envelope.teamId,});};diff --git a/packages/lib/server-only/envelope/create-envelope.ts b/packages/lib/server-only/envelope/create-envelope.tsnew file mode 100644index 000000000..2a0bc9fee--- /dev/null+++ b/packages/lib/server-only/envelope/create-envelope.ts@@ -0,0 +1,376 @@+import type { DocumentMeta, DocumentVisibility, TemplateType } from '@prisma/client';+import {+ DocumentSource,+ EnvelopeType,+ FolderType,+ RecipientRole,+ SendStatus,+ SigningStatus,+ WebhookTriggerEvents,+} from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { normalizePdf as makeNormalizedPdf } from '@documenso/lib/server-only/pdf/normalize-pdf';+import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';+import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';+import { nanoid, prefixedId } from '@documenso/lib/universal/id';+import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';+import { prisma } from '@documenso/prisma';+import type { TCreateEnvelopeRequest } from '@documenso/trpc/server/envelope-router/create-envelope.types';++import type { TDocumentAccessAuthTypes, TDocumentActionAuthTypes } from '../../types/document-auth';+import type { TDocumentFormValues } from '../../types/document-form-values';+import {+ ZWebhookDocumentSchema,+ mapEnvelopeToWebhookDocumentPayload,+} from '../../types/webhook-payload';+import { getFileServerSide } from '../../universal/upload/get-file.server';+import { putPdfFileServerSide } from '../../universal/upload/put-file.server';+import { extractDerivedDocumentMeta } from '../../utils/document';+import { createDocumentAuthOptions, createRecipientAuthOptions } from '../../utils/document-auth';+import { buildTeamWhereQuery } from '../../utils/teams';+import { incrementDocumentId, incrementTemplateId } from '../envelope/increment-id';+import { getTeamSettings } from '../team/get-team-settings';+import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';++export type CreateEnvelopeOptions = {+ userId: number;+ teamId: number;+ normalizePdf?: boolean;+ internalVersion: 1 | 2;+ data: {+ type: EnvelopeType;+ title: string;+ externalId?: string;+ envelopeItems: { title?: string; documentDataId: string; order?: number }[];+ formValues?: TDocumentFormValues;++ timezone?: string;+ userTimezone?: string;++ templateType?: TemplateType;+ publicTitle?: string;+ publicDescription?: string;++ visibility?: DocumentVisibility;+ globalAccessAuth?: TDocumentAccessAuthTypes[];+ globalActionAuth?: TDocumentActionAuthTypes[];+ recipients?: TCreateEnvelopeRequest['recipients'];+ folderId?: string;+ };+ meta?: Partial<Omit<DocumentMeta, 'id'>>;+ requestMetadata: ApiRequestMetadata;+};++export const createEnvelope = async ({+ userId,+ teamId,+ normalizePdf,+ data,+ meta,+ requestMetadata,+ internalVersion,+}: CreateEnvelopeOptions) => {+ const {+ type,+ title,+ externalId,+ formValues,+ timezone,+ userTimezone,+ folderId,+ templateType,+ globalAccessAuth,+ globalActionAuth,+ publicTitle,+ publicDescription,+ visibility: visibilityOverride,+ } = data;++ const team = await prisma.team.findFirst({+ where: buildTeamWhereQuery({ teamId, userId }),+ include: {+ organisation: {+ select: {+ organisationClaim: true,+ },+ },+ },+ });++ if (!team) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Team not found',+ });+ }++ // Verify that the folder exists and is associated with the team.+ if (folderId) {+ const folder = await prisma.folder.findUnique({+ where: {+ id: folderId,+ type: data.type === EnvelopeType.TEMPLATE ? FolderType.TEMPLATE : FolderType.DOCUMENT,+ team: buildTeamWhereQuery({ teamId, userId }),+ },+ });++ if (!folder) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Folder not found',+ });+ }+ }++ const settings = await getTeamSettings({+ userId,+ teamId,+ });++ if (data.envelopeItems.length !== 1 && internalVersion === 1) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Envelope items must have exactly 1 item for version 1',+ });+ }++ let envelopeItems: { title?: string; documentDataId: string; order?: number }[] =+ data.envelopeItems;++ if (normalizePdf) {+ envelopeItems = await Promise.all(+ data.envelopeItems.map(async (item) => {+ const documentData = await prisma.documentData.findFirst({+ where: {+ id: item.documentDataId,+ },+ });++ if (!documentData) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Document data not found',+ });+ }++ const buffer = await getFileServerSide(documentData);++ const normalizedPdf = await makeNormalizedPdf(Buffer.from(buffer));++ const titleToUse = item.title || title;++ const newDocumentData = await putPdfFileServerSide({+ name: titleToUse,+ type: 'application/pdf',+ arrayBuffer: async () => Promise.resolve(normalizedPdf),+ });++ return {+ title: titleToUse.endsWith('.pdf') ? titleToUse.slice(0, -4) : titleToUse,+ documentDataId: newDocumentData.id,+ order: item.order,+ };+ }),+ );+ }++ const authOptions = createDocumentAuthOptions({+ globalAccessAuth: globalAccessAuth || [],+ globalActionAuth: globalActionAuth || [],+ });++ const recipientsHaveActionAuth = data.recipients?.some(+ (recipient) => recipient.actionAuth && recipient.actionAuth.length > 0,+ );++ // Check if user has permission to set the global action auth.+ if (+ (authOptions.globalActionAuth.length > 0 || recipientsHaveActionAuth) &&+ !team.organisation.organisationClaim.flags.cfr21+ ) {+ throw new AppError(AppErrorCode.UNAUTHORIZED, {+ message: 'You do not have permission to set the action auth',+ });+ }++ const visibility = visibilityOverride || settings.documentVisibility;++ const emailId = meta?.emailId;++ // Validate that the email ID belongs to the organisation.+ if (emailId) {+ const email = await prisma.organisationEmail.findFirst({+ where: {+ id: emailId,+ organisationId: team.organisationId,+ },+ });++ if (!email) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Email not found',+ });+ }+ }++ // userTimezone is last because it's always passed in regardless of the organisation/team settings+ // for uploads from the frontend+ const timezoneToUse = timezone || settings.documentTimezone || userTimezone;++ const documentMeta = await prisma.documentMeta.create({+ data: extractDerivedDocumentMeta(settings, {+ ...meta,+ timezone: timezoneToUse,+ }),+ });++ const secondaryId =+ type === EnvelopeType.DOCUMENT+ ? await incrementDocumentId().then((v) => v.formattedDocumentId)+ : await incrementTemplateId().then((v) => v.formattedTemplateId);++ return await prisma.$transaction(async (tx) => {+ const envelope = await tx.envelope.create({+ data: {+ id: prefixedId('envelope'),+ secondaryId,+ internalVersion,+ type,+ title,+ qrToken: prefixedId('qr'),+ externalId,+ envelopeItems: {+ createMany: {+ data: envelopeItems.map((item, i) => ({+ id: prefixedId('envelope_item'),+ title: item.title || title,+ order: item.order !== undefined ? item.order : i + 1,+ documentDataId: item.documentDataId,+ })),+ },+ },+ userId,+ teamId,+ authOptions,+ visibility,+ folderId,+ formValues,+ source: type === EnvelopeType.DOCUMENT ? DocumentSource.DOCUMENT : DocumentSource.TEMPLATE,+ documentMetaId: documentMeta.id,++ // Template specific fields.+ templateType: type === EnvelopeType.TEMPLATE ? templateType : undefined,+ publicTitle: type === EnvelopeType.TEMPLATE ? publicTitle : undefined,+ publicDescription: type === EnvelopeType.TEMPLATE ? publicDescription : undefined,+ },+ include: {+ envelopeItems: true,+ },+ });++ const firstEnvelopeItem = envelope.envelopeItems[0];++ await Promise.all(+ (data.recipients || []).map(async (recipient) => {+ const recipientAuthOptions = createRecipientAuthOptions({+ accessAuth: recipient.accessAuth ?? [],+ actionAuth: recipient.actionAuth ?? [],+ });++ const recipientFieldsToCreate = (recipient.fields || []).map((field) => {+ let envelopeItemId = firstEnvelopeItem.id;++ if (field.documentDataId) {+ const foundEnvelopeItem = envelope.envelopeItems.find(+ (item) => item.documentDataId === field.documentDataId,+ );++ if (!foundEnvelopeItem) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Document data not found',+ });+ }++ envelopeItemId = foundEnvelopeItem.id;+ }++ return {+ envelopeId: envelope.id,+ envelopeItemId,+ type: field.type,+ page: field.page,+ positionX: field.positionX,+ positionY: field.positionY,+ width: field.width,+ height: field.height,+ customText: '',+ inserted: false,+ fieldMeta: field.fieldMeta || undefined,+ };+ });++ await tx.recipient.create({+ data: {+ envelopeId: envelope.id,+ name: recipient.name,+ email: recipient.email,+ role: recipient.role,+ signingOrder: recipient.signingOrder,+ token: nanoid(),+ sendStatus: recipient.role === RecipientRole.CC ? SendStatus.SENT : SendStatus.NOT_SENT,+ signingStatus:+ recipient.role === RecipientRole.CC ? SigningStatus.SIGNED : SigningStatus.NOT_SIGNED,+ authOptions: recipientAuthOptions,+ fields: {+ createMany: {+ data: recipientFieldsToCreate,+ },+ },+ },+ });+ }),+ );++ const createdEnvelope = await tx.envelope.findFirst({+ where: {+ id: envelope.id,+ },+ include: {+ documentMeta: true,+ recipients: true,+ fields: true,+ folder: true,+ envelopeItems: true,+ },+ });++ if (!createdEnvelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ // Only create audit logs and webhook events for documents.+ if (type === EnvelopeType.DOCUMENT) {+ await tx.documentAuditLog.create({+ data: createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ title,+ source: {+ type: DocumentSource.DOCUMENT,+ },+ },+ }),+ });++ await triggerWebhook({+ event: WebhookTriggerEvents.DOCUMENT_CREATED,+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(createdEnvelope)),+ userId,+ teamId,+ });+ }++ return createdEnvelope;+ });+};diff --git a/packages/lib/server-only/envelope/duplicate-envelope.ts b/packages/lib/server-only/envelope/duplicate-envelope.tsnew file mode 100644index 000000000..c83bc85a2--- /dev/null+++ b/packages/lib/server-only/envelope/duplicate-envelope.ts@@ -0,0 +1,196 @@+import { DocumentSource, EnvelopeType, WebhookTriggerEvents } from '@prisma/client';+import { omit } from 'remeda';++import { prisma } from '@documenso/prisma';++import { AppError, AppErrorCode } from '../../errors/app-error';+import {+ ZWebhookDocumentSchema,+ mapEnvelopeToWebhookDocumentPayload,+} from '../../types/webhook-payload';+import { nanoid, prefixedId } from '../../universal/id';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';+import { incrementDocumentId, incrementTemplateId } from '../envelope/increment-id';+import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';++export interface DuplicateEnvelopeOptions {+ id: EnvelopeIdOptions;+ userId: number;+ teamId: number;+}++export const duplicateEnvelope = async ({ id, userId, teamId }: DuplicateEnvelopeOptions) => {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: null,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,+ select: {+ type: true,+ title: true,+ userId: true,+ internalVersion: true,+ envelopeItems: {+ include: {+ documentData: {+ select: {+ data: true,+ initialData: true,+ type: true,+ },+ },+ },+ },+ authOptions: true,+ visibility: true,+ documentMeta: true,+ recipients: {+ select: {+ email: true,+ name: true,+ role: true,+ signingOrder: true,+ fields: true,+ },+ },+ teamId: true,+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Document not found',+ });+ }++ const { legacyNumberId, secondaryId } =+ envelope.type === EnvelopeType.DOCUMENT+ ? await incrementDocumentId().then(({ documentId, formattedDocumentId }) => ({+ legacyNumberId: documentId,+ secondaryId: formattedDocumentId,+ }))+ : await incrementTemplateId().then(({ templateId, formattedTemplateId }) => ({+ legacyNumberId: templateId,+ secondaryId: formattedTemplateId,+ }));++ const createdDocumentMeta = await prisma.documentMeta.create({+ data: {+ ...omit(envelope.documentMeta, ['id']),+ emailSettings: envelope.documentMeta.emailSettings || undefined,+ },+ });++ const duplicatedEnvelope = await prisma.envelope.create({+ data: {+ id: prefixedId('envelope'),+ secondaryId,+ type: envelope.type,+ internalVersion: envelope.internalVersion,+ userId,+ teamId,+ title: envelope.title + ' (copy)',+ documentMetaId: createdDocumentMeta.id,+ authOptions: envelope.authOptions || undefined,+ visibility: envelope.visibility,+ source:+ envelope.type === EnvelopeType.DOCUMENT ? DocumentSource.DOCUMENT : DocumentSource.TEMPLATE,+ },+ include: {+ recipients: true,+ documentMeta: true,+ },+ });++ // Key = original envelope item ID+ // Value = duplicated envelope item ID.+ const oldEnvelopeItemToNewEnvelopeItemIdMap: Record<string, string> = {};++ // Duplicate the envelope items.+ await Promise.all(+ envelope.envelopeItems.map(async (envelopeItem) => {+ const duplicatedDocumentData = await prisma.documentData.create({+ data: {+ type: envelopeItem.documentData.type,+ data: envelopeItem.documentData.initialData,+ initialData: envelopeItem.documentData.initialData,+ },+ });++ const duplicatedEnvelopeItem = await prisma.envelopeItem.create({+ data: {+ id: prefixedId('envelope_item'),+ title: envelopeItem.title,+ order: envelopeItem.order,+ envelopeId: duplicatedEnvelope.id,+ documentDataId: duplicatedDocumentData.id,+ },+ });++ oldEnvelopeItemToNewEnvelopeItemIdMap[envelopeItem.id] = duplicatedEnvelopeItem.id;+ }),+ );++ for (const recipient of envelope.recipients) {+ await prisma.recipient.create({+ data: {+ envelopeId: duplicatedEnvelope.id,+ email: recipient.email,+ name: recipient.name,+ role: recipient.role,+ signingOrder: recipient.signingOrder,+ token: nanoid(),+ fields: {+ createMany: {+ data: recipient.fields.map((field) => ({+ envelopeId: duplicatedEnvelope.id,+ envelopeItemId: oldEnvelopeItemToNewEnvelopeItemIdMap[field.envelopeItemId],+ type: field.type,+ page: field.page,+ positionX: field.positionX,+ positionY: field.positionY,+ width: field.width,+ height: field.height,+ customText: '',+ inserted: false,+ fieldMeta: field.fieldMeta as PrismaJson.FieldMeta,+ })),+ },+ },+ },+ });+ }++ if (duplicatedEnvelope.type === EnvelopeType.DOCUMENT) {+ const refetchedEnvelope = await prisma.envelope.findFirstOrThrow({+ where: {+ id: duplicatedEnvelope.id,+ },+ include: {+ documentMeta: true,+ recipients: true,+ },+ });++ await triggerWebhook({+ event: WebhookTriggerEvents.DOCUMENT_CREATED,+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(refetchedEnvelope)),+ userId: userId,+ teamId: teamId,+ });+ }++ return {+ id: duplicatedEnvelope.id,+ envelope: duplicatedEnvelope,+ legacyId: {+ type: envelope.type,+ id: legacyNumberId,+ },+ };+};diff --git a/packages/lib/server-only/envelope/get-envelope-by-id.ts b/packages/lib/server-only/envelope/get-envelope-by-id.tsnew file mode 100644index 000000000..62acaf5cd--- /dev/null+++ b/packages/lib/server-only/envelope/get-envelope-by-id.ts@@ -0,0 +1,199 @@+import type { Prisma } from '@prisma/client';+import type { EnvelopeType } from '@prisma/client';++import { prisma } from '@documenso/prisma';++import { TEAM_DOCUMENT_VISIBILITY_MAP } from '../../constants/teams';+import { AppError, AppErrorCode } from '../../errors/app-error';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';+import { getTeamById } from '../team/get-team';++export type GetEnvelopeByIdOptions = {+ id: EnvelopeIdOptions;++ /**+ * The validated team ID.+ */+ userId: number;++ /**+ * The unvalidated team ID.+ */+ teamId: number;++ /**+ * The type of envelope to get.+ *+ * Set to null to bypass check.+ */+ type: EnvelopeType | null;+};++export const getEnvelopeById = async ({ id, userId, teamId, type }: GetEnvelopeByIdOptions) => {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ userId,+ teamId,+ type,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ orderBy: {+ order: 'asc',+ },+ },+ folder: true,+ documentMeta: true,+ user: {+ select: {+ id: true,+ name: true,+ email: true,+ },+ },+ recipients: {+ orderBy: {+ id: 'asc',+ },+ },+ fields: true,+ team: {+ select: {+ id: true,+ url: true,+ },+ },+ directLink: {+ select: {+ directTemplateRecipientId: true,+ enabled: true,+ id: true,+ token: true,+ },+ },+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope could not be found',+ });+ }++ return {+ ...envelope,+ user: {+ id: envelope.user.id,+ name: envelope.user.name || '',+ email: envelope.user.email,+ },+ };+};++export type GetEnvelopeByIdResponse = Awaited<ReturnType<typeof getEnvelopeById>>;++export type GetEnvelopeWhereInputOptions = {+ id: EnvelopeIdOptions;++ /**+ * The user ID who has been authenticated.+ */+ userId: number;++ /**+ * The unknown teamId from the request.+ */+ teamId: number;++ /**+ * The type of envelope to get.+ *+ * Set to null to bypass check.+ */+ type: EnvelopeType | null;+};++/**+ * Generate the where input for a given Prisma envelope query.+ *+ * This will return a query that allows a user to get a document if they have valid access to it.+ *+ * NOTE: Be extremely careful when modifying this function. Needs at minimum two reviewers to approve any changes.+ */+export const getEnvelopeWhereInput = async ({+ id,+ userId,+ teamId,+ type,+}: GetEnvelopeWhereInputOptions) => {+ // Backup validation incase something goes wrong.+ if (!id.id || !userId || !teamId || type === undefined) {+ console.error(`[CRTICAL ERROR]: MUST NEVER HAPPEN`);++ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope ID not found',+ });+ }++ // Validate that the user belongs to the team provided.+ const team = await getTeamById({ teamId, userId });++ const envelopeOrInput: Prisma.EnvelopeWhereInput[] = [+ // Allow access if they own the document.+ {+ userId,+ },+ // Or, if they belong to the team that the document is associated with.+ {+ visibility: {+ in: TEAM_DOCUMENT_VISIBILITY_MAP[team.currentTeamRole],+ },+ teamId: team.id,+ },+ ];++ // Allow access to documents sent from the team email.+ if (team.teamEmail) {+ envelopeOrInput.push({+ user: {+ email: team.teamEmail.email,+ },+ });+ }++ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+ // NOTE: DO NOT PUT ANY CODE AFTER THIS POINT.+ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++ const envelopeWhereInput: Prisma.EnvelopeWhereUniqueInput = {+ ...unsafeBuildEnvelopeIdQuery(id, type),+ OR: envelopeOrInput,+ };++ // Final backup validation incase something goes wrong.+ if (+ !envelopeWhereInput.OR ||+ envelopeWhereInput.OR.length < 2 ||+ !userId ||+ !teamId ||+ !team.id ||+ teamId !== team.id+ ) {+ throw new AppError(AppErrorCode.UNAUTHORIZED, {+ message: 'Query not valid',+ });+ }++ // Do not modify this return directly, all adjustments need to be made prior to the above if statement.+ return {+ envelopeWhereInput,+ team,+ };+};diff --git a/packages/lib/server-only/envelope/get-envelope-for-recipient-signing.ts b/packages/lib/server-only/envelope/get-envelope-for-recipient-signing.tsnew file mode 100644index 000000000..e0490cf33--- /dev/null+++ b/packages/lib/server-only/envelope/get-envelope-for-recipient-signing.ts@@ -0,0 +1,311 @@+import { DocumentSigningOrder, DocumentStatus, EnvelopeType, SigningStatus } from '@prisma/client';+import { z } from 'zod';++import { prisma } from '@documenso/prisma';+import DocumentDataSchema from '@documenso/prisma/generated/zod/modelSchema/DocumentDataSchema';+import DocumentMetaSchema from '@documenso/prisma/generated/zod/modelSchema/DocumentMetaSchema';+import EnvelopeItemSchema from '@documenso/prisma/generated/zod/modelSchema/EnvelopeItemSchema';+import EnvelopeSchema from '@documenso/prisma/generated/zod/modelSchema/EnvelopeSchema';+import SignatureSchema from '@documenso/prisma/generated/zod/modelSchema/SignatureSchema';+import TeamSchema from '@documenso/prisma/generated/zod/modelSchema/TeamSchema';+import UserSchema from '@documenso/prisma/generated/zod/modelSchema/UserSchema';++import { AppError, AppErrorCode } from '../../errors/app-error';+import type { TDocumentAuthMethods } from '../../types/document-auth';+import { ZFieldSchema } from '../../types/field';+import { ZRecipientLiteSchema } from '../../types/recipient';+import { isRecipientAuthorized } from '../document/is-recipient-authorized';+import { getTeamSettings } from '../team/get-team-settings';++export type GetRecipientEnvelopeByTokenOptions = {+ token: string;+ userId?: number;+ accessAuth?: TDocumentAuthMethods;+};++const ZEnvelopeForSigningResponse = z.object({+ envelope: EnvelopeSchema.pick({+ type: true,+ status: true,+ id: true,+ secondaryId: true,+ internalVersion: true,+ completedAt: true,+ deletedAt: true,+ title: true,+ authOptions: true,+ userId: true,+ teamId: true,+ }).extend({+ documentMeta: DocumentMetaSchema.pick({+ signingOrder: true,+ distributionMethod: true,+ timezone: true,+ dateFormat: true,+ redirectUrl: true,+ typedSignatureEnabled: true,+ uploadSignatureEnabled: true,+ drawSignatureEnabled: true,+ allowDictateNextSigner: true,+ language: true,+ }),+ recipients: ZRecipientLiteSchema.pick({+ id: true,+ role: true,+ signingStatus: true,+ email: true,+ name: true,+ documentDeletedAt: true,+ expired: true,+ signedAt: true,+ authOptions: true,+ signingOrder: true,+ rejectionReason: true,+ })+ .extend({+ fields: ZFieldSchema.omit({+ documentId: true,+ templateId: true,+ }).array(),+ })+ .array(),++ envelopeItems: EnvelopeItemSchema.pick({+ id: true,+ title: true,+ documentDataId: true,+ order: true,+ })+ .extend({+ documentData: DocumentDataSchema.pick({+ type: true,+ id: true,+ data: true,+ initialData: true,+ }),+ })+ .array(),++ team: TeamSchema.pick({+ id: true,+ name: true,+ }),+ user: UserSchema.pick({+ name: true,+ email: true,+ }),+ }),++ /**+ * The recipient that is currently signing.+ */+ recipient: ZRecipientLiteSchema.pick({+ id: true,+ role: true,+ envelopeId: true,+ readStatus: true,+ sendStatus: true,+ signingStatus: true,+ email: true,+ name: true,+ documentDeletedAt: true,+ expired: true,+ signedAt: true,+ authOptions: true,+ token: true,+ signingOrder: true,+ rejectionReason: true,+ }).extend({+ fields: ZFieldSchema.omit({+ documentId: true,+ templateId: true,+ })+ .extend({+ signature: SignatureSchema.nullish(),+ })+ .array(),+ }),+ recipientSignature: SignatureSchema.pick({+ signatureImageAsBase64: true,+ typedSignature: true,+ }).nullable(),++ isCompleted: z.boolean(),+ isRejected: z.boolean(),+ isRecipientsTurn: z.boolean(),++ sender: z.object({+ email: z.string(),+ name: z.string(),+ }),++ settings: z.object({+ includeSenderDetails: z.boolean(),+ brandingEnabled: z.boolean(),+ brandingLogo: z.string(),+ }),+});++export type EnvelopeForSigningResponse = z.infer<typeof ZEnvelopeForSigningResponse>;++/**+ * Get all the values and details for an envelope that a recipient requires+ * to sign an envelope.+ *+ * Do not overexpose any information that the recipient should not have.+ */+export const getEnvelopeForRecipientSigning = async ({+ token,+ userId,+ accessAuth,+}: GetRecipientEnvelopeByTokenOptions): Promise<EnvelopeForSigningResponse> => {+ if (!token) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Missing token',+ });+ }++ const envelope = await prisma.envelope.findFirst({+ where: {+ type: EnvelopeType.DOCUMENT,+ status: {+ not: DocumentStatus.DRAFT,+ },+ recipients: {+ some: {+ token,+ },+ },+ },+ include: {+ user: {+ select: {+ id: true,+ email: true,+ name: true,+ },+ },+ documentMeta: true,+ recipients: {+ include: {+ fields: {+ include: {+ signature: true,+ },+ },+ },+ orderBy: {+ signingOrder: 'asc',+ },+ },+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ team: {+ select: {+ id: true,+ name: true,+ teamEmail: true,+ teamGlobalSettings: {+ select: {+ includeSigningCertificate: true,+ },+ },+ },+ },+ },+ });++ const recipient = (envelope?.recipients || []).find((r) => r.token === token);++ if (!envelope || !recipient) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ if (envelope.envelopeItems.length === 0) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope has no items',+ });+ }++ const documentAccessValid = await isRecipientAuthorized({+ type: 'ACCESS',+ documentAuthOptions: envelope.authOptions,+ recipient,+ userId,+ authOptions: accessAuth,+ });++ if (!documentAccessValid) {+ throw new AppError(AppErrorCode.UNAUTHORIZED, {+ message: 'Invalid access values',+ });+ }++ const settings = await getTeamSettings({ teamId: envelope.teamId });++ // Get the signature if they have put it in already.+ const recipientSignature = await prisma.signature.findFirst({+ where: {+ field: {+ recipientId: recipient.id,+ envelopeId: envelope.id,+ },+ },+ select: {+ id: true,+ recipientId: true,+ signatureImageAsBase64: true,+ typedSignature: true,+ },+ });++ let isRecipientsTurn = true;++ const currentRecipientIndex = envelope.recipients.findIndex((r) => r.token === token);++ if (+ envelope.documentMeta.signingOrder === DocumentSigningOrder.SEQUENTIAL &&+ currentRecipientIndex !== -1+ ) {+ for (let i = 0; i < currentRecipientIndex; i++) {+ if (envelope.recipients[i].signingStatus !== SigningStatus.SIGNED) {+ isRecipientsTurn = false;+ break;+ }+ }+ }++ const sender = settings.includeSenderDetails+ ? {+ email: envelope.user.email,+ name: envelope.user.name || '',+ }+ : {+ email: envelope.team.teamEmail?.email || '',+ name: envelope.team.name || '',+ };++ return ZEnvelopeForSigningResponse.parse({+ envelope,+ recipient,+ recipientSignature,+ isRecipientsTurn,+ isCompleted:+ recipient.signingStatus === SigningStatus.SIGNED ||+ envelope.status === DocumentStatus.COMPLETED,+ isRejected:+ recipient.signingStatus === SigningStatus.REJECTED ||+ envelope.status === DocumentStatus.REJECTED,+ sender,+ settings: {+ includeSenderDetails: settings.includeSenderDetails,+ brandingEnabled: settings.brandingEnabled,+ brandingLogo: settings.brandingLogo,+ },+ } satisfies EnvelopeForSigningResponse);+};diff --git a/packages/lib/server-only/envelope/get-envelope-required-access-data.ts b/packages/lib/server-only/envelope/get-envelope-required-access-data.tsnew file mode 100644index 000000000..c5aef69ff--- /dev/null+++ b/packages/lib/server-only/envelope/get-envelope-required-access-data.ts@@ -0,0 +1,56 @@+import { DocumentStatus, EnvelopeType } from '@prisma/client';++import { prisma } from '@documenso/prisma';++import { AppError, AppErrorCode } from '../../errors/app-error';++export const getEnvelopeRequiredAccessData = async ({ token }: { token: string }) => {+ const envelope = await prisma.envelope.findFirst({+ where: {+ type: EnvelopeType.DOCUMENT,+ status: {+ not: DocumentStatus.DRAFT,+ },+ recipients: {+ some: {+ token,+ },+ },+ },+ include: {+ recipients: {+ where: {+ token,+ },+ },+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ const recipient = envelope.recipients.find((r) => r.token === token);++ if (!recipient) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Recipient not found',+ });+ }++ const recipientUserAccount = await prisma.user.findFirst({+ where: {+ email: recipient.email.toLowerCase(),+ },+ select: {+ id: true,+ },+ });++ return {+ recipientEmail: recipient.email,+ recipientHasAccount: Boolean(recipientUserAccount),+ } as const;+};diff --git a/packages/lib/server-only/envelope/increment-id.ts b/packages/lib/server-only/envelope/increment-id.tsnew file mode 100644index 000000000..35d5bce0f--- /dev/null+++ b/packages/lib/server-only/envelope/increment-id.ts@@ -0,0 +1,39 @@+import { prisma } from '@documenso/prisma';++import { mapDocumentIdToSecondaryId, mapTemplateIdToSecondaryId } from '../../utils/envelope';++export const incrementDocumentId = async () => {+ const documentIdCounter = await prisma.counter.update({+ where: {+ id: 'document',+ },+ data: {+ value: {+ increment: 1,+ },+ },+ });++ return {+ documentId: documentIdCounter.value,+ formattedDocumentId: mapDocumentIdToSecondaryId(documentIdCounter.value),+ };+};++export const incrementTemplateId = async () => {+ const templateIdCounter = await prisma.counter.update({+ where: {+ id: 'template',+ },+ data: {+ value: {+ increment: 1,+ },+ },+ });++ return {+ templateId: templateIdCounter.value,+ formattedTemplateId: mapTemplateIdToSecondaryId(templateIdCounter.value),+ };+};diff --git a/packages/lib/server-only/envelope/update-envelope.ts b/packages/lib/server-only/envelope/update-envelope.tsnew file mode 100644index 000000000..d2cf256bd--- /dev/null+++ b/packages/lib/server-only/envelope/update-envelope.ts@@ -0,0 +1,344 @@+import type { DocumentMeta, DocumentVisibility, Prisma, TemplateType } from '@prisma/client';+import { EnvelopeType, FolderType } from '@prisma/client';+import { DocumentStatus } from '@prisma/client';+import { isDeepEqual } from 'remeda';++import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';+import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';+import type { CreateDocumentAuditLogDataResponse } from '@documenso/lib/utils/document-audit-logs';+import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';+import { prisma } from '@documenso/prisma';++import { TEAM_DOCUMENT_VISIBILITY_MAP } from '../../constants/teams';+import { AppError, AppErrorCode } from '../../errors/app-error';+import type { TDocumentAccessAuthTypes, TDocumentActionAuthTypes } from '../../types/document-auth';+import { createDocumentAuthOptions, extractDocumentAuthMethods } from '../../utils/document-auth';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { buildTeamWhereQuery, canAccessTeamDocument } from '../../utils/teams';+import { getEnvelopeWhereInput } from './get-envelope-by-id';++export type UpdateEnvelopeOptions = {+ userId: number;+ teamId: number;+ id: EnvelopeIdOptions;+ data?: {+ title?: string;+ folderId?: string | null;+ externalId?: string | null;+ visibility?: DocumentVisibility;+ globalAccessAuth?: TDocumentAccessAuthTypes[];+ globalActionAuth?: TDocumentActionAuthTypes[];+ publicTitle?: string;+ publicDescription?: string;+ templateType?: TemplateType;+ useLegacyFieldInsertion?: boolean;+ };+ meta?: Partial<Omit<DocumentMeta, 'id'>>;+ requestMetadata: ApiRequestMetadata;+};++export const updateEnvelope = async ({+ userId,+ teamId,+ id,+ data = {},+ meta = {},+ requestMetadata,+}: UpdateEnvelopeOptions) => {+ const { envelopeWhereInput, team } = await getEnvelopeWhereInput({+ id,+ type: null, // Allow updating both documents and templates.+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,+ include: {+ documentMeta: true,+ team: {+ select: {+ organisationId: true,+ organisation: {+ select: {+ organisationClaim: true,+ },+ },+ },+ },+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ if (+ envelope.type !== EnvelopeType.TEMPLATE &&+ (data.publicTitle || data.publicDescription || data.templateType)+ ) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'You cannot update the template fields for document type envelopes',+ });+ }++ // If no data just return the document since this function is normally chained after a meta update.+ if (Object.values(data).length === 0 && Object.keys(meta).length === 0) {+ return envelope;+ }++ const isEnvelopeOwner = envelope.userId === userId;++ // Validate whether the new visibility setting is allowed for the current user.+ if (+ !isEnvelopeOwner &&+ data?.visibility &&+ !canAccessTeamDocument(team.currentTeamRole, data.visibility)+ ) {+ throw new AppError(AppErrorCode.UNAUTHORIZED, {+ message: 'You do not have permission to update the envelope visibility',+ });+ }++ const { documentAuthOption } = extractDocumentAuthMethods({+ documentAuth: envelope.authOptions,+ });++ const documentGlobalAccessAuth = documentAuthOption?.globalAccessAuth ?? null;+ const documentGlobalActionAuth = documentAuthOption?.globalActionAuth ?? null;++ // If the new global auth values aren't passed in, fallback to the current document values.+ const newGlobalAccessAuth =+ data?.globalAccessAuth === undefined ? documentGlobalAccessAuth : data.globalAccessAuth;+ const newGlobalActionAuth =+ data?.globalActionAuth === undefined ? documentGlobalActionAuth : data.globalActionAuth;++ // Check if user has permission to set the global action auth.+ if (newGlobalActionAuth.length > 0 && !envelope.team.organisation.organisationClaim.flags.cfr21) {+ throw new AppError(AppErrorCode.UNAUTHORIZED, {+ message: 'You do not have permission to set the action auth',+ });+ }++ const authOptions = createDocumentAuthOptions({+ globalAccessAuth: newGlobalAccessAuth,+ globalActionAuth: newGlobalActionAuth,+ });++ const emailId = meta.emailId;++ // Validate the emailId belongs to the organisation.+ if (emailId) {+ const email = await prisma.organisationEmail.findFirst({+ where: {+ id: emailId,+ organisationId: envelope.team.organisationId,+ },+ });++ if (!email) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Email not found',+ });+ }+ }++ let folderUpdateQuery: Prisma.FolderUpdateOneWithoutEnvelopesNestedInput | undefined = undefined;++ // Validate folder ID.+ if (data.folderId) {+ const folder = await prisma.folder.findFirst({+ where: {+ id: data.folderId,+ team: buildTeamWhereQuery({+ teamId,+ userId,+ }),+ type: envelope.type === EnvelopeType.TEMPLATE ? FolderType.TEMPLATE : FolderType.DOCUMENT,+ visibility: {+ in: TEAM_DOCUMENT_VISIBILITY_MAP[team.currentTeamRole],+ },+ },+ });++ if (!folder) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Folder not found',+ });+ }++ folderUpdateQuery = {+ connect: {+ id: data.folderId,+ },+ };+ }++ // Move to root folder if folderId is null.+ if (data.folderId === null) {+ folderUpdateQuery = {+ disconnect: true,+ };+ }++ const isTitleSame = data.title === undefined || data.title === envelope.title;+ const isExternalIdSame = data.externalId === undefined || data.externalId === envelope.externalId;+ const isGlobalAccessSame =+ documentGlobalAccessAuth === undefined ||+ isDeepEqual(documentGlobalAccessAuth, newGlobalAccessAuth);+ const isGlobalActionSame =+ documentGlobalActionAuth === undefined ||+ isDeepEqual(documentGlobalActionAuth, newGlobalActionAuth);+ const isDocumentVisibilitySame =+ data.visibility === undefined || data.visibility === envelope.visibility;+ const isFolderSame = data.folderId === undefined || data.folderId === envelope.folderId;+ const isTemplateTypeSame =+ data.templateType === undefined || data.templateType === envelope.templateType;+ const isPublicDescriptionSame =+ data.publicDescription === undefined || data.publicDescription === envelope.publicDescription;+ const isPublicTitleSame =+ data.publicTitle === undefined || data.publicTitle === envelope.publicTitle;++ const auditLogs: CreateDocumentAuditLogDataResponse[] = [];++ if (!isTitleSame && envelope.status !== DocumentStatus.DRAFT) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'You cannot update the title if the envelope has been sent',+ });+ }++ if (!isTitleSame) {+ auditLogs.push(+ createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_TITLE_UPDATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ from: envelope.title,+ to: data.title || '',+ },+ }),+ );+ }++ if (!isExternalIdSame) {+ auditLogs.push(+ createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_EXTERNAL_ID_UPDATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ from: envelope.externalId,+ to: data.externalId || '',+ },+ }),+ );+ }++ if (!isGlobalAccessSame) {+ auditLogs.push(+ createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_GLOBAL_AUTH_ACCESS_UPDATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ from: documentGlobalAccessAuth,+ to: newGlobalAccessAuth,+ },+ }),+ );+ }++ if (!isGlobalActionSame) {+ auditLogs.push(+ createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_GLOBAL_AUTH_ACTION_UPDATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ from: documentGlobalActionAuth,+ to: newGlobalActionAuth,+ },+ }),+ );+ }++ if (!isDocumentVisibilitySame) {+ auditLogs.push(+ createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_VISIBILITY_UPDATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ from: envelope.visibility,+ to: data.visibility || '',+ },+ }),+ );+ }++ // Todo: Decide if we want to log moving the document around.+ // if (!isFolderSame) {+ // auditLogs.push(+ // createDocumentAuditLogData({+ // type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FOLDER_UPDATED,+ // envelopeId: envelope.id,+ // metadata: requestMetadata,+ // data: {+ // from: envelope.folderId,+ // to: data.folderId || '',+ // },+ // }),+ // );+ // }++ // Todo: Determine if changes are made+ // Commented out since we didn't detect the changes to sequence.+ // const isMetaSame = isDeepEqual(envelope.documentMeta, meta);+ // Early return if nothing is required.+ // if (+ // auditLogs.length === 0 &&+ // data.useLegacyFieldInsertion === undefined &&+ // isFolderSame &&+ // isTemplateTypeSame &&+ // isPublicDescriptionSame &&+ // isPublicTitleSame+ // ) {+ // return envelope;+ // }++ return await prisma.$transaction(async (tx) => {+ const updatedEnvelope = await tx.envelope.update({+ where: {+ id: envelope.id,+ },+ data: {+ title: data.title,+ externalId: data.externalId,+ visibility: data.visibility,+ templateType: data.templateType,+ publicDescription: data.publicDescription,+ publicTitle: data.publicTitle,+ useLegacyFieldInsertion: data.useLegacyFieldInsertion,+ authOptions,+ folder: folderUpdateQuery,+ documentMeta: {+ update: {+ ...meta,+ emailSettings: meta?.emailSettings || undefined,+ },+ },+ },+ });++ if (envelope.type === EnvelopeType.DOCUMENT) {+ await tx.documentAuditLog.createMany({+ data: auditLogs,+ });+ }++ return updatedEnvelope;+ });+};diff --git a/packages/lib/server-only/field/create-document-fields.ts b/packages/lib/server-only/field/create-document-fields.tsdeleted file mode 100644index aa315625b..000000000--- a/packages/lib/server-only/field/create-document-fields.ts+++ /dev/null@@ -1,126 +0,0 @@-import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';-import type { TFieldAndMeta } from '@documenso/lib/types/field-meta';-import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';-import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';-import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import { canRecipientFieldsBeModified } from '../../utils/recipients';-import { getDocumentWhereInput } from '../document/get-document-by-id';--export interface CreateDocumentFieldsOptions {- userId: number;- teamId: number;- documentId: number;- fields: (TFieldAndMeta & {- recipientId: number;- pageNumber: number;- pageX: number;- pageY: number;- width: number;- height: number;- })[];- requestMetadata: ApiRequestMetadata;-}--export const createDocumentFields = async ({- userId,- teamId,- documentId,- fields,- requestMetadata,-}: CreateDocumentFieldsOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,- userId,- teamId,- });-- const document = await prisma.document.findFirst({- where: documentWhereInput,- include: {- recipients: true,- fields: true,- },- });-- if (!document) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document not found',- });- }-- if (document.completedAt) {- throw new AppError(AppErrorCode.INVALID_REQUEST, {- message: 'Document already complete',- });- }-- // Field validation.- const validatedFields = fields.map((field) => {- const recipient = document.recipients.find((recipient) => recipient.id === field.recipientId);-- // Each field MUST have a recipient associated with it.- if (!recipient) {- throw new AppError(AppErrorCode.INVALID_REQUEST, {- message: `Recipient ${field.recipientId} not found`,- });- }-- // Check whether the recipient associated with the field can have new fields created.- if (!canRecipientFieldsBeModified(recipient, document.fields)) {- throw new AppError(AppErrorCode.INVALID_REQUEST, {- message:- 'Recipient type cannot have fields, or they have already interacted with the document.',- });- }-- return {- ...field,- recipientEmail: recipient.email,- };- });-- const createdFields = await prisma.$transaction(async (tx) => {- return await Promise.all(- validatedFields.map(async (field) => {- const createdField = await tx.field.create({- data: {- type: field.type,- page: field.pageNumber,- positionX: field.pageX,- positionY: field.pageY,- width: field.width,- height: field.height,- customText: '',- inserted: false,- fieldMeta: field.fieldMeta,- documentId,- recipientId: field.recipientId,- },- });-- // Handle field created audit log.- await tx.documentAuditLog.create({- data: createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_CREATED,- documentId,- metadata: requestMetadata,- data: {- fieldId: createdField.secondaryId,- fieldRecipientEmail: field.recipientEmail,- fieldRecipientId: createdField.recipientId,- fieldType: createdField.type,- },- }),- });-- return createdField;- }),- );- });-- return {- fields: createdFields,- };-};diff --git a/packages/lib/server-only/field/create-envelope-fields.ts b/packages/lib/server-only/field/create-envelope-fields.tsnew file mode 100644index 000000000..32a41b89f--- /dev/null+++ b/packages/lib/server-only/field/create-envelope-fields.ts@@ -0,0 +1,168 @@+import { EnvelopeType } from '@prisma/client';++import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';+import type { TFieldAndMeta } from '@documenso/lib/types/field-meta';+import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';+import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';+import { prisma } from '@documenso/prisma';++import { AppError, AppErrorCode } from '../../errors/app-error';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapFieldToLegacyField } from '../../utils/fields';+import { canRecipientFieldsBeModified } from '../../utils/recipients';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';++export interface CreateEnvelopeFieldsOptions {+ userId: number;+ teamId: number;+ id: EnvelopeIdOptions;++ fields: (TFieldAndMeta & {+ /**+ * The ID of the item to insert the fields into.+ *+ * If blank, the first item will be used.+ */+ envelopeItemId?: string;++ recipientId: number;+ pageNumber: number;+ pageX: number;+ pageY: number;+ width: number;+ height: number;+ })[];+ requestMetadata: ApiRequestMetadata;+}++export const createEnvelopeFields = async ({+ userId,+ teamId,+ id,+ fields,+ requestMetadata,+}: CreateEnvelopeFieldsOptions) => {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: null, // Null to allow any type of envelope.+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,+ include: {+ recipients: true,+ fields: true,+ envelopeItems: {+ select: {+ id: true,+ },+ },+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ if (envelope.type === EnvelopeType.DOCUMENT && envelope.completedAt) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Envelope already complete',+ });+ }++ const firstEnvelopeItem = envelope.envelopeItems[0];++ if (!firstEnvelopeItem) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope item not found',+ });+ }++ // Field validation.+ const validatedFields = fields.map((field) => {+ const recipient = envelope.recipients.find((recipient) => recipient.id === field.recipientId);++ // The item to attach the fields to MUST belong to the document.+ if (+ field.envelopeItemId &&+ !envelope.envelopeItems.find((envelopeItem) => envelopeItem.id === field.envelopeItemId)+ ) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Item to attach fields to must belong to the document',+ });+ }++ // Each field MUST have a recipient associated with it.+ if (!recipient) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Recipient ${field.recipientId} not found`,+ });+ }++ // Check whether the recipient associated with the field can have new fields created.+ if (!canRecipientFieldsBeModified(recipient, envelope.fields)) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message:+ 'Recipient type cannot have fields, or they have already interacted with the document.',+ });+ }++ return {+ ...field,+ envelopeItemId: field.envelopeItemId || firstEnvelopeItem.id, // Fallback to first envelope item if no envelope item ID is provided.+ recipientEmail: recipient.email,+ };+ });++ const createdFields = await prisma.$transaction(async (tx) => {+ const newlyCreatedFields = await tx.field.createManyAndReturn({+ data: validatedFields.map((field) => ({+ type: field.type,+ page: field.pageNumber,+ positionX: field.pageX,+ positionY: field.pageY,+ width: field.width,+ height: field.height,+ customText: '',+ inserted: false,+ fieldMeta: field.fieldMeta,+ envelopeId: envelope.id,+ envelopeItemId: field.envelopeItemId,+ recipientId: field.recipientId,+ })),+ });++ // Handle field created audit log.+ if (envelope.type === EnvelopeType.DOCUMENT) {+ await tx.documentAuditLog.createMany({+ data: newlyCreatedFields.map((createdField) => {+ const recipient = validatedFields.find(+ (field) => field.recipientId === createdField.recipientId,+ );++ return createDocumentAuditLogData({+ type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_CREATED,+ envelopeId: envelope.id,+ metadata: requestMetadata,+ data: {+ fieldId: createdField.secondaryId,+ fieldRecipientEmail: recipient?.recipientEmail || '',+ fieldRecipientId: createdField.recipientId,+ fieldType: createdField.type,+ },+ });+ }),+ });+ }++ return newlyCreatedFields;+ });++ return {+ fields: createdFields.map((field) => mapFieldToLegacyField(field, envelope)),+ };+};diff --git a/packages/lib/server-only/field/create-field.ts b/packages/lib/server-only/field/create-field.tsdeleted file mode 100644index 7f0342677..000000000--- a/packages/lib/server-only/field/create-field.ts+++ /dev/null@@ -1,136 +0,0 @@-import type { FieldType } from '@prisma/client';-import { match } from 'ts-pattern';--import { prisma } from '@documenso/prisma';--import {- ZCheckboxFieldMeta,- ZDropdownFieldMeta,- ZNumberFieldMeta,- ZRadioFieldMeta,- ZTextFieldMeta,-} from '../../types/field-meta';-import type { TFieldMetaSchema as FieldMeta } from '../../types/field-meta';-import type { RequestMetadata } from '../../universal/extract-request-metadata';-import { createDocumentAuditLogData } from '../../utils/document-audit-logs';-import { getDocumentWhereInput } from '../document/get-document-by-id';--export type CreateFieldOptions = {- documentId: number;- userId: number;- teamId: number;- recipientId: number;- type: FieldType;- pageNumber: number;- pageX: number;- pageY: number;- pageWidth: number;- pageHeight: number;- fieldMeta?: FieldMeta;- requestMetadata?: RequestMetadata;-};--export const createField = async ({- documentId,- userId,- teamId,- recipientId,- type,- pageNumber,- pageX,- pageY,- pageWidth,- pageHeight,- fieldMeta,- requestMetadata,-}: CreateFieldOptions) => {- const { documentWhereInput, team } = await getDocumentWhereInput({- documentId,- userId,- teamId,- });-- const document = await prisma.document.findFirst({- where: documentWhereInput,- select: {- id: true,- },- });-- if (!document) {- throw new Error('Document not found');- }-- const advancedField = ['NUMBER', 'RADIO', 'CHECKBOX', 'DROPDOWN', 'TEXT'].includes(type);-- if (advancedField && !fieldMeta) {- throw new Error(- 'Field meta is required for this type of field. Please provide the appropriate field meta object.',- );- }-- if (fieldMeta && fieldMeta.type.toLowerCase() !== String(type).toLowerCase()) {- throw new Error('Field meta type does not match the field type');- }-- const result = match(type)- .with('RADIO', () => ZRadioFieldMeta.safeParse(fieldMeta))- .with('CHECKBOX', () => ZCheckboxFieldMeta.safeParse(fieldMeta))- .with('DROPDOWN', () => ZDropdownFieldMeta.safeParse(fieldMeta))- .with('NUMBER', () => ZNumberFieldMeta.safeParse(fieldMeta))- .with('TEXT', () => ZTextFieldMeta.safeParse(fieldMeta))- .with('SIGNATURE', 'INITIALS', 'DATE', 'EMAIL', 'NAME', () => ({- success: true,- data: {},- }))- .with('FREE_SIGNATURE', () => ({- success: false,- error: 'FREE_SIGNATURE is not supported',- data: {},- }))- .exhaustive();-- if (!result.success) {- throw new Error('Field meta parsing failed');- }-- const field = await prisma.field.create({- data: {- documentId,- recipientId,- type,- page: pageNumber,- positionX: pageX,- positionY: pageY,- width: pageWidth,- height: pageHeight,- customText: '',- inserted: false,- fieldMeta: result.data,- },- include: {- recipient: true,- },- });-- await prisma.documentAuditLog.create({- data: createDocumentAuditLogData({- type: 'FIELD_CREATED',- documentId,- user: {- id: team.id,- email: team.name,- name: '',- },- data: {- fieldId: field.secondaryId,- fieldRecipientEmail: field.recipient?.email ?? '',- fieldRecipientId: recipientId,- fieldType: field.type,- },- requestMetadata,- }),- });-- return field;-};diff --git a/packages/lib/server-only/field/create-template-fields.ts b/packages/lib/server-only/field/create-template-fields.tsdeleted file mode 100644index 69faf7e17..000000000--- a/packages/lib/server-only/field/create-template-fields.ts+++ /dev/null@@ -1,101 +0,0 @@-import type { FieldType } from '@prisma/client';--import type { TFieldMetaSchema } from '@documenso/lib/types/field-meta';-import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import { canRecipientFieldsBeModified } from '../../utils/recipients';-import { buildTeamWhereQuery } from '../../utils/teams';--export interface CreateTemplateFieldsOptions {- userId: number;- teamId: number;- templateId: number;- fields: {- recipientId: number;- type: FieldType;- pageNumber: number;- pageX: number;- pageY: number;- width: number;- height: number;- fieldMeta?: TFieldMetaSchema;- }[];-}--export const createTemplateFields = async ({- userId,- teamId,- templateId,- fields,-}: CreateTemplateFieldsOptions) => {- const template = await prisma.template.findFirst({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },- include: {- recipients: true,- fields: true,- },- });-- if (!template) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'template not found',- });- }-- // Field validation.- const validatedFields = fields.map((field) => {- const recipient = template.recipients.find((recipient) => recipient.id === field.recipientId);-- // Each field MUST have a recipient associated with it.- if (!recipient) {- throw new AppError(AppErrorCode.INVALID_REQUEST, {- message: `Recipient ${field.recipientId} not found`,- });- }-- // Check whether the recipient associated with the field can have new fields created.- if (!canRecipientFieldsBeModified(recipient, template.fields)) {- throw new AppError(AppErrorCode.INVALID_REQUEST, {- message:- 'Recipient type cannot have fields, or they have already interacted with the template.',- });- }-- return {- ...field,- recipientEmail: recipient.email,- };- });-- const createdFields = await prisma.$transaction(async (tx) => {- return await Promise.all(- validatedFields.map(async (field) => {- const createdField = await tx.field.create({- data: {- type: field.type,- page: field.pageNumber,- positionX: field.pageX,- positionY: field.pageY,- width: field.width,- height: field.height,- customText: '',- inserted: false,- fieldMeta: field.fieldMeta,- templateId,- recipientId: field.recipientId,- },- });-- return createdField;- }),- );- });-- return {- fields: createdFields,- };-};diff --git a/packages/lib/server-only/field/delete-document-field.ts b/packages/lib/server-only/field/delete-document-field.tsindex eea449fa9..ee734f4ba 100644--- a/packages/lib/server-only/field/delete-document-field.ts+++ b/packages/lib/server-only/field/delete-document-field.ts@@ -1,3 +1,5 @@+import { EnvelopeType } from '@prisma/client';+import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';@@ -5,7 +7,7 @@ import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';import { canRecipientFieldsBeModified } from '../../utils/recipients';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface DeleteDocumentFieldOptions {userId: number;@@ -19,7 +21,8 @@ export const deleteDocumentField = async ({teamId,fieldId,requestMetadata,-}: DeleteDocumentFieldOptions): Promise<void> => {+}: DeleteDocumentFieldOptions) => {+ // Unauthenticated check, we do the real check later.const field = await prisma.field.findFirst({where: {id: fieldId,@@ -32,22 +35,18 @@ export const deleteDocumentField = async ({});}- const documentId = field.documentId;-- if (!documentId) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Field does not belong to a document. Use delete template field instead.',- });- }-- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: field.envelopeId,+ },+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,include: {recipients: {where: {@@ -60,19 +59,19 @@ export const deleteDocumentField = async ({},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- if (document.completedAt) {+ if (envelope.completedAt) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document already complete',});}- const recipient = document.recipients.find((recipient) => recipient.id === field.recipientId);+ const recipient = envelope.recipients.find((recipient) => recipient.id === field.recipientId);if (!recipient) {throw new AppError(AppErrorCode.INVALID_REQUEST, {@@ -87,10 +86,11 @@ export const deleteDocumentField = async ({});}- await prisma.$transaction(async (tx) => {+ return await prisma.$transaction(async (tx) => {const deletedField = await tx.field.delete({where: {id: fieldId,+ envelopeId: envelope.id,},});@@ -98,7 +98,7 @@ export const deleteDocumentField = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_DELETED,- documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {fieldId: deletedField.secondaryId,@@ -108,5 +108,7 @@ export const deleteDocumentField = async ({},}),});++ return deletedField;});};diff --git a/packages/lib/server-only/field/delete-field.ts b/packages/lib/server-only/field/delete-field.tsdeleted file mode 100644index abcb1c189..000000000--- a/packages/lib/server-only/field/delete-field.ts+++ /dev/null@@ -1,78 +0,0 @@-import type { Team } from '@prisma/client';--import { prisma } from '@documenso/prisma';--import type { RequestMetadata } from '../../universal/extract-request-metadata';-import { createDocumentAuditLogData } from '../../utils/document-audit-logs';-import { buildTeamWhereQuery } from '../../utils/teams';--export type DeleteFieldOptions = {- fieldId: number;- documentId: number;- userId: number;- teamId: number;- requestMetadata?: RequestMetadata;-};--export const deleteField = async ({- fieldId,- userId,- teamId,- documentId,- requestMetadata,-}: DeleteFieldOptions) => {- const field = await prisma.field.delete({- where: {- id: fieldId,- document: {- id: documentId,- team: buildTeamWhereQuery({ teamId, userId }),- },- },- include: {- recipient: true,- },- });-- const user = await prisma.user.findFirstOrThrow({- where: {- id: userId,- },- select: {- id: true,- name: true,- email: true,- },- });-- let team: Team | null = null;-- if (teamId) {- team = await prisma.team.findFirstOrThrow({- where: {- id: teamId,- },- });- }-- await prisma.documentAuditLog.create({- data: createDocumentAuditLogData({- type: 'FIELD_DELETED',- documentId,- user: {- id: team?.id ?? user.id,- email: team?.name ?? user.email,- name: team ? '' : user.name,- },- data: {- fieldId: field.secondaryId,- fieldRecipientEmail: field.recipient?.email ?? '',- fieldRecipientId: field.recipientId ?? -1,- fieldType: field.type,- },- requestMetadata,- }),- });-- return field;-};diff --git a/packages/lib/server-only/field/delete-template-field.ts b/packages/lib/server-only/field/delete-template-field.tsindex 87a522068..a1a96555d 100644--- a/packages/lib/server-only/field/delete-template-field.ts+++ b/packages/lib/server-only/field/delete-template-field.ts@@ -1,7 +1,10 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';import { buildTeamWhereQuery } from '../../utils/teams';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface DeleteTemplateFieldOptions {userId: number;@@ -17,21 +20,34 @@ export const deleteTemplateField = async ({const field = await prisma.field.findFirst({where: {id: fieldId,- template: {+ envelope: {+ type: EnvelopeType.TEMPLATE,team: buildTeamWhereQuery({ teamId, userId }),},},});- if (!field || !field.templateId) {+ if (!field) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Field not found',});}+ // Additional validation to check visibility.+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: field.envelopeId,+ },+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });+await prisma.field.delete({where: {- id: fieldId,+ id: field.id,+ envelope: envelopeWhereInput,},});};diff --git a/packages/lib/server-only/field/get-completed-fields-for-token.ts b/packages/lib/server-only/field/get-completed-fields-for-token.tsindex 658e913e8..02b620ec8 100644--- a/packages/lib/server-only/field/get-completed-fields-for-token.ts+++ b/packages/lib/server-only/field/get-completed-fields-for-token.ts@@ -1,4 +1,4 @@-import { SigningStatus } from '@prisma/client';+import { EnvelopeType, SigningStatus } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -6,10 +6,12 @@ export type GetCompletedFieldsForTokenOptions = {token: string;};+// Note: You many need to filter this on a per envelope item ID basis.export const getCompletedFieldsForToken = async ({ token }: GetCompletedFieldsForTokenOptions) => {return await prisma.field.findMany({where: {- document: {+ envelope: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {token,diff --git a/packages/lib/server-only/field/get-field-by-id.ts b/packages/lib/server-only/field/get-field-by-id.tsindex e91a99461..dee488ff6 100644--- a/packages/lib/server-only/field/get-field-by-id.ts+++ b/packages/lib/server-only/field/get-field-by-id.ts@@ -1,53 +1,61 @@+import type { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import { mapFieldToLegacyField } from '../../utils/fields';import { buildTeamWhereQuery } from '../../utils/teams';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type GetFieldByIdOptions = {userId: number;teamId: number;fieldId: number;+ envelopeType: EnvelopeType;};-export const getFieldById = async ({ userId, teamId, fieldId }: GetFieldByIdOptions) => {+export const getFieldById = async ({+ userId,+ teamId,+ fieldId,+ envelopeType,+}: GetFieldByIdOptions) => {const field = await prisma.field.findFirst({where: {id: fieldId,- },- include: {- document: {- select: {- teamId: true,- },- },- template: {- select: {- teamId: true,- },+ envelope: {+ type: envelopeType,+ team: buildTeamWhereQuery({ teamId, userId }),},},});- const foundTeamId = field?.document?.teamId || field?.template?.teamId;-- if (!field || !foundTeamId || foundTeamId !== teamId) {+ if (!field) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Field not found',});}- const team = await prisma.team.findUnique({- where: buildTeamWhereQuery({- teamId: foundTeamId,- userId,- }),+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: field.envelopeId,+ },+ type: envelopeType,+ userId,+ teamId,+ });++ // Additional validation to check visibility.+ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,});- if (!team) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Field not found',});}- return field;+ return mapFieldToLegacyField(field, envelope);};diff --git a/packages/lib/server-only/field/get-fields-for-document.ts b/packages/lib/server-only/field/get-fields-for-document.tsdeleted file mode 100644index 007a6c2ba..000000000--- a/packages/lib/server-only/field/get-fields-for-document.ts+++ /dev/null@@ -1,41 +0,0 @@-import { prisma } from '@documenso/prisma';--import { buildTeamWhereQuery } from '../../utils/teams';--export interface GetFieldsForDocumentOptions {- documentId: number;- userId: number;- teamId: number;-}--export type DocumentField = Awaited<ReturnType<typeof getFieldsForDocument>>[number];--export const getFieldsForDocument = async ({- documentId,- userId,- teamId,-}: GetFieldsForDocumentOptions) => {- const fields = await prisma.field.findMany({- where: {- document: {- id: documentId,- team: buildTeamWhereQuery({ teamId, userId }),- },- },- include: {- signature: true,- recipient: {- select: {- name: true,- email: true,- signingStatus: true,- },- },- },- orderBy: {- id: 'asc',- },- });-- return fields;-};diff --git a/packages/lib/server-only/field/get-fields-for-token.ts b/packages/lib/server-only/field/get-fields-for-token.tsindex 1d27b2a6a..0c4534cf8 100644--- a/packages/lib/server-only/field/get-fields-for-token.ts+++ b/packages/lib/server-only/field/get-fields-for-token.ts@@ -1,4 +1,4 @@-import { FieldType, RecipientRole, SigningStatus } from '@prisma/client';+import { EnvelopeType, FieldType, RecipientRole, SigningStatus } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -6,6 +6,7 @@ export type GetFieldsForTokenOptions = {token: string;};+// Note: You many need to filter this on a per envelope item ID basis.export const getFieldsForToken = async ({ token }: GetFieldsForTokenOptions) => {if (!token) {throw new Error('Missing token');@@ -35,7 +36,10 @@ export const getFieldsForToken = async ({ token }: GetFieldsForTokenOptions) =>gte: recipient.signingOrder ?? 0,},},- documentId: recipient.documentId,+ envelope: {+ id: recipient.envelopeId,+ type: EnvelopeType.DOCUMENT,+ },},{recipientId: recipient.id,diff --git a/packages/lib/server-only/field/remove-signed-field-with-token.ts b/packages/lib/server-only/field/remove-signed-field-with-token.tsindex e95a8048d..70be50629 100644--- a/packages/lib/server-only/field/remove-signed-field-with-token.ts+++ b/packages/lib/server-only/field/remove-signed-field-with-token.ts@@ -41,19 +41,19 @@ export const removeSignedFieldWithToken = async ({},},include: {- document: true,+ envelope: true,recipient: true,},});- const { document } = field;+ const { envelope } = field;- if (!document) {+ if (!envelope) {throw new Error(`Document not found for field ${field.id}`);}- if (document.status !== DocumentStatus.PENDING) {- throw new Error(`Document ${document.id} must be pending`);+ if (envelope.status !== DocumentStatus.PENDING) {+ throw new Error(`Document ${envelope.id} must be pending`);}if (@@ -89,7 +89,7 @@ export const removeSignedFieldWithToken = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FIELD_UNINSERTED,- documentId: document.id,+ envelopeId: envelope.id,user: {name: recipient.name,email: recipient.email,diff --git a/packages/lib/server-only/field/set-fields-for-document.ts b/packages/lib/server-only/field/set-fields-for-document.tsindex 497f01078..f564da4a0 100644--- a/packages/lib/server-only/field/set-fields-for-document.ts+++ b/packages/lib/server-only/field/set-fields-for-document.ts@@ -1,5 +1,4 @@-import type { Field } from '@prisma/client';-import { FieldType } from '@prisma/client';+import { EnvelopeType, type Field, FieldType } from '@prisma/client';import { isDeepEqual } from 'remeda';import { validateCheckboxField } from '@documenso/lib/advanced-fields-validation/validate-checkbox';@@ -25,13 +24,15 @@ import {import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapFieldToLegacyField } from '../../utils/fields';import { canRecipientFieldsBeModified } from '../../utils/recipients';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface SetFieldsForDocumentOptions {userId: number;teamId: number;- documentId: number;+ id: EnvelopeIdOptions;fields: FieldData[];requestMetadata: ApiRequestMetadata;}@@ -39,43 +40,47 @@ export interface SetFieldsForDocumentOptions {export const setFieldsForDocument = async ({userId,teamId,- documentId,+ id,fields,requestMetadata,}: SetFieldsForDocumentOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,+ envelopeItems: {+ select: {+ id: true,+ },+ },+ fields: {+ include: {+ recipient: true,+ },+ },},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- if (document.completedAt) {+ if (envelope.completedAt) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document already complete',});}- const existingFields = await prisma.field.findMany({- where: {- documentId,- },- include: {- recipient: true,- },- });+ const existingFields = envelope.fields;const removedFields = existingFields.filter((existingField) => !fields.find((field) => field.id === existingField.id),@@ -84,7 +89,18 @@ export const setFieldsForDocument = async ({const linkedFields = fields.map((field) => {const existing = existingFields.find((existingField) => existingField.id === field.id);- const recipient = document.recipients.find((recipient) => recipient.id === field.recipientId);+ const recipient = envelope.recipients.find((recipient) => recipient.id === field.recipientId);++ // Check whether the field is being attached to an allowed envelope item.+ const foundEnvelopeItem = envelope.envelopeItems.find(+ (envelopeItem) => envelopeItem.id === field.envelopeItemId,+ );++ if (!foundEnvelopeItem) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Envelope item ${field.envelopeItemId} not found`,+ });+ }// Each field MUST have a recipient associated with it.if (!recipient) {@@ -105,6 +121,14 @@ export const setFieldsForDocument = async ({});}+ // Prevent creating new fields when recipient has interacted with the document.+ if (!existing && !canRecipientFieldsBeModified(recipient, existingFields)) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message:+ 'Cannot modify a field where the recipient has already interacted with the document',+ });+ }+return {...field,_persisted: existing,@@ -115,7 +139,7 @@ export const setFieldsForDocument = async ({const persistedFields = await prisma.$transaction(async (tx) => {return await Promise.all(linkedFields.map(async (field) => {- const fieldSignerEmail = field.signerEmail.toLowerCase();+ const fieldSignerEmail = field._recipient.email.toLowerCase();const parsedFieldMeta = field.fieldMeta? ZFieldMetaSchema.parse(field.fieldMeta)@@ -197,7 +221,8 @@ export const setFieldsForDocument = async ({const upsertedField = await tx.field.upsert({where: {id: field._persisted?.id ?? -1,- documentId,+ envelopeId: envelope.id,+ envelopeItemId: field.envelopeItemId,},update: {page: field.pageNumber,@@ -217,15 +242,21 @@ export const setFieldsForDocument = async ({customText: '',inserted: false,fieldMeta: parsedFieldMeta,- document: {+ envelope: {+ connect: {+ id: envelope.id,+ },+ },+ envelopeItem: {connect: {- id: documentId,+ id: field.envelopeItemId,+ envelopeId: envelope.id,},},recipient: {connect: {- id: field.recipientId,- documentId,+ id: field._recipient.id,+ envelopeId: envelope.id,},},},@@ -249,7 +280,7 @@ export const setFieldsForDocument = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_UPDATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {changes,@@ -264,7 +295,7 @@ export const setFieldsForDocument = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_CREATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {...baseAuditLog,@@ -292,7 +323,7 @@ export const setFieldsForDocument = async ({data: removedFields.map((field) =>createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_DELETED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {fieldId: field.secondaryId,@@ -315,7 +346,9 @@ export const setFieldsForDocument = async ({});return {- fields: [...filteredFields, ...persistedFields],+ fields: [...filteredFields, ...persistedFields].map((field) =>+ mapFieldToLegacyField(field, envelope),+ ),};};@@ -324,8 +357,8 @@ export const setFieldsForDocument = async ({*/type FieldData = {id?: number | null;+ envelopeItemId: string;type: FieldType;- signerEmail: string;recipientId: number;pageNumber: number;pageX: number;@@ -340,6 +373,7 @@ const hasFieldBeenChanged = (field: Field, newFieldData: FieldData) => {const newFieldMeta = newFieldData.fieldMeta || null;return (+ field.envelopeItemId !== newFieldData.envelopeItemId ||field.type !== newFieldData.type ||field.page !== newFieldData.pageNumber ||field.positionX.toNumber() !== newFieldData.pageX ||diff --git a/packages/lib/server-only/field/set-fields-for-template.ts b/packages/lib/server-only/field/set-fields-for-template.tsindex a116c6275..c919c1016 100644--- a/packages/lib/server-only/field/set-fields-for-template.ts+++ b/packages/lib/server-only/field/set-fields-for-template.ts@@ -1,4 +1,4 @@-import { FieldType } from '@prisma/client';+import { EnvelopeType, FieldType } from '@prisma/client';import { validateCheckboxField } from '@documenso/lib/advanced-fields-validation/validate-checkbox';import { validateDropdownField } from '@documenso/lib/advanced-fields-validation/validate-dropdown';@@ -16,16 +16,19 @@ import {} from '@documenso/lib/types/field-meta';import { prisma } from '@documenso/prisma';-import { buildTeamWhereQuery } from '../../utils/teams';+import { AppError, AppErrorCode } from '../../errors/app-error';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapFieldToLegacyField } from '../../utils/fields';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type SetFieldsForTemplateOptions = {userId: number;teamId: number;- templateId: number;+ id: EnvelopeIdOptions;fields: {id?: number | null;+ envelopeItemId: string;type: FieldType;- signerEmail: string;recipientId: number;pageNumber: number;pageX: number;@@ -39,29 +42,41 @@ export type SetFieldsForTemplateOptions = {export const setFieldsForTemplate = async ({userId,teamId,- templateId,+ id,fields,}: SetFieldsForTemplateOptions) => {- const template = await prisma.template.findFirst({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,});- if (!template) {- throw new Error('Template not found');- }-- const existingFields = await prisma.field.findMany({- where: {- templateId,- },+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {- recipient: true,+ recipients: true,+ envelopeItems: {+ select: {+ id: true,+ },+ },+ fields: {+ include: {+ recipient: true,+ },+ },},});+ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Document not found',+ });+ }++ const existingFields = envelope.fields;+const removedFields = existingFields.filter((existingField) => !fields.find((field) => field.id === existingField.id),);@@ -69,9 +84,30 @@ export const setFieldsForTemplate = async ({const linkedFields = fields.map((field) => {const existing = existingFields.find((existingField) => existingField.id === field.id);+ const recipient = envelope.recipients.find((recipient) => recipient.id === field.recipientId);++ // Check whether the field is being attached to an allowed envelope item.+ const foundEnvelopeItem = envelope.envelopeItems.find(+ (envelopeItem) => envelopeItem.id === field.envelopeItemId,+ );++ if (!foundEnvelopeItem) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Envelope item ${field.envelopeItemId} not found`,+ });+ }++ // Each field MUST have a recipient associated with it.+ if (!recipient) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Recipient not found for field ${field.id}`,+ });+ }+return {...field,_persisted: existing,+ _recipient: recipient,};});@@ -143,7 +179,8 @@ export const setFieldsForTemplate = async ({return prisma.field.upsert({where: {id: field._persisted?.id ?? -1,- templateId,+ envelopeId: envelope.id,+ envelopeItemId: field.envelopeItemId,},update: {page: field.pageNumber,@@ -163,15 +200,21 @@ export const setFieldsForTemplate = async ({customText: '',inserted: false,fieldMeta: parsedFieldMeta,- template: {+ envelope: {+ connect: {+ id: envelope.id,+ },+ },+ envelopeItem: {connect: {- id: templateId,+ id: field.envelopeItemId,+ envelopeId: envelope.id,},},recipient: {connect: {- id: field.recipientId,- templateId,+ id: field._recipient.id,+ envelopeId: envelope.id,},},},@@ -198,6 +241,8 @@ export const setFieldsForTemplate = async ({});return {- fields: [...filteredFields, ...persistedFields],+ fields: [...filteredFields, ...persistedFields].map((field) =>+ mapFieldToLegacyField(field, envelope),+ ),};};diff --git a/packages/lib/server-only/field/sign-field-with-token.ts b/packages/lib/server-only/field/sign-field-with-token.tsindex c3e18cb98..8c6c81c2b 100644--- a/packages/lib/server-only/field/sign-field-with-token.ts+++ b/packages/lib/server-only/field/sign-field-with-token.ts@@ -81,7 +81,7 @@ export const signFieldWithToken = async ({},},include: {- document: {+ envelope: {include: {recipients: true,},@@ -90,9 +90,9 @@ export const signFieldWithToken = async ({},});- const { document } = field;+ const { envelope } = field;- if (!document) {+ if (!envelope) {throw new Error(`Document not found for field ${field.id}`);}@@ -100,12 +100,12 @@ export const signFieldWithToken = async ({throw new Error(`Recipient not found for field ${field.id}`);}- if (document.deletedAt) {- throw new Error(`Document ${document.id} has been deleted`);+ if (envelope.deletedAt) {+ throw new Error(`Document ${envelope.id} has been deleted`);}- if (document.status !== DocumentStatus.PENDING) {- throw new Error(`Document ${document.id} must be pending for signing`);+ if (envelope.status !== DocumentStatus.PENDING) {+ throw new Error(`Document ${envelope.id} must be pending for signing`);}if (@@ -172,7 +172,7 @@ export const signFieldWithToken = async ({}const derivedRecipientActionAuth = await validateFieldAuth({- documentAuthOptions: document.authOptions,+ documentAuthOptions: envelope.authOptions,recipient,field,userId,@@ -181,7 +181,9 @@ export const signFieldWithToken = async ({const documentMeta = await prisma.documentMeta.findFirst({where: {- documentId: document.id,+ envelope: {+ id: envelope.id,+ },},});@@ -272,7 +274,7 @@ export const signFieldWithToken = async ({assistant && field.recipientId !== assistant.id? DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FIELD_PREFILLED: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FIELD_INSERTED,- documentId: document.id,+ envelopeId: envelope.id,user: {email: assistant?.email ?? recipient.email,name: assistant?.name ?? recipient.name,diff --git a/packages/lib/server-only/field/update-document-fields.ts b/packages/lib/server-only/field/update-document-fields.tsindex dc87db70d..2df65d436 100644--- a/packages/lib/server-only/field/update-document-fields.ts+++ b/packages/lib/server-only/field/update-document-fields.ts@@ -1,4 +1,4 @@-import type { FieldType } from '@prisma/client';+import { EnvelopeType, type FieldType } from '@prisma/client';import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';import type { TFieldMetaSchema } from '@documenso/lib/types/field-meta';@@ -10,8 +10,9 @@ import {import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import { mapFieldToLegacyField } from '../../utils/fields';import { canRecipientFieldsBeModified } from '../../utils/recipients';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface UpdateDocumentFieldsOptions {userId: number;@@ -37,34 +38,38 @@ export const updateDocumentFields = async ({fields,requestMetadata,}: UpdateDocumentFieldsOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,fields: true,},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- if (document.completedAt) {+ if (envelope.completedAt) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document already complete',});}const fieldsToUpdate = fields.map((field) => {- const originalField = document.fields.find((existingField) => existingField.id === field.id);+ const originalField = envelope.fields.find((existingField) => existingField.id === field.id);if (!originalField) {throw new AppError(AppErrorCode.NOT_FOUND, {@@ -72,7 +77,7 @@ export const updateDocumentFields = async ({});}- const recipient = document.recipients.find(+ const recipient = envelope.recipients.find((recipient) => recipient.id === originalField.recipientId,);@@ -84,7 +89,7 @@ export const updateDocumentFields = async ({}// Check whether the recipient associated with the field can be modified.- if (!canRecipientFieldsBeModified(recipient, document.fields)) {+ if (!canRecipientFieldsBeModified(recipient, envelope.fields)) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message:'Cannot modify a field where the recipient has already interacted with the document',@@ -123,7 +128,7 @@ export const updateDocumentFields = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_UPDATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {fieldId: updatedField.secondaryId,@@ -142,6 +147,6 @@ export const updateDocumentFields = async ({});return {- fields: updatedFields,+ fields: updatedFields.map((field) => mapFieldToLegacyField(field, envelope)),};};diff --git a/packages/lib/server-only/field/update-field.ts b/packages/lib/server-only/field/update-field.tsdeleted file mode 100644index 727d2cf98..000000000--- a/packages/lib/server-only/field/update-field.ts+++ /dev/null@@ -1,119 +0,0 @@-import type { FieldType, Team } from '@prisma/client';--import { type TFieldMetaSchema as FieldMeta } from '@documenso/lib/types/field-meta';-import { prisma } from '@documenso/prisma';--import { DOCUMENT_AUDIT_LOG_TYPE } from '../../types/document-audit-logs';-import type { RequestMetadata } from '../../universal/extract-request-metadata';-import { createDocumentAuditLogData, diffFieldChanges } from '../../utils/document-audit-logs';-import { buildTeamWhereQuery } from '../../utils/teams';--export type UpdateFieldOptions = {- fieldId: number;- documentId: number;- userId: number;- teamId: number;- recipientId?: number;- type?: FieldType;- pageNumber?: number;- pageX?: number;- pageY?: number;- pageWidth?: number;- pageHeight?: number;- requestMetadata?: RequestMetadata;- fieldMeta?: FieldMeta;-};--export const updateField = async ({- fieldId,- documentId,- userId,- teamId,- recipientId,- type,- pageNumber,- pageX,- pageY,- pageWidth,- pageHeight,- requestMetadata,- fieldMeta,-}: UpdateFieldOptions) => {- if (type === 'FREE_SIGNATURE') {- throw new Error('Cannot update a FREE_SIGNATURE field');- }-- const oldField = await prisma.field.findFirstOrThrow({- where: {- id: fieldId,- document: {- id: documentId,- team: buildTeamWhereQuery({ teamId, userId }),- },- },- });-- const field = prisma.$transaction(async (tx) => {- const updatedField = await tx.field.update({- where: {- id: fieldId,- },- data: {- recipientId,- type,- page: pageNumber,- positionX: pageX,- positionY: pageY,- width: pageWidth,- height: pageHeight,- fieldMeta,- },- include: {- recipient: true,- },- });-- const user = await prisma.user.findFirstOrThrow({- where: {- id: userId,- },- select: {- id: true,- name: true,- email: true,- },- });-- let team: Team | null = null;-- if (teamId) {- team = await prisma.team.findFirst({- where: buildTeamWhereQuery({ teamId, userId }),- });- }-- await tx.documentAuditLog.create({- data: createDocumentAuditLogData({- type: DOCUMENT_AUDIT_LOG_TYPE.FIELD_UPDATED,- documentId,- user: {- id: team?.id ?? user.id,- email: team?.name ?? user.email,- name: team ? '' : user.name,- },- data: {- fieldId: updatedField.secondaryId,- fieldRecipientEmail: updatedField.recipient?.email ?? '',- fieldRecipientId: recipientId ?? -1,- fieldType: updatedField.type,- changes: diffFieldChanges(oldField, updatedField),- },- requestMetadata,- }),- });-- return updatedField;- });-- return field;-};diff --git a/packages/lib/server-only/field/update-template-fields.ts b/packages/lib/server-only/field/update-template-fields.tsindex 4b62937bd..cd05ebbd7 100644--- a/packages/lib/server-only/field/update-template-fields.ts+++ b/packages/lib/server-only/field/update-template-fields.ts@@ -1,11 +1,12 @@-import type { FieldType } from '@prisma/client';+import { EnvelopeType, type FieldType } from '@prisma/client';import type { TFieldMetaSchema } from '@documenso/lib/types/field-meta';import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import { mapFieldToLegacyField } from '../../utils/fields';import { canRecipientFieldsBeModified } from '../../utils/recipients';-import { buildTeamWhereQuery } from '../../utils/teams';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface UpdateTemplateFieldsOptions {userId: number;@@ -29,25 +30,32 @@ export const updateTemplateFields = async ({templateId,fields,}: UpdateTemplateFieldsOptions) => {- const template = await prisma.template.findFirst({- where: {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'templateId',id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),},+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,fields: true,},});- if (!template) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}const fieldsToUpdate = fields.map((field) => {- const originalField = template.fields.find((existingField) => existingField.id === field.id);+ const originalField = envelope.fields.find((existingField) => existingField.id === field.id);if (!originalField) {throw new AppError(AppErrorCode.NOT_FOUND, {@@ -55,7 +63,7 @@ export const updateTemplateFields = async ({});}- const recipient = template.recipients.find(+ const recipient = envelope.recipients.find((recipient) => recipient.id === originalField.recipientId,);@@ -67,7 +75,7 @@ export const updateTemplateFields = async ({}// Check whether the recipient associated with the field can be modified.- if (!canRecipientFieldsBeModified(recipient, template.fields)) {+ if (!canRecipientFieldsBeModified(recipient, envelope.fields)) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message:'Cannot modify a field where the recipient has already interacted with the document',@@ -103,6 +111,6 @@ export const updateTemplateFields = async ({});return {- fields: updatedFields,+ fields: updatedFields.map((field) => mapFieldToLegacyField(field, envelope)),};};diff --git a/packages/lib/server-only/folder/create-folder.ts b/packages/lib/server-only/folder/create-folder.tsindex d361ae37d..9939f9634 100644--- a/packages/lib/server-only/folder/create-folder.ts+++ b/packages/lib/server-only/folder/create-folder.ts@@ -2,8 +2,6 @@ import { prisma } from '@documenso/prisma';import type { TFolderType } from '../../types/folder-type';import { FolderType } from '../../types/folder-type';-import { determineDocumentVisibility } from '../../utils/document-visibility';-import { getTeamById } from '../team/get-team';import { getTeamSettings } from '../team/get-team-settings';export interface CreateFolderOptions {@@ -21,8 +19,7 @@ export const createFolder = async ({parentId,type = FolderType.DOCUMENT,}: CreateFolderOptions) => {- const team = await getTeamById({ userId, teamId });-+ // This indirectly verifies whether the user has access to the team.const settings = await getTeamSettings({ userId, teamId });return await prisma.folder.create({@@ -32,7 +29,7 @@ export const createFolder = async ({teamId,parentId,type,- visibility: determineDocumentVisibility(settings.documentVisibility, team.currentTeamRole),+ visibility: settings.documentVisibility,},});};diff --git a/packages/lib/server-only/folder/delete-folder.ts b/packages/lib/server-only/folder/delete-folder.tsindex 128bd35ae..c7e9615af 100644--- a/packages/lib/server-only/folder/delete-folder.ts+++ b/packages/lib/server-only/folder/delete-folder.ts@@ -1,10 +1,7 @@-import { DocumentVisibility, TeamMemberRole } from '@prisma/client';-import { match } from 'ts-pattern';-import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { prisma } from '@documenso/prisma';-import { buildTeamWhereQuery } from '../../utils/teams';+import { buildTeamWhereQuery, canAccessTeamDocument } from '../../utils/teams';import { getTeamById } from '../team/get-team';export interface DeleteFolderOptions {@@ -24,11 +21,6 @@ export const deleteFolder = async ({ userId, teamId, folderId }: DeleteFolderOptuserId,}),},- include: {- documents: true,- subfolders: true,- templates: true,- },});if (!folder) {@@ -37,11 +29,7 @@ export const deleteFolder = async ({ userId, teamId, folderId }: DeleteFolderOpt});}- const hasPermission = match(team.currentTeamRole)- .with(TeamMemberRole.ADMIN, () => true)- .with(TeamMemberRole.MANAGER, () => folder.visibility !== DocumentVisibility.ADMIN)- .with(TeamMemberRole.MEMBER, () => folder.visibility === DocumentVisibility.EVERYONE)- .otherwise(() => false);+ const hasPermission = canAccessTeamDocument(team.currentTeamRole, folder.visibility);if (!hasPermission) {throw new AppError(AppErrorCode.UNAUTHORIZED, {diff --git a/packages/lib/server-only/folder/find-folders.ts b/packages/lib/server-only/folder/find-folders.tsindex fc4760c97..957870ef9 100644--- a/packages/lib/server-only/folder/find-folders.ts+++ b/packages/lib/server-only/folder/find-folders.ts@@ -1,9 +1,8 @@-import { TeamMemberRole } from '@prisma/client';-import { match } from 'ts-pattern';+import { EnvelopeType } from '@prisma/client';import { prisma } from '@documenso/prisma';-import { DocumentVisibility } from '../../types/document-visibility';+import { TEAM_DOCUMENT_VISIBILITY_MAP } from '../../constants/teams';import type { TFolderType } from '../../types/folder-type';import { getTeamById } from '../team/get-team';@@ -17,22 +16,11 @@ export interface FindFoldersOptions {export const findFolders = async ({ userId, teamId, parentId, type }: FindFoldersOptions) => {const team = await getTeamById({ userId, teamId });- const visibilityFilters = match(team.currentTeamRole)- .with(TeamMemberRole.ADMIN, () => ({- visibility: {- in: [- DocumentVisibility.EVERYONE,- DocumentVisibility.MANAGER_AND_ABOVE,- DocumentVisibility.ADMIN,- ],- },- }))- .with(TeamMemberRole.MANAGER, () => ({- visibility: {- in: [DocumentVisibility.EVERYONE, DocumentVisibility.MANAGER_AND_ABOVE],- },- }))- .otherwise(() => ({ visibility: DocumentVisibility.EVERYONE }));+ const visibilityFilters = {+ visibility: {+ in: TEAM_DOCUMENT_VISIBILITY_MAP[team.currentTeamRole],+ },+ };const whereClause = {AND: [@@ -69,13 +57,15 @@ export const findFolders = async ({ userId, teamId, parentId, type }: FindFoldercreatedAt: 'desc',},}),- prisma.document.count({+ prisma.envelope.count({where: {+ type: EnvelopeType.DOCUMENT,folderId: folder.id,},}),- prisma.template.count({+ prisma.envelope.count({where: {+ type: EnvelopeType.TEMPLATE,folderId: folder.id,},}),diff --git a/packages/lib/server-only/folder/move-document-to-folder.ts b/packages/lib/server-only/folder/move-document-to-folder.tsdeleted file mode 100644index 9cc0e25e7..000000000--- a/packages/lib/server-only/folder/move-document-to-folder.ts+++ /dev/null@@ -1,92 +0,0 @@-import { TeamMemberRole } from '@prisma/client';-import { match } from 'ts-pattern';--import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { DocumentVisibility } from '@documenso/lib/types/document-visibility';-import { FolderType } from '@documenso/lib/types/folder-type';-import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';-import { prisma } from '@documenso/prisma';--import { getTeamById } from '../team/get-team';--export interface MoveDocumentToFolderOptions {- userId: number;- teamId: number;- documentId: number;- folderId?: string | null;- requestMetadata?: ApiRequestMetadata;-}--export const moveDocumentToFolder = async ({- userId,- teamId,- documentId,- folderId,-}: MoveDocumentToFolderOptions) => {- const team = await getTeamById({ userId, teamId });-- const visibilityFilters = match(team.currentTeamRole)- .with(TeamMemberRole.ADMIN, () => ({- visibility: {- in: [- DocumentVisibility.EVERYONE,- DocumentVisibility.MANAGER_AND_ABOVE,- DocumentVisibility.ADMIN,- ],- },- }))- .with(TeamMemberRole.MANAGER, () => ({- visibility: {- in: [DocumentVisibility.EVERYONE, DocumentVisibility.MANAGER_AND_ABOVE],- },- }))- .otherwise(() => ({ visibility: DocumentVisibility.EVERYONE }));-- const documentWhereClause = {- id: documentId,- OR: [- { teamId, ...visibilityFilters },- { userId, teamId },- ],- };-- const document = await prisma.document.findFirst({- where: documentWhereClause,- });-- if (!document) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document not found',- });- }-- if (folderId) {- const folderWhereClause = {- id: folderId,- type: FolderType.DOCUMENT,- OR: [- { teamId, ...visibilityFilters },- { userId, teamId },- ],- };-- const folder = await prisma.folder.findFirst({- where: folderWhereClause,- });-- if (!folder) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }- }-- return await prisma.document.update({- where: {- id: documentId,- },- data: {- folderId,- },- });-};diff --git a/packages/lib/server-only/folder/move-template-to-folder.ts b/packages/lib/server-only/folder/move-template-to-folder.tsdeleted file mode 100644index c2e759de6..000000000--- a/packages/lib/server-only/folder/move-template-to-folder.ts+++ /dev/null@@ -1,63 +0,0 @@-import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { FolderType } from '@documenso/lib/types/folder-type';-import { prisma } from '@documenso/prisma';--import { buildTeamWhereQuery } from '../../utils/teams';--export interface MoveTemplateToFolderOptions {- userId: number;- teamId?: number;- templateId: number;- folderId?: string | null;-}--export const moveTemplateToFolder = async ({- userId,- teamId,- templateId,- folderId,-}: MoveTemplateToFolderOptions) => {- const template = await prisma.template.findFirst({- where: {- id: templateId,- team: buildTeamWhereQuery({- teamId,- userId,- }),- },- });-- if (!template) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Template not found',- });- }-- if (folderId !== null) {- const folder = await prisma.folder.findFirst({- where: {- id: folderId,- team: buildTeamWhereQuery({- teamId,- userId,- }),- type: FolderType.TEMPLATE,- },- });-- if (!folder) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }- }-- return await prisma.template.update({- where: {- id: templateId,- },- data: {- folderId,- },- });-};diff --git a/packages/lib/server-only/pdf/add-rejection-stamp-to-pdf.ts b/packages/lib/server-only/pdf/add-rejection-stamp-to-pdf.tsindex c0f2b123a..47b372af9 100644--- a/packages/lib/server-only/pdf/add-rejection-stamp-to-pdf.ts+++ b/packages/lib/server-only/pdf/add-rejection-stamp-to-pdf.ts@@ -1,6 +1,6 @@+import type { PDFDocument } from '@cantoo/pdf-lib';+import { TextAlignment, rgb, setFontAndSize } from '@cantoo/pdf-lib';import fontkit from '@pdf-lib/fontkit';-import type { PDFDocument } from 'pdf-lib';-import { TextAlignment, rgb, setFontAndSize } from 'pdf-lib';import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';import { getPageSize } from './get-page-size';diff --git a/packages/lib/server-only/pdf/flatten-annotations.ts b/packages/lib/server-only/pdf/flatten-annotations.tsindex 83ac860e0..6ceb2f201 100644--- a/packages/lib/server-only/pdf/flatten-annotations.ts+++ b/packages/lib/server-only/pdf/flatten-annotations.ts@@ -1,4 +1,4 @@-import { PDFAnnotation, PDFRef } from 'pdf-lib';+import { PDFAnnotation, PDFRef } from '@cantoo/pdf-lib';import {PDFDict,type PDFDocument,@@ -8,7 +8,7 @@ import {pushGraphicsState,rotateInPlace,translate,-} from 'pdf-lib';+} from '@cantoo/pdf-lib';export const flattenAnnotations = (document: PDFDocument) => {const pages = document.getPages();diff --git a/packages/lib/server-only/pdf/flatten-form.ts b/packages/lib/server-only/pdf/flatten-form.tsindex ab5b17a1c..ccd80973f 100644--- a/packages/lib/server-only/pdf/flatten-form.ts+++ b/packages/lib/server-only/pdf/flatten-form.ts@@ -1,5 +1,4 @@-import fontkit from '@pdf-lib/fontkit';-import type { PDFField, PDFWidgetAnnotation } from 'pdf-lib';+import type { PDFField, PDFWidgetAnnotation } from '@cantoo/pdf-lib';import {PDFCheckBox,PDFDict,@@ -12,7 +11,8 @@ import {pushGraphicsState,rotateInPlace,translate,-} from 'pdf-lib';+} from '@cantoo/pdf-lib';+import fontkit from '@pdf-lib/fontkit';import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';diff --git a/packages/lib/server-only/pdf/get-page-size.ts b/packages/lib/server-only/pdf/get-page-size.tsindex 76c5babf7..21d8a1327 100644--- a/packages/lib/server-only/pdf/get-page-size.ts+++ b/packages/lib/server-only/pdf/get-page-size.ts@@ -1,4 +1,4 @@-import type { PDFPage } from 'pdf-lib';+import type { PDFPage } from '@cantoo/pdf-lib';/*** Gets the effective page size for PDF operations.diff --git a/packages/lib/server-only/pdf/insert-field-in-pdf.ts b/packages/lib/server-only/pdf/insert-field-in-pdf-v1.tssimilarity index 99%rename from packages/lib/server-only/pdf/insert-field-in-pdf.tsrename to packages/lib/server-only/pdf/insert-field-in-pdf-v1.tsindex 9b2b8183b..a72558a07 100644--- a/packages/lib/server-only/pdf/insert-field-in-pdf.ts+++ b/packages/lib/server-only/pdf/insert-field-in-pdf-v1.ts@@ -1,7 +1,5 @@// https://github.com/Hopding/pdf-lib/issues/20#issuecomment-412852821-import fontkit from '@pdf-lib/fontkit';-import { FieldType } from '@prisma/client';-import type { PDFDocument, PDFFont, PDFTextField } from 'pdf-lib';+import type { PDFDocument, PDFFont, PDFTextField } from '@cantoo/pdf-lib';import {RotationTypes,TextAlignment,@@ -9,7 +7,9 @@ import {radiansToDegrees,rgb,setFontAndSize,-} from 'pdf-lib';+} from '@cantoo/pdf-lib';+import fontkit from '@pdf-lib/fontkit';+import { FieldType } from '@prisma/client';import { P, match } from 'ts-pattern';import {@@ -35,7 +35,7 @@ import {} from '../../types/field-meta';import { getPageSize } from './get-page-size';-export const insertFieldInPDF = async (pdf: PDFDocument, field: FieldWithSignature) => {+export const insertFieldInPDFV1 = async (pdf: PDFDocument, field: FieldWithSignature) => {const [fontCaveat, fontNoto] = await Promise.all([fetch(`${NEXT_PUBLIC_WEBAPP_URL()}/fonts/caveat.ttf`).then(async (res) => res.arrayBuffer()),fetch(`${NEXT_PUBLIC_WEBAPP_URL()}/fonts/noto-sans.ttf`).then(async (res) => res.arrayBuffer()),diff --git a/packages/lib/server-only/pdf/insert-field-in-pdf-v2.ts b/packages/lib/server-only/pdf/insert-field-in-pdf-v2.tsnew file mode 100644index 000000000..cd1ec2c30--- /dev/null+++ b/packages/lib/server-only/pdf/insert-field-in-pdf-v2.ts@@ -0,0 +1,133 @@+import type { PDFDocument } from '@cantoo/pdf-lib';+import { RotationTypes, radiansToDegrees } from '@cantoo/pdf-lib';+import fontkit from '@pdf-lib/fontkit';+import Konva from 'konva';+import 'konva/skia-backend';+import fs from 'node:fs';+import type { Canvas } from 'skia-canvas';+import { match } from 'ts-pattern';++import { isSignatureFieldType } from '@documenso/prisma/guards/is-signature-field';+import type { FieldWithSignature } from '@documenso/prisma/types/field-with-signature';++import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';+import { renderField } from '../../universal/field-renderer/render-field';+import { getPageSize } from './get-page-size';++// const font = await pdf.embedFont(+// isSignatureField ? fontCaveat : fontNoto,+// isSignatureField ? { features: { calt: false } } : undefined,+// );+// const minFontSize = isSignatureField ? MIN_HANDWRITING_FONT_SIZE : MIN_STANDARD_FONT_SIZE;+// const maxFontSize = isSignatureField ? DEFAULT_HANDWRITING_FONT_SIZE : DEFAULT_STANDARD_FONT_SIZE;++export const insertFieldInPDFV2 = async (pdf: PDFDocument, field: FieldWithSignature) => {+ const [fontCaveat, fontNoto] = await Promise.all([+ fetch(`${NEXT_PUBLIC_WEBAPP_URL()}/fonts/caveat.ttf`).then(async (res) => res.arrayBuffer()),+ fetch(`${NEXT_PUBLIC_WEBAPP_URL()}/fonts/noto-sans.ttf`).then(async (res) => res.arrayBuffer()),+ ]);++ const isSignatureField = isSignatureFieldType(field.type);++ pdf.registerFontkit(fontkit);++ const pages = pdf.getPages();++ const page = pages.at(field.page - 1);++ if (!page) {+ throw new Error(`Page ${field.page} does not exist`);+ }++ const pageRotation = page.getRotation();++ let pageRotationInDegrees = match(pageRotation.type)+ .with(RotationTypes.Degrees, () => pageRotation.angle)+ .with(RotationTypes.Radians, () => radiansToDegrees(pageRotation.angle))+ .exhaustive();++ // Round to the closest multiple of 90 degrees.+ pageRotationInDegrees = Math.round(pageRotationInDegrees / 90) * 90;++ const isPageRotatedToLandscape = pageRotationInDegrees === 90 || pageRotationInDegrees === 270;++ // Todo: Evenloeps - getPageSize this had extra logic? Ask lucas++ console.log({+ cropBox: page.getCropBox(),+ mediaBox: page.getMediaBox(),+ mediaBox2: page.getSize(),+ });++ const { width: pageWidth, height: pageHeight } = getPageSize(page);++ // PDFs can have pages that are rotated, which are correctly rendered in the frontend.+ // However when we load the PDF in the backend, the rotation is applied.+ //+ // To account for this, we swap the width and height for pages that are rotated by 90/270+ // degrees. This is so we can calculate the virtual position the field was placed if it+ // was correctly oriented in the frontend.+ //+ // Then when we insert the fields, we apply a transformation to the position of the field+ // so it is rotated correctly.+ if (isPageRotatedToLandscape) {+ // [pageWidth, pageHeight] = [pageHeight, pageWidth];+ }++ console.log({+ pageWidth,+ pageHeight,+ fieldWidth: field.width,+ fieldHeight: field.height,+ });++ const stage = new Konva.Stage({ width: pageWidth, height: pageHeight });+ const layer = new Konva.Layer();++ // Will render onto the layer.+ renderField({+ field: {+ renderId: field.id.toString(),+ ...field,+ width: Number(field.width),+ height: Number(field.height),+ positionX: Number(field.positionX),+ positionY: Number(field.positionY),+ },+ pageLayer: layer,+ pageWidth,+ pageHeight,+ mode: 'export',+ });++ stage.add(layer);+ const canvas = layer.canvas._canvas as unknown as Canvas;++ const renderedField = await canvas.toBuffer('svg');++ fs.writeFileSync(+ `rendered-field-${field.envelopeId}--${field.id}.svg`,+ renderedField.toString('utf-8'),+ );++ // Embed the SVG into the PDF+ const svgElement = await pdf.embedSvg(renderedField.toString('utf-8'));++ // Calculate position to cover the whole page+ // pdf-lib coordinates: (0,0) is bottom-left, y increases upward+ const svgWidth = pageWidth; // Use full page width+ const svgHeight = pageHeight; // Use full page height++ const x = 0; // Start from left edge+ const y = pageHeight; // Start from bottom edge++ // Draw the SVG on the page+ page.drawSvg(svgElement, {+ x: x,+ y: y,+ width: svgWidth,+ height: svgHeight,+ });++ return pdf;+};diff --git a/packages/lib/server-only/pdf/insert-form-values-in-pdf.ts b/packages/lib/server-only/pdf/insert-form-values-in-pdf.tsindex a3c311895..a79f3b504 100644--- a/packages/lib/server-only/pdf/insert-form-values-in-pdf.ts+++ b/packages/lib/server-only/pdf/insert-form-values-in-pdf.ts@@ -1,4 +1,10 @@-import { PDFCheckBox, PDFDocument, PDFDropdown, PDFRadioGroup, PDFTextField } from 'pdf-lib';+import {+ PDFCheckBox,+ PDFDocument,+ PDFDropdown,+ PDFRadioGroup,+ PDFTextField,+} from '@cantoo/pdf-lib';export type InsertFormValuesInPdfOptions = {pdf: Buffer;diff --git a/packages/lib/server-only/pdf/insert-image-in-pdf.ts b/packages/lib/server-only/pdf/insert-image-in-pdf.tsindex b3c1df517..d896ab668 100644--- a/packages/lib/server-only/pdf/insert-image-in-pdf.ts+++ b/packages/lib/server-only/pdf/insert-image-in-pdf.ts@@ -1,4 +1,4 @@-import { PDFDocument } from 'pdf-lib';+import { PDFDocument } from '@cantoo/pdf-lib';export async function insertImageInPDF(pdfAsBase64: string,diff --git a/packages/lib/server-only/pdf/insert-text-in-pdf.ts b/packages/lib/server-only/pdf/insert-text-in-pdf.tsindex d4bd5fe81..7dda44db9 100644--- a/packages/lib/server-only/pdf/insert-text-in-pdf.ts+++ b/packages/lib/server-only/pdf/insert-text-in-pdf.ts@@ -1,5 +1,5 @@+import { PDFDocument, StandardFonts, rgb } from '@cantoo/pdf-lib';import fontkit from '@pdf-lib/fontkit';-import { PDFDocument, StandardFonts, rgb } from 'pdf-lib';import { CAVEAT_FONT_PATH } from '../../constants/pdf';diff --git a/packages/lib/server-only/pdf/legacy-insert-field-in-pdf.ts b/packages/lib/server-only/pdf/legacy-insert-field-in-pdf.tsindex 86ceea65f..9d6fa5445 100644--- a/packages/lib/server-only/pdf/legacy-insert-field-in-pdf.ts+++ b/packages/lib/server-only/pdf/legacy-insert-field-in-pdf.ts@@ -1,8 +1,8 @@// https://github.com/Hopding/pdf-lib/issues/20#issuecomment-412852821+import type { PDFDocument } from '@cantoo/pdf-lib';+import { RotationTypes, degrees, radiansToDegrees, rgb } from '@cantoo/pdf-lib';import fontkit from '@pdf-lib/fontkit';import { FieldType } from '@prisma/client';-import type { PDFDocument } from 'pdf-lib';-import { RotationTypes, degrees, radiansToDegrees, rgb } from 'pdf-lib';import { P, match } from 'ts-pattern';import {diff --git a/packages/lib/server-only/pdf/normalize-pdf.ts b/packages/lib/server-only/pdf/normalize-pdf.tsindex 68ec96a73..ffbe5be06 100644--- a/packages/lib/server-only/pdf/normalize-pdf.ts+++ b/packages/lib/server-only/pdf/normalize-pdf.ts@@ -1,4 +1,4 @@-import { PDFDocument } from 'pdf-lib';+import { PDFDocument } from '@cantoo/pdf-lib';import { flattenAnnotations } from './flatten-annotations';import { flattenForm, removeOptionalContentGroups } from './flatten-form';diff --git a/packages/lib/server-only/pdf/normalize-signature-appearances.ts b/packages/lib/server-only/pdf/normalize-signature-appearances.tsindex d8bb83563..b76a88f63 100644--- a/packages/lib/server-only/pdf/normalize-signature-appearances.ts+++ b/packages/lib/server-only/pdf/normalize-signature-appearances.ts@@ -1,5 +1,5 @@-import type { PDFDocument } from 'pdf-lib';-import { PDFSignature, rectangle } from 'pdf-lib';+import type { PDFDocument } from '@cantoo/pdf-lib';+import { PDFSignature, rectangle } from '@cantoo/pdf-lib';export const normalizeSignatureAppearances = (document: PDFDocument) => {const form = document.getForm();diff --git a/packages/lib/server-only/profile/get-public-profile-by-url.ts b/packages/lib/server-only/profile/get-public-profile-by-url.tsindex 1c9a2133e..e92c39f00 100644--- a/packages/lib/server-only/profile/get-public-profile-by-url.ts+++ b/packages/lib/server-only/profile/get-public-profile-by-url.ts@@ -1,5 +1,5 @@-import type { Template, TemplateDirectLink } from '@prisma/client';-import { type TeamProfile, TemplateType } from '@prisma/client';+import type { Envelope, TemplateDirectLink } from '@prisma/client';+import { EnvelopeType, type TeamProfile, TemplateType } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -9,11 +9,8 @@ export type GetPublicProfileByUrlOptions = {profileUrl: string;};-type PublicDirectLinkTemplate = Template & {- type: 'PUBLIC';- directLink: TemplateDirectLink & {- enabled: true;- };+type PublicDirectLinkTemplate = Pick<Envelope, 'id' | 'publicTitle' | 'publicDescription'> & {+ directLink: TemplateDirectLink;};type GetPublicProfileByUrlResponse = {@@ -43,12 +40,13 @@ export const getPublicProfileByUrl = async ({},include: {profile: true,- templates: {+ envelopes: {where: {+ type: EnvelopeType.TEMPLATE,+ templateType: TemplateType.PUBLIC,directLink: {enabled: true,},- type: TemplateType.PUBLIC,},include: {directLink: true,@@ -68,13 +66,28 @@ export const getPublicProfileByUrl = async ({type: 'Premium',since: team.createdAt,},- profile: team.profile,+ profile: {+ teamId: team.profile.teamId,+ id: team.profile.id,+ enabled: team.profile.enabled,+ bio: team.profile.bio,+ },url: profileUrl,avatarImageId: team.avatarImageId,name: team.name || '',- templates: team.templates.filter(- (template): template is PublicDirectLinkTemplate =>- template.directLink?.enabled === true && template.type === TemplateType.PUBLIC,- ),+ templates: team.envelopes.map((template) => {+ const directLink = template.directLink;++ if (!directLink || !directLink.enabled || template.templateType !== TemplateType.PUBLIC) {+ throw new Error('Not possible');+ }++ return {+ id: template.id,+ publicTitle: template.publicTitle,+ publicDescription: template.publicDescription,+ directLink,+ };+ }),};};diff --git a/packages/lib/server-only/recipient/create-document-recipients.ts b/packages/lib/server-only/recipient/create-document-recipients.tsindex 4baac9f1c..d2b2e0d13 100644--- a/packages/lib/server-only/recipient/create-document-recipients.ts+++ b/packages/lib/server-only/recipient/create-document-recipients.ts@@ -1,4 +1,4 @@-import { RecipientRole } from '@prisma/client';+import { EnvelopeType, RecipientRole } from '@prisma/client';import { SendStatus, SigningStatus } from '@prisma/client';import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';@@ -11,12 +11,14 @@ import { createRecipientAuthOptions } from '@documenso/lib/utils/document-auth';import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapRecipientToLegacyRecipient } from '../../utils/recipients';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface CreateDocumentRecipientsOptions {userId: number;teamId: number;- documentId: number;+ id: EnvelopeIdOptions;recipients: {email: string;name: string;@@ -31,18 +33,19 @@ export interface CreateDocumentRecipientsOptions {export const createDocumentRecipients = async ({userId,teamId,- documentId,+ id,recipients: recipientsToCreate,requestMetadata,}: CreateDocumentRecipientsOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,team: {@@ -57,13 +60,13 @@ export const createDocumentRecipients = async ({},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- if (document.completedAt) {+ if (envelope.completedAt) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document already complete',});@@ -74,7 +77,7 @@ export const createDocumentRecipients = async ({);// Check if user has permission to set the global action auth.- if (recipientsHaveActionAuth && !document.team.organisation.organisationClaim.flags.cfr21) {+ if (recipientsHaveActionAuth && !envelope.team.organisation.organisationClaim.flags.cfr21) {throw new AppError(AppErrorCode.UNAUTHORIZED, {message: 'You do not have permission to set the action auth',});@@ -95,7 +98,7 @@ export const createDocumentRecipients = async ({const createdRecipient = await tx.recipient.create({data: {- documentId,+ envelopeId: envelope.id,name: recipient.name,email: recipient.email,role: recipient.role,@@ -112,7 +115,7 @@ export const createDocumentRecipients = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_CREATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {recipientEmail: createdRecipient.email,@@ -131,6 +134,8 @@ export const createDocumentRecipients = async ({});return {- recipients: createdRecipients,+ recipients: createdRecipients.map((recipient) =>+ mapRecipientToLegacyRecipient(recipient, envelope),+ ),};};diff --git a/packages/lib/server-only/recipient/create-template-recipients.ts b/packages/lib/server-only/recipient/create-template-recipients.tsindex 1621e87b7..e64e00cfe 100644--- a/packages/lib/server-only/recipient/create-template-recipients.ts+++ b/packages/lib/server-only/recipient/create-template-recipients.ts@@ -1,4 +1,4 @@-import { RecipientRole } from '@prisma/client';+import { EnvelopeType, RecipientRole } from '@prisma/client';import { SendStatus, SigningStatus } from '@prisma/client';import type { TRecipientAccessAuthTypes } from '@documenso/lib/types/document-auth';@@ -8,7 +8,8 @@ import { createRecipientAuthOptions } from '@documenso/lib/utils/document-auth';import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { buildTeamWhereQuery } from '../../utils/teams';+import { mapRecipientToLegacyRecipient } from '../../utils/recipients';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface CreateTemplateRecipientsOptions {userId: number;@@ -30,11 +31,18 @@ export const createTemplateRecipients = async ({templateId,recipients: recipientsToCreate,}: CreateTemplateRecipientsOptions) => {- const template = await prisma.template.findFirst({- where: {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'templateId',id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),},+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const template = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,team: {@@ -81,7 +89,7 @@ export const createTemplateRecipients = async ({const createdRecipient = await tx.recipient.create({data: {- templateId,+ envelopeId: template.id,name: recipient.name,email: recipient.email,role: recipient.role,@@ -100,6 +108,8 @@ export const createTemplateRecipients = async ({});return {- recipients: createdRecipients,+ recipients: createdRecipients.map((recipient) =>+ mapRecipientToLegacyRecipient(recipient, template),+ ),};};diff --git a/packages/lib/server-only/recipient/delete-document-recipient.ts b/packages/lib/server-only/recipient/delete-document-recipient.tsindex bff48beb7..dfefd1f23 100644--- a/packages/lib/server-only/recipient/delete-document-recipient.ts+++ b/packages/lib/server-only/recipient/delete-document-recipient.ts@@ -1,7 +1,7 @@import { createElement } from 'react';import { msg } from '@lingui/core/macro';-import { SendStatus } from '@prisma/client';+import { EnvelopeType, SendStatus } from '@prisma/client';import { mailer } from '@documenso/email/mailer';import RecipientRemovedFromDocumentTemplate from '@documenso/email/templates/recipient-removed-from-document';@@ -30,9 +30,10 @@ export const deleteDocumentRecipient = async ({teamId,recipientId,requestMetadata,-}: DeleteDocumentRecipientOptions): Promise<void> => {- const document = await prisma.document.findFirst({+}: DeleteDocumentRecipientOptions) => {+ const envelope = await prisma.envelope.findFirst({where: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {id: recipientId,@@ -62,13 +63,13 @@ export const deleteDocumentRecipient = async ({},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- if (document.completedAt) {+ if (envelope.completedAt) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document already complete',});@@ -80,7 +81,7 @@ export const deleteDocumentRecipient = async ({});}- const recipientToDelete = document.recipients[0];+ const recipientToDelete = envelope.recipients[0];if (!recipientToDelete || recipientToDelete.id !== recipientId) {throw new AppError(AppErrorCode.NOT_FOUND, {@@ -88,17 +89,11 @@ export const deleteDocumentRecipient = async ({});}- await prisma.$transaction(async (tx) => {- await tx.recipient.delete({- where: {- id: recipientId,- },- });-+ const deletedRecipient = await prisma.$transaction(async (tx) => {await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_DELETED,- documentId: document.id,+ envelopeId: envelope.id,metadata: requestMetadata,data: {recipientEmail: recipientToDelete.email,@@ -108,10 +103,16 @@ export const deleteDocumentRecipient = async ({},}),});++ return await tx.recipient.delete({+ where: {+ id: recipientId,+ },+ });});const isRecipientRemovedEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientRemoved;// Send email to deleted recipient.@@ -119,8 +120,8 @@ export const deleteDocumentRecipient = async ({const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const template = createElement(RecipientRemovedFromDocumentTemplate, {- documentName: document.title,- inviterName: document.team?.name || user.name || undefined,+ documentName: envelope.title,+ inviterName: envelope.team?.name || user.name || undefined,assetBaseUrl,});@@ -128,9 +129,9 @@ export const deleteDocumentRecipient = async ({emailType: 'RECIPIENT',source: {type: 'team',- teamId: document.teamId,+ teamId: envelope.teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});const [html, text] = await Promise.all([@@ -152,4 +153,6 @@ export const deleteDocumentRecipient = async ({text,});}++ return deletedRecipient;};diff --git a/packages/lib/server-only/recipient/delete-recipient.ts b/packages/lib/server-only/recipient/delete-recipient.tsdeleted file mode 100644index 4596c2427..000000000--- a/packages/lib/server-only/recipient/delete-recipient.ts+++ /dev/null@@ -1,88 +0,0 @@-import { SendStatus } from '@prisma/client';--import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import type { RequestMetadata } from '../../universal/extract-request-metadata';-import { createDocumentAuditLogData } from '../../utils/document-audit-logs';-import { buildTeamWhereQuery } from '../../utils/teams';--export type DeleteRecipientOptions = {- documentId: number;- recipientId: number;- userId: number;- teamId: number;- requestMetadata?: RequestMetadata;-};--export const deleteRecipient = async ({- documentId,- recipientId,- userId,- teamId,- requestMetadata,-}: DeleteRecipientOptions) => {- const recipient = await prisma.recipient.findFirst({- where: {- id: recipientId,- document: {- id: documentId,- userId,- team: buildTeamWhereQuery({ teamId, userId }),- },- },- });-- if (!recipient) {- throw new Error('Recipient not found');- }-- if (recipient.sendStatus !== SendStatus.NOT_SENT) {- throw new Error('Can not delete a recipient that has already been sent a document');- }-- const user = await prisma.user.findFirstOrThrow({- where: {- id: userId,- },- });-- const team = await prisma.team.findFirst({- where: buildTeamWhereQuery({ teamId, userId }),- });-- if (!team) {- throw new AppError(AppErrorCode.NOT_FOUND);- }-- const deletedRecipient = await prisma.$transaction(async (tx) => {- const deleted = await tx.recipient.delete({- where: {- id: recipient.id,- },- });-- await tx.documentAuditLog.create({- data: createDocumentAuditLogData({- type: 'RECIPIENT_DELETED',- documentId,- user: {- id: team?.id ?? user.id,- email: team?.name ?? user.email,- name: team ? '' : user.name,- },- data: {- recipientEmail: recipient.email,- recipientName: recipient.name,- recipientId: recipient.id,- recipientRole: recipient.role,- },- requestMetadata,- }),- });-- return deleted;- });-- return deletedRecipient;-};diff --git a/packages/lib/server-only/recipient/delete-template-recipient.ts b/packages/lib/server-only/recipient/delete-template-recipient.tsindex d042d1d2d..839526f3b 100644--- a/packages/lib/server-only/recipient/delete-template-recipient.ts+++ b/packages/lib/server-only/recipient/delete-template-recipient.ts@@ -1,7 +1,10 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';import { buildTeamWhereQuery } from '../../utils/teams';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface DeleteTemplateRecipientOptions {userId: number;@@ -14,31 +17,31 @@ export const deleteTemplateRecipient = async ({teamId,recipientId,}: DeleteTemplateRecipientOptions): Promise<void> => {- const template = await prisma.template.findFirst({+ const recipientToDelete = await prisma.recipient.findFirst({where: {- recipients: {- some: {- id: recipientId,- },- },- team: buildTeamWhereQuery({ teamId, userId }),- },- include: {- recipients: {- where: {- id: recipientId,- },+ id: recipientId,+ envelope: {+ type: EnvelopeType.TEMPLATE,+ team: buildTeamWhereQuery({ teamId, userId }),},},});- if (!template) {+ if (!recipientToDelete) {throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Template not found',+ message: 'Recipient not found',});}- const recipientToDelete = template.recipients[0];+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: recipientToDelete.envelopeId,+ },+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });if (!recipientToDelete || recipientToDelete.id !== recipientId) {throw new AppError(AppErrorCode.NOT_FOUND, {@@ -49,6 +52,7 @@ export const deleteTemplateRecipient = async ({await prisma.recipient.delete({where: {id: recipientId,+ envelope: envelopeWhereInput,},});};diff --git a/packages/lib/server-only/recipient/get-is-recipient-turn.ts b/packages/lib/server-only/recipient/get-is-recipient-turn.tsindex e8ef9f126..44127f8ef 100644--- a/packages/lib/server-only/recipient/get-is-recipient-turn.ts+++ b/packages/lib/server-only/recipient/get-is-recipient-turn.ts@@ -1,4 +1,4 @@-import { DocumentSigningOrder, SigningStatus } from '@prisma/client';+import { DocumentSigningOrder, EnvelopeType, SigningStatus } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -7,8 +7,9 @@ export type GetIsRecipientTurnOptions = {};export async function getIsRecipientsTurnToSign({ token }: GetIsRecipientTurnOptions) {- const document = await prisma.document.findFirstOrThrow({+ const envelope = await prisma.envelope.findFirstOrThrow({where: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {token,@@ -25,11 +26,11 @@ export async function getIsRecipientsTurnToSign({ token }: GetIsRecipientTurnOpt},});- if (document.documentMeta?.signingOrder !== DocumentSigningOrder.SEQUENTIAL) {+ if (envelope.documentMeta?.signingOrder !== DocumentSigningOrder.SEQUENTIAL) {return true;}- const { recipients } = document;+ const { recipients } = envelope;const currentRecipientIndex = recipients.findIndex((r) => r.token === token);diff --git a/packages/lib/server-only/recipient/get-next-pending-recipient.ts b/packages/lib/server-only/recipient/get-next-pending-recipient.tsindex 5b3811268..14158ab23 100644--- a/packages/lib/server-only/recipient/get-next-pending-recipient.ts+++ b/packages/lib/server-only/recipient/get-next-pending-recipient.ts@@ -1,5 +1,9 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';+import { mapDocumentIdToSecondaryId } from '../../utils/envelope';+export const getNextPendingRecipient = async ({documentId,currentRecipientId,@@ -9,7 +13,10 @@ export const getNextPendingRecipient = async ({}) => {const recipients = await prisma.recipient.findMany({where: {- documentId,+ envelope: {+ type: EnvelopeType.DOCUMENT,+ secondaryId: mapDocumentIdToSecondaryId(documentId),+ },},orderBy: [{diff --git a/packages/lib/server-only/recipient/get-recipient-by-email.ts b/packages/lib/server-only/recipient/get-recipient-by-email.tsdeleted file mode 100644index 349149105..000000000--- a/packages/lib/server-only/recipient/get-recipient-by-email.ts+++ /dev/null@@ -1,21 +0,0 @@-import { prisma } from '@documenso/prisma';--export type GetRecipientByEmailOptions = {- documentId: number;- email: string;-};--export const getRecipientByEmail = async ({ documentId, email }: GetRecipientByEmailOptions) => {- const recipient = await prisma.recipient.findFirst({- where: {- documentId,- email: email.toLowerCase(),- },- });-- if (!recipient) {- throw new Error('Recipient not found');- }-- return recipient;-};diff --git a/packages/lib/server-only/recipient/get-recipient-by-id-v1-api.ts b/packages/lib/server-only/recipient/get-recipient-by-id-v1-api.tsdeleted file mode 100644index 6f5cef204..000000000--- a/packages/lib/server-only/recipient/get-recipient-by-id-v1-api.ts+++ /dev/null@@ -1,21 +0,0 @@-import { prisma } from '@documenso/prisma';--export type GetRecipientByIdOptions = {- id: number;- documentId: number;-};--export const getRecipientByIdV1Api = async ({ documentId, id }: GetRecipientByIdOptions) => {- const recipient = await prisma.recipient.findFirst({- where: {- documentId,- id,- },- });-- if (!recipient) {- throw new Error('Recipient not found');- }-- return recipient;-};diff --git a/packages/lib/server-only/recipient/get-recipient-by-id.ts b/packages/lib/server-only/recipient/get-recipient-by-id.tsindex a647d021b..57a5d9b5b 100644--- a/packages/lib/server-only/recipient/get-recipient-by-id.ts+++ b/packages/lib/server-only/recipient/get-recipient-by-id.ts@@ -1,12 +1,16 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import { mapSecondaryIdToDocumentId, mapSecondaryIdToTemplateId } from '../../utils/envelope';import { buildTeamWhereQuery } from '../../utils/teams';export type GetRecipientByIdOptions = {recipientId: number;userId: number;teamId: number;+ type: EnvelopeType;};/**@@ -17,16 +21,23 @@ export const getRecipientById = async ({recipientId,userId,teamId,+ type,}: GetRecipientByIdOptions) => {const recipient = await prisma.recipient.findFirst({where: {id: recipientId,- document: {+ envelope: {+ type,team: buildTeamWhereQuery({ teamId, userId }),},},include: {fields: true,+ envelope: {+ select: {+ secondaryId: true,+ },+ },},});@@ -36,5 +47,26 @@ export const getRecipientById = async ({});}- return recipient;+ const legacyId = {+ documentId:+ type === EnvelopeType.DOCUMENT+ ? mapSecondaryIdToDocumentId(recipient.envelope.secondaryId)+ : null,+ templateId:+ type === EnvelopeType.TEMPLATE+ ? mapSecondaryIdToTemplateId(recipient.envelope.secondaryId)+ : null,+ };++ // Backwards compatibility mapping.+ return {+ ...recipient,+ ...legacyId,++ // eslint-disable-next-line unused-imports/no-unused-vars+ fields: recipient.fields.map((field) => ({+ ...field,+ ...legacyId,+ })),+ };};diff --git a/packages/lib/server-only/recipient/get-recipient-suggestions.ts b/packages/lib/server-only/recipient/get-recipient-suggestions.tsindex 9ffd64c29..94342df03 100644--- a/packages/lib/server-only/recipient/get-recipient-suggestions.ts+++ b/packages/lib/server-only/recipient/get-recipient-suggestions.ts@@ -1,11 +1,11 @@-import { Prisma } from '@prisma/client';+import { EnvelopeType, Prisma } from '@prisma/client';import { buildTeamWhereQuery } from '@documenso/lib/utils/teams';import { prisma } from '@documenso/prisma';export type GetRecipientSuggestionsOptions = {userId: number;- teamId?: number;+ teamId: number;query: string;};@@ -37,7 +37,8 @@ export const getRecipientSuggestions = async ({const recipients = await prisma.recipient.findMany({where: {- document: {+ envelope: {+ type: EnvelopeType.DOCUMENT,team: buildTeamWhereQuery({ teamId, userId }),},...nameEmailFilter,@@ -45,7 +46,7 @@ export const getRecipientSuggestions = async ({select: {name: true,email: true,- document: {+ envelope: {select: {createdAt: true,},@@ -53,7 +54,7 @@ export const getRecipientSuggestions = async ({},distinct: ['email'],orderBy: {- document: {+ envelope: {createdAt: 'desc',},},diff --git a/packages/lib/server-only/recipient/get-recipients-for-assistant.ts b/packages/lib/server-only/recipient/get-recipients-for-assistant.tsindex ba5154fb3..c79a57927 100644--- a/packages/lib/server-only/recipient/get-recipients-for-assistant.ts+++ b/packages/lib/server-only/recipient/get-recipients-for-assistant.ts@@ -23,7 +23,7 @@ export const getRecipientsForAssistant = async ({ token }: GetRecipientsForAssislet recipients = await prisma.recipient.findMany({where: {- documentId: assistant.documentId,+ envelopeId: assistant.envelopeId,signingOrder: {gte: assistant.signingOrder ?? 0,},@@ -39,7 +39,7 @@ export const getRecipientsForAssistant = async ({ token }: GetRecipientsForAssistype: {not: FieldType.SIGNATURE,},- documentId: assistant.documentId,+ envelopeId: assistant.envelopeId,},],},diff --git a/packages/lib/server-only/recipient/get-recipients-for-document.ts b/packages/lib/server-only/recipient/get-recipients-for-document.tsindex 3cfd79e4d..ffa6d2505 100644--- a/packages/lib/server-only/recipient/get-recipients-for-document.ts+++ b/packages/lib/server-only/recipient/get-recipients-for-document.ts@@ -1,6 +1,8 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface GetRecipientsForDocumentOptions {documentId: number;@@ -13,15 +15,19 @@ export const getRecipientsForDocument = async ({userId,teamId,}: GetRecipientsForDocumentOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,userId,teamId,});const recipients = await prisma.recipient.findMany({where: {- document: documentWhereInput,+ envelope: envelopeWhereInput,},orderBy: {id: 'asc',diff --git a/packages/lib/server-only/recipient/get-recipients-for-template.ts b/packages/lib/server-only/recipient/get-recipients-for-template.tsdeleted file mode 100644index 6d5c4c88f..000000000--- a/packages/lib/server-only/recipient/get-recipients-for-template.ts+++ /dev/null@@ -1,32 +0,0 @@-import { prisma } from '@documenso/prisma';--import { buildTeamWhereQuery } from '../../utils/teams';--export interface GetRecipientsForTemplateOptions {- templateId: number;- userId: number;- teamId: number;-}--export const getRecipientsForTemplate = async ({- templateId,- userId,- teamId,-}: GetRecipientsForTemplateOptions) => {- const recipients = await prisma.recipient.findMany({- where: {- templateId,- template: {- team: buildTeamWhereQuery({- teamId,- userId,- }),- },- },- orderBy: {- id: 'asc',- },- });-- return recipients;-};diff --git a/packages/lib/server-only/recipient/set-document-recipients.ts b/packages/lib/server-only/recipient/set-document-recipients.tsindex fd9ba5730..6d185ded4 100644--- a/packages/lib/server-only/recipient/set-document-recipients.ts+++ b/packages/lib/server-only/recipient/set-document-recipients.ts@@ -2,7 +2,7 @@ import { createElement } from 'react';import { msg } from '@lingui/core/macro';import type { Recipient } from '@prisma/client';-import { RecipientRole } from '@prisma/client';+import { EnvelopeType, RecipientRole } from '@prisma/client';import { SendStatus, SigningStatus } from '@prisma/client';import { isDeepEqual } from 'remeda';@@ -27,15 +27,16 @@ import { getI18nInstance } from '../../client-only/providers/i18n-server';import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';import { AppError, AppErrorCode } from '../../errors/app-error';import { extractDerivedDocumentEmailSettings } from '../../types/document-email';+import { type EnvelopeIdOptions, mapSecondaryIdToDocumentId } from '../../utils/envelope';import { canRecipientBeModified } from '../../utils/recipients';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';-import { getDocumentWhereInput } from '../document/get-document-by-id';import { getEmailContext } from '../email/get-email-context';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface SetDocumentRecipientsOptions {userId: number;teamId: number;- documentId: number;+ id: EnvelopeIdOptions;recipients: RecipientData[];requestMetadata: ApiRequestMetadata;}@@ -43,18 +44,19 @@ export interface SetDocumentRecipientsOptions {export const setDocumentRecipients = async ({userId,teamId,- documentId,+ id,recipients,requestMetadata,}: SetDocumentRecipientsOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {fields: true,documentMeta: true,@@ -67,6 +69,7 @@ export const setDocumentRecipients = async ({},},},+ recipients: true,},});@@ -81,11 +84,11 @@ export const setDocumentRecipients = async ({},});- if (!document) {+ if (!envelope) {throw new Error('Document not found');}- if (document.completedAt) {+ if (envelope.completedAt) {throw new Error('Document already complete');}@@ -95,7 +98,7 @@ export const setDocumentRecipients = async ({type: 'team',teamId,},- meta: document.documentMeta,+ meta: envelope.documentMeta,});const recipientsHaveActionAuth = recipients.some(@@ -103,7 +106,7 @@ export const setDocumentRecipients = async ({);// Check if user has permission to set the global action auth.- if (recipientsHaveActionAuth && !document.team.organisation.organisationClaim.flags.cfr21) {+ if (recipientsHaveActionAuth && !envelope.team.organisation.organisationClaim.flags.cfr21) {throw new AppError(AppErrorCode.UNAUTHORIZED, {message: 'You do not have permission to set the action auth',});@@ -114,11 +117,7 @@ export const setDocumentRecipients = async ({email: recipient.email.toLowerCase(),}));- const existingRecipients = await prisma.recipient.findMany({- where: {- documentId,- },- });+ const existingRecipients = envelope.recipients;const removedRecipients = existingRecipients.filter((existingRecipient) =>@@ -131,12 +130,12 @@ export const setDocumentRecipients = async ({);const canPersistedRecipientBeModified =- existing && canRecipientBeModified(existing, document.fields);+ existing && canRecipientBeModified(existing, envelope.fields);if (existing &&hasRecipientBeenChanged(existing, recipient) &&- !canRecipientBeModified(existing, document.fields)+ !canRecipientBeModified(existing, envelope.fields)) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Cannot modify a recipient who has already interacted with the document',@@ -172,14 +171,14 @@ export const setDocumentRecipients = async ({const upsertedRecipient = await tx.recipient.upsert({where: {id: recipient._persisted?.id ?? -1,- documentId,+ envelopeId: envelope.id,},update: {name: recipient.name,email: recipient.email,role: recipient.role,signingOrder: recipient.signingOrder,- documentId,+ envelopeId: envelope.id,sendStatus: recipient.role === RecipientRole.CC ? SendStatus.SENT : SendStatus.NOT_SENT,signingStatus:recipient.role === RecipientRole.CC ? SigningStatus.SIGNED : SigningStatus.NOT_SIGNED,@@ -191,7 +190,7 @@ export const setDocumentRecipients = async ({role: recipient.role,signingOrder: recipient.signingOrder,token: nanoid(),- documentId,+ envelopeId: envelope.id,sendStatus: recipient.role === RecipientRole.CC ? SendStatus.SENT : SendStatus.NOT_SENT,signingStatus:recipient.role === RecipientRole.CC ? SigningStatus.SIGNED : SigningStatus.NOT_SIGNED,@@ -230,7 +229,7 @@ export const setDocumentRecipients = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_UPDATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {changes,@@ -245,7 +244,7 @@ export const setDocumentRecipients = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_CREATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {...baseAuditLog,@@ -278,7 +277,7 @@ export const setDocumentRecipients = async ({data: removedRecipients.map((recipient) =>createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_DELETED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {recipientEmail: recipient.email,@@ -292,7 +291,7 @@ export const setDocumentRecipients = async ({});const isRecipientRemovedEmailEnabled = extractDerivedDocumentEmailSettings(- document.documentMeta,+ envelope.documentMeta,).recipientRemoved;// Send emails to deleted recipients.@@ -305,7 +304,7 @@ export const setDocumentRecipients = async ({const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const template = createElement(RecipientRemovedFromDocumentTemplate, {- documentName: document.title,+ documentName: envelope.title,inviterName: user.name || undefined,assetBaseUrl,});@@ -345,7 +344,11 @@ export const setDocumentRecipients = async ({});return {- recipients: [...filteredRecipients, ...persistedRecipients],+ recipients: [...filteredRecipients, ...persistedRecipients].map((recipient) => ({+ ...recipient,+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),+ templateId: null,+ })),};};diff --git a/packages/lib/server-only/recipient/set-template-recipients.ts b/packages/lib/server-only/recipient/set-template-recipients.tsindex 955ff94f1..1743968c1 100644--- a/packages/lib/server-only/recipient/set-template-recipients.ts+++ b/packages/lib/server-only/recipient/set-template-recipients.ts@@ -1,5 +1,5 @@import type { Recipient } from '@prisma/client';-import { RecipientRole } from '@prisma/client';+import { EnvelopeType, RecipientRole } from '@prisma/client';import {DIRECT_TEMPLATE_RECIPIENT_EMAIL,@@ -14,12 +14,13 @@ import {} from '../../types/document-auth';import { nanoid } from '../../universal/id';import { createRecipientAuthOptions } from '../../utils/document-auth';-import { buildTeamWhereQuery } from '../../utils/teams';+import { type EnvelopeIdOptions, mapSecondaryIdToTemplateId } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type SetTemplateRecipientsOptions = {userId: number;teamId: number;- templateId: number;+ id: EnvelopeIdOptions;recipients: {id?: number;email: string;@@ -33,14 +34,18 @@ export type SetTemplateRecipientsOptions = {export const setTemplateRecipients = async ({userId,teamId,- templateId,+ id,recipients,}: SetTemplateRecipientsOptions) => {- const template = await prisma.template.findFirst({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {directLink: true,team: {@@ -52,10 +57,11 @@ export const setTemplateRecipients = async ({},},},+ recipients: true,},});- if (!template) {+ if (!envelope) {throw new Error('Template not found');}@@ -64,7 +70,7 @@ export const setTemplateRecipients = async ({);// Check if user has permission to set the global action auth.- if (recipientsHaveActionAuth && !template.team.organisation.organisationClaim.flags.cfr21) {+ if (recipientsHaveActionAuth && !envelope.team.organisation.organisationClaim.flags.cfr21) {throw new AppError(AppErrorCode.UNAUTHORIZED, {message: 'You do not have permission to set the action auth',});@@ -72,7 +78,7 @@ export const setTemplateRecipients = async ({const normalizedRecipients = recipients.map((recipient) => {// Force replace any changes to the name or email of the direct recipient.- if (template.directLink && recipient.id === template.directLink.directTemplateRecipientId) {+ if (envelope.directLink && recipient.id === envelope.directLink.directTemplateRecipientId) {return {...recipient,email: DIRECT_TEMPLATE_RECIPIENT_EMAIL,@@ -86,24 +92,20 @@ export const setTemplateRecipients = async ({};});- const existingRecipients = await prisma.recipient.findMany({- where: {- templateId,- },- });+ const existingRecipients = envelope.recipients;const removedRecipients = existingRecipients.filter((existingRecipient) =>!normalizedRecipients.find((recipient) => recipient.id === existingRecipient.id),);- if (template.directLink !== null) {+ if (envelope.directLink !== null) {const updatedDirectRecipient = recipients.find(- (recipient) => recipient.id === template.directLink?.directTemplateRecipientId,+ (recipient) => recipient.id === envelope.directLink?.directTemplateRecipientId,);const deletedDirectRecipient = removedRecipients.find(- (recipient) => recipient.id === template.directLink?.directTemplateRecipientId,+ (recipient) => recipient.id === envelope.directLink?.directTemplateRecipientId,);if (updatedDirectRecipient?.role === RecipientRole.CC) {@@ -145,14 +147,14 @@ export const setTemplateRecipients = async ({const upsertedRecipient = await tx.recipient.upsert({where: {id: recipient._persisted?.id ?? -1,- templateId,+ envelopeId: envelope.id,},update: {name: recipient.name,email: recipient.email,role: recipient.role,signingOrder: recipient.signingOrder,- templateId,+ envelopeId: envelope.id,authOptions,},create: {@@ -161,7 +163,7 @@ export const setTemplateRecipients = async ({role: recipient.role,signingOrder: recipient.signingOrder,token: nanoid(),- templateId,+ envelopeId: envelope.id,authOptions,},});@@ -209,6 +211,10 @@ export const setTemplateRecipients = async ({});return {- recipients: [...filteredRecipients, ...persistedRecipients],+ recipients: [...filteredRecipients, ...persistedRecipients].map((recipient) => ({+ ...recipient,+ documentId: null,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ })),};};diff --git a/packages/lib/server-only/recipient/update-document-recipients.ts b/packages/lib/server-only/recipient/update-document-recipients.tsindex 6372f56a2..bede48dfe 100644--- a/packages/lib/server-only/recipient/update-document-recipients.ts+++ b/packages/lib/server-only/recipient/update-document-recipients.ts@@ -1,4 +1,4 @@-import { RecipientRole } from '@prisma/client';+import { EnvelopeType, RecipientRole } from '@prisma/client';import { SendStatus, SigningStatus } from '@prisma/client';import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';@@ -16,13 +16,15 @@ import { createRecipientAuthOptions } from '@documenso/lib/utils/document-auth';import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import { type EnvelopeIdOptions, mapSecondaryIdToDocumentId } from '../../utils/envelope';+import { mapFieldToLegacyField } from '../../utils/fields';import { canRecipientBeModified } from '../../utils/recipients';-import { getDocumentWhereInput } from '../document/get-document-by-id';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface UpdateDocumentRecipientsOptions {userId: number;teamId: number;- documentId: number;+ id: EnvelopeIdOptions;recipients: RecipientData[];requestMetadata: ApiRequestMetadata;}@@ -30,18 +32,19 @@ export interface UpdateDocumentRecipientsOptions {export const updateDocumentRecipients = async ({userId,teamId,- documentId,+ id,recipients,requestMetadata,}: UpdateDocumentRecipientsOptions) => {- const { documentWhereInput } = await getDocumentWhereInput({- documentId,+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.DOCUMENT,userId,teamId,});- const document = await prisma.document.findFirst({- where: documentWhereInput,+ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {fields: true,recipients: true,@@ -57,13 +60,13 @@ export const updateDocumentRecipients = async ({},});- if (!document) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}- if (document.completedAt) {+ if (envelope.completedAt) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document already complete',});@@ -74,14 +77,14 @@ export const updateDocumentRecipients = async ({);// Check if user has permission to set the global action auth.- if (recipientsHaveActionAuth && !document.team.organisation.organisationClaim.flags.cfr21) {+ if (recipientsHaveActionAuth && !envelope.team.organisation.organisationClaim.flags.cfr21) {throw new AppError(AppErrorCode.UNAUTHORIZED, {message: 'You do not have permission to set the action auth',});}const recipientsToUpdate = recipients.map((recipient) => {- const originalRecipient = document.recipients.find(+ const originalRecipient = envelope.recipients.find((existingRecipient) => existingRecipient.id === recipient.id,);@@ -91,7 +94,7 @@ export const updateDocumentRecipients = async ({});}- if (!canRecipientBeModified(originalRecipient, document.fields)) {+ if (!canRecipientBeModified(originalRecipient, envelope.fields)) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Cannot modify a recipient who has already interacted with the document',});@@ -123,14 +126,14 @@ export const updateDocumentRecipients = async ({const updatedRecipient = await tx.recipient.update({where: {id: originalRecipient.id,- documentId,+ envelopeId: envelope.id,},data: {name: mergedRecipient.name,email: mergedRecipient.email,role: mergedRecipient.role,signingOrder: mergedRecipient.signingOrder,- documentId,+ envelopeId: envelope.id,sendStatus:mergedRecipient.role === RecipientRole.CC ? SendStatus.SENT : SendStatus.NOT_SENT,signingStatus:@@ -164,7 +167,7 @@ export const updateDocumentRecipients = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.RECIPIENT_UPDATED,- documentId: documentId,+ envelopeId: envelope.id,metadata: requestMetadata,data: {recipientEmail: updatedRecipient.email,@@ -183,7 +186,12 @@ export const updateDocumentRecipients = async ({});return {- recipients: updatedRecipients,+ recipients: updatedRecipients.map((recipient) => ({+ ...recipient,+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),+ templateId: null,+ fields: recipient.fields.map((field) => mapFieldToLegacyField(field, envelope)),+ })),};};diff --git a/packages/lib/server-only/recipient/update-template-recipients.ts b/packages/lib/server-only/recipient/update-template-recipients.tsindex aca4520f8..45bdff76b 100644--- a/packages/lib/server-only/recipient/update-template-recipients.ts+++ b/packages/lib/server-only/recipient/update-template-recipients.ts@@ -1,4 +1,4 @@-import { RecipientRole } from '@prisma/client';+import { EnvelopeType, RecipientRole } from '@prisma/client';import { SendStatus, SigningStatus } from '@prisma/client';import type { TRecipientAccessAuthTypes } from '@documenso/lib/types/document-auth';@@ -10,7 +10,9 @@ import { createRecipientAuthOptions } from '@documenso/lib/utils/document-auth';import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { buildTeamWhereQuery } from '../../utils/teams';+import { mapSecondaryIdToTemplateId } from '../../utils/envelope';+import { mapFieldToLegacyField } from '../../utils/fields';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export interface UpdateTemplateRecipientsOptions {userId: number;@@ -33,11 +35,18 @@ export const updateTemplateRecipients = async ({templateId,recipients,}: UpdateTemplateRecipientsOptions) => {- const template = await prisma.template.findFirst({- where: {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'templateId',id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),},+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,team: {@@ -52,7 +61,7 @@ export const updateTemplateRecipients = async ({},});- if (!template) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Template not found',});@@ -63,14 +72,14 @@ export const updateTemplateRecipients = async ({);// Check if user has permission to set the global action auth.- if (recipientsHaveActionAuth && !template.team.organisation.organisationClaim.flags.cfr21) {+ if (recipientsHaveActionAuth && !envelope.team.organisation.organisationClaim.flags.cfr21) {throw new AppError(AppErrorCode.UNAUTHORIZED, {message: 'You do not have permission to set the action auth',});}const recipientsToUpdate = recipients.map((recipient) => {- const originalRecipient = template.recipients.find(+ const originalRecipient = envelope.recipients.find((existingRecipient) => existingRecipient.id === recipient.id,);@@ -109,14 +118,14 @@ export const updateTemplateRecipients = async ({const updatedRecipient = await tx.recipient.update({where: {id: originalRecipient.id,- templateId,+ envelopeId: envelope.id,},data: {name: mergedRecipient.name,email: mergedRecipient.email,role: mergedRecipient.role,signingOrder: mergedRecipient.signingOrder,- templateId,+ envelopeId: envelope.id,sendStatus:mergedRecipient.role === RecipientRole.CC ? SendStatus.SENT : SendStatus.NOT_SENT,signingStatus:@@ -149,6 +158,11 @@ export const updateTemplateRecipients = async ({});return {- recipients: updatedRecipients,+ recipients: updatedRecipients.map((recipient) => ({+ ...recipient,+ documentId: null,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ fields: recipient.fields.map((field) => mapFieldToLegacyField(field, envelope)),+ })),};};diff --git a/packages/lib/server-only/share/create-or-get-share-link.ts b/packages/lib/server-only/share/create-or-get-share-link.tsindex 1569b98af..63066f218 100644--- a/packages/lib/server-only/share/create-or-get-share-link.ts+++ b/packages/lib/server-only/share/create-or-get-share-link.ts@@ -1,8 +1,11 @@+import { EnvelopeType } from '@prisma/client';import { P, match } from 'ts-pattern';import { prisma } from '@documenso/prisma';+import { AppError, AppErrorCode } from '../../errors/app-error';import { alphaid } from '../../universal/id';+import { unsafeBuildEnvelopeIdQuery } from '../../utils/envelope';export type CreateSharingIdOptions =| {@@ -15,12 +18,29 @@ export type CreateSharingIdOptions =};export const createOrGetShareLink = async ({ documentId, ...options }: CreateSharingIdOptions) => {+ const envelope = await prisma.envelope.findUnique({+ where: unsafeBuildEnvelopeIdQuery(+ {+ type: 'documentId',+ id: documentId,+ },+ EnvelopeType.DOCUMENT,+ ),+ select: {+ id: true,+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND);+ }+const email = await match(options).with({ token: P.string }, async ({ token }) => {return await prisma.recipient.findFirst({where: {- documentId,+ envelopeId: envelope.id,token,},})@@ -32,6 +52,9 @@ export const createOrGetShareLink = async ({ documentId, ...options }: CreateShawhere: {id: userId,},+ select: {+ email: true,+ },}).then((user) => user?.email);})@@ -43,14 +66,14 @@ export const createOrGetShareLink = async ({ documentId, ...options }: CreateShareturn await prisma.documentShareLink.upsert({where: {- documentId_email: {+ envelopeId_email: {+ envelopeId: envelope.id,email,- documentId,},},create: {email,- documentId,+ envelopeId: envelope.id,slug: alphaid(14),},update: {},diff --git a/packages/lib/server-only/share/get-share-link-by-slug.ts b/packages/lib/server-only/share/get-share-link-by-slug.tsdeleted file mode 100644index 4486de81a..000000000--- a/packages/lib/server-only/share/get-share-link-by-slug.ts+++ /dev/null@@ -1,13 +0,0 @@-import { prisma } from '@documenso/prisma';--export type GetShareLinkBySlugOptions = {- slug: string;-};--export const getShareLinkBySlug = async ({ slug }: GetShareLinkBySlugOptions) => {- return await prisma.documentShareLink.findFirstOrThrow({- where: {- slug,- },- });-};diff --git a/packages/lib/server-only/team/get-member-roles.ts b/packages/lib/server-only/team/get-member-roles.tsindex 247bf7145..090df533f 100644--- a/packages/lib/server-only/team/get-member-roles.ts+++ b/packages/lib/server-only/team/get-member-roles.ts@@ -21,7 +21,14 @@ type GetMemberRolesOptions = {* Returns the highest Team role of a given member or user of a team*/export const getMemberRoles = async ({ teamId, reference }: GetMemberRolesOptions) => {- const team = await prisma.team.findFirst({+ // Enforce incase teamId undefined slips through due to invalid types.+ if (teamId === undefined) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Team not found',+ });+ }++ const team = await prisma.team.findUnique({where: {id: teamId,},diff --git a/packages/lib/server-only/template/create-document-from-direct-template.ts b/packages/lib/server-only/template/create-document-from-direct-template.tsindex b223dd49f..fb354d8db 100644--- a/packages/lib/server-only/template/create-document-from-direct-template.ts+++ b/packages/lib/server-only/template/create-document-from-direct-template.ts@@ -5,6 +5,7 @@ import type { Field, Signature } from '@prisma/client';import {DocumentSource,DocumentStatus,+ EnvelopeType,FieldType,Prisma,RecipientRole,@@ -31,9 +32,11 @@ import { DocumentAccessAuth, ZRecipientAuthOptionsSchema } from '../../types/docimport { ZFieldMetaSchema } from '../../types/field-meta';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../types/webhook-payload';import type { ApiRequestMetadata } from '../../universal/extract-request-metadata';+import { getFileServerSide } from '../../universal/upload/get-file.server';+import { putPdfFileServerSide } from '../../universal/upload/put-file.server';import { isRequiredField } from '../../utils/advanced-fields-helpers';import { extractDerivedDocumentMeta } from '../../utils/document';import type { CreateDocumentAuditLogDataResponse } from '../../utils/document-audit-logs';@@ -43,11 +46,13 @@ import {createRecipientAuthOptions,extractDocumentAuthMethods,} from '../../utils/document-auth';+import { mapSecondaryIdToTemplateId } from '../../utils/envelope';import { renderEmailWithI18N } from '../../utils/render-email-with-i18n';import { formatDocumentsPath } from '../../utils/teams';import { sendDocument } from '../document/send-document';import { validateFieldAuth } from '../document/validate-field-auth';import { getEmailContext } from '../email/get-email-context';+import { incrementDocumentId } from '../envelope/increment-id';import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';export type CreateDocumentFromDirectTemplateOptions = {@@ -90,7 +95,7 @@ export const createDocumentFromDirectTemplate = async ({requestMetadata,user,}: CreateDocumentFromDirectTemplateOptions): Promise<TCreateDocumentFromDirectTemplateResponse> => {- const template = await prisma.template.findFirst({+ const directTemplateEnvelope = await prisma.envelope.findFirst({where: {directLink: {token: directTemplateToken,@@ -103,8 +108,12 @@ export const createDocumentFromDirectTemplate = async ({},},directLink: true,- templateDocumentData: true,- templateMeta: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ documentMeta: true,user: {select: {id: true,@@ -115,19 +124,29 @@ export const createDocumentFromDirectTemplate = async ({},});- if (!template?.directLink?.enabled) {+ if (!directTemplateEnvelope?.directLink?.enabled) {throw new AppError(AppErrorCode.INVALID_REQUEST, { message: 'Invalid or missing template' });}+ const directTemplateEnvelopeLegacyId = mapSecondaryIdToTemplateId(+ directTemplateEnvelope.secondaryId,+ );++ if (directTemplateEnvelope.envelopeItems.length < 1) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Invalid number of envelope items',+ });+ }+const { branding, settings, senderEmail, emailLanguage } = await getEmailContext({emailType: 'INTERNAL',source: {type: 'team',- teamId: template.teamId,+ teamId: directTemplateEnvelope.teamId,},});- const { recipients, directLink, user: templateOwner } = template;+ const { recipients, directLink, user: templateOwner } = directTemplateEnvelope;const directTemplateRecipient = recipients.find((recipient) => recipient.id === directLink.directTemplateRecipientId,@@ -139,7 +158,7 @@ export const createDocumentFromDirectTemplate = async ({});}- if (template.updatedAt.getTime() !== templateUpdatedAt.getTime()) {+ if (directTemplateEnvelope.updatedAt.getTime() !== templateUpdatedAt.getTime()) {throw new AppError(AppErrorCode.INVALID_REQUEST, { message: 'Template no longer matches' });}@@ -151,7 +170,7 @@ export const createDocumentFromDirectTemplate = async ({const { derivedRecipientAccessAuth, documentAuthOption: templateAuthOptions } =extractDocumentAuthMethods({- documentAuth: template.authOptions,+ documentAuth: directTemplateEnvelope.authOptions,});const directRecipientName = user?.name || initialDirectRecipientName;@@ -171,10 +190,13 @@ export const createDocumentFromDirectTemplate = async ({directTemplateRecipient.authOptions,);- const nonDirectTemplateRecipients = template.recipients.filter(+ const nonDirectTemplateRecipients = directTemplateEnvelope.recipients.filter((recipient) => recipient.id !== directTemplateRecipient.id,);- const derivedDocumentMeta = extractDerivedDocumentMeta(settings, template.templateMeta);+ const derivedDocumentMeta = extractDerivedDocumentMeta(+ settings,+ directTemplateEnvelope.documentMeta,+ );// Associate, validate and map to a query every direct template recipient field with the provided fields.// Only process fields that are either required or have been signed by the user@@ -202,11 +224,11 @@ export const createDocumentFromDirectTemplate = async ({}const derivedRecipientActionAuth = await validateFieldAuth({- documentAuthOptions: template.authOptions,+ documentAuthOptions: directTemplateEnvelope.authOptions,recipient: {authOptions: directTemplateRecipient.authOptions,email: directRecipientEmail,- documentId: template.id,+ envelopeId: directTemplateEnvelope.id,},field: templateField,userId: user?.id,@@ -267,29 +289,73 @@ export const createDocumentFromDirectTemplate = async ({const initialRequestTime = new Date();- const { documentId, recipientId, token } = await prisma.$transaction(async (tx) => {- const documentData = await tx.documentData.create({- data: {- type: template.templateDocumentData.type,- data: template.templateDocumentData.data,- initialData: template.templateDocumentData.initialData,- },- });+ // Key = original envelope item ID+ // Value = duplicated envelope item ID.+ const oldEnvelopeItemToNewEnvelopeItemIdMap: Record<string, string> = {};++ // Duplicate the envelope item data.+ const envelopeItemsToCreate = await Promise.all(+ directTemplateEnvelope.envelopeItems.map(async (item, i) => {+ const buffer = await getFileServerSide(item.documentData);++ const titleToUse = item.title || directTemplateEnvelope.title;- // Create the document and non direct template recipients.- const document = await tx.document.create({+ const duplicatedFile = await putPdfFileServerSide({+ name: titleToUse,+ type: 'application/pdf',+ arrayBuffer: async () => Promise.resolve(buffer),+ });++ const newDocumentData = await prisma.documentData.create({+ data: {+ type: duplicatedFile.type,+ data: duplicatedFile.data,+ initialData: duplicatedFile.initialData,+ },+ });++ const newEnvelopeItemId = prefixedId('envelope_item');++ oldEnvelopeItemToNewEnvelopeItemIdMap[item.id] = newEnvelopeItemId;++ return {+ id: newEnvelopeItemId,+ title: titleToUse.endsWith('.pdf') ? titleToUse.slice(0, -4) : titleToUse,+ documentDataId: newDocumentData.id,+ order: item.order !== undefined ? item.order : i + 1,+ };+ }),+ );++ const documentMeta = await prisma.documentMeta.create({+ data: derivedDocumentMeta,+ });++ const incrementedDocumentId = await incrementDocumentId();++ const { createdEnvelope, recipientId, token } = await prisma.$transaction(async (tx) => {+ // Create the envelope and non direct template recipients.+ const createdEnvelope = await tx.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: incrementedDocumentId.formattedDocumentId,+ type: EnvelopeType.DOCUMENT,+ internalVersion: 1,qrToken: prefixedId('qr'),source: DocumentSource.TEMPLATE_DIRECT_LINK,- templateId: template.id,- userId: template.userId,- teamId: template.teamId,- title: template.title,+ templateId: directTemplateEnvelopeLegacyId,+ userId: directTemplateEnvelope.userId,+ teamId: directTemplateEnvelope.teamId,+ title: directTemplateEnvelope.title,createdAt: initialRequestTime,status: DocumentStatus.PENDING,externalId: directTemplateExternalId,visibility: settings.documentVisibility,- documentDataId: documentData.id,+ envelopeItems: {+ createMany: {+ data: envelopeItemsToCreate,+ },+ },authOptions: createDocumentAuthOptions({globalAccessAuth: templateAuthOptions.globalAccessAuth,globalActionAuth: templateAuthOptions.globalActionAuth,@@ -319,9 +385,7 @@ export const createDocumentFromDirectTemplate = async ({}),},},- documentMeta: {- create: derivedDocumentMeta,- },+ documentMetaId: documentMeta.id,},include: {recipients: true,@@ -330,13 +394,18 @@ export const createDocumentFromDirectTemplate = async ({url: true,},},+ envelopeItems: {+ select: {+ id: true,+ },+ },},});let nonDirectRecipientFieldsToCreate: Omit<Field, 'id' | 'secondaryId' | 'templateId'>[] = [];Object.values(nonDirectTemplateRecipients).forEach((templateRecipient) => {- const recipient = document.recipients.find(+ const recipient = createdEnvelope.recipients.find((recipient) => recipient.email === templateRecipient.email,);@@ -346,7 +415,8 @@ export const createDocumentFromDirectTemplate = async ({nonDirectRecipientFieldsToCreate = nonDirectRecipientFieldsToCreate.concat(templateRecipient.fields.map((field) => ({- documentId: document.id,+ envelopeId: createdEnvelope.id,+ envelopeItemId: oldEnvelopeItemToNewEnvelopeItemIdMap[field.envelopeItemId],recipientId: recipient.id,type: field.type,page: field.page,@@ -371,7 +441,7 @@ export const createDocumentFromDirectTemplate = async ({// Create the direct recipient and their non signature fields.const createdDirectRecipient = await tx.recipient.create({data: {- documentId: document.id,+ envelopeId: createdEnvelope.id,email: directRecipientEmail,name: directRecipientName,authOptions: createRecipientAuthOptions({@@ -387,7 +457,8 @@ export const createDocumentFromDirectTemplate = async ({fields: {createMany: {data: directTemplateNonSignatureFields.map(({ templateField, customText }) => ({- documentId: document.id,+ envelopeId: createdEnvelope.id,+ envelopeItemId: oldEnvelopeItemToNewEnvelopeItemIdMap[templateField.envelopeItemId],type: templateField.type,page: templateField.page,positionX: templateField.positionX,@@ -417,7 +488,8 @@ export const createDocumentFromDirectTemplate = async ({const field = await tx.field.create({data: {- documentId: document.id,+ envelopeId: createdEnvelope.id,+ envelopeItemId: oldEnvelopeItemToNewEnvelopeItemIdMap[templateField.envelopeItemId],recipientId: createdDirectRecipient.id,type: templateField.type,page: templateField.page,@@ -466,7 +538,7 @@ export const createDocumentFromDirectTemplate = async ({const auditLogsToCreate: CreateDocumentAuditLogDataResponse[] = [createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,- documentId: document.id,+ envelopeId: createdEnvelope.id,user: {id: user?.id,name: user?.name,@@ -474,17 +546,17 @@ export const createDocumentFromDirectTemplate = async ({},metadata: requestMetadata,data: {- title: document.title,+ title: createdEnvelope.title,source: {type: DocumentSource.TEMPLATE_DIRECT_LINK,- templateId: template.id,+ templateId: directTemplateEnvelopeLegacyId,directRecipientEmail,},},}),createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_OPENED,- documentId: document.id,+ envelopeId: createdEnvelope.id,user: {id: user?.id,name: user?.name,@@ -502,7 +574,7 @@ export const createDocumentFromDirectTemplate = async ({...createdDirectRecipientFields.map(({ field, derivedRecipientActionAuth }) =>createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FIELD_INSERTED,- documentId: document.id,+ envelopeId: createdEnvelope.id,user: {id: user?.id,name: user?.name,@@ -547,7 +619,7 @@ export const createDocumentFromDirectTemplate = async ({),createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_COMPLETED,- documentId: document.id,+ envelopeId: createdEnvelope.id,user: {id: user?.id,name: user?.name,@@ -572,10 +644,10 @@ export const createDocumentFromDirectTemplate = async ({const emailTemplate = createElement(DocumentCreatedFromDirectTemplateEmailTemplate, {recipientName: directRecipientEmail,recipientRole: directTemplateRecipient.role,- documentLink: `${NEXT_PUBLIC_WEBAPP_URL()}${formatDocumentsPath(document.team?.url)}/${- document.id+ documentLink: `${NEXT_PUBLIC_WEBAPP_URL()}${formatDocumentsPath(createdEnvelope.team?.url)}/${+ createdEnvelope.id}`,- documentName: document.title,+ documentName: createdEnvelope.title,assetBaseUrl: NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000',});@@ -600,8 +672,8 @@ export const createDocumentFromDirectTemplate = async ({});return {+ createdEnvelope,token: createdDirectRecipient.token,- documentId: document.id,recipientId: createdDirectRecipient.id,};});@@ -609,18 +681,21 @@ export const createDocumentFromDirectTemplate = async ({try {// This handles sending emails and sealing the document if required.await sendDocument({- documentId,- userId: template.userId,- teamId: template.teamId,+ id: {+ type: 'envelopeId',+ id: createdEnvelope.id,+ },+ userId: createdEnvelope.userId,+ teamId: createdEnvelope.teamId,requestMetadata,});- const createdDocument = await prisma.document.findFirstOrThrow({+ // Refetch envelope so we get the final data.+ const refetchedEnvelope = await prisma.envelope.findFirstOrThrow({where: {- id: documentId,+ id: createdEnvelope.id,},include: {- documentData: true,documentMeta: true,recipients: true,},@@ -628,9 +703,9 @@ export const createDocumentFromDirectTemplate = async ({await triggerWebhook({event: WebhookTriggerEvents.DOCUMENT_SIGNED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(createdDocument)),- userId: template.userId,- teamId: template.teamId ?? undefined,+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(refetchedEnvelope)),+ userId: refetchedEnvelope.userId,+ teamId: refetchedEnvelope.teamId ?? undefined,});} catch (err) {console.error('[CREATE_DOCUMENT_FROM_DIRECT_TEMPLATE]:', err);@@ -641,7 +716,7 @@ export const createDocumentFromDirectTemplate = async ({return {token,- documentId,+ documentId: incrementedDocumentId.documentId,recipientId,};};diff --git a/packages/lib/server-only/template/create-document-from-template-legacy.ts b/packages/lib/server-only/template/create-document-from-template-legacy.tsdeleted file mode 100644index 6bc83c667..000000000--- a/packages/lib/server-only/template/create-document-from-template-legacy.ts+++ /dev/null@@ -1,183 +0,0 @@-import { DocumentSource, type RecipientRole } from '@prisma/client';--import { nanoid, prefixedId } from '@documenso/lib/universal/id';-import { prisma } from '@documenso/prisma';--import { extractDerivedDocumentMeta } from '../../utils/document';-import { buildTeamWhereQuery } from '../../utils/teams';-import { getTeamSettings } from '../team/get-team-settings';--export type CreateDocumentFromTemplateLegacyOptions = {- templateId: number;- userId: number;- teamId: number;- recipients?: {- name?: string;- email: string;- role?: RecipientRole;- signingOrder?: number | null;- }[];-};--// !TODO: Make this work--/**- * Legacy server function for /api/v1- */-export const createDocumentFromTemplateLegacy = async ({- templateId,- userId,- teamId,- recipients,-}: CreateDocumentFromTemplateLegacyOptions) => {- const template = await prisma.template.findUnique({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },- include: {- recipients: true,- fields: true,- templateDocumentData: true,- templateMeta: true,- },- });-- if (!template) {- throw new Error('Template not found.');- }-- const settings = await getTeamSettings({- userId,- teamId,- });-- const documentData = await prisma.documentData.create({- data: {- type: template.templateDocumentData.type,- data: template.templateDocumentData.data,- initialData: template.templateDocumentData.initialData,- },- });-- const recipientsToCreate = template.recipients.map((recipient) => ({- id: recipient.id,- email: recipient.email,- name: recipient.name,- role: recipient.role,- signingOrder: recipient.signingOrder,- token: nanoid(),- }));-- const document = await prisma.document.create({- data: {- qrToken: prefixedId('qr'),- source: DocumentSource.TEMPLATE,- templateId: template.id,- userId,- teamId: template.teamId,- title: template.title,- visibility: settings.documentVisibility,- documentDataId: documentData.id,- useLegacyFieldInsertion: template.useLegacyFieldInsertion ?? false,- recipients: {- create: recipientsToCreate.map((recipient) => ({- email: recipient.email,- name: recipient.name,- role: recipient.role,- signingOrder: recipient.signingOrder,- token: recipient.token,- })),- },- documentMeta: {- create: extractDerivedDocumentMeta(settings, template.templateMeta),- },- },-- include: {- recipients: {- orderBy: {- id: 'asc',- },- },- documentData: true,- },- });-- await prisma.field.createMany({- data: template.fields.map((field) => {- const recipient = recipientsToCreate.find((recipient) => recipient.id === field.recipientId);-- const documentRecipient = document.recipients.find(- (documentRecipient) => documentRecipient.token === recipient?.token,- );-- if (!documentRecipient) {- throw new Error('Recipient not found.');- }-- return {- type: field.type,- page: field.page,- positionX: field.positionX,- positionY: field.positionY,- width: field.width,- height: field.height,- customText: field.customText,- inserted: field.inserted,- documentId: document.id,- recipientId: documentRecipient.id,- };- }),- });-- // Replicate the old logic, get by index and create if we exceed the number of existing recipients.- if (recipients && recipients.length > 0) {- await Promise.all(- recipients.map(async (recipient, index) => {- const existingRecipient = document.recipients.at(index);-- if (existingRecipient) {- return await prisma.recipient.update({- where: {- id: existingRecipient.id,- documentId: document.id,- },- data: {- name: recipient.name,- email: recipient.email,- role: recipient.role,- signingOrder: recipient.signingOrder,- },- });- }-- return await prisma.recipient.create({- data: {- documentId: document.id,- name: recipient.name,- email: recipient.email,- role: recipient.role,- signingOrder: recipient.signingOrder,- token: nanoid(),- },- });- }),- );- }-- // Gross but we need to do the additional fetch since we mutate above.- const updatedRecipients = await prisma.recipient.findMany({- where: {- documentId: document.id,- },- orderBy: {- id: 'asc',- },- });-- return {- ...document,- recipients: updatedRecipients,- };-};diff --git a/packages/lib/server-only/template/create-document-from-template.ts b/packages/lib/server-only/template/create-document-from-template.tsindex e7a1011c3..3aa48e29a 100644--- a/packages/lib/server-only/template/create-document-from-template.ts+++ b/packages/lib/server-only/template/create-document-from-template.ts@@ -1,6 +1,7 @@import type { DocumentDistributionMethod, DocumentSigningOrder } from '@prisma/client';import {DocumentSource,+ EnvelopeType,type Field,FolderType,type Recipient,@@ -37,9 +38,11 @@ import {} from '../../types/field-meta';import {ZWebhookDocumentSchema,- mapDocumentToWebhookDocumentPayload,+ mapEnvelopeToWebhookDocumentPayload,} from '../../types/webhook-payload';import type { ApiRequestMetadata } from '../../universal/extract-request-metadata';+import { getFileServerSide } from '../../universal/upload/get-file.server';+import { putPdfFileServerSide } from '../../universal/upload/put-file.server';import { extractDerivedDocumentMeta } from '../../utils/document';import { createDocumentAuditLogData } from '../../utils/document-audit-logs';import {@@ -47,7 +50,11 @@ import {createRecipientAuthOptions,extractDocumentAuthMethods,} from '../../utils/document-auth';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapSecondaryIdToTemplateId } from '../../utils/envelope';import { buildTeamWhereQuery } from '../../utils/teams';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';+import { incrementDocumentId } from '../envelope/increment-id';import { getTeamSettings } from '../team/get-team-settings';import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';@@ -60,7 +67,7 @@ type FinalRecipient = Pick<};export type CreateDocumentFromTemplateOptions = {- templateId: number;+ id: EnvelopeIdOptions;externalId?: string | null;userId: number;teamId: number;@@ -72,7 +79,17 @@ export type CreateDocumentFromTemplateOptions = {}[];folderId?: string;prefillFields?: TFieldMetaPrefillFieldsSchema[];- customDocumentDataId?: string;++ customDocumentData?: {+ documentDataId: string;++ /**+ * The envelope item ID which will be updated to use the custom document data.+ *+ * If undefined, will use the first envelope item. This is done for backwards compatibility reasons.+ */+ envelopeItemId?: string;+ }[];/*** Values that will override the predefined values in the template.@@ -268,30 +285,38 @@ const getUpdatedFieldMeta = (field: Field, prefillField?: TFieldMetaPrefillField};export const createDocumentFromTemplate = async ({- templateId,+ id,externalId,userId,teamId,recipients,- customDocumentDataId,+ customDocumentData = [],override,requestMetadata,folderId,prefillFields,}: CreateDocumentFromTemplateOptions) => {- const template = await prisma.template.findUnique({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const template = await prisma.envelope.findUnique({+ where: envelopeWhereInput,include: {recipients: {include: {fields: true,},},- templateDocumentData: true,- templateMeta: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ documentMeta: true,},});@@ -317,6 +342,15 @@ export const createDocumentFromTemplate = async ({}}+ const legacyTemplateId = mapSecondaryIdToTemplateId(template.secondaryId);+ const finalEnvelopeTitle = override?.title || template.title;++ if (template.envelopeItems.length < 1) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Template must have at least 1 envelope item',+ });+ }+const settings = await getTeamSettings({userId,teamId,@@ -354,74 +388,121 @@ export const createDocumentFromTemplate = async ({};});- let parentDocumentData = template.templateDocumentData;+ const firstEnvelopeItemId = template.envelopeItems[0].id;- if (customDocumentDataId) {- const customDocumentData = await prisma.documentData.findFirst({- where: {- id: customDocumentDataId,- },- });+ // Key = original envelope item ID+ // Value = duplicated envelope item ID.+ const oldEnvelopeItemToNewEnvelopeItemIdMap: Record<string, string> = {};- if (!customDocumentData) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Custom document data not found',+ // Duplicate the envelope item data.+ // Note: This is duplicated in createDocumentFromDirectTemplate+ const envelopeItemsToCreate = await Promise.all(+ template.envelopeItems.map(async (item, i) => {+ let documentDataIdToDuplicate = item.documentDataId;++ const foundCustomDocumentData = customDocumentData.find(+ (customDocumentDataItem) =>+ customDocumentDataItem.envelopeItemId || firstEnvelopeItemId === item.id,+ );++ if (foundCustomDocumentData) {+ documentDataIdToDuplicate = foundCustomDocumentData.documentDataId;+ }++ const documentDataToDuplicate = await prisma.documentData.findFirst({+ where: {+ id: documentDataIdToDuplicate,+ },});- }- parentDocumentData = customDocumentData;- }+ if (!documentDataToDuplicate) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Document data not found',+ });+ }- const documentData = await prisma.documentData.create({- data: {- type: parentDocumentData.type,- data: parentDocumentData.data,- initialData: parentDocumentData.initialData,- },+ const buffer = await getFileServerSide(documentDataToDuplicate);++ const titleToUse = item.title || finalEnvelopeTitle;++ const duplicatedFile = await putPdfFileServerSide({+ name: titleToUse,+ type: 'application/pdf',+ arrayBuffer: async () => Promise.resolve(buffer),+ });++ const newDocumentData = await prisma.documentData.create({+ data: {+ type: duplicatedFile.type,+ data: duplicatedFile.data,+ initialData: duplicatedFile.initialData,+ },+ });++ const newEnvelopeItemId = prefixedId('envelope_item');++ oldEnvelopeItemToNewEnvelopeItemIdMap[item.id] = newEnvelopeItemId;++ return {+ id: newEnvelopeItemId,+ title: titleToUse.endsWith('.pdf') ? titleToUse.slice(0, -4) : titleToUse,+ documentDataId: newDocumentData.id,+ order: item.order !== undefined ? item.order : i + 1,+ };+ }),+ );++ const incrementedDocumentId = await incrementDocumentId();++ const documentMeta = await prisma.documentMeta.create({+ data: extractDerivedDocumentMeta(settings, {+ subject: override?.subject || template.documentMeta?.subject,+ message: override?.message || template.documentMeta?.message,+ timezone: override?.timezone || template.documentMeta?.timezone,+ dateFormat: override?.dateFormat || template.documentMeta?.dateFormat,+ redirectUrl: override?.redirectUrl || template.documentMeta?.redirectUrl,+ distributionMethod: override?.distributionMethod || template.documentMeta?.distributionMethod,+ emailSettings: override?.emailSettings || template.documentMeta?.emailSettings,+ signingOrder: override?.signingOrder || template.documentMeta?.signingOrder,+ language: override?.language || template.documentMeta?.language || settings.documentLanguage,+ typedSignatureEnabled:+ override?.typedSignatureEnabled ?? template.documentMeta?.typedSignatureEnabled,+ uploadSignatureEnabled:+ override?.uploadSignatureEnabled ?? template.documentMeta?.uploadSignatureEnabled,+ drawSignatureEnabled:+ override?.drawSignatureEnabled ?? template.documentMeta?.drawSignatureEnabled,+ allowDictateNextSigner:+ override?.allowDictateNextSigner ?? template.documentMeta?.allowDictateNextSigner,+ }),});return await prisma.$transaction(async (tx) => {- const document = await tx.document.create({+ const envelope = await tx.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: incrementedDocumentId.formattedDocumentId,+ type: EnvelopeType.DOCUMENT,+ internalVersion: template.internalVersion,qrToken: prefixedId('qr'),source: DocumentSource.TEMPLATE,externalId: externalId || template.externalId,- templateId: template.id,+ templateId: legacyTemplateId, // The template this envelope was created from.userId,folderId,teamId: template.teamId,- title: override?.title || template.title,- documentDataId: documentData.id,+ title: finalEnvelopeTitle,+ envelopeItems: {+ createMany: {+ data: envelopeItemsToCreate,+ },+ },authOptions: createDocumentAuthOptions({globalAccessAuth: templateAuthOptions.globalAccessAuth,globalActionAuth: templateAuthOptions.globalActionAuth,}),visibility: template.visibility || settings.documentVisibility,useLegacyFieldInsertion: template.useLegacyFieldInsertion ?? false,- documentMeta: {- create: extractDerivedDocumentMeta(settings, {- subject: override?.subject || template.templateMeta?.subject,- message: override?.message || template.templateMeta?.message,- timezone: override?.timezone || template.templateMeta?.timezone,- password: override?.password || template.templateMeta?.password,- dateFormat: override?.dateFormat || template.templateMeta?.dateFormat,- redirectUrl: override?.redirectUrl || template.templateMeta?.redirectUrl,- distributionMethod:- override?.distributionMethod || template.templateMeta?.distributionMethod,- emailSettings: override?.emailSettings || template.templateMeta?.emailSettings,- signingOrder: override?.signingOrder || template.templateMeta?.signingOrder,- language:- override?.language || template.templateMeta?.language || settings.documentLanguage,- typedSignatureEnabled:- override?.typedSignatureEnabled ?? template.templateMeta?.typedSignatureEnabled,- uploadSignatureEnabled:- override?.uploadSignatureEnabled ?? template.templateMeta?.uploadSignatureEnabled,- drawSignatureEnabled:- override?.drawSignatureEnabled ?? template.templateMeta?.drawSignatureEnabled,- allowDictateNextSigner:- override?.allowDictateNextSigner ?? template.templateMeta?.allowDictateNextSigner,- }),- },+ documentMetaId: documentMeta.id,recipients: {createMany: {data: finalRecipients.map((recipient) => {@@ -454,11 +535,15 @@ export const createDocumentFromTemplate = async ({id: 'asc',},},- documentData: true,+ envelopeItems: {+ select: {+ id: true,+ },+ },},});- let fieldsToCreate: Omit<Field, 'id' | 'secondaryId' | 'templateId'>[] = [];+ let fieldsToCreate: Omit<Field, 'id' | 'secondaryId'>[] = [];// Get all template field IDs first so we can validate laterconst allTemplateFieldIds = finalRecipients.flatMap((recipient) =>@@ -502,7 +587,7 @@ export const createDocumentFromTemplate = async ({}Object.values(finalRecipients).forEach(({ token, fields }) => {- const recipient = document.recipients.find((recipient) => recipient.token === token);+ const recipient = envelope.recipients.find((recipient) => recipient.token === token);if (!recipient) {throw new Error('Recipient not found.');@@ -513,7 +598,8 @@ export const createDocumentFromTemplate = async ({const prefillField = prefillFields?.find((value) => value.id === field.id);const payload = {- documentId: document.id,+ envelopeItemId: oldEnvelopeItemToNewEnvelopeItemIdMap[field.envelopeItemId],+ envelopeId: envelope.id,recipientId: recipient.id,type: field.type,page: field.page,@@ -544,7 +630,7 @@ export const createDocumentFromTemplate = async ({}payload.customText = DateTime.fromJSDate(date).toFormat(- template.templateMeta?.dateFormat ?? DEFAULT_DOCUMENT_DATE_FORMAT,+ template.documentMeta?.dateFormat ?? DEFAULT_DOCUMENT_DATE_FORMAT,);payload.inserted = true;@@ -569,21 +655,21 @@ export const createDocumentFromTemplate = async ({await tx.documentAuditLog.create({data: createDocumentAuditLogData({type: DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CREATED,- documentId: document.id,+ envelopeId: envelope.id,metadata: requestMetadata,data: {- title: document.title,+ title: envelope.title,source: {type: DocumentSource.TEMPLATE,- templateId: template.id,+ templateId: legacyTemplateId,},},}),});- const createdDocument = await tx.document.findFirst({+ const createdEnvelope = await tx.envelope.findFirst({where: {- id: document.id,+ id: envelope.id,},include: {documentMeta: true,@@ -591,17 +677,17 @@ export const createDocumentFromTemplate = async ({},});- if (!createdDocument) {+ if (!createdEnvelope) {throw new Error('Document not found');}await triggerWebhook({event: WebhookTriggerEvents.DOCUMENT_CREATED,- data: ZWebhookDocumentSchema.parse(mapDocumentToWebhookDocumentPayload(createdDocument)),+ data: ZWebhookDocumentSchema.parse(mapEnvelopeToWebhookDocumentPayload(createdEnvelope)),userId,teamId,});- return document;+ return envelope;});};diff --git a/packages/lib/server-only/template/create-template-direct-link.ts b/packages/lib/server-only/template/create-template-direct-link.tsindex db4a2dc46..1d2333880 100644--- a/packages/lib/server-only/template/create-template-direct-link.ts+++ b/packages/lib/server-only/template/create-template-direct-link.ts@@ -1,4 +1,4 @@-import type { Recipient } from '@prisma/client';+import { EnvelopeType, type Recipient } from '@prisma/client';import { nanoid } from 'nanoid';import {@@ -8,50 +8,55 @@ import {import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { buildTeamWhereQuery } from '../../utils/teams';+import { type EnvelopeIdOptions, mapSecondaryIdToTemplateId } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type CreateTemplateDirectLinkOptions = {- templateId: number;+ id: EnvelopeIdOptions;userId: number;teamId: number;directRecipientId?: number;};export const createTemplateDirectLink = async ({- templateId,+ id,userId,teamId,directRecipientId,}: CreateTemplateDirectLinkOptions) => {- const template = await prisma.template.findFirst({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,directLink: true,},});- if (!template) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, { message: 'Template not found' });}- if (template.directLink) {+ if (envelope.directLink) {throw new AppError(AppErrorCode.ALREADY_EXISTS, { message: 'Direct template already exists' });}if (directRecipientId &&- !template.recipients.find((recipient) => recipient.id === directRecipientId)+ !envelope.recipients.find((recipient) => recipient.id === directRecipientId)) {throw new AppError(AppErrorCode.NOT_FOUND, { message: 'Recipient not found' });}if (!directRecipientId &&- template.recipients.find(+ envelope.recipients.find((recipient) => recipient.email.toLowerCase() === DIRECT_TEMPLATE_RECIPIENT_EMAIL,)) {@@ -60,13 +65,13 @@ export const createTemplateDirectLink = async ({});}- return await prisma.$transaction(async (tx) => {+ const createdDirectLink = await prisma.$transaction(async (tx) => {let recipient: Recipient | undefined;if (directRecipientId) {recipient = await tx.recipient.update({where: {- templateId,+ envelopeId: envelope.id,id: directRecipientId,},data: {@@ -77,7 +82,7 @@ export const createTemplateDirectLink = async ({} else {recipient = await tx.recipient.create({data: {- templateId,+ envelopeId: envelope.id,name: DIRECT_TEMPLATE_RECIPIENT_NAME,email: DIRECT_TEMPLATE_RECIPIENT_EMAIL,token: nanoid(),@@ -87,11 +92,21 @@ export const createTemplateDirectLink = async ({return await tx.templateDirectLink.create({data: {- templateId,+ envelopeId: envelope.id,enabled: true,token: nanoid(),directTemplateRecipientId: recipient.id,},});});++ return {+ id: createdDirectLink.id,+ token: createdDirectLink.token,+ createdAt: createdDirectLink.createdAt,+ enabled: createdDirectLink.enabled,+ directTemplateRecipientId: createdDirectLink.directTemplateRecipientId,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ envelopeId: envelope.id,+ };};diff --git a/packages/lib/server-only/template/create-template.ts b/packages/lib/server-only/template/create-template.tsdeleted file mode 100644index 5019407a2..000000000--- a/packages/lib/server-only/template/create-template.ts+++ /dev/null@@ -1,112 +0,0 @@-import type { DocumentVisibility, Template, TemplateMeta } from '@prisma/client';-import type { z } from 'zod';--import { prisma } from '@documenso/prisma';-import { TemplateSchema } from '@documenso/prisma/generated/zod/modelSchema//TemplateSchema';--import { AppError, AppErrorCode } from '../../errors/app-error';-import type { TDocumentAccessAuthTypes, TDocumentActionAuthTypes } from '../../types/document-auth';-import { extractDerivedDocumentMeta } from '../../utils/document';-import { createDocumentAuthOptions } from '../../utils/document-auth';-import { buildTeamWhereQuery } from '../../utils/teams';-import { getTeamSettings } from '../team/get-team-settings';--export type CreateTemplateOptions = {- userId: number;- teamId: number;- templateDocumentDataId: string;- data: {- title: string;- folderId?: string;- externalId?: string | null;- visibility?: DocumentVisibility;- globalAccessAuth?: TDocumentAccessAuthTypes[];- globalActionAuth?: TDocumentActionAuthTypes[];- publicTitle?: string;- publicDescription?: string;- type?: Template['type'];- };- meta?: Partial<Omit<TemplateMeta, 'id' | 'templateId'>>;-};--export const ZCreateTemplateResponseSchema = TemplateSchema;--export type TCreateTemplateResponse = z.infer<typeof ZCreateTemplateResponseSchema>;--export const createTemplate = async ({- userId,- teamId,- templateDocumentDataId,- data,- meta = {},-}: CreateTemplateOptions) => {- const { title, folderId } = data;-- const team = await prisma.team.findFirst({- where: buildTeamWhereQuery({ teamId, userId }),- });-- if (!team) {- throw new AppError(AppErrorCode.NOT_FOUND);- }-- if (folderId) {- const folder = await prisma.folder.findFirst({- where: {- id: folderId,- teamId: team.id,- },- });-- if (!folder) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }- }-- const settings = await getTeamSettings({- userId,- teamId,- });-- const emailId = meta.emailId;-- // Validate that the email ID belongs to the organisation.- if (emailId) {- const email = await prisma.organisationEmail.findFirst({- where: {- id: emailId,- organisationId: team.organisationId,- },- });-- if (!email) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Email not found',- });- }- }-- return await prisma.template.create({- data: {- title,- teamId,- userId,- templateDocumentDataId,- folderId,- externalId: data.externalId,- visibility: data.visibility ?? settings.documentVisibility,- authOptions: createDocumentAuthOptions({- globalAccessAuth: data.globalAccessAuth || [],- globalActionAuth: data.globalActionAuth || [],- }),- publicTitle: data.publicTitle,- publicDescription: data.publicDescription,- type: data.type,- templateMeta: {- create: extractDerivedDocumentMeta(settings, meta),- },- },- });-};diff --git a/packages/lib/server-only/template/delete-template-direct-link.ts b/packages/lib/server-only/template/delete-template-direct-link.tsindex e7971d19e..30f427f75 100644--- a/packages/lib/server-only/template/delete-template-direct-link.ts+++ b/packages/lib/server-only/template/delete-template-direct-link.ts@@ -1,8 +1,10 @@+import { EnvelopeType } from '@prisma/client';+import { generateAvaliableRecipientPlaceholder } from '@documenso/lib/utils/templates';import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { buildTeamWhereQuery } from '../../utils/teams';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type DeleteTemplateDirectLinkOptions = {templateId: number;@@ -15,24 +17,31 @@ export const deleteTemplateDirectLink = async ({userId,teamId,}: DeleteTemplateDirectLinkOptions): Promise<void> => {- const template = await prisma.template.findFirst({- where: {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'templateId',id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),},+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,include: {directLink: true,recipients: true,},});- if (!template) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Template not found',});}- const { directLink } = template;+ const { directLink } = envelope;if (!directLink) {return;@@ -41,17 +50,17 @@ export const deleteTemplateDirectLink = async ({await prisma.$transaction(async (tx) => {await tx.recipient.update({where: {- templateId: template.id,+ envelopeId: envelope.id,id: directLink.directTemplateRecipientId,},data: {- ...generateAvaliableRecipientPlaceholder(template.recipients),+ ...generateAvaliableRecipientPlaceholder(envelope.recipients),},});await tx.templateDirectLink.delete({where: {- templateId,+ envelopeId: envelope.id,},});});diff --git a/packages/lib/server-only/template/delete-template.ts b/packages/lib/server-only/template/delete-template.tsindex 9d8920031..7833a389b 100644--- a/packages/lib/server-only/template/delete-template.ts+++ b/packages/lib/server-only/template/delete-template.ts@@ -1,18 +1,25 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';-import { buildTeamWhereQuery } from '../../utils/teams';+import { type EnvelopeIdOptions } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type DeleteTemplateOptions = {- id: number;+ id: EnvelopeIdOptions;userId: number;teamId: number;};export const deleteTemplate = async ({ id, userId, teamId }: DeleteTemplateOptions) => {- return await prisma.template.delete({- where: {- id,- team: buildTeamWhereQuery({ teamId, userId }),- },+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ return await prisma.envelope.delete({+ where: envelopeWhereInput,});};diff --git a/packages/lib/server-only/template/duplicate-template.ts b/packages/lib/server-only/template/duplicate-template.tsdeleted file mode 100644index c82a9f70a..000000000--- a/packages/lib/server-only/template/duplicate-template.ts+++ /dev/null@@ -1,110 +0,0 @@-import type { Prisma } from '@prisma/client';-import { omit } from 'remeda';--import { nanoid } from '@documenso/lib/universal/id';-import { prisma } from '@documenso/prisma';-import type { TDuplicateTemplateMutationSchema } from '@documenso/trpc/server/template-router/schema';--import { buildTeamWhereQuery } from '../../utils/teams';--export type DuplicateTemplateOptions = TDuplicateTemplateMutationSchema & {- userId: number;- teamId: number;-};--export const duplicateTemplate = async ({- templateId,- userId,- teamId,-}: DuplicateTemplateOptions) => {- const template = await prisma.template.findUnique({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },- include: {- recipients: {- select: {- email: true,- name: true,- role: true,- signingOrder: true,- fields: true,- },- },- templateDocumentData: true,- templateMeta: true,- },- });-- if (!template) {- throw new Error('Template not found.');- }-- const documentData = await prisma.documentData.create({- data: {- type: template.templateDocumentData.type,- data: template.templateDocumentData.data,- initialData: template.templateDocumentData.initialData,- },- });-- let templateMeta: Prisma.TemplateCreateArgs['data']['templateMeta'] | undefined = undefined;-- if (template.templateMeta) {- templateMeta = {- create: {- ...omit(template.templateMeta, ['id', 'templateId']),- emailSettings: template.templateMeta.emailSettings || undefined,- },- };- }-- const duplicatedTemplate = await prisma.template.create({- data: {- userId,- teamId,- title: template.title + ' (copy)',- templateDocumentDataId: documentData.id,- authOptions: template.authOptions || undefined,- visibility: template.visibility,- templateMeta,- },- include: {- recipients: true,- },- });-- const recipientsToCreate = template.recipients.map((recipient) => ({- templateId: duplicatedTemplate.id,- email: recipient.email,- name: recipient.name,- role: recipient.role,- signingOrder: recipient.signingOrder,- token: nanoid(),- fields: {- createMany: {- data: recipient.fields.map((field) => ({- templateId: duplicatedTemplate.id,- type: field.type,- page: field.page,- positionX: field.positionX,- positionY: field.positionY,- width: field.width,- height: field.height,- customText: '',- inserted: false,- fieldMeta: field.fieldMeta as PrismaJson.FieldMeta,- })),- },- },- }));-- for (const recipientData of recipientsToCreate) {- await prisma.recipient.create({- data: recipientData,- });- }-- return duplicatedTemplate;-};diff --git a/packages/lib/server-only/template/find-templates.ts b/packages/lib/server-only/template/find-templates.tsindex a56bc22c4..3a46dd4b4 100644--- a/packages/lib/server-only/template/find-templates.ts+++ b/packages/lib/server-only/template/find-templates.ts@@ -1,15 +1,16 @@-import { DocumentVisibility, type Prisma, TeamMemberRole, type Template } from '@prisma/client';-import { match } from 'ts-pattern';+import type { TemplateType } from '@prisma/client';+import { EnvelopeType, type Prisma } from '@prisma/client';import { prisma } from '@documenso/prisma';+import { TEAM_DOCUMENT_VISIBILITY_MAP } from '../../constants/teams';import { type FindResultResponse } from '../../types/search-params';import { getMemberRoles } from '../team/get-member-roles';export type FindTemplatesOptions = {userId: number;teamId: number;- type?: Template['type'];+ type?: TemplateType;page?: number;perPage?: number;folderId?: string;@@ -23,46 +24,29 @@ export const findTemplates = async ({perPage = 10,folderId,}: FindTemplatesOptions) => {- const whereFilter: Prisma.TemplateWhereInput[] = [];+ const whereFilter: Prisma.EnvelopeWhereInput[] = [];- if (teamId === undefined) {- whereFilter.push({ userId });- }-- if (teamId !== undefined) {- const { teamRole } = await getMemberRoles({- teamId,- reference: {- type: 'User',- id: userId,- },- });+ const { teamRole } = await getMemberRoles({+ teamId,+ reference: {+ type: 'User',+ id: userId,+ },+ });- whereFilter.push(- { teamId },- {- OR: [- match(teamRole)- .with(TeamMemberRole.ADMIN, () => ({- visibility: {- in: [- DocumentVisibility.EVERYONE,- DocumentVisibility.MANAGER_AND_ABOVE,- DocumentVisibility.ADMIN,- ],- },- }))- .with(TeamMemberRole.MANAGER, () => ({- visibility: {- in: [DocumentVisibility.EVERYONE, DocumentVisibility.MANAGER_AND_ABOVE],- },- }))- .otherwise(() => ({ visibility: DocumentVisibility.EVERYONE })),- { userId, teamId },- ],- },- );- }+ whereFilter.push(+ { teamId },+ {+ OR: [+ {+ visibility: {+ in: TEAM_DOCUMENT_VISIBILITY_MAP[teamRole],+ },+ },+ { userId, teamId },+ ],+ },+ );if (folderId) {whereFilter.push({ folderId });@@ -71,9 +55,10 @@ export const findTemplates = async ({}const [data, count] = await Promise.all([- prisma.template.findMany({+ prisma.envelope.findMany({where: {- type,+ type: EnvelopeType.TEMPLATE,+ templateType: type,AND: whereFilter,},include: {@@ -85,7 +70,7 @@ export const findTemplates = async ({},fields: true,recipients: true,- templateMeta: true,+ documentMeta: true,directLink: {select: {token: true,@@ -98,8 +83,10 @@ export const findTemplates = async ({createdAt: 'desc',},}),- prisma.template.count({+ prisma.envelope.count({where: {+ type: EnvelopeType.TEMPLATE,+ templateType: type,AND: whereFilter,},}),diff --git a/packages/lib/server-only/template/get-template-by-direct-link-token.ts b/packages/lib/server-only/template/get-template-by-direct-link-token.tsindex 04efba70e..486b81f92 100644--- a/packages/lib/server-only/template/get-template-by-direct-link-token.ts+++ b/packages/lib/server-only/template/get-template-by-direct-link-token.ts@@ -1,6 +1,9 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';+import { mapSecondaryIdToTemplateId } from '../../utils/envelope';export interface GetTemplateByDirectLinkTokenOptions {token: string;@@ -9,8 +12,9 @@ export interface GetTemplateByDirectLinkTokenOptions {export const getTemplateByDirectLinkToken = async ({token,}: GetTemplateByDirectLinkTokenOptions) => {- const template = await prisma.template.findFirst({+ const envelope = await prisma.envelope.findFirst({where: {+ type: EnvelopeType.TEMPLATE,directLink: {token,enabled: true,@@ -23,21 +27,66 @@ export const getTemplateByDirectLinkToken = async ({fields: true,},},- templateDocumentData: true,- templateMeta: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ documentMeta: true,},});- const directLink = template?.directLink;+ const directLink = envelope?.directLink;++ // Todo: Envelopes+ const firstDocumentData = envelope?.envelopeItems[0]?.documentData;// Doing this to enforce type safety for directLink.- if (!directLink) {+ if (!directLink || !firstDocumentData) {throw new AppError(AppErrorCode.NOT_FOUND);}+ const recipientsWithMappedFields = envelope.recipients.map((recipient) => ({+ ...recipient,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ documentId: null,+ fields: recipient.fields.map((field) => ({+ ...field,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ documentId: null,+ })),+ }));++ // Backwards compatibility mapping.return {- ...template,- directLink,- fields: template.recipients.map((recipient) => recipient.fields).flat(),+ id: mapSecondaryIdToTemplateId(envelope.secondaryId),+ envelopeId: envelope.id,+ type: envelope.templateType,+ visibility: envelope.visibility,+ externalId: envelope.externalId,+ title: envelope.title,+ userId: envelope.userId,+ teamId: envelope.teamId,+ authOptions: envelope.authOptions,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ publicTitle: envelope.publicTitle,+ publicDescription: envelope.publicDescription,+ folderId: envelope.folderId,+ templateDocumentDataId: firstDocumentData.id,+ templateDocumentData: {+ ...firstDocumentData,+ envelopeItemId: envelope.envelopeItems[0].id,+ },+ directLink: {+ ...directLink,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ },+ templateMeta: {+ ...envelope.documentMeta,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ },+ recipients: recipientsWithMappedFields,+ fields: recipientsWithMappedFields.flatMap((recipient) => recipient.fields),};};diff --git a/packages/lib/server-only/template/get-template-by-id.ts b/packages/lib/server-only/template/get-template-by-id.tsindex 9a53056c4..546e16e39 100644--- a/packages/lib/server-only/template/get-template-by-id.ts+++ b/packages/lib/server-only/template/get-template-by-id.ts@@ -1,31 +1,37 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { buildTeamWhereQuery } from '../../utils/teams';+import type { EnvelopeIdOptions } from '../../utils/envelope';+import { mapSecondaryIdToTemplateId } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type GetTemplateByIdOptions = {- id: number;+ id: EnvelopeIdOptions;userId: number;teamId: number;- folderId?: string | null;};-export const getTemplateById = async ({- id,- userId,- teamId,- folderId = null,-}: GetTemplateByIdOptions) => {- const template = await prisma.template.findFirst({- where: {- id,- team: buildTeamWhereQuery({ teamId, userId }),- ...(folderId ? { folderId } : {}),- },+export const getTemplateById = async ({ id, userId, teamId }: GetTemplateByIdOptions) => {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id,+ type: EnvelopeType.TEMPLATE,+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {directLink: true,- templateDocumentData: true,- templateMeta: true,+ documentMeta: true,+ envelopeItems: {+ select: {+ id: true,+ documentData: true,+ },+ },recipients: true,fields: true,user: {@@ -39,11 +45,54 @@ export const getTemplateById = async ({},});- if (!template) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Template not found',});}- return template;+ const firstTemplateDocumentData = envelope.envelopeItems[0].documentData;++ if (!firstTemplateDocumentData) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Template document data not found',+ });+ }++ // eslint-disable-next-line unused-imports/no-unused-vars+ const { envelopeItems, documentMeta, ...rest } = envelope;++ const legacyTemplateId = mapSecondaryIdToTemplateId(envelope.secondaryId);++ return {+ ...rest,+ envelopeId: envelope.id,+ type: envelope.templateType,+ templateDocumentDataId: firstTemplateDocumentData.id,+ templateDocumentData: {+ ...firstTemplateDocumentData,+ envelopeItemId: envelope.envelopeItems[0].id,+ },+ templateMeta: {+ ...envelope.documentMeta,+ templateId: legacyTemplateId,+ },+ fields: envelope.fields.map((field) => ({+ ...field,+ documentId: null,+ templateId: legacyTemplateId,+ })),+ recipients: envelope.recipients.map((recipient) => ({+ ...recipient,+ documentId: null,+ templateId: legacyTemplateId,+ })),+ directLink: envelope.directLink+ ? {+ ...envelope.directLink,+ templateId: legacyTemplateId,+ }+ : null,+ id: mapSecondaryIdToTemplateId(envelope.secondaryId),+ };};diff --git a/packages/lib/server-only/template/toggle-template-direct-link.ts b/packages/lib/server-only/template/toggle-template-direct-link.tsindex 6641f5f5e..7cbbe2b50 100644--- a/packages/lib/server-only/template/toggle-template-direct-link.ts+++ b/packages/lib/server-only/template/toggle-template-direct-link.ts@@ -1,7 +1,10 @@+import { EnvelopeType } from '@prisma/client';+import { prisma } from '@documenso/prisma';import { AppError, AppErrorCode } from '../../errors/app-error';-import { buildTeamWhereQuery } from '../../utils/teams';+import { mapSecondaryIdToTemplateId } from '../../utils/envelope';+import { getEnvelopeWhereInput } from '../envelope/get-envelope-by-id';export type ToggleTemplateDirectLinkOptions = {templateId: number;@@ -16,24 +19,31 @@ export const toggleTemplateDirectLink = async ({teamId,enabled,}: ToggleTemplateDirectLinkOptions) => {- const template = await prisma.template.findFirst({- where: {+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ type: EnvelopeType.TEMPLATE,+ id: {+ type: 'templateId',id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),},+ userId,+ teamId,+ });++ const envelope = await prisma.envelope.findFirst({+ where: envelopeWhereInput,include: {recipients: true,directLink: true,},});- if (!template) {+ if (!envelope) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Template not found',});}- const { directLink } = template;+ const { directLink } = envelope;if (!directLink) {throw new AppError(AppErrorCode.NOT_FOUND, {@@ -41,13 +51,23 @@ export const toggleTemplateDirectLink = async ({});}- return await prisma.templateDirectLink.update({+ const updatedDirectLink = await prisma.templateDirectLink.update({where: {id: directLink.id,},data: {- templateId: template.id,+ envelopeId: envelope.id,enabled,},});++ return {+ id: updatedDirectLink.id,+ token: updatedDirectLink.token,+ createdAt: updatedDirectLink.createdAt,+ enabled: updatedDirectLink.enabled,+ directTemplateRecipientId: updatedDirectLink.directTemplateRecipientId,+ templateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ envelopeId: envelope.id,+ };};diff --git a/packages/lib/server-only/template/update-template.ts b/packages/lib/server-only/template/update-template.tsdeleted file mode 100644index 65314dd48..000000000--- a/packages/lib/server-only/template/update-template.ts+++ /dev/null@@ -1,138 +0,0 @@-import type { DocumentVisibility, Template, TemplateMeta } from '@prisma/client';--import { prisma } from '@documenso/prisma';--import { AppError, AppErrorCode } from '../../errors/app-error';-import type { TDocumentAccessAuthTypes, TDocumentActionAuthTypes } from '../../types/document-auth';-import { createDocumentAuthOptions, extractDocumentAuthMethods } from '../../utils/document-auth';-import { buildTeamWhereQuery } from '../../utils/teams';--export type UpdateTemplateOptions = {- userId: number;- teamId: number;- templateId: number;- data?: {- title?: string;- externalId?: string | null;- visibility?: DocumentVisibility;- globalAccessAuth?: TDocumentAccessAuthTypes[];- globalActionAuth?: TDocumentActionAuthTypes[];- publicTitle?: string;- publicDescription?: string;- type?: Template['type'];- useLegacyFieldInsertion?: boolean;- };- meta?: Partial<Omit<TemplateMeta, 'id' | 'templateId'>>;-};--export const updateTemplate = async ({- userId,- teamId,- templateId,- meta = {},- data = {},-}: UpdateTemplateOptions) => {- const template = await prisma.template.findFirst({- where: {- id: templateId,- team: buildTeamWhereQuery({ teamId, userId }),- },- include: {- templateMeta: true,- team: {- select: {- organisationId: true,- organisation: {- select: {- organisationClaim: true,- },- },- },- },- },- });-- if (!template) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Template not found',- });- }-- if (Object.values(data).length === 0 && Object.keys(meta).length === 0) {- return template;- }-- const { documentAuthOption } = extractDocumentAuthMethods({- documentAuth: template.authOptions,- });-- const documentGlobalAccessAuth = documentAuthOption?.globalAccessAuth ?? null;- const documentGlobalActionAuth = documentAuthOption?.globalActionAuth ?? null;-- // If the new global auth values aren't passed in, fallback to the current document values.- const newGlobalAccessAuth =- data?.globalAccessAuth === undefined ? documentGlobalAccessAuth : data.globalAccessAuth;- const newGlobalActionAuth =- data?.globalActionAuth === undefined ? documentGlobalActionAuth : data.globalActionAuth;-- // Check if user has permission to set the global action auth.- if (newGlobalActionAuth.length > 0 && !template.team.organisation.organisationClaim.flags.cfr21) {- throw new AppError(AppErrorCode.UNAUTHORIZED, {- message: 'You do not have permission to set the action auth',- });- }-- const authOptions = createDocumentAuthOptions({- globalAccessAuth: newGlobalAccessAuth,- globalActionAuth: newGlobalActionAuth,- });-- const emailId = meta.emailId;-- // Validate the emailId belongs to the organisation.- if (emailId) {- const email = await prisma.organisationEmail.findFirst({- where: {- id: emailId,- organisationId: template.team.organisationId,- },- });-- if (!email) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Email not found',- });- }- }-- return await prisma.template.update({- where: {- id: templateId,- },- data: {- title: data?.title,- externalId: data?.externalId,- type: data?.type,- visibility: data?.visibility,- publicDescription: data?.publicDescription,- publicTitle: data?.publicTitle,- useLegacyFieldInsertion: data?.useLegacyFieldInsertion,- authOptions,- templateMeta: {- upsert: {- where: {- templateId,- },- create: {- ...meta,- emailSettings: meta?.emailSettings || undefined,- },- update: {- ...meta,- emailSettings: meta?.emailSettings || undefined,- },- },- },- },- });-};diff --git a/packages/lib/server-only/user/delete-user.ts b/packages/lib/server-only/user/delete-user.tsindex 414e13a46..ccc7f7476 100644--- a/packages/lib/server-only/user/delete-user.ts+++ b/packages/lib/server-only/user/delete-user.ts@@ -1,4 +1,4 @@-import { DocumentStatus } from '@prisma/client';+import { DocumentStatus, EnvelopeType } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -25,9 +25,10 @@ export const deleteUser = async ({ id }: DeleteUserOptions) => {const serviceAccount = await deletedAccountServiceAccount();// TODO: Send out cancellations for all pending docs- await prisma.document.updateMany({+ await prisma.envelope.updateMany({where: {userId: user.id,+ type: EnvelopeType.DOCUMENT,status: {in: [DocumentStatus.PENDING, DocumentStatus.REJECTED, DocumentStatus.COMPLETED],},diff --git a/packages/lib/server-only/user/get-all-users.ts b/packages/lib/server-only/user/get-all-users.tsindex 69e07813d..fd3c560db 100644--- a/packages/lib/server-only/user/get-all-users.ts+++ b/packages/lib/server-only/user/get-all-users.ts@@ -1,4 +1,4 @@-import { Prisma } from '@prisma/client';+import { EnvelopeType, Prisma } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -34,12 +34,20 @@ export const findUsers = async ({const [users, count] = await Promise.all([prisma.user.findMany({- include: {- documents: {+ select: {+ _count: {select: {- id: true,+ envelopes: {+ where: {+ type: EnvelopeType.DOCUMENT,+ },+ },},},+ id: true,+ name: true,+ email: true,+ roles: true,},where: whereClause,skip: Math.max(page - 1, 0) * perPage,@@ -51,7 +59,10 @@ export const findUsers = async ({]);return {- users,+ users: users.map((user) => ({+ ...user,+ documentCount: user._count.envelopes,+ })),totalPages: Math.ceil(count / perPage),};};diff --git a/packages/lib/server-only/webhooks/trigger/generate-sample-data.ts b/packages/lib/server-only/webhooks/trigger/generate-sample-data.tsindex 73916c491..47e3e7c53 100644--- a/packages/lib/server-only/webhooks/trigger/generate-sample-data.ts+++ b/packages/lib/server-only/webhooks/trigger/generate-sample-data.ts@@ -410,7 +410,6 @@ export const generateSampleWebhookPayload = (externalId: null,userId: 3,status: DocumentStatus.PENDING,- documentDataId: 'cm6exvn93006hi02ru90a265a',documentMeta: {...basePayload.documentMeta,id: 'cm6exvn96006ji02rqvzjvwoy',diff --git a/packages/lib/server-only/webhooks/zapier/list-documents.ts b/packages/lib/server-only/webhooks/zapier/list-documents.tsindex 73077d40f..9aed6a878 100644--- a/packages/lib/server-only/webhooks/zapier/list-documents.ts+++ b/packages/lib/server-only/webhooks/zapier/list-documents.ts@@ -1,8 +1,8 @@-import type { Webhook } from '@prisma/client';+import { EnvelopeType, type Webhook } from '@prisma/client';-import { findDocuments } from '@documenso/lib/server-only/document/find-documents';-import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document';+import { prisma } from '@documenso/prisma';+import { mapSecondaryIdToDocumentId } from '../../../utils/envelope';import { getWebhooksByTeamId } from '../get-webhooks-by-team-id';import { validateApiToken } from './validateApiToken';@@ -14,48 +14,73 @@ export const listDocumentsHandler = async (req: Request) => {return new Response('Unauthorized', { status: 401 });}- const { user, userId, teamId } = await validateApiToken({ authorization });+ const { user, teamId } = await validateApiToken({ authorization });- let allWebhooks: Webhook[] = [];+ const allWebhooks: Webhook[] = await getWebhooksByTeamId(teamId, user.id);- const documents = await findDocuments({- userId: userId ?? user.id,- teamId,- perPage: 1,- });-- const recipients = await getRecipientsForDocument({- documentId: documents.data[0].id,- userId: userId ?? user.id,- teamId,+ const document = await prisma.envelope.findFirst({+ where: {+ userId: user.id,+ teamId,+ type: EnvelopeType.DOCUMENT,+ },+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ recipients: true,+ },});- allWebhooks = await getWebhooksByTeamId(teamId, user.id);+ if (+ !document ||+ document.envelopeItems.length === 0 ||+ document.recipients.length === 0 ||+ allWebhooks.length === 0+ ) {+ return Response.json([]);+ }- if (documents && documents.data.length > 0 && allWebhooks.length > 0 && recipients.length > 0) {- const testWebhook = {- event: allWebhooks[0].eventTriggers.toString(),- createdAt: allWebhooks[0].createdAt,- webhookEndpoint: allWebhooks[0].webhookUrl,- payload: {- id: documents.data[0].id,- userId: documents.data[0].userId,- title: documents.data[0].title,- status: documents.data[0].status,- documentDataId: documents.data[0].documentDataId,- createdAt: documents.data[0].createdAt,- updatedAt: documents.data[0].updatedAt,- completedAt: documents.data[0].completedAt,- deletedAt: documents.data[0].deletedAt,- teamId: documents.data[0].teamId,- Recipient: recipients,- },- };+ const legacyDocumentId = mapSecondaryIdToDocumentId(document.secondaryId);- return Response.json([testWebhook]);- }+ const testWebhook = {+ event: allWebhooks[0].eventTriggers.toString(),+ createdAt: allWebhooks[0].createdAt,+ webhookEndpoint: allWebhooks[0].webhookUrl,+ payload: {+ id: legacyDocumentId,+ userId: document.userId,+ title: document.title,+ status: document.status,+ createdAt: document.createdAt,+ updatedAt: document.updatedAt,+ completedAt: document.completedAt,+ deletedAt: document.deletedAt,+ teamId: document.teamId,+ Recipient: document.recipients.map((recipient) => ({+ id: recipient.id,+ documentId: legacyDocumentId,+ templateId: null,+ email: recipient.email,+ name: recipient.name,+ token: recipient.token,+ documentDeletedAt: recipient.documentDeletedAt,+ expired: recipient.expired,+ signedAt: recipient.signedAt,+ authOptions: recipient.authOptions,+ signingOrder: recipient.signingOrder,+ rejectionReason: recipient.rejectionReason,+ role: recipient.role,+ readStatus: recipient.readStatus,+ signingStatus: recipient.signingStatus,+ sendStatus: recipient.sendStatus,+ })),+ },+ };- return Response.json([]);+ return Response.json([testWebhook]);} catch (err) {console.error(err);diff --git a/packages/lib/translations/de/web.po b/packages/lib/translations/de/web.poindex b3a8af9e0..c47b81dcc 100644--- a/packages/lib/translations/de/web.po+++ b/packages/lib/translations/de/web.po@@ -72,6 +72,11 @@ msgstr "{0, plural, one {(1 Zeichen über dem Limit)} other {(# Zeichen über demsgid "{0, plural, one {# character over the limit} other {# characters over the limit}}"msgstr "{0, plural, one {# Zeichen über dem Limit} other {# Zeichen über dem Limit}}"+#. placeholder {0}: fieldMeta?.characterLimit - (field.value?.length ?? 0)+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "{0, plural, one {# character remaining} other {# characters remaining}}"+msgstr ""+#. placeholder {0}: folder._count.documents#: apps/remix/app/components/general/folder/folder-card.tsxmsgid "{0, plural, one {# document} other {# documents}}"@@ -103,13 +108,25 @@ msgstr "{0, plural, one {# Vorlage} other {# Vorlagen}}"msgid "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"msgstr "{0, plural, one {<0>Sie haben <1>1</1> ausstehende Einladung</0>} other {<2>Sie haben <3>#</3> ausstehende Einladungen</2>}}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"+msgstr ""++#. placeholder {0}: fields.filter((field) => field.envelopeItemId === doc.id).length+#. placeholder {0}: recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id) .length+#: apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0, plural, one {1 Field} other {# Fields}}"+msgstr ""+#. placeholder {0}: autoSignableFields.filter((f) => f.type === fieldType).length#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsxmsgid "{0, plural, one {1 matching field} other {# matching fields}}"msgstr "{0, plural, one {1 passendes Feld} other {# passende Felder}}"#. placeholder {0}: recipients.length-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxmsgid "{0, plural, one {1 Recipient} other {# Recipients}}"msgstr "{0, plural, one {1 Empfänger} other {# Empfänger}}"@@ -131,8 +148,13 @@ msgstr "{0}"msgid "{0} direct signing templates"msgstr "{0} direkte Signaturvorlagen"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0} fields remaining"+msgstr ""+#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{0} has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{0} hat Sie eingeladen, das Dokument \"{1}\" {recipientActionVerb}."@@ -144,7 +166,8 @@ msgstr "{0} hat dich eingeladen, ein Dokument {recipientActionVerb}"#. placeholder {0}: remaining.documents#. placeholder {1}: quota.documents-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "{0} of {1} documents remaining this month."msgstr "{0} von {1} Dokumenten verbleibend in diesem Monat."@@ -156,13 +179,13 @@ msgid "{0} of {1} row(s) selected."msgstr "{0} von {1} Zeile(n) ausgewählt."#. placeholder {0}: user.name || user.email-#. placeholder {1}: document.team.name-#. placeholder {2}: document.title+#. placeholder {1}: envelope.team.name+#. placeholder {2}: envelope.title#: packages/lib/server-only/document/resend-document.tsmsgid "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."msgstr "{0} im Namen von \"{1}\" hat Sie eingeladen, das Dokument \"{2}\" {recipientActionVerb}."-#. placeholder {0}: recipients.length+#. placeholder {0}: envelope.recipients.length#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxmsgid "{0} Recipient(s)"msgstr "{0} Empfänger(in)"@@ -214,7 +237,7 @@ msgid "{inviterName} has removed you from the document<0/>\"{documentName}\""msgstr "{inviterName} hat dich aus dem Dokument<0/>\"{documentName}\" entfernt"#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{inviterName} im Auftrag von \"{0}\" hat Sie eingeladen, das Dokument \"{1}\" {recipientActionVerb}."@@ -346,7 +369,7 @@ msgstr "{recipientName} hat das Dokument '{documentName}' abgelehnt"msgid "{recipientReference} has completed signing the document."msgstr "{recipientReference} hat das Dokument vollständig unterschrieben."-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsmsgid "{recipientReference} has signed \"{0}\""msgstr "{recipientReference} hat \"{0}\" unterschrieben"@@ -393,14 +416,26 @@ msgstr "{userName} hat das Dokument in CC gesetzt"msgid "{userName} completed their task"msgstr "{userName} hat ihre Aufgabe abgeschlossen"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} failed to validate a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} rejected the document"msgstr "{userName} hat das Dokument abgelehnt"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} requested a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} signed the document"msgstr "{userName} hat das Dokument unterschrieben"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} validated a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} viewed the document"msgstr "{userName} hat das Dokument angesehen"@@ -410,6 +445,8 @@ msgid "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}msgstr "{visibleRows, plural, one {Eine # Ergebnis wird angezeigt.} other {# Ergebnisse werden angezeigt.}}"#. placeholder {0}: document.title+#. placeholder {0}: envelope.title+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "<0>\"{0}\"</0>is no longer available to sign"msgstr "<0>\"{0}\"</0> steht nicht mehr zur Unterschrift zur Verfügung"@@ -442,6 +479,7 @@ msgstr ""msgid "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."msgstr "<0>Gezeichnet</0> - Eine Signatur, die mit einer Maus oder einem Stift gezeichnet wird."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."msgstr "<0>E-Mail</0> - Der Empfänger erhält das Dokument zur Unterschrift, Genehmigung usw."@@ -466,10 +504,12 @@ msgstr "<0>Keine Einschränkungen</0> - Das Dokument kann direkt über die dem Emsgid "<0>None</0> - No authentication required"msgstr "<0>Keine</0> - Keine Authentifizierung erforderlich"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>None</0> - We will generate links which you can send to the recipients manually."msgstr "<0>Keiner</0> - Wir werden Links generieren, die Sie manuell an die Empfänger senden können."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."msgstr "<0>Hinweis</0> - Wenn Sie Links in Kombination mit direkten Vorlagen verwenden, müssen Sie die Links manuell an die restlichen Empfänger senden."@@ -554,6 +594,10 @@ msgstr ""msgid "401 Unauthorized"msgstr "401 Nicht autorisiert"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "404 Document not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsxmsgid "404 Email domain not found"msgstr "404 E-Mail-Domain nicht gefunden"@@ -562,6 +606,12 @@ msgstr "404 E-Mail-Domain nicht gefunden"msgid "404 not found"msgstr "404 nicht gefunden"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "404 Not found"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsxmsgid "404 Not Found"msgstr ""@@ -584,6 +634,10 @@ msgstr "404 Profil nicht gefunden"msgid "404 Team not found"msgstr "404 Team nicht gefunden"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "404 Template not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsxmsgid "404 User not found"msgstr "404 Benutzer nicht gefunden"@@ -850,6 +904,7 @@ msgstr "Aktion"#: apps/remix/app/components/tables/admin-organisations-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Actions"msgstr "Aktionen"@@ -872,6 +927,7 @@ msgstr "Aktive Abonnements"msgid "Add"msgstr "Hinzufügen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add 2 or more signers to enable signing order."msgstr ""@@ -884,6 +940,7 @@ msgstr "Fügen Sie eine benutzerdefinierte Domain hinzu, um E-Mails im Namen Ihrmsgid "Add a document"msgstr "Dokument hinzufügen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -907,6 +964,7 @@ msgstr "Fügen Sie einen Authenticator hinzu, um als sekundäre Authentifizierunmsgid "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."msgstr "Fügen Sie einen Authenticator hinzu, um als sekundäre Authentifizierungsmethode beim Einloggen oder bei der Unterzeichnung von Dokumenten zu dienen."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Add an external ID to the document. This can be used to identify the document in external systems."msgstr "Fügen Sie dem Dokument eine externe ID hinzu. Diese kann verwendet werden, um das Dokument in externen Systemen zu identifizieren."@@ -941,6 +999,9 @@ msgid "Add Email Domain"msgstr "E-Mail-Domain hinzufügen"#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: apps/remix/app/components/general/document/document-edit-form.tsxmsgid "Add Fields"msgstr "Felder hinzufügen"@@ -975,6 +1036,7 @@ msgstr "Mehr hinzufügen"msgid "Add myself"msgstr "Mich selbst hinzufügen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "Add Myself"msgstr "Mich hinzufügen"@@ -996,6 +1058,7 @@ msgstr "Platzhalterempfänger hinzufügen"msgid "Add Placeholders"msgstr "Platzhalter hinzufügen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add Signer"@@ -1013,10 +1076,12 @@ msgstr "Unterzeichner hinzufügen und Signaturpräferenzen konfigurieren"msgid "Add team email"msgstr "Team-E-Mail hinzufügen"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text"msgstr "Text hinzufügen"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text to the field"msgstr "Text zum Feld hinzufügen"@@ -1148,6 +1213,7 @@ msgstr "Erlaube allen Organisationsmitgliedern den Zugriff auf dieses Team"msgid "Allow document recipients to reply directly to this email address"msgstr "Erlauben Sie den Dokumentempfängern, direkt an diese E-Mail-Adresse zu antworten"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -1158,6 +1224,7 @@ msgstr "Unterzeichner können nächsten Unterzeichner bestimmen"msgid "Allowed Email Domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -1205,6 +1272,8 @@ msgstr "Eine E-Mail mit dieser Adresse existiert bereits."#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx#: apps/remix/app/components/forms/token.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/reset-password.tsx@@ -1386,7 +1455,8 @@ msgstr "Ein Fehler ist aufgetreten, während die Unterschrift aktualisiert wurdemsgid "An error occurred while updating your profile."msgstr "Ein Fehler ist aufgetreten, während dein Profil aktualisiert wurde."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "An error occurred while uploading your document."msgstr "Ein Fehler ist aufgetreten, während dein Dokument hochgeladen wurde."@@ -1410,6 +1480,7 @@ msgstr "Ein unerwarteter Fehler ist aufgetreten."#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/admin+/site-settings.tsx#: apps/remix/app/components/general/app-command-menu.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/signup.tsx@@ -1446,6 +1517,7 @@ msgstr "Ein unerwarteter Fehler ist aufgetreten."#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/account-delete-dialog.tsx@@ -1487,11 +1559,6 @@ msgstr "API-Token"msgid "App Version"msgstr "App-Version"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Approve"-msgstr ""-#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-button.tsx@@ -1501,19 +1568,27 @@ msgstr ""msgid "Approve"msgstr "Genehmigen"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Approve"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Approve Document"msgstr "Dokument genehmigen"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Approved"+msgstr "Genehmigt"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Approved"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Approved"-msgstr "Genehmigt"+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "Approver"+msgstr ""#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"@@ -1576,6 +1651,7 @@ msgstr "Bist du dir sicher, dass du dieses Team löschen möchtest?"#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Are you sure?"msgstr "Bist du dir sicher?"@@ -1589,8 +1665,7 @@ msgctxt "Recipient role action verb"msgid "Assist"msgstr ""-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Assist Document"msgstr "Dokumentassistenz"@@ -1616,20 +1691,21 @@ msgstr ""msgid "Assistants and Copy roles are currently not compatible with the multi-sign experience."msgstr "Assistenten- und Kopierollen sind derzeit nicht mit der Multi-Signatur-Erfahrung kompatibel."+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Assisted"+msgstr "Unterstützt"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Assisted"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Assisted"-msgstr "Unterstützt"-#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role progressive verb"msgid "Assisting"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx#: packages/ui/primitives/template-flow/add-template-settings.types.tsx#: packages/ui/primitives/document-flow/add-settings.types.ts@@ -1662,6 +1738,10 @@ msgstr ""msgid "Authentication required"msgstr "Authentifizierung erforderlich"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Authenticator app"+msgstr ""+#: apps/remix/app/components/forms/avatar-image.tsxmsgid "Avatar"msgstr "Avatar"@@ -1691,6 +1771,10 @@ msgstr "Zurück nach Hause"msgid "Background Color"msgstr "Hintergrundfarbe"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Background Jobs"+msgstr ""+#: apps/remix/app/components/forms/signin.tsx#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Backup Code"@@ -1828,6 +1912,7 @@ msgstr "Kann vorbereiten"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/general/teams/team-email-usage.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -1866,6 +1951,13 @@ msgstr "Kann vorbereiten"#: apps/remix/app/components/dialogs/team-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: apps/remix/app/components/dialogs/session-logout-all-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/passkey-create-dialog.tsx@@ -1888,6 +1980,10 @@ msgstr "Kann vorbereiten"#: apps/remix/app/components/dialogs/folder-move-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -1911,10 +2007,15 @@ msgstr "Vom Benutzer abgebrochen"msgid "Cannot remove document"msgstr "Dokument kann nicht entfernt werden"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Cannot remove signer"msgstr "Unterzeichner kann nicht entfernt werden"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Cannot upload items after the document has been sent"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Cc"@@ -1940,6 +2041,11 @@ msgctxt "Recipient role plural name"msgid "Ccers"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Center"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Character Limit"msgstr "Zeichenbeschränkung"@@ -1948,10 +2054,16 @@ msgstr "Zeichenbeschränkung"msgid "Charts"msgstr "Diagramme"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Checkbox"msgstr "Kontrollkästchen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Checkbox Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Checkbox values"msgstr "Checkbox-Werte"@@ -1978,6 +2090,10 @@ msgstr "Wählen Sie, wie das Dokument die Empfänger erreichen soll"msgid "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."msgstr "Wählen Sie, wie Sie Ihr Dokument an Empfänger verteilen möchten. E-Mail sendet Benachrichtigungen, Keine generiert Signatur-Links zur manuellen Verteilung."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Choose verification method"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Choose your preferred authentication method:"msgstr "Wählen Sie Ihre bevorzugte Authentifizierungsmethode aus:"@@ -2025,6 +2141,7 @@ msgstr "Klicken Sie hier, um hochzuladen"msgid "Click to copy signing link for sending to recipient"msgstr "Klicken Sie, um den Signatur-Link zu kopieren, um ihn an den Empfänger zu senden"+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx#: apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -2064,6 +2181,8 @@ msgstr ""#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Close"msgstr "Schließen"@@ -2103,7 +2222,7 @@ msgstr "Dokument abschließen"msgid "Complete Signing"msgstr "Unterzeichnung abschließen"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Complete the fields for the following signers."msgstr ""@@ -2112,8 +2231,10 @@ msgstr ""msgid "Complete Viewing"msgstr "Betrachten abschließen"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx#: packages/lib/constants/document.ts@@ -2157,6 +2278,14 @@ msgstr "Direkten Empfänger konfigurieren"msgid "Configure Document"msgstr "Dokument konfigurieren"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure document settings and options before sending."+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure email settings for the document"+msgstr ""+#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -2171,6 +2300,10 @@ msgstr "Konfigurieren Sie die allgemeinen Einstellungen für das Dokument."msgid "Configure general settings for the template."msgstr "Konfigurieren Sie die allgemeinen Einstellungen für die Vorlage."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure security settings for the document"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Configure template"msgstr "Vorlage konfigurieren"@@ -2305,6 +2438,7 @@ msgstr "Steuert die Standard-sichtbarkeit eines hochgeladenen Dokuments."msgid "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."msgstr "Steuert das Format der Nachricht, die gesendet wird, wenn ein Empfänger eingeladen wird, ein Dokument zu unterschreiben. Wenn eine benutzerdefinierte Nachricht beim Konfigurieren des Dokuments bereitgestellt wurde, wird diese stattdessen verwendet."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."msgstr "Legt die Sprache des Dokuments fest, einschließlich der Sprache für E-Mail-Benachrichtigungen und des endgültigen Zertifikats, das generiert und dem Dokument angehängt wird."@@ -2322,6 +2456,7 @@ msgid "Controls which signatures are allowed to be used when signing a document.msgstr "Bestimmt, welche Signaturen beim Unterschreiben eines Dokuments verwendet werden dürfen."#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copied"msgstr "Kopiert"@@ -2339,12 +2474,14 @@ msgstr "Kopiert"#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/components/document/document-share-button.tsxmsgid "Copied to clipboard"msgstr "In die Zwischenablage kopiert"#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copy"msgstr "Kopieren"@@ -2445,7 +2582,7 @@ msgstr "Antrag erstellen"msgid "Create Claim"msgstr "Antrag erstellen"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Create Direct Link"msgstr "Direkten Link erstellen"@@ -2645,6 +2782,7 @@ msgid "Dashboard"msgstr "Dashboard"#: apps/remix/app/components/tables/settings-security-activity-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-date-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -2656,12 +2794,17 @@ msgstr "Datum"msgid "Date created"msgstr "Erstellungsdatum"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Date Format"msgstr "Datumsformat"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Date Settings"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: packages/email/templates/organisation-invite.tsx@@ -2700,6 +2843,10 @@ msgstr "Standard-Signatureinstellungen"msgid "Default Time Zone"msgstr "Standard-Zeitzone"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Default Value"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "delete"msgstr "löschen"@@ -2731,6 +2878,7 @@ msgstr "löschen"#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/claim-delete-dialog.tsxmsgid "Delete"@@ -2770,6 +2918,7 @@ msgstr "Konto löschen"msgid "Delete document"msgstr "Dokument löschen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -2821,6 +2970,10 @@ msgstr "Team löschen"msgid "Delete team group"msgstr "Teamgruppe löschen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Delete Template"+msgstr ""+#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Delete the document. This action is irreversible so proceed with caution."msgstr "Löschen Sie das Dokument. Diese Aktion ist irreversibel, daher seien Sie vorsichtig."@@ -2872,6 +3025,7 @@ msgstr "Direkter Link"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsxmsgid "Direct Link"msgstr "Direkter Link"@@ -2909,6 +3063,7 @@ msgstr "Direkter Vorlagenlink gelöscht"msgid "Direct template link usage exceeded ({0}/{1})"msgstr "Die Verwendung des direkten Vorlagenlinks wurde überschritten ({0}/{1})"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Direction"msgstr "Richtung"@@ -3002,22 +3157,27 @@ msgstr "Documenso wird <0>alle Ihre Dokumente</0> löschen, zusammen mit allen amsgid "Document"msgstr "Dokument"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#. placeholder {1}: recipient.name#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejected by {1}"msgstr "Dokument \"{0}\" - Abgelehnt von {1}"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejection Confirmed"msgstr "Dokument \"{0}\" - Ablehnung Bestätigt"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsmsgid "Document \"{0}\" Cancelled"msgstr "Dokument „{0}“ abgebrochen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document & Recipients"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/document/document-global-auth-access-select.tsx@@ -3038,21 +3198,22 @@ msgid "Document Approved"msgstr "Dokument genehmigt"#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx-#: packages/lib/server-only/document/super-delete-document.ts+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: packages/lib/server-only/document/delete-document.ts+#: packages/lib/server-only/admin/admin-super-delete-document.tsmsgid "Document Cancelled"msgstr "Dokument storniert"+#: apps/remix/app/components/general/document/document-status.tsx+msgid "Document completed"+msgstr "Dokument abgeschlossen"+#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document completed"msgstr ""-#: apps/remix/app/components/general/document/document-status.tsx-msgid "Document completed"-msgstr "Dokument abgeschlossen"-#: packages/ui/components/document/document-email-checkboxes.tsx#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document completed email"@@ -3062,15 +3223,15 @@ msgstr "E-Mail zum Abschluss des Dokuments"msgid "Document Completed!"msgstr "Dokument abgeschlossen!"+#: apps/remix/app/components/dialogs/template-use-dialog.tsx+msgid "Document created"+msgstr "Dokument erstellt"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document created"msgstr ""-#: apps/remix/app/components/dialogs/template-use-dialog.tsx-msgid "Document created"-msgstr "Dokument erstellt"-#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Document Created"msgstr "Dokument erstellt"@@ -3093,17 +3254,17 @@ msgstr "Dokument erstellt mit einem <0>direkten Link</0>"msgid "Document Creation"msgstr "Dokumenterstellung"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"-msgid "Document deleted"-msgstr ""-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Document deleted"msgstr "Dokument gelöscht"+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"+msgid "Document deleted"+msgstr ""+#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document deleted email"msgstr "E-Mail zum Löschen des Dokuments"@@ -3112,6 +3273,8 @@ msgstr "E-Mail zum Löschen des Dokuments"msgid "Document Deleted!"msgstr "Dokument gelöscht!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Document Distribution Method"@@ -3125,6 +3288,10 @@ msgstr "Dokument-Entwurf"msgid "Document Duplicated"msgstr "Dokument dupliziert"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Editor"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document external ID updated"@@ -3134,7 +3301,6 @@ msgstr ""msgid "Document found in your account"msgstr "Dokument in Ihrem Konto gefunden"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Document ID"msgstr "Dokument-ID"@@ -3210,18 +3376,18 @@ msgstr "Dokument abgelehnt"msgid "Document Rejected"msgstr "Dokument Abgelehnt"-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx-msgid "Document resealed"-msgstr "Dokument wieder versiegelt"+#: apps/remix/app/components/general/document/document-edit-form.tsx+msgid "Document sent"+msgstr "Dokument gesendet"#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document sent"msgstr ""-#: apps/remix/app/components/general/document/document-edit-form.tsx-msgid "Document sent"-msgstr "Dokument gesendet"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Settings"+msgstr ""#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Document Signed"@@ -3244,6 +3410,10 @@ msgstr "Dokumentenstatus"msgid "Document title"msgstr "Dokumenttitel"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Document Title"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document title updated"@@ -3258,11 +3428,13 @@ msgstr ""msgid "Document updated successfully"msgstr "Dokument erfolgreich aktualisiert"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Document upload disabled due to unpaid invoices"msgstr "Dokumenten-Upload deaktiviert aufgrund unbezahlter Rechnungen"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Document uploaded"msgstr "Dokument hochgeladen"@@ -3276,6 +3448,10 @@ msgstr ""msgid "Document Viewed"msgstr "Dokument angesehen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Document visibility"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document visibility updated"@@ -3291,7 +3467,7 @@ msgstr ""#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/_layout.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -3363,15 +3539,21 @@ msgid "Download Certificate"msgstr "Zertifikat herunterladen"#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsxmsgid "Download Original"msgstr "Original herunterladen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Download PDF"+msgstr ""+#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Download Template CSV"msgstr "Vorlage CSV herunterladen"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: packages/lib/constants/document.tsmsgid "Draft"@@ -3398,42 +3580,68 @@ msgstr "Ziehen Sie die Datei hierher oder klicken Sie, um hochzuladen"msgid "Drag and drop your PDF file here"msgstr "Ziehen Sie Ihre PDF-Datei hierher"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Draw"+msgstr "Zeichnen"+#: packages/lib/constants/document.tsmsgctxt "Draw signatute type"msgid "Draw"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Draw"-msgstr "Zeichnen"-#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Drop your document here"msgstr "Legen Sie Ihr Dokument hier ab"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "Dropdown"msgstr "Dropdown"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown must have at least one option"+msgstr ""+#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Dropdown options"msgstr "Dropdown-Optionen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Dropdown Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown values"+msgstr ""+#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsx#: apps/remix/app/components/dialogs/template-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate"msgstr "Duplizieren"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Document"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate on all pages"msgstr "Auf allen Seiten duplizieren"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Template"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks._index.tsx#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx@@ -3471,6 +3679,10 @@ msgstr "Offenlegung der elektronischen Unterschrift"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-email-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/general/direct-template/direct-template-configure-form.tsx@@ -3548,6 +3760,10 @@ msgstr "E-Mail-Domains"msgid "Email domains synced"msgstr "E-Mail-Domains synchronisiert"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Email is required"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Email Options"msgstr "E-Mail-Optionen"@@ -3567,6 +3783,8 @@ msgstr "E-Mail-Präferenzen aktualisiert"msgid "Email resent"msgstr "E-Mail erneut gesendet"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Email Sender"@@ -3580,6 +3798,14 @@ msgstr "E-Mail gesendet"msgid "Email sent!"msgstr "E-Mail gesendet!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Email Settings"+msgstr ""++#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Email verification"+msgstr ""+#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsxmsgid "Email verification has been removed"msgstr "E-Mail-Verifizierung wurde entfernt"@@ -3644,6 +3870,7 @@ msgstr "Aktivieren Sie das benutzerdefinierte Branding für alle Dokumente in dimsgid "Enable Direct Link Signing"msgstr "Direktlink-Signierung aktivieren"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -3681,6 +3908,10 @@ msgstr "Anspruchsname eingeben"msgid "Enter the domain you want to use for sending emails (without http:// or www)"msgstr "Geben Sie die Domain ein, die Sie zum Versenden von E-Mails verwenden möchten (ohne http:// oder www)"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Enter verification code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your 2FA code"msgstr "Geben Sie Ihren 2FA-Code ein"@@ -3701,11 +3932,16 @@ msgstr "Geben Sie Ihre E-Mail-Adresse ein, um das abgeschlossene Dokument zu erhmsgid "Enter your name"msgstr "Geben Sie Ihren Namen ein"+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Enter your number here"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your password"msgstr "Geben Sie Ihr Passwort ein"#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsxmsgid "Enter your text here"msgstr "Geben Sie hier Ihren Text ein"@@ -3713,6 +3949,34 @@ msgstr "Geben Sie hier Ihren Text ein"msgid "Enterprise"msgstr "Unternehmen"+#: packages/ui/primitives/document-upload.tsx+msgid "Envelope (beta)"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Envelope distributed"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Envelope Duplicated"+msgstr ""++#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+msgid "Envelope ID"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Envelope resent"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Envelope Title"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Envelope updated"+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -3753,7 +4017,8 @@ msgstr "Unternehmen"#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsx-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx@@ -3814,11 +4079,17 @@ msgstr "Zeitüberschreitung überschritten"msgid "Expired"msgstr "Abgelaufen"+#. placeholder {0}: DateTime.fromMillis(Math.max(millisecondsRemaining, 0)).toFormat( 'mm:ss', )+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Expires in {0}"+msgstr ""+#. placeholder {0}: i18n.date(token.expires, DateTime.DATETIME_FULL)#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Expires on {0}"msgstr "Läuft ab am {0}"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "External ID"@@ -3902,10 +4173,12 @@ msgstr "Fehlgeschlagen: {failedCount}"msgid "Feature Flags"msgstr "Funktionsflaggen"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field character limit"msgstr "Zeichenbeschränkung des Feldes"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -3915,16 +4188,20 @@ msgstr "Zeichenbeschränkung des Feldes"msgid "Field font size"msgstr "Feldschriftgröße"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Field format"msgstr "Feldformat"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Field label"msgstr "Feldbeschriftung"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field placeholder"msgstr "Feldplatzhalter"@@ -3952,7 +4229,8 @@ msgstr "Felder"msgid "Fields updated"msgstr "Felder aktualisiert"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"msgstr "Die Datei darf nicht größer als {APP_DOCUMENT_UPLOAD_SIZE_LIMIT} MB sein"@@ -4010,6 +4288,7 @@ msgstr "Ordner-Einstellungen"msgid "Folder updated successfully"msgstr "Ordner erfolgreich aktualisiert"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -4049,6 +4328,11 @@ msgstr "Kostenlos"msgid "Free Signature"msgstr "Freie Unterschrift"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Free Signature Settings"+msgstr ""++#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -4064,6 +4348,7 @@ msgstr "Vollständiger Name"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-page.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx@@ -4074,6 +4359,7 @@ msgstr "Allgemein"msgid "Generate DKIM Records"msgstr "DKIM-Datensätze generieren"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Generate Links"msgstr "Links generieren"@@ -4085,7 +4371,9 @@ msgstr "Globale Empfängerauthentifizierung"#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsxmsgid "Go back"@@ -4094,7 +4382,9 @@ msgstr "Zurückgehen"#: apps/remix/app/routes/_recipient+/_layout.tsx#: apps/remix/app/routes/_profile+/_layout.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: packages/ui/primitives/document-flow/document-flow-root.tsxmsgid "Go Back"@@ -4109,10 +4399,12 @@ msgstr "Zurück nach Hause"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Go Back Home"msgstr "Zurück nach Hause"#: apps/remix/app/routes/_authenticated+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxmsgid "Go home"msgstr "Nach Hause gehen"@@ -4163,22 +4455,25 @@ msgstr "Gruppenname"msgid "Groups"msgstr "Gruppen"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to approve this document"msgstr "hat Sie eingeladen, dieses Dokument zu genehmigen"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to assist this document"msgstr "hat dich eingeladen, bei diesem Dokument zu assistieren"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to sign this document"msgstr "hat Sie eingeladen, dieses Dokument zu unterzeichnen"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to view this document"msgstr "hat Sie eingeladen, dieses Dokument anzusehen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -4248,6 +4543,10 @@ msgstr "Hey, ich bin Timur"msgid "Hi {userName},"msgstr "Hallo, {userName},"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+msgstr ""+#: packages/email/templates/reset-password.tsxmsgid "Hi, {userName} <0>({userEmail})</0>"msgstr "Hallo, {userName} <0>({userEmail})</0>"@@ -4269,6 +4568,7 @@ msgstr "Startseite"msgid "Home (No Folder)"msgstr "Startseite (kein Ordner)"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Horizontal"msgstr "Horizontal"@@ -4322,6 +4622,10 @@ msgstr "ID in die Zwischenablage kopiert"msgid "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."msgstr "Bei einem Problem mit Ihrem Abo kontaktieren Sie uns bitte unter <0>{SUPPORT_EMAIL}</0>."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "If you didn't request this verification code, you can safely ignore this email."+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."msgstr "Wenn Sie die angegebene Authentifizierung nicht verwenden möchten, können Sie sie schließen, wodurch die nächste verfügbare Authentifizierung angezeigt wird."@@ -4388,11 +4692,29 @@ msgstr "Organisationsmitglieder erben"msgid "Inherited subscription claim"msgstr "Geerbter Abonnementsanspruch"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-initials-field.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Initials"msgstr "Initialen"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Initials are required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Initials Settings"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Insert a value into the number field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Insert a value into the text field"+msgstr ""+#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsxmsgid "Inserted"msgstr "Eingefügt"@@ -4409,6 +4731,7 @@ msgstr "Ungültiger Code. Bitte versuchen Sie es erneut."msgid "Invalid domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.types.tsmsgid "Invalid email"msgstr "Ungültige E-Mail"@@ -4531,6 +4854,8 @@ msgstr ""msgid "Joined {0}"msgstr "Beigetreten {0}"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -4541,6 +4866,7 @@ msgstr "Beschriftung"#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -4568,6 +4894,10 @@ msgstr "Zuletzt aktiv"msgid "Last modified"msgstr "Zuletzt geändert"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Last Retried"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Last updated"msgstr "Zuletzt aktualisiert"@@ -4604,6 +4934,10 @@ msgstr "Leer lassen, um von der Organisation zu erben."msgid "Leave organisation"msgstr "Organisation verlassen"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Left"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "Legality of Electronic Signatures"msgstr "Rechtlichkeit elektronischer Unterschriften"@@ -4654,9 +4988,16 @@ msgstr "Anhören von {0}"msgid "Load older activity"msgstr "Ältere Aktivitäten laden"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Loading"+msgstr ""+#: apps/remix/app/components/general/skeletons/document-edit-skeleton.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Loading document..."msgstr "Lade Dokument..."@@ -4722,7 +5063,7 @@ msgstr "Rechnungsverwaltung"msgid "Manage details for this public template"msgstr "Details für diese öffentliche Vorlage verwalten"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Manage Direct Link"msgstr "Direktlink verwalten"@@ -4847,6 +5188,7 @@ msgstr "MAU (hat Dokument abgeschlossen)"msgid "MAU (signed in)"msgstr "MAU (angemeldet)"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Max"msgstr "Max"@@ -4888,7 +5230,9 @@ msgstr "Mitglied seit"msgid "Members"msgstr "Mitglieder"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Message"@@ -4898,6 +5242,7 @@ msgstr "Nachricht"msgid "Message <0>(Optional)</0>"msgstr "Nachricht <0>(Optional)</0>"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Min"msgstr "Min"@@ -4970,9 +5315,13 @@ msgstr "N/A"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/admin-leaderboard-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/forms/subscription-claim-form.tsx@@ -4995,9 +5344,14 @@ msgid "Name"msgstr "Name"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsxmsgid "Name is required"msgstr "Name ist erforderlich"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Name Settings"+msgstr ""+#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Need to sign documents?"msgstr "Müssen Dokumente signieren?"@@ -5055,6 +5409,12 @@ msgstr "Nein"msgid "No active drafts"msgstr "Keine aktiven Entwürfe"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "No documents found"+msgstr ""+#: apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxmsgid "No folders found"@@ -5094,6 +5454,7 @@ msgstr "Kein passender Empfänger mit dieser Beschreibung gefunden."#: apps/remix/app/components/general/template/template-page-view-recipients.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "No recipients"msgstr "Keine Empfänger"@@ -5155,11 +5516,18 @@ msgid "No worries, it happens! Enter your email and we'll email you a special limsgstr "Keine Sorge, das passiert! Geben Sie Ihre E-Mail ein, und wir senden Ihnen einen speziellen Link zum Zurücksetzen Ihres Passworts."#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/lib/constants/document.tsmsgid "None"msgstr "Keine"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Not found"+msgstr ""+#: apps/remix/app/components/forms/signin.tsxmsgid "Not supported"msgstr "Nicht unterstützt"@@ -5169,6 +5537,7 @@ msgstr "Nicht unterstützt"msgid "Nothing to do"msgstr "Nichts zu tun"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-number-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -5176,6 +5545,7 @@ msgstr "Nichts zu tun"msgid "Number"msgstr "Nummer"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Number format"msgstr "Zahlenformat"@@ -5190,23 +5560,27 @@ msgstr "Anzahl der erlaubten Mitglieder. 0 = Unbegrenzt"msgid "Number of teams allowed. 0 = Unlimited"msgstr "Anzahl der erlaubten Teams. 0 = Unbegrenzt"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Number Settings"+msgstr ""+#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to approve this document"msgstr "im Auftrag von \"{0}\" hat Sie eingeladen, dieses Dokument zu genehmigen"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to assist this document"msgstr "im Namen von „{0}“ hat dich eingeladen, bei diesem Dokument zu assistieren"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to sign this document"msgstr "im Auftrag von \"{0}\" hat Sie eingeladen, dieses Dokument zu unterzeichnen"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to view this document"msgstr "im Auftrag von \"{0}\" hat Sie eingeladen, dieses Dokument anzusehen"@@ -5269,6 +5643,8 @@ msgid "Only PDF files are allowed"msgstr ""#: apps/remix/app/routes/_profile+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsxmsgid "Oops! Something went wrong."@@ -5278,6 +5654,14 @@ msgstr "Hoppla! Etwas ist schief gelaufen."msgid "Opened"msgstr "Geöffnet"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Option is required"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Option value cannot be empty"+msgstr ""+#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Or"@@ -5444,6 +5828,7 @@ msgstr "Seite {0} von {1}"#. placeholder {0}: i + 1#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Page {0} of {numPages}"msgstr "Seite {0} von {numPages}"@@ -5532,6 +5917,7 @@ msgstr "Zahlung überfällig"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/components/tables/organisation-email-domains-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsx@@ -5581,6 +5967,7 @@ msgstr "Persönliches Konto"msgid "Personal Inbox"msgstr "Persönlicher Posteingang"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Pick a number"msgstr "Wählen Sie eine Zahl"@@ -5597,6 +5984,13 @@ msgstr "Wählen Sie eine der folgenden Vereinbarungen aus und beginnen Sie das Smsgid "Pin"msgstr "Anheften"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Place and configure form fields in the document"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -5671,7 +6065,11 @@ msgstr "Bitte geben Sie einen aussagekräftigen Namen für Ihr Token ein. Dies wmsgid "Please enter a valid name."msgstr "Bitte geben Sie einen gültigen Namen ein."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Please enter a valid number"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please mark as viewed to complete."msgstr ""@@ -5707,6 +6105,10 @@ msgstr "Bitte beachten Sie, dass Sie den Zugriff auf alle Dokumente, die mit diemsgid "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"msgstr "Bitte beachten Sie, dass Sie den Zugriff auf alle mit diesem Team verbundenen Dokumente verlieren werden und alle Mitglieder entfernt und benachrichtigt werden."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please open your authenticator app and enter the 6-digit code for this document."+msgstr ""+#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."msgstr "Bitte geben Sie ein Token von der Authentifizierungs-App oder einen Backup-Code an. Wenn Sie keinen Backup-Code haben, kontaktieren Sie bitte den Support."@@ -5715,11 +6117,11 @@ msgstr "Bitte geben Sie ein Token von der Authentifizierungs-App oder einen Backmsgid "Please provide a token from your authenticator, or a backup code."msgstr "Bitte geben Sie ein Token von Ihrem Authentifizierer oder einen Backup-Code an."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before approving."msgstr "Bitte überprüfen Sie das Dokument, bevor Sie es genehmigen."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before signing."msgstr "Bitte überprüfen Sie das Dokument vor der Unterzeichnung."@@ -5727,6 +6129,10 @@ msgstr "Bitte überprüfen Sie das Dokument vor der Unterzeichnung."msgid "Please select a PDF file"msgstr "Bitte wählen Sie eine PDF-Datei aus"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please select how you'd like to receive your verification code."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-create-dialog.tsxmsgid "Please try a different domain."msgstr "Bitte versuchen Sie eine andere Domain."@@ -5742,6 +6148,8 @@ msgstr "Bitte versuchen Sie es später noch einmal."#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Please try again or contact our support."msgstr "Bitte versuchen Sie es erneut oder kontaktieren Sie unseren Support."@@ -5755,6 +6163,11 @@ msgstr "Bitte {0} eingeben, um zu bestätigen"msgid "Please type <0>{0}</0> to confirm."msgstr "Bitte geben Sie <0>{0}</0> ein, um zu bestätigen."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Please upload a document to continue"+msgstr ""+#: apps/remix/app/components/forms/branding-preferences-form.tsxmsgid "Please upload a logo"msgstr "Bitte laden Sie ein Logo hoch"@@ -5770,6 +6183,7 @@ msgstr "Vorformatiertes CSV-Template mit Beispieldaten."msgid "Preferences"msgstr "Einstellungen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/forms/document-preferences-form.tsxmsgid "Preview"msgstr "Vorschau"@@ -5778,11 +6192,29 @@ msgstr "Vorschau"msgid "Preview and configure template."msgstr "Vorschau und Vorlagen konfigurieren."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview Mode"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Preview the document before sending"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview what the signed document will look like with placeholder data"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/general/template/template-type.tsxmsgid "Private"msgstr "Privat"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Private Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Private templates can only be modified and viewed by you."msgstr "Private Vorlagen können nur von Ihnen bearbeitet und angezeigt werden."@@ -5843,14 +6275,28 @@ msgstr "Öffentliches Profil"msgid "Public profile URL"msgstr "Öffentlicher Profil-URL"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Public Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."msgstr "Öffentliche Vorlagen sind mit Ihrem öffentlichen Profil verbunden. Änderungen an öffentlichen Vorlagen erscheinen auch in Ihrem öffentlichen Profil."+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Quick Actions"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Radio"msgstr "Radio"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Radio Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-radio-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsxmsgid "Radio values"msgstr "Radio-Werte"@@ -5863,6 +6309,10 @@ msgstr "Radio-Werte"msgid "Read only"msgstr "Nur lesen"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Read Only"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.support.tsxmsgid "Read our documentation to get started with Documenso."msgstr ""@@ -5918,9 +6368,13 @@ msgstr "Neueste Dokumente"#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsx#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.tsmsgid "Recipient"msgstr "Empfänger"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/recipient/recipient-action-auth-select.tsx@@ -5955,6 +6409,10 @@ msgstr "Empfänger"msgid "Recipients metrics"msgstr "Empfängermetriken"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Recipients will be able to sign the document once sent"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Recipients will still retain their copy of the document"msgstr "Empfänger behalten weiterhin ihre Kopie des Dokuments"@@ -5987,12 +6445,17 @@ msgstr "Rot"msgid "Redirect URI"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Redirect URL"msgstr "Weiterleitungs-URL"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+msgid "Redirecting"+msgstr ""+#: apps/remix/app/components/general/claim-account.tsx#: apps/remix/app/components/forms/signup.tsxmsgid "Registration Successful"@@ -6001,12 +6464,13 @@ msgstr "Registrierung erfolgreich"#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Reject Document"msgstr "Dokument Ablehnen"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx@@ -6022,16 +6486,21 @@ msgstr "Ablehnung Bestätigt"msgid "Rejection reason: {reason}"msgstr "Ablehnungsgrund: {reason}"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Reload"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/forgot-password.tsxmsgid "Remembered your password? <0>Sign In</0>"msgstr "Haben Sie Ihr Passwort vergessen? <0>Einloggen</0>"-#. placeholder {0}: customEmail.subject+#. placeholder {0}: envelope.documentMeta.subject#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0}"msgstr "Erinnerung: {0}"-#. placeholder {0}: document.team.name+#. placeholder {0}: envelope.team.name#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0} invited you to {recipientActionVerb} a document"msgstr "Erinnerung: {0} hat dich eingeladen, ein Dokument {recipientActionVerb}"@@ -6051,6 +6520,7 @@ msgstr "Erinnerung: Bitte {recipientActionVerb} dein Dokument"#: apps/remix/app/components/tables/organisation-members-table.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx#: apps/remix/app/components/general/teams/team-email-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document-signing/document-signing-field-container.tsx#: apps/remix/app/components/forms/branding-preferences-form.tsx#: apps/remix/app/components/forms/avatar-image.tsx@@ -6095,6 +6565,8 @@ msgstr "Passwort wiederholen"msgid "Reply to email"msgstr "Auf E-Mail antworten"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Reply To Email"@@ -6112,6 +6584,10 @@ msgstr ""msgid "Required field"msgstr "Pflichtfeld"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Required Field"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "Required scopes"msgstr ""@@ -6126,10 +6602,20 @@ msgstr "Dokument wieder versiegeln"msgid "Resend"msgstr "Erneut senden"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Resend code"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Resend Confirmation Email"msgstr "Bestätigungs-E-Mail erneut senden"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Resend Document"+msgstr ""+#: apps/remix/app/components/general/teams/team-email-dropdown.tsxmsgid "Resend verification"msgstr "Bestätigung erneut senden"@@ -6188,6 +6674,10 @@ msgstr "Eingeschränkter Zugriff"msgid "Retention of Documents"msgstr "Aufbewahrung von Dokumenten"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Retried"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-passkey.tsxmsgid "Retry"msgstr "Wiederholen"@@ -6196,6 +6686,7 @@ msgstr "Wiederholen"#: apps/remix/app/routes/_unauthenticated+/organisation.invite.$token.tsx#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsx#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Return"msgstr "Zurück"@@ -6203,6 +6694,10 @@ msgstr "Zurück"msgid "Return to Documenso sign in page here"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to documents"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "Return to Home"msgstr "Zurück zur Startseite"@@ -6212,6 +6707,10 @@ msgstr "Zurück zur Startseite"msgid "Return to sign in"msgstr "Zurück zur Anmeldung"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to templates"+msgstr ""+#: packages/email/templates/organisation-account-link-confirmation.tsxmsgid "Review request"msgstr ""@@ -6231,6 +6730,10 @@ msgstr "Zugriff widerrufen"msgid "Revoke all sessions"msgstr "Alle Sitzungen widerrufen"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Right"+msgstr ""+#: apps/remix/app/components/tables/user-organisations-table.tsx#: apps/remix/app/components/tables/team-members-table.tsx#: apps/remix/app/components/tables/team-groups-table.tsx@@ -6263,10 +6766,20 @@ msgstr "Zeilen pro Seite"msgid "Save"msgstr "Speichern"+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "Save failed"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-fields.tsxmsgid "Save Template"msgstr "Vorlage speichern"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "Sealing job started"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.members.tsx@@ -6320,6 +6833,7 @@ msgstr "Geheim"#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsx#: apps/remix/app/components/general/settings-nav-mobile.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Security"msgstr "Sicherheit"@@ -6327,6 +6841,10 @@ msgstr "Sicherheit"msgid "Security activity"msgstr "Sicherheitsaktivität"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "See the background jobs tab for the status"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-dropdown-field.tsx#: packages/ui/primitives/document-flow/types.ts#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsx@@ -6365,10 +6883,15 @@ msgstr "Wählen Sie eine Vorlage aus, die Sie im öffentlichen Profil Ihres Teammsgid "Select a time zone"msgstr "Wählen Sie eine Zeitzone aus"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Select a value to sign into the field"+msgstr ""+#: packages/ui/components/document/document-global-auth-access-select.tsxmsgid "Select access methods"msgstr "Zugriffsmethoden auswählen"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: packages/ui/primitives/combobox.tsxmsgid "Select an option"msgstr "Option auswählen"@@ -6377,6 +6900,7 @@ msgstr "Option auswählen"msgid "Select an organisation to view teams"msgstr "Wählen Sie eine Organisation, um Teams anzuzeigen"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select at least"msgstr "Wählen Sie mindestens"@@ -6386,6 +6910,7 @@ msgstr "Wählen Sie mindestens"msgid "Select authentication methods"msgstr "Authentifizierungsmethoden auswählen"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Select default option"msgstr "Standardoption auswählen"@@ -6394,6 +6919,7 @@ msgstr "Standardoption auswählen"msgid "Select default role"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select direction"msgstr "Richtung auswählen"@@ -6432,6 +6958,10 @@ msgstr "Passkey auswählen"msgid "Select signature types"msgstr "Signaturtypen auswählen"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Select text align"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-create-dialog.tsxmsgid "Select the members to add to this group"msgstr "Wählen Sie die Mitglieder, die dieser Gruppe hinzugefügt werden sollen"@@ -6449,6 +6979,12 @@ msgstr "Auslöser auswählen"msgid "Select visibility"msgstr "Sichtbarkeit auswählen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Selected Recipient"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -6469,6 +7005,9 @@ msgstr "Bestätigungs-E-Mail senden"msgid "Send document"msgstr "Dokument senden"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsxmsgid "Send Document"msgstr "Dokument senden"@@ -6513,10 +7052,15 @@ msgstr "E-Mail über Empfänger-unterschrieben senden"msgid "Send recipient signing request email"msgstr "E-Mail über Unterzeichnungsanfrage des Empfängers senden"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsxmsgid "Send reminder"msgstr "Erinnerung senden"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Send reminders to the following recipients"+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "Send Test Webhook"msgstr "Test-Webhook senden"@@ -6567,6 +7111,7 @@ msgstr "Richten Sie Ihre Vorlageneigenschaften und Empfängerinformationen ein"#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/folder/folder-card.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Settings"msgstr "Einstellungen"@@ -6600,6 +7145,7 @@ msgstr "Teilen Sie Ihre Unterzeichnungserfahrung!"msgid "Show"msgstr "Anzeigen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Show advanced settings"@@ -6609,11 +7155,6 @@ msgstr "Erweiterte Einstellungen anzeigen"msgid "Show templates in your public profile for your audience to sign and get started quickly"msgstr "Vorlagen in Ihrem öffentlichen Profil anzeigen, damit Ihre Zielgruppe unterschreiben und schnell loslegen kann"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Sign"-msgstr ""-#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -6627,9 +7168,21 @@ msgstr ""#: apps/remix/app/components/general/document-signing/document-signing-auth-password.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-2fa.tsx#: apps/remix/app/components/general/document/document-page-view-button.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsxmsgid "Sign"msgstr "Unterschreiben"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Sign"+msgstr ""+#. placeholder {0}: recipient.name#. placeholder {1}: recipient.email#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx@@ -6648,8 +7201,8 @@ msgstr "Unterzeichnen als<0>{0} <1>({1})</1></0>"msgid "Sign document"msgstr "Dokument unterschreiben"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Sign Document"msgstr "Dokument signieren"@@ -6657,6 +7210,14 @@ msgstr "Dokument signieren"msgid "Sign Documents"msgstr "Dokumente unterschreiben"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign Dropdown Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign Email"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Sign field"@@ -6679,12 +7240,32 @@ msgstr "Anmelden"msgid "Sign in to your account"msgstr "Melden Sie sich bei Ihrem Konto an"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign Initials"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign Name"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Sign Number Field"+msgstr ""+#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx#: apps/remix/app/components/general/app-nav-mobile.tsxmsgid "Sign Out"msgstr "Ausloggen"+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+msgid "Sign Signature Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Sign Text Field"+msgstr ""+#: apps/remix/app/components/embed/embed-document-signing-page.tsx#: apps/remix/app/components/embed/embed-direct-template-client-page.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -6703,8 +7284,22 @@ msgstr "Registrieren mit Google"msgid "Sign Up with OIDC"msgstr "Registrieren mit OIDC"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign your email into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign your full name into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign your initials into the field"+msgstr ""+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -6730,6 +7325,10 @@ msgstr "Signatur ist zu klein"msgid "Signature Pad cannot be empty."msgstr "Signaturfeld darf nicht leer sein."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Signature Settings"+msgstr ""+#: packages/ui/components/document/document-signature-settings-tooltip.tsxmsgid "Signature types"msgstr "Signaturtypen"@@ -6742,17 +7341,17 @@ msgstr "Gesammelte Unterschriften"msgid "Signatures will appear once the document has been completed"msgstr "Unterschriften erscheinen, sobald das Dokument abgeschlossen ist"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Signed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsxmsgid "Signed"msgstr "Unterzeichnet"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Signed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Signer"@@ -6803,6 +7402,7 @@ msgstr "Signierlinks"msgid "Signing links have been generated for this document."msgstr "Unterzeichnungslinks wurden für dieses Dokument erstellt."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Signing order is enabled."@@ -6831,6 +7431,7 @@ msgstr "Website Banner"msgid "Site Settings"msgstr "Website Einstellungen"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."msgstr "Einige Unterzeichner haben noch kein Unterschriftsfeld zugewiesen bekommen. Bitte weisen Sie jedem Unterzeichner mindestens ein Unterschriftsfeld zu, bevor Sie fortfahren."@@ -6879,6 +7480,9 @@ msgstr "Einige Unterzeichner haben noch kein Unterschriftsfeld zugewiesen bekomm#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-member-invite-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx@@ -6893,6 +7497,8 @@ msgstr "Etwas ist schiefgelaufen beim Versuch, Ihre E-Mail-Adresse für <0>{0}</#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Something went wrong while loading the document."msgstr "Beim Laden des Dokuments ist ein Fehler aufgetreten."@@ -6908,6 +7514,10 @@ msgstr "Etwas ist schiefgelaufen beim Senden der Bestätigungs-E-Mail."msgid "Something went wrong while updating the team billing subscription, please contact support."msgstr "Etwas ist schiefgelaufen beim Aktualisieren des Abonnements für die Team-Zahlung. Bitte kontaktieren Sie den Support."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Something went wrong while uploading this file"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.email.tsx@@ -6960,6 +7570,7 @@ msgstr "Statistiken"#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table.tsx#: apps/remix/app/components/tables/admin-organisations-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsxmsgid "Status"msgstr "Status"@@ -6981,10 +7592,12 @@ msgid "Stripe Customer ID"msgstr "Stripe-Kunden-ID"#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Subject"msgstr "Betreff"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Subject <0>(Optional)</0>"@@ -6994,6 +7607,10 @@ msgstr "Betreff <0>(Optional)</0>"msgid "Submit"msgstr ""+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Submitted"+msgstr ""+#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx@@ -7033,7 +7650,6 @@ msgstr "Abonnement ungültig"#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx@@ -7043,6 +7659,7 @@ msgstr "Abonnement ungültig"#: apps/remix/app/components/general/teams/team-email-dropdown.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/organisation-update-form.tsx@@ -7074,6 +7691,7 @@ msgstr "Abonnement ungültig"#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsxmsgid "Success"msgstr "Erfolg"@@ -7107,6 +7725,10 @@ msgstr "Synchronisieren"msgid "Sync Email Domains"msgstr "E-Mail-Domains synchronisieren"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Sync failed, changes not saved"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "System Requirements"msgstr "Systemanforderungen"@@ -7259,7 +7881,7 @@ msgstr "Teams helfen Ihnen, Ihre Arbeit zu organisieren und mit anderen zusammenmsgid "Teams that this organisation group is currently assigned to"msgstr "Teams, denen diese Organisationsgruppe derzeit zugewiesen ist"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx@@ -7285,6 +7907,10 @@ msgstr "Vorlagendokument hochgeladen"msgid "Template duplicated"msgstr "Vorlage dupliziert"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Editor"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Template has been removed from your public profile."msgstr "Vorlage ist von Deinem öffentlichen Profil entfernt worden."@@ -7305,6 +7931,10 @@ msgstr "Vorlage verschoben"msgid "Template saved"msgstr "Vorlage gespeichert"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Settings"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Template title"msgstr "Vorlagentitel"@@ -7314,6 +7944,7 @@ msgid "Template updated successfully"msgstr "Vorlage erfolgreich aktualisiert"#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsxmsgid "Template uploaded"msgstr "Vorlage hochgeladen"@@ -7344,6 +7975,7 @@ msgstr "Test-Webhook fehlgeschlagen"msgid "Test webhook sent"msgstr "Test-Webhook gesendet"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx@@ -7352,6 +7984,7 @@ msgstr "Test-Webhook gesendet"msgid "Text"msgstr "Text"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -7365,6 +7998,14 @@ msgstr "Textausrichtung"msgid "Text Color"msgstr "Textfarbe"+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Text is required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Text Settings"+msgstr ""+#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Thank you for completing the signing process."msgstr "Danke, dass Sie den Signaturvorgang abgeschlossen haben."@@ -7453,6 +8094,17 @@ msgstr "Das Dokument wird von Ihrem Konto verborgen werden"msgid "The document will be immediately sent to recipients if this is checked."msgstr "Das Dokument wird sofort an die Empfänger gesendet, wenn dies angehakt ist."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "The document you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: packages/ui/components/document/document-send-email-message-helper.tsxmsgid "The document's name"msgstr "Der Name des Dokuments"@@ -7610,6 +8262,7 @@ msgstr "Der Name des Unterzeichners"#: apps/remix/app/components/general/avatar-with-recipient.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "The signing link has been copied to your clipboard."msgstr "Der Signierlink wurde in die Zwischenablage kopiert."@@ -7642,6 +8295,16 @@ msgstr "Die Vorlage wurde erfolgreich verschoben."msgid "The template will be removed from your profile"msgstr "Die Vorlage wird von Ihrem Profil entfernt"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "The template you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+msgid ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "The test webhook has been successfully sent to your endpoint."msgstr "Das Test-Webhook wurde erfolgreich an Ihren Endpunkt gesendet."@@ -7753,6 +8416,10 @@ msgstr "Diese Aktion ist umkehrbar, jedoch bitte seien Sie vorsichtig, da das Komsgid "This claim is locked and cannot be deleted."msgstr "Dieser Anspruch ist gesperrt und kann nicht gelöscht werden."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "This code will expire in {expiresInMinutes} minutes."+msgstr ""+#: packages/email/template-components/template-document-super-delete.tsxmsgid "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."msgstr "Dieses Dokument kann nicht wiederhergestellt werden. Wenn du den Grund für zukünftige Dokumente anfechten möchtest, kontaktiere bitte den Support."@@ -7765,6 +8432,7 @@ msgstr "Dieses Dokument kann nicht geändert werden"msgid "This document could not be deleted at this time. Please try again."msgstr "Dieses Dokument konnte derzeit nicht gelöscht werden. Bitte versuchen Sie es erneut."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsxmsgid "This document could not be duplicated at this time. Please try again."msgstr "Dieses Dokument konnte derzeit nicht dupliziert werden. Bitte versuche es erneut."@@ -7781,6 +8449,7 @@ msgstr "Dieses Dokument wurde bereits an diesen Empfänger gesendet. Sie könnenmsgid "This document has been cancelled by the owner and is no longer available for others to sign."msgstr "Dieses Dokument wurde vom Eigentümer storniert und steht anderen nicht mehr zur Unterzeichnung zur Verfügung."+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "This document has been cancelled by the owner."msgstr "Dieses Dokument wurde vom Eigentümer storniert."@@ -7817,6 +8486,10 @@ msgstr "Dieses Dokument wurde mit einem direkten Link erstellt."msgid "This document was sent using <0>Documenso.</0>"msgstr "Dieses Dokument wurde mit <0>Documenso.</0> gesendet"+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This document will be duplicated."+msgstr ""+#: packages/email/template-components/template-document-rejection-confirmed.tsxmsgid "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."msgstr "Diese E-Mail bestätigt, dass Sie das Dokument <0>\"{documentName}\"</0> abgelehnt haben, das von {documentOwnerName} gesendet wurde."@@ -7841,6 +8514,14 @@ msgstr "Diese E-Mail wird an den Empfänger gesendet und fordert ihn auf, das Domsgid "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."msgstr "Diese E-Mail wird an den Empfänger gesendet, der das Dokument gerade unterschrieben hat, wenn es noch andere Empfänger gibt, die noch nicht unterschrieben haben."+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "This envelope could not be distributed at this time. Please try again."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "This envelope could not be resent at this time. Please try again."+msgstr ""+#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."msgstr "Dieses Feld kann nicht geändert oder gelöscht werden. Wenn Sie den direkten Link dieser Vorlage teilen oder zu Ihrem öffentlichen Profil hinzufügen, kann jeder, der darauf zugreift, seinen Namen und seine E-Mail-Adresse eingeben und die ihm zugewiesenen Felder ausfüllen."@@ -7849,6 +8530,7 @@ msgstr "Dieses Feld kann nicht geändert oder gelöscht werden. Wenn Sie den dirmsgid "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."msgstr "Dieser Ordner enthält mehrere Elemente. Wenn Sie ihn löschen, werden alle Unterordner entfernt und alle darin enthaltenen Dokumente und Vorlagen in den Stammordner verschoben."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "This is how the document will reach the recipients once the document is ready for signing."msgstr "So wird das Dokument die Empfänger erreichen, sobald es zum Unterschreiben bereit ist."@@ -7865,6 +8547,10 @@ msgstr ""msgid "This is the URL which users will use to sign in to your organisation."msgstr ""+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "This item cannot be deleted"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/team.verify.email.$token.tsxmsgid "This link is invalid or has expired. Please contact your team to resend a verification."msgstr "Dieser Link ist ungültig oder abgelaufen. Bitte kontaktieren Sie Ihr Team, um eine neue Bestätigungsanfrage zu senden."@@ -7885,6 +8571,7 @@ msgstr "Dieser Zugangsschlüssel wurde bereits registriert."msgid "This passkey is not configured for this application. Please login and add one in the user settings."msgstr "Dieser Passkey ist für diese Anwendung nicht konfiguriert. Bitte melden Sie sich an und fügen Sie einen in den Benutzereinstellungen hinzu."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "This recipient can no longer be modified as they have signed a field, or completed the document."msgstr "Dieser Empfänger kann nicht mehr bearbeitet werden, da er ein Feld unterschrieben oder das Dokument abgeschlossen hat."@@ -7893,6 +8580,7 @@ msgstr "Dieser Empfänger kann nicht mehr bearbeitet werden, da er ein Feld untemsgid "This session has expired. Please try again."msgstr "Diese Sitzung ist abgelaufen. Bitte versuchen Sie es erneut."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "This signer has already signed the document."msgstr "Dieser Unterzeichner hat das Dokument bereits unterschrieben."@@ -7909,6 +8597,10 @@ msgstr "Diese Vorlage konnte derzeit nicht gelöscht werden. Bitte versuchen Siemsgid "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."msgstr "Diese Vorlage verwendet Altfeld-Integration, wir empfehlen das Verwenden der neuen Methode für genauere Ergebnisse."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This template will be duplicated."+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "This token is invalid or has expired. No action is needed."msgstr "Dieses Token ist ungültig oder abgelaufen. Es sind keine weiteren Maßnahmen erforderlich."@@ -7960,6 +8652,7 @@ msgid "Time zone"msgstr "Zeitzone"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -8108,6 +8801,7 @@ msgstr "Zwei-Faktor-Authentifizierung"msgid "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."msgstr "Wiederherstellungscodes für die Zwei-Faktor-Authentifizierung werden verwendet, um auf Ihr Konto zuzugreifen, falls Sie den Zugang zu Ihrer Authentifizierungs-App verlieren."+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/forms/signin.tsxmsgid "Two-Factor Authentication"msgstr "Zwei-Faktor-Authentifizierung"@@ -8128,17 +8822,17 @@ msgstr "Die Zwei-Faktor-Authentifizierung wurde für Ihr Konto deaktiviert. Siemsgid "Two-Factor Re-Authentication"msgstr "Zwei-Faktor-Wiederauthentifizierung"-#: packages/lib/constants/document.ts-msgctxt "Type signatute type"-msgid "Type"-msgstr ""-#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Type"msgstr "Typ"+#: packages/lib/constants/document.ts+msgctxt "Type signatute type"+msgid "Type"+msgstr ""+#: apps/remix/app/components/general/app-command-menu.tsxmsgid "Type a command or search..."msgstr "Geben Sie einen Befehl ein oder suchen Sie..."@@ -8287,6 +8981,7 @@ msgstr "Unbetitelte Gruppe"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-public-profile-templates-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/email-preferences-form.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx@@ -8418,15 +9113,15 @@ msgstr "<0>{0}</0> auf {planName} aktualisieren"msgid "Upgrade your plan to upload more documents"msgstr "Aktualisieren Sie Ihren Tarif, um mehr Dokumente hochzuladen"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Upload"+msgstr "Hochladen"+#: packages/lib/constants/document.tsmsgctxt "Upload signatute type"msgid "Upload"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Upload"-msgstr "Hochladen"-#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Upload a CSV file to create multiple documents from this template. Each row represents one document with its recipient details."msgstr "Laden Sie eine CSV-Datei hoch, um mehrere Dokumente aus dieser Vorlage zu erstellen. Jede Zeile repräsentiert ein Dokument mit den Empfängerdaten."@@ -8451,12 +9146,20 @@ msgstr "CSV hochladen"msgid "Upload custom document"msgstr "Benutzerdefiniertes Dokument hochladen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Upload disabled"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsx#: packages/ui/primitives/document-upload.tsxmsgid "Upload Document"msgstr "Dokument hochladen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Upload documents and add recipients"+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Upload failed"@@ -8496,6 +9199,10 @@ msgstr "Die hochgeladene Datei ist zu klein"msgid "Uploaded file not an allowed file type"msgstr "Die hochgeladene Datei ist kein zulässiger Dateityp"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Uploading"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Uploading document..."msgstr "Dokument wird hochgeladen..."@@ -8518,10 +9225,15 @@ msgstr "Authenticator verwenden"msgid "Use Backup Code"msgstr "Backup-Code verwenden"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Use Template"msgstr "Vorlage verwenden"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Use your authenticator app to generate a code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Use your passkey for authentication"msgstr "Verwenden Sie Ihren Passkey zur Authentifizierung"@@ -8570,17 +9282,25 @@ msgstr "Ein Benutzer mit dieser E-Mail existiert bereits. Bitte verwenden Sie eimsgid "Users"msgstr "Benutzer"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Validation"msgstr "Validierung"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Value"msgstr "Wert"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Verification Code Required"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Verification Email Sent"msgstr "Bestätigungs-E-Mail gesendet"@@ -8589,6 +9309,10 @@ msgstr "Bestätigungs-E-Mail gesendet"msgid "Verification email sent successfully."msgstr "Bestätigungs-E-Mail erfolgreich gesendet."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Verify & Complete"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsxmsgid "Verify Domain"msgstr "Domain verifizieren"@@ -8605,7 +9329,8 @@ msgstr "Überprüfen Sie Ihre E-Mail-Adresse"msgid "Verify your email address to unlock all features."msgstr "Überprüfen Sie Ihre E-Mail-Adresse, um alle Funktionen freizuschalten."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Verify your email to upload documents."msgstr "Überprüfen Sie Ihre E-Mail, um Dokumente hochzuladen."@@ -8613,15 +9338,11 @@ msgstr "Überprüfen Sie Ihre E-Mail, um Dokumente hochzuladen."msgid "Verify your team email address"msgstr "Überprüfen Sie Ihre Team-E-Mail-Adresse"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Vertical"msgstr "Vertikal"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "View"-msgstr ""-#: apps/remix/app/components/tables/organisation-billing-invoices-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx@@ -8634,6 +9355,11 @@ msgstr ""msgid "View"msgstr "Betrachten"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "View"+msgstr ""+#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsxmsgid "View activity"msgstr "Aktivität ansehen"@@ -8680,7 +9406,7 @@ msgstr "DNS-Datensätze anzeigen"msgid "View document"msgstr "Dokument anzeigen"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -8689,6 +9415,18 @@ msgstr "Dokument anzeigen"msgid "View Document"msgstr "Dokument ansehen"+#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to approve"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to assist"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to sign"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._index.tsxmsgid "View documents associated with this email"msgstr "Dokumente ansehen, die mit dieser E-Mail verknüpft sind"@@ -8730,17 +9468,17 @@ msgstr "Teams ansehen"msgid "View the DNS records for this email domain"msgstr "DNS-Datensätze für diese E-Mail-Domain anzeigen"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Viewed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Viewed"msgstr "Betrachtet"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Viewed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Viewer"@@ -8781,6 +9519,7 @@ msgstr "Warten auf andere, um zu unterschreiben"msgid "Waiting for Your Turn"msgstr "Warten auf deine Reihe"+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Want to send slick signing links like this one? <0>Check out Documenso.</0>"msgstr "Möchten Sie auffällige Signatur-Links wie diesen senden? <0>Überprüfen Sie Documenso.</0>"@@ -8789,6 +9528,9 @@ msgstr "Möchten Sie auffällige Signatur-Links wie diesen senden? <0>Überprüfmsgid "Want your own public profile?"msgstr "Möchten Sie Ihr eigenes öffentliches Profil haben?"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -8832,6 +9574,12 @@ msgstr "Wir konnten die Organisation nicht aktualisieren. Bitte versuchen Sie esmsgid "We couldn't update the provider. Please try again."msgstr ""+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-create-dialog.tsxmsgid "We encountered an error while creating the email. Please try again later."msgstr "Wir haben beim Erstellen der E-Mail einen Fehler festgestellt. Bitte versuchen Sie es später noch einmal."@@ -8918,6 +9666,10 @@ msgstr "Es gab einen unbekannten Fehler beim Versuch, diese E-Mail-Domain zu entmsgid "We encountered an unknown error while attempting to remove this email. Please try again later."msgstr "Es gab einen unbekannten Fehler beim Versuch, diese E-Mail zu entfernen. Bitte versuchen Sie es später erneut."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/team-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "We encountered an unknown error while attempting to remove this group. Please try again later."@@ -8932,6 +9684,11 @@ msgstr "Wir sind auf einen unbekannten Fehler gestoßen, während wir versucht hmsgid "We encountered an unknown error while attempting to remove this user. Please try again later."msgstr "Wir sind auf einen unbekannten Fehler gestoßen, während wir versucht haben, diesen Benutzer zu entfernen. Bitte versuchen Sie es später erneut."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+msgstr ""+#: apps/remix/app/components/forms/reset-password.tsxmsgid "We encountered an unknown error while attempting to reset your password. Please try again later."msgstr "Wir sind auf einen unbekannten Fehler gestoßen, während wir versucht haben, Ihr Passwort zurückzusetzen. Bitte versuchen Sie es später erneut."@@ -8955,6 +9712,10 @@ msgstr "Wir sind auf einen unbekannten Fehler gestoßen, während wir versucht hmsgid "We encountered an unknown error while attempting to update the banner. Please try again later."msgstr "Wir sind auf einen unbekannten Fehler gestoßen, während wir versucht haben, das Banner zu aktualisieren. Bitte versuchen Sie es später erneut."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "We encountered an unknown error while attempting to update the envelope. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "We encountered an unknown error while attempting to update the template. Please try again later."msgstr "Wir sind auf einen unbekannten Fehler gestoßen, während wir versucht haben, die Vorlage zu aktualisieren. Bitte versuchen Sie es später erneut."@@ -9067,11 +9828,13 @@ msgid "We were unable to verify your email. If your email is not verified alreadmsgstr "Wir konnten Ihre E-Mail nicht bestätigen. Wenn Ihre E-Mail noch nicht bestätigt wurde, versuchen Sie es bitte erneut."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We will generate signing links for you, which you can send to the recipients through your method of choice."msgstr "Wir werden Unterzeichnungslinks für Sie erstellen, die Sie an die Empfänger über Ihre bevorzugte Methode senden können."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We won't send anything to notify recipients."msgstr "Wir werden nichts senden, um die Empfänger zu benachrichtigen."@@ -9080,6 +9843,10 @@ msgstr "Wir werden nichts senden, um die Empfänger zu benachrichtigen."msgid "We'll get back to you as soon as possible via email."msgstr ""+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We'll send a 6-digit code to your email"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates._index.tsx#: apps/remix/app/components/tables/documents-table-empty-state.tsxmsgid "We're all empty"@@ -9093,6 +9860,10 @@ msgstr "Wir warten noch darauf, dass andere Unterzeichner dieses Dokument unterzmsgid "We've changed your password as you asked. You can now sign in with your new password."msgstr "Wir haben dein Passwort wie gewünscht geändert. Du kannst dich jetzt mit deinem neuen Passwort anmelden."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."msgstr "Wir haben eine Bestätigungs-E-Mail an <0>{email}</0> gesendet. Bitte überprüfen Sie Ihren Posteingang und klicken Sie auf den Link in der E-Mail, um Ihr Konto zu bestätigen."@@ -9157,6 +9928,7 @@ msgstr "Hast du stattdessen versucht, dieses Dokument zu bearbeiten?"msgid "What you can do with teams:"msgstr "Was Sie mit Teams machen können:"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -9255,6 +10027,10 @@ msgstr ""msgid "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."msgstr "Sie sind dabei, die E-Mail-Domain <0>{emailDomain}</0> von <1>{0}</1> zu entfernen. Alle mit dieser Domain verbundenen E-Mails werden gelöscht."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You are about to remove the following document and all associated fields"+msgstr ""+#. placeholder {0}: organisation.name#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsxmsgid "You are about to remove the following email from <0>{0}</0>."@@ -9385,6 +10161,7 @@ msgstr "Sie können die erstellten Dokumente in Ihrem Dashboard unter der Rubrikmsgid "You can view the document and its status by clicking the button below."msgstr "Sie können das Dokument und seinen Status einsehen, indem Sie auf die Schaltfläche unten klicken."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "You cannot add assistants when signing order is disabled."@@ -9394,6 +10171,10 @@ msgstr "Sie können keine Assistenten hinzufügen, wenn die Unterschriftenreihenmsgid "You cannot delete a group which has a higher role than you."msgstr "Sie können keine Gruppe löschen, die eine höhere Rolle hat als Sie."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You cannot delete this item because the document has been sent to recipients"+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."msgstr "Sie dürfen nicht mehr als {MAXIMUM_PASSKEYS} Passkeys haben."@@ -9419,7 +10200,8 @@ msgstr "Sie können keine Mitglieder aus diesem Team entfernen, wenn die Funktiomsgid "You cannot upload documents at this time."msgstr "Sie können derzeit keine Dokumente hochladen."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You cannot upload encrypted PDFs"msgstr "Sie können keine verschlüsselten PDFs hochladen"@@ -9478,7 +10260,7 @@ msgstr "Sie wurden aufgefordert, die folgenden Dokumente zu unterzeichnen. Übermsgid "You have declined the invitation from <0>{0}</0> to join their organisation."msgstr "Sie haben die Einladung von <0>{0}</0> abgelehnt, deren Organisation beizutreten."-#. placeholder {0}: `"${document.title}"`+#. placeholder {0}: `"${envelope.title}"`#: packages/lib/server-only/document/resend-document.ts#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "You have initiated the document {0} that requires you to {recipientActionVerb} it."@@ -9505,12 +10287,14 @@ msgstr "Sie haben das maximale Limit von {0} direkten Vorlagen erreicht. <0>Upgrmsgid "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."msgstr "Sie haben die maximale Anzahl an Teams für Ihren Plan erreicht. Bitte kontaktieren Sie den Vertrieb unter <0>{SUPPORT_EMAIL}</0>, wenn Sie Ihren Plan anpassen möchten."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You have reached your document limit for this month. Please upgrade your plan."msgstr "Sie haben Ihr Dokumentenlimit für diesen Monat erreicht. Bitte aktualisieren Sie Ihren Plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: packages/ui/primitives/document-dropzone.tsxmsgid "You have reached your document limit."msgstr "Sie haben Ihr Dokumentenlimit erreicht."@@ -9549,6 +10333,10 @@ msgstr "Sie haben diese E-Mail-Domain erfolgreich von der Organisation entfernt.msgid "You have successfully removed this email from the organisation."msgstr "Sie haben diese E-Mail erfolgreich von der Organisation entfernt."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You have successfully removed this envelope item."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "You have successfully removed this group from the organisation."msgstr "Sie haben diese Gruppe erfolgreich aus der Organisation entfernt."@@ -9597,11 +10385,19 @@ msgstr "Sie haben Ihre E-Mail-Adresse für <0>{0}</0> bestätigt."msgid "You must enter '{deleteMessage}' to proceed"msgstr "Sie müssen '{deleteMessage}' eingeben, um fortzufahren"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "You must select at least one item"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsxmsgid "You must type '{deleteMessage}' to confirm"msgstr "Sie müssen '{deleteMessage}' eingeben, um zu bestätigen"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "You need at least one recipient to add fields"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "You need to be an admin to manage API tokens."msgstr "Sie müssen Administrator sein, um API-Token zu verwalten."@@ -9683,7 +10479,8 @@ msgstr "Ihr aktueller Plan ist überfällig."msgid "Your direct signing templates"msgstr "Ihre direkten Unterzeichnungsvorlagen"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Your document failed to upload."msgstr "Ihr Dokument konnte nicht hochgeladen werden."@@ -9712,7 +10509,8 @@ msgstr "Ihr Dokument wurde erfolgreich gesendet."msgid "Your document has been successfully duplicated."msgstr "Ihr Dokument wurde erfolgreich dupliziert."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Your document has been uploaded successfully."msgstr "Ihr Dokument wurde erfolgreich hochgeladen."@@ -9749,6 +10547,18 @@ msgstr "Ihre E-Mail wird derzeit von Team <0>{0}</0> ({1}) verwendet."msgid "Your email preferences have been updated"msgstr "Ihre E-Mail-Präferenzen wurden aktualisiert"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Your envelope has been distributed successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Your envelope has been resent successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Your envelope has been successfully duplicated."+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Your existing tokens"msgstr "Ihre vorhandenen Tokens"@@ -9832,6 +10642,10 @@ msgstr "Ihr Team wurde erfolgreich gelöscht."msgid "Your team has been successfully updated."msgstr "Ihr Team wurde erfolgreich aktualisiert."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template failed to upload."+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Your template has been created successfully"msgstr "Ihre Vorlage wurde erfolgreich erstellt"@@ -9844,6 +10658,10 @@ msgstr "Ihre Vorlage wurde erfolgreich dupliziert."msgid "Your template has been successfully deleted."msgstr "Ihre Vorlage wurde erfolgreich gelöscht."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template has been uploaded successfully."+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxmsgid "Your template has been uploaded successfully. You will be redirected to the template page."msgstr "Ihre Vorlage wurde erfolgreich hochgeladen. Sie werden zur Vorlagenseite weitergeleitet."@@ -9868,6 +10686,18 @@ msgstr "Ihr Token wurde erfolgreich erstellt! Stellen Sie sicher, dass Sie es komsgid "Your tokens will be shown here once you create them."msgstr "Ihre Tokens werden hier angezeigt, sobald Sie sie erstellt haben."+#: packages/lib/server-only/2fa/email/send-2fa-token-email.ts+msgid "Your two-factor authentication code"+msgstr ""++#: packages/email/templates/access-auth-2fa.tsx+msgid "Your verification code is {code}"+msgstr ""++#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Your verification code:"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "your-domain.com another-domain.com"msgstr ""diff --git a/packages/lib/translations/en/web.po b/packages/lib/translations/en/web.poindex bf2b40730..60620e757 100644--- a/packages/lib/translations/en/web.po+++ b/packages/lib/translations/en/web.po@@ -67,6 +67,11 @@ msgstr "{0, plural, one {(1 character over)} other {(# characters over)}}"msgid "{0, plural, one {# character over the limit} other {# characters over the limit}}"msgstr "{0, plural, one {# character over the limit} other {# characters over the limit}}"+#. placeholder {0}: fieldMeta?.characterLimit - (field.value?.length ?? 0)+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "{0, plural, one {# character remaining} other {# characters remaining}}"+msgstr "{0, plural, one {# character remaining} other {# characters remaining}}"+#. placeholder {0}: folder._count.documents#: apps/remix/app/components/general/folder/folder-card.tsxmsgid "{0, plural, one {# document} other {# documents}}"@@ -98,13 +103,25 @@ msgstr "{0, plural, one {# template} other {# templates}}"msgid "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"msgstr "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"+msgstr "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"++#. placeholder {0}: fields.filter((field) => field.envelopeItemId === doc.id).length+#. placeholder {0}: recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id) .length+#: apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0, plural, one {1 Field} other {# Fields}}"+msgstr "{0, plural, one {1 Field} other {# Fields}}"+#. placeholder {0}: autoSignableFields.filter((f) => f.type === fieldType).length#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsxmsgid "{0, plural, one {1 matching field} other {# matching fields}}"msgstr "{0, plural, one {1 matching field} other {# matching fields}}"#. placeholder {0}: recipients.length-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxmsgid "{0, plural, one {1 Recipient} other {# Recipients}}"msgstr "{0, plural, one {1 Recipient} other {# Recipients}}"@@ -126,8 +143,13 @@ msgstr "{0}"msgid "{0} direct signing templates"msgstr "{0} direct signing templates"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0} fields remaining"+msgstr "{0} fields remaining"+#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{0} has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{0} has invited you to {recipientActionVerb} the document \"{1}\"."@@ -139,7 +161,8 @@ msgstr "{0} invited you to {recipientActionVerb} a document"#. placeholder {0}: remaining.documents#. placeholder {1}: quota.documents-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "{0} of {1} documents remaining this month."msgstr "{0} of {1} documents remaining this month."@@ -151,13 +174,13 @@ msgid "{0} of {1} row(s) selected."msgstr "{0} of {1} row(s) selected."#. placeholder {0}: user.name || user.email-#. placeholder {1}: document.team.name-#. placeholder {2}: document.title+#. placeholder {1}: envelope.team.name+#. placeholder {2}: envelope.title#: packages/lib/server-only/document/resend-document.tsmsgid "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."msgstr "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."-#. placeholder {0}: recipients.length+#. placeholder {0}: envelope.recipients.length#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxmsgid "{0} Recipient(s)"msgstr "{0} Recipient(s)"@@ -209,7 +232,7 @@ msgid "{inviterName} has removed you from the document<0/>\"{documentName}\""msgstr "{inviterName} has removed you from the document<0/>\"{documentName}\""#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."@@ -341,7 +364,7 @@ msgstr "{recipientName} has rejected the document '{documentName}'"msgid "{recipientReference} has completed signing the document."msgstr "{recipientReference} has completed signing the document."-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsmsgid "{recipientReference} has signed \"{0}\""msgstr "{recipientReference} has signed \"{0}\""@@ -388,14 +411,26 @@ msgstr "{userName} CC'd the document"msgid "{userName} completed their task"msgstr "{userName} completed their task"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} failed to validate a 2FA token for the document"+msgstr "{userName} failed to validate a 2FA token for the document"+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} rejected the document"msgstr "{userName} rejected the document"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} requested a 2FA token for the document"+msgstr "{userName} requested a 2FA token for the document"+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} signed the document"msgstr "{userName} signed the document"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} validated a 2FA token for the document"+msgstr "{userName} validated a 2FA token for the document"+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} viewed the document"msgstr "{userName} viewed the document"@@ -405,6 +440,8 @@ msgid "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}msgstr "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}"#. placeholder {0}: document.title+#. placeholder {0}: envelope.title+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "<0>\"{0}\"</0>is no longer available to sign"msgstr "<0>\"{0}\"</0>is no longer available to sign"@@ -437,6 +474,7 @@ msgstr "<0>Data access:</0> Access all data associated with your account"msgid "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."msgstr "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."msgstr "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."@@ -461,10 +499,12 @@ msgstr "<0>No restrictions</0> - The document can be accessed directly by the URmsgid "<0>None</0> - No authentication required"msgstr "<0>None</0> - No authentication required"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>None</0> - We will generate links which you can send to the recipients manually."msgstr "<0>None</0> - We will generate links which you can send to the recipients manually."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."msgstr "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."@@ -549,6 +589,10 @@ msgstr "400 Error"msgid "401 Unauthorized"msgstr "401 Unauthorized"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "404 Document not found"+msgstr "404 Document not found"+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsxmsgid "404 Email domain not found"msgstr "404 Email domain not found"@@ -557,6 +601,12 @@ msgstr "404 Email domain not found"msgid "404 not found"msgstr "404 not found"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "404 Not found"+msgstr "404 Not found"+#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsxmsgid "404 Not Found"msgstr "404 Not Found"@@ -579,6 +629,10 @@ msgstr "404 Profile not found"msgid "404 Team not found"msgstr "404 Team not found"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "404 Template not found"+msgstr "404 Template not found"+#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsxmsgid "404 User not found"msgstr "404 User not found"@@ -845,6 +899,7 @@ msgstr "Action"#: apps/remix/app/components/tables/admin-organisations-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Actions"msgstr "Actions"@@ -867,6 +922,7 @@ msgstr "Active Subscriptions"msgid "Add"msgstr "Add"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add 2 or more signers to enable signing order."msgstr "Add 2 or more signers to enable signing order."@@ -879,6 +935,7 @@ msgstr "Add a custom domain to send emails on behalf of your organisation. We'llmsgid "Add a document"msgstr "Add a document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -902,6 +959,7 @@ msgstr "Add an authenticator to serve as a secondary authentication method for smsgid "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."msgstr "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Add an external ID to the document. This can be used to identify the document in external systems."msgstr "Add an external ID to the document. This can be used to identify the document in external systems."@@ -936,6 +994,9 @@ msgid "Add Email Domain"msgstr "Add Email Domain"#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: apps/remix/app/components/general/document/document-edit-form.tsxmsgid "Add Fields"msgstr "Add Fields"@@ -970,6 +1031,7 @@ msgstr "Add more"msgid "Add myself"msgstr "Add myself"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "Add Myself"msgstr "Add Myself"@@ -991,6 +1053,7 @@ msgstr "Add Placeholder Recipient"msgid "Add Placeholders"msgstr "Add Placeholders"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add Signer"@@ -1008,10 +1071,12 @@ msgstr "Add signers and configure signing preferences"msgid "Add team email"msgstr "Add team email"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text"msgstr "Add text"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text to the field"msgstr "Add text to the field"@@ -1143,6 +1208,7 @@ msgstr "Allow all organisation members to access this team"msgid "Allow document recipients to reply directly to this email address"msgstr "Allow document recipients to reply directly to this email address"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -1153,6 +1219,7 @@ msgstr "Allow signers to dictate next signer"msgid "Allowed Email Domains"msgstr "Allowed Email Domains"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -1200,6 +1267,8 @@ msgstr "An email with this address already exists."#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx#: apps/remix/app/components/forms/token.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/reset-password.tsx@@ -1381,7 +1450,8 @@ msgstr "An error occurred while updating the signature."msgid "An error occurred while updating your profile."msgstr "An error occurred while updating your profile."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "An error occurred while uploading your document."msgstr "An error occurred while uploading your document."@@ -1405,6 +1475,7 @@ msgstr "An unexpected error occurred."#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/admin+/site-settings.tsx#: apps/remix/app/components/general/app-command-menu.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/signup.tsx@@ -1441,6 +1512,7 @@ msgstr "An unexpected error occurred."#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/account-delete-dialog.tsx@@ -1482,11 +1554,6 @@ msgstr "API Tokens"msgid "App Version"msgstr "App Version"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Approve"-msgstr "Approve"-#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-button.tsx@@ -1496,20 +1563,28 @@ msgstr "Approve"msgid "Approve"msgstr "Approve"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Approve"+msgstr "Approve"++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Approve Document"msgstr "Approve Document"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsxmsgid "Approved"msgstr "Approved"-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"msgid "Approved"msgstr "Approved"+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "Approver"+msgstr "Approver"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Approver"@@ -1571,6 +1646,7 @@ msgstr "Are you sure you wish to delete this team?"#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Are you sure?"msgstr "Are you sure?"@@ -1584,8 +1660,7 @@ msgctxt "Recipient role action verb"msgid "Assist"msgstr "Assist"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Assist Document"msgstr "Assist Document"@@ -1611,12 +1686,12 @@ msgstr "Assistants"msgid "Assistants and Copy roles are currently not compatible with the multi-sign experience."msgstr "Assistants and Copy roles are currently not compatible with the multi-sign experience."-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsxmsgid "Assisted"msgstr "Assisted"-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"msgid "Assisted"msgstr "Assisted"@@ -1625,6 +1700,7 @@ msgctxt "Recipient role progressive verb"msgid "Assisting"msgstr "Assisting"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx#: packages/ui/primitives/template-flow/add-template-settings.types.tsx#: packages/ui/primitives/document-flow/add-settings.types.ts@@ -1657,6 +1733,10 @@ msgstr "Authentication Portal Not Found"msgid "Authentication required"msgstr "Authentication required"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Authenticator app"+msgstr "Authenticator app"+#: apps/remix/app/components/forms/avatar-image.tsxmsgid "Avatar"msgstr "Avatar"@@ -1686,6 +1766,10 @@ msgstr "Back home"msgid "Background Color"msgstr "Background Color"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Background Jobs"+msgstr "Background Jobs"+#: apps/remix/app/components/forms/signin.tsx#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Backup Code"@@ -1823,6 +1907,7 @@ msgstr "Can prepare"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/general/teams/team-email-usage.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -1861,6 +1946,13 @@ msgstr "Can prepare"#: apps/remix/app/components/dialogs/team-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: apps/remix/app/components/dialogs/session-logout-all-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/passkey-create-dialog.tsx@@ -1883,6 +1975,10 @@ msgstr "Can prepare"#: apps/remix/app/components/dialogs/folder-move-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -1906,10 +2002,15 @@ msgstr "Cancelled by user"msgid "Cannot remove document"msgstr "Cannot remove document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Cannot remove signer"msgstr "Cannot remove signer"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Cannot upload items after the document has been sent"+msgstr "Cannot upload items after the document has been sent"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Cc"@@ -1935,6 +2036,11 @@ msgctxt "Recipient role plural name"msgid "Ccers"msgstr "Ccers"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Center"+msgstr "Center"++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Character Limit"msgstr "Character Limit"@@ -1943,10 +2049,16 @@ msgstr "Character Limit"msgid "Charts"msgstr "Charts"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Checkbox"msgstr "Checkbox"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Checkbox Settings"+msgstr "Checkbox Settings"++#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Checkbox values"msgstr "Checkbox values"@@ -1973,6 +2085,10 @@ msgstr "Choose how the document will reach recipients"msgid "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."msgstr "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Choose verification method"+msgstr "Choose verification method"+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Choose your preferred authentication method:"msgstr "Choose your preferred authentication method:"@@ -2020,6 +2136,7 @@ msgstr "Click here to upload"msgid "Click to copy signing link for sending to recipient"msgstr "Click to copy signing link for sending to recipient"+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx#: apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -2059,6 +2176,8 @@ msgstr "Client secret is required"#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Close"msgstr "Close"@@ -2098,7 +2217,7 @@ msgstr "Complete Document"msgid "Complete Signing"msgstr "Complete Signing"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Complete the fields for the following signers."msgstr "Complete the fields for the following signers."@@ -2107,8 +2226,10 @@ msgstr "Complete the fields for the following signers."msgid "Complete Viewing"msgstr "Complete Viewing"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx#: packages/lib/constants/document.ts@@ -2152,6 +2273,14 @@ msgstr "Configure Direct Recipient"msgid "Configure Document"msgstr "Configure Document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure document settings and options before sending."+msgstr "Configure document settings and options before sending."++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure email settings for the document"+msgstr "Configure email settings for the document"+#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -2166,6 +2295,10 @@ msgstr "Configure general settings for the document."msgid "Configure general settings for the template."msgstr "Configure general settings for the template."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure security settings for the document"+msgstr "Configure security settings for the document"+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Configure template"msgstr "Configure template"@@ -2300,6 +2433,7 @@ msgstr "Controls the default visibility of an uploaded document."msgid "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."msgstr "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."msgstr "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."@@ -2317,6 +2451,7 @@ msgid "Controls which signatures are allowed to be used when signing a document.msgstr "Controls which signatures are allowed to be used when signing a document."#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copied"msgstr "Copied"@@ -2334,12 +2469,14 @@ msgstr "Copied"#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/components/document/document-share-button.tsxmsgid "Copied to clipboard"msgstr "Copied to clipboard"#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copy"msgstr "Copy"@@ -2440,7 +2577,7 @@ msgstr "Create claim"msgid "Create Claim"msgstr "Create Claim"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Create Direct Link"msgstr "Create Direct Link"@@ -2640,6 +2777,7 @@ msgid "Dashboard"msgstr "Dashboard"#: apps/remix/app/components/tables/settings-security-activity-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-date-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -2651,12 +2789,17 @@ msgstr "Date"msgid "Date created"msgstr "Date created"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Date Format"msgstr "Date Format"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Date Settings"+msgstr "Date Settings"+#: apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: packages/email/templates/organisation-invite.tsx@@ -2695,6 +2838,10 @@ msgstr "Default Signature Settings"msgid "Default Time Zone"msgstr "Default Time Zone"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Default Value"+msgstr "Default Value"+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "delete"msgstr "delete"@@ -2726,6 +2873,7 @@ msgstr "delete"#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/claim-delete-dialog.tsxmsgid "Delete"@@ -2765,6 +2913,7 @@ msgstr "Delete Account"msgid "Delete document"msgstr "Delete document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -2816,6 +2965,10 @@ msgstr "Delete team"msgid "Delete team group"msgstr "Delete team group"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Delete Template"+msgstr "Delete Template"+#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Delete the document. This action is irreversible so proceed with caution."msgstr "Delete the document. This action is irreversible so proceed with caution."@@ -2867,6 +3020,7 @@ msgstr "Direct link"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsxmsgid "Direct Link"msgstr "Direct Link"@@ -2904,6 +3058,7 @@ msgstr "Direct template link deleted"msgid "Direct template link usage exceeded ({0}/{1})"msgstr "Direct template link usage exceeded ({0}/{1})"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Direction"msgstr "Direction"@@ -2997,22 +3152,27 @@ msgstr "Documenso will delete <0>all of your documents</0>, along with all of yomsgid "Document"msgstr "Document"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#. placeholder {1}: recipient.name#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejected by {1}"msgstr "Document \"{0}\" - Rejected by {1}"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejection Confirmed"msgstr "Document \"{0}\" - Rejection Confirmed"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsmsgid "Document \"{0}\" Cancelled"msgstr "Document \"{0}\" Cancelled"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document & Recipients"+msgstr "Document & Recipients"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/document/document-global-auth-access-select.tsx@@ -3033,18 +3193,19 @@ msgid "Document Approved"msgstr "Document Approved"#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx-#: packages/lib/server-only/document/super-delete-document.ts+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: packages/lib/server-only/document/delete-document.ts+#: packages/lib/server-only/admin/admin-super-delete-document.tsmsgid "Document Cancelled"msgstr "Document Cancelled"-#: packages/lib/utils/document-audit-logs.ts-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"+#: apps/remix/app/components/general/document/document-status.tsxmsgid "Document completed"msgstr "Document completed"-#: apps/remix/app/components/general/document/document-status.tsx+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"msgid "Document completed"msgstr "Document completed"@@ -3057,12 +3218,12 @@ msgstr "Document completed email"msgid "Document Completed!"msgstr "Document Completed!"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"+#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Document created"msgstr "Document created"-#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"msgid "Document created"msgstr "Document created"@@ -3088,17 +3249,17 @@ msgstr "Document created using a <0>direct link</0>"msgid "Document Creation"msgstr "Document Creation"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"-msgid "Document deleted"-msgstr "Document deleted"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Document deleted"msgstr "Document deleted"+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"+msgid "Document deleted"+msgstr "Document deleted"+#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document deleted email"msgstr "Document deleted email"@@ -3107,6 +3268,8 @@ msgstr "Document deleted email"msgid "Document Deleted!"msgstr "Document Deleted!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Document Distribution Method"@@ -3120,6 +3283,10 @@ msgstr "Document draft"msgid "Document Duplicated"msgstr "Document Duplicated"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Editor"+msgstr "Document Editor"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document external ID updated"@@ -3129,7 +3296,6 @@ msgstr "Document external ID updated"msgid "Document found in your account"msgstr "Document found in your account"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Document ID"msgstr "Document ID"@@ -3205,18 +3371,18 @@ msgstr "Document rejected"msgid "Document Rejected"msgstr "Document Rejected"-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx-msgid "Document resealed"-msgstr "Document resealed"+#: apps/remix/app/components/general/document/document-edit-form.tsx+msgid "Document sent"+msgstr "Document sent"#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document sent"msgstr "Document sent"-#: apps/remix/app/components/general/document/document-edit-form.tsx-msgid "Document sent"-msgstr "Document sent"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Settings"+msgstr "Document Settings"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Document Signed"@@ -3239,6 +3405,10 @@ msgstr "Document status"msgid "Document title"msgstr "Document title"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Document Title"+msgstr "Document Title"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document title updated"@@ -3253,11 +3423,13 @@ msgstr "Document updated"msgid "Document updated successfully"msgstr "Document updated successfully"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Document upload disabled due to unpaid invoices"msgstr "Document upload disabled due to unpaid invoices"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Document uploaded"msgstr "Document uploaded"@@ -3271,6 +3443,10 @@ msgstr "Document viewed"msgid "Document Viewed"msgstr "Document Viewed"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Document visibility"+msgstr "Document visibility"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document visibility updated"@@ -3286,7 +3462,7 @@ msgstr "Documentation"#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/_layout.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -3358,15 +3534,21 @@ msgid "Download Certificate"msgstr "Download Certificate"#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsxmsgid "Download Original"msgstr "Download Original"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Download PDF"+msgstr "Download PDF"+#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Download Template CSV"msgstr "Download Template CSV"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: packages/lib/constants/document.tsmsgid "Draft"@@ -3393,12 +3575,12 @@ msgstr "Drag and drop or click to upload"msgid "Drag and drop your PDF file here"msgstr "Drag and drop your PDF file here"-#: packages/lib/constants/document.ts-msgctxt "Draw signatute type"+#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Draw"msgstr "Draw"-#: packages/ui/primitives/signature-pad/signature-pad.tsx+#: packages/lib/constants/document.ts+msgctxt "Draw signatute type"msgid "Draw"msgstr "Draw"@@ -3406,29 +3588,55 @@ msgstr "Draw"msgid "Drop your document here"msgstr "Drop your document here"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "Dropdown"msgstr "Dropdown"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown must have at least one option"+msgstr "Dropdown must have at least one option"+#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Dropdown options"msgstr "Dropdown options"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Dropdown Settings"+msgstr "Dropdown Settings"++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown values"+msgstr "Dropdown values"+#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsx#: apps/remix/app/components/dialogs/template-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate"msgstr "Duplicate"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Document"+msgstr "Duplicate Document"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate on all pages"msgstr "Duplicate on all pages"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Template"+msgstr "Duplicate Template"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks._index.tsx#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx@@ -3466,6 +3674,10 @@ msgstr "Electronic Signature Disclosure"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-email-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/general/direct-template/direct-template-configure-form.tsx@@ -3543,6 +3755,10 @@ msgstr "Email Domains"msgid "Email domains synced"msgstr "Email domains synced"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Email is required"+msgstr "Email is required"+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Email Options"msgstr "Email Options"@@ -3562,6 +3778,8 @@ msgstr "Email preferences updated"msgid "Email resent"msgstr "Email resent"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Email Sender"@@ -3575,6 +3793,14 @@ msgstr "Email sent"msgid "Email sent!"msgstr "Email sent!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Email Settings"+msgstr "Email Settings"++#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Email verification"+msgstr "Email verification"+#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsxmsgid "Email verification has been removed"msgstr "Email verification has been removed"@@ -3639,6 +3865,7 @@ msgstr "Enable custom branding for all documents in this team"msgid "Enable Direct Link Signing"msgstr "Enable Direct Link Signing"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -3676,6 +3903,10 @@ msgstr "Enter claim name"msgid "Enter the domain you want to use for sending emails (without http:// or www)"msgstr "Enter the domain you want to use for sending emails (without http:// or www)"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Enter verification code"+msgstr "Enter verification code"+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your 2FA code"msgstr "Enter your 2FA code"@@ -3696,11 +3927,16 @@ msgstr "Enter your email address to receive the completed document."msgid "Enter your name"msgstr "Enter your name"+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Enter your number here"+msgstr "Enter your number here"+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your password"msgstr "Enter your password"#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsxmsgid "Enter your text here"msgstr "Enter your text here"@@ -3708,6 +3944,34 @@ msgstr "Enter your text here"msgid "Enterprise"msgstr "Enterprise"+#: packages/ui/primitives/document-upload.tsx+msgid "Envelope (beta)"+msgstr "Envelope (beta)"++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Envelope distributed"+msgstr "Envelope distributed"++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Envelope Duplicated"+msgstr "Envelope Duplicated"++#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+msgid "Envelope ID"+msgstr "Envelope ID"++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Envelope resent"+msgstr "Envelope resent"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Envelope Title"+msgstr "Envelope Title"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Envelope updated"+msgstr "Envelope updated"+#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -3748,7 +4012,8 @@ msgstr "Enterprise"#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsx-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx@@ -3809,11 +4074,17 @@ msgstr "Exceeded timeout"msgid "Expired"msgstr "Expired"+#. placeholder {0}: DateTime.fromMillis(Math.max(millisecondsRemaining, 0)).toFormat( 'mm:ss', )+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Expires in {0}"+msgstr "Expires in {0}"+#. placeholder {0}: i18n.date(token.expires, DateTime.DATETIME_FULL)#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Expires on {0}"msgstr "Expires on {0}"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "External ID"@@ -3897,10 +4168,12 @@ msgstr "Failed: {failedCount}"msgid "Feature Flags"msgstr "Feature Flags"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field character limit"msgstr "Field character limit"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -3910,16 +4183,20 @@ msgstr "Field character limit"msgid "Field font size"msgstr "Field font size"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Field format"msgstr "Field format"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Field label"msgstr "Field label"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field placeholder"msgstr "Field placeholder"@@ -3947,7 +4224,8 @@ msgstr "Fields"msgid "Fields updated"msgstr "Fields updated"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"msgstr "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"@@ -4005,6 +4283,7 @@ msgstr "Folder Settings"msgid "Folder updated successfully"msgstr "Folder updated successfully"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -4044,6 +4323,11 @@ msgstr "Free"msgid "Free Signature"msgstr "Free Signature"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Free Signature Settings"+msgstr "Free Signature Settings"++#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -4059,6 +4343,7 @@ msgstr "Full Name"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-page.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx@@ -4069,6 +4354,7 @@ msgstr "General"msgid "Generate DKIM Records"msgstr "Generate DKIM Records"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Generate Links"msgstr "Generate Links"@@ -4080,7 +4366,9 @@ msgstr "Global recipient action authentication"#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsxmsgid "Go back"@@ -4089,7 +4377,9 @@ msgstr "Go back"#: apps/remix/app/routes/_recipient+/_layout.tsx#: apps/remix/app/routes/_profile+/_layout.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: packages/ui/primitives/document-flow/document-flow-root.tsxmsgid "Go Back"@@ -4104,10 +4394,12 @@ msgstr "Go back home"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Go Back Home"msgstr "Go Back Home"#: apps/remix/app/routes/_authenticated+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxmsgid "Go home"msgstr "Go home"@@ -4158,22 +4450,25 @@ msgstr "Group Name"msgid "Groups"msgstr "Groups"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to approve this document"msgstr "has invited you to approve this document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to assist this document"msgstr "has invited you to assist this document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to sign this document"msgstr "has invited you to sign this document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to view this document"msgstr "has invited you to view this document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -4243,6 +4538,10 @@ msgstr "Hey I’m Timur"msgid "Hi {userName},"msgstr "Hi {userName},"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+msgstr "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+#: packages/email/templates/reset-password.tsxmsgid "Hi, {userName} <0>({userEmail})</0>"msgstr "Hi, {userName} <0>({userEmail})</0>"@@ -4264,6 +4563,7 @@ msgstr "Home"msgid "Home (No Folder)"msgstr "Home (No Folder)"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Horizontal"msgstr "Horizontal"@@ -4317,6 +4617,10 @@ msgstr "ID copied to clipboard"msgid "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."msgstr "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "If you didn't request this verification code, you can safely ignore this email."+msgstr "If you didn't request this verification code, you can safely ignore this email."+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."msgstr "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."@@ -4383,11 +4687,29 @@ msgstr "Inherit organisation members"msgid "Inherited subscription claim"msgstr "Inherited subscription claim"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-initials-field.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Initials"msgstr "Initials"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Initials are required"+msgstr "Initials are required"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Initials Settings"+msgstr "Initials Settings"++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Insert a value into the number field"+msgstr "Insert a value into the number field"++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Insert a value into the text field"+msgstr "Insert a value into the text field"+#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsxmsgid "Inserted"msgstr "Inserted"@@ -4404,6 +4726,7 @@ msgstr "Invalid code. Please try again."msgid "Invalid domains"msgstr "Invalid domains"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.types.tsmsgid "Invalid email"msgstr "Invalid email"@@ -4526,6 +4849,8 @@ msgstr "Join our community on <0>Discord</0> for community support and discussiomsgid "Joined {0}"msgstr "Joined {0}"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -4536,6 +4861,7 @@ msgstr "Label"#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -4563,6 +4889,10 @@ msgstr "Last Active"msgid "Last modified"msgstr "Last modified"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Last Retried"+msgstr "Last Retried"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Last updated"msgstr "Last updated"@@ -4599,6 +4929,10 @@ msgstr "Leave blank to inherit from the organisation."msgid "Leave organisation"msgstr "Leave organisation"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Left"+msgstr "Left"+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "Legality of Electronic Signatures"msgstr "Legality of Electronic Signatures"@@ -4649,9 +4983,16 @@ msgstr "Listening to {0}"msgid "Load older activity"msgstr "Load older activity"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Loading"+msgstr "Loading"+#: apps/remix/app/components/general/skeletons/document-edit-skeleton.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Loading document..."msgstr "Loading document..."@@ -4717,7 +5058,7 @@ msgstr "Manage Billing"msgid "Manage details for this public template"msgstr "Manage details for this public template"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Manage Direct Link"msgstr "Manage Direct Link"@@ -4842,6 +5183,7 @@ msgstr "MAU (had document completed)"msgid "MAU (signed in)"msgstr "MAU (signed in)"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Max"msgstr "Max"@@ -4883,7 +5225,9 @@ msgstr "Member Since"msgid "Members"msgstr "Members"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Message"@@ -4893,6 +5237,7 @@ msgstr "Message"msgid "Message <0>(Optional)</0>"msgstr "Message <0>(Optional)</0>"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Min"msgstr "Min"@@ -4965,9 +5310,13 @@ msgstr "N/A"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/admin-leaderboard-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/forms/subscription-claim-form.tsx@@ -4990,9 +5339,14 @@ msgid "Name"msgstr "Name"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsxmsgid "Name is required"msgstr "Name is required"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Name Settings"+msgstr "Name Settings"+#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Need to sign documents?"msgstr "Need to sign documents?"@@ -5050,6 +5404,12 @@ msgstr "No"msgid "No active drafts"msgstr "No active drafts"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "No documents found"+msgstr "No documents found"+#: apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxmsgid "No folders found"@@ -5089,6 +5449,7 @@ msgstr "No recipient matching this description was found."#: apps/remix/app/components/general/template/template-page-view-recipients.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "No recipients"msgstr "No recipients"@@ -5150,11 +5511,18 @@ msgid "No worries, it happens! Enter your email and we'll email you a special limsgstr "No worries, it happens! Enter your email and we'll email you a special link to reset your password."#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/lib/constants/document.tsmsgid "None"msgstr "None"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Not found"+msgstr "Not found"+#: apps/remix/app/components/forms/signin.tsxmsgid "Not supported"msgstr "Not supported"@@ -5164,6 +5532,7 @@ msgstr "Not supported"msgid "Nothing to do"msgstr "Nothing to do"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-number-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -5171,6 +5540,7 @@ msgstr "Nothing to do"msgid "Number"msgstr "Number"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Number format"msgstr "Number format"@@ -5185,23 +5555,27 @@ msgstr "Number of members allowed. 0 = Unlimited"msgid "Number of teams allowed. 0 = Unlimited"msgstr "Number of teams allowed. 0 = Unlimited"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Number Settings"+msgstr "Number Settings"+#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to approve this document"msgstr "on behalf of \"{0}\" has invited you to approve this document"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to assist this document"msgstr "on behalf of \"{0}\" has invited you to assist this document"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to sign this document"msgstr "on behalf of \"{0}\" has invited you to sign this document"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to view this document"msgstr "on behalf of \"{0}\" has invited you to view this document"@@ -5264,6 +5638,8 @@ msgid "Only PDF files are allowed"msgstr "Only PDF files are allowed"#: apps/remix/app/routes/_profile+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsxmsgid "Oops! Something went wrong."@@ -5273,6 +5649,14 @@ msgstr "Oops! Something went wrong."msgid "Opened"msgstr "Opened"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Option is required"+msgstr "Option is required"++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Option value cannot be empty"+msgstr "Option value cannot be empty"+#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Or"@@ -5439,6 +5823,7 @@ msgstr "Page {0} of {1}"#. placeholder {0}: i + 1#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Page {0} of {numPages}"msgstr "Page {0} of {numPages}"@@ -5527,6 +5912,7 @@ msgstr "Payment overdue"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/components/tables/organisation-email-domains-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsx@@ -5576,6 +5962,7 @@ msgstr "Personal Account"msgid "Personal Inbox"msgstr "Personal Inbox"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Pick a number"msgstr "Pick a number"@@ -5592,6 +5979,13 @@ msgstr "Pick any of the following agreements below and start signing to get starmsgid "Pin"msgstr "Pin"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Place and configure form fields in the document"+msgstr "Place and configure form fields in the document"++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -5666,7 +6060,11 @@ msgstr "Please enter a meaningful name for your token. This will help you identimsgid "Please enter a valid name."msgstr "Please enter a valid name."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Please enter a valid number"+msgstr "Please enter a valid number"++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please mark as viewed to complete."msgstr "Please mark as viewed to complete."@@ -5702,6 +6100,10 @@ msgstr "Please note that this action is irreversible. Once confirmed, your webhomsgid "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"msgstr "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please open your authenticator app and enter the 6-digit code for this document."+msgstr "Please open your authenticator app and enter the 6-digit code for this document."+#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."msgstr "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."@@ -5710,11 +6112,11 @@ msgstr "Please provide a token from the authenticator, or a backup code. If youmsgid "Please provide a token from your authenticator, or a backup code."msgstr "Please provide a token from your authenticator, or a backup code."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before approving."msgstr "Please review the document before approving."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before signing."msgstr "Please review the document before signing."@@ -5722,6 +6124,10 @@ msgstr "Please review the document before signing."msgid "Please select a PDF file"msgstr "Please select a PDF file"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please select how you'd like to receive your verification code."+msgstr "Please select how you'd like to receive your verification code."+#: apps/remix/app/components/dialogs/organisation-email-domain-create-dialog.tsxmsgid "Please try a different domain."msgstr "Please try a different domain."@@ -5737,6 +6143,8 @@ msgstr "Please try again later."#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Please try again or contact our support."msgstr "Please try again or contact our support."@@ -5750,6 +6158,11 @@ msgstr "Please type {0} to confirm"msgid "Please type <0>{0}</0> to confirm."msgstr "Please type <0>{0}</0> to confirm."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Please upload a document to continue"+msgstr "Please upload a document to continue"+#: apps/remix/app/components/forms/branding-preferences-form.tsxmsgid "Please upload a logo"msgstr "Please upload a logo"@@ -5765,6 +6178,7 @@ msgstr "Pre-formatted CSV template with example data."msgid "Preferences"msgstr "Preferences"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/forms/document-preferences-form.tsxmsgid "Preview"msgstr "Preview"@@ -5773,11 +6187,29 @@ msgstr "Preview"msgid "Preview and configure template."msgstr "Preview and configure template."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview Mode"+msgstr "Preview Mode"++#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Preview the document before sending"+msgstr "Preview the document before sending"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview what the signed document will look like with placeholder data"+msgstr "Preview what the signed document will look like with placeholder data"+#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/general/template/template-type.tsxmsgid "Private"msgstr "Private"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Private Template"+msgstr "Private Template"+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Private templates can only be modified and viewed by you."msgstr "Private templates can only be modified and viewed by you."@@ -5838,14 +6270,28 @@ msgstr "Public Profile"msgid "Public profile URL"msgstr "Public profile URL"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Public Template"+msgstr "Public Template"+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."msgstr "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Quick Actions"+msgstr "Quick Actions"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Radio"msgstr "Radio"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Radio Settings"+msgstr "Radio Settings"++#: apps/remix/app/components/forms/editor/editor-field-radio-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsxmsgid "Radio values"msgstr "Radio values"@@ -5858,6 +6304,10 @@ msgstr "Radio values"msgid "Read only"msgstr "Read only"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Read Only"+msgstr "Read Only"+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.support.tsxmsgid "Read our documentation to get started with Documenso."msgstr "Read our documentation to get started with Documenso."@@ -5913,9 +6363,13 @@ msgstr "Recent documents"#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsx#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.tsmsgid "Recipient"msgstr "Recipient"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/recipient/recipient-action-auth-select.tsx@@ -5950,6 +6404,10 @@ msgstr "Recipients"msgid "Recipients metrics"msgstr "Recipients metrics"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Recipients will be able to sign the document once sent"+msgstr "Recipients will be able to sign the document once sent"+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Recipients will still retain their copy of the document"msgstr "Recipients will still retain their copy of the document"@@ -5982,12 +6440,17 @@ msgstr "Red"msgid "Redirect URI"msgstr "Redirect URI"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Redirect URL"msgstr "Redirect URL"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+msgid "Redirecting"+msgstr "Redirecting"+#: apps/remix/app/components/general/claim-account.tsx#: apps/remix/app/components/forms/signup.tsxmsgid "Registration Successful"@@ -5996,12 +6459,13 @@ msgstr "Registration Successful"#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Reject Document"msgstr "Reject Document"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx@@ -6017,16 +6481,21 @@ msgstr "Rejection Confirmed"msgid "Rejection reason: {reason}"msgstr "Rejection reason: {reason}"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Reload"+msgstr "Reload"+#: apps/remix/app/routes/_unauthenticated+/forgot-password.tsxmsgid "Remembered your password? <0>Sign In</0>"msgstr "Remembered your password? <0>Sign In</0>"-#. placeholder {0}: customEmail.subject+#. placeholder {0}: envelope.documentMeta.subject#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0}"msgstr "Reminder: {0}"-#. placeholder {0}: document.team.name+#. placeholder {0}: envelope.team.name#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0} invited you to {recipientActionVerb} a document"msgstr "Reminder: {0} invited you to {recipientActionVerb} a document"@@ -6046,6 +6515,7 @@ msgstr "Reminder: Please {recipientActionVerb} your document"#: apps/remix/app/components/tables/organisation-members-table.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx#: apps/remix/app/components/general/teams/team-email-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document-signing/document-signing-field-container.tsx#: apps/remix/app/components/forms/branding-preferences-form.tsx#: apps/remix/app/components/forms/avatar-image.tsx@@ -6090,6 +6560,8 @@ msgstr "Repeat Password"msgid "Reply to email"msgstr "Reply to email"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Reply To Email"@@ -6107,6 +6579,10 @@ msgstr "Requesting Organisation"msgid "Required field"msgstr "Required field"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Required Field"+msgstr "Required Field"+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "Required scopes"msgstr "Required scopes"@@ -6121,10 +6597,20 @@ msgstr "Reseal document"msgid "Resend"msgstr "Resend"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Resend code"+msgstr "Resend code"+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Resend Confirmation Email"msgstr "Resend Confirmation Email"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Resend Document"+msgstr "Resend Document"+#: apps/remix/app/components/general/teams/team-email-dropdown.tsxmsgid "Resend verification"msgstr "Resend verification"@@ -6183,6 +6669,10 @@ msgstr "Restricted Access"msgid "Retention of Documents"msgstr "Retention of Documents"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Retried"+msgstr "Retried"+#: apps/remix/app/components/general/document-signing/document-signing-auth-passkey.tsxmsgid "Retry"msgstr "Retry"@@ -6191,6 +6681,7 @@ msgstr "Retry"#: apps/remix/app/routes/_unauthenticated+/organisation.invite.$token.tsx#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsx#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Return"msgstr "Return"@@ -6198,6 +6689,10 @@ msgstr "Return"msgid "Return to Documenso sign in page here"msgstr "Return to Documenso sign in page here"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to documents"+msgstr "Return to documents"+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "Return to Home"msgstr "Return to Home"@@ -6207,6 +6702,10 @@ msgstr "Return to Home"msgid "Return to sign in"msgstr "Return to sign in"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to templates"+msgstr "Return to templates"+#: packages/email/templates/organisation-account-link-confirmation.tsxmsgid "Review request"msgstr "Review request"@@ -6226,6 +6725,10 @@ msgstr "Revoke access"msgid "Revoke all sessions"msgstr "Revoke all sessions"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Right"+msgstr "Right"+#: apps/remix/app/components/tables/user-organisations-table.tsx#: apps/remix/app/components/tables/team-members-table.tsx#: apps/remix/app/components/tables/team-groups-table.tsx@@ -6258,10 +6761,20 @@ msgstr "Rows per page"msgid "Save"msgstr "Save"+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "Save failed"+msgstr "Save failed"+#: packages/ui/primitives/template-flow/add-template-fields.tsxmsgid "Save Template"msgstr "Save Template"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "Sealing job started"+msgstr "Sealing job started"+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.members.tsx@@ -6315,6 +6828,7 @@ msgstr "Secret"#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsx#: apps/remix/app/components/general/settings-nav-mobile.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Security"msgstr "Security"@@ -6322,6 +6836,10 @@ msgstr "Security"msgid "Security activity"msgstr "Security activity"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "See the background jobs tab for the status"+msgstr "See the background jobs tab for the status"+#: apps/remix/app/components/general/document-signing/document-signing-dropdown-field.tsx#: packages/ui/primitives/document-flow/types.ts#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsx@@ -6360,10 +6878,15 @@ msgstr "Select a template you'd like to display on your team's public profile"msgid "Select a time zone"msgstr "Select a time zone"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Select a value to sign into the field"+msgstr "Select a value to sign into the field"+#: packages/ui/components/document/document-global-auth-access-select.tsxmsgid "Select access methods"msgstr "Select access methods"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: packages/ui/primitives/combobox.tsxmsgid "Select an option"msgstr "Select an option"@@ -6372,6 +6895,7 @@ msgstr "Select an option"msgid "Select an organisation to view teams"msgstr "Select an organisation to view teams"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select at least"msgstr "Select at least"@@ -6381,6 +6905,7 @@ msgstr "Select at least"msgid "Select authentication methods"msgstr "Select authentication methods"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Select default option"msgstr "Select default option"@@ -6389,6 +6914,7 @@ msgstr "Select default option"msgid "Select default role"msgstr "Select default role"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select direction"msgstr "Select direction"@@ -6427,6 +6953,10 @@ msgstr "Select passkey"msgid "Select signature types"msgstr "Select signature types"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Select text align"+msgstr "Select text align"+#: apps/remix/app/components/dialogs/organisation-group-create-dialog.tsxmsgid "Select the members to add to this group"msgstr "Select the members to add to this group"@@ -6444,6 +6974,12 @@ msgstr "Select triggers"msgid "Select visibility"msgstr "Select visibility"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Selected Recipient"+msgstr "Selected Recipient"++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -6464,6 +7000,9 @@ msgstr "Send confirmation email"msgid "Send document"msgstr "Send document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsxmsgid "Send Document"msgstr "Send Document"@@ -6508,10 +7047,15 @@ msgstr "Send recipient signed email"msgid "Send recipient signing request email"msgstr "Send recipient signing request email"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsxmsgid "Send reminder"msgstr "Send reminder"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Send reminders to the following recipients"+msgstr "Send reminders to the following recipients"+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "Send Test Webhook"msgstr "Send Test Webhook"@@ -6562,6 +7106,7 @@ msgstr "Set up your template properties and recipient information"#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/folder/folder-card.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Settings"msgstr "Settings"@@ -6595,6 +7140,7 @@ msgstr "Share your signing experience!"msgid "Show"msgstr "Show"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Show advanced settings"@@ -6604,11 +7150,6 @@ msgstr "Show advanced settings"msgid "Show templates in your public profile for your audience to sign and get started quickly"msgstr "Show templates in your public profile for your audience to sign and get started quickly"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Sign"-msgstr "Sign"-#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -6622,6 +7163,18 @@ msgstr "Sign"#: apps/remix/app/components/general/document-signing/document-signing-auth-password.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-2fa.tsx#: apps/remix/app/components/general/document/document-page-view-button.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign"+msgstr "Sign"++#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"msgid "Sign"msgstr "Sign"@@ -6643,8 +7196,8 @@ msgstr "Sign as<0>{0} <1>({1})</1></0>"msgid "Sign document"msgstr "Sign document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Sign Document"msgstr "Sign Document"@@ -6652,6 +7205,14 @@ msgstr "Sign Document"msgid "Sign Documents"msgstr "Sign Documents"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign Dropdown Field"+msgstr "Sign Dropdown Field"++#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign Email"+msgstr "Sign Email"+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Sign field"@@ -6674,12 +7235,32 @@ msgstr "Sign In"msgid "Sign in to your account"msgstr "Sign in to your account"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign Initials"+msgstr "Sign Initials"++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign Name"+msgstr "Sign Name"++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Sign Number Field"+msgstr "Sign Number Field"+#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx#: apps/remix/app/components/general/app-nav-mobile.tsxmsgid "Sign Out"msgstr "Sign Out"+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+msgid "Sign Signature Field"+msgstr "Sign Signature Field"++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Sign Text Field"+msgstr "Sign Text Field"+#: apps/remix/app/components/embed/embed-document-signing-page.tsx#: apps/remix/app/components/embed/embed-direct-template-client-page.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -6698,8 +7279,22 @@ msgstr "Sign Up with Google"msgid "Sign Up with OIDC"msgstr "Sign Up with OIDC"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign your email into the field"+msgstr "Sign your email into the field"++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign your full name into the field"+msgstr "Sign your full name into the field"++#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign your initials into the field"+msgstr "Sign your initials into the field"+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -6725,6 +7320,10 @@ msgstr "Signature is too small"msgid "Signature Pad cannot be empty."msgstr "Signature Pad cannot be empty."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Signature Settings"+msgstr "Signature Settings"+#: packages/ui/components/document/document-signature-settings-tooltip.tsxmsgid "Signature types"msgstr "Signature types"@@ -6737,17 +7336,17 @@ msgstr "Signatures Collected"msgid "Signatures will appear once the document has been completed"msgstr "Signatures will appear once the document has been completed"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Signed"-msgstr "Signed"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsxmsgid "Signed"msgstr "Signed"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Signed"+msgstr "Signed"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Signer"@@ -6798,6 +7397,7 @@ msgstr "Signing Links"msgid "Signing links have been generated for this document."msgstr "Signing links have been generated for this document."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Signing order is enabled."@@ -6826,6 +7426,7 @@ msgstr "Site Banner"msgid "Site Settings"msgstr "Site Settings"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."msgstr "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."@@ -6874,6 +7475,9 @@ msgstr "Some signers have not been assigned a signature field. Please assign at#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-member-invite-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx@@ -6888,6 +7492,8 @@ msgstr "Something went wrong while attempting to verify your email address for <#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Something went wrong while loading the document."msgstr "Something went wrong while loading the document."@@ -6903,6 +7509,10 @@ msgstr "Something went wrong while sending the confirmation email."msgid "Something went wrong while updating the team billing subscription, please contact support."msgstr "Something went wrong while updating the team billing subscription, please contact support."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Something went wrong while uploading this file"+msgstr "Something went wrong while uploading this file"+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.email.tsx@@ -6955,6 +7565,7 @@ msgstr "Stats"#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table.tsx#: apps/remix/app/components/tables/admin-organisations-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsxmsgid "Status"msgstr "Status"@@ -6976,10 +7587,12 @@ msgid "Stripe Customer ID"msgstr "Stripe Customer ID"#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Subject"msgstr "Subject"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Subject <0>(Optional)</0>"@@ -6989,6 +7602,10 @@ msgstr "Subject <0>(Optional)</0>"msgid "Submit"msgstr "Submit"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Submitted"+msgstr "Submitted"+#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx@@ -7028,7 +7645,6 @@ msgstr "Subscription invalid"#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx@@ -7038,6 +7654,7 @@ msgstr "Subscription invalid"#: apps/remix/app/components/general/teams/team-email-dropdown.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/organisation-update-form.tsx@@ -7069,6 +7686,7 @@ msgstr "Subscription invalid"#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsxmsgid "Success"msgstr "Success"@@ -7102,6 +7720,10 @@ msgstr "Sync"msgid "Sync Email Domains"msgstr "Sync Email Domains"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Sync failed, changes not saved"+msgstr "Sync failed, changes not saved"+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "System Requirements"msgstr "System Requirements"@@ -7254,7 +7876,7 @@ msgstr "Teams help you organise your work and collaborate with others. Create yomsgid "Teams that this organisation group is currently assigned to"msgstr "Teams that this organisation group is currently assigned to"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx@@ -7280,6 +7902,10 @@ msgstr "Template document uploaded"msgid "Template duplicated"msgstr "Template duplicated"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Editor"+msgstr "Template Editor"+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Template has been removed from your public profile."msgstr "Template has been removed from your public profile."@@ -7300,6 +7926,10 @@ msgstr "Template moved"msgid "Template saved"msgstr "Template saved"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Settings"+msgstr "Template Settings"+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Template title"msgstr "Template title"@@ -7309,6 +7939,7 @@ msgid "Template updated successfully"msgstr "Template updated successfully"#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsxmsgid "Template uploaded"msgstr "Template uploaded"@@ -7339,6 +7970,7 @@ msgstr "Test webhook failed"msgid "Test webhook sent"msgstr "Test webhook sent"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx@@ -7347,6 +7979,7 @@ msgstr "Test webhook sent"msgid "Text"msgstr "Text"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -7360,6 +7993,14 @@ msgstr "Text Align"msgid "Text Color"msgstr "Text Color"+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Text is required"+msgstr "Text is required"++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Text Settings"+msgstr "Text Settings"+#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Thank you for completing the signing process."msgstr "Thank you for completing the signing process."@@ -7448,6 +8089,19 @@ msgstr "The document will be hidden from your account"msgid "The document will be immediately sent to recipients if this is checked."msgstr "The document will be immediately sent to recipients if this is checked."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "The document you are looking for could not be found."+msgstr "The document you are looking for could not be found."++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+#: packages/ui/components/document/document-send-email-message-helper.tsxmsgid "The document's name"msgstr "The document's name"@@ -7613,6 +8267,7 @@ msgstr "The signer's name"#: apps/remix/app/components/general/avatar-with-recipient.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "The signing link has been copied to your clipboard."msgstr "The signing link has been copied to your clipboard."@@ -7649,6 +8304,18 @@ msgstr "The template has been moved successfully."msgid "The template will be removed from your profile"msgstr "The template will be removed from your profile"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "The template you are looking for could not be found."+msgstr "The template you are looking for could not be found."++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+msgid ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "The test webhook has been successfully sent to your endpoint."msgstr "The test webhook has been successfully sent to your endpoint."@@ -7764,6 +8431,10 @@ msgstr "This action is reversible, but please be careful as the account may be amsgid "This claim is locked and cannot be deleted."msgstr "This claim is locked and cannot be deleted."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "This code will expire in {expiresInMinutes} minutes."+msgstr "This code will expire in {expiresInMinutes} minutes."+#: packages/email/template-components/template-document-super-delete.tsxmsgid "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."msgstr "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."@@ -7776,6 +8447,7 @@ msgstr "This document cannot be changed"msgid "This document could not be deleted at this time. Please try again."msgstr "This document could not be deleted at this time. Please try again."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsxmsgid "This document could not be duplicated at this time. Please try again."msgstr "This document could not be duplicated at this time. Please try again."@@ -7792,6 +8464,7 @@ msgstr "This document has already been sent to this recipient. You can no longermsgid "This document has been cancelled by the owner and is no longer available for others to sign."msgstr "This document has been cancelled by the owner and is no longer available for others to sign."+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "This document has been cancelled by the owner."msgstr "This document has been cancelled by the owner."@@ -7828,6 +8501,10 @@ msgstr "This document was created using a direct link."msgid "This document was sent using <0>Documenso.</0>"msgstr "This document was sent using <0>Documenso.</0>"+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This document will be duplicated."+msgstr "This document will be duplicated."+#: packages/email/template-components/template-document-rejection-confirmed.tsxmsgid "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."msgstr "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."@@ -7852,6 +8529,14 @@ msgstr "This email is sent to the recipient requesting them to sign the documentmsgid "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."msgstr "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "This envelope could not be distributed at this time. Please try again."+msgstr "This envelope could not be distributed at this time. Please try again."++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "This envelope could not be resent at this time. Please try again."+msgstr "This envelope could not be resent at this time. Please try again."+#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."msgstr "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."@@ -7860,6 +8545,7 @@ msgstr "This field cannot be modified or deleted. When you share this template'smsgid "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."msgstr "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "This is how the document will reach the recipients once the document is ready for signing."msgstr "This is how the document will reach the recipients once the document is ready for signing."@@ -7876,6 +8562,10 @@ msgstr "This is the required scopes you must set in your provider's settings"msgid "This is the URL which users will use to sign in to your organisation."msgstr "This is the URL which users will use to sign in to your organisation."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "This item cannot be deleted"+msgstr "This item cannot be deleted"+#: apps/remix/app/routes/_unauthenticated+/team.verify.email.$token.tsxmsgid "This link is invalid or has expired. Please contact your team to resend a verification."msgstr "This link is invalid or has expired. Please contact your team to resend a verification."@@ -7896,6 +8586,7 @@ msgstr "This passkey has already been registered."msgid "This passkey is not configured for this application. Please login and add one in the user settings."msgstr "This passkey is not configured for this application. Please login and add one in the user settings."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "This recipient can no longer be modified as they have signed a field, or completed the document."msgstr "This recipient can no longer be modified as they have signed a field, or completed the document."@@ -7904,6 +8595,7 @@ msgstr "This recipient can no longer be modified as they have signed a field, ormsgid "This session has expired. Please try again."msgstr "This session has expired. Please try again."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "This signer has already signed the document."msgstr "This signer has already signed the document."@@ -7920,6 +8612,10 @@ msgstr "This template could not be deleted at this time. Please try again."msgid "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."msgstr "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This template will be duplicated."+msgstr "This template will be duplicated."+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "This token is invalid or has expired. No action is needed."msgstr "This token is invalid or has expired. No action is needed."@@ -7971,6 +8667,7 @@ msgid "Time zone"msgstr "Time zone"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -8119,6 +8816,7 @@ msgstr "Two factor authentication"msgid "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."msgstr "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/forms/signin.tsxmsgid "Two-Factor Authentication"msgstr "Two-Factor Authentication"@@ -8139,17 +8837,17 @@ msgstr "Two-factor authentication has been disabled for your account. You will nmsgid "Two-Factor Re-Authentication"msgstr "Two-Factor Re-Authentication"-#: packages/lib/constants/document.ts-msgctxt "Type signatute type"-msgid "Type"-msgstr "Type"-#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Type"msgstr "Type"+#: packages/lib/constants/document.ts+msgctxt "Type signatute type"+msgid "Type"+msgstr "Type"+#: apps/remix/app/components/general/app-command-menu.tsxmsgid "Type a command or search..."msgstr "Type a command or search..."@@ -8298,6 +8996,7 @@ msgstr "Untitled Group"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-public-profile-templates-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/email-preferences-form.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx@@ -8429,12 +9128,12 @@ msgstr "Upgrade <0>{0}</0> to {planName}"msgid "Upgrade your plan to upload more documents"msgstr "Upgrade your plan to upload more documents"-#: packages/lib/constants/document.ts-msgctxt "Upload signatute type"+#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Upload"msgstr "Upload"-#: packages/ui/primitives/signature-pad/signature-pad.tsx+#: packages/lib/constants/document.ts+msgctxt "Upload signatute type"msgid "Upload"msgstr "Upload"@@ -8462,12 +9161,20 @@ msgstr "Upload CSV"msgid "Upload custom document"msgstr "Upload custom document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Upload disabled"+msgstr "Upload disabled"+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsx#: packages/ui/primitives/document-upload.tsxmsgid "Upload Document"msgstr "Upload Document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Upload documents and add recipients"+msgstr "Upload documents and add recipients"+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Upload failed"@@ -8507,6 +9214,10 @@ msgstr "Uploaded file is too small"msgid "Uploaded file not an allowed file type"msgstr "Uploaded file not an allowed file type"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Uploading"+msgstr "Uploading"+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Uploading document..."msgstr "Uploading document..."@@ -8529,10 +9240,15 @@ msgstr "Use Authenticator"msgid "Use Backup Code"msgstr "Use Backup Code"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Use Template"msgstr "Use Template"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Use your authenticator app to generate a code"+msgstr "Use your authenticator app to generate a code"+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Use your passkey for authentication"msgstr "Use your passkey for authentication"@@ -8581,17 +9297,25 @@ msgstr "User with this email already exists. Please use a different email addresmsgid "Users"msgstr "Users"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Validation"msgstr "Validation"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Value"msgstr "Value"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Verification Code Required"+msgstr "Verification Code Required"+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Verification Email Sent"msgstr "Verification Email Sent"@@ -8600,6 +9324,10 @@ msgstr "Verification Email Sent"msgid "Verification email sent successfully."msgstr "Verification email sent successfully."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Verify & Complete"+msgstr "Verify & Complete"+#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsxmsgid "Verify Domain"msgstr "Verify Domain"@@ -8616,7 +9344,8 @@ msgstr "Verify your email address"msgid "Verify your email address to unlock all features."msgstr "Verify your email address to unlock all features."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Verify your email to upload documents."msgstr "Verify your email to upload documents."@@ -8624,15 +9353,11 @@ msgstr "Verify your email to upload documents."msgid "Verify your team email address"msgstr "Verify your team email address"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Vertical"msgstr "Vertical"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "View"-msgstr "View"-#: apps/remix/app/components/tables/organisation-billing-invoices-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx@@ -8645,6 +9370,11 @@ msgstr "View"msgid "View"msgstr "View"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "View"+msgstr "View"+#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsxmsgid "View activity"msgstr "View activity"@@ -8691,7 +9421,7 @@ msgstr "View DNS Records"msgid "View document"msgstr "View document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -8700,6 +9430,18 @@ msgstr "View document"msgid "View Document"msgstr "View Document"+#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to approve"+msgstr "View Document to approve"++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to assist"+msgstr "View Document to assist"++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to sign"+msgstr "View Document to sign"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._index.tsxmsgid "View documents associated with this email"msgstr "View documents associated with this email"@@ -8741,17 +9483,17 @@ msgstr "View teams"msgid "View the DNS records for this email domain"msgstr "View the DNS records for this email domain"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Viewed"-msgstr "Viewed"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Viewed"msgstr "Viewed"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Viewed"+msgstr "Viewed"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Viewer"@@ -8792,6 +9534,7 @@ msgstr "Waiting for others to sign"msgid "Waiting for Your Turn"msgstr "Waiting for Your Turn"+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Want to send slick signing links like this one? <0>Check out Documenso.</0>"msgstr "Want to send slick signing links like this one? <0>Check out Documenso.</0>"@@ -8800,6 +9543,9 @@ msgstr "Want to send slick signing links like this one? <0>Check out Documenso.<msgid "Want your own public profile?"msgstr "Want your own public profile?"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -8843,6 +9589,12 @@ msgstr "We couldn't update the organisation. Please try again."msgid "We couldn't update the provider. Please try again."msgstr "We couldn't update the provider. Please try again."+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+msgstr "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+#: apps/remix/app/components/dialogs/organisation-email-create-dialog.tsxmsgid "We encountered an error while creating the email. Please try again later."msgstr "We encountered an error while creating the email. Please try again later."@@ -8929,6 +9681,10 @@ msgstr "We encountered an unknown error while attempting to remove this email domsgid "We encountered an unknown error while attempting to remove this email. Please try again later."msgstr "We encountered an unknown error while attempting to remove this email. Please try again later."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+msgstr "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+#: apps/remix/app/components/dialogs/team-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "We encountered an unknown error while attempting to remove this group. Please try again later."@@ -8943,6 +9699,11 @@ msgstr "We encountered an unknown error while attempting to remove this templatemsgid "We encountered an unknown error while attempting to remove this user. Please try again later."msgstr "We encountered an unknown error while attempting to remove this user. Please try again later."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+msgstr "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+#: apps/remix/app/components/forms/reset-password.tsxmsgid "We encountered an unknown error while attempting to reset your password. Please try again later."msgstr "We encountered an unknown error while attempting to reset your password. Please try again later."@@ -8966,6 +9727,10 @@ msgstr "We encountered an unknown error while attempting to sign you Up. Pleasemsgid "We encountered an unknown error while attempting to update the banner. Please try again later."msgstr "We encountered an unknown error while attempting to update the banner. Please try again later."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "We encountered an unknown error while attempting to update the envelope. Please try again later."+msgstr "We encountered an unknown error while attempting to update the envelope. Please try again later."+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "We encountered an unknown error while attempting to update the template. Please try again later."msgstr "We encountered an unknown error while attempting to update the template. Please try again later."@@ -9078,11 +9843,13 @@ msgid "We were unable to verify your email. If your email is not verified alreadmsgstr "We were unable to verify your email. If your email is not verified already, please try again."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We will generate signing links for you, which you can send to the recipients through your method of choice."msgstr "We will generate signing links for you, which you can send to the recipients through your method of choice."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We won't send anything to notify recipients."msgstr "We won't send anything to notify recipients."@@ -9091,6 +9858,10 @@ msgstr "We won't send anything to notify recipients."msgid "We'll get back to you as soon as possible via email."msgstr "We'll get back to you as soon as possible via email."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We'll send a 6-digit code to your email"+msgstr "We'll send a 6-digit code to your email"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates._index.tsx#: apps/remix/app/components/tables/documents-table-empty-state.tsxmsgid "We're all empty"@@ -9104,6 +9875,10 @@ msgstr "We're still waiting for other signers to sign this document.<0/>We'll nomsgid "We've changed your password as you asked. You can now sign in with your new password."msgstr "We've changed your password as you asked. You can now sign in with your new password."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+msgstr "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."msgstr "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."@@ -9168,6 +9943,7 @@ msgstr "Were you trying to edit this document instead?"msgid "What you can do with teams:"msgstr "What you can do with teams:"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -9266,6 +10042,10 @@ msgstr "You are about to remove the <0>{provider}</0> login method from your accmsgid "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."msgstr "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You are about to remove the following document and all associated fields"+msgstr "You are about to remove the following document and all associated fields"+#. placeholder {0}: organisation.name#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsxmsgid "You are about to remove the following email from <0>{0}</0>."@@ -9396,6 +10176,7 @@ msgstr "You can view the created documents in your dashboard under the \"Documenmsgid "You can view the document and its status by clicking the button below."msgstr "You can view the document and its status by clicking the button below."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "You cannot add assistants when signing order is disabled."@@ -9405,6 +10186,10 @@ msgstr "You cannot add assistants when signing order is disabled."msgid "You cannot delete a group which has a higher role than you."msgstr "You cannot delete a group which has a higher role than you."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You cannot delete this item because the document has been sent to recipients"+msgstr "You cannot delete this item because the document has been sent to recipients"+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."msgstr "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."@@ -9430,7 +10215,8 @@ msgstr "You cannot remove members from this team if the inherit member feature imsgid "You cannot upload documents at this time."msgstr "You cannot upload documents at this time."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You cannot upload encrypted PDFs"msgstr "You cannot upload encrypted PDFs"@@ -9489,7 +10275,7 @@ msgstr "You have been requested to sign the following documents. Review each docmsgid "You have declined the invitation from <0>{0}</0> to join their organisation."msgstr "You have declined the invitation from <0>{0}</0> to join their organisation."-#. placeholder {0}: `"${document.title}"`+#. placeholder {0}: `"${envelope.title}"`#: packages/lib/server-only/document/resend-document.ts#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "You have initiated the document {0} that requires you to {recipientActionVerb} it."@@ -9516,12 +10302,14 @@ msgstr "You have reached the maximum limit of {0} direct templates. <0>Upgrade ymsgid "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."msgstr "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You have reached your document limit for this month. Please upgrade your plan."msgstr "You have reached your document limit for this month. Please upgrade your plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: packages/ui/primitives/document-dropzone.tsxmsgid "You have reached your document limit."msgstr "You have reached your document limit."@@ -9560,6 +10348,10 @@ msgstr "You have successfully removed this email domain from the organisation."msgid "You have successfully removed this email from the organisation."msgstr "You have successfully removed this email from the organisation."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You have successfully removed this envelope item."+msgstr "You have successfully removed this envelope item."+#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "You have successfully removed this group from the organisation."msgstr "You have successfully removed this group from the organisation."@@ -9608,11 +10400,19 @@ msgstr "You have verified your email address for <0>{0}</0>."msgid "You must enter '{deleteMessage}' to proceed"msgstr "You must enter '{deleteMessage}' to proceed"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "You must select at least one item"+msgstr "You must select at least one item"+#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsxmsgid "You must type '{deleteMessage}' to confirm"msgstr "You must type '{deleteMessage}' to confirm"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "You need at least one recipient to add fields"+msgstr "You need at least one recipient to add fields"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "You need to be an admin to manage API tokens."msgstr "You need to be an admin to manage API tokens."@@ -9694,7 +10494,8 @@ msgstr "Your current plan is past due."msgid "Your direct signing templates"msgstr "Your direct signing templates"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Your document failed to upload."msgstr "Your document failed to upload."@@ -9723,7 +10524,8 @@ msgstr "Your document has been sent successfully."msgid "Your document has been successfully duplicated."msgstr "Your document has been successfully duplicated."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Your document has been uploaded successfully."msgstr "Your document has been uploaded successfully."@@ -9760,6 +10562,18 @@ msgstr "Your email is currently being used by team <0>{0}</0> ({1})."msgid "Your email preferences have been updated"msgstr "Your email preferences have been updated"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Your envelope has been distributed successfully."+msgstr "Your envelope has been distributed successfully."++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Your envelope has been resent successfully."+msgstr "Your envelope has been resent successfully."++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Your envelope has been successfully duplicated."+msgstr "Your envelope has been successfully duplicated."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Your existing tokens"msgstr "Your existing tokens"@@ -9843,6 +10657,10 @@ msgstr "Your team has been successfully deleted."msgid "Your team has been successfully updated."msgstr "Your team has been successfully updated."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template failed to upload."+msgstr "Your template failed to upload."+#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Your template has been created successfully"msgstr "Your template has been created successfully"@@ -9855,6 +10673,10 @@ msgstr "Your template has been duplicated successfully."msgid "Your template has been successfully deleted."msgstr "Your template has been successfully deleted."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template has been uploaded successfully."+msgstr "Your template has been uploaded successfully."+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxmsgid "Your template has been uploaded successfully. You will be redirected to the template page."msgstr "Your template has been uploaded successfully. You will be redirected to the template page."@@ -9879,6 +10701,18 @@ msgstr "Your token was created successfully! Make sure to copy it because you womsgid "Your tokens will be shown here once you create them."msgstr "Your tokens will be shown here once you create them."+#: packages/lib/server-only/2fa/email/send-2fa-token-email.ts+msgid "Your two-factor authentication code"+msgstr "Your two-factor authentication code"++#: packages/email/templates/access-auth-2fa.tsx+msgid "Your verification code is {code}"+msgstr "Your verification code is {code}"++#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Your verification code:"+msgstr "Your verification code:"+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "your-domain.com another-domain.com"msgstr "your-domain.com another-domain.com"diff --git a/packages/lib/translations/es/web.po b/packages/lib/translations/es/web.poindex a2520c175..e155f7747 100644--- a/packages/lib/translations/es/web.po+++ b/packages/lib/translations/es/web.po@@ -72,6 +72,11 @@ msgstr "{0, plural, one {(1 carácter excedido)} other {(# caracteres excedidos)msgid "{0, plural, one {# character over the limit} other {# characters over the limit}}"msgstr "{0, plural, one {# carácter sobre el límite} other {# caracteres sobre el límite}}"+#. placeholder {0}: fieldMeta?.characterLimit - (field.value?.length ?? 0)+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "{0, plural, one {# character remaining} other {# characters remaining}}"+msgstr ""+#. placeholder {0}: folder._count.documents#: apps/remix/app/components/general/folder/folder-card.tsxmsgid "{0, plural, one {# document} other {# documents}}"@@ -103,13 +108,25 @@ msgstr "{0, plural, one {# plantilla} other {# plantillas}}"msgid "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"msgstr "{0, plural, one {<0>Tienes <1>1</1> invitación pendiente</0>} other {<2>Tienes <3>#</3> invitaciones pendientes</2>}}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"+msgstr ""++#. placeholder {0}: fields.filter((field) => field.envelopeItemId === doc.id).length+#. placeholder {0}: recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id) .length+#: apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0, plural, one {1 Field} other {# Fields}}"+msgstr ""+#. placeholder {0}: autoSignableFields.filter((f) => f.type === fieldType).length#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsxmsgid "{0, plural, one {1 matching field} other {# matching fields}}"msgstr "{0, plural, one {1 campo que coincide} other {# campos que coinciden}}"#. placeholder {0}: recipients.length-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxmsgid "{0, plural, one {1 Recipient} other {# Recipients}}"msgstr "{0, plural, one {1 Destinatario} other {# Destinatarios}}"@@ -131,8 +148,13 @@ msgstr "{0}"msgid "{0} direct signing templates"msgstr "{0} plantillas de firma directa"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0} fields remaining"+msgstr ""+#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{0} has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{0} te ha invitado a {recipientActionVerb} el documento \"{1}\"."@@ -144,7 +166,8 @@ msgstr "{0} te invitó a {recipientActionVerb} un documento"#. placeholder {0}: remaining.documents#. placeholder {1}: quota.documents-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "{0} of {1} documents remaining this month."msgstr "{0} de {1} documentos restantes este mes."@@ -156,13 +179,13 @@ msgid "{0} of {1} row(s) selected."msgstr "{0} de {1} fila(s) seleccionada."#. placeholder {0}: user.name || user.email-#. placeholder {1}: document.team.name-#. placeholder {2}: document.title+#. placeholder {1}: envelope.team.name+#. placeholder {2}: envelope.title#: packages/lib/server-only/document/resend-document.tsmsgid "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."msgstr "{0} en nombre de \"{1}\" te ha invitado a {recipientActionVerb} el documento \"{2}\"."-#. placeholder {0}: recipients.length+#. placeholder {0}: envelope.recipients.length#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxmsgid "{0} Recipient(s)"msgstr "{0} Destinatario(s)"@@ -214,7 +237,7 @@ msgid "{inviterName} has removed you from the document<0/>\"{documentName}\""msgstr "{inviterName} te ha eliminado del documento<0/>\"{documentName}\""#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{inviterName} en nombre de \"{0}\" te ha invitado a {recipientActionVerb} el documento \"{1}\"."@@ -346,7 +369,7 @@ msgstr "{recipientName} ha rechazado el documento '{documentName}'"msgid "{recipientReference} has completed signing the document."msgstr "{recipientReference} ha completado la firma del documento."-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsmsgid "{recipientReference} has signed \"{0}\""msgstr "{recipientReference} ha firmado \"{0}\""@@ -393,14 +416,26 @@ msgstr "{userName} envió una copia del documento"msgid "{userName} completed their task"msgstr "{userName} completó su tarea"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} failed to validate a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} rejected the document"msgstr "{userName} rechazó el documento"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} requested a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} signed the document"msgstr "{userName} firmó el documento"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} validated a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} viewed the document"msgstr "{userName} vio el documento"@@ -410,6 +445,8 @@ msgid "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}msgstr "{visibleRows, plural, one {Mostrando # resultado.} other {Mostrando # resultados.}}"#. placeholder {0}: document.title+#. placeholder {0}: envelope.title+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "<0>\"{0}\"</0>is no longer available to sign"msgstr "<0>\"{0}\"</0> ya no está disponible para firmar"@@ -442,6 +479,7 @@ msgstr ""msgid "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."msgstr "<0>Dibujado</0> - Una firma que se dibuja usando un ratón o un lápiz óptico."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."msgstr "<0>Correo electrónico</0> - Al destinatario se le enviará el documento para firmar, aprobar, etc."@@ -466,10 +504,12 @@ msgstr "<0>Sin restricciones</0> - El documento se puede acceder directamente amsgid "<0>None</0> - No authentication required"msgstr "<0>Ninguno</0> - No se requiere autenticación"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>None</0> - We will generate links which you can send to the recipients manually."msgstr "<0>Ninguno</0> - Generaremos enlaces que puedes enviar a los destinatarios manualmente."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."msgstr "<0>Nota</0> - Si usas Enlaces en combinación con plantillas directas, necesitarás enviar manualmente los enlaces a los destinatarios restantes."@@ -554,6 +594,10 @@ msgstr ""msgid "401 Unauthorized"msgstr "401 No autorizado"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "404 Document not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsxmsgid "404 Email domain not found"msgstr "404 Dominio de correo electrónico no encontrado"@@ -562,6 +606,12 @@ msgstr "404 Dominio de correo electrónico no encontrado"msgid "404 not found"msgstr "404 no encontrado"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "404 Not found"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsxmsgid "404 Not Found"msgstr ""@@ -584,6 +634,10 @@ msgstr "404 Perfil no encontrado"msgid "404 Team not found"msgstr "404 Equipo no encontrado"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "404 Template not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsxmsgid "404 User not found"msgstr "404 Usuario no encontrado"@@ -850,6 +904,7 @@ msgstr "Acción"#: apps/remix/app/components/tables/admin-organisations-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Actions"msgstr "Acciones"@@ -872,6 +927,7 @@ msgstr "Suscripciones Activas"msgid "Add"msgstr "Agregar"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add 2 or more signers to enable signing order."msgstr ""@@ -884,6 +940,7 @@ msgstr "Agrega un dominio personalizado para enviar correos electrónicos en nommsgid "Add a document"msgstr "Agregar un documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -907,6 +964,7 @@ msgstr "Agrega un autenticador para servir como método de autenticación secundmsgid "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."msgstr "Agrega un autenticador para servir como método de autenticación secundario al iniciar sesión o al firmar documentos."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Add an external ID to the document. This can be used to identify the document in external systems."msgstr "Agregue un ID externo al documento. Esto se puede usar para identificar el documento en sistemas externos."@@ -941,6 +999,9 @@ msgid "Add Email Domain"msgstr "Agregar dominio de correo electrónico"#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: apps/remix/app/components/general/document/document-edit-form.tsxmsgid "Add Fields"msgstr "Agregar Campos"@@ -975,6 +1036,7 @@ msgstr "Agregar más"msgid "Add myself"msgstr "Agregame"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "Add Myself"msgstr "Agregame"@@ -996,6 +1058,7 @@ msgstr "Agregar destinatario de marcador de posición"msgid "Add Placeholders"msgstr "Agregar Marcadores de posición"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add Signer"@@ -1013,10 +1076,12 @@ msgstr "Agregar firmantes y configurar preferencias de firma"msgid "Add team email"msgstr "Agregar correo electrónico del equipo"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text"msgstr "Agregar texto"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text to the field"msgstr "Agregar texto al campo"@@ -1148,6 +1213,7 @@ msgstr "Permitir a todos los miembros de la organización acceder a este equipo"msgid "Allow document recipients to reply directly to this email address"msgstr "Permitir que los destinatarios del documento respondan directamente a esta dirección de correo electrónico"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -1158,6 +1224,7 @@ msgstr "Permitir a los firmantes dictar al siguiente firmante"msgid "Allowed Email Domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -1205,6 +1272,8 @@ msgstr "Ya existe un correo electrónico con esta dirección."#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx#: apps/remix/app/components/forms/token.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/reset-password.tsx@@ -1386,7 +1455,8 @@ msgstr "Ocurrió un error al actualizar la firma."msgid "An error occurred while updating your profile."msgstr "Ocurrió un error al actualizar tu perfil."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "An error occurred while uploading your document."msgstr "Ocurrió un error al subir tu documento."@@ -1410,6 +1480,7 @@ msgstr "Ocurrió un error inesperado."#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/admin+/site-settings.tsx#: apps/remix/app/components/general/app-command-menu.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/signup.tsx@@ -1446,6 +1517,7 @@ msgstr "Ocurrió un error inesperado."#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/account-delete-dialog.tsx@@ -1487,11 +1559,6 @@ msgstr "Tokens de API"msgid "App Version"msgstr "Versión de la Aplicación"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Approve"-msgstr ""-#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-button.tsx@@ -1501,19 +1568,27 @@ msgstr ""msgid "Approve"msgstr "Aprobar"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Approve"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Approve Document"msgstr "Aprobar Documento"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Approved"+msgstr "Aprobado"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Approved"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Approved"-msgstr "Aprobado"+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "Approver"+msgstr ""#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"@@ -1576,6 +1651,7 @@ msgstr "¿Estás seguro de que deseas eliminar este equipo?"#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Are you sure?"msgstr "¿Estás seguro?"@@ -1589,8 +1665,7 @@ msgctxt "Recipient role action verb"msgid "Assist"msgstr ""-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Assist Document"msgstr "Asistir Documento"@@ -1616,20 +1691,21 @@ msgstr ""msgid "Assistants and Copy roles are currently not compatible with the multi-sign experience."msgstr "Los roles de asistentes y copias actualmente no son compatibles con la experiencia de firmar múltiple."+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Assisted"+msgstr "Asistido"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Assisted"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Assisted"-msgstr "Asistido"-#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role progressive verb"msgid "Assisting"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx#: packages/ui/primitives/template-flow/add-template-settings.types.tsx#: packages/ui/primitives/document-flow/add-settings.types.ts@@ -1662,6 +1738,10 @@ msgstr ""msgid "Authentication required"msgstr "Se requiere autenticación"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Authenticator app"+msgstr ""+#: apps/remix/app/components/forms/avatar-image.tsxmsgid "Avatar"msgstr "Avatar"@@ -1691,6 +1771,10 @@ msgstr "Volver a inicio"msgid "Background Color"msgstr "Color de Fondo"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Background Jobs"+msgstr ""+#: apps/remix/app/components/forms/signin.tsx#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Backup Code"@@ -1828,6 +1912,7 @@ msgstr "Puede preparar"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/general/teams/team-email-usage.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -1866,6 +1951,13 @@ msgstr "Puede preparar"#: apps/remix/app/components/dialogs/team-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: apps/remix/app/components/dialogs/session-logout-all-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/passkey-create-dialog.tsx@@ -1888,6 +1980,10 @@ msgstr "Puede preparar"#: apps/remix/app/components/dialogs/folder-move-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -1911,10 +2007,15 @@ msgstr "Cancelado por el usuario"msgid "Cannot remove document"msgstr "No se puede eliminar el documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Cannot remove signer"msgstr "No se puede eliminar el firmante"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Cannot upload items after the document has been sent"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Cc"@@ -1940,6 +2041,11 @@ msgctxt "Recipient role plural name"msgid "Ccers"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Center"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Character Limit"msgstr "Límite de caracteres"@@ -1948,10 +2054,16 @@ msgstr "Límite de caracteres"msgid "Charts"msgstr "Gráficas"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Checkbox"msgstr "Casilla de verificación"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Checkbox Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Checkbox values"msgstr "Valores de Checkbox"@@ -1978,6 +2090,10 @@ msgstr "Elige cómo el documento llegará a los destinatarios"msgid "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."msgstr "Elija cómo distribuir su documento a los destinatarios. El correo electrónico enviará notificaciones, Ninguno generará enlaces de firma para la distribución manual."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Choose verification method"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Choose your preferred authentication method:"msgstr "Elige tu método de autenticación preferido:"@@ -2025,6 +2141,7 @@ msgstr "Haga clic aquí para subir"msgid "Click to copy signing link for sending to recipient"msgstr "Haga clic para copiar el enlace de firma para enviar al destinatario"+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx#: apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -2064,6 +2181,8 @@ msgstr ""#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Close"msgstr "Cerrar"@@ -2103,7 +2222,7 @@ msgstr "Documento Completo"msgid "Complete Signing"msgstr "Completar Firmado"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Complete the fields for the following signers."msgstr ""@@ -2112,8 +2231,10 @@ msgstr ""msgid "Complete Viewing"msgstr "Completar Visualización"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx#: packages/lib/constants/document.ts@@ -2157,6 +2278,14 @@ msgstr "Configurar destinatario directo"msgid "Configure Document"msgstr "Configurar documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure document settings and options before sending."+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure email settings for the document"+msgstr ""+#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -2171,6 +2300,10 @@ msgstr "Configurar ajustes generales para el documento."msgid "Configure general settings for the template."msgstr "Configurar ajustes generales para la plantilla."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure security settings for the document"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Configure template"msgstr "Configurar plantilla"@@ -2305,6 +2438,7 @@ msgstr "Controla la visibilidad predeterminada de un documento cargado."msgid "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."msgstr "Controla el formato del mensaje que se enviará al invitar a un destinatario a firmar un documento. Si se ha proporcionado un mensaje personalizado al configurar el documento, se usará en su lugar."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."msgstr "Controla el idioma para el documento, incluyendo el idioma a utilizar para las notificaciones de correo electrónico y el certificado final que se genera y adjunta al documento."@@ -2322,6 +2456,7 @@ msgid "Controls which signatures are allowed to be used when signing a document.msgstr "Controla qué firmas están permitidas al firmar un documento."#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copied"msgstr "Copiado"@@ -2339,12 +2474,14 @@ msgstr "Copiado"#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/components/document/document-share-button.tsxmsgid "Copied to clipboard"msgstr "Copiado al portapapeles"#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copy"msgstr "Copiar"@@ -2445,7 +2582,7 @@ msgstr "Crear reclamación"msgid "Create Claim"msgstr "Crear reclamación"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Create Direct Link"msgstr "Crear enlace directo"@@ -2645,6 +2782,7 @@ msgid "Dashboard"msgstr "Tablero"#: apps/remix/app/components/tables/settings-security-activity-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-date-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -2656,12 +2794,17 @@ msgstr "Fecha"msgid "Date created"msgstr "Fecha de creación"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Date Format"msgstr "Formato de fecha"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Date Settings"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: packages/email/templates/organisation-invite.tsx@@ -2700,6 +2843,10 @@ msgstr "Configuraciones de Firma por Defecto"msgid "Default Time Zone"msgstr "Zona horaria predeterminada"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Default Value"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "delete"msgstr "eliminar"@@ -2731,6 +2878,7 @@ msgstr "eliminar"#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/claim-delete-dialog.tsxmsgid "Delete"@@ -2770,6 +2918,7 @@ msgstr "Eliminar Cuenta"msgid "Delete document"msgstr "Eliminar documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -2821,6 +2970,10 @@ msgstr "Eliminar equipo"msgid "Delete team group"msgstr "Eliminar grupo de equipo"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Delete Template"+msgstr ""+#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Delete the document. This action is irreversible so proceed with caution."msgstr "Eliminar el documento. Esta acción es irreversible, así que proceda con precaución."@@ -2872,6 +3025,7 @@ msgstr "Enlace directo"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsxmsgid "Direct Link"msgstr "Enlace directo"@@ -2909,6 +3063,7 @@ msgstr "Enlace de plantilla directo eliminado"msgid "Direct template link usage exceeded ({0}/{1})"msgstr "El uso de enlace de plantilla directo excedió ({0}/{1})"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Direction"msgstr "Dirección"@@ -3002,22 +3157,27 @@ msgstr "Documenso eliminará <0>todos sus documentos</0>, junto con todos sus domsgid "Document"msgstr "Documento"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#. placeholder {1}: recipient.name#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejected by {1}"msgstr "Documento \"{0}\" - Rechazado por {1}"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejection Confirmed"msgstr "Documento \"{0}\" - Rechazo confirmado"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsmsgid "Document \"{0}\" Cancelled"msgstr "Documento \"{0}\" Cancelado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document & Recipients"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/document/document-global-auth-access-select.tsx@@ -3038,21 +3198,22 @@ msgid "Document Approved"msgstr "Documento Aprobado"#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx-#: packages/lib/server-only/document/super-delete-document.ts+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: packages/lib/server-only/document/delete-document.ts+#: packages/lib/server-only/admin/admin-super-delete-document.tsmsgid "Document Cancelled"msgstr "Documento cancelado"+#: apps/remix/app/components/general/document/document-status.tsx+msgid "Document completed"+msgstr "Documento completado"+#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document completed"msgstr ""-#: apps/remix/app/components/general/document/document-status.tsx-msgid "Document completed"-msgstr "Documento completado"-#: packages/ui/components/document/document-email-checkboxes.tsx#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document completed email"@@ -3062,15 +3223,15 @@ msgstr "Correo electrónico de documento completado"msgid "Document Completed!"msgstr "¡Documento completado!"+#: apps/remix/app/components/dialogs/template-use-dialog.tsx+msgid "Document created"+msgstr "Documento creado"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document created"msgstr ""-#: apps/remix/app/components/dialogs/template-use-dialog.tsx-msgid "Document created"-msgstr "Documento creado"-#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Document Created"msgstr "Documento Creado"@@ -3093,17 +3254,17 @@ msgstr "Documento creado usando un <0>enlace directo</0>"msgid "Document Creation"msgstr "Creación de documento"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"-msgid "Document deleted"-msgstr ""-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Document deleted"msgstr "Documento eliminado"+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"+msgid "Document deleted"+msgstr ""+#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document deleted email"msgstr "Correo electrónico de documento eliminado"@@ -3112,6 +3273,8 @@ msgstr "Correo electrónico de documento eliminado"msgid "Document Deleted!"msgstr "¡Documento eliminado!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Document Distribution Method"@@ -3125,6 +3288,10 @@ msgstr "Borrador de documento"msgid "Document Duplicated"msgstr "Documento duplicado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Editor"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document external ID updated"@@ -3134,7 +3301,6 @@ msgstr ""msgid "Document found in your account"msgstr "Documento encontrado en tu cuenta"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Document ID"msgstr "ID del documento"@@ -3210,18 +3376,18 @@ msgstr "Documento rechazado"msgid "Document Rejected"msgstr "Documento Rechazado"-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx-msgid "Document resealed"-msgstr "Documento sellado nuevamente"+#: apps/remix/app/components/general/document/document-edit-form.tsx+msgid "Document sent"+msgstr "Documento enviado"#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document sent"msgstr ""-#: apps/remix/app/components/general/document/document-edit-form.tsx-msgid "Document sent"-msgstr "Documento enviado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Settings"+msgstr ""#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Document Signed"@@ -3244,6 +3410,10 @@ msgstr "Estado del documento"msgid "Document title"msgstr "Título del documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Document Title"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document title updated"@@ -3258,11 +3428,13 @@ msgstr ""msgid "Document updated successfully"msgstr "Documento actualizado con éxito"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Document upload disabled due to unpaid invoices"msgstr "La carga de documentos está deshabilitada debido a facturas impagadas"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Document uploaded"msgstr "Documento subido"@@ -3276,6 +3448,10 @@ msgstr ""msgid "Document Viewed"msgstr "Documento visto"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Document visibility"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document visibility updated"@@ -3291,7 +3467,7 @@ msgstr ""#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/_layout.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -3363,15 +3539,21 @@ msgid "Download Certificate"msgstr "Descargar certificado"#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsxmsgid "Download Original"msgstr "Descargar Original"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Download PDF"+msgstr ""+#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Download Template CSV"msgstr "Descargar Plantilla CSV"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: packages/lib/constants/document.tsmsgid "Draft"@@ -3398,42 +3580,68 @@ msgstr "Arrastra y suelta o haz clic para cargar"msgid "Drag and drop your PDF file here"msgstr "Arrastra y suelta tu archivo PDF aquí"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Draw"+msgstr "Dibujar"+#: packages/lib/constants/document.tsmsgctxt "Draw signatute type"msgid "Draw"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Draw"-msgstr "Dibujar"-#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Drop your document here"msgstr "Suelta tu documento aquí"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "Dropdown"msgstr "Menú desplegable"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown must have at least one option"+msgstr ""+#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Dropdown options"msgstr "Opciones de menú desplegable"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Dropdown Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown values"+msgstr ""+#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsx#: apps/remix/app/components/dialogs/template-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate"msgstr "Duplicar"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Document"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate on all pages"msgstr "Duplicar en todas las páginas"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Template"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks._index.tsx#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx@@ -3471,6 +3679,10 @@ msgstr "Divulgación de Firma Electrónica"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-email-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/general/direct-template/direct-template-configure-form.tsx@@ -3548,6 +3760,10 @@ msgstr "Dominios de correo electrónico"msgid "Email domains synced"msgstr "Dominios de correo electrónico sincronizados"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Email is required"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Email Options"msgstr "Opciones de correo electrónico"@@ -3567,6 +3783,8 @@ msgstr "Preferencias de correo electrónico actualizadas"msgid "Email resent"msgstr "Correo electrónico reeenviado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Email Sender"@@ -3580,6 +3798,14 @@ msgstr "Correo electrónico enviado"msgid "Email sent!"msgstr "¡Correo electrónico enviado!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Email Settings"+msgstr ""++#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Email verification"+msgstr ""+#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsxmsgid "Email verification has been removed"msgstr "La verificación de correo electrónico ha sido eliminada"@@ -3644,6 +3870,7 @@ msgstr "Habilita la marca personalizada para todos los documentos en este equipomsgid "Enable Direct Link Signing"msgstr "Habilitar firma de enlace directo"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -3681,6 +3908,10 @@ msgstr "Ingresar nombre de la reclamación"msgid "Enter the domain you want to use for sending emails (without http:// or www)"msgstr "Ingresa el dominio que deseas usar para enviar correos electrónicos (sin http:// ni www)"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Enter verification code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your 2FA code"msgstr "Ingrese su código 2FA"@@ -3701,11 +3932,16 @@ msgstr "Ingresa tu dirección de correo electrónico para recibir el documento cmsgid "Enter your name"msgstr "Ingresa tu nombre"+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Enter your number here"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your password"msgstr "Ingrese la contraseña"#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsxmsgid "Enter your text here"msgstr "Ingresa tu texto aquí"@@ -3713,6 +3949,34 @@ msgstr "Ingresa tu texto aquí"msgid "Enterprise"msgstr "Enterprise"+#: packages/ui/primitives/document-upload.tsx+msgid "Envelope (beta)"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Envelope distributed"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Envelope Duplicated"+msgstr ""++#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+msgid "Envelope ID"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Envelope resent"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Envelope Title"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Envelope updated"+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -3753,7 +4017,8 @@ msgstr "Enterprise"#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsx-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx@@ -3814,11 +4079,17 @@ msgstr "Tiempo de espera excedido"msgid "Expired"msgstr "Expirado"+#. placeholder {0}: DateTime.fromMillis(Math.max(millisecondsRemaining, 0)).toFormat( 'mm:ss', )+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Expires in {0}"+msgstr ""+#. placeholder {0}: i18n.date(token.expires, DateTime.DATETIME_FULL)#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Expires on {0}"msgstr "Expira el {0}"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "External ID"@@ -3902,10 +4173,12 @@ msgstr "Fallidos: {failedCount}"msgid "Feature Flags"msgstr "Flags de características"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field character limit"msgstr "Límite de caracteres del campo"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -3915,16 +4188,20 @@ msgstr "Límite de caracteres del campo"msgid "Field font size"msgstr "Tamaño de fuente del campo"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Field format"msgstr "Formato de campo"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Field label"msgstr "Etiqueta de campo"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field placeholder"msgstr "Marcador de posición de campo"@@ -3952,7 +4229,8 @@ msgstr "Campos"msgid "Fields updated"msgstr "Campos actualizados"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"msgstr "El archivo no puede ser mayor a {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"@@ -4010,6 +4288,7 @@ msgstr "Configuración de carpeta"msgid "Folder updated successfully"msgstr "Carpeta actualizada con éxito"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -4049,6 +4328,11 @@ msgstr "Gratis"msgid "Free Signature"msgstr "Firma gratuita"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Free Signature Settings"+msgstr ""++#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -4064,6 +4348,7 @@ msgstr "Nombre completo"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-page.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx@@ -4074,6 +4359,7 @@ msgstr "General"msgid "Generate DKIM Records"msgstr "Generar registros DKIM"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Generate Links"msgstr "Generar enlaces"@@ -4085,7 +4371,9 @@ msgstr "Autenticación de acción de destinatario global"#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsxmsgid "Go back"@@ -4094,7 +4382,9 @@ msgstr "Regresar"#: apps/remix/app/routes/_recipient+/_layout.tsx#: apps/remix/app/routes/_profile+/_layout.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: packages/ui/primitives/document-flow/document-flow-root.tsxmsgid "Go Back"@@ -4109,10 +4399,12 @@ msgstr "Regresar a casa"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Go Back Home"msgstr "Regresar a casa"#: apps/remix/app/routes/_authenticated+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxmsgid "Go home"msgstr "Ir a casa"@@ -4163,22 +4455,25 @@ msgstr "Nombre del grupo"msgid "Groups"msgstr "Grupos"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to approve this document"msgstr "te ha invitado a aprobar este documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to assist this document"msgstr "te ha invitado a asistir con este documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to sign this document"msgstr "te ha invitado a firmar este documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to view this document"msgstr "te ha invitado a ver este documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -4248,6 +4543,10 @@ msgstr "Hola, soy Timur"msgid "Hi {userName},"msgstr "Hola, {userName},"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+msgstr ""+#: packages/email/templates/reset-password.tsxmsgid "Hi, {userName} <0>({userEmail})</0>"msgstr "Hola, {userName} <0>({userEmail})</0>"@@ -4269,6 +4568,7 @@ msgstr "Inicio"msgid "Home (No Folder)"msgstr "Inicio (Sin Carpeta)"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Horizontal"msgstr "Horizontal"@@ -4322,6 +4622,10 @@ msgstr "ID copiado al portapapeles"msgid "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."msgstr "Si tienes algún problema con tu suscripción, por favor contáctanos en <0>{SUPPORT_EMAIL}</0>."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "If you didn't request this verification code, you can safely ignore this email."+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."msgstr "Si no deseas usar el autenticador solicitado, puedes cerrarlo, lo que mostrará el próximo autenticador disponible."@@ -4388,11 +4692,29 @@ msgstr "Heredar miembros de la organización"msgid "Inherited subscription claim"msgstr "Reclamación de suscripción heredada"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-initials-field.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Initials"msgstr "Iniciales"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Initials are required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Initials Settings"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Insert a value into the number field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Insert a value into the text field"+msgstr ""+#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsxmsgid "Inserted"msgstr "Insertado"@@ -4409,6 +4731,7 @@ msgstr "Código inválido. Por favor, intenta nuevamente."msgid "Invalid domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.types.tsmsgid "Invalid email"msgstr "Email inválido"@@ -4531,6 +4854,8 @@ msgstr ""msgid "Joined {0}"msgstr "Se unió a {0}"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -4541,6 +4866,7 @@ msgstr "Etiqueta"#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -4568,6 +4894,10 @@ msgstr "Última actividad"msgid "Last modified"msgstr "Última modificación"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Last Retried"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Last updated"msgstr "Última actualización"@@ -4604,6 +4934,10 @@ msgstr "Deja en blanco para heredar de la organización."msgid "Leave organisation"msgstr "Dejar la organización"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Left"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "Legality of Electronic Signatures"msgstr "Legalidad de las Firmas Electrónicas"@@ -4654,9 +4988,16 @@ msgstr "Escuchando a {0}"msgid "Load older activity"msgstr "Cargar actividad anterior"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Loading"+msgstr ""+#: apps/remix/app/components/general/skeletons/document-edit-skeleton.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Loading document..."msgstr "Cargando documento..."@@ -4722,7 +5063,7 @@ msgstr "Administrar facturación"msgid "Manage details for this public template"msgstr "Gestionar detalles de esta plantilla pública"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Manage Direct Link"msgstr "Gestionar enlace directo"@@ -4847,6 +5188,7 @@ msgstr "MAU (documento completado)"msgid "MAU (signed in)"msgstr "MAU (con sesión iniciada)"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Max"msgstr "Máx"@@ -4888,7 +5230,9 @@ msgstr "Miembro desde"msgid "Members"msgstr "Miembros"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Message"@@ -4898,6 +5242,7 @@ msgstr "Mensaje"msgid "Message <0>(Optional)</0>"msgstr "Mensaje <0>(Opcional)</0>"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Min"msgstr "Mín"@@ -4970,9 +5315,13 @@ msgstr "N/A"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/admin-leaderboard-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/forms/subscription-claim-form.tsx@@ -4995,9 +5344,14 @@ msgid "Name"msgstr "Nombre"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsxmsgid "Name is required"msgstr "Se requiere el nombre"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Name Settings"+msgstr ""+#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Need to sign documents?"msgstr "¿Necesitas firmar documentos?"@@ -5055,6 +5409,12 @@ msgstr "No"msgid "No active drafts"msgstr "No hay borradores activos"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "No documents found"+msgstr ""+#: apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxmsgid "No folders found"@@ -5094,6 +5454,7 @@ msgstr "No se encontró ningún destinatario que coincidiera con esta descripci#: apps/remix/app/components/general/template/template-page-view-recipients.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "No recipients"msgstr "Sin destinatarios"@@ -5155,11 +5516,18 @@ msgid "No worries, it happens! Enter your email and we'll email you a special limsgstr "¡No te preocupes, sucede! Ingresa tu correo electrónico y te enviaremos un enlace especial para restablecer tu contraseña."#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/lib/constants/document.tsmsgid "None"msgstr "Ninguno"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Not found"+msgstr ""+#: apps/remix/app/components/forms/signin.tsxmsgid "Not supported"msgstr "No soportado"@@ -5169,6 +5537,7 @@ msgstr "No soportado"msgid "Nothing to do"msgstr "Nada que hacer"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-number-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -5176,6 +5545,7 @@ msgstr "Nada que hacer"msgid "Number"msgstr "Número"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Number format"msgstr "Formato de número"@@ -5190,23 +5560,27 @@ msgstr "Número de miembros permitidos. 0 = Ilimitado"msgid "Number of teams allowed. 0 = Unlimited"msgstr "Número de equipos permitidos. 0 = Ilimitado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Number Settings"+msgstr ""+#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to approve this document"msgstr "en nombre de \"{0}\" te ha invitado a aprobar este documento"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to assist this document"msgstr "en nombre de \"{0}\" te ha invitado a asistir con este documento"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to sign this document"msgstr "en nombre de \"{0}\" te ha invitado a firmar este documento"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to view this document"msgstr "en nombre de \"{0}\" te ha invitado a ver este documento"@@ -5269,6 +5643,8 @@ msgid "Only PDF files are allowed"msgstr ""#: apps/remix/app/routes/_profile+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsxmsgid "Oops! Something went wrong."@@ -5278,6 +5654,14 @@ msgstr "¡Ups! Algo salió mal."msgid "Opened"msgstr "Abierto"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Option is required"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Option value cannot be empty"+msgstr ""+#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Or"@@ -5444,6 +5828,7 @@ msgstr "Página {0} de {1}"#. placeholder {0}: i + 1#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Page {0} of {numPages}"msgstr "Página {0} de {numPages}"@@ -5532,6 +5917,7 @@ msgstr "Pago atrasado"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/components/tables/organisation-email-domains-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsx@@ -5581,6 +5967,7 @@ msgstr "Cuenta personal"msgid "Personal Inbox"msgstr "Bandeja de entrada personal"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Pick a number"msgstr "Seleccione un número"@@ -5597,6 +5984,13 @@ msgstr "Elige cualquiera de los siguientes acuerdos a continuación y comience amsgid "Pin"msgstr "Fijar"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Place and configure form fields in the document"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -5671,7 +6065,11 @@ msgstr "Por favor, ingresa un nombre significativo para tu token. Esto te ayudarmsgid "Please enter a valid name."msgstr "Por favor, introduce un nombre válido."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Please enter a valid number"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please mark as viewed to complete."msgstr ""@@ -5707,6 +6105,10 @@ msgstr "Por favor, ten en cuenta que esta acción es irreversible. Una vez confimsgid "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"msgstr "Por favor, ten en cuenta que perderás acceso a todos los documentos asociados con este equipo y todos los miembros serán eliminados y notificados"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please open your authenticator app and enter the 6-digit code for this document."+msgstr ""+#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."msgstr "Por favor, proporciona un token del autenticador o un código de respaldo. Si no tienes un código de respaldo disponible, contacta al soporte."@@ -5715,11 +6117,11 @@ msgstr "Por favor, proporciona un token del autenticador o un código de respaldmsgid "Please provide a token from your authenticator, or a backup code."msgstr "Por favor, proporciona un token de tu autenticador, o un código de respaldo."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before approving."msgstr "Por favor, revise el documento antes de aprobarlo."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before signing."msgstr "Por favor, revise el documento antes de firmar."@@ -5727,6 +6129,10 @@ msgstr "Por favor, revise el documento antes de firmar."msgid "Please select a PDF file"msgstr "Por favor seleccione un archivo PDF"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please select how you'd like to receive your verification code."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-create-dialog.tsxmsgid "Please try a different domain."msgstr "Por favor, intenta con un dominio diferente."@@ -5742,6 +6148,8 @@ msgstr "Por favor, intenta de nuevo más tarde."#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Please try again or contact our support."msgstr "Por favor, inténtalo de nuevo o contacta a nuestro soporte."@@ -5755,6 +6163,11 @@ msgstr "Por favor, escriba {0} para confirmar"msgid "Please type <0>{0}</0> to confirm."msgstr "Por favor, escribe <0>{0}</0> para confirmar."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Please upload a document to continue"+msgstr ""+#: apps/remix/app/components/forms/branding-preferences-form.tsxmsgid "Please upload a logo"msgstr "Por favor, suba un logotipo"@@ -5770,6 +6183,7 @@ msgstr "Plantilla CSV preformateada con datos de ejemplo."msgid "Preferences"msgstr "Preferencias"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/forms/document-preferences-form.tsxmsgid "Preview"msgstr "Vista previa"@@ -5778,11 +6192,29 @@ msgstr "Vista previa"msgid "Preview and configure template."msgstr "Vista previa y configurar plantilla."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview Mode"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Preview the document before sending"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview what the signed document will look like with placeholder data"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/general/template/template-type.tsxmsgid "Private"msgstr "Privado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Private Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Private templates can only be modified and viewed by you."msgstr "Las plantillas privadas solo pueden ser modificadas y vistas por ti."@@ -5843,14 +6275,28 @@ msgstr "Perfil Público"msgid "Public profile URL"msgstr "URL del perfil público"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Public Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."msgstr "Las plantillas públicas están conectadas a tu perfil público. Cualquier modificación a las plantillas públicas también aparecerá en tu perfil público."+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Quick Actions"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Radio"msgstr "Radio"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Radio Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-radio-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsxmsgid "Radio values"msgstr "Valores de radio"@@ -5863,6 +6309,10 @@ msgstr "Valores de radio"msgid "Read only"msgstr "Solo lectura"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Read Only"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.support.tsxmsgid "Read our documentation to get started with Documenso."msgstr ""@@ -5918,9 +6368,13 @@ msgstr "Documentos recientes"#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsx#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.tsmsgid "Recipient"msgstr "Destinatario"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/recipient/recipient-action-auth-select.tsx@@ -5955,6 +6409,10 @@ msgstr "Destinatarios"msgid "Recipients metrics"msgstr "Métricas de destinatarios"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Recipients will be able to sign the document once sent"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Recipients will still retain their copy of the document"msgstr "Los destinatarios aún conservarán su copia del documento"@@ -5987,12 +6445,17 @@ msgstr "Rojo"msgid "Redirect URI"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Redirect URL"msgstr "URL de redirección"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+msgid "Redirecting"+msgstr ""+#: apps/remix/app/components/general/claim-account.tsx#: apps/remix/app/components/forms/signup.tsxmsgid "Registration Successful"@@ -6001,12 +6464,13 @@ msgstr "Registro exitoso"#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Reject Document"msgstr "Rechazar Documento"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx@@ -6022,16 +6486,21 @@ msgstr "Rechazo Confirmado"msgid "Rejection reason: {reason}"msgstr "Razón del rechazo: {reason}"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Reload"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/forgot-password.tsxmsgid "Remembered your password? <0>Sign In</0>"msgstr "¿Recordaste tu contraseña? <0>Iniciar sesión</0>"-#. placeholder {0}: customEmail.subject+#. placeholder {0}: envelope.documentMeta.subject#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0}"msgstr "Recordatorio: {0}"-#. placeholder {0}: document.team.name+#. placeholder {0}: envelope.team.name#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0} invited you to {recipientActionVerb} a document"msgstr "Recordatorio: {0} te invitó a {recipientActionVerb} un documento"@@ -6051,6 +6520,7 @@ msgstr "Recordatorio: Por favor {recipientActionVerb} tu documento"#: apps/remix/app/components/tables/organisation-members-table.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx#: apps/remix/app/components/general/teams/team-email-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document-signing/document-signing-field-container.tsx#: apps/remix/app/components/forms/branding-preferences-form.tsx#: apps/remix/app/components/forms/avatar-image.tsx@@ -6095,6 +6565,8 @@ msgstr "Repetir contraseña"msgid "Reply to email"msgstr "Responder al correo"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Reply To Email"@@ -6112,6 +6584,10 @@ msgstr ""msgid "Required field"msgstr "Campo obligatorio"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Required Field"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "Required scopes"msgstr ""@@ -6126,10 +6602,20 @@ msgstr "Re-sellar documento"msgid "Resend"msgstr "Reenviar"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Resend code"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Resend Confirmation Email"msgstr "Reenviar correo de confirmación"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Resend Document"+msgstr ""+#: apps/remix/app/components/general/teams/team-email-dropdown.tsxmsgid "Resend verification"msgstr "Reenviar verificación"@@ -6188,6 +6674,10 @@ msgstr "Acceso restringido"msgid "Retention of Documents"msgstr "Retención de Documentos"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Retried"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-passkey.tsxmsgid "Retry"msgstr "Reintentar"@@ -6196,6 +6686,7 @@ msgstr "Reintentar"#: apps/remix/app/routes/_unauthenticated+/organisation.invite.$token.tsx#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsx#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Return"msgstr "Regresar"@@ -6203,6 +6694,10 @@ msgstr "Regresar"msgid "Return to Documenso sign in page here"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to documents"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "Return to Home"msgstr "Regresar a la página de inicio"@@ -6212,6 +6707,10 @@ msgstr "Regresar a la página de inicio"msgid "Return to sign in"msgstr "Regresar para iniciar sesión"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to templates"+msgstr ""+#: packages/email/templates/organisation-account-link-confirmation.tsxmsgid "Review request"msgstr ""@@ -6231,6 +6730,10 @@ msgstr "Revocar acceso"msgid "Revoke all sessions"msgstr "Revocar todas las sesiones"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Right"+msgstr ""+#: apps/remix/app/components/tables/user-organisations-table.tsx#: apps/remix/app/components/tables/team-members-table.tsx#: apps/remix/app/components/tables/team-groups-table.tsx@@ -6263,10 +6766,20 @@ msgstr "Filas por página"msgid "Save"msgstr "Guardar"+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "Save failed"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-fields.tsxmsgid "Save Template"msgstr "Guardar plantilla"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "Sealing job started"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.members.tsx@@ -6320,6 +6833,7 @@ msgstr "Secreto"#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsx#: apps/remix/app/components/general/settings-nav-mobile.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Security"msgstr "Seguridad"@@ -6327,6 +6841,10 @@ msgstr "Seguridad"msgid "Security activity"msgstr "Actividad de seguridad"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "See the background jobs tab for the status"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-dropdown-field.tsx#: packages/ui/primitives/document-flow/types.ts#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsx@@ -6365,10 +6883,15 @@ msgstr "Seleccionar una plantilla que te gustaría mostrar en el perfil públicomsgid "Select a time zone"msgstr "Seleccione una zona horaria"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Select a value to sign into the field"+msgstr ""+#: packages/ui/components/document/document-global-auth-access-select.tsxmsgid "Select access methods"msgstr "Seleccione métodos de acceso"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: packages/ui/primitives/combobox.tsxmsgid "Select an option"msgstr "Seleccionar una opción"@@ -6377,6 +6900,7 @@ msgstr "Seleccionar una opción"msgid "Select an organisation to view teams"msgstr "Seleccione una organización para ver los equipos"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select at least"msgstr "Seleccionar al menos"@@ -6386,6 +6910,7 @@ msgstr "Seleccionar al menos"msgid "Select authentication methods"msgstr "Seleccionar métodos de autenticación"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Select default option"msgstr "Seleccionar opción predeterminada"@@ -6394,6 +6919,7 @@ msgstr "Seleccionar opción predeterminada"msgid "Select default role"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select direction"msgstr "Seleccione dirección"@@ -6432,6 +6958,10 @@ msgstr "Seleccionar clave de acceso"msgid "Select signature types"msgstr "Seleccione tipos de firma"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Select text align"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-create-dialog.tsxmsgid "Select the members to add to this group"msgstr "Seleccione a los miembros para agregar a este grupo"@@ -6449,6 +6979,12 @@ msgstr "Seleccionar activaciones"msgid "Select visibility"msgstr "Seleccionar visibilidad"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Selected Recipient"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -6469,6 +7005,9 @@ msgstr "Enviar correo de confirmación"msgid "Send document"msgstr "Enviar documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsxmsgid "Send Document"msgstr "Enviar documento"@@ -6513,10 +7052,15 @@ msgstr "Enviar correo electrónico de destinatario firmado"msgid "Send recipient signing request email"msgstr "Enviar correo electrónico de solicitud de firma de destinatario"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsxmsgid "Send reminder"msgstr "Enviar recordatorio"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Send reminders to the following recipients"+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "Send Test Webhook"msgstr "Enviar webhook de prueba"@@ -6567,6 +7111,7 @@ msgstr "Configura las propiedades de tu plantilla y la información del destinat#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/folder/folder-card.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Settings"msgstr "Configuraciones"@@ -6600,6 +7145,7 @@ msgstr "¡Comparte tu experiencia de firma!"msgid "Show"msgstr "Mostrar"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Show advanced settings"@@ -6609,11 +7155,6 @@ msgstr "Mostrar configuraciones avanzadas"msgid "Show templates in your public profile for your audience to sign and get started quickly"msgstr "Mostrar plantillas en tu perfil público para que tu audiencia firme y comience rápidamente"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Sign"-msgstr ""-#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -6627,9 +7168,21 @@ msgstr ""#: apps/remix/app/components/general/document-signing/document-signing-auth-password.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-2fa.tsx#: apps/remix/app/components/general/document/document-page-view-button.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsxmsgid "Sign"msgstr "Firmar"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Sign"+msgstr ""+#. placeholder {0}: recipient.name#. placeholder {1}: recipient.email#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx@@ -6648,8 +7201,8 @@ msgstr "Firmar como<0>{0} <1>({1})</1></0>"msgid "Sign document"msgstr "Firmar documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Sign Document"msgstr "Firmar Documento"@@ -6657,6 +7210,14 @@ msgstr "Firmar Documento"msgid "Sign Documents"msgstr "Firmar documentos"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign Dropdown Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign Email"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Sign field"@@ -6679,12 +7240,32 @@ msgstr "Iniciar sesión"msgid "Sign in to your account"msgstr "Inicia sesión en tu cuenta"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign Initials"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign Name"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Sign Number Field"+msgstr ""+#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx#: apps/remix/app/components/general/app-nav-mobile.tsxmsgid "Sign Out"msgstr "Cerrar sesión"+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+msgid "Sign Signature Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Sign Text Field"+msgstr ""+#: apps/remix/app/components/embed/embed-document-signing-page.tsx#: apps/remix/app/components/embed/embed-direct-template-client-page.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -6703,8 +7284,22 @@ msgstr "Regístrate con Google"msgid "Sign Up with OIDC"msgstr "Regístrate con OIDC"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign your email into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign your full name into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign your initials into the field"+msgstr ""+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -6730,6 +7325,10 @@ msgstr "La firma es demasiado pequeña"msgid "Signature Pad cannot be empty."msgstr "El área de firma no puede estar vacío."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Signature Settings"+msgstr ""+#: packages/ui/components/document/document-signature-settings-tooltip.tsxmsgid "Signature types"msgstr "Tipos de firma"@@ -6742,17 +7341,17 @@ msgstr "Firmas recolectadas"msgid "Signatures will appear once the document has been completed"msgstr "Las firmas aparecerán una vez que el documento se haya completado"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Signed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsxmsgid "Signed"msgstr "Firmado"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Signed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Signer"@@ -6803,6 +7402,7 @@ msgstr "Enlaces de firma"msgid "Signing links have been generated for this document."msgstr "Se han generado enlaces de firma para este documento."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Signing order is enabled."@@ -6831,6 +7431,7 @@ msgstr "Banner del sitio"msgid "Site Settings"msgstr "Configuraciones del sitio"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."msgstr "Algunos firmantes no han sido asignados a un campo de firma. Asigne al menos 1 campo de firma a cada firmante antes de continuar."@@ -6879,6 +7480,9 @@ msgstr "Algunos firmantes no han sido asignados a un campo de firma. Asigne al m#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-member-invite-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx@@ -6893,6 +7497,8 @@ msgstr "Algo salió mal al intentar verificar tu dirección de correo electróni#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Something went wrong while loading the document."msgstr "Algo salió mal al cargar el documento."@@ -6908,6 +7514,10 @@ msgstr "Algo salió mal al enviar el correo de confirmación."msgid "Something went wrong while updating the team billing subscription, please contact support."msgstr "Algo salió mal al actualizar la suscripción de facturación del equipo, por favor contacta al soporte."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Something went wrong while uploading this file"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.email.tsx@@ -6960,6 +7570,7 @@ msgstr "Estadísticas"#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table.tsx#: apps/remix/app/components/tables/admin-organisations-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsxmsgid "Status"msgstr "Estado"@@ -6981,10 +7592,12 @@ msgid "Stripe Customer ID"msgstr "ID de Cliente de Stripe"#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Subject"msgstr "Asunto"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Subject <0>(Optional)</0>"@@ -6994,6 +7607,10 @@ msgstr "Asunto <0>(Opcional)</0>"msgid "Submit"msgstr ""+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Submitted"+msgstr ""+#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx@@ -7033,7 +7650,6 @@ msgstr "Suscripción inválida"#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx@@ -7043,6 +7659,7 @@ msgstr "Suscripción inválida"#: apps/remix/app/components/general/teams/team-email-dropdown.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/organisation-update-form.tsx@@ -7074,6 +7691,7 @@ msgstr "Suscripción inválida"#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsxmsgid "Success"msgstr "Éxito"@@ -7107,6 +7725,10 @@ msgstr "Sincronizar"msgid "Sync Email Domains"msgstr "Sincronizar dominios de correo electrónico"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Sync failed, changes not saved"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "System Requirements"msgstr "Requisitos del Sistema"@@ -7259,7 +7881,7 @@ msgstr "Los equipos te ayudan a organizar tu trabajo y colaborar con otros. Creamsgid "Teams that this organisation group is currently assigned to"msgstr "Equipos a los que actualmente está asignado este grupo de organización"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx@@ -7285,6 +7907,10 @@ msgstr "Documento de plantilla subido"msgid "Template duplicated"msgstr "Plantilla duplicada"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Editor"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Template has been removed from your public profile."msgstr "La plantilla ha sido eliminada de tu perfil público."@@ -7305,6 +7931,10 @@ msgstr "Plantilla movida"msgid "Template saved"msgstr "Plantilla guardada"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Settings"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Template title"msgstr "Título de plantilla"@@ -7314,6 +7944,7 @@ msgid "Template updated successfully"msgstr "Plantilla actualizada con éxito"#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsxmsgid "Template uploaded"msgstr "Plantilla subida"@@ -7344,6 +7975,7 @@ msgstr "Fallo en el webhook de prueba"msgid "Test webhook sent"msgstr "Webhook de prueba enviado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx@@ -7352,6 +7984,7 @@ msgstr "Webhook de prueba enviado"msgid "Text"msgstr "Texto"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -7365,6 +7998,14 @@ msgstr "Alineación de texto"msgid "Text Color"msgstr "Color de texto"+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Text is required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Text Settings"+msgstr ""+#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Thank you for completing the signing process."msgstr "Gracias por completar el proceso de firma."@@ -7453,6 +8094,17 @@ msgstr "El documento será ocultado de tu cuenta"msgid "The document will be immediately sent to recipients if this is checked."msgstr "El documento se enviará inmediatamente a los destinatarios si esto está marcado."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "The document you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: packages/ui/components/document/document-send-email-message-helper.tsxmsgid "The document's name"msgstr "El nombre del documento"@@ -7610,6 +8262,7 @@ msgstr "El nombre del firmante"#: apps/remix/app/components/general/avatar-with-recipient.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "The signing link has been copied to your clipboard."msgstr "El enlace de firma ha sido copiado a tu portapapeles."@@ -7644,6 +8297,16 @@ msgstr "La plantilla se ha movido exitosamente."msgid "The template will be removed from your profile"msgstr "La plantilla será eliminada de tu perfil"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "The template you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+msgid ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "The test webhook has been successfully sent to your endpoint."msgstr "El webhook de prueba se ha enviado exitosamente a tu terminal."@@ -7755,6 +8418,10 @@ msgstr "Esta acción es reversible, pero ten cuidado ya que la cuenta podría vemsgid "This claim is locked and cannot be deleted."msgstr "Esta reclamo está bloqueado y no puede ser eliminado."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "This code will expire in {expiresInMinutes} minutes."+msgstr ""+#: packages/email/template-components/template-document-super-delete.tsxmsgid "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."msgstr "Este documento no se puede recuperar, si deseas impugnar la razón para documentos futuros, por favor contacta con el soporte."@@ -7767,6 +8434,7 @@ msgstr "Este documento no se puede cambiar"msgid "This document could not be deleted at this time. Please try again."msgstr "Este documento no se pudo eliminar en este momento. Por favor, inténtalo de nuevo."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsxmsgid "This document could not be duplicated at this time. Please try again."msgstr "Este documento no se pudo duplicar en este momento. Por favor, inténtalo de nuevo."@@ -7783,6 +8451,7 @@ msgstr "Este documento ya ha sido enviado a este destinatario. Ya no puede editamsgid "This document has been cancelled by the owner and is no longer available for others to sign."msgstr "Este documento ha sido cancelado por el propietario y ya no está disponible para que otros lo firmen."+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "This document has been cancelled by the owner."msgstr "Este documento ha sido cancelado por el propietario."@@ -7819,6 +8488,10 @@ msgstr "Este documento fue creado usando un enlace directo."msgid "This document was sent using <0>Documenso.</0>"msgstr "Este documento fue enviado usando <0>Documenso.</0>"+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This document will be duplicated."+msgstr ""+#: packages/email/template-components/template-document-rejection-confirmed.tsxmsgid "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."msgstr "Este correo electrónico confirma que ha rechazado el documento <0>\"{documentName}\"</0> enviado por {documentOwnerName}."@@ -7843,6 +8516,14 @@ msgstr "Este correo electrónico se envía al destinatario solicitando que firmemsgid "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."msgstr "Este correo electrónico se enviará al destinatario que acaba de firmar el documento, si todavía hay otros destinatarios que no han firmado."+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "This envelope could not be distributed at this time. Please try again."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "This envelope could not be resent at this time. Please try again."+msgstr ""+#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."msgstr "Este campo no se puede modificar ni eliminar. Cuando comparta el enlace directo de esta plantilla o lo agregue a su perfil público, cualquiera que acceda podrá ingresar su nombre y correo electrónico, y completar los campos que se le hayan asignado."@@ -7851,6 +8532,7 @@ msgstr "Este campo no se puede modificar ni eliminar. Cuando comparta el enlacemsgid "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."msgstr "Esta carpeta contiene múltiples elementos. Eliminarla eliminará todas las subcarpetas y moverá todos los documentos y plantillas anidados a la carpeta raíz."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "This is how the document will reach the recipients once the document is ready for signing."msgstr "Así es como el documento llegará a los destinatarios una vez que esté listo para firmarse."@@ -7867,6 +8549,10 @@ msgstr ""msgid "This is the URL which users will use to sign in to your organisation."msgstr ""+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "This item cannot be deleted"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/team.verify.email.$token.tsxmsgid "This link is invalid or has expired. Please contact your team to resend a verification."msgstr "Este enlace es inválido o ha expirado. Por favor, contacta a tu equipo para reenviar una verificación."@@ -7887,6 +8573,7 @@ msgstr "Esta clave de acceso ya ha sido registrada."msgid "This passkey is not configured for this application. Please login and add one in the user settings."msgstr "Esta clave de acceso no está configurada para esta aplicación. Por favor, inicia sesión y añade una en la configuración del usuario."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "This recipient can no longer be modified as they have signed a field, or completed the document."msgstr "Este destinatario ya no puede ser modificado ya que ha firmado un campo o completado el documento."@@ -7895,6 +8582,7 @@ msgstr "Este destinatario ya no puede ser modificado ya que ha firmado un campomsgid "This session has expired. Please try again."msgstr "Esta sesión ha expirado. Por favor, inténtalo de nuevo."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "This signer has already signed the document."msgstr "Este firmante ya ha firmado el documento."@@ -7911,6 +8599,10 @@ msgstr "Esta plantilla no se pudo eliminar en este momento. Por favor, inténtalmsgid "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."msgstr "Esta plantilla utiliza inserción de campos heredada, recomendamos usar el nuevo método para resultados más precisos."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This template will be duplicated."+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "This token is invalid or has expired. No action is needed."msgstr "Este token es inválido o ha expirado. No se necesita ninguna acción."@@ -7962,6 +8654,7 @@ msgid "Time zone"msgstr "Zona horaria"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -8110,6 +8803,7 @@ msgstr "Autenticación de dos factores"msgid "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."msgstr "Los códigos de recuperación de autenticación de dos factores se utilizan para acceder a tu cuenta en caso de perder el acceso a tu aplicación de autenticador."+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/forms/signin.tsxmsgid "Two-Factor Authentication"msgstr "Autenticación de dos factores"@@ -8130,17 +8824,17 @@ msgstr "La autenticación de dos factores ha sido desactivada para tu cuenta. Yamsgid "Two-Factor Re-Authentication"msgstr "Re-autenticación de Doble Factor"-#: packages/lib/constants/document.ts-msgctxt "Type signatute type"-msgid "Type"-msgstr ""-#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Type"msgstr "Tipo"+#: packages/lib/constants/document.ts+msgctxt "Type signatute type"+msgid "Type"+msgstr ""+#: apps/remix/app/components/general/app-command-menu.tsxmsgid "Type a command or search..."msgstr "Escribe un comando o busca..."@@ -8289,6 +8983,7 @@ msgstr "Grupo sin título"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-public-profile-templates-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/email-preferences-form.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx@@ -8420,15 +9115,15 @@ msgstr "Actualizar <0>{0}</0> a {planName}"msgid "Upgrade your plan to upload more documents"msgstr "Actualiza tu plan para cargar más documentos"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Upload"+msgstr "Subir"+#: packages/lib/constants/document.tsmsgctxt "Upload signatute type"msgid "Upload"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Upload"-msgstr "Subir"-#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Upload a CSV file to create multiple documents from this template. Each row represents one document with its recipient details."msgstr "Sube un archivo CSV para crear múltiples documentos a partir de esta plantilla. Cada fila representa un documento con los detalles del destinatario."@@ -8453,12 +9148,20 @@ msgstr "Subir CSV"msgid "Upload custom document"msgstr "Subir documento personalizado"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Upload disabled"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsx#: packages/ui/primitives/document-upload.tsxmsgid "Upload Document"msgstr "Cargar Documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Upload documents and add recipients"+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Upload failed"@@ -8498,6 +9201,10 @@ msgstr "El archivo subido es demasiado pequeño"msgid "Uploaded file not an allowed file type"msgstr "El archivo subido no es un tipo de archivo permitido"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Uploading"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Uploading document..."msgstr "Cargando documento..."@@ -8520,10 +9227,15 @@ msgstr "Usar Autenticador"msgid "Use Backup Code"msgstr "Usar Código de Respaldo"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Use Template"msgstr "Usar Plantilla"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Use your authenticator app to generate a code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Use your passkey for authentication"msgstr "Utilice su clave de acceso para la autenticación"@@ -8572,17 +9284,25 @@ msgstr "Un usuario con este correo electrónico ya existe. Por favor, use una dimsgid "Users"msgstr "Usuarios"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Validation"msgstr "Validación"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Value"msgstr "Valor"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Verification Code Required"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Verification Email Sent"msgstr "Correo Electrónico de Verificación Enviado"@@ -8591,6 +9311,10 @@ msgstr "Correo Electrónico de Verificación Enviado"msgid "Verification email sent successfully."msgstr "Correo electrónico de verificación enviado con éxito."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Verify & Complete"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsxmsgid "Verify Domain"msgstr "Verificar dominio"@@ -8607,7 +9331,8 @@ msgstr "Verifica tu dirección de correo electrónico"msgid "Verify your email address to unlock all features."msgstr "Verifica tu dirección de correo electrónico para desbloquear todas las funciones."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Verify your email to upload documents."msgstr "Verifica tu correo electrónico para subir documentos."@@ -8615,15 +9340,11 @@ msgstr "Verifica tu correo electrónico para subir documentos."msgid "Verify your team email address"msgstr "Verifica tu dirección de correo electrónico del equipo"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Vertical"msgstr "Vertical"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "View"-msgstr ""-#: apps/remix/app/components/tables/organisation-billing-invoices-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx@@ -8636,6 +9357,11 @@ msgstr ""msgid "View"msgstr "Ver"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "View"+msgstr ""+#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsxmsgid "View activity"msgstr "Ver actividad"@@ -8682,7 +9408,7 @@ msgstr "Ver registros DNS"msgid "View document"msgstr "Ver documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -8691,6 +9417,18 @@ msgstr "Ver documento"msgid "View Document"msgstr "Ver Documento"+#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to approve"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to assist"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to sign"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._index.tsxmsgid "View documents associated with this email"msgstr "Ver documentos asociados con este correo electrónico"@@ -8732,17 +9470,17 @@ msgstr "Ver equipos"msgid "View the DNS records for this email domain"msgstr "Ver los registros DNS para este dominio de correo electrónico"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Viewed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Viewed"msgstr "Visto"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Viewed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Viewer"@@ -8783,6 +9521,7 @@ msgstr "Esperando a que otros firmen"msgid "Waiting for Your Turn"msgstr "Esperando tu turno"+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Want to send slick signing links like this one? <0>Check out Documenso.</0>"msgstr "¿Quieres enviar enlaces de firma elegantes como este? <0>Consulta Documenso.</0>"@@ -8791,6 +9530,9 @@ msgstr "¿Quieres enviar enlaces de firma elegantes como este? <0>Consulta Docummsgid "Want your own public profile?"msgstr "¿Quieres tu propio perfil público?"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -8834,6 +9576,12 @@ msgstr "No pudimos actualizar la organización. Por favor, intente nuevamente."msgid "We couldn't update the provider. Please try again."msgstr ""+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-create-dialog.tsxmsgid "We encountered an error while creating the email. Please try again later."msgstr "Encontramos un error mientras creábamos el correo. Por favor, inténtalo de nuevo más tarde."@@ -8920,6 +9668,10 @@ msgstr "Encontramos un error desconocido al intentar eliminar este dominio de comsgid "We encountered an unknown error while attempting to remove this email. Please try again later."msgstr "Encontramos un error desconocido al intentar eliminar este correo. Por favor, inténtalo de nuevo más tarde."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/team-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "We encountered an unknown error while attempting to remove this group. Please try again later."@@ -8934,6 +9686,11 @@ msgstr "Encontramos un error desconocido al intentar eliminar esta plantilla demsgid "We encountered an unknown error while attempting to remove this user. Please try again later."msgstr "Encontramos un error desconocido al intentar eliminar a este usuario. Por favor, inténtalo de nuevo más tarde."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+msgstr ""+#: apps/remix/app/components/forms/reset-password.tsxmsgid "We encountered an unknown error while attempting to reset your password. Please try again later."msgstr "Encontramos un error desconocido al intentar restablecer tu contraseña. Por favor, inténtalo de nuevo más tarde."@@ -8957,6 +9714,10 @@ msgstr "Encontramos un error desconocido al intentar registrarte. Por favor, intmsgid "We encountered an unknown error while attempting to update the banner. Please try again later."msgstr "Encontramos un error desconocido al intentar actualizar el banner. Por favor, inténtalo de nuevo más tarde."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "We encountered an unknown error while attempting to update the envelope. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "We encountered an unknown error while attempting to update the template. Please try again later."msgstr "Encontramos un error desconocido al intentar actualizar la plantilla. Por favor, inténtalo de nuevo más tarde."@@ -9069,11 +9830,13 @@ msgid "We were unable to verify your email. If your email is not verified alreadmsgstr "No pudimos verificar tu correo electrónico. Si tu correo electrónico no está verificado ya, por favor inténtalo de nuevo."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We will generate signing links for you, which you can send to the recipients through your method of choice."msgstr "Generaremos enlaces de firma para ti, que podrás enviar a los destinatarios a través de tu método preferido."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We won't send anything to notify recipients."msgstr "No enviaremos nada para notificar a los destinatarios."@@ -9082,6 +9845,10 @@ msgstr "No enviaremos nada para notificar a los destinatarios."msgid "We'll get back to you as soon as possible via email."msgstr ""+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We'll send a 6-digit code to your email"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates._index.tsx#: apps/remix/app/components/tables/documents-table-empty-state.tsxmsgid "We're all empty"@@ -9095,6 +9862,10 @@ msgstr "Aún estamos esperando a que otros firmantes firmen este documento.<0/>Tmsgid "We've changed your password as you asked. You can now sign in with your new password."msgstr "Hemos cambiado tu contraseña como solicitaste. Ahora puedes iniciar sesión con tu nueva contraseña."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."msgstr "Hemos enviado un correo electrónico de confirmación a <0>{email}</0>. Por favor, revisa tu bandeja de entrada y haz clic en el enlace del correo electrónico para verificar tu cuenta."@@ -9159,6 +9930,7 @@ msgstr "¿Estabas intentando editar este documento en su lugar?"msgid "What you can do with teams:"msgstr "Lo que puedes hacer con los equipos:"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -9257,6 +10029,10 @@ msgstr ""msgid "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."msgstr "Estás a punto de eliminar el dominio de correo electrónico <0>{emailDomain}</0> de <1>{0}</1>. Todos los correos electrónicos asociados con este dominio serán eliminados."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You are about to remove the following document and all associated fields"+msgstr ""+#. placeholder {0}: organisation.name#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsxmsgid "You are about to remove the following email from <0>{0}</0>."@@ -9387,6 +10163,7 @@ msgstr "Puedes ver los documentos creados en tu panel de control bajo la secciómsgid "You can view the document and its status by clicking the button below."msgstr "Puede ver el documento y su estado haciendo clic en el botón de abajo."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "You cannot add assistants when signing order is disabled."@@ -9396,6 +10173,10 @@ msgstr "No puedes añadir asistentes cuando el orden de firma está deshabilitadmsgid "You cannot delete a group which has a higher role than you."msgstr "No puedes eliminar un grupo que tiene un rol superior al tuyo."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You cannot delete this item because the document has been sent to recipients"+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."msgstr "No puedes tener más de {MAXIMUM_PASSKEYS} claves de acceso."@@ -9421,7 +10202,8 @@ msgstr "No puedes eliminar miembros de este equipo si la función de heredar miemsgid "You cannot upload documents at this time."msgstr "No puede cargar documentos en este momento."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You cannot upload encrypted PDFs"msgstr "No puedes subir PDFs encriptados"@@ -9480,7 +10262,7 @@ msgstr "Se te ha solicitado firmar los siguientes documentos. Revisa cada documemsgid "You have declined the invitation from <0>{0}</0> to join their organisation."msgstr "Has rechazado la invitación de <0>{0}</0> para unirte a su organización."-#. placeholder {0}: `"${document.title}"`+#. placeholder {0}: `"${envelope.title}"`#: packages/lib/server-only/document/resend-document.ts#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "You have initiated the document {0} that requires you to {recipientActionVerb} it."@@ -9507,12 +10289,14 @@ msgstr "Has alcanzado el límite máximo de {0} plantillas directas. <0>¡Actualmsgid "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."msgstr "Has alcanzado el número máximo de equipos para tu plan. Por favor, contacta con ventas en <0>{SUPPORT_EMAIL}</0> si deseas ajustar tu plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You have reached your document limit for this month. Please upgrade your plan."msgstr "Ha alcanzado su límite de documentos para este mes. Por favor, actualice su plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: packages/ui/primitives/document-dropzone.tsxmsgid "You have reached your document limit."msgstr "Ha alcanzado su límite de documentos."@@ -9551,6 +10335,10 @@ msgstr "Has eliminado exitosamente este dominio de correo electrónico de la orgmsgid "You have successfully removed this email from the organisation."msgstr "Has eliminado exitosamente este correo de la organización."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You have successfully removed this envelope item."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "You have successfully removed this group from the organisation."msgstr "Has eliminado este grupo de la organización exitosamente."@@ -9599,11 +10387,19 @@ msgstr "Has verificado tu dirección de correo electrónico para <0>{0}</0>."msgid "You must enter '{deleteMessage}' to proceed"msgstr "Debes ingresar '{deleteMessage}' para continuar"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "You must select at least one item"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsxmsgid "You must type '{deleteMessage}' to confirm"msgstr "Debes escribir '{deleteMessage}' para confirmar"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "You need at least one recipient to add fields"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "You need to be an admin to manage API tokens."msgstr "Necesitas ser administrador para gestionar tokens de API."@@ -9685,7 +10481,8 @@ msgstr "Tu plan actual está vencido."msgid "Your direct signing templates"msgstr "Tus {0} plantillas de firma directa"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Your document failed to upload."msgstr "Tu documento no se pudo cargar."@@ -9714,7 +10511,8 @@ msgstr "Tu documento ha sido enviado con éxito."msgid "Your document has been successfully duplicated."msgstr "Tu documento ha sido duplicado con éxito."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Your document has been uploaded successfully."msgstr "Tu documento ha sido subido con éxito."@@ -9751,6 +10549,18 @@ msgstr "Tu correo electrónico está siendo utilizado actualmente por el equipomsgid "Your email preferences have been updated"msgstr "Tus preferencias de correo electrónico han sido actualizadas"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Your envelope has been distributed successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Your envelope has been resent successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Your envelope has been successfully duplicated."+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Your existing tokens"msgstr "Tus tokens existentes"@@ -9834,6 +10644,10 @@ msgstr "Tu equipo ha sido eliminado con éxito."msgid "Your team has been successfully updated."msgstr "Tu equipo ha sido actualizado con éxito."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template failed to upload."+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Your template has been created successfully"msgstr "Tu plantilla se ha creado exitosamente"@@ -9846,6 +10660,10 @@ msgstr "Tu plantilla ha sido duplicada con éxito."msgid "Your template has been successfully deleted."msgstr "Tu plantilla ha sido eliminada con éxito."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template has been uploaded successfully."+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxmsgid "Your template has been uploaded successfully. You will be redirected to the template page."msgstr "Tu plantilla ha sido cargada exitosamente. Serás redirigido a la página de plantillas."@@ -9870,6 +10688,18 @@ msgstr "¡Tu token se creó con éxito! ¡Asegúrate de copiarlo porque no podrmsgid "Your tokens will be shown here once you create them."msgstr "Tus tokens se mostrarán aquí una vez que los crees."+#: packages/lib/server-only/2fa/email/send-2fa-token-email.ts+msgid "Your two-factor authentication code"+msgstr ""++#: packages/email/templates/access-auth-2fa.tsx+msgid "Your verification code is {code}"+msgstr ""++#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Your verification code:"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "your-domain.com another-domain.com"msgstr ""diff --git a/packages/lib/translations/fr/web.po b/packages/lib/translations/fr/web.poindex f8baf3af8..aeb1997f6 100644--- a/packages/lib/translations/fr/web.po+++ b/packages/lib/translations/fr/web.po@@ -72,6 +72,11 @@ msgstr "{0, plural, one {(1 caractère de trop)} other {(# caractères de trop)}msgid "{0, plural, one {# character over the limit} other {# characters over the limit}}"msgstr "{0, plural, one {# caractère au-dessus de la limite} other {# caractères au-dessus de la limite}}"+#. placeholder {0}: fieldMeta?.characterLimit - (field.value?.length ?? 0)+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "{0, plural, one {# character remaining} other {# characters remaining}}"+msgstr ""+#. placeholder {0}: folder._count.documents#: apps/remix/app/components/general/folder/folder-card.tsxmsgid "{0, plural, one {# document} other {# documents}}"@@ -103,13 +108,25 @@ msgstr "{0, plural, one {# modèle} other {# modèles}}"msgid "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"msgstr "{0, plural, one {<0>Vous avez <1>1</1> invitation en attente</0>} other {<2>Vous avez <3>#</3> invitations en attente</2>}}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"+msgstr ""++#. placeholder {0}: fields.filter((field) => field.envelopeItemId === doc.id).length+#. placeholder {0}: recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id) .length+#: apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0, plural, one {1 Field} other {# Fields}}"+msgstr ""+#. placeholder {0}: autoSignableFields.filter((f) => f.type === fieldType).length#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsxmsgid "{0, plural, one {1 matching field} other {# matching fields}}"msgstr "{0, plural, one {1 champ correspondant} other {# champs correspondants}}"#. placeholder {0}: recipients.length-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxmsgid "{0, plural, one {1 Recipient} other {# Recipients}}"msgstr "{0, plural, one {1 Destinataire} other {# Destinataires}}"@@ -131,8 +148,13 @@ msgstr "{0}"msgid "{0} direct signing templates"msgstr "{0} modèles de signature directe"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0} fields remaining"+msgstr ""+#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{0} has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{0} vous a invité à {recipientActionVerb} le document \"{1}\"."@@ -144,7 +166,8 @@ msgstr "{0} vous a invité à {recipientActionVerb} un document"#. placeholder {0}: remaining.documents#. placeholder {1}: quota.documents-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "{0} of {1} documents remaining this month."msgstr "{0} des {1} documents restants ce mois-ci."@@ -156,13 +179,13 @@ msgid "{0} of {1} row(s) selected."msgstr "{0} sur {1} ligne(s) sélectionnée(s)."#. placeholder {0}: user.name || user.email-#. placeholder {1}: document.team.name-#. placeholder {2}: document.title+#. placeholder {1}: envelope.team.name+#. placeholder {2}: envelope.title#: packages/lib/server-only/document/resend-document.tsmsgid "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."msgstr "{0} représentant \"{1}\" vous a invité à {recipientActionVerb} le document \"{2}\"."-#. placeholder {0}: recipients.length+#. placeholder {0}: envelope.recipients.length#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxmsgid "{0} Recipient(s)"msgstr "{0} Destinataire(s)"@@ -214,7 +237,7 @@ msgid "{inviterName} has removed you from the document<0/>\"{documentName}\""msgstr "{inviterName} vous a retiré du document<0/>\"{documentName}\""#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{inviterName} représentant \"{0}\" vous a invité à {recipientActionVerb} le document \"{1}\"."@@ -346,7 +369,7 @@ msgstr "{recipientName} a rejeté le document \"{documentName}\""msgid "{recipientReference} has completed signing the document."msgstr "{recipientReference} a terminé de signer le document."-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsmsgid "{recipientReference} has signed \"{0}\""msgstr "{recipientReference} a signé \"{0}\""@@ -393,14 +416,26 @@ msgstr "{userName} a mis en copie le document"msgid "{userName} completed their task"msgstr "{userName} a terminé sa tâche"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} failed to validate a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} rejected the document"msgstr "{userName} a rejeté le document"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} requested a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} signed the document"msgstr "{userName} a signé le document"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} validated a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} viewed the document"msgstr "{userName} a consulté le document"@@ -410,6 +445,8 @@ msgid "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}msgstr "{visibleRows, plural, one {Affichage de # résultat.} other {Affichage de # résultats.}}"#. placeholder {0}: document.title+#. placeholder {0}: envelope.title+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "<0>\"{0}\"</0>is no longer available to sign"msgstr "<0>\"{0}\"</0> n'est plus disponible pour signer"@@ -442,6 +479,7 @@ msgstr ""msgid "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."msgstr "<0>Dessinée</0> - Une signature dessinée en utilisant une souris ou un stylet."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."msgstr "<0>Email</0> - Le destinataire recevra le document par e-mail pour signer, approuver, etc."@@ -466,10 +504,12 @@ msgstr "<0>Aucune restriction</0> - Le document peut être consulté directementmsgid "<0>None</0> - No authentication required"msgstr "<0>Aucun</0> - Aucune authentification requise"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>None</0> - We will generate links which you can send to the recipients manually."msgstr "<0>Aucun</0> - Nous générerons des liens que vous pourrez envoyer aux destinataires manuellement."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."msgstr "<0>Remarque</0> - Si vous utilisez des liens en combinaison avec des modèles directs, vous devrez envoyer manuellement les liens aux destinataires restants."@@ -554,6 +594,10 @@ msgstr ""msgid "401 Unauthorized"msgstr "401 Non autorisé"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "404 Document not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsxmsgid "404 Email domain not found"msgstr "404 Domaine email introuvable"@@ -562,6 +606,12 @@ msgstr "404 Domaine email introuvable"msgid "404 not found"msgstr "404 non trouvé"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "404 Not found"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsxmsgid "404 Not Found"msgstr ""@@ -584,6 +634,10 @@ msgstr "404 Profil non trouvé"msgid "404 Team not found"msgstr "404 Équipe non trouvée"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "404 Template not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsxmsgid "404 User not found"msgstr "404 Utilisateur non trouvé"@@ -850,6 +904,7 @@ msgstr "Action"#: apps/remix/app/components/tables/admin-organisations-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Actions"msgstr "Actions"@@ -872,6 +927,7 @@ msgstr "Abonnements actifs"msgid "Add"msgstr "Ajouter"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add 2 or more signers to enable signing order."msgstr ""@@ -884,6 +940,7 @@ msgstr "Ajoutez un domaine personnalisé pour envoyer des emails au nom de votremsgid "Add a document"msgstr "Ajouter un document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -907,6 +964,7 @@ msgstr "Ajouter un authentificateur pour servir de méthode d'authentification smsgid "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."msgstr "Ajouter un authentificateur pour servir de méthode d'authentification secondaire lors de la connexion ou lors de la signature de documents."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Add an external ID to the document. This can be used to identify the document in external systems."msgstr "Ajouter un ID externe au document. Cela peut être utilisé pour identifier le document dans les systèmes externes."@@ -941,6 +999,9 @@ msgid "Add Email Domain"msgstr "Ajouter un domaine email"#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: apps/remix/app/components/general/document/document-edit-form.tsxmsgid "Add Fields"msgstr "Ajouter des champs"@@ -975,6 +1036,7 @@ msgstr "Ajouter davantage"msgid "Add myself"msgstr "M'ajouter"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "Add Myself"msgstr "M'ajouter"@@ -996,6 +1058,7 @@ msgstr "Ajouter un destinataire fictif"msgid "Add Placeholders"msgstr "Ajouter des espaces réservés"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add Signer"@@ -1013,10 +1076,12 @@ msgstr "Ajouter des signataires et configurer les préférences de signature"msgid "Add team email"msgstr "Ajouter un e-mail d'équipe"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text"msgstr "Ajouter du texte"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text to the field"msgstr "Ajouter du texte au champ"@@ -1148,6 +1213,7 @@ msgstr "Permettre à tous les membres de l'organisation d'accéder à cette équmsgid "Allow document recipients to reply directly to this email address"msgstr "Autoriser les destinataires du document à répondre directement à cette adresse e-mail"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -1158,6 +1224,7 @@ msgstr "Permettre aux signataires de désigner le prochain signataire"msgid "Allowed Email Domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -1205,6 +1272,8 @@ msgstr "Un email avec cette adresse existe déjà."#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx#: apps/remix/app/components/forms/token.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/reset-password.tsx@@ -1386,7 +1455,8 @@ msgstr "Une erreur est survenue lors de la mise à jour de la signature."msgid "An error occurred while updating your profile."msgstr "Une erreur est survenue lors de la mise à jour de votre profil."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "An error occurred while uploading your document."msgstr "Une erreur est survenue lors de l'importation de votre document."@@ -1410,6 +1480,7 @@ msgstr "Une erreur inattendue est survenue."#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/admin+/site-settings.tsx#: apps/remix/app/components/general/app-command-menu.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/signup.tsx@@ -1446,6 +1517,7 @@ msgstr "Une erreur inattendue est survenue."#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/account-delete-dialog.tsx@@ -1487,11 +1559,6 @@ msgstr "Tokens API"msgid "App Version"msgstr "Version de l'application"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Approve"-msgstr ""-#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-button.tsx@@ -1501,19 +1568,27 @@ msgstr ""msgid "Approve"msgstr "Approuver"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Approve"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Approve Document"msgstr "Approuver le document"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Approved"+msgstr "Approuvé"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Approved"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Approved"-msgstr "Approuvé"+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "Approver"+msgstr ""#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"@@ -1576,6 +1651,7 @@ msgstr "Êtes-vous sûr de vouloir supprimer cette équipe ?"#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Are you sure?"msgstr "Êtes-vous sûr ?"@@ -1589,8 +1665,7 @@ msgctxt "Recipient role action verb"msgid "Assist"msgstr ""-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Assist Document"msgstr "Assister le Document"@@ -1616,20 +1691,21 @@ msgstr ""msgid "Assistants and Copy roles are currently not compatible with the multi-sign experience."msgstr "Les rôles d'assistant et de copie ne sont actuellement pas compatibles avec l'expérience multi-sign."+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Assisted"+msgstr "Assisté"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Assisted"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Assisted"-msgstr "Assisté"-#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role progressive verb"msgid "Assisting"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx#: packages/ui/primitives/template-flow/add-template-settings.types.tsx#: packages/ui/primitives/document-flow/add-settings.types.ts@@ -1662,6 +1738,10 @@ msgstr ""msgid "Authentication required"msgstr "Authentification requise"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Authenticator app"+msgstr ""+#: apps/remix/app/components/forms/avatar-image.tsxmsgid "Avatar"msgstr "Avatar"@@ -1691,6 +1771,10 @@ msgstr "Retour au tableau de bord"msgid "Background Color"msgstr "Couleur d'arrière-plan"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Background Jobs"+msgstr ""+#: apps/remix/app/components/forms/signin.tsx#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Backup Code"@@ -1828,6 +1912,7 @@ msgstr "Peut préparer"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/general/teams/team-email-usage.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -1866,6 +1951,13 @@ msgstr "Peut préparer"#: apps/remix/app/components/dialogs/team-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: apps/remix/app/components/dialogs/session-logout-all-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/passkey-create-dialog.tsx@@ -1888,6 +1980,10 @@ msgstr "Peut préparer"#: apps/remix/app/components/dialogs/folder-move-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -1911,10 +2007,15 @@ msgstr "Annulé par l'utilisateur"msgid "Cannot remove document"msgstr "Impossible de retirer le document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Cannot remove signer"msgstr "Impossible de supprimer le signataire"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Cannot upload items after the document has been sent"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Cc"@@ -1940,6 +2041,11 @@ msgctxt "Recipient role plural name"msgid "Ccers"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Center"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Character Limit"msgstr "Limite de caractères"@@ -1948,10 +2054,16 @@ msgstr "Limite de caractères"msgid "Charts"msgstr "Graphiques"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Checkbox"msgstr "Case à cocher"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Checkbox Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Checkbox values"msgstr "Valeurs de la case à cocher"@@ -1978,6 +2090,10 @@ msgstr "Choisissez comment le document atteindra les destinataires"msgid "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."msgstr "Choisissez comment distribuer votre document aux destinataires. L'email enverra des notifications, Aucun générera des liens de signature pour une distribution manuelle."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Choose verification method"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Choose your preferred authentication method:"msgstr "Choisissez votre méthode d'authentification préférée:"@@ -2025,6 +2141,7 @@ msgstr "Cliquez ici pour importer"msgid "Click to copy signing link for sending to recipient"msgstr "Cliquez pour copier le lien de signature à envoyer au destinataire"+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx#: apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -2064,6 +2181,8 @@ msgstr ""#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Close"msgstr "Fermer"@@ -2103,7 +2222,7 @@ msgstr "Compléter le Document"msgid "Complete Signing"msgstr "Compléter la signature"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Complete the fields for the following signers."msgstr ""@@ -2112,8 +2231,10 @@ msgstr ""msgid "Complete Viewing"msgstr "Compléter la visualisation"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx#: packages/lib/constants/document.ts@@ -2157,6 +2278,14 @@ msgstr "Configurer le destinataire direct"msgid "Configure Document"msgstr "Configurer le document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure document settings and options before sending."+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure email settings for the document"+msgstr ""+#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -2171,6 +2300,10 @@ msgstr "Configurer les paramètres généraux pour le document."msgid "Configure general settings for the template."msgstr "Configurer les paramètres généraux pour le modèle."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure security settings for the document"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Configure template"msgstr "Configurer le modèle"@@ -2305,6 +2438,7 @@ msgstr "Contrôle la visibilité par défaut d'un document importé."msgid "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."msgstr "Contrôle le formatage du message qui sera envoyé lors de l'invitation d'un destinataire à signer un document. Si un message personnalisé a été fourni lors de la configuration du document, il sera utilisé à la place."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."msgstr "Contrôle la langue du document, y compris la langue à utiliser pour les notifications par email et le certificat final qui est généré et attaché au document."@@ -2322,6 +2456,7 @@ msgid "Controls which signatures are allowed to be used when signing a document.msgstr "Contrôle quelles signatures sont autorisées lors de la signature d'un document."#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copied"msgstr "Copié"@@ -2339,12 +2474,14 @@ msgstr "Copié"#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/components/document/document-share-button.tsxmsgid "Copied to clipboard"msgstr "Copié dans le presse-papiers"#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copy"msgstr "Copier"@@ -2445,7 +2582,7 @@ msgstr "Créer une réclamation"msgid "Create Claim"msgstr "Créer une réclamation"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Create Direct Link"msgstr "Créer un lien direct"@@ -2645,6 +2782,7 @@ msgid "Dashboard"msgstr "Tableau de bord"#: apps/remix/app/components/tables/settings-security-activity-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-date-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -2656,12 +2794,17 @@ msgstr "Date"msgid "Date created"msgstr "Date de création"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Date Format"msgstr "Format de date"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Date Settings"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: packages/email/templates/organisation-invite.tsx@@ -2700,6 +2843,10 @@ msgstr "Paramètres de Signature par Défaut"msgid "Default Time Zone"msgstr "Fuseau horaire par défaut"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Default Value"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "delete"msgstr "supprimer"@@ -2731,6 +2878,7 @@ msgstr "supprimer"#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/claim-delete-dialog.tsxmsgid "Delete"@@ -2770,6 +2918,7 @@ msgstr "Supprimer le compte"msgid "Delete document"msgstr "Supprimer le document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -2821,6 +2970,10 @@ msgstr "Supprimer l'équipe"msgid "Delete team group"msgstr "Supprimer le groupe d'équipe"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Delete Template"+msgstr ""+#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Delete the document. This action is irreversible so proceed with caution."msgstr "Supprimez le document. Cette action est irréversible, soyez prudent."@@ -2872,6 +3025,7 @@ msgstr "Lien direct"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsxmsgid "Direct Link"msgstr "Lien direct"@@ -2909,6 +3063,7 @@ msgstr "Modèle de lien direct supprimé"msgid "Direct template link usage exceeded ({0}/{1})"msgstr "L'utilisation du lien de modèle direct a été dépassée ({0}/{1})"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Direction"msgstr "Direction"@@ -3002,22 +3157,27 @@ msgstr "Documenso supprimera <0>tous vos documents</0>, ainsi que tous vos docummsgid "Document"msgstr "Document"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#. placeholder {1}: recipient.name#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejected by {1}"msgstr "Document \"{0}\" - Rejeté par {1}"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejection Confirmed"msgstr "Document \"{0}\" - Rejet Confirmé"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsmsgid "Document \"{0}\" Cancelled"msgstr "Document \"{0}\" Annulé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document & Recipients"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/document/document-global-auth-access-select.tsx@@ -3038,21 +3198,22 @@ msgid "Document Approved"msgstr "Document Approuvé"#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx-#: packages/lib/server-only/document/super-delete-document.ts+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: packages/lib/server-only/document/delete-document.ts+#: packages/lib/server-only/admin/admin-super-delete-document.tsmsgid "Document Cancelled"msgstr "Document Annulé"+#: apps/remix/app/components/general/document/document-status.tsx+msgid "Document completed"+msgstr "Document terminé"+#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document completed"msgstr ""-#: apps/remix/app/components/general/document/document-status.tsx-msgid "Document completed"-msgstr "Document terminé"-#: packages/ui/components/document/document-email-checkboxes.tsx#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document completed email"@@ -3062,15 +3223,15 @@ msgstr "E-mail de document complété"msgid "Document Completed!"msgstr "Document Complété !"+#: apps/remix/app/components/dialogs/template-use-dialog.tsx+msgid "Document created"+msgstr "Document créé"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document created"msgstr ""-#: apps/remix/app/components/dialogs/template-use-dialog.tsx-msgid "Document created"-msgstr "Document créé"-#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Document Created"msgstr "Document créé"@@ -3093,17 +3254,17 @@ msgstr "Document créé en utilisant un <0>lien direct</0>"msgid "Document Creation"msgstr "Création de document"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"-msgid "Document deleted"-msgstr ""-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Document deleted"msgstr "Document supprimé"+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"+msgid "Document deleted"+msgstr ""+#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document deleted email"msgstr "E-mail de document supprimé"@@ -3112,6 +3273,8 @@ msgstr "E-mail de document supprimé"msgid "Document Deleted!"msgstr "Document Supprimé !"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Document Distribution Method"@@ -3125,6 +3288,10 @@ msgstr "Brouillon de document"msgid "Document Duplicated"msgstr "Document dupliqué"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Editor"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document external ID updated"@@ -3134,7 +3301,6 @@ msgstr ""msgid "Document found in your account"msgstr "Document trouvé dans votre compte"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Document ID"msgstr "ID du document"@@ -3210,18 +3376,18 @@ msgstr "Document rejeté"msgid "Document Rejected"msgstr "Document Rejeté"-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx-msgid "Document resealed"-msgstr "Document resealé"+#: apps/remix/app/components/general/document/document-edit-form.tsx+msgid "Document sent"+msgstr "Document envoyé"#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document sent"msgstr ""-#: apps/remix/app/components/general/document/document-edit-form.tsx-msgid "Document sent"-msgstr "Document envoyé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Settings"+msgstr ""#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Document Signed"@@ -3244,6 +3410,10 @@ msgstr "Statut du document"msgid "Document title"msgstr "Titre du document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Document Title"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document title updated"@@ -3258,11 +3428,13 @@ msgstr ""msgid "Document updated successfully"msgstr "Document mis à jour avec succès"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Document upload disabled due to unpaid invoices"msgstr "Importation de documents désactivé en raison de factures impayées"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Document uploaded"msgstr "Document importé"@@ -3276,6 +3448,10 @@ msgstr ""msgid "Document Viewed"msgstr "Document consulté"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Document visibility"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document visibility updated"@@ -3291,7 +3467,7 @@ msgstr ""#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/_layout.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -3363,15 +3539,21 @@ msgid "Download Certificate"msgstr "Télécharger le certificat"#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsxmsgid "Download Original"msgstr "Télécharger l'original"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Download PDF"+msgstr ""+#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Download Template CSV"msgstr "Télécharger le modèle CSV"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: packages/lib/constants/document.tsmsgid "Draft"@@ -3398,42 +3580,68 @@ msgstr "Glissez-déposez ou cliquez pour importer"msgid "Drag and drop your PDF file here"msgstr "Faites glisser et déposez votre fichier PDF ici"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Draw"+msgstr "Dessiner"+#: packages/lib/constants/document.tsmsgctxt "Draw signatute type"msgid "Draw"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Draw"-msgstr "Dessiner"-#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Drop your document here"msgstr "Déposez votre document ici"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "Dropdown"msgstr "Liste déroulante"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown must have at least one option"+msgstr ""+#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Dropdown options"msgstr "Options de liste déroulante"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Dropdown Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown values"+msgstr ""+#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsx#: apps/remix/app/components/dialogs/template-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate"msgstr "Dupliquer"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Document"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate on all pages"msgstr "Dupliquer sur toutes les pages"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Template"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks._index.tsx#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx@@ -3471,6 +3679,10 @@ msgstr "Divulgation de signature électronique"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-email-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/general/direct-template/direct-template-configure-form.tsx@@ -3548,6 +3760,10 @@ msgstr "Domaines de messagerie"msgid "Email domains synced"msgstr "Domaines de messagerie synchronisés"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Email is required"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Email Options"msgstr "Options d'email"@@ -3567,6 +3783,8 @@ msgstr "Préférences de messagerie mises à jour"msgid "Email resent"msgstr "Email renvoyé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Email Sender"@@ -3580,6 +3798,14 @@ msgstr "Email envoyé"msgid "Email sent!"msgstr "Email envoyé !"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Email Settings"+msgstr ""++#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Email verification"+msgstr ""+#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsxmsgid "Email verification has been removed"msgstr "La vérification par email a été supprimée"@@ -3644,6 +3870,7 @@ msgstr "Activez la personnalisation de la marque pour tous les documents de cettmsgid "Enable Direct Link Signing"msgstr "Activer la signature de lien direct"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -3681,6 +3908,10 @@ msgstr "Entrez le nom de la réclamation"msgid "Enter the domain you want to use for sending emails (without http:// or www)"msgstr "Entrez le domaine que vous souhaitez utiliser pour l'envoi des e-mails (sans http:// ou www)"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Enter verification code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your 2FA code"msgstr "Entrez votre code 2FA"@@ -3701,11 +3932,16 @@ msgstr "Entrez votre adresse e-mail pour recevoir le document complété."msgid "Enter your name"msgstr "Entrez votre nom"+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Enter your number here"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your password"msgstr "Entrez votre mot de passe"#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsxmsgid "Enter your text here"msgstr "Entrez votre texte ici"@@ -3713,6 +3949,34 @@ msgstr "Entrez votre texte ici"msgid "Enterprise"msgstr "Entreprise"+#: packages/ui/primitives/document-upload.tsx+msgid "Envelope (beta)"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Envelope distributed"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Envelope Duplicated"+msgstr ""++#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+msgid "Envelope ID"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Envelope resent"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Envelope Title"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Envelope updated"+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -3753,7 +4017,8 @@ msgstr "Entreprise"#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsx-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx@@ -3814,11 +4079,17 @@ msgstr "Délai dépassé"msgid "Expired"msgstr "Expiré"+#. placeholder {0}: DateTime.fromMillis(Math.max(millisecondsRemaining, 0)).toFormat( 'mm:ss', )+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Expires in {0}"+msgstr ""+#. placeholder {0}: i18n.date(token.expires, DateTime.DATETIME_FULL)#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Expires on {0}"msgstr "Expire le {0}"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "External ID"@@ -3902,10 +4173,12 @@ msgstr "Échoués : {failedCount}"msgid "Feature Flags"msgstr "Drapeaux de fonctionnalités"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field character limit"msgstr "Limite de caractères du champ"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -3915,16 +4188,20 @@ msgstr "Limite de caractères du champ"msgid "Field font size"msgstr "Taille de police du champ"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Field format"msgstr "Format du champ"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Field label"msgstr "Étiquette du champ"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field placeholder"msgstr "Espace réservé du champ"@@ -3952,7 +4229,8 @@ msgstr "Champs"msgid "Fields updated"msgstr "Champs mis à jour"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"msgstr "Le fichier ne peut pas dépasser {APP_DOCUMENT_UPLOAD_SIZE_LIMIT} Mo"@@ -4010,6 +4288,7 @@ msgstr "Paramètres du dossier"msgid "Folder updated successfully"msgstr "Dossier mis à jour avec succès"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -4049,6 +4328,11 @@ msgstr "Gratuit"msgid "Free Signature"msgstr "Signature gratuite"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Free Signature Settings"+msgstr ""++#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -4064,6 +4348,7 @@ msgstr "Nom complet"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-page.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx@@ -4074,6 +4359,7 @@ msgstr "Général"msgid "Generate DKIM Records"msgstr "Générer des enregistrements DKIM"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Generate Links"msgstr "Générer des liens"@@ -4085,7 +4371,9 @@ msgstr "Authentification d'action de destinataire globale"#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsxmsgid "Go back"@@ -4094,7 +4382,9 @@ msgstr "Retour"#: apps/remix/app/routes/_recipient+/_layout.tsx#: apps/remix/app/routes/_profile+/_layout.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: packages/ui/primitives/document-flow/document-flow-root.tsxmsgid "Go Back"@@ -4109,10 +4399,12 @@ msgstr "Revenir au tableau de bord"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Go Back Home"msgstr "Revenir au tableau de bord"#: apps/remix/app/routes/_authenticated+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxmsgid "Go home"msgstr "Retour à l'accueil"@@ -4163,22 +4455,25 @@ msgstr "Nom du groupe"msgid "Groups"msgstr "Groupes"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to approve this document"msgstr "t'a invité à approuver ce document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to assist this document"msgstr "vous a invité à aider ce document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to sign this document"msgstr "t'a invité à signer ce document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to view this document"msgstr "t'a invité à voir ce document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -4248,6 +4543,10 @@ msgstr "Salut, je suis Timur"msgid "Hi {userName},"msgstr "Bonjour {userName},"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+msgstr ""+#: packages/email/templates/reset-password.tsxmsgid "Hi, {userName} <0>({userEmail})</0>"msgstr "Bonjour, {userName} <0>({userEmail})</0>"@@ -4269,6 +4568,7 @@ msgstr "Accueil"msgid "Home (No Folder)"msgstr "Accueil (Pas de Dossier)"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Horizontal"msgstr "Horizontal"@@ -4322,6 +4622,10 @@ msgstr "ID copié dans le presse-papiers"msgid "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."msgstr "Si vous rencontrez un problème avec votre abonnement, veuillez nous contacter à <0>{SUPPORT_EMAIL}</0>."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "If you didn't request this verification code, you can safely ignore this email."+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."msgstr "Si vous ne souhaitez pas utiliser l'authentificateur proposé, vous pouvez le fermer, ce qui affichera l'authentificateur suivant disponible."@@ -4388,11 +4692,29 @@ msgstr "Hériter des membres de l'organisation"msgid "Inherited subscription claim"msgstr "Réclamation d'abonnement héritée"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-initials-field.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Initials"msgstr "Initiales"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Initials are required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Initials Settings"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Insert a value into the number field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Insert a value into the text field"+msgstr ""+#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsxmsgid "Inserted"msgstr "Inséré"@@ -4409,6 +4731,7 @@ msgstr "Code invalide. Veuillez réessayer."msgid "Invalid domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.types.tsmsgid "Invalid email"msgstr "Email invalide"@@ -4531,6 +4854,8 @@ msgstr ""msgid "Joined {0}"msgstr "A rejoint {0}"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -4541,6 +4866,7 @@ msgstr "Étiquette"#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -4568,6 +4894,10 @@ msgstr "Dernière activité"msgid "Last modified"msgstr "Dernière modification"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Last Retried"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Last updated"msgstr "Dernière mise à jour"@@ -4604,6 +4934,10 @@ msgstr "Laisser vide pour hériter de l'organisation."msgid "Leave organisation"msgstr "Quitter l'organisation"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Left"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "Legality of Electronic Signatures"msgstr "Légalité des signatures électroniques"@@ -4654,9 +4988,16 @@ msgstr "Écoute {0}"msgid "Load older activity"msgstr "Charger l'activité plus ancienne"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Loading"+msgstr ""+#: apps/remix/app/components/general/skeletons/document-edit-skeleton.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Loading document..."msgstr "Chargement du document..."@@ -4722,7 +5063,7 @@ msgstr "Gérer la facturation"msgid "Manage details for this public template"msgstr "Gérer les détails de ce modèle public"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Manage Direct Link"msgstr "Gérer le lien direct"@@ -4847,6 +5188,7 @@ msgstr "MAU (document terminé)"msgid "MAU (signed in)"msgstr "MAU (connecté)"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Max"msgstr "Maximum"@@ -4888,7 +5230,9 @@ msgstr "Membre depuis"msgid "Members"msgstr "Membres"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Message"@@ -4898,6 +5242,7 @@ msgstr "Message"msgid "Message <0>(Optional)</0>"msgstr "Message <0>(Optionnel)</0>"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Min"msgstr "Min"@@ -4970,9 +5315,13 @@ msgstr "N/A"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/admin-leaderboard-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/forms/subscription-claim-form.tsx@@ -4995,9 +5344,14 @@ msgid "Name"msgstr "Nom"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsxmsgid "Name is required"msgstr "Le nom est requis"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Name Settings"+msgstr ""+#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Need to sign documents?"msgstr "Besoin de signer des documents ?"@@ -5055,6 +5409,12 @@ msgstr "Non"msgid "No active drafts"msgstr "Pas de brouillons actifs"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "No documents found"+msgstr ""+#: apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxmsgid "No folders found"@@ -5094,6 +5454,7 @@ msgstr "Aucun destinataire correspondant à cette description n'a été trouvé.#: apps/remix/app/components/general/template/template-page-view-recipients.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "No recipients"msgstr "Aucun destinataire"@@ -5155,11 +5516,18 @@ msgid "No worries, it happens! Enter your email and we'll email you a special limsgstr "Pas de soucis, ça arrive ! Entrez votre email et nous vous enverrons un lien spécial pour réinitialiser votre mot de passe."#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/lib/constants/document.tsmsgid "None"msgstr "Aucun"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Not found"+msgstr ""+#: apps/remix/app/components/forms/signin.tsxmsgid "Not supported"msgstr "Non pris en charge"@@ -5169,6 +5537,7 @@ msgstr "Non pris en charge"msgid "Nothing to do"msgstr "Rien à faire"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-number-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -5176,6 +5545,7 @@ msgstr "Rien à faire"msgid "Number"msgstr "Numéro"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Number format"msgstr "Format de numéro"@@ -5190,23 +5560,27 @@ msgstr "Nombre de membres autorisés. 0 = Illimité"msgid "Number of teams allowed. 0 = Unlimited"msgstr "Nombre d'équipes autorisées. 0 = Illimité"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Number Settings"+msgstr ""+#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to approve this document"msgstr "au nom de \"{0}\" vous a invité à approuver ce document"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to assist this document"msgstr "au nom de \"{0}\" vous a invité à aider ce document"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to sign this document"msgstr "au nom de \"{0}\" vous a invité à signer ce document"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to view this document"msgstr "au nom de \"{0}\" vous a invité à voir ce document"@@ -5269,6 +5643,8 @@ msgid "Only PDF files are allowed"msgstr ""#: apps/remix/app/routes/_profile+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsxmsgid "Oops! Something went wrong."@@ -5278,6 +5654,14 @@ msgstr "Oups ! Quelque chose a mal tourné."msgid "Opened"msgstr "Ouvert"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Option is required"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Option value cannot be empty"+msgstr ""+#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Or"@@ -5444,6 +5828,7 @@ msgstr "Page {0} sur {1}"#. placeholder {0}: i + 1#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Page {0} of {numPages}"msgstr "Page {0} sur {numPages}"@@ -5532,6 +5917,7 @@ msgstr "Paiement en retard"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/components/tables/organisation-email-domains-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsx@@ -5581,6 +5967,7 @@ msgstr "Compte personnel"msgid "Personal Inbox"msgstr "Boîte de réception personnelle"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Pick a number"msgstr "Choisissez un numéro"@@ -5597,6 +5984,13 @@ msgstr "Choisissez l'un des accords suivants ci-dessous et commencez à signer pmsgid "Pin"msgstr "Épingler"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Place and configure form fields in the document"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -5671,7 +6065,11 @@ msgstr "Veuillez entrer un nom significatif pour votre token. Cela vous aideramsgid "Please enter a valid name."msgstr "Veuiillez entrer un nom valide."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Please enter a valid number"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please mark as viewed to complete."msgstr ""@@ -5707,6 +6105,10 @@ msgstr "Veuillez noter que cette action est irréversible. Une fois confirmée,msgid "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"msgstr "Veuillez noter que vous perdrez l'accès à tous les documents associés à cette équipe et que tous les membres seront supprimés et notifiés"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please open your authenticator app and enter the 6-digit code for this document."+msgstr ""+#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."msgstr "Veuillez fournir un token de l'authentificateur, ou un code de secours. Si vous n'avez pas de code de secours disponible, veuillez contacter le support."@@ -5715,11 +6117,11 @@ msgstr "Veuillez fournir un token de l'authentificateur, ou un code de secours.msgid "Please provide a token from your authenticator, or a backup code."msgstr "Veuillez fournir un token de votre authentificateur, ou un code de secours."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before approving."msgstr "Veuillez examiner le document avant d'approuver."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before signing."msgstr "Veuillez examiner le document avant de signer."@@ -5727,6 +6129,10 @@ msgstr "Veuillez examiner le document avant de signer."msgid "Please select a PDF file"msgstr "Veuillez sélectionner un fichier PDF"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please select how you'd like to receive your verification code."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-create-dialog.tsxmsgid "Please try a different domain."msgstr "Veuillez essayer un autre domaine."@@ -5742,6 +6148,8 @@ msgstr "Veuillez réessayer plus tard."#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Please try again or contact our support."msgstr "Veuillez réessayer ou contacter notre support."@@ -5755,6 +6163,11 @@ msgstr "Veuiillez taper {0} pour confirmer"msgid "Please type <0>{0}</0> to confirm."msgstr "Veuillez taper <0>{0}</0> pour confirmer."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Please upload a document to continue"+msgstr ""+#: apps/remix/app/components/forms/branding-preferences-form.tsxmsgid "Please upload a logo"msgstr "Veuillez télécharger un logo"@@ -5770,6 +6183,7 @@ msgstr "Modèle CSV pré-formaté avec des données d'exemple."msgid "Preferences"msgstr "Préférences"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/forms/document-preferences-form.tsxmsgid "Preview"msgstr "Aperçu"@@ -5778,11 +6192,29 @@ msgstr "Aperçu"msgid "Preview and configure template."msgstr "Aperçu et configurer le modèle."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview Mode"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Preview the document before sending"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview what the signed document will look like with placeholder data"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/general/template/template-type.tsxmsgid "Private"msgstr "Privé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Private Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Private templates can only be modified and viewed by you."msgstr "Les modèles privés ne peuvent être modifiés et consultés que par vous."@@ -5843,14 +6275,28 @@ msgstr "Profil public"msgid "Public profile URL"msgstr "URL du profil public"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Public Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."msgstr "Les modèles publics sont connectés à votre profil public. Toute modification apportée aux modèles publics apparaîtra également dans votre profil public."+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Quick Actions"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Radio"msgstr "Radio"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Radio Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-radio-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsxmsgid "Radio values"msgstr "Valeurs radio"@@ -5863,6 +6309,10 @@ msgstr "Valeurs radio"msgid "Read only"msgstr "Lecture seule"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Read Only"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.support.tsxmsgid "Read our documentation to get started with Documenso."msgstr ""@@ -5918,9 +6368,13 @@ msgstr "Documents récents"#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsx#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.tsmsgid "Recipient"msgstr "Destinataire"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/recipient/recipient-action-auth-select.tsx@@ -5955,6 +6409,10 @@ msgstr "Destinataires"msgid "Recipients metrics"msgstr "Métriques des destinataires"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Recipients will be able to sign the document once sent"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Recipients will still retain their copy of the document"msgstr "Les destinataires conservent toujours leur copie du document"@@ -5987,12 +6445,17 @@ msgstr "Rouge"msgid "Redirect URI"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Redirect URL"msgstr "URL de redirection"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+msgid "Redirecting"+msgstr ""+#: apps/remix/app/components/general/claim-account.tsx#: apps/remix/app/components/forms/signup.tsxmsgid "Registration Successful"@@ -6001,12 +6464,13 @@ msgstr "Inscription réussie"#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Reject Document"msgstr "Rejeter le Document"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx@@ -6022,16 +6486,21 @@ msgstr "Rejet Confirmé"msgid "Rejection reason: {reason}"msgstr "Motif du rejet : {reason}"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Reload"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/forgot-password.tsxmsgid "Remembered your password? <0>Sign In</0>"msgstr "Vous vous souvenez de votre mot de passe ? <0>Connectez-vous</0>"-#. placeholder {0}: customEmail.subject+#. placeholder {0}: envelope.documentMeta.subject#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0}"msgstr "Rappel : {0}"-#. placeholder {0}: document.team.name+#. placeholder {0}: envelope.team.name#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0} invited you to {recipientActionVerb} a document"msgstr "Rappel : {0} vous a invité à {recipientActionVerb} un document"@@ -6051,6 +6520,7 @@ msgstr "Rappel : Veuillez {recipientActionVerb} votre document"#: apps/remix/app/components/tables/organisation-members-table.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx#: apps/remix/app/components/general/teams/team-email-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document-signing/document-signing-field-container.tsx#: apps/remix/app/components/forms/branding-preferences-form.tsx#: apps/remix/app/components/forms/avatar-image.tsx@@ -6095,6 +6565,8 @@ msgstr "Répéter le mot de passe"msgid "Reply to email"msgstr "Répondre à l'e-mail"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Reply To Email"@@ -6112,6 +6584,10 @@ msgstr ""msgid "Required field"msgstr "Champ requis"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Required Field"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "Required scopes"msgstr ""@@ -6126,10 +6602,20 @@ msgstr "Rescellage du document"msgid "Resend"msgstr "Renvoyer"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Resend code"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Resend Confirmation Email"msgstr "Renvoyer l'e-mail de confirmation"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Resend Document"+msgstr ""+#: apps/remix/app/components/general/teams/team-email-dropdown.tsxmsgid "Resend verification"msgstr "Renvoyer la vérification"@@ -6188,6 +6674,10 @@ msgstr "Accès restreint"msgid "Retention of Documents"msgstr "Conservation des documents"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Retried"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-passkey.tsxmsgid "Retry"msgstr "Réessayer"@@ -6196,6 +6686,7 @@ msgstr "Réessayer"#: apps/remix/app/routes/_unauthenticated+/organisation.invite.$token.tsx#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsx#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Return"msgstr "Retour"@@ -6203,6 +6694,10 @@ msgstr "Retour"msgid "Return to Documenso sign in page here"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to documents"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "Return to Home"msgstr "Retour à l'accueil"@@ -6212,6 +6707,10 @@ msgstr "Retour à l'accueil"msgid "Return to sign in"msgstr "Retour à la connexion"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to templates"+msgstr ""+#: packages/email/templates/organisation-account-link-confirmation.tsxmsgid "Review request"msgstr ""@@ -6231,6 +6730,10 @@ msgstr "Révoquer l'accès"msgid "Revoke all sessions"msgstr "Révoquer toutes les sessions"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Right"+msgstr ""+#: apps/remix/app/components/tables/user-organisations-table.tsx#: apps/remix/app/components/tables/team-members-table.tsx#: apps/remix/app/components/tables/team-groups-table.tsx@@ -6263,10 +6766,20 @@ msgstr "Lignes par page"msgid "Save"msgstr "Sauvegarder"+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "Save failed"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-fields.tsxmsgid "Save Template"msgstr "Sauvegarder le modèle"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "Sealing job started"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.members.tsx@@ -6320,6 +6833,7 @@ msgstr "Secret"#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsx#: apps/remix/app/components/general/settings-nav-mobile.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Security"msgstr "Sécurité"@@ -6327,6 +6841,10 @@ msgstr "Sécurité"msgid "Security activity"msgstr "Activité de sécurité"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "See the background jobs tab for the status"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-dropdown-field.tsx#: packages/ui/primitives/document-flow/types.ts#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsx@@ -6365,10 +6883,15 @@ msgstr "Sélectionnez un modèle que vous souhaitez afficher sur le profil publimsgid "Select a time zone"msgstr "Sélectionner un fuseau horaire"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Select a value to sign into the field"+msgstr ""+#: packages/ui/components/document/document-global-auth-access-select.tsxmsgid "Select access methods"msgstr "Sélectionnez les méthodes d'accès"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: packages/ui/primitives/combobox.tsxmsgid "Select an option"msgstr "Sélectionner une option"@@ -6377,6 +6900,7 @@ msgstr "Sélectionner une option"msgid "Select an organisation to view teams"msgstr "Sélectionnez une organisation pour voir les équipes"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select at least"msgstr "Sélectionnez au moins"@@ -6386,6 +6910,7 @@ msgstr "Sélectionnez au moins"msgid "Select authentication methods"msgstr "Sélectionnez les méthodes d'authentification"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Select default option"msgstr "Sélectionner l'option par défaut"@@ -6394,6 +6919,7 @@ msgstr "Sélectionner l'option par défaut"msgid "Select default role"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select direction"msgstr "Sélectionner la direction"@@ -6432,6 +6958,10 @@ msgstr "Sélectionner la clé d'authentification"msgid "Select signature types"msgstr "Sélectionnez les types de signature"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Select text align"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-create-dialog.tsxmsgid "Select the members to add to this group"msgstr "Sélectionnez les membres à ajouter à ce groupe"@@ -6449,6 +6979,12 @@ msgstr "Sélectionner les déclencheurs"msgid "Select visibility"msgstr "Sélectionner la visibilité"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Selected Recipient"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -6469,6 +7005,9 @@ msgstr "Envoyer l'e-mail de confirmation"msgid "Send document"msgstr "Envoyer le document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsxmsgid "Send Document"msgstr "Envoyer le document"@@ -6513,10 +7052,15 @@ msgstr "Envoyer l'e-mail signé par le destinataire"msgid "Send recipient signing request email"msgstr "Envoyer l'e-mail de demande de signature de destinataire"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsxmsgid "Send reminder"msgstr "Envoyer un rappel"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Send reminders to the following recipients"+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "Send Test Webhook"msgstr "Envoyer le webhook de test"@@ -6567,6 +7111,7 @@ msgstr "Configurez les propriétés de votre modèle et les informations du dest#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/folder/folder-card.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Settings"msgstr "Paramètres"@@ -6600,6 +7145,7 @@ msgstr "Partagez votre expérience de signature !"msgid "Show"msgstr "Afficher"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Show advanced settings"@@ -6609,11 +7155,6 @@ msgstr "Afficher les paramètres avancés"msgid "Show templates in your public profile for your audience to sign and get started quickly"msgstr "Afficher des modèles dans votre profil public pour que votre audience puisse signer et commencer rapidement"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Sign"-msgstr ""-#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -6627,9 +7168,21 @@ msgstr ""#: apps/remix/app/components/general/document-signing/document-signing-auth-password.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-2fa.tsx#: apps/remix/app/components/general/document/document-page-view-button.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsxmsgid "Sign"msgstr "Signer"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Sign"+msgstr ""+#. placeholder {0}: recipient.name#. placeholder {1}: recipient.email#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx@@ -6648,8 +7201,8 @@ msgstr "Signer comme<0>{0} <1>({1})</1></0>"msgid "Sign document"msgstr "Signer le document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Sign Document"msgstr "Signer le document"@@ -6657,6 +7210,14 @@ msgstr "Signer le document"msgid "Sign Documents"msgstr "Signer des documents"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign Dropdown Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign Email"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Sign field"@@ -6679,12 +7240,32 @@ msgstr "Se connecter"msgid "Sign in to your account"msgstr "Connectez-vous à votre compte"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign Initials"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign Name"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Sign Number Field"+msgstr ""+#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx#: apps/remix/app/components/general/app-nav-mobile.tsxmsgid "Sign Out"msgstr "Déconnexion"+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+msgid "Sign Signature Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Sign Text Field"+msgstr ""+#: apps/remix/app/components/embed/embed-document-signing-page.tsx#: apps/remix/app/components/embed/embed-direct-template-client-page.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -6703,8 +7284,22 @@ msgstr "S'inscrire avec Google"msgid "Sign Up with OIDC"msgstr "S'inscrire avec OIDC"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign your email into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign your full name into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign your initials into the field"+msgstr ""+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -6730,6 +7325,10 @@ msgstr "La signature est trop petite"msgid "Signature Pad cannot be empty."msgstr "Le champ de signature ne peut pas être vide."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Signature Settings"+msgstr ""+#: packages/ui/components/document/document-signature-settings-tooltip.tsxmsgid "Signature types"msgstr "Types de signature"@@ -6742,17 +7341,17 @@ msgstr "Signatures collectées"msgid "Signatures will appear once the document has been completed"msgstr "Les signatures apparaîtront une fois le document complété"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Signed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsxmsgid "Signed"msgstr "Signé"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Signed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Signer"@@ -6803,6 +7402,7 @@ msgstr "Liens de signature"msgid "Signing links have been generated for this document."msgstr "Des liens de signature ont été générés pour ce document."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Signing order is enabled."@@ -6831,6 +7431,7 @@ msgstr "Bannière du site"msgid "Site Settings"msgstr "Paramètres du site"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."msgstr "Certains signataires n'ont pas été assignés à un champ de signature. Veuillez assigner au moins 1 champ de signature à chaque signataire avant de continuer."@@ -6879,6 +7480,9 @@ msgstr "Certains signataires n'ont pas été assignés à un champ de signature.#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-member-invite-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx@@ -6893,6 +7497,8 @@ msgstr "Quelque chose a mal tourné lors de la tentative de vérification de vot#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Something went wrong while loading the document."msgstr "Une erreur s'est produite lors du chargement du document."@@ -6908,6 +7514,10 @@ msgstr "Quelque chose a mal tourné lors de l'envoi de l'e-mail de confirmation.msgid "Something went wrong while updating the team billing subscription, please contact support."msgstr "Quelque chose a mal tourné lors de la mise à jour de l'abonnement de l'équipe, veuillez contacter le support."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Something went wrong while uploading this file"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.email.tsx@@ -6960,6 +7570,7 @@ msgstr "Statistiques"#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table.tsx#: apps/remix/app/components/tables/admin-organisations-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsxmsgid "Status"msgstr "Statut"@@ -6981,10 +7592,12 @@ msgid "Stripe Customer ID"msgstr "ID client Stripe"#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Subject"msgstr "Sujet"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Subject <0>(Optional)</0>"@@ -6994,6 +7607,10 @@ msgstr "Objet <0>(Optionnel)</0>"msgid "Submit"msgstr ""+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Submitted"+msgstr ""+#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx@@ -7033,7 +7650,6 @@ msgstr "Abonnement non valide"#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx@@ -7043,6 +7659,7 @@ msgstr "Abonnement non valide"#: apps/remix/app/components/general/teams/team-email-dropdown.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/organisation-update-form.tsx@@ -7074,6 +7691,7 @@ msgstr "Abonnement non valide"#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsxmsgid "Success"msgstr "Succès"@@ -7107,6 +7725,10 @@ msgstr "Synchronisation"msgid "Sync Email Domains"msgstr "Synchroniser les domaines de messagerie"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Sync failed, changes not saved"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "System Requirements"msgstr "Exigences du système"@@ -7259,7 +7881,7 @@ msgstr "Les équipes vous aident à organiser votre travail et à collaborer avemsgid "Teams that this organisation group is currently assigned to"msgstr "Équipes auxquelles ce groupe d'organisation est actuellement attribué"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx@@ -7285,6 +7907,10 @@ msgstr "Document modèle importé"msgid "Template duplicated"msgstr "Modèle dupliqué"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Editor"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Template has been removed from your public profile."msgstr "Le modèle a été retiré de votre profil public."@@ -7305,6 +7931,10 @@ msgstr "Modèle déplacé"msgid "Template saved"msgstr "Modèle enregistré"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Settings"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Template title"msgstr "Titre du modèle"@@ -7314,6 +7944,7 @@ msgid "Template updated successfully"msgstr "Modèle mis à jour avec succès"#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsxmsgid "Template uploaded"msgstr "Modèle de document téléchargé"@@ -7344,6 +7975,7 @@ msgstr "Échec du test du webhook"msgid "Test webhook sent"msgstr "Webhook de test envoyé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx@@ -7352,6 +7984,7 @@ msgstr "Webhook de test envoyé"msgid "Text"msgstr "Texte"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -7365,6 +7998,14 @@ msgstr "Alignement du texte"msgid "Text Color"msgstr "Couleur du texte"+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Text is required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Text Settings"+msgstr ""+#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Thank you for completing the signing process."msgstr "Merci d'avoir complété le processus de signature."@@ -7453,6 +8094,17 @@ msgstr "Le document sera caché de votre compte"msgid "The document will be immediately sent to recipients if this is checked."msgstr "Le document sera immédiatement envoyé aux destinataires si cela est coché."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "The document you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: packages/ui/components/document/document-send-email-message-helper.tsxmsgid "The document's name"msgstr "Le nom du document"@@ -7610,6 +8262,7 @@ msgstr "Le nom du signataire"#: apps/remix/app/components/general/avatar-with-recipient.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "The signing link has been copied to your clipboard."msgstr "Le lien de signature a été copié dans votre presse-papiers."@@ -7642,6 +8295,16 @@ msgstr "Le modèle a été déplacé avec succès."msgid "The template will be removed from your profile"msgstr "Le modèle sera retiré de votre profil"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "The template you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+msgid ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "The test webhook has been successfully sent to your endpoint."msgstr "Le webhook de test a été envoyé avec succès vers votre point de terminaison."@@ -7753,6 +8416,10 @@ msgstr "Cette action est réversible, mais veuillez faire attention car le comptmsgid "This claim is locked and cannot be deleted."msgstr "Cette réclamation est verrouillée et ne peut pas être supprimée."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "This code will expire in {expiresInMinutes} minutes."+msgstr ""+#: packages/email/template-components/template-document-super-delete.tsxmsgid "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."msgstr "Ce document ne peut pas être récupéré, si vous souhaitez contester la raison des documents futurs, veuillez contacter le support."@@ -7765,6 +8432,7 @@ msgstr "Ce document ne peut pas être modifié"msgid "This document could not be deleted at this time. Please try again."msgstr "Ce document n'a pas pu être supprimé pour le moment. Veuillez réessayer."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsxmsgid "This document could not be duplicated at this time. Please try again."msgstr "Ce document n'a pas pu être dupliqué pour le moment. Veuillez réessayer."@@ -7781,6 +8449,7 @@ msgstr "Ce document a déjà été envoyé à ce destinataire. Vous ne pouvez plmsgid "This document has been cancelled by the owner and is no longer available for others to sign."msgstr "Ce document a été annulé par le propriétaire et n'est plus disponible pour d'autres à signer."+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "This document has been cancelled by the owner."msgstr "Ce document a été annulé par le propriétaire."@@ -7817,6 +8486,10 @@ msgstr "Ce document a été créé en utilisant un lien direct."msgid "This document was sent using <0>Documenso.</0>"msgstr "Ce document a été envoyé via <0>Documenso.</0>"+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This document will be duplicated."+msgstr ""+#: packages/email/template-components/template-document-rejection-confirmed.tsxmsgid "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."msgstr "Cet e-mail confirme que vous avez rejeté le document <0>\"{documentName}\"</0> envoyé par {documentOwnerName}."@@ -7841,6 +8514,14 @@ msgstr "Cet e-mail est envoyé au destinataire lui demandant de signer le documemsgid "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."msgstr "Cet e-mail sera envoyé au destinataire qui vient de signer le document, s'il y a encore d'autres destinataires qui n'ont pas signé."+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "This envelope could not be distributed at this time. Please try again."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "This envelope could not be resent at this time. Please try again."+msgstr ""+#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."msgstr "Ce champ ne peut pas être modifié ou supprimé. Lorsque vous partagez le lien direct de ce modèle ou l'ajoutez à votre profil public, toute personne qui y accède peut saisir son nom et son email, et remplir les champs qui lui sont attribués."@@ -7849,6 +8530,7 @@ msgstr "Ce champ ne peut pas être modifié ou supprimé. Lorsque vous partagezmsgid "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."msgstr "Ce dossier contient plusieurs éléments. Le supprimer supprimera tous les sous-dossiers et déplacera tous les documents et modèles intégrés vers le dossier racine."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "This is how the document will reach the recipients once the document is ready for signing."msgstr "Voici comment le document atteindra les destinataires une fois qu'il sera prêt à être signé."@@ -7865,6 +8547,10 @@ msgstr ""msgid "This is the URL which users will use to sign in to your organisation."msgstr ""+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "This item cannot be deleted"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/team.verify.email.$token.tsxmsgid "This link is invalid or has expired. Please contact your team to resend a verification."msgstr "Ce lien est invalide ou a expiré. Veuillez contacter votre équipe pour renvoyer une vérification."@@ -7885,6 +8571,7 @@ msgstr "Cette clé d'accès a déjà été enregistrée."msgid "This passkey is not configured for this application. Please login and add one in the user settings."msgstr "Cette clé d'accès n'est pas configurée pour cette application. Veuillez vous connecter et en ajouter une dans les paramètres de l'utilisateur."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "This recipient can no longer be modified as they have signed a field, or completed the document."msgstr "Ce destinataire ne peut plus être modifié car il a signé un champ ou complété le document."@@ -7893,6 +8580,7 @@ msgstr "Ce destinataire ne peut plus être modifié car il a signé un champ oumsgid "This session has expired. Please try again."msgstr "Cette session a expiré. Veuillez réessayer."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "This signer has already signed the document."msgstr "Ce signataire a déjà signé le document."@@ -7909,6 +8597,10 @@ msgstr "Ce modèle n'a pas pu être supprimé pour le moment. Veuillez réessayemsgid "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."msgstr "Ce modèle utilise l'insertion de champ héritée, il est recommandé d'utiliser la nouvelle méthode d'insertion pour des résultats plus précis."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This template will be duplicated."+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "This token is invalid or has expired. No action is needed."msgstr "Ce token est invalide ou a expiré. Aucune action n'est nécessaire."@@ -7960,6 +8652,7 @@ msgid "Time zone"msgstr "Fuseau horaire"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -8108,6 +8801,7 @@ msgstr "Authentification à deux facteurs"msgid "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."msgstr "Les codes de récupération de l'authentification à deux facteurs sont utilisés pour accéder à votre compte dans le cas où vous perdez l'accès à votre application d'authentification."+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/forms/signin.tsxmsgid "Two-Factor Authentication"msgstr "Authentification à deux facteurs"@@ -8128,17 +8822,17 @@ msgstr "L'authentification à deux facteurs a été désactivée pour votre compmsgid "Two-Factor Re-Authentication"msgstr "Ré-authentification à deux facteurs"-#: packages/lib/constants/document.ts-msgctxt "Type signatute type"-msgid "Type"-msgstr ""-#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Type"msgstr "Type"+#: packages/lib/constants/document.ts+msgctxt "Type signatute type"+msgid "Type"+msgstr ""+#: apps/remix/app/components/general/app-command-menu.tsxmsgid "Type a command or search..."msgstr "Tapez une commande ou recherchez..."@@ -8287,6 +8981,7 @@ msgstr "Groupe sans titre"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-public-profile-templates-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/email-preferences-form.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx@@ -8418,15 +9113,15 @@ msgstr "Mettre à niveau <0>{0}</0> vers {planName}"msgid "Upgrade your plan to upload more documents"msgstr "Mettez à niveau votre plan pour importer plus de documents"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Upload"+msgstr "Importer"+#: packages/lib/constants/document.tsmsgctxt "Upload signatute type"msgid "Upload"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Upload"-msgstr "Importer"-#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Upload a CSV file to create multiple documents from this template. Each row represents one document with its recipient details."msgstr "Importer un fichier CSV pour créer plusieurs documents à partir de ce modèle. Chaque ligne représente un document avec les coordonnées de son destinataire."@@ -8451,12 +9146,20 @@ msgstr "Importer le CSV"msgid "Upload custom document"msgstr "Importer un document personnalisé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Upload disabled"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsx#: packages/ui/primitives/document-upload.tsxmsgid "Upload Document"msgstr "Importer le document"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Upload documents and add recipients"+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Upload failed"@@ -8496,6 +9199,10 @@ msgstr "Le fichier importé est trop petit"msgid "Uploaded file not an allowed file type"msgstr "Le fichier importé n'est pas un type de fichier autorisé"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Uploading"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Uploading document..."msgstr "Importation du document..."@@ -8518,10 +9225,15 @@ msgstr "Utiliser l'authentificateur"msgid "Use Backup Code"msgstr "Utiliser le code de secours"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Use Template"msgstr "Utiliser le modèle"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Use your authenticator app to generate a code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Use your passkey for authentication"msgstr "Utilisez votre clé d'accès pour l'authentification"@@ -8570,17 +9282,25 @@ msgstr "Un utilisateur avec cet e-mail existe déjà. Veuillez utiliser une adremsgid "Users"msgstr "Utilisateurs"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Validation"msgstr "Validation"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Value"msgstr "Valeur"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Verification Code Required"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Verification Email Sent"msgstr "Email de vérification envoyé"@@ -8589,6 +9309,10 @@ msgstr "Email de vérification envoyé"msgid "Verification email sent successfully."msgstr "Email de vérification envoyé avec succès."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Verify & Complete"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsxmsgid "Verify Domain"msgstr "Vérifier le domaine"@@ -8605,7 +9329,8 @@ msgstr "Vérifiez votre adresse e-mail"msgid "Verify your email address to unlock all features."msgstr "Vérifiez votre adresse e-mail pour débloquer toutes les fonctionnalités."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Verify your email to upload documents."msgstr "Vérifiez votre e-mail pour importer des documents."@@ -8613,15 +9338,11 @@ msgstr "Vérifiez votre e-mail pour importer des documents."msgid "Verify your team email address"msgstr "Vérifiez votre adresse e-mail d'équipe"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Vertical"msgstr "Vertical"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "View"-msgstr ""-#: apps/remix/app/components/tables/organisation-billing-invoices-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx@@ -8634,6 +9355,11 @@ msgstr ""msgid "View"msgstr "Voir"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "View"+msgstr ""+#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsxmsgid "View activity"msgstr "Voir l'activité"@@ -8680,7 +9406,7 @@ msgstr "Voir les enregistrements DNS"msgid "View document"msgstr "Voir le document"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -8689,6 +9415,18 @@ msgstr "Voir le document"msgid "View Document"msgstr "Voir le document"+#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to approve"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to assist"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to sign"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._index.tsxmsgid "View documents associated with this email"msgstr "Voir les documents associés à cet e-mail"@@ -8730,17 +9468,17 @@ msgstr "Voir les équipes"msgid "View the DNS records for this email domain"msgstr "Voir les enregistrements DNS pour ce domaine de messagerie"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Viewed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Viewed"msgstr "Vu"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Viewed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Viewer"@@ -8781,6 +9519,7 @@ msgstr "En attente que d'autres signent"msgid "Waiting for Your Turn"msgstr "En attente de votre tour"+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Want to send slick signing links like this one? <0>Check out Documenso.</0>"msgstr "Vous voulez envoyer des liens de signature élégants comme celui-ci ? <0>Découvrez Documenso.</0>"@@ -8789,6 +9528,9 @@ msgstr "Vous voulez envoyer des liens de signature élégants comme celui-ci ? <msgid "Want your own public profile?"msgstr "Vous voulez votre propre profil public ?"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -8832,6 +9574,12 @@ msgstr "Nous n'avons pas pu mettre à jour l'organisation. Veuillez réessayer."msgid "We couldn't update the provider. Please try again."msgstr ""+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-create-dialog.tsxmsgid "We encountered an error while creating the email. Please try again later."msgstr "Nous avons rencontré une erreur lors de la création de l'e-mail. Veuillez réessayer plus tard."@@ -8918,6 +9666,10 @@ msgstr "Nous avons rencontré une erreur inconnue lors de la tentative de suppremsgid "We encountered an unknown error while attempting to remove this email. Please try again later."msgstr "Nous avons rencontré une erreur inconnue lors de la tentative de suppression de cet e-mail. Veuillez réessayer plus tard."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/team-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "We encountered an unknown error while attempting to remove this group. Please try again later."@@ -8932,6 +9684,11 @@ msgstr "Une erreur inconnue s'est produite lors de la suppression de ce modèlemsgid "We encountered an unknown error while attempting to remove this user. Please try again later."msgstr "Une erreur inconnue s'est produite lors de la suppression de cet utilisateur. Veuillez réessayer plus tard."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+msgstr ""+#: apps/remix/app/components/forms/reset-password.tsxmsgid "We encountered an unknown error while attempting to reset your password. Please try again later."msgstr "Une erreur inconnue s'est produite lors de la réinitialisation de votre mot de passe. Veuillez réessayer plus tard."@@ -8955,6 +9712,10 @@ msgstr "Une erreur inconnue s'est produite lors de l'inscription. Veuillez réesmsgid "We encountered an unknown error while attempting to update the banner. Please try again later."msgstr "Une erreur inconnue s'est produite lors de la mise à jour de la bannière. Veuillez réessayer plus tard."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "We encountered an unknown error while attempting to update the envelope. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "We encountered an unknown error while attempting to update the template. Please try again later."msgstr "Une erreur inconnue s'est produite lors de la mise à jour du modèle. Veuillez réessayer plus tard."@@ -9067,11 +9828,13 @@ msgid "We were unable to verify your email. If your email is not verified alreadmsgstr "Nous n'avons pas pu vérifier votre e-mail. Si votre e-mail n'est pas déjà vérifié, veuillez réessayer."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We will generate signing links for you, which you can send to the recipients through your method of choice."msgstr "Nous allons générer des liens de signature pour vous, que vous pouvez envoyer aux destinataires par votre méthode de choix."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We won't send anything to notify recipients."msgstr "Nous n'enverrons rien pour notifier les destinataires."@@ -9080,6 +9843,10 @@ msgstr "Nous n'enverrons rien pour notifier les destinataires."msgid "We'll get back to you as soon as possible via email."msgstr ""+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We'll send a 6-digit code to your email"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates._index.tsx#: apps/remix/app/components/tables/documents-table-empty-state.tsxmsgid "We're all empty"@@ -9093,6 +9860,10 @@ msgstr "Nous attendons encore que d'autres signataires signent ce document.<0/>Nmsgid "We've changed your password as you asked. You can now sign in with your new password."msgstr "Nous avons changé votre mot de passe comme demandé. Vous pouvez maintenant vous connecter avec votre nouveau mot de passe."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."msgstr "Nous avons envoyé un e-mail de confirmation à <0>{email}</0>. Veuillez vérifier votre boîte de réception et cliquer sur le lien de l'e-mail pour vérifier votre compte."@@ -9157,6 +9928,7 @@ msgstr "Essayiez-vous d'éditer ce document à la place ?"msgid "What you can do with teams:"msgstr "Ce que vous pouvez faire avec les équipes :"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -9255,6 +10027,10 @@ msgstr ""msgid "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."msgstr "Vous êtes sur le point de supprimer le domaine de messagerie <0>{emailDomain}</0> de <1>{0}</1>. Tous les e-mails associés à ce domaine seront supprimés."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You are about to remove the following document and all associated fields"+msgstr ""+#. placeholder {0}: organisation.name#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsxmsgid "You are about to remove the following email from <0>{0}</0>."@@ -9385,6 +10161,7 @@ msgstr "Vous pouvez voir les documents créés dans votre tableau de bord sous lmsgid "You can view the document and its status by clicking the button below."msgstr "Vous pouvez voir le document et son statut en cliquant sur le bouton ci-dessous."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "You cannot add assistants when signing order is disabled."@@ -9394,6 +10171,10 @@ msgstr "Vous ne pouvez pas ajouter d'assistants lorsque l'ordre de signature estmsgid "You cannot delete a group which has a higher role than you."msgstr "Vous ne pouvez pas supprimer un groupe qui a un rôle supérieur au vôtre."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You cannot delete this item because the document has been sent to recipients"+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."msgstr "Vous ne pouvez pas avoir plus de {MAXIMUM_PASSKEYS} clés de passkey."@@ -9419,7 +10200,8 @@ msgstr "Vous ne pouvez pas retirer des membres de cette équipe si la fonctionnamsgid "You cannot upload documents at this time."msgstr "Vous ne pouvez pas importer de documents pour le moment."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You cannot upload encrypted PDFs"msgstr "Vous ne pouvez pas importer de PDF cryptés"@@ -9478,7 +10260,7 @@ msgstr "Vous avez été invité à signer les documents suivants. Consultez chaqmsgid "You have declined the invitation from <0>{0}</0> to join their organisation."msgstr "Vous avez refusé l'invitation de <0>{0}</0> à rejoindre leur organisation."-#. placeholder {0}: `"${document.title}"`+#. placeholder {0}: `"${envelope.title}"`#: packages/lib/server-only/document/resend-document.ts#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "You have initiated the document {0} that requires you to {recipientActionVerb} it."@@ -9505,12 +10287,14 @@ msgstr "Vous avez atteint la limite maximale de {0} modèles directs. <0>Mettezmsgid "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."msgstr "Vous avez atteint le nombre maximum d'équipes pour votre plan. Veuillez contacter les ventes à <0>{SUPPORT_EMAIL}</0> si vous souhaitez ajuster votre plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You have reached your document limit for this month. Please upgrade your plan."msgstr "Vous avez atteint votre limite de documents pour ce mois. Veuillez passer à l'abonnement supérieur."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: packages/ui/primitives/document-dropzone.tsxmsgid "You have reached your document limit."msgstr "Vous avez atteint votre limite de documents."@@ -9549,6 +10333,10 @@ msgstr "Vous avez supprimé avec succès ce domaine de messagerie de l'organisatmsgid "You have successfully removed this email from the organisation."msgstr "Vous avez supprimé avec succès cet e-mail de l'organisation."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You have successfully removed this envelope item."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "You have successfully removed this group from the organisation."msgstr "Vous avez enlevé ce groupe de l'organisation avec succès."@@ -9597,11 +10385,19 @@ msgstr "Vous avez vérifié votre adresse e-mail pour <0>{0}</0>."msgid "You must enter '{deleteMessage}' to proceed"msgstr "Vous devez entrer '{deleteMessage}' pour continuer"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "You must select at least one item"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsxmsgid "You must type '{deleteMessage}' to confirm"msgstr "Vous devez taper '{deleteMessage}' pour confirmer"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "You need at least one recipient to add fields"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "You need to be an admin to manage API tokens."msgstr "Vous devez être administrateur pour gérer les tokens API."@@ -9683,7 +10479,8 @@ msgstr "Votre plan actuel est arrivé à échéance."msgid "Your direct signing templates"msgstr "Vos modèles de signature directe"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Your document failed to upload."msgstr "L'importation de votre document a échoué."@@ -9712,7 +10509,8 @@ msgstr "Votre document a été envoyé avec succès."msgid "Your document has been successfully duplicated."msgstr "Votre document a été dupliqué avec succès."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Your document has been uploaded successfully."msgstr "Votre document a été importé avec succès."@@ -9749,6 +10547,18 @@ msgstr "Votre e-mail est actuellement utilisé par l'équipe <0>{0}</0> ({1})."msgid "Your email preferences have been updated"msgstr "Vos préférences d'e-mail ont été mises à jour"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Your envelope has been distributed successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Your envelope has been resent successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Your envelope has been successfully duplicated."+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Your existing tokens"msgstr "Vos tokens existants"@@ -9832,6 +10642,10 @@ msgstr "Votre équipe a été supprimée avec succès."msgid "Your team has been successfully updated."msgstr "Votre équipe a été mise à jour avec succès."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template failed to upload."+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Your template has been created successfully"msgstr "Votre modèle a été créé avec succès"@@ -9844,6 +10658,10 @@ msgstr "Votre modèle a été dupliqué avec succès."msgid "Your template has been successfully deleted."msgstr "Votre modèle a été supprimé avec succès."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template has been uploaded successfully."+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxmsgid "Your template has been uploaded successfully. You will be redirected to the template page."msgstr "Votre modèle a été téléchargé avec succès. Vous serez redirigé vers la page du modèle."@@ -9868,6 +10686,18 @@ msgstr "Votre token a été créé avec succès ! Assurez-vous de le copier carmsgid "Your tokens will be shown here once you create them."msgstr "Vos tokens seront affichés ici une fois que vous les aurez créés."+#: packages/lib/server-only/2fa/email/send-2fa-token-email.ts+msgid "Your two-factor authentication code"+msgstr ""++#: packages/email/templates/access-auth-2fa.tsx+msgid "Your verification code is {code}"+msgstr ""++#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Your verification code:"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "your-domain.com another-domain.com"msgstr ""diff --git a/packages/lib/translations/it/web.po b/packages/lib/translations/it/web.poindex 35d82a4a4..d2d96cc1b 100644--- a/packages/lib/translations/it/web.po+++ b/packages/lib/translations/it/web.po@@ -72,6 +72,11 @@ msgstr "{0, plural, one {(1 carattere in eccesso)} other {(# caratteri in eccessmsgid "{0, plural, one {# character over the limit} other {# characters over the limit}}"msgstr "{0, plural, one {# carattere oltre il limite} other {# caratteri oltre il limite}}"+#. placeholder {0}: fieldMeta?.characterLimit - (field.value?.length ?? 0)+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "{0, plural, one {# character remaining} other {# characters remaining}}"+msgstr ""+#. placeholder {0}: folder._count.documents#: apps/remix/app/components/general/folder/folder-card.tsxmsgid "{0, plural, one {# document} other {# documents}}"@@ -103,13 +108,25 @@ msgstr "{0, plural, one {# modello} other {# modelli}}"msgid "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"msgstr "{0, plural, one {<0>Hai <1>1</1> invito in sospeso</0>} other {<2>Hai <3>#</3> inviti in sospeso</2>}}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"+msgstr ""++#. placeholder {0}: fields.filter((field) => field.envelopeItemId === doc.id).length+#. placeholder {0}: recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id) .length+#: apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0, plural, one {1 Field} other {# Fields}}"+msgstr ""+#. placeholder {0}: autoSignableFields.filter((f) => f.type === fieldType).length#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsxmsgid "{0, plural, one {1 matching field} other {# matching fields}}"msgstr "{0, plural, one {1 campo corrispondente} other {# campi corrispondenti}}"#. placeholder {0}: recipients.length-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxmsgid "{0, plural, one {1 Recipient} other {# Recipients}}"msgstr "{0, plural, one {1 destinatario} other {# destinatari}}"@@ -131,8 +148,13 @@ msgstr ""msgid "{0} direct signing templates"msgstr "{0} modelli di firma diretta"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0} fields remaining"+msgstr ""+#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{0} has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{0} ti ha invitato a {recipientActionVerb} il documento \"{1}\"."@@ -144,7 +166,8 @@ msgstr "{0} ti ha invitato a {recipientActionVerb} un documento"#. placeholder {0}: remaining.documents#. placeholder {1}: quota.documents-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "{0} of {1} documents remaining this month."msgstr "{0} di {1} documenti rimanenti questo mese."@@ -156,13 +179,13 @@ msgid "{0} of {1} row(s) selected."msgstr "{0} di {1} riga selezionata."#. placeholder {0}: user.name || user.email-#. placeholder {1}: document.team.name-#. placeholder {2}: document.title+#. placeholder {1}: envelope.team.name+#. placeholder {2}: envelope.title#: packages/lib/server-only/document/resend-document.tsmsgid "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."msgstr "{0} per conto di \"{1}\" ti ha invitato a {recipientActionVerb} il documento \"{2}\"."-#. placeholder {0}: recipients.length+#. placeholder {0}: envelope.recipients.length#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxmsgid "{0} Recipient(s)"msgstr "{0} Destinatario(i)"@@ -214,7 +237,7 @@ msgid "{inviterName} has removed you from the document<0/>\"{documentName}\""msgstr "{inviterName} ti ha rimosso dal documento<0/>\"{documentName}\""#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "{inviterName} a nome di \"{0}\" ti ha invitato a {recipientActionVerb} il documento \"{1}\"."@@ -346,7 +369,7 @@ msgstr "{recipientName} ha rifiutato il documento '{documentName}'"msgid "{recipientReference} has completed signing the document."msgstr "{recipientReference} ha completato la firma del documento."-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsmsgid "{recipientReference} has signed \"{0}\""msgstr "{recipientReference} ha firmato \"{0}\""@@ -393,14 +416,26 @@ msgstr "{userName} ha inoltrato il documento"msgid "{userName} completed their task"msgstr "{userName} ha completato il suo compito"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} failed to validate a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} rejected the document"msgstr "{userName} ha rifiutato il documento"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} requested a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} signed the document"msgstr "{userName} ha firmato il documento"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} validated a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} viewed the document"msgstr "{userName} ha visualizzato il documento"@@ -410,6 +445,8 @@ msgid "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}msgstr "{visibleRows, plural, one {Visualizzazione di # risultato.} other {Visualizzazione di # risultati.}}"#. placeholder {0}: document.title+#. placeholder {0}: envelope.title+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "<0>\"{0}\"</0>is no longer available to sign"msgstr "<0>\"{0}\"</0>non è più disponibile per la firma"@@ -442,6 +479,7 @@ msgstr ""msgid "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."msgstr "<0>Disegnata</0> - Una firma disegnata con un mouse o uno stilo."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."msgstr "<0>Email</0> - Al destinatario verrà inviato il documento tramite email per firmare, approvare, ecc."@@ -466,10 +504,12 @@ msgstr "<0>Nessuna restrizione</0> - Il documento può essere accessibile direttmsgid "<0>None</0> - No authentication required"msgstr "<0>Nessuno</0> - Non è richiesta autenticazione"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>None</0> - We will generate links which you can send to the recipients manually."msgstr "<0>Nessuno</0> - Genereremo i link che potrai inviare manualmente ai destinatari."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."msgstr "<0>Nota</0> - Se usi i link in combinazione con modelli diretti, dovrai inviare manualmente i link ai destinatari rimanenti."@@ -554,6 +594,10 @@ msgstr ""msgid "401 Unauthorized"msgstr "401 Non autorizzato"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "404 Document not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsxmsgid "404 Email domain not found"msgstr "404 Dominio email non trovato"@@ -562,6 +606,12 @@ msgstr "404 Dominio email non trovato"msgid "404 not found"msgstr "404 non trovato"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "404 Not found"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsxmsgid "404 Not Found"msgstr ""@@ -584,6 +634,10 @@ msgstr "404 Profilo non trovato"msgid "404 Team not found"msgstr "404 Squadra non trovata"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "404 Template not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsxmsgid "404 User not found"msgstr "404 Utente non trovato"@@ -850,6 +904,7 @@ msgstr "Azione"#: apps/remix/app/components/tables/admin-organisations-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Actions"msgstr "Azioni"@@ -872,6 +927,7 @@ msgstr "Abbonamenti attivi"msgid "Add"msgstr "Aggiungi"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add 2 or more signers to enable signing order."msgstr ""@@ -884,6 +940,7 @@ msgstr "Aggiungi un dominio personalizzato per inviare email per conto della tuamsgid "Add a document"msgstr "Aggiungi un documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -907,6 +964,7 @@ msgstr "Aggiungi un autenticatore come metodo di autenticazione secondario per fmsgid "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."msgstr "Aggiungi un autenticatore come metodo di autenticazione secondario al momento dell'accesso o durante la firma di documenti."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Add an external ID to the document. This can be used to identify the document in external systems."msgstr "Aggiungi un ID esterno al documento. Questo può essere usato per identificare il documento in sistemi esterni."@@ -941,6 +999,9 @@ msgid "Add Email Domain"msgstr "Aggiungi Dominio Email"#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: apps/remix/app/components/general/document/document-edit-form.tsxmsgid "Add Fields"msgstr "Aggiungi campi"@@ -975,6 +1036,7 @@ msgstr "Aggiungi altro"msgid "Add myself"msgstr "Aggiungi me stesso"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "Add Myself"msgstr "Aggiungi me stesso"@@ -996,6 +1058,7 @@ msgstr "Aggiungi un destinatario segnaposto"msgid "Add Placeholders"msgstr "Aggiungi segnaposto"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add Signer"@@ -1013,10 +1076,12 @@ msgstr "Aggiungi firmatari e configura le preferenze di firma"msgid "Add team email"msgstr "Aggiungi email del team"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text"msgstr "Aggiungi testo"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text to the field"msgstr "Aggiungi testo al campo"@@ -1148,6 +1213,7 @@ msgstr "Consenti a tutti i membri dell'organizzazione di accedere a questo team"msgid "Allow document recipients to reply directly to this email address"msgstr "Consenti ai destinatari del documento di rispondere direttamente a questo indirizzo email"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -1158,6 +1224,7 @@ msgstr "Permetti ai firmatari di scegliere il prossimo firmatario"msgid "Allowed Email Domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -1205,6 +1272,8 @@ msgstr "Una email con questo indirizzo esiste già."#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx#: apps/remix/app/components/forms/token.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/reset-password.tsx@@ -1386,7 +1455,8 @@ msgstr "Si è verificato un errore durante l'aggiornamento della firma."msgid "An error occurred while updating your profile."msgstr "Si è verificato un errore durante l'aggiornamento del tuo profilo."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "An error occurred while uploading your document."msgstr "Si è verificato un errore durante il caricamento del tuo documento."@@ -1410,6 +1480,7 @@ msgstr "Si è verificato un errore inaspettato."#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/admin+/site-settings.tsx#: apps/remix/app/components/general/app-command-menu.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/signup.tsx@@ -1446,6 +1517,7 @@ msgstr "Si è verificato un errore inaspettato."#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/account-delete-dialog.tsx@@ -1487,11 +1559,6 @@ msgstr "Token API"msgid "App Version"msgstr "Versione dell'app"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Approve"-msgstr ""-#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-button.tsx@@ -1501,19 +1568,27 @@ msgstr ""msgid "Approve"msgstr "Approvare"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Approve"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Approve Document"msgstr "Approva Documento"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Approved"+msgstr "Approvato"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Approved"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Approved"-msgstr "Approvato"+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "Approver"+msgstr ""#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"@@ -1576,6 +1651,7 @@ msgstr "Sei sicuro di voler eliminare questo team?"#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Are you sure?"msgstr "Sei sicuro?"@@ -1589,8 +1665,7 @@ msgctxt "Recipient role action verb"msgid "Assist"msgstr ""-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Assist Document"msgstr "Assisti il Documento"@@ -1616,20 +1691,21 @@ msgstr ""msgid "Assistants and Copy roles are currently not compatible with the multi-sign experience."msgstr "I ruoli Assistenti e Copia non sono attualmente compatibili con l'esperienza multi-firma."+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Assisted"+msgstr "Assistenza"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Assisted"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Assisted"-msgstr "Assistenza"-#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role progressive verb"msgid "Assisting"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx#: packages/ui/primitives/template-flow/add-template-settings.types.tsx#: packages/ui/primitives/document-flow/add-settings.types.ts@@ -1662,6 +1738,10 @@ msgstr ""msgid "Authentication required"msgstr "Autenticazione richiesta"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Authenticator app"+msgstr ""+#: apps/remix/app/components/forms/avatar-image.tsxmsgid "Avatar"msgstr "Avatar"@@ -1691,6 +1771,10 @@ msgstr "Torna a casa"msgid "Background Color"msgstr "Colore di Sfondo"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Background Jobs"+msgstr ""+#: apps/remix/app/components/forms/signin.tsx#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Backup Code"@@ -1828,6 +1912,7 @@ msgstr "Può preparare"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/general/teams/team-email-usage.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -1866,6 +1951,13 @@ msgstr "Può preparare"#: apps/remix/app/components/dialogs/team-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: apps/remix/app/components/dialogs/session-logout-all-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/passkey-create-dialog.tsx@@ -1888,6 +1980,10 @@ msgstr "Può preparare"#: apps/remix/app/components/dialogs/folder-move-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -1911,10 +2007,15 @@ msgstr "Annullato dall'utente"msgid "Cannot remove document"msgstr "Impossibile rimuovere il documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Cannot remove signer"msgstr "Impossibile rimuovere il firmatario"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Cannot upload items after the document has been sent"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Cc"@@ -1940,6 +2041,11 @@ msgctxt "Recipient role plural name"msgid "Ccers"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Center"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Character Limit"msgstr "Limite di caratteri"@@ -1948,10 +2054,16 @@ msgstr "Limite di caratteri"msgid "Charts"msgstr "Grafici"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Checkbox"msgstr "Casella di controllo"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Checkbox Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Checkbox values"msgstr "Valori della casella di controllo"@@ -1978,6 +2090,10 @@ msgstr "Scegli come il documento verrà inviato ai destinatari"msgid "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."msgstr "Scegli come distribuire il tuo documento ai destinatari. L'email invierà notifiche, Nessuna genererà link di firma per la distribuzione manuale."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Choose verification method"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Choose your preferred authentication method:"msgstr "Scegli il tuo metodo di autenticazione preferito:"@@ -2025,6 +2141,7 @@ msgstr "Clicca qui per caricare"msgid "Click to copy signing link for sending to recipient"msgstr "Clicca per copiare il link di firma da inviare al destinatario"+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx#: apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -2064,6 +2181,8 @@ msgstr ""#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Close"msgstr "Chiudi"@@ -2103,7 +2222,7 @@ msgstr "Completa Documento"msgid "Complete Signing"msgstr "Completa la Firma"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Complete the fields for the following signers."msgstr ""@@ -2112,8 +2231,10 @@ msgstr ""msgid "Complete Viewing"msgstr "Completa la Visualizzazione"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx#: packages/lib/constants/document.ts@@ -2157,6 +2278,14 @@ msgstr "Configura destinatario diretto"msgid "Configure Document"msgstr "Configura Documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure document settings and options before sending."+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure email settings for the document"+msgstr ""+#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -2171,6 +2300,10 @@ msgstr "Configura le impostazioni generali per il documento."msgid "Configure general settings for the template."msgstr "Configura le impostazioni generali per il modello."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure security settings for the document"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Configure template"msgstr "Configura il modello"@@ -2305,6 +2438,7 @@ msgstr "Controlla la visibilità predefinita di un documento caricato."msgid "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."msgstr "Controlla la formattazione del messaggio che verrà inviato quando si invita un destinatario a firmare un documento. Se è stato fornito un messaggio personalizzato durante la configurazione del documento, verrà utilizzato invece."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."msgstr "Controlla la lingua del documento, inclusa quella per le notifiche email e il certificato finale che viene generato e allegato al documento."@@ -2322,6 +2456,7 @@ msgid "Controls which signatures are allowed to be used when signing a document.msgstr "Controlla quali firme sono consentite per firmare un documento."#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copied"msgstr "Copiato"@@ -2339,12 +2474,14 @@ msgstr "Copiato"#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/components/document/document-share-button.tsxmsgid "Copied to clipboard"msgstr "Copiato negli appunti"#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copy"msgstr "Copia"@@ -2445,7 +2582,7 @@ msgstr "Crea richiesta"msgid "Create Claim"msgstr "Crea Richiesta"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Create Direct Link"msgstr "Crea Link Diretto"@@ -2645,6 +2782,7 @@ msgid "Dashboard"msgstr "Dashboard"#: apps/remix/app/components/tables/settings-security-activity-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-date-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -2656,12 +2794,17 @@ msgstr "Data"msgid "Date created"msgstr "Data di creazione"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Date Format"msgstr "Formato data"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Date Settings"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: packages/email/templates/organisation-invite.tsx@@ -2700,6 +2843,10 @@ msgstr "Impostazioni predefinite della firma"msgid "Default Time Zone"msgstr "Fuso Orario Predefinito"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Default Value"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "delete"msgstr "elimina"@@ -2731,6 +2878,7 @@ msgstr "elimina"#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/claim-delete-dialog.tsxmsgid "Delete"@@ -2770,6 +2918,7 @@ msgstr "Elimina Account"msgid "Delete document"msgstr "Elimina documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -2821,6 +2970,10 @@ msgstr "Elimina squadra"msgid "Delete team group"msgstr "Elimina gruppo di team"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Delete Template"+msgstr ""+#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Delete the document. This action is irreversible so proceed with caution."msgstr "Elimina il documento. Questa azione è irreversibile quindi procedi con cautela."@@ -2872,6 +3025,7 @@ msgstr "Collegamento diretto"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsxmsgid "Direct Link"msgstr "Collegamento diretto"@@ -2909,6 +3063,7 @@ msgstr "Collegamento diretto al modello eliminato"msgid "Direct template link usage exceeded ({0}/{1})"msgstr "Utilizzo del collegamento diretto al modello superato ({0}/{1})"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Direction"msgstr "Direzione"@@ -3002,22 +3157,27 @@ msgstr "Documenso eliminerà <0>tutti i tuoi documenti</0>, insieme a tutti i tumsgid "Document"msgstr "Documento"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#. placeholder {1}: recipient.name#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejected by {1}"msgstr "Documento \"{0}\" - Rifiutato da {1}"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejection Confirmed"msgstr "Documento \"{0}\" - Rifiuto Confermato"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsmsgid "Document \"{0}\" Cancelled"msgstr "Documento \"{0}\" Annullato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document & Recipients"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/document/document-global-auth-access-select.tsx@@ -3038,21 +3198,22 @@ msgid "Document Approved"msgstr "Documento Approvato"#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx-#: packages/lib/server-only/document/super-delete-document.ts+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: packages/lib/server-only/document/delete-document.ts+#: packages/lib/server-only/admin/admin-super-delete-document.tsmsgid "Document Cancelled"msgstr "Documento Annullato"+#: apps/remix/app/components/general/document/document-status.tsx+msgid "Document completed"+msgstr "Documento completato"+#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document completed"msgstr ""-#: apps/remix/app/components/general/document/document-status.tsx-msgid "Document completed"-msgstr "Documento completato"-#: packages/ui/components/document/document-email-checkboxes.tsx#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document completed email"@@ -3062,15 +3223,15 @@ msgstr "Email documento completato"msgid "Document Completed!"msgstr "Documento completato!"+#: apps/remix/app/components/dialogs/template-use-dialog.tsx+msgid "Document created"+msgstr "Documento creato"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document created"msgstr ""-#: apps/remix/app/components/dialogs/template-use-dialog.tsx-msgid "Document created"-msgstr "Documento creato"-#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Document Created"msgstr "Documento creato"@@ -3093,17 +3254,17 @@ msgstr "Documento creato usando un <0>link diretto</0>"msgid "Document Creation"msgstr "Creazione del documento"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"-msgid "Document deleted"-msgstr ""-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Document deleted"msgstr "Documento eliminato"+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"+msgid "Document deleted"+msgstr ""+#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document deleted email"msgstr "Email documento eliminato"@@ -3112,6 +3273,8 @@ msgstr "Email documento eliminato"msgid "Document Deleted!"msgstr "Documento Eliminato!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Document Distribution Method"@@ -3125,6 +3288,10 @@ msgstr "Bozza del documento"msgid "Document Duplicated"msgstr "Documento Duplicato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Editor"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document external ID updated"@@ -3134,7 +3301,6 @@ msgstr ""msgid "Document found in your account"msgstr "Documento trovato nel tuo account"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Document ID"msgstr "ID del documento"@@ -3210,18 +3376,18 @@ msgstr "Documento rifiutato"msgid "Document Rejected"msgstr "Documento Rifiutato"-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx-msgid "Document resealed"-msgstr "Documento risigillato"+#: apps/remix/app/components/general/document/document-edit-form.tsx+msgid "Document sent"+msgstr "Documento inviato"#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document sent"msgstr ""-#: apps/remix/app/components/general/document/document-edit-form.tsx-msgid "Document sent"-msgstr "Documento inviato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Settings"+msgstr ""#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Document Signed"@@ -3244,6 +3410,10 @@ msgstr "Stato del documento"msgid "Document title"msgstr "Titolo del documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Document Title"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document title updated"@@ -3258,11 +3428,13 @@ msgstr ""msgid "Document updated successfully"msgstr "Documento aggiornato con successo"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Document upload disabled due to unpaid invoices"msgstr "Caricamento del documento disabilitato a causa di fatture non pagate"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Document uploaded"msgstr "Documento caricato"@@ -3276,6 +3448,10 @@ msgstr ""msgid "Document Viewed"msgstr "Documento visualizzato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Document visibility"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document visibility updated"@@ -3291,7 +3467,7 @@ msgstr ""#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/_layout.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -3363,15 +3539,21 @@ msgid "Download Certificate"msgstr "Scarica il certificato"#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsxmsgid "Download Original"msgstr "Scarica originale"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Download PDF"+msgstr ""+#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Download Template CSV"msgstr "Scarica Modello CSV"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: packages/lib/constants/document.tsmsgid "Draft"@@ -3398,42 +3580,68 @@ msgstr "Trascina e rilascia o fai clic per caricare"msgid "Drag and drop your PDF file here"msgstr "Trascina qui il tuo file PDF"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Draw"+msgstr "Disegno"+#: packages/lib/constants/document.tsmsgctxt "Draw signatute type"msgid "Draw"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Draw"-msgstr "Disegno"-#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Drop your document here"msgstr "Rilascia qui il tuo documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "Dropdown"msgstr "Menu a tendina"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown must have at least one option"+msgstr ""+#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Dropdown options"msgstr "Opzioni del menu a tendina"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Dropdown Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown values"+msgstr ""+#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsx#: apps/remix/app/components/dialogs/template-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate"msgstr "Duplica"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Document"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate on all pages"msgstr "Duplica in tutte le pagine"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Template"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks._index.tsx#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx@@ -3471,6 +3679,10 @@ msgstr "Divulgazione della firma elettronica"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-email-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/general/direct-template/direct-template-configure-form.tsx@@ -3548,6 +3760,10 @@ msgstr "Domini Email"msgid "Email domains synced"msgstr "Domini email sincronizzati"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Email is required"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Email Options"msgstr "Opzioni email"@@ -3567,6 +3783,8 @@ msgstr "Preferenze email aggiornate"msgid "Email resent"msgstr "Email rinviato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Email Sender"@@ -3580,6 +3798,14 @@ msgstr "Email inviato"msgid "Email sent!"msgstr "Email inviato!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Email Settings"+msgstr ""++#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Email verification"+msgstr ""+#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsxmsgid "Email verification has been removed"msgstr "Verifica email rimossa"@@ -3644,6 +3870,7 @@ msgstr "Abilita il marchio personalizzato per tutti i documenti in questo team"msgid "Enable Direct Link Signing"msgstr "Abilita la firma di link diretto"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -3681,6 +3908,10 @@ msgstr "Inserisci nome richiesta"msgid "Enter the domain you want to use for sending emails (without http:// or www)"msgstr "Inserisci il dominio che desideri utilizzare per inviare email (senza http:// o www)"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Enter verification code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your 2FA code"msgstr "Inserisci il tuo codice 2FA"@@ -3701,11 +3932,16 @@ msgstr "Inserisci il tuo indirizzo email per ricevere il documento completato."msgid "Enter your name"msgstr "Inserisci il tuo nome"+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Enter your number here"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your password"msgstr "Inserisci la tua password"#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsxmsgid "Enter your text here"msgstr "Inserisci il tuo testo qui"@@ -3713,6 +3949,34 @@ msgstr "Inserisci il tuo testo qui"msgid "Enterprise"msgstr "Impresa"+#: packages/ui/primitives/document-upload.tsx+msgid "Envelope (beta)"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Envelope distributed"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Envelope Duplicated"+msgstr ""++#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+msgid "Envelope ID"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Envelope resent"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Envelope Title"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Envelope updated"+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -3753,7 +4017,8 @@ msgstr "Impresa"#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsx-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx@@ -3814,11 +4079,17 @@ msgstr "Tempo scaduto"msgid "Expired"msgstr "Scaduto"+#. placeholder {0}: DateTime.fromMillis(Math.max(millisecondsRemaining, 0)).toFormat( 'mm:ss', )+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Expires in {0}"+msgstr ""+#. placeholder {0}: i18n.date(token.expires, DateTime.DATETIME_FULL)#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Expires on {0}"msgstr "Scade il {0}"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "External ID"@@ -3902,10 +4173,12 @@ msgstr "Falliti: {failedCount}"msgid "Feature Flags"msgstr "Flags delle funzionalità"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field character limit"msgstr "Limite di caratteri del campo"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -3915,16 +4188,20 @@ msgstr "Limite di caratteri del campo"msgid "Field font size"msgstr "Dimensione del carattere del campo"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Field format"msgstr "Formato del campo"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Field label"msgstr "Etichetta del campo"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field placeholder"msgstr "Segnaposto del campo"@@ -3952,7 +4229,8 @@ msgstr "Campi"msgid "Fields updated"msgstr "Campi aggiornati"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"msgstr "Il file non può essere più grande di {APP_DOCUMENT_UPLOAD_SIZE_LIMIT} MB"@@ -4010,6 +4288,7 @@ msgstr "Impostazioni Cartella"msgid "Folder updated successfully"msgstr "Cartella aggiornata con successo"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -4049,6 +4328,11 @@ msgstr "Gratuito"msgid "Free Signature"msgstr "Firma gratuita"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Free Signature Settings"+msgstr ""++#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -4064,6 +4348,7 @@ msgstr "Nome completo"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-page.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx@@ -4074,6 +4359,7 @@ msgstr "Generale"msgid "Generate DKIM Records"msgstr "Genera Record DKIM"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Generate Links"msgstr "Genera link"@@ -4085,7 +4371,9 @@ msgstr "Autenticazione globale del destinatario"#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsxmsgid "Go back"@@ -4094,7 +4382,9 @@ msgstr "Torna indietro"#: apps/remix/app/routes/_recipient+/_layout.tsx#: apps/remix/app/routes/_profile+/_layout.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: packages/ui/primitives/document-flow/document-flow-root.tsxmsgid "Go Back"@@ -4109,10 +4399,12 @@ msgstr "Torna alla home"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Go Back Home"msgstr "Torna alla home"#: apps/remix/app/routes/_authenticated+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxmsgid "Go home"msgstr "Vai a home"@@ -4163,22 +4455,25 @@ msgstr "Nome del gruppo"msgid "Groups"msgstr "Gruppi"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to approve this document"msgstr "ti ha invitato ad approvare questo documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to assist this document"msgstr "ti ha invitato ad assistere questo documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to sign this document"msgstr "ti ha invitato a firmare questo documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to view this document"msgstr "ti ha invitato a visualizzare questo documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -4248,6 +4543,10 @@ msgstr "Ciao, sono Timur"msgid "Hi {userName},"msgstr "Ciao {userName},"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+msgstr ""+#: packages/email/templates/reset-password.tsxmsgid "Hi, {userName} <0>({userEmail})</0>"msgstr "Ciao, {userName} <0>({userEmail})</0>"@@ -4269,6 +4568,7 @@ msgstr "Home"msgid "Home (No Folder)"msgstr "Home (Nessuna Cartella)"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Horizontal"msgstr "Orizzontale"@@ -4322,6 +4622,10 @@ msgstr "ID copiato negli appunti"msgid "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."msgstr "Se ci sono problemi con il tuo abbonamento, contattaci a <0>{SUPPORT_EMAIL}</0>."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "If you didn't request this verification code, you can safely ignore this email."+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."msgstr "Se non vuoi utilizzare l'autenticatore richiesto, puoi chiuderlo, dopodiché verrà mostrato il successivo disponibile."@@ -4388,11 +4692,29 @@ msgstr "Ereditare i membri dell'organizzazione"msgid "Inherited subscription claim"msgstr "Rivendicazione di abbonamento ereditata"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-initials-field.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Initials"msgstr "Iniziali"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Initials are required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Initials Settings"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Insert a value into the number field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Insert a value into the text field"+msgstr ""+#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsxmsgid "Inserted"msgstr "Inserito"@@ -4409,6 +4731,7 @@ msgstr "Codice non valido. Riprova."msgid "Invalid domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.types.tsmsgid "Invalid email"msgstr "Email non valida"@@ -4531,6 +4854,8 @@ msgstr ""msgid "Joined {0}"msgstr "Iscritto a {0}"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -4541,6 +4866,7 @@ msgstr "Etichetta"#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -4568,6 +4894,10 @@ msgstr "Ultimo accesso"msgid "Last modified"msgstr "Ultima modifica"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Last Retried"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Last updated"msgstr "Ultimo aggiornamento"@@ -4604,6 +4934,10 @@ msgstr "Lascia vuoto per ereditare dall'organizzazione."msgid "Leave organisation"msgstr "Lascia l'organizzazione"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Left"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "Legality of Electronic Signatures"msgstr "Legalità delle firme elettroniche"@@ -4654,9 +4988,16 @@ msgstr "Ascoltando {0}"msgid "Load older activity"msgstr "Carica attività precedente"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Loading"+msgstr ""+#: apps/remix/app/components/general/skeletons/document-edit-skeleton.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Loading document..."msgstr "Caricamento del documento..."@@ -4722,7 +5063,7 @@ msgstr "Gestisci la Fatturazione"msgid "Manage details for this public template"msgstr "Gestisci i dettagli per questo modello pubblico"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Manage Direct Link"msgstr "Gestisci Link Diretto"@@ -4847,6 +5188,7 @@ msgstr "MAU (ha completato il documento)"msgid "MAU (signed in)"msgstr "MAU (autenticati)"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Max"msgstr ""@@ -4888,7 +5230,9 @@ msgstr "Membro dal"msgid "Members"msgstr "Membri"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Message"@@ -4898,6 +5242,7 @@ msgstr "Messaggio"msgid "Message <0>(Optional)</0>"msgstr "Messaggio <0>(Opzionale)</0>"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Min"msgstr ""@@ -4970,9 +5315,13 @@ msgstr "N/A"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/admin-leaderboard-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/forms/subscription-claim-form.tsx@@ -4995,9 +5344,14 @@ msgid "Name"msgstr "Nome"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsxmsgid "Name is required"msgstr "Nome richiesto"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Name Settings"+msgstr ""+#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Need to sign documents?"msgstr "Hai bisogno di firmare documenti?"@@ -5055,6 +5409,12 @@ msgstr "No"msgid "No active drafts"msgstr "Nessuna bozza attiva"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "No documents found"+msgstr ""+#: apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxmsgid "No folders found"@@ -5094,6 +5454,7 @@ msgstr "Nessun destinatario corrispondente a questa descrizione è stato trovato#: apps/remix/app/components/general/template/template-page-view-recipients.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "No recipients"msgstr "Nessun destinatario"@@ -5155,11 +5516,18 @@ msgid "No worries, it happens! Enter your email and we'll email you a special limsgstr "Non ti preoccupare, succede! Inserisci la tua email e ti invieremo un link speciale per reimpostare la tua password."#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/lib/constants/document.tsmsgid "None"msgstr "Nessuno"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Not found"+msgstr ""+#: apps/remix/app/components/forms/signin.tsxmsgid "Not supported"msgstr "Non supportato"@@ -5169,6 +5537,7 @@ msgstr "Non supportato"msgid "Nothing to do"msgstr "Niente da fare"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-number-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -5176,6 +5545,7 @@ msgstr "Niente da fare"msgid "Number"msgstr "Numero"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Number format"msgstr "Formato numero"@@ -5190,23 +5560,27 @@ msgstr "Numero di membri consentiti. 0 = Illimitati"msgid "Number of teams allowed. 0 = Unlimited"msgstr "Numero di team consentiti. 0 = Illimitati"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Number Settings"+msgstr ""+#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to approve this document"msgstr "per conto di \"{0}\" ti ha invitato ad approvare questo documento"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to assist this document"msgstr "per conto di \"{0}\" ti ha invitato ad assistere questo documento"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to sign this document"msgstr "per conto di \"{0}\" ti ha invitato a firmare questo documento"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to view this document"msgstr "per conto di \"{0}\" ti ha invitato a visualizzare questo documento"@@ -5269,6 +5643,8 @@ msgid "Only PDF files are allowed"msgstr ""#: apps/remix/app/routes/_profile+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsxmsgid "Oops! Something went wrong."@@ -5278,6 +5654,14 @@ msgstr "Ops! Qualcosa è andato storto."msgid "Opened"msgstr "Aperto"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Option is required"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Option value cannot be empty"+msgstr ""+#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Or"@@ -5444,6 +5828,7 @@ msgstr "Pagina {0} di {1}"#. placeholder {0}: i + 1#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Page {0} of {numPages}"msgstr "Pagina {0} di {numPages}"@@ -5532,6 +5917,7 @@ msgstr "Pagamento scaduto"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/components/tables/organisation-email-domains-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsx@@ -5581,6 +5967,7 @@ msgstr "Account personale"msgid "Personal Inbox"msgstr "Posta in arrivo personale"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Pick a number"msgstr "Scegli un numero"@@ -5597,6 +5984,13 @@ msgstr "Scegli uno dei seguenti accordi e inizia a firmare per iniziare"msgid "Pin"msgstr "Fissa"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Place and configure form fields in the document"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -5671,7 +6065,11 @@ msgstr "Si prega di inserire un nome significativo per il proprio token. Questomsgid "Please enter a valid name."msgstr "Per favore inserisci un nome valido."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Please enter a valid number"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please mark as viewed to complete."msgstr ""@@ -5707,6 +6105,10 @@ msgstr "Si prega di notare che questa azione è irreversibile. Una volta confermmsgid "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"msgstr "Si prega di notare che perderai l'accesso a tutti i documenti associati a questo team e tutti i membri saranno rimossi e notificati"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please open your authenticator app and enter the 6-digit code for this document."+msgstr ""+#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."msgstr "Si prega di fornire un token dal tuo autenticatore, o un codice di backup. Se non hai un codice di backup disponibile, contatta il supporto."@@ -5715,11 +6117,11 @@ msgstr "Si prega di fornire un token dal tuo autenticatore, o un codice di backumsgid "Please provide a token from your authenticator, or a backup code."msgstr "Si prega di fornire un token dal tuo autenticatore, o un codice di backup."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before approving."msgstr "Per favore, esamina il documento prima di approvarlo."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before signing."msgstr "Rivedi il documento prima di firmare."@@ -5727,6 +6129,10 @@ msgstr "Rivedi il documento prima di firmare."msgid "Please select a PDF file"msgstr "Seleziona un file PDF"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please select how you'd like to receive your verification code."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-create-dialog.tsxmsgid "Please try a different domain."msgstr "Si prega di provare un altro dominio."@@ -5742,6 +6148,8 @@ msgstr "Si prega di riprovare più tardi."#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Please try again or contact our support."msgstr "Per favore, riprova o contatta il nostro supporto."@@ -5755,6 +6163,11 @@ msgstr "Per favore, digita {0} per confermare"msgid "Please type <0>{0}</0> to confirm."msgstr "Si prega di digitare <0>{0}</0> per confermare."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Please upload a document to continue"+msgstr ""+#: apps/remix/app/components/forms/branding-preferences-form.tsxmsgid "Please upload a logo"msgstr "Si prega di caricare un logo"@@ -5770,6 +6183,7 @@ msgstr "Modello CSV preformattato con dati di esempio."msgid "Preferences"msgstr "Preferenze"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/forms/document-preferences-form.tsxmsgid "Preview"msgstr "Anteprima"@@ -5778,11 +6192,29 @@ msgstr "Anteprima"msgid "Preview and configure template."msgstr "Anteprima e configurazione del modello."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview Mode"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Preview the document before sending"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview what the signed document will look like with placeholder data"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/general/template/template-type.tsxmsgid "Private"msgstr "Privato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Private Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Private templates can only be modified and viewed by you."msgstr "I modelli privati possono essere modificati e visualizzati solo da te."@@ -5843,14 +6275,28 @@ msgstr "Profilo pubblico"msgid "Public profile URL"msgstr "URL del profilo pubblico"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Public Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."msgstr "I modelli pubblici sono collegati al tuo profilo pubblico. Ogni modifica ai modelli pubblici apparirà anche nel tuo profilo pubblico."+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Quick Actions"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Radio"msgstr "Radio"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Radio Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-radio-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsxmsgid "Radio values"msgstr "Valori radio"@@ -5863,6 +6309,10 @@ msgstr "Valori radio"msgid "Read only"msgstr "Sola lettura"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Read Only"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.support.tsxmsgid "Read our documentation to get started with Documenso."msgstr ""@@ -5918,9 +6368,13 @@ msgstr "Documenti recenti"#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsx#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.tsmsgid "Recipient"msgstr "Destinatario"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/recipient/recipient-action-auth-select.tsx@@ -5955,6 +6409,10 @@ msgstr "Destinatari"msgid "Recipients metrics"msgstr "Metriche dei destinatari"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Recipients will be able to sign the document once sent"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Recipients will still retain their copy of the document"msgstr "I destinatari conserveranno comunque la loro copia del documento"@@ -5987,12 +6445,17 @@ msgstr "Rosso"msgid "Redirect URI"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Redirect URL"msgstr "URL di reindirizzamento"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+msgid "Redirecting"+msgstr ""+#: apps/remix/app/components/general/claim-account.tsx#: apps/remix/app/components/forms/signup.tsxmsgid "Registration Successful"@@ -6001,12 +6464,13 @@ msgstr "Registrazione avvenuta con successo"#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Reject Document"msgstr "Rifiuta Documento"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx@@ -6022,16 +6486,21 @@ msgstr "Rifiuto confermato"msgid "Rejection reason: {reason}"msgstr "Motivo del rifiuto: {reason}"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Reload"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/forgot-password.tsxmsgid "Remembered your password? <0>Sign In</0>"msgstr "Ricordi la tua password? <0>Accedi</0>"-#. placeholder {0}: customEmail.subject+#. placeholder {0}: envelope.documentMeta.subject#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0}"msgstr "Promemoria: {0}"-#. placeholder {0}: document.team.name+#. placeholder {0}: envelope.team.name#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0} invited you to {recipientActionVerb} a document"msgstr "Promemoria: {0} ti ha invitato a {recipientActionVerb} un documento"@@ -6051,6 +6520,7 @@ msgstr "Promemoria: per favore {recipientActionVerb} il tuo documento"#: apps/remix/app/components/tables/organisation-members-table.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx#: apps/remix/app/components/general/teams/team-email-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document-signing/document-signing-field-container.tsx#: apps/remix/app/components/forms/branding-preferences-form.tsx#: apps/remix/app/components/forms/avatar-image.tsx@@ -6095,6 +6565,8 @@ msgstr "Ripeti Password"msgid "Reply to email"msgstr "Rispondi all'email"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Reply To Email"@@ -6112,6 +6584,10 @@ msgstr ""msgid "Required field"msgstr "Campo richiesto"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Required Field"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "Required scopes"msgstr ""@@ -6126,10 +6602,20 @@ msgstr "Risigilla documento"msgid "Resend"msgstr "Reinvia"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Resend code"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Resend Confirmation Email"msgstr "Reinvia email di conferma"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Resend Document"+msgstr ""+#: apps/remix/app/components/general/teams/team-email-dropdown.tsxmsgid "Resend verification"msgstr "Reinvia verifica"@@ -6188,6 +6674,10 @@ msgstr "Accesso limitato"msgid "Retention of Documents"msgstr "Conservazione dei documenti"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Retried"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-passkey.tsxmsgid "Retry"msgstr "Riprova"@@ -6196,6 +6686,7 @@ msgstr "Riprova"#: apps/remix/app/routes/_unauthenticated+/organisation.invite.$token.tsx#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsx#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Return"msgstr "Ritorna"@@ -6203,6 +6694,10 @@ msgstr "Ritorna"msgid "Return to Documenso sign in page here"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to documents"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "Return to Home"msgstr "Torna alla home"@@ -6212,6 +6707,10 @@ msgstr "Torna alla home"msgid "Return to sign in"msgstr "Torna a accedere"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to templates"+msgstr ""+#: packages/email/templates/organisation-account-link-confirmation.tsxmsgid "Review request"msgstr ""@@ -6231,6 +6730,10 @@ msgstr "Revoca l'accesso"msgid "Revoke all sessions"msgstr "Revoca tutte le sessioni"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Right"+msgstr ""+#: apps/remix/app/components/tables/user-organisations-table.tsx#: apps/remix/app/components/tables/team-members-table.tsx#: apps/remix/app/components/tables/team-groups-table.tsx@@ -6263,10 +6766,20 @@ msgstr "Righe per pagina"msgid "Save"msgstr "Salva"+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "Save failed"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-fields.tsxmsgid "Save Template"msgstr "Salva modello"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "Sealing job started"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.members.tsx@@ -6320,6 +6833,7 @@ msgstr "Segreto"#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsx#: apps/remix/app/components/general/settings-nav-mobile.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Security"msgstr "Sicurezza"@@ -6327,6 +6841,10 @@ msgstr "Sicurezza"msgid "Security activity"msgstr "Attività di sicurezza"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "See the background jobs tab for the status"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-dropdown-field.tsx#: packages/ui/primitives/document-flow/types.ts#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsx@@ -6365,10 +6883,15 @@ msgstr "Seleziona un modello che desideri mostrare nel profilo pubblico del tuomsgid "Select a time zone"msgstr "Seleziona un fuso orario"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Select a value to sign into the field"+msgstr ""+#: packages/ui/components/document/document-global-auth-access-select.tsxmsgid "Select access methods"msgstr "Seleziona i metodi di accesso"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: packages/ui/primitives/combobox.tsxmsgid "Select an option"msgstr "Seleziona un'opzione"@@ -6377,6 +6900,7 @@ msgstr "Seleziona un'opzione"msgid "Select an organisation to view teams"msgstr "Seleziona un'organizzazione per visualizzare i team"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select at least"msgstr "Seleziona almeno"@@ -6386,6 +6910,7 @@ msgstr "Seleziona almeno"msgid "Select authentication methods"msgstr "Seleziona i metodi di autenticazione"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Select default option"msgstr "Seleziona opzione predefinita"@@ -6394,6 +6919,7 @@ msgstr "Seleziona opzione predefinita"msgid "Select default role"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select direction"msgstr "Seleziona la direzione"@@ -6432,6 +6958,10 @@ msgstr "Seleziona una chiave di accesso"msgid "Select signature types"msgstr "Seleziona i tipi di firme"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Select text align"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-create-dialog.tsxmsgid "Select the members to add to this group"msgstr "Seleziona i membri da aggiungere a questo gruppo"@@ -6449,6 +6979,12 @@ msgstr "Seleziona trigger"msgid "Select visibility"msgstr "Seleziona visibilità"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Selected Recipient"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -6469,6 +7005,9 @@ msgstr "Invia email di conferma"msgid "Send document"msgstr "Invia documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsxmsgid "Send Document"msgstr "Invia documento"@@ -6513,10 +7052,15 @@ msgstr "Invia email firmato dal destinatario"msgid "Send recipient signing request email"msgstr "Invia email richiesta firma destinatario"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsxmsgid "Send reminder"msgstr "Invia promemoria"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Send reminders to the following recipients"+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "Send Test Webhook"msgstr "Invia Webhook di Prova"@@ -6567,6 +7111,7 @@ msgstr "Configura le proprietà del modello e le informazioni sui destinatari"#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/folder/folder-card.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Settings"msgstr "Impostazioni"@@ -6600,6 +7145,7 @@ msgstr "Condividi la tua esperienza di firma!"msgid "Show"msgstr "Mostra"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Show advanced settings"@@ -6609,11 +7155,6 @@ msgstr "Mostra impostazioni avanzate"msgid "Show templates in your public profile for your audience to sign and get started quickly"msgstr "Mostra modelli nel tuo profilo pubblico per il tuo pubblico da firmare e iniziare rapidamente"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Sign"-msgstr ""-#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -6627,9 +7168,21 @@ msgstr ""#: apps/remix/app/components/general/document-signing/document-signing-auth-password.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-2fa.tsx#: apps/remix/app/components/general/document/document-page-view-button.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsxmsgid "Sign"msgstr "Firma"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Sign"+msgstr ""+#. placeholder {0}: recipient.name#. placeholder {1}: recipient.email#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx@@ -6648,8 +7201,8 @@ msgstr "Firma come<0>{0} <1>({1})</1></0>"msgid "Sign document"msgstr "Firma il documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Sign Document"msgstr "Firma documento"@@ -6657,6 +7210,14 @@ msgstr "Firma documento"msgid "Sign Documents"msgstr "Firma documenti"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign Dropdown Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign Email"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Sign field"@@ -6679,12 +7240,32 @@ msgstr "Accedi"msgid "Sign in to your account"msgstr "Accedi al tuo account"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign Initials"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign Name"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Sign Number Field"+msgstr ""+#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx#: apps/remix/app/components/general/app-nav-mobile.tsxmsgid "Sign Out"msgstr "Disconnetti"+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+msgid "Sign Signature Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Sign Text Field"+msgstr ""+#: apps/remix/app/components/embed/embed-document-signing-page.tsx#: apps/remix/app/components/embed/embed-direct-template-client-page.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -6703,8 +7284,22 @@ msgstr "Iscriviti con Google"msgid "Sign Up with OIDC"msgstr "Iscriviti con OIDC"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign your email into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign your full name into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign your initials into the field"+msgstr ""+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -6730,6 +7325,10 @@ msgstr "La firma è troppo piccola"msgid "Signature Pad cannot be empty."msgstr "Il pad per la firma non può essere vuoto."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Signature Settings"+msgstr ""+#: packages/ui/components/document/document-signature-settings-tooltip.tsxmsgid "Signature types"msgstr "Tipi di firma"@@ -6742,17 +7341,17 @@ msgstr "Firme raccolte"msgid "Signatures will appear once the document has been completed"msgstr "Le firme appariranno una volta completato il documento"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Signed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsxmsgid "Signed"msgstr "Firmato"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Signed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Signer"@@ -6803,6 +7402,7 @@ msgstr "Link di firma"msgid "Signing links have been generated for this document."msgstr "I link di firma sono stati generati per questo documento."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Signing order is enabled."@@ -6831,6 +7431,7 @@ msgstr "Banner del sito"msgid "Site Settings"msgstr "Impostazioni del sito"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."msgstr "Alcuni firmatari non hanno un campo firma assegnato. Assegna almeno 1 campo di firma a ciascun firmatario prima di procedere."@@ -6879,6 +7480,9 @@ msgstr "Alcuni firmatari non hanno un campo firma assegnato. Assegna almeno 1 ca#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-member-invite-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx@@ -6893,6 +7497,8 @@ msgstr "Qualcosa è andato storto durante il tentativo di verifica del tuo indir#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Something went wrong while loading the document."msgstr "Qualcosa è andato storto durante il caricamento del documento."@@ -6908,6 +7514,10 @@ msgstr "Qualcosa è andato storto durante l'invio dell'e-mail di conferma."msgid "Something went wrong while updating the team billing subscription, please contact support."msgstr "Qualcosa è andato storto durante l'aggiornamento dell'abbonamento di fatturazione del team, contatta il supporto."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Something went wrong while uploading this file"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.email.tsx@@ -6960,6 +7570,7 @@ msgstr "Statistiche"#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table.tsx#: apps/remix/app/components/tables/admin-organisations-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsxmsgid "Status"msgstr "Stato"@@ -6981,10 +7592,12 @@ msgid "Stripe Customer ID"msgstr "ID cliente di Stripe"#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Subject"msgstr "Soggetto"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Subject <0>(Optional)</0>"@@ -6994,6 +7607,10 @@ msgstr "Oggetto <0>(Opzionale)</0>"msgid "Submit"msgstr ""+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Submitted"+msgstr ""+#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx@@ -7033,7 +7650,6 @@ msgstr "Abbonamento non valido"#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx@@ -7043,6 +7659,7 @@ msgstr "Abbonamento non valido"#: apps/remix/app/components/general/teams/team-email-dropdown.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/organisation-update-form.tsx@@ -7074,6 +7691,7 @@ msgstr "Abbonamento non valido"#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsxmsgid "Success"msgstr "Successo"@@ -7107,6 +7725,10 @@ msgstr "Sincronizza"msgid "Sync Email Domains"msgstr "Sincronizza Domini Email"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Sync failed, changes not saved"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "System Requirements"msgstr "Requisiti di sistema"@@ -7259,7 +7881,7 @@ msgstr "I team ti aiutano a organizzare il tuo lavoro e collaborare con altri. Cmsgid "Teams that this organisation group is currently assigned to"msgstr "Team a cui è attualmente assegnato questo gruppo di organizzazione"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx@@ -7285,6 +7907,10 @@ msgstr "Documento modello caricato"msgid "Template duplicated"msgstr "Modello duplicato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Editor"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Template has been removed from your public profile."msgstr "Il modello è stato rimosso dal tuo profilo pubblico."@@ -7305,6 +7931,10 @@ msgstr "Modello spostato"msgid "Template saved"msgstr "Modello salvato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Settings"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Template title"msgstr "Titolo del modello"@@ -7314,6 +7944,7 @@ msgid "Template updated successfully"msgstr "Modello aggiornato con successo"#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsxmsgid "Template uploaded"msgstr "Modello caricato"@@ -7344,6 +7975,7 @@ msgstr "Il test del webhook non è riuscito"msgid "Test webhook sent"msgstr "Webhook di prova inviato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx@@ -7352,6 +7984,7 @@ msgstr "Webhook di prova inviato"msgid "Text"msgstr "Testo"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -7365,6 +7998,14 @@ msgstr "Allineamento del testo"msgid "Text Color"msgstr "Colore del testo"+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Text is required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Text Settings"+msgstr ""+#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Thank you for completing the signing process."msgstr "Grazie per aver completato il processo di firma."@@ -7453,6 +8094,17 @@ msgstr "Il documento verrà nascosto dal tuo account"msgid "The document will be immediately sent to recipients if this is checked."msgstr "Il documento sarà immediatamente inviato ai destinatari se selezionato."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "The document you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: packages/ui/components/document/document-send-email-message-helper.tsxmsgid "The document's name"msgstr "Il nome del documento"@@ -7618,6 +8270,7 @@ msgstr "Il nome del firmatario"#: apps/remix/app/components/general/avatar-with-recipient.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "The signing link has been copied to your clipboard."msgstr "Il link di firma è stato copiato negli appunti."@@ -7654,6 +8307,16 @@ msgstr "Il modello è stato spostato con successo."msgid "The template will be removed from your profile"msgstr "Il modello sarà rimosso dal tuo profilo"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "The template you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+msgid ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "The test webhook has been successfully sent to your endpoint."msgstr "Il test del webhook è stato inviato con successo al tuo endpoint."@@ -7769,6 +8432,10 @@ msgstr "Questa azione è reversibile, ma fai attenzione poiché l'account potrebmsgid "This claim is locked and cannot be deleted."msgstr "Questo reclamo è bloccato e non può essere eliminato."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "This code will expire in {expiresInMinutes} minutes."+msgstr ""+#: packages/email/template-components/template-document-super-delete.tsxmsgid "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."msgstr "Questo documento non può essere recuperato, se vuoi contestare la ragione per i documenti futuri, contatta il supporto."@@ -7781,6 +8448,7 @@ msgstr "Questo documento non può essere modificato"msgid "This document could not be deleted at this time. Please try again."msgstr "Questo documento non può essere eliminato in questo momento. Riprova."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsxmsgid "This document could not be duplicated at this time. Please try again."msgstr "Questo documento non può essere duplicato in questo momento. Riprova."@@ -7797,6 +8465,7 @@ msgstr "Questo documento è già stato inviato a questo destinatario. Non puoi pmsgid "This document has been cancelled by the owner and is no longer available for others to sign."msgstr "Questo documento è stato annullato dal proprietario e non è più disponibile per la firma di altri."+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "This document has been cancelled by the owner."msgstr "Questo documento è stato annullato dal proprietario."@@ -7833,6 +8502,10 @@ msgstr "Questo documento è stato creato utilizzando un link diretto."msgid "This document was sent using <0>Documenso.</0>"msgstr "Questo documento è stato inviato utilizzando <0>Documenso.</0>"+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This document will be duplicated."+msgstr ""+#: packages/email/template-components/template-document-rejection-confirmed.tsxmsgid "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."msgstr "Questa email conferma che hai rifiutato il documento <0>\"{documentName}\"</0> inviato da {documentOwnerName}."@@ -7857,6 +8530,14 @@ msgstr "Questa email viene inviata al destinatario chiedendo loro di firmare ilmsgid "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."msgstr "Questa email sarà inviata al destinatario che ha appena firmato il documento, se ci sono ancora altri destinatari che non hanno ancora firmato."+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "This envelope could not be distributed at this time. Please try again."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "This envelope could not be resent at this time. Please try again."+msgstr ""+#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."msgstr "Questo campo non può essere modificato o eliminato. Quando condividi il link diretto di questo modello o lo aggiungi al tuo profilo pubblico, chiunque vi acceda può inserire il proprio nome e email, e compilare i campi assegnati."@@ -7865,6 +8546,7 @@ msgstr "Questo campo non può essere modificato o eliminato. Quando condividi ilmsgid "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."msgstr "Questa cartella contiene più elementi. Eliminandola verranno rimossi tutte le sottocartelle e i documenti e modelli nidificati verranno spostati nella cartella principale."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "This is how the document will reach the recipients once the document is ready for signing."msgstr "È così che il documento raggiungerà i destinatari una volta pronto per essere firmato."@@ -7881,6 +8563,10 @@ msgstr ""msgid "This is the URL which users will use to sign in to your organisation."msgstr ""+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "This item cannot be deleted"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/team.verify.email.$token.tsxmsgid "This link is invalid or has expired. Please contact your team to resend a verification."msgstr "Questo link è invalido o è scaduto. Si prega di contattare il tuo team per inviare nuovamente una verifica."@@ -7901,6 +8587,7 @@ msgstr "Questa chiave d'accesso è già stata registrata."msgid "This passkey is not configured for this application. Please login and add one in the user settings."msgstr "Questa chiave di accesso non è configurata per questa applicazione. Effettua il login e aggiungine una nelle impostazioni utente."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "This recipient can no longer be modified as they have signed a field, or completed the document."msgstr "Questo destinatario non può più essere modificato poiché ha firmato un campo o completato il documento."@@ -7909,6 +8596,7 @@ msgstr "Questo destinatario non può più essere modificato poiché ha firmato umsgid "This session has expired. Please try again."msgstr "Questa sessione è scaduta. Per favore prova di nuovo."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "This signer has already signed the document."msgstr "Questo firmatario ha già firmato il documento."@@ -7925,6 +8613,10 @@ msgstr "Questo modello non può essere eliminato in questo momento. Per favore pmsgid "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."msgstr "Questo modello utilizza l'inserimento campo legacy, consigliamo di utilizzare il nuovo metodo di inserimento campo per risultati più accurati."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This template will be duplicated."+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "This token is invalid or has expired. No action is needed."msgstr "Questo token è invalido o è scaduto. Non è necessaria alcuna azione."@@ -7976,6 +8668,7 @@ msgid "Time zone"msgstr "Fuso orario"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -8124,6 +8817,7 @@ msgstr "Autenticazione a due fattori"msgid "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."msgstr "I codici di recupero dell'autenticazione a due fattori sono utilizzati per accedere al tuo account nel caso in cui perdi l'accesso alla tua app di autenticazione."+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/forms/signin.tsxmsgid "Two-Factor Authentication"msgstr "Autenticazione a due fattori"@@ -8144,17 +8838,17 @@ msgstr "L'autenticazione a due fattori è stata disattivata per il tuo account.msgid "Two-Factor Re-Authentication"msgstr "Ri-autenticazione a due fattori"-#: packages/lib/constants/document.ts-msgctxt "Type signatute type"-msgid "Type"-msgstr ""-#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Type"msgstr "Tipo"+#: packages/lib/constants/document.ts+msgctxt "Type signatute type"+msgid "Type"+msgstr ""+#: apps/remix/app/components/general/app-command-menu.tsxmsgid "Type a command or search..."msgstr "Digita un comando o cerca..."@@ -8303,6 +8997,7 @@ msgstr "Gruppo senza nome"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-public-profile-templates-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/email-preferences-form.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx@@ -8434,15 +9129,15 @@ msgstr "Aggiorna <0>{0}</0> al {planName}"msgid "Upgrade your plan to upload more documents"msgstr "Aggiorna il tuo piano per caricare più documenti"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Upload"+msgstr "Carica"+#: packages/lib/constants/document.tsmsgctxt "Upload signatute type"msgid "Upload"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Upload"-msgstr "Carica"-#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Upload a CSV file to create multiple documents from this template. Each row represents one document with its recipient details."msgstr "Carica un file CSV per creare più documenti da questo modello. Ogni riga rappresenta un documento con i dettagli del destinatario."@@ -8467,12 +9162,20 @@ msgstr "Carica CSV"msgid "Upload custom document"msgstr "Carica documento personalizzato"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Upload disabled"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsx#: packages/ui/primitives/document-upload.tsxmsgid "Upload Document"msgstr "Carica documento"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Upload documents and add recipients"+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Upload failed"@@ -8512,6 +9215,10 @@ msgstr "Il file caricato è troppo piccolo"msgid "Uploaded file not an allowed file type"msgstr "Il file caricato non è di un tipo di file consentito"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Uploading"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Uploading document..."msgstr "Caricamento documento in corso..."@@ -8534,10 +9241,15 @@ msgstr "Usa Authenticator"msgid "Use Backup Code"msgstr "Usa il Codice di Backup"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Use Template"msgstr "Usa Modello"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Use your authenticator app to generate a code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Use your passkey for authentication"msgstr "Usa la tua chiave di accesso per l'autenticazione"@@ -8586,17 +9298,25 @@ msgstr "Un utente con questo email esiste già. Si prega di utilizzare un indirimsgid "Users"msgstr "Utenti"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Validation"msgstr "Validazione"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Value"msgstr "Valore"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Verification Code Required"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Verification Email Sent"msgstr "Email di Verifica Inviata"@@ -8605,6 +9325,10 @@ msgstr "Email di Verifica Inviata"msgid "Verification email sent successfully."msgstr "Email di verifica inviata con successo."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Verify & Complete"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsxmsgid "Verify Domain"msgstr "Verifica Dominio"@@ -8621,7 +9345,8 @@ msgstr "Verifica il tuo indirizzo email"msgid "Verify your email address to unlock all features."msgstr "Verifica il tuo indirizzo email per sbloccare tutte le funzionalità."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Verify your email to upload documents."msgstr "Verifica il tuo email per caricare documenti."@@ -8629,15 +9354,11 @@ msgstr "Verifica il tuo email per caricare documenti."msgid "Verify your team email address"msgstr "Verifica il tuo indirizzo email del team"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Vertical"msgstr "Verticale"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "View"-msgstr ""-#: apps/remix/app/components/tables/organisation-billing-invoices-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx@@ -8650,6 +9371,11 @@ msgstr ""msgid "View"msgstr "Visualizza"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "View"+msgstr ""+#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsxmsgid "View activity"msgstr "Visualizza attività"@@ -8696,7 +9422,7 @@ msgstr "Visualizza Record DNS"msgid "View document"msgstr "Visualizza documento"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -8705,6 +9431,18 @@ msgstr "Visualizza documento"msgid "View Document"msgstr "Visualizza documento"+#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to approve"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to assist"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to sign"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._index.tsxmsgid "View documents associated with this email"msgstr "Visualizza documenti associati a questa email"@@ -8746,17 +9484,17 @@ msgstr "Visualizza squadre"msgid "View the DNS records for this email domain"msgstr "Visualizza i record DNS per questo dominio email"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Viewed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Viewed"msgstr "Visualizzato"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Viewed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Viewer"@@ -8797,6 +9535,7 @@ msgstr "In attesa degli altri per firmare"msgid "Waiting for Your Turn"msgstr "In attesa del tuo turno"+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Want to send slick signing links like this one? <0>Check out Documenso.</0>"msgstr "Vuoi inviare link di firma eleganti come questo? <0>Scopri Documenso.</0>"@@ -8805,6 +9544,9 @@ msgstr "Vuoi inviare link di firma eleganti come questo? <0>Scopri Documenso.</0msgid "Want your own public profile?"msgstr "Vuoi il tuo profilo pubblico?"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -8848,6 +9590,12 @@ msgstr "Non siamo riusciti ad aggiornare l'organizzazione. Si prega di riprovaremsgid "We couldn't update the provider. Please try again."msgstr ""+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-create-dialog.tsxmsgid "We encountered an error while creating the email. Please try again later."msgstr "Abbiamo riscontrato un errore durante la creazione dell'email. Riprovare più tardi."@@ -8934,6 +9682,10 @@ msgstr "Abbiamo incontrato un errore sconosciuto durante il tentativo di rimuovemsgid "We encountered an unknown error while attempting to remove this email. Please try again later."msgstr "Abbiamo incontrato un errore sconosciuto durante il tentativo di rimuovere questa email. Si prega di riprovare più tardi."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/team-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "We encountered an unknown error while attempting to remove this group. Please try again later."@@ -8948,6 +9700,11 @@ msgstr "Abbiamo riscontrato un errore sconosciuto durante il tentativo di rimuovmsgid "We encountered an unknown error while attempting to remove this user. Please try again later."msgstr "Abbiamo riscontrato un errore sconosciuto durante il tentativo di rimuovere questo utente. Si prega di riprovare più tardi."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+msgstr ""+#: apps/remix/app/components/forms/reset-password.tsxmsgid "We encountered an unknown error while attempting to reset your password. Please try again later."msgstr "Abbiamo riscontrato un errore sconosciuto durante il tentativo di reimpostare la tua password. Si prega di riprovare più tardi."@@ -8971,6 +9728,10 @@ msgstr "Abbiamo riscontrato un errore sconosciuto durante il tentativo di registmsgid "We encountered an unknown error while attempting to update the banner. Please try again later."msgstr "Abbiamo riscontrato un errore sconosciuto durante il tentativo di aggiornare il banner. Si prega di riprovare più tardi."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "We encountered an unknown error while attempting to update the envelope. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "We encountered an unknown error while attempting to update the template. Please try again later."msgstr "Abbiamo riscontrato un errore sconosciuto durante il tentativo di aggiornare il modello. Si prega di riprovare più tardi."@@ -9083,11 +9844,13 @@ msgid "We were unable to verify your email. If your email is not verified alreadmsgstr "Non siamo riusciti a verificare la tua email. Se la tua email non è già verificata, riprova."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We will generate signing links for you, which you can send to the recipients through your method of choice."msgstr "Genereremo link di firma per te, che potrai inviare ai destinatari tramite il metodo di tua scelta."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We won't send anything to notify recipients."msgstr "Non invieremo nulla per notificare i destinatari."@@ -9096,6 +9859,10 @@ msgstr "Non invieremo nulla per notificare i destinatari."msgid "We'll get back to you as soon as possible via email."msgstr ""+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We'll send a 6-digit code to your email"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates._index.tsx#: apps/remix/app/components/tables/documents-table-empty-state.tsxmsgid "We're all empty"@@ -9109,6 +9876,10 @@ msgstr "Stiamo ancora aspettando che altri firmatari firmino questo documento.<0msgid "We've changed your password as you asked. You can now sign in with your new password."msgstr "Abbiamo cambiato la tua password come richiesto. Ora puoi accedere con la tua nuova password."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."msgstr "Abbiamo inviato un'email di conferma a <0>{email}</0>. Controlla la tua casella di posta e clicca sul link nell'email per verificare il tuo account."@@ -9173,6 +9944,7 @@ msgstr "Stavi provando a modificare questo documento invece?"msgid "What you can do with teams:"msgstr "Cosa puoi fare con i team:"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -9271,6 +10043,10 @@ msgstr ""msgid "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."msgstr "Stai per rimuovere il dominio email <0>{emailDomain}</0> da <1>{0}</1>. Tutte le email associate a questo dominio verranno eliminate."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You are about to remove the following document and all associated fields"+msgstr ""+#. placeholder {0}: organisation.name#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsxmsgid "You are about to remove the following email from <0>{0}</0>."@@ -9401,6 +10177,7 @@ msgstr "Puoi visualizzare i documenti creati nel tuo dashboard nella sezione \"Dmsgid "You can view the document and its status by clicking the button below."msgstr "Puoi visualizzare il documento e il suo stato cliccando sul pulsante qui sotto."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "You cannot add assistants when signing order is disabled."@@ -9410,6 +10187,10 @@ msgstr "Non puoi aggiungere assistenti quando l'ordine di firma è disabilitato.msgid "You cannot delete a group which has a higher role than you."msgstr "Non puoi eliminare un gruppo che ha un ruolo superiore al tuo."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You cannot delete this item because the document has been sent to recipients"+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."msgstr "Non puoi avere più di {MAXIMUM_PASSKEYS} passkey."@@ -9435,7 +10216,8 @@ msgstr "Non puoi rimuovere membri da questo team se la funzione di ereditarietàmsgid "You cannot upload documents at this time."msgstr "Non puoi caricare documenti in questo momento."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You cannot upload encrypted PDFs"msgstr "Non puoi caricare PDF crittografati"@@ -9494,7 +10276,7 @@ msgstr "Ti è stato richiesto di firmare i seguenti documenti. Esamina ciascun dmsgid "You have declined the invitation from <0>{0}</0> to join their organisation."msgstr "Hai rifiutato l'invito da <0>{0}</0> a unirti alla loro organizzazione."-#. placeholder {0}: `"${document.title}"`+#. placeholder {0}: `"${envelope.title}"`#: packages/lib/server-only/document/resend-document.ts#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "You have initiated the document {0} that requires you to {recipientActionVerb} it."@@ -9521,12 +10303,14 @@ msgstr "Hai raggiunto il limite massimo di {0} modelli diretti. <0>Aggiorna il tmsgid "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."msgstr "Hai raggiunto il massimo numero di team per il tuo piano. Si prega di contattare le vendite a <0>{SUPPORT_EMAIL}</0> se si desidera modificare il proprio piano."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You have reached your document limit for this month. Please upgrade your plan."msgstr "Hai raggiunto il limite dei documenti per questo mese. Si prega di aggiornare il proprio piano."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: packages/ui/primitives/document-dropzone.tsxmsgid "You have reached your document limit."msgstr "Hai raggiunto il tuo limite di documenti."@@ -9565,6 +10349,10 @@ msgstr "Hai rimosso correttamente questo dominio email dall'organizzazione."msgid "You have successfully removed this email from the organisation."msgstr "Hai rimosso correttamente questa email dall'organizzazione."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You have successfully removed this envelope item."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "You have successfully removed this group from the organisation."msgstr "Hai rimosso con successo questo gruppo dall'organizzazione."@@ -9613,11 +10401,19 @@ msgstr "Hai verificato il tuo indirizzo email per <0>{0}</0>."msgid "You must enter '{deleteMessage}' to proceed"msgstr "Devi inserire '{deleteMessage}' per procedere"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "You must select at least one item"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsxmsgid "You must type '{deleteMessage}' to confirm"msgstr "Devi digitare '{deleteMessage}' per confermare"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "You need at least one recipient to add fields"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "You need to be an admin to manage API tokens."msgstr "Devi essere un amministratore per gestire i token API."@@ -9699,7 +10495,8 @@ msgstr "Il tuo attuale piano è scaduto."msgid "Your direct signing templates"msgstr "I tuoi modelli di firma diretta"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Your document failed to upload."msgstr "Il tuo documento non è stato caricato."@@ -9728,7 +10525,8 @@ msgstr "Il tuo documento è stato inviato correttamente."msgid "Your document has been successfully duplicated."msgstr "Il tuo documento è stato duplicato correttamente."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Your document has been uploaded successfully."msgstr "Il tuo documento è stato caricato correttamente."@@ -9765,6 +10563,18 @@ msgstr "La tua email è attualmente utilizzata dal team <0>{0}</0> ({1})."msgid "Your email preferences have been updated"msgstr "Le tue preferenze email sono state aggiornate"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Your envelope has been distributed successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Your envelope has been resent successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Your envelope has been successfully duplicated."+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Your existing tokens"msgstr "I tuoi token esistenti"@@ -9848,6 +10658,10 @@ msgstr "Il tuo team è stato eliminato correttamente."msgid "Your team has been successfully updated."msgstr "Il tuo team è stato aggiornato correttamente."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template failed to upload."+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Your template has been created successfully"msgstr "Il tuo modello è stato creato con successo"@@ -9860,6 +10674,10 @@ msgstr "Il tuo modello è stato duplicato correttamente."msgid "Your template has been successfully deleted."msgstr "Il tuo modello è stato eliminato correttamente."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template has been uploaded successfully."+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxmsgid "Your template has been uploaded successfully. You will be redirected to the template page."msgstr "Il tuo modello è stato caricato con successo. Verrai reindirizzato alla pagina del modello."@@ -9884,6 +10702,18 @@ msgstr "Il tuo token è stato creato con successo! Assicurati di copiarlo perchmsgid "Your tokens will be shown here once you create them."msgstr "I tuoi token verranno mostrati qui una volta creati."+#: packages/lib/server-only/2fa/email/send-2fa-token-email.ts+msgid "Your two-factor authentication code"+msgstr ""++#: packages/email/templates/access-auth-2fa.tsx+msgid "Your verification code is {code}"+msgstr ""++#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Your verification code:"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "your-domain.com another-domain.com"msgstr ""diff --git a/packages/lib/translations/pl/web.po b/packages/lib/translations/pl/web.poindex dec7686c1..7880ee3fe 100644--- a/packages/lib/translations/pl/web.po+++ b/packages/lib/translations/pl/web.po@@ -72,6 +72,11 @@ msgstr "{0, plural, one {(1 znak przekroczony)} few {(# znaki przekroczone)} manmsgid "{0, plural, one {# character over the limit} other {# characters over the limit}}"msgstr "{0, plural, one {Przekroczono # znak} few {Przekroczono # znaki} many {Przekroczono # znaków} other {Przekroczono # znaków}}"+#. placeholder {0}: fieldMeta?.characterLimit - (field.value?.length ?? 0)+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "{0, plural, one {# character remaining} other {# characters remaining}}"+msgstr ""+#. placeholder {0}: folder._count.documents#: apps/remix/app/components/general/folder/folder-card.tsxmsgid "{0, plural, one {# document} other {# documents}}"@@ -103,13 +108,25 @@ msgstr "{0, plural, one {# szablon} few {# szablony} many {# szablonów} other {msgid "{0, plural, one {<0>You have <1>1</1> pending invitation</0>} other {<2>You have <3>#</3> pending invitations</2>}}"msgstr "{0, plural, one {<0>Masz <1>1</1> oczekujące zaproszenie</0>} few {<2>Masz <3>#</3> oczekujące zaproszenia</2>} many {<2>Masz <3>#</3> oczekujących zaproszeń</2>} other {<2>Masz <3>#</3> oczekujących zaproszeń</2>}}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "{0, plural, one {1 Field Remaining} other {# Fields Remaining}}"+msgstr ""++#. placeholder {0}: fields.filter((field) => field.envelopeItemId === doc.id).length+#. placeholder {0}: recipientFieldsRemaining.filter((field) => field.envelopeItemId === doc.id) .length+#: apps/remix/app/components/general/envelope-editor/envelope-file-selector.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0, plural, one {1 Field} other {# Fields}}"+msgstr ""+#. placeholder {0}: autoSignableFields.filter((f) => f.type === fieldType).length#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsxmsgid "{0, plural, one {1 matching field} other {# matching fields}}"msgstr "{0, plural, one {1 pasujące pole} few {# pasujące pola} many {# pasujących pól} other {# pasujących pól}}"#. placeholder {0}: recipients.length-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsxmsgid "{0, plural, one {1 Recipient} other {# Recipients}}"msgstr "{0, plural, one {1 odbiorca} few {# odbiorców} many {# odbiorców} other {# odbiorców}}"@@ -131,8 +148,13 @@ msgstr "{0}"msgid "{0} direct signing templates"msgstr "Bezpośrednie szablony podpisu zespołu {0}"+#. placeholder {0}: recipientFieldsRemaining.length+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "{0} fields remaining"+msgstr ""+#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{0} has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "Sprawdź i {recipientActionVerb} dokument „{1}” utworzony przez zespół {0}\"."@@ -144,7 +166,8 @@ msgstr "Sprawdź i {recipientActionVerb} dokument utworzony przez zespół „{0#. placeholder {0}: remaining.documents#. placeholder {1}: quota.documents-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "{0} of {1} documents remaining this month."msgstr "{0} z {1} dokumentów pozostałych w tym miesiącu."@@ -156,13 +179,13 @@ msgid "{0} of {1} row(s) selected."msgstr "{0} z {1} wybranych wierszy."#. placeholder {0}: user.name || user.email-#. placeholder {1}: document.team.name-#. placeholder {2}: document.title+#. placeholder {1}: envelope.team.name+#. placeholder {2}: envelope.title#: packages/lib/server-only/document/resend-document.tsmsgid "{0} on behalf of \"{1}\" has invited you to {recipientActionVerb} the document \"{2}\"."msgstr "Sprawdź i {recipientActionVerb} dokument „{2}” utworzony przez użytkownika {0} z zespołu „{1}”"-#. placeholder {0}: recipients.length+#. placeholder {0}: envelope.recipients.length#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsxmsgid "{0} Recipient(s)"msgstr "{0} Odbiorca(ów)"@@ -214,7 +237,7 @@ msgid "{inviterName} has removed you from the document<0/>\"{documentName}\""msgstr "{inviterName} usunął cię z dokumentu<0/>„{documentName}”"#. placeholder {0}: team.name-#. placeholder {1}: document.title+#. placeholder {1}: envelope.title#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "{inviterName} on behalf of \"{0}\" has invited you to {recipientActionVerb} the document \"{1}\"."msgstr "Sprawdź i {recipientActionVerb} dokument „{1}” utworzony przez użytkownika {inviterName} z zespołu „{0}”"@@ -346,7 +369,7 @@ msgstr "{recipientName} odrzucił dokument '{documentName}'"msgid "{recipientReference} has completed signing the document."msgstr "Użytkownik {recipientReference} zakończył podpisywanie dokumentu."-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-recipient-signed-email.handler.tsmsgid "{recipientReference} has signed \"{0}\""msgstr "Użytkownik {recipientReference} podpisał dokument „{0}”"@@ -393,14 +416,26 @@ msgstr "{userName} odebrał kopię dokumentu"msgid "{userName} completed their task"msgstr "Użytkownik {userName} zakończył swoje zadanie"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} failed to validate a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} rejected the document"msgstr "Użytkownik {userName} odrzucił dokument"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} requested a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} signed the document"msgstr "Użytkownik {userName} podpisał dokument"+#: packages/lib/utils/document-audit-logs.ts+msgid "{userName} validated a 2FA token for the document"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgid "{userName} viewed the document"msgstr "Użytkownik {userName} wyświetlił dokument"@@ -410,6 +445,8 @@ msgid "{visibleRows, plural, one {Showing # result.} other {Showing # results.}}msgstr "{visibleRows, plural, one {Wyświetlanie # wyniku.} other {Wyświetlanie # wyników.}}"#. placeholder {0}: document.title+#. placeholder {0}: envelope.title+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "<0>\"{0}\"</0>is no longer available to sign"msgstr "<0>\"{0}\"</0>nie jest już dostępny do podpisu"@@ -442,6 +479,7 @@ msgstr ""msgid "<0>Drawn</0> - A signature that is drawn using a mouse or stylus."msgstr "<0>Rysowany</0> – Podpis narysowany za pomocą myszy lub pióra."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Email</0> - The recipient will be emailed the document to sign, approve, etc."msgstr "<0>Adres e-mail</0> – Odbiorca otrzyma wiadomość z dokumentem do podpisania, zatwierdzenia itp."@@ -466,10 +504,12 @@ msgstr "<0>Brak ograniczeń</0> – Dokument można otworzyć za pomocą adresumsgid "<0>None</0> - No authentication required"msgstr "<0>Brak</0> - Uwierzytelnianie nie jest wymagane"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>None</0> - We will generate links which you can send to the recipients manually."msgstr "<0>Brak</0> – Wygenerujemy linki, które możesz wysłać do odbiorców ręcznie."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "<0>Note</0> - If you use Links in combination with direct templates, you will need to manually send the links to the remaining recipients."msgstr "<0>Uwaga</0> – Jeśli używasz linków w połączeniu z bezpośrednimi szablonami, musisz ręcznie wysłać linki do pozostałych odbiorców."@@ -554,6 +594,10 @@ msgstr ""msgid "401 Unauthorized"msgstr "401: Dostęp nieautoryzowany"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "404 Document not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsxmsgid "404 Email domain not found"msgstr "404: Domena nie została znaleziona"@@ -562,6 +606,12 @@ msgstr "404: Domena nie została znaleziona"msgid "404 not found"msgstr "404: Strona nie została znaleziona"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "404 Not found"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsxmsgid "404 Not Found"msgstr ""@@ -584,6 +634,10 @@ msgstr "404: Profil nie został znaleziony"msgid "404 Team not found"msgstr "404: Zespół nie został znaleziony"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "404 Template not found"+msgstr ""+#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsxmsgid "404 User not found"msgstr "404: Użytkownik nie został znaleziony"@@ -850,6 +904,7 @@ msgstr "Akcja"#: apps/remix/app/components/tables/admin-organisations-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Actions"msgstr "Akcje"@@ -872,6 +927,7 @@ msgstr "Aktywne subskrypcje"msgid "Add"msgstr "Dodaj"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add 2 or more signers to enable signing order."msgstr ""@@ -884,6 +940,7 @@ msgstr "Dodaj niestandardową domenę, aby wysyłać wiadomości w imieniu swojemsgid "Add a document"msgstr "Dodaj dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -907,6 +964,7 @@ msgstr "Dodaj autoryzator, aby służył jako dodatkowa metoda uwierzytelnianiamsgid "Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents."msgstr "Dodaj autoryzator, aby służył jako dodatkowa metoda uwierzytelniania podczas logowania lub podpisywania dokumentów."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Add an external ID to the document. This can be used to identify the document in external systems."msgstr "Dodaj identyfikator zewnętrzny dokumentu. Może być używany do identyfikacji dokumentu w zewnętrznych systemach."@@ -941,6 +999,9 @@ msgid "Add Email Domain"msgstr "Dodaj domenę"#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: apps/remix/app/components/general/document/document-edit-form.tsxmsgid "Add Fields"msgstr "Dodaj pola"@@ -975,6 +1036,7 @@ msgstr "Dodaj więcej"msgid "Add myself"msgstr "Dodaj siebie"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "Add Myself"msgstr "Dodaj siebie"@@ -996,6 +1058,7 @@ msgstr "Dodaj odbiorcę zastępczego"msgid "Add Placeholders"msgstr "Dodaj znaczniki"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Add Signer"@@ -1013,10 +1076,12 @@ msgstr "Dodaj podpisujących i skonfiguruj ustawienia podpisywania"msgid "Add team email"msgstr "Dodaj e-mail zespołowy"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text"msgstr "Dodaj tekst"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Add text to the field"msgstr "Dodaj tekst do pola"@@ -1148,6 +1213,7 @@ msgstr "Zezwól wszystkim członkom organizacji na dostęp do tego zespołu"msgid "Allow document recipients to reply directly to this email address"msgstr "Odpowiadanie odbiorcom dokumentu bezpośrednio na ten adres e-mail"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -1158,6 +1224,7 @@ msgstr "Zezwalaj podpisującym wskazać następnego podpisującego"msgid "Allowed Email Domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -1205,6 +1272,8 @@ msgstr "Ten adres e-mail już istnieje."#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx#: apps/remix/app/components/forms/token.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/reset-password.tsx@@ -1386,7 +1455,8 @@ msgstr "Wystąpił błąd podczas aktualizowania podpisu."msgid "An error occurred while updating your profile."msgstr "Wystąpił błąd podczas aktualizowania profilu."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "An error occurred while uploading your document."msgstr "Wystąpił błąd podczas przesyłania dokumentu."@@ -1410,6 +1480,7 @@ msgstr "Wystąpił nieoczekiwany błąd."#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/admin+/site-settings.tsx#: apps/remix/app/components/general/app-command-menu.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/forms/signup.tsx@@ -1446,6 +1517,7 @@ msgstr "Wystąpił nieoczekiwany błąd."#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/account-delete-dialog.tsx@@ -1487,11 +1559,6 @@ msgstr "Tokeny API"msgid "App Version"msgstr "Wersja aplikacji"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Approve"-msgstr ""-#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-button.tsx@@ -1501,19 +1568,27 @@ msgstr ""msgid "Approve"msgstr "Zatwierdź"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Approve"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Approve Document"msgstr "Zatwierdź dokument"+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Approved"+msgstr "Zatwierdził"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Approved"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Approved"-msgstr "Zatwierdził"+#: apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx+msgid "Approver"+msgstr ""#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"@@ -1576,6 +1651,7 @@ msgstr "Czy na pewno chcesz usunąć ten zespół?"#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Are you sure?"msgstr "Czy na pewno?"@@ -1589,8 +1665,7 @@ msgctxt "Recipient role action verb"msgid "Assist"msgstr ""-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Assist Document"msgstr "Asysta dokumentu"@@ -1616,20 +1691,21 @@ msgstr ""msgid "Assistants and Copy roles are currently not compatible with the multi-sign experience."msgstr "Asystenci i role Kopii są obecnie niekompatybilne z doświadczeniem multi-sign."+#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+msgid "Assisted"+msgstr "Przygotował"+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role actioned"msgid "Assisted"msgstr ""-#: apps/remix/app/components/general/document/document-page-view-recipients.tsx-msgid "Assisted"-msgstr "Przygotował"-#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role progressive verb"msgid "Assisting"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx#: packages/ui/primitives/template-flow/add-template-settings.types.tsx#: packages/ui/primitives/document-flow/add-settings.types.ts@@ -1662,6 +1738,10 @@ msgstr ""msgid "Authentication required"msgstr "Wymagana autoryzacja"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Authenticator app"+msgstr ""+#: apps/remix/app/components/forms/avatar-image.tsxmsgid "Avatar"msgstr "Awatar"@@ -1691,6 +1771,10 @@ msgstr "Powrót do domu"msgid "Background Color"msgstr "Kolor tła"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Background Jobs"+msgstr ""+#: apps/remix/app/components/forms/signin.tsx#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Backup Code"@@ -1828,6 +1912,7 @@ msgstr "Może przygotować"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/general/teams/team-email-usage.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx@@ -1866,6 +1951,13 @@ msgstr "Może przygotować"#: apps/remix/app/components/dialogs/team-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx#: apps/remix/app/components/dialogs/team-create-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: apps/remix/app/components/dialogs/session-logout-all-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/passkey-create-dialog.tsx@@ -1888,6 +1980,10 @@ msgstr "Może przygotować"#: apps/remix/app/components/dialogs/folder-move-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx@@ -1911,10 +2007,15 @@ msgstr "Anulowano przez użytkownika"msgid "Cannot remove document"msgstr "Nie można usunąć dokumentu"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Cannot remove signer"msgstr "Nie można usunąć podpisującego"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Cannot upload items after the document has been sent"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Cc"@@ -1940,6 +2041,11 @@ msgctxt "Recipient role plural name"msgid "Ccers"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Center"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Character Limit"msgstr "Limit znaków"@@ -1948,10 +2054,16 @@ msgstr "Limit znaków"msgid "Charts"msgstr "Wykresy"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Checkbox"msgstr "Pole wyboru"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Checkbox Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Checkbox values"msgstr "Wartości checkboxa"@@ -1978,6 +2090,10 @@ msgstr "Wybierz, jak dokument dotrze do odbiorców"msgid "Choose how to distribute your document to recipients. Email will send notifications, None will generate signing links for manual distribution."msgstr "Wybierz sposób dystrybucji dokumentu do odbiorców. E-mail wyśle powiadomienia, Brak wygeneruje linki do podpisu do ręcznej dystrybucji."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Choose verification method"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Choose your preferred authentication method:"msgstr "Wybierz preferowaną metodę uwierzytelniania:"@@ -2025,6 +2141,7 @@ msgstr "Kliknij tutaj, aby przesłać"msgid "Click to copy signing link for sending to recipient"msgstr "Kliknij, aby skopiować link podpisu do wysłania do odbiorcy"+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx#: apps/remix/app/components/embed/embed-document-signing-page.tsx@@ -2064,6 +2181,8 @@ msgstr ""#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Close"msgstr "Zamknij"@@ -2103,7 +2222,7 @@ msgstr "Zakończ dokument"msgid "Complete Signing"msgstr "Zakończ podpisywanie"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Complete the fields for the following signers."msgstr ""@@ -2112,8 +2231,10 @@ msgstr ""msgid "Complete Viewing"msgstr "Zakończ wyświetlanie"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx#: packages/lib/constants/document.ts@@ -2157,6 +2278,14 @@ msgstr "Skonfiguruj bezpośredniego odbiorcę"msgid "Configure Document"msgstr "Skonfiguruj dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure document settings and options before sending."+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure email settings for the document"+msgstr ""+#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx#: apps/remix/app/components/embed/authoring/configure-fields-view.tsx@@ -2171,6 +2300,10 @@ msgstr "Skonfiguruj ogólne ustawienia dokumentu."msgid "Configure general settings for the template."msgstr "Skonfiguruj ogólne ustawienia szablonu."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Configure security settings for the document"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Configure template"msgstr "Skonfiguruj szablon"@@ -2305,6 +2438,7 @@ msgstr "Kontroluje domyślną widoczność przesłanego dokumentu."msgid "Controls the formatting of the message that will be sent when inviting a recipient to sign a document. If a custom message has been provided while configuring the document, it will be used instead."msgstr "Kontroluje formatowanie wiadomości, która zostanie wysłana podczas zapraszania odbiorcy do podpisania dokumentu. Jeśli w konfiguracji dokumentu podano niestandardową wiadomość, zostanie użyta zamiast tego."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Controls the language for the document, including the language to be used for email notifications, and the final certificate that is generated and attached to the document."msgstr "Kontroluje język dokumentu, w tym język powiadomień e-mail i ostateczny certyfikat, który jest generowany i dołączony do dokumentu."@@ -2322,6 +2456,7 @@ msgid "Controls which signatures are allowed to be used when signing a document.msgstr "Kontroluje, które podpisy są dozwolone do użycia podczas podpisywania dokumentu."#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copied"msgstr "Skopiowano"@@ -2339,12 +2474,14 @@ msgstr "Skopiowano"#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/components/document/document-share-button.tsxmsgid "Copied to clipboard"msgstr "Skopiowano do schowka"#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Copy"msgstr "Kopiuj"@@ -2445,7 +2582,7 @@ msgstr "Utwórz roszczenie"msgid "Create Claim"msgstr "Utwórz roszczenie"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Create Direct Link"msgstr "Utwórz bezpośredni link"@@ -2645,6 +2782,7 @@ msgid "Dashboard"msgstr "Panel sterowania"#: apps/remix/app/components/tables/settings-security-activity-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-date-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -2656,12 +2794,17 @@ msgstr "Data"msgid "Date created"msgstr "Data utworzenia"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Date Format"msgstr "Format daty"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Date Settings"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.sso.confirmation.$token.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: packages/email/templates/organisation-invite.tsx@@ -2700,6 +2843,10 @@ msgstr "Domyślne rodzaje dozwolonych podpisów"msgid "Default Time Zone"msgstr "Domyślna strefa czasowa"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Default Value"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "delete"msgstr "usuń"@@ -2731,6 +2878,7 @@ msgstr "usuń"#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/claim-delete-dialog.tsxmsgid "Delete"@@ -2770,6 +2918,7 @@ msgstr "Usuń konto"msgid "Delete document"msgstr "Usuń dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsx@@ -2821,6 +2970,10 @@ msgstr "Usuń zespół"msgid "Delete team group"msgstr "Usuń grupę zespołu"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Delete Template"+msgstr ""+#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Delete the document. This action is irreversible so proceed with caution."msgstr "Usuń dokument. Działanie to jest nieodwracalne, więc działaj ostrożnie."@@ -2872,6 +3025,7 @@ msgstr "Bezpośredni link"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsxmsgid "Direct Link"msgstr "Bezpośredni link"@@ -2909,6 +3063,7 @@ msgstr "Link szablonu bezpośredniego usunięty"msgid "Direct template link usage exceeded ({0}/{1})"msgstr "Przekroczono użycie linku szablonu bezpośredniego ({0}/{1})"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Direction"msgstr "Kierunek"@@ -3002,22 +3157,27 @@ msgstr "Documenso usunie <0>wszystkie twoje dokumenty</0>, wraz ze wszystkimi zamsgid "Document"msgstr "Dokument"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#. placeholder {1}: recipient.name#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejected by {1}"msgstr "Dokument \"{0}\" - Odrzucony przez {1}"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-rejection-emails.handler.tsmsgid "Document \"{0}\" - Rejection Confirmed"msgstr "Dokument \"{0}\" - Odrzucenie potwierdzone"-#. placeholder {0}: document.title+#. placeholder {0}: envelope.title#: packages/lib/jobs/definitions/emails/send-document-cancelled-emails.handler.tsmsgid "Document \"{0}\" Cancelled"msgstr "Dokument \"{0}\" anulowany"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document & Recipients"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/document/document-global-auth-access-select.tsx@@ -3038,21 +3198,22 @@ msgid "Document Approved"msgstr "Dokument zatwierdzony"#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx-#: packages/lib/server-only/document/super-delete-document.ts+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: packages/lib/server-only/document/delete-document.ts+#: packages/lib/server-only/admin/admin-super-delete-document.tsmsgid "Document Cancelled"msgstr "Dokument anulowany"+#: apps/remix/app/components/general/document/document-status.tsx+msgid "Document completed"+msgstr "Zakończono dokument"+#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document completed"msgstr ""-#: apps/remix/app/components/general/document/document-status.tsx-msgid "Document completed"-msgstr "Zakończono dokument"-#: packages/ui/components/document/document-email-checkboxes.tsx#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document completed email"@@ -3062,15 +3223,15 @@ msgstr "Wiadomość potwierdzająca zakończenie"msgid "Document Completed!"msgstr "Dokument Zakończony!"+#: apps/remix/app/components/dialogs/template-use-dialog.tsx+msgid "Document created"+msgstr "Utworzono dokument"+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document created"msgstr ""-#: apps/remix/app/components/dialogs/template-use-dialog.tsx-msgid "Document created"-msgstr "Utworzono dokument"-#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Document Created"msgstr "Dokument utworzony"@@ -3093,17 +3254,17 @@ msgstr "Dokument utworzony za pomocą <0>bezpośredniego linku</0>"msgid "Document Creation"msgstr "Tworzenie dokumentu"-#: packages/lib/utils/document-audit-logs.ts-msgctxt "Audit log format"-msgid "Document deleted"-msgstr ""-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-document-delete-dialog.tsxmsgid "Document deleted"msgstr "Usunięto dokument"+#: packages/lib/utils/document-audit-logs.ts+msgctxt "Audit log format"+msgid "Document deleted"+msgstr ""+#: packages/ui/components/document/document-email-checkboxes.tsxmsgid "Document deleted email"msgstr "Wiadomość o usunięciu dokumentu"@@ -3112,6 +3273,8 @@ msgstr "Wiadomość o usunięciu dokumentu"msgid "Document Deleted!"msgstr "Dokument usunięty!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Document Distribution Method"@@ -3125,6 +3288,10 @@ msgstr "Szkic dokumentu"msgid "Document Duplicated"msgstr "Dokument zduplikowany"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Editor"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document external ID updated"@@ -3134,7 +3301,6 @@ msgstr ""msgid "Document found in your account"msgstr "Dokument znaleziony na Twoim koncie"-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Document ID"msgstr "Identyfikator dokumentu"@@ -3210,18 +3376,18 @@ msgstr "Dokument odrzucony"msgid "Document Rejected"msgstr "Dokument odrzucone"-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx-msgid "Document resealed"-msgstr "Dokument ponownie zaplombowany"+#: apps/remix/app/components/general/document/document-edit-form.tsx+msgid "Document sent"+msgstr "Wysłano dokument"#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document sent"msgstr ""-#: apps/remix/app/components/general/document/document-edit-form.tsx-msgid "Document sent"-msgstr "Wysłano dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Document Settings"+msgstr ""#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Document Signed"@@ -3244,6 +3410,10 @@ msgstr "Status dokumentu"msgid "Document title"msgstr "Tytuł dokumentu"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Document Title"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document title updated"@@ -3258,11 +3428,13 @@ msgstr ""msgid "Document updated successfully"msgstr "Dokument został pomyślnie zaktualizowany"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Document upload disabled due to unpaid invoices"msgstr "Przesyłanie dokumentu wyłączone z powodu nieopłaconych faktur"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Document uploaded"msgstr "Przesłano dokument"@@ -3276,6 +3448,10 @@ msgstr ""msgid "Document Viewed"msgstr "Dokument został wyświetlony"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Document visibility"+msgstr ""+#: packages/lib/utils/document-audit-logs.tsmsgctxt "Audit log format"msgid "Document visibility updated"@@ -3291,7 +3467,7 @@ msgstr ""#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents._index.tsx-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/_layout.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx@@ -3363,15 +3539,21 @@ msgid "Download Certificate"msgstr "Pobierz certyfikat"#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsxmsgid "Download Original"msgstr "Pobierz oryginał"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Download PDF"+msgstr ""+#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Download Template CSV"msgstr "Pobierz szablon CSV"#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: packages/lib/constants/document.tsmsgid "Draft"@@ -3398,42 +3580,68 @@ msgstr "Przeciągnij i upuść lub kliknij, aby przesłać"msgid "Drag and drop your PDF file here"msgstr "Przeciągnij i upuść swój plik PDF tutaj"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Draw"+msgstr "Rysowany"+#: packages/lib/constants/document.tsmsgctxt "Draw signatute type"msgid "Draw"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Draw"-msgstr "Rysowany"-#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Drop your document here"msgstr "Upuść swój dokument tutaj"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "Dropdown"msgstr "Lista rozwijana"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown must have at least one option"+msgstr ""+#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Dropdown options"msgstr "Opcje rozwijane"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Dropdown Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Dropdown values"+msgstr ""+#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document/document-page-view-dropdown.tsx#: apps/remix/app/components/dialogs/template-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate"msgstr "Zduplikuj"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Document"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: packages/ui/primitives/document-flow/field-item.tsxmsgid "Duplicate on all pages"msgstr "Powiel na wszystkich stronach"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Duplicate Template"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks._index.tsx#: apps/remix/app/components/tables/templates-table-action-dropdown.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx@@ -3471,6 +3679,10 @@ msgstr "Ujawnienie podpisu elektronicznego"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-email-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/general/direct-template/direct-template-configure-form.tsx@@ -3548,6 +3760,10 @@ msgstr "Domeny"msgid "Email domains synced"msgstr "Domeny zostały zsynchronizowane"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Email is required"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Email Options"msgstr "Opcje adresu e-mail"@@ -3567,6 +3783,8 @@ msgstr "Preferencje e-mail zaktualizowane"msgid "Email resent"msgstr "Wysłano ponownie wiadomość"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Email Sender"@@ -3580,6 +3798,14 @@ msgstr "Wysłano wiadomość"msgid "Email sent!"msgstr "Wiadomość została wysłana!"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Email Settings"+msgstr ""++#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Email verification"+msgstr ""+#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsxmsgid "Email verification has been removed"msgstr "Weryfikacja e-mailu została usunięta"@@ -3644,6 +3870,7 @@ msgstr "Włącz niestandardowe brandowanie dla wszystkich dokumentów w tym zespmsgid "Enable Direct Link Signing"msgstr "Włącz podpisywanie linku bezpośredniego"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -3681,6 +3908,10 @@ msgstr "Wprowadź nazwę roszczenia"msgid "Enter the domain you want to use for sending emails (without http:// or www)"msgstr "Wprowadź domenę, której chcesz używać do wysyłania wiadomości e-mail (bez http:// lub www)"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Enter verification code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your 2FA code"msgstr "Wprowadź swój kod 2FA"@@ -3701,11 +3932,16 @@ msgstr "Wprowadź swój adres e-mail, aby otrzymać ukończony dokument."msgid "Enter your name"msgstr "Wpisz nazwę"+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Enter your number here"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Enter your password"msgstr "Wprowadź swoje hasło"#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsxmsgid "Enter your text here"msgstr "Wprowadź swój tekst tutaj"@@ -3713,6 +3949,34 @@ msgstr "Wprowadź swój tekst tutaj"msgid "Enterprise"msgstr "Enterprise"+#: packages/ui/primitives/document-upload.tsx+msgid "Envelope (beta)"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Envelope distributed"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Envelope Duplicated"+msgstr ""++#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+msgid "Envelope ID"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Envelope resent"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Envelope Title"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "Envelope updated"+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx#: apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx@@ -3753,7 +4017,8 @@ msgstr "Enterprise"#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-checkbox-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-auto-sign.tsx-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx@@ -3814,11 +4079,17 @@ msgstr "Przekroczono limit czasu"msgid "Expired"msgstr "Wygasł"+#. placeholder {0}: DateTime.fromMillis(Math.max(millisecondsRemaining, 0)).toFormat( 'mm:ss', )+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Expires in {0}"+msgstr ""+#. placeholder {0}: i18n.date(token.expires, DateTime.DATETIME_FULL)#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Expires on {0}"msgstr "Wygasa {0}"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "External ID"@@ -3902,10 +4173,12 @@ msgstr "Niepowodzenie: {failedCount}"msgid "Feature Flags"msgstr "Flagi funkcji"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field character limit"msgstr "Limit znaków pola"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -3915,16 +4188,20 @@ msgstr "Limit znaków pola"msgid "Field font size"msgstr "Rozmiar czcionki pola"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Field format"msgstr "Format pola"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Field label"msgstr "Etykieta pola"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsxmsgid "Field placeholder"msgstr "Tekst zastępczy pola"@@ -3952,7 +4229,8 @@ msgstr "Pola"msgid "Fields updated"msgstr "Pola zaktualizowane"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "File cannot be larger than {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"msgstr "Plik nie może mieć większej wielkości niż {APP_DOCUMENT_UPLOAD_SIZE_LIMIT}MB"@@ -4010,6 +4288,7 @@ msgstr "Ustawienia folderu"msgid "Folder updated successfully"msgstr "Folder zaktualizowany pomyślnie"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -4049,6 +4328,11 @@ msgstr "Darmowy"msgid "Free Signature"msgstr "Swobodny podpis"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Free Signature Settings"+msgstr ""++#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -4064,6 +4348,7 @@ msgstr "Imię i nazwisko"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx#: apps/remix/app/components/general/template/template-edit-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/general/document/document-edit-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-page.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx@@ -4074,6 +4359,7 @@ msgstr "Ogólne"msgid "Generate DKIM Records"msgstr "Wygeneruj rekordy DKIM"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Generate Links"msgstr "Generuj linki"@@ -4085,7 +4371,9 @@ msgstr "Globalne uwierzytelnianie akcji odbiorcy"#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email-domains.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.webhooks.$id.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx#: apps/remix/app/routes/_authenticated+/admin+/users.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsxmsgid "Go back"@@ -4094,7 +4382,9 @@ msgstr "Wróć"#: apps/remix/app/routes/_recipient+/_layout.tsx#: apps/remix/app/routes/_profile+/_layout.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: packages/ui/primitives/document-flow/document-flow-root.tsxmsgid "Go Back"@@ -4109,10 +4399,12 @@ msgstr "Wróć do domu"#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Go Back Home"msgstr "Wróć do domu"#: apps/remix/app/routes/_authenticated+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsxmsgid "Go home"msgstr "Wróć na stronę główną"@@ -4163,22 +4455,25 @@ msgstr "Nazwa grupy"msgid "Groups"msgstr "Grupy"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to approve this document"msgstr "Zaproszono Cię do zatwierdzenia tego dokumentu"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to assist this document"msgstr "zaprosił Cię do pomocy przy tym dokumencie"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to sign this document"msgstr "Zaproszono Cię do podpisania tego dokumentu"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "has invited you to view this document"msgstr "Zaproszono Cię do wyświetlenia tego dokumentu"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -4248,6 +4543,10 @@ msgstr "Cześć, jestem Timur"msgid "Hi {userName},"msgstr "Cześć, {userName},"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Hi {userName}, you need to enter a verification code to complete the document \"{documentTitle}\"."+msgstr ""+#: packages/email/templates/reset-password.tsxmsgid "Hi, {userName} <0>({userEmail})</0>"msgstr "Cześć, {userName} <0>({userEmail})</0>"@@ -4269,6 +4568,7 @@ msgstr "Strona główna"msgid "Home (No Folder)"msgstr "Strona główna (brak folderu)"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Horizontal"msgstr "Poziomo"@@ -4322,6 +4622,10 @@ msgstr "Identyfikator został skopiowany do schowka"msgid "If there is any issue with your subscription, please contact us at <0>{SUPPORT_EMAIL}</0>."msgstr "Jeśli masz jakiekolwiek problemy z subskrypcją, skontaktuj się z nami pod adresem <0>{SUPPORT_EMAIL}</0>."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "If you didn't request this verification code, you can safely ignore this email."+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "If you do not want to use the authenticator prompted, you can close it, which will then display the next available authenticator."msgstr "Jeśli nie chcesz korzystać z proponowanego uwierzytelnienia, możesz je zamknąć, a następnie wyświetlić następne dostępne uwierzytelnienie."@@ -4388,11 +4692,29 @@ msgstr "Odziedzicz członków organizacji"msgid "Inherited subscription claim"msgstr "Odziedziczone roszczenie subskrypcji"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-initials-field.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Initials"msgstr "Inicjały"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Initials are required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Initials Settings"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Insert a value into the number field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Insert a value into the text field"+msgstr ""+#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsxmsgid "Inserted"msgstr "Wstawione"@@ -4409,6 +4731,7 @@ msgstr "Kod jest nieprawidłowy. Spróbuj ponownie."msgid "Invalid domains"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.types.tsmsgid "Invalid email"msgstr "Adres e-mail jest nieprawidłowy"@@ -4531,6 +4854,8 @@ msgstr ""msgid "Joined {0}"msgstr "Dołączył {0}"+#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -4541,6 +4866,7 @@ msgstr "Etykieta"#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -4568,6 +4894,10 @@ msgstr "Ostatnia aktywność"msgid "Last modified"msgstr "Zmodyfikowano"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Last Retried"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.logs.tsxmsgid "Last updated"msgstr "Zaktualizowano"@@ -4604,6 +4934,10 @@ msgstr "Pozostaw puste, aby odziedziczyć z organizacji."msgid "Leave organisation"msgstr "Opuść organizację"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Left"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "Legality of Electronic Signatures"msgstr "Legalność podpisów elektronicznych"@@ -4654,9 +4988,16 @@ msgstr "Słuchając {0}"msgid "Load older activity"msgstr "Załaduj starszą aktywność"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Loading"+msgstr ""+#: apps/remix/app/components/general/skeletons/document-edit-skeleton.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Loading document..."msgstr "Ładowanie dokumentu..."@@ -4722,7 +5063,7 @@ msgstr "Zarządzaj płatnościami"msgid "Manage details for this public template"msgstr "Zarządzaj szczegółami tego publicznego szablonu"-#: apps/remix/app/components/dialogs/template-direct-link-dialog-wrapper.tsx+#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Manage Direct Link"msgstr "Zarządzaj Bezpośrednim Linkiem"@@ -4847,6 +5188,7 @@ msgstr "MAU (zakończony dokument)"msgid "MAU (signed in)"msgstr "MAU (zalogowani)"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Max"msgstr "Max"@@ -4888,7 +5230,9 @@ msgstr "Data dołączenia"msgid "Members"msgstr "Członkowie"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Message"@@ -4898,6 +5242,7 @@ msgstr "Wiadomość"msgid "Message <0>(Optional)</0>"msgstr "Wiadomość <0>(opcjonalnie)</0>"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Min"msgstr "Min"@@ -4970,9 +5315,13 @@ msgstr "Nie dotyczy"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/admin-leaderboard-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/tables/admin-dashboard-users-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx#: apps/remix/app/components/general/claim-account.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-name-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx#: apps/remix/app/components/forms/subscription-claim-form.tsx@@ -4995,9 +5344,14 @@ msgid "Name"msgstr "Nazwa"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.groups.$id.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsxmsgid "Name is required"msgstr "Imię jest wymagane"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Name Settings"+msgstr ""+#: apps/remix/app/routes/_recipient+/sign.$token+/complete.tsxmsgid "Need to sign documents?"msgstr "Potrzebujesz podpisać dokumenty?"@@ -5055,6 +5409,12 @@ msgstr "Nie"msgid "No active drafts"msgstr "Brak aktywnych szkiców"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+msgid "No documents found"+msgstr ""+#: apps/remix/app/components/dialogs/template-move-to-folder-dialog.tsx#: apps/remix/app/components/dialogs/document-move-to-folder-dialog.tsxmsgid "No folders found"@@ -5094,6 +5454,7 @@ msgstr "Nie znaleziono odbiorcy pasującego do tego opisu."#: apps/remix/app/components/general/template/template-page-view-recipients.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "No recipients"msgstr "Brak odbiorców"@@ -5155,11 +5516,18 @@ msgid "No worries, it happens! Enter your email and we'll email you a special limsgstr "Nie martw się, to się zdarza! Wprowadź swój e-mail, a my wyślemy Ci specjalny link do zresetowania hasła."#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/lib/constants/document.tsmsgid "None"msgstr "Brak"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid "Not found"+msgstr ""+#: apps/remix/app/components/forms/signin.tsxmsgid "Not supported"msgstr "Nieobsługiwane"@@ -5169,6 +5537,7 @@ msgstr "Nieobsługiwane"msgid "Nothing to do"msgstr "Nic do zrobienia"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-number-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx#: packages/ui/primitives/document-flow/types.ts@@ -5176,6 +5545,7 @@ msgstr "Nic do zrobienia"msgid "Number"msgstr "Numer"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Number format"msgstr "Format liczby"@@ -5190,23 +5560,27 @@ msgstr "Ilość dozwolonych członków. 0 = Bez ograniczeń"msgid "Number of teams allowed. 0 = Unlimited"msgstr "Ilość dozwolonych zespołów. 0 = Bez ograniczeń"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Number Settings"+msgstr ""+#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to approve this document"msgstr "z zespołu „{0}” zaprosił Cię do zatwierdzenia dokumentu"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to assist this document"msgstr "z zespołu „{0}” zaprosił Cię do przygotowania dokumentu"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to sign this document"msgstr "z zespołu „{0}” zaprosił Cię do podpisania dokumentu"#. placeholder {0}: document.team?.name-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "on behalf of \"{0}\" has invited you to view this document"msgstr "z zespołu „{0}” zaprosił Cię do wyświetlenia dokumentu"@@ -5269,6 +5643,8 @@ msgid "Only PDF files are allowed"msgstr ""#: apps/remix/app/routes/_profile+/_layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsx#: apps/remix/app/components/general/generic-error-layout.tsxmsgid "Oops! Something went wrong."@@ -5278,6 +5654,14 @@ msgstr "Ups! Coś poszło nie tak."msgid "Opened"msgstr "Otwarto"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Option is required"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx+msgid "Option value cannot be empty"+msgstr ""+#: apps/remix/app/components/forms/signup.tsx#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsxmsgid "Or"@@ -5444,6 +5828,7 @@ msgstr "Strona {0} z {1}"#. placeholder {0}: i + 1#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Page {0} of {numPages}"msgstr "Strona {0} z {numPages}"@@ -5532,6 +5917,7 @@ msgstr "Płatność zaległa"#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/components/tables/organisation-email-domains-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsx@@ -5581,6 +5967,7 @@ msgstr "Konto osobiste"msgid "Personal Inbox"msgstr "Skrzynka odbiorcza osobista"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Pick a number"msgstr "Wybierz numer"@@ -5597,6 +5984,13 @@ msgstr "Wybierz umowę i zacznij podpisywanie"msgid "Pin"msgstr "Przypnij"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Place and configure form fields in the document"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-text-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -5671,7 +6065,11 @@ msgstr "Wpisz nazwę tokena. Pomoże to później w jego identyfikacji."msgid "Please enter a valid name."msgstr "Wpisz prawdłową nazwę."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Please enter a valid number"+msgstr ""++#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please mark as viewed to complete."msgstr ""@@ -5707,6 +6105,10 @@ msgstr "Proszę pamiętać, że ta czynność jest nieodwracalna. Po potwierdzenmsgid "Please note that you will lose access to all documents associated with this team & all the members will be removed and notified"msgstr "Proszę pamiętać, że stracisz dostęp do wszystkich dokumentów powiązanych z tym zespołem i wszyscy członkowie zostaną usunięci oraz powiadomieni"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please open your authenticator app and enter the 6-digit code for this document."+msgstr ""+#: apps/remix/app/components/forms/2fa/disable-authenticator-app-dialog.tsxmsgid "Please provide a token from the authenticator, or a backup code. If you do not have a backup code available, please contact support."msgstr "Proszę podać token z aplikacji uwierzytelniającej lub kod zapasowy. Jeśli nie masz dostępnego kodu zapasowego, skontaktuj się z pomocą techniczną."@@ -5715,11 +6117,11 @@ msgstr "Proszę podać token z aplikacji uwierzytelniającej lub kod zapasowy. Jmsgid "Please provide a token from your authenticator, or a backup code."msgstr "Proszę podać token z Twojego uwierzytelniacza lub kod zapasowy."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before approving."msgstr "Przejrzyj dokument przed zatwierdzeniem."-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Please review the document before signing."msgstr "Proszę przejrzeć dokument przed podpisaniem."@@ -5727,6 +6129,10 @@ msgstr "Proszę przejrzeć dokument przed podpisaniem."msgid "Please select a PDF file"msgstr "Wybierz plik PDF"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Please select how you'd like to receive your verification code."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-create-dialog.tsxmsgid "Please try a different domain."msgstr "Spróbuj innej domeny."@@ -5742,6 +6148,8 @@ msgstr "Spróbuj ponownie później."#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Please try again or contact our support."msgstr "Spróbuj ponownie lub skontaktuj się z naszym wsparciem."@@ -5755,6 +6163,11 @@ msgstr "Wpisz {0}, aby potwierdzić"msgid "Please type <0>{0}</0> to confirm."msgstr "Wpisz <0>{0}</0>, aby potwierdzić."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Please upload a document to continue"+msgstr ""+#: apps/remix/app/components/forms/branding-preferences-form.tsxmsgid "Please upload a logo"msgstr "Prześlij logo"@@ -5770,6 +6183,7 @@ msgstr "Wstępnie sformatowany szablon CSV z przykładowymi danymi."msgid "Preferences"msgstr "Ustawienia"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx#: apps/remix/app/components/forms/document-preferences-form.tsxmsgid "Preview"msgstr "Podgląd"@@ -5778,11 +6192,29 @@ msgstr "Podgląd"msgid "Preview and configure template."msgstr "Podgląd i konfiguracja szablonu."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview Mode"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Preview the document before sending"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+msgid "Preview what the signed document will look like with placeholder data"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/general/template/template-type.tsxmsgid "Private"msgstr "Prywatne"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Private Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Private templates can only be modified and viewed by you."msgstr "Prywatne szablony mogą być modyfikowane i przeglądane tylko przez Ciebie."@@ -5843,14 +6275,28 @@ msgstr "Profil publiczny"msgid "Public profile URL"msgstr "Adres URL profilu publicznego"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Public Template"+msgstr ""+#: apps/remix/app/components/tables/templates-table.tsxmsgid "Public templates are connected to your public profile. Any modifications to public templates will also appear in your public profile."msgstr "Szablony publiczne są powiązane z Twoim publicznym profilem. Wszelkie modyfikacje szablonów publicznych również pojawią się w Twoim publicznym profilu."+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Quick Actions"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: packages/ui/primitives/document-flow/types.tsmsgid "Radio"msgstr "Radio"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Radio Settings"+msgstr ""++#: apps/remix/app/components/forms/editor/editor-field-radio-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/radio-field.tsxmsgid "Radio values"msgstr "Wartości radiowe"@@ -5863,6 +6309,10 @@ msgstr "Wartości radiowe"msgid "Read only"msgstr "Tylko do odczytu"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Read Only"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.support.tsxmsgid "Read our documentation to get started with Documenso."msgstr ""@@ -5918,9 +6368,13 @@ msgstr "Ostatnie dokumenty"#: apps/remix/app/components/dialogs/template-direct-link-dialog.tsx#: packages/lib/utils/document-audit-logs.ts#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.ts+#: packages/lib/utils/document-audit-logs.tsmsgid "Recipient"msgstr "Odbiorca"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx#: packages/ui/components/recipient/recipient-action-auth-select.tsx@@ -5955,6 +6409,10 @@ msgstr "Odbiorcy"msgid "Recipients metrics"msgstr "Metryki odbiorców"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Recipients will be able to sign the document once sent"+msgstr ""+#: apps/remix/app/components/dialogs/document-delete-dialog.tsxmsgid "Recipients will still retain their copy of the document"msgstr "Odbiorcy nadal zachowają swoją kopię dokumentu"@@ -5987,12 +6445,17 @@ msgstr "Czerwony"msgid "Redirect URI"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsxmsgid "Redirect URL"msgstr "Adres URL przekierowania"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+msgid "Redirecting"+msgstr ""+#: apps/remix/app/components/general/claim-account.tsx#: apps/remix/app/components/forms/signup.tsxmsgid "Registration Successful"@@ -6001,12 +6464,13 @@ msgstr "Rejestracja zakończona sukcesem"#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-reject-dialog.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Reject Document"msgstr "Odrzuć dokument"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/stack-avatars-with-tooltip.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/general/document/document-status.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsx@@ -6022,16 +6486,21 @@ msgstr "Odmowa potwierdzona"msgid "Rejection reason: {reason}"msgstr "Powód odrzucenia: {reason}"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Reload"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/forgot-password.tsxmsgid "Remembered your password? <0>Sign In</0>"msgstr "Zapamiętałeś hasło? <0>Zaloguj się</0>"-#. placeholder {0}: customEmail.subject+#. placeholder {0}: envelope.documentMeta.subject#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0}"msgstr "Przypomnienie: {0}"-#. placeholder {0}: document.team.name+#. placeholder {0}: envelope.team.name#: packages/lib/server-only/document/resend-document.tsmsgid "Reminder: {0} invited you to {recipientActionVerb} a document"msgstr "Przypomnienie: {0} zaprosił Cię do {recipientActionVerb} dokument"@@ -6051,6 +6520,7 @@ msgstr "Przypomnienie: Sprawdź i {recipientActionVerb} swój dokument"#: apps/remix/app/components/tables/organisation-members-table.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx#: apps/remix/app/components/general/teams/team-email-dropdown.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page-renderer.tsx#: apps/remix/app/components/general/document-signing/document-signing-field-container.tsx#: apps/remix/app/components/forms/branding-preferences-form.tsx#: apps/remix/app/components/forms/avatar-image.tsx@@ -6095,6 +6565,8 @@ msgstr "Potwierdź hasło"msgid "Reply to email"msgstr "Odpowiedz na adres"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Reply To Email"@@ -6112,6 +6584,10 @@ msgstr ""msgid "Required field"msgstr "Wymagane pole"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Required Field"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "Required scopes"msgstr ""@@ -6126,10 +6602,20 @@ msgstr "Zapieczętuj ponownie dokument"msgid "Resend"msgstr "Wyślij ponownie"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Resend code"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Resend Confirmation Email"msgstr "Wyślij ponownie e-mail potwierdzający"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Resend Document"+msgstr ""+#: apps/remix/app/components/general/teams/team-email-dropdown.tsxmsgid "Resend verification"msgstr "Wyślij ponownie weryfikację"@@ -6188,6 +6674,10 @@ msgstr "Ograniczony dostęp"msgid "Retention of Documents"msgstr "Przechowywanie dokumentów"+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Retried"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-passkey.tsxmsgid "Retry"msgstr "Spróbuj ponownie"@@ -6196,6 +6686,7 @@ msgstr "Spróbuj ponownie"#: apps/remix/app/routes/_unauthenticated+/organisation.invite.$token.tsx#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsx#: apps/remix/app/routes/_unauthenticated+/o.$orgUrl.signin.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsxmsgid "Return"msgstr "Zwróć"@@ -6203,6 +6694,10 @@ msgstr "Zwróć"msgid "Return to Documenso sign in page here"msgstr ""+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to documents"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "Return to Home"msgstr "Powrót do strony głównej"@@ -6212,6 +6707,10 @@ msgstr "Powrót do strony głównej"msgid "Return to sign in"msgstr "Powrót do logowania"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Return to templates"+msgstr ""+#: packages/email/templates/organisation-account-link-confirmation.tsxmsgid "Review request"msgstr ""@@ -6231,6 +6730,10 @@ msgstr "Cofnij dostęp"msgid "Revoke all sessions"msgstr "Cofnij wszystkie sesje"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Right"+msgstr ""+#: apps/remix/app/components/tables/user-organisations-table.tsx#: apps/remix/app/components/tables/team-members-table.tsx#: apps/remix/app/components/tables/team-groups-table.tsx@@ -6263,10 +6766,20 @@ msgstr "Wiersze na stronę"msgid "Save"msgstr "Zapisz"+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "Save failed"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-fields.tsxmsgid "Save Template"msgstr "Zapisz szablon"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "Sealing job started"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.members.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.members.tsx@@ -6320,6 +6833,7 @@ msgstr "Sekret"#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsx#: apps/remix/app/components/general/settings-nav-mobile.tsx#: apps/remix/app/components/general/settings-nav-desktop.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Security"msgstr "Bezpieczeństwo"@@ -6327,6 +6841,10 @@ msgstr "Bezpieczeństwo"msgid "Security activity"msgstr "Aktywność bezpieczeństwa"+#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx+msgid "See the background jobs tab for the status"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-dropdown-field.tsx#: packages/ui/primitives/document-flow/types.ts#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsx@@ -6365,10 +6883,15 @@ msgstr "Wybierz szablon, który chcesz wyświetlić w profilu publicznym zespołmsgid "Select a time zone"msgstr "Wybierz strefę czasową"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Select a value to sign into the field"+msgstr ""+#: packages/ui/components/document/document-global-auth-access-select.tsxmsgid "Select access methods"msgstr "Wybierz metody dostępu"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx#: packages/ui/primitives/combobox.tsxmsgid "Select an option"msgstr "Wybierz opcję"@@ -6377,6 +6900,7 @@ msgstr "Wybierz opcję"msgid "Select an organisation to view teams"msgstr "Wybierz organizację, aby zobaczyć zespoły"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select at least"msgstr "Wybierz co najmniej"@@ -6386,6 +6910,7 @@ msgstr "Wybierz co najmniej"msgid "Select authentication methods"msgstr "Wybierz metody uwierzytelniania"+#: apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/dropdown-field.tsxmsgid "Select default option"msgstr "Wybierz domyślną opcję"@@ -6394,6 +6919,7 @@ msgstr "Wybierz domyślną opcję"msgid "Select default role"msgstr ""+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Select direction"msgstr "Wybierz kierunek"@@ -6432,6 +6958,10 @@ msgstr "Wybierz klucz uwierzytelniający"msgid "Select signature types"msgstr "Wybierz rodzaje podpisów"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx+msgid "Select text align"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-create-dialog.tsxmsgid "Select the members to add to this group"msgstr "Wybierz członków, aby dodać do tej grupy"@@ -6449,6 +6979,12 @@ msgstr "Wybierz wyzwalacze"msgid "Select visibility"msgstr "Wybierz widoczność"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-preview.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Selected Recipient"+msgstr ""++#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -6469,6 +7005,9 @@ msgstr "Wyślij e-mail potwierdzający"msgid "Send document"msgstr "Wyślij dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/send-document-action-dialog.tsxmsgid "Send Document"msgstr "Wyślij dokument"@@ -6513,10 +7052,15 @@ msgstr "Wyślij potwierdzenie podpisania"msgid "Send recipient signing request email"msgstr "Wyślij prośbę o podpisanie"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsxmsgid "Send reminder"msgstr "Wyślij przypomnienie"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Send reminders to the following recipients"+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "Send Test Webhook"msgstr "Wyślij testowy webhook"@@ -6567,6 +7111,7 @@ msgstr "Skonfiguruj właściwości szablonu i informacje o odbiorcach"#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/app-command-menu.tsx#: apps/remix/app/components/general/folder/folder-card.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsxmsgid "Settings"msgstr "Ustawienia"@@ -6600,6 +7145,7 @@ msgstr "Podziel się swoim doświadczeniem podpisywania!"msgid "Show"msgstr "Pokaż"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Show advanced settings"@@ -6609,11 +7155,6 @@ msgstr "Pokaż ustawienia zaawansowane"msgid "Show templates in your public profile for your audience to sign and get started quickly"msgstr "Pokaż szablony w profilu publicznym, aby szybko podpisać dokument"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "Sign"-msgstr ""-#: apps/remix/app/routes/_profile+/p.$url.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table-action-dropdown.tsx@@ -6627,9 +7168,21 @@ msgstr ""#: apps/remix/app/components/general/document-signing/document-signing-auth-password.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-2fa.tsx#: apps/remix/app/components/general/document/document-page-view-button.tsx+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsxmsgid "Sign"msgstr "Podpisz"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "Sign"+msgstr ""+#. placeholder {0}: recipient.name#. placeholder {1}: recipient.email#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx@@ -6648,8 +7201,8 @@ msgstr "Podpisz jako<0>{0} <1>({1})</1></0>"msgid "Sign document"msgstr "Podpisz dokument"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx-#: packages/email/template-components/template-document-invite.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsxmsgid "Sign Document"msgstr "Podpisz dokument"@@ -6657,6 +7210,14 @@ msgstr "Podpisz dokument"msgid "Sign Documents"msgstr "Podpisz dokumenty"+#: apps/remix/app/components/dialogs/sign-field-dropdown-dialog.tsx+msgid "Sign Dropdown Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign Email"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsx#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Sign field"@@ -6679,12 +7240,32 @@ msgstr "Zaloguj się"msgid "Sign in to your account"msgstr "Zaloguj się na swoje konto"+#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign Initials"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign Name"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-number-dialog.tsx+msgid "Sign Number Field"+msgstr ""+#: apps/remix/app/components/general/org-menu-switcher.tsx#: apps/remix/app/components/general/menu-switcher.tsx#: apps/remix/app/components/general/app-nav-mobile.tsxmsgid "Sign Out"msgstr "Wyloguj"+#: apps/remix/app/components/dialogs/sign-field-signature-dialog.tsx+msgid "Sign Signature Field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Sign Text Field"+msgstr ""+#: apps/remix/app/components/embed/embed-document-signing-page.tsx#: apps/remix/app/components/embed/embed-direct-template-client-page.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-signing-view.tsx@@ -6703,8 +7284,22 @@ msgstr "Zarejestruj się za pomocą Google"msgid "Sign Up with OIDC"msgstr "Zarejestruj się za pomocą OIDC"+#: apps/remix/app/components/dialogs/sign-field-email-dialog.tsx+msgid "Sign your email into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-name-dialog.tsx+msgid "Sign your full name into the field"+msgstr ""++#: apps/remix/app/components/dialogs/sign-field-initials-dialog.tsx+msgid "Sign your initials into the field"+msgstr ""+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/general/envelope-signing/envelope-signer-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-signature-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-form.tsx#: apps/remix/app/components/general/direct-template/direct-template-signing-form.tsx@@ -6730,6 +7325,10 @@ msgstr "Podpis jest zbyt mały"msgid "Signature Pad cannot be empty."msgstr "Partner podpisu nie może być pusty."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Signature Settings"+msgstr ""+#: packages/ui/components/document/document-signature-settings-tooltip.tsxmsgid "Signature types"msgstr "Rodzaje podpisów"@@ -6742,17 +7341,17 @@ msgstr "Zebrane podpisy"msgid "Signatures will appear once the document has been completed"msgstr "Podpisy pojawią się po ukończeniu dokumentu"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Signed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: packages/ui/components/document/document-read-only-fields.tsxmsgid "Signed"msgstr "Podpisał"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Signed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Signer"@@ -6803,6 +7402,7 @@ msgstr "Linki do podpisania"msgid "Signing links have been generated for this document."msgstr "Linki do podpisania zostały wygenerowane dla tego dokumentu."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "Signing order is enabled."@@ -6831,6 +7431,7 @@ msgstr "Baner strony"msgid "Site Settings"msgstr "Ustawienia strony"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/missing-signature-field-dialog.tsxmsgid "Some signers have not been assigned a signature field. Please assign at least 1 signature field to each signer before proceeding."msgstr "Niektórzy sygnatariusze nie zostali przypisani do pola podpisu. Przypisz co najmniej 1 pole podpisu do każdego sygnatariusza przed kontynuowaniem."@@ -6879,6 +7480,9 @@ msgstr "Niektórzy sygnatariusze nie zostali przypisani do pola podpisu. Przypis#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/team-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-member-invite-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: apps/remix/app/components/dialogs/document-resend-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-delete-dialog.tsx@@ -6893,6 +7497,8 @@ msgstr "Coś poszło nie tak podczas próby weryfikacji adresu e-mail dla <0>{0}#: packages/ui/primitives/pdf-viewer.tsx#: packages/ui/primitives/pdf-viewer.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx+#: packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxmsgid "Something went wrong while loading the document."msgstr "Coś poszło nie tak podczas ładowania dokumentu."@@ -6908,6 +7514,10 @@ msgstr "Coś poszło nie tak podczas wysyłania e-maila potwierdzającego."msgid "Something went wrong while updating the team billing subscription, please contact support."msgstr "Coś poszło nie tak podczas aktualizacji subskrypcji płatniczej zespołu, prosimy o kontakt z pomocą techniczną."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Something went wrong while uploading this file"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.email.tsx#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.document.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.email.tsx@@ -6960,6 +7570,7 @@ msgstr "Statystyki"#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/documents-table.tsx#: apps/remix/app/components/tables/admin-organisations-table.tsx+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsxmsgid "Status"msgstr "Status"@@ -6981,10 +7592,12 @@ msgid "Stripe Customer ID"msgstr "Identyfikator klienta Stripe"#: apps/remix/app/components/forms/support-ticket-form.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "Subject"msgstr "Temat"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Subject <0>(Optional)</0>"@@ -6994,6 +7607,10 @@ msgstr "Temat <0>(opcjonalnie)</0>"msgid "Submit"msgstr ""+#: apps/remix/app/components/tables/admin-document-jobs-table.tsx+msgid "Submitted"+msgstr ""+#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx#: apps/remix/app/components/general/billing-plans.tsx@@ -7033,7 +7650,6 @@ msgstr "Subskrypcja nieważna"#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx#: apps/remix/app/routes/_authenticated+/admin+/organisations.$id.tsx-#: apps/remix/app/routes/_authenticated+/admin+/documents.$id.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/organisation-member-invites-table.tsx@@ -7043,6 +7659,7 @@ msgstr "Subskrypcja nieważna"#: apps/remix/app/components/general/teams/team-email-dropdown.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx#: apps/remix/app/components/general/organisations/organisation-invitations.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/team-update-form.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/organisation-update-form.tsx@@ -7074,6 +7691,7 @@ msgstr "Subskrypcja nieważna"#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-create-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx#: apps/remix/app/components/dialogs/admin-organisation-create-dialog.tsxmsgid "Success"msgstr "Sukces"@@ -7107,6 +7725,10 @@ msgstr "Synchronizuj"msgid "Sync Email Domains"msgstr "Synchronizuj domeny e-mail"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx+msgid "Sync failed, changes not saved"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/articles.signature-disclosure.tsxmsgid "System Requirements"msgstr "Wymagania systemowe"@@ -7259,7 +7881,7 @@ msgstr "Zespoły pomagają Ci organizować pracę i współpracować z innymi. Smsgid "Teams that this organisation group is currently assigned to"msgstr "Zespoły, do których obecnie przypisana jest ta grupa organizacji"-#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id.legacy_editor.tsx#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx#: apps/remix/app/components/general/template/template-page-view-documents-table.tsx@@ -7285,6 +7907,10 @@ msgstr "Szablon dokumentu został przesłany"msgid "Template duplicated"msgstr "Szablon został zduplikowany"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Editor"+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "Template has been removed from your public profile."msgstr "Szablon został usunięty z profilu publicznego."@@ -7305,6 +7931,10 @@ msgstr "Szablon został przeniesiony"msgid "Template saved"msgstr "Szablon został zapisany"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Template Settings"+msgstr ""+#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "Template title"msgstr "Tytuł szablonu"@@ -7314,6 +7944,7 @@ msgid "Template updated successfully"msgstr "Szablon został zaktualizowany"#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsxmsgid "Template uploaded"msgstr "Szablon przesłany"@@ -7344,6 +7975,7 @@ msgstr "Testowanie webhooka nie powiodło się"msgid "Test webhook sent"msgstr "Testowy webhook wysłany"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-fields-drag-drop.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: apps/remix/app/components/general/document-signing/document-signing-text-field.tsx#: packages/ui/primitives/template-flow/add-template-fields.tsx@@ -7352,6 +7984,7 @@ msgstr "Testowy webhook wysłany"msgid "Text"msgstr "Tekst"+#: apps/remix/app/components/forms/editor/editor-field-generic-field-forms.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/text-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/name-field.tsx@@ -7365,6 +7998,14 @@ msgstr "Wyrównanie tekstu"msgid "Text Color"msgstr "Kolor tekstu"+#: apps/remix/app/components/dialogs/sign-field-text-dialog.tsx+msgid "Text is required"+msgstr ""++#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "Text Settings"+msgstr ""+#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Thank you for completing the signing process."msgstr "Dziękujemy za pomyślne ukończenie procesu podpisu."@@ -7453,6 +8094,17 @@ msgstr "Dokument zostanie ukryty w Twoim koncie"msgid "The document will be immediately sent to recipients if this is checked."msgstr "Dokument zostanie natychmiast wysłany do odbiorców, jeśli to zostanie zaznaczone."+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._layout.tsx+msgid "The document you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id.edit.tsx+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/documents.$id._index.tsx+msgid ""+"The document you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: packages/ui/components/document/document-send-email-message-helper.tsxmsgid "The document's name"msgstr "Nazwa dokumentu"@@ -7610,6 +8262,7 @@ msgstr "Nazwa podpisującego"#: apps/remix/app/components/general/avatar-with-recipient.tsx#: apps/remix/app/components/general/document/document-recipient-link-copy-dialog.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "The signing link has been copied to your clipboard."msgstr "Link do podpisu został skopiowany do schowka."@@ -7642,6 +8295,16 @@ msgstr "Szablon został pomyślnie przeniesiony."msgid "The template will be removed from your profile"msgstr "Szablon zostanie usunięty z Twojego profilu"+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._layout.tsx+msgid "The template you are looking for could not be found."+msgstr ""++#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates.$id._index.tsx+msgid ""+"The template you are looking for may have been removed, renamed or may have never\n"+" existed."+msgstr ""+#: apps/remix/app/components/dialogs/webhook-test-dialog.tsxmsgid "The test webhook has been successfully sent to your endpoint."msgstr "Testowy webhook został pomyślnie wysłany na twój punkt końcowy."@@ -7753,6 +8416,10 @@ msgstr "Ta akcja jest odwracalna, ale proszę być ostrożnym, ponieważ konto mmsgid "This claim is locked and cannot be deleted."msgstr "To roszczenie jest zablokowane i nie można go usunąć."+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "This code will expire in {expiresInMinutes} minutes."+msgstr ""+#: packages/email/template-components/template-document-super-delete.tsxmsgid "This document can not be recovered, if you would like to dispute the reason for future documents please contact support."msgstr "Dokument ten nie może być odzyskany. Jeśli chcesz zakwestionować przyczynę przyszłych dokumentów, skontaktuj się z administracją."@@ -7765,6 +8432,7 @@ msgstr "Tego dokumentu nie można zmienić"msgid "This document could not be deleted at this time. Please try again."msgstr "Nie można usunąć tego dokumentu w tej chwili. Proszę spróbować ponownie."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx#: apps/remix/app/components/dialogs/document-duplicate-dialog.tsxmsgid "This document could not be duplicated at this time. Please try again."msgstr "Nie można skopiować tego dokumentu w tej chwili. Proszę spróbować ponownie."@@ -7781,6 +8449,7 @@ msgstr "Ten dokument został już wysłany do tego odbiorcy. Nie można już edymsgid "This document has been cancelled by the owner and is no longer available for others to sign."msgstr "Ten dokument został anulowany przez właściciela i nie jest już dostępny do podpisania przez innych."+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "This document has been cancelled by the owner."msgstr "Ten dokument został anulowany przez właściciela."@@ -7817,6 +8486,10 @@ msgstr "Ten dokument został stworzony przy użyciu bezpośredniego linku."msgid "This document was sent using <0>Documenso.</0>"msgstr "Dokument został wysłany za pomocą <0>Documenso.</0>"+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This document will be duplicated."+msgstr ""+#: packages/email/template-components/template-document-rejection-confirmed.tsxmsgid "This email confirms that you have rejected the document <0>\"{documentName}\"</0> sent by {documentOwnerName}."msgstr "Ten email potwierdza, że odrzuciłeś dokument <0>\"{documentName}\"</0> wysłany przez {documentOwnerName}."@@ -7841,6 +8514,14 @@ msgstr "Zostanie wysłana do odbiorcy z prośbą o podpisanie dokumentu."msgid "This email will be sent to the recipient who has just signed the document, if there are still other recipients who have not signed yet."msgstr "Zostanie wysłana do odbiorcy, który właśnie podpisał dokument, gdy są jeszcze inni odbiorcy, którzy jeszcze nie podpisali dokumentu."+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "This envelope could not be distributed at this time. Please try again."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "This envelope could not be resent at this time. Please try again."+msgstr ""+#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsxmsgid "This field cannot be modified or deleted. When you share this template's direct link or add it to your public profile, anyone who accesses it can input their name and email, and fill in the fields assigned to them."msgstr "To pole nie może być modyfikowane ani usuwane. Po udostępnieniu bezpośredniego linku do tego szablonu lub dodaniu go do swojego publicznego profilu, każdy, kto się w nim dostanie, może wpisać swoje imię i email oraz wypełnić przypisane mu pola."@@ -7849,6 +8530,7 @@ msgstr "To pole nie może być modyfikowane ani usuwane. Po udostępnieniu bezpomsgid "This folder contains multiple items. Deleting it will remove all subfolders and move all nested documents and templates to the root folder."msgstr "Ten folder zawiera wiele elementów. Usunięcie go spowoduje usunięcie wszystkich podfolderów i przeniesienie wszystkich zagnieżdżonych dokumentów oraz szablonów do folderu głównego."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsxmsgid "This is how the document will reach the recipients once the document is ready for signing."msgstr "W ten sposób dokument dotrze do odbiorców, gdy tylko dokument będzie gotowy do podpisania."@@ -7865,6 +8547,10 @@ msgstr ""msgid "This is the URL which users will use to sign in to your organisation."msgstr ""+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "This item cannot be deleted"+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/team.verify.email.$token.tsxmsgid "This link is invalid or has expired. Please contact your team to resend a verification."msgstr "Ten link jest nieprawidłowy lub wygasł. Proszę skontaktować się ze swoim zespołem, aby ponownie wysłać weryfikację."@@ -7885,6 +8571,7 @@ msgstr "Ten klucz dostępu został już zarejestrowany."msgid "This passkey is not configured for this application. Please login and add one in the user settings."msgstr "Ten klucz dostępu nie jest skonfigurowany dla tej aplikacji. Proszę zalogować się i dodać jeden w ustawieniach użytkownika."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx#: packages/ui/primitives/document-flow/add-fields.tsxmsgid "This recipient can no longer be modified as they have signed a field, or completed the document."msgstr "Ten odbiorca nie może być już modyfikowany, ponieważ podpisał pole lub ukończył dokument."@@ -7893,6 +8580,7 @@ msgstr "Ten odbiorca nie może być już modyfikowany, ponieważ podpisał polemsgid "This session has expired. Please try again."msgstr "Ta sesja wygasła. Proszę spróbować ponownie."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "This signer has already signed the document."msgstr "Ten sygnatariusz już podpisał dokument."@@ -7909,6 +8597,10 @@ msgstr "Ten szablon nie mógł zostać usunięty w tej chwili. Proszę spróbowamsgid "This template is using legacy field insertion, we recommend using the new field insertion method for more accurate results."msgstr "Ten szablon używa starej metody wstawiania pola, zalecamy nową metodę dla lepszych rezultatów."+#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "This template will be duplicated."+msgstr ""+#: apps/remix/app/routes/_unauthenticated+/organisation.decline.$token.tsxmsgid "This token is invalid or has expired. No action is needed."msgstr "Ten token jest nieprawidłowy lub wygasł. Nie wymaga żadnej akcji."@@ -7960,6 +8652,7 @@ msgid "Time zone"msgstr "Strefa czasowa"#: apps/remix/app/routes/_internal+/[__htmltopdf]+/audit-log.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/embed/authoring/configure-document-advanced-settings.tsx#: packages/ui/primitives/template-flow/add-template-settings.tsx#: packages/ui/primitives/document-flow/add-settings.tsx@@ -8108,6 +8801,7 @@ msgstr "Uwierzytelnianie dwuetapowe"msgid "Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app."msgstr "Kody odzyskiwania uwierzytelniania dwuetapowego są używane do uzyskania dostępu do Twojego konta w przypadku, gdy stracisz dostęp do aplikacji uwierzytelniającej."+#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/forms/signin.tsxmsgid "Two-Factor Authentication"msgstr "Uwierzytelnianie dwuetapowe"@@ -8128,17 +8822,17 @@ msgstr "Uwierzytelnianie dwuetapowe zostało wyłączone dla Twojego konta. Niemsgid "Two-Factor Re-Authentication"msgstr "Ponowna autoryzacja za pomocą dwuetapowej weryfikacji"-#: packages/lib/constants/document.ts-msgctxt "Type signatute type"-msgid "Type"-msgstr ""-#: apps/remix/app/components/tables/templates-table.tsx#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx#: packages/ui/primitives/signature-pad/signature-pad.tsxmsgid "Type"msgstr "Typ"+#: packages/lib/constants/document.ts+msgctxt "Type signatute type"+msgid "Type"+msgstr ""+#: apps/remix/app/components/general/app-command-menu.tsxmsgid "Type a command or search..."msgstr "Wpisz polecenie lub wyszukaj..."@@ -8287,6 +8981,7 @@ msgstr "Grupa bez nazwy"#: apps/remix/app/components/tables/settings-security-passkey-table-actions.tsx#: apps/remix/app/components/tables/settings-public-profile-templates-table.tsx#: apps/remix/app/components/tables/admin-claims-table.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx#: apps/remix/app/components/forms/public-profile-form.tsx#: apps/remix/app/components/forms/email-preferences-form.tsx#: apps/remix/app/components/forms/document-preferences-form.tsx@@ -8418,15 +9113,15 @@ msgstr "Ulepsz <0>{0}</0> do {planName}"msgid "Upgrade your plan to upload more documents"msgstr "Zaktualizuj swój plan, aby przesłać więcej dokumentów"+#: packages/ui/primitives/signature-pad/signature-pad.tsx+msgid "Upload"+msgstr "Przesłany"+#: packages/lib/constants/document.tsmsgctxt "Upload signatute type"msgid "Upload"msgstr ""-#: packages/ui/primitives/signature-pad/signature-pad.tsx-msgid "Upload"-msgstr "Przesłany"-#: apps/remix/app/components/dialogs/template-bulk-send-dialog.tsxmsgid "Upload a CSV file to create multiple documents from this template. Each row represents one document with its recipient details."msgstr "Prześlij plik CSV, aby utworzyć wiele dokumentów z tego szablonu. Każda linia reprezentuje jeden dokument z jego szczegółami odbiorcy."@@ -8451,12 +9146,20 @@ msgstr "Prześlij CSV"msgid "Upload custom document"msgstr "Prześlij niestandardowy dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Upload disabled"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsx#: packages/ui/primitives/document-upload.tsxmsgid "Upload Document"msgstr "Prześlij dokument"+#: apps/remix/app/components/general/envelope-editor/envelope-editor.tsx+msgid "Upload documents and add recipients"+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Upload failed"@@ -8496,6 +9199,10 @@ msgstr "Przesłany plik jest zbyt mały"msgid "Uploaded file not an allowed file type"msgstr "Przesłany plik nie jest dozwolonym typem pliku"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-upload.tsx+msgid "Uploading"+msgstr ""+#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Uploading document..."msgstr "Przesyłanie dokumentu..."@@ -8518,10 +9225,15 @@ msgstr "Użyj Authenticatora"msgid "Use Backup Code"msgstr "Użyj kodu zapasowego"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-header.tsx#: apps/remix/app/components/dialogs/template-use-dialog.tsxmsgid "Use Template"msgstr "Użyj szablonu"+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Use your authenticator app to generate a code"+msgstr ""+#: apps/remix/app/components/general/document-signing/document-signing-auth-dialog.tsxmsgid "Use your passkey for authentication"msgstr "Użyj swojego klucza dostępu do uwierzytelniania"@@ -8570,17 +9282,25 @@ msgstr "Użytkownik z tym adresem e-mail już istnieje. Proszę użyć innego admsgid "Users"msgstr "Użytkownicy"+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Validation"msgstr "Walidacja"#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx+#: apps/remix/app/components/forms/editor/editor-field-number-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxmsgid "Value"msgstr "Wartość"+#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Verification Code Required"+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "Verification Email Sent"msgstr "Wysłano wiadomość e-mail z weryfikacją"@@ -8589,6 +9309,10 @@ msgstr "Wysłano wiadomość e-mail z weryfikacją"msgid "Verification email sent successfully."msgstr "Wiadomość e-mail z weryfikacją została wysłana pomyślnie."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "Verify & Complete"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-records-dialog.tsxmsgid "Verify Domain"msgstr "Zweryfikuj domenę"@@ -8605,7 +9329,8 @@ msgstr "Zweryfikuj adres e-mail"msgid "Verify your email address to unlock all features."msgstr "Zweryfikuj adres e-mail, aby odblokować wszystkie funkcje."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsxmsgid "Verify your email to upload documents."msgstr "Zweryfikuj adres e-mail, aby przesłać dokumenty."@@ -8613,15 +9338,11 @@ msgstr "Zweryfikuj adres e-mail, aby przesłać dokumenty."msgid "Verify your team email address"msgstr "Zweryfikuj adres e-mail zespołu"+#: apps/remix/app/components/forms/editor/editor-field-checkbox-form.tsx#: packages/ui/primitives/document-flow/field-items-advanced-settings/checkbox-field.tsxmsgid "Vertical"msgstr "Pionowo"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role action verb"-msgid "View"-msgstr ""-#: apps/remix/app/components/tables/organisation-billing-invoices-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx#: apps/remix/app/components/tables/inbox-table.tsx@@ -8634,6 +9355,11 @@ msgstr ""msgid "View"msgstr "Widok"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role action verb"+msgid "View"+msgstr ""+#: apps/remix/app/routes/_authenticated+/settings+/security._index.tsxmsgid "View activity"msgstr "Wyświetl aktywność"@@ -8680,7 +9406,7 @@ msgstr "Zobacz rekordy DNS"msgid "View document"msgstr "Zobacz dokument"-#: apps/remix/app/components/general/document-signing/document-signing-page-view.tsx+#: apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx#: packages/ui/primitives/document-flow/add-subject.tsx@@ -8689,6 +9415,18 @@ msgstr "Zobacz dokument"msgid "View Document"msgstr "Wyświetl dokument"+#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to approve"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to assist"+msgstr ""++#: packages/email/template-components/template-document-invite.tsx+msgid "View Document to sign"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings._index.tsxmsgid "View documents associated with this email"msgstr "Wyświetl dokumenty powiązane z tym e-mailem"@@ -8730,17 +9468,17 @@ msgstr "Wyświetl zespoły"msgid "View the DNS records for this email domain"msgstr "Zobacz rekordy DNS dla tej domeny e-mail"-#: packages/lib/constants/recipient-roles.ts-msgctxt "Recipient role actioned"-msgid "Viewed"-msgstr ""-#: apps/remix/app/routes/_internal+/[__htmltopdf]+/certificate.tsx#: apps/remix/app/components/general/document/document-page-view-recipients.tsx#: apps/remix/app/components/embed/multisign/multi-sign-document-list.tsxmsgid "Viewed"msgstr "Wyświetlono"+#: packages/lib/constants/recipient-roles.ts+msgctxt "Recipient role actioned"+msgid "Viewed"+msgstr ""+#: packages/lib/constants/recipient-roles.tsmsgctxt "Recipient role name"msgid "Viewer"@@ -8781,6 +9519,7 @@ msgstr "Czekam na podpisy innych"msgid "Waiting for Your Turn"msgstr "Czekając na Twój Ruch"+#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsx#: apps/remix/app/routes/_recipient+/sign.$token+/_index.tsxmsgid "Want to send slick signing links like this one? <0>Check out Documenso.</0>"msgstr "Chcesz wysłać eleganckie linki do podpisywania, takie jak ten? <0>Sprawdź Documenso.</0>"@@ -8789,6 +9528,9 @@ msgstr "Chcesz wysłać eleganckie linki do podpisywania, takie jak ten? <0>Spramsgid "Want your own public profile?"msgstr "Chcesz mieć profil publiczny?"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx@@ -8832,6 +9574,12 @@ msgstr "Nie udało nam się zaktualizować organizacji. Spróbuj ponownie."msgid "We couldn't update the provider. Please try again."msgstr ""+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+#: packages/lib/client-only/providers/envelope-editor-provider.tsx+msgid "We encountered an error while attempting to save your changes. Your changes cannot be saved at this time."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-create-dialog.tsxmsgid "We encountered an error while creating the email. Please try again later."msgstr "Wystąpił błąd podczas tworzenia e-maila. Proszę spróbować ponownie później."@@ -8918,6 +9666,10 @@ msgstr "Wystąpił nieznany błąd podczas próby usunięcia tej domeny e-mail.msgid "We encountered an unknown error while attempting to remove this email. Please try again later."msgstr "Wystąpił nieznany błąd podczas próby usunięcia tego e-maila. Proszę spróbować ponownie później."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "We encountered an unknown error while attempting to remove this envelope item. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/team-group-delete-dialog.tsx#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "We encountered an unknown error while attempting to remove this group. Please try again later."@@ -8932,6 +9684,11 @@ msgstr "Natknęliśmy się na nieznany błąd podczas próby usunięcia tego szamsgid "We encountered an unknown error while attempting to remove this user. Please try again later."msgstr "Natknęliśmy się na nieznany błąd podczas próby usunięcia tego użytkownika. Proszę spróbuj ponownie później."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We encountered an unknown error while attempting to request the two-factor authentication code. Please try again later."+msgstr ""+#: apps/remix/app/components/forms/reset-password.tsxmsgid "We encountered an unknown error while attempting to reset your password. Please try again later."msgstr "Natknęliśmy się na nieznany błąd podczas próby zresetowania hasła. Proszę spróbuj ponownie później."@@ -8955,6 +9712,10 @@ msgstr "Natknęliśmy się na nieznany błąd podczas próby rejestracji. Proszmsgid "We encountered an unknown error while attempting to update the banner. Please try again later."msgstr "Natknęliśmy się na nieznany błąd podczas próby zaktualizowania banera. Proszę spróbuj ponownie później."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-settings-dialog.tsx+msgid "We encountered an unknown error while attempting to update the envelope. Please try again later."+msgstr ""+#: apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsxmsgid "We encountered an unknown error while attempting to update the template. Please try again later."msgstr "Natknęliśmy się na nieznany błąd podczas próby zaktualizowania szablonu. Proszę spróbuj ponownie później."@@ -9067,11 +9828,13 @@ msgid "We were unable to verify your email. If your email is not verified alreadmsgstr "Nie udało się zweryfikować twojego e-maila. Jeśli twój e-mail nie jest jeszcze zweryfikowany, spróbuj ponownie."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We will generate signing links for you, which you can send to the recipients through your method of choice."msgstr "Wygenerujemy dla Ciebie linki do podpisania, które możesz wysłać do odbiorców za pomocą wybranej metody."#: apps/remix/app/components/dialogs/template-use-dialog.tsx+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx#: packages/ui/primitives/document-flow/add-subject.tsxmsgid "We won't send anything to notify recipients."msgstr "Nie wyślemy nic, aby powiadomić odbiorców."@@ -9080,6 +9843,10 @@ msgstr "Nie wyślemy nic, aby powiadomić odbiorców."msgid "We'll get back to you as soon as possible via email."msgstr ""+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We'll send a 6-digit code to your email"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/templates._index.tsx#: apps/remix/app/components/tables/documents-table-empty-state.tsxmsgid "We're all empty"@@ -9093,6 +9860,10 @@ msgstr "Wciąż czekamy na innych sygnatariuszy, aby podpisać ten dokument.<0/>msgid "We've changed your password as you asked. You can now sign in with your new password."msgstr "Zmieniłem hasło, jak prosiłeś. Teraz możesz zalogować się za pomocą nowego hasła."+#: apps/remix/app/components/general/document-signing/access-auth-2fa-form.tsx+msgid "We've sent a 6-digit verification code to your email. Please enter it below to complete the document."+msgstr ""+#: apps/remix/app/components/general/verify-email-banner.tsxmsgid "We've sent a confirmation email to <0>{email}</0>. Please check your inbox and click the link in the email to verify your account."msgstr "Wysłaliśmy wiadomość e-mail z potwierdzeniem na <0>{email}</0>. Proszę sprawdź swoją skrzynkę odbiorczą i kliknij link w e-maile, aby zweryfikować swoje konto."@@ -9157,6 +9928,7 @@ msgstr "Czy próbowałeś raczej edytować ten dokument?"msgid "What you can do with teams:"msgstr "Co możesz zrobić z zespołami:"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: apps/remix/app/components/embed/authoring/configure-document-recipients.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsx@@ -9255,6 +10027,10 @@ msgstr ""msgid "You are about to remove the email domain <0>{emailDomain}</0> from <1>{0}</1>. All emails associated with this domain will be deleted."msgstr "Masz zamiar usunąć domenę e-mail <0>{emailDomain}</0> z <1>{0}</1>. Wszystkie e-maile powiązane z tą domeną zostaną usunięte."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You are about to remove the following document and all associated fields"+msgstr ""+#. placeholder {0}: organisation.name#: apps/remix/app/components/dialogs/organisation-email-delete-dialog.tsxmsgid "You are about to remove the following email from <0>{0}</0>."@@ -9385,6 +10161,7 @@ msgstr "Możesz zobaczyć utworzone dokumenty na swoim pulpicie w sekcji \"Dokummsgid "You can view the document and its status by clicking the button below."msgstr "Możesz zobaczyć dokument i jego status, klikając przycisk poniżej."+#: apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx#: packages/ui/primitives/template-flow/add-template-placeholder-recipients.tsx#: packages/ui/primitives/document-flow/add-signers.tsxmsgid "You cannot add assistants when signing order is disabled."@@ -9394,6 +10171,10 @@ msgstr "Nie można dodać asystentów, gdy kolejność podpisywania jest wyłącmsgid "You cannot delete a group which has a higher role than you."msgstr "Nie możesz usunąć grupy, która ma wyższą rolę niż ty."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You cannot delete this item because the document has been sent to recipients"+msgstr ""+#: apps/remix/app/components/dialogs/passkey-create-dialog.tsxmsgid "You cannot have more than {MAXIMUM_PASSKEYS} passkeys."msgstr "Nie możesz mieć więcej niż {MAXIMUM_PASSKEYS} kluczy zabezpieczeń."@@ -9419,7 +10200,8 @@ msgstr "Nie możesz usuwać członków z tego zespołu, jeśli funkcja dziedziczmsgid "You cannot upload documents at this time."msgstr "Nie możesz przesyłać dokumentów w tej chwili."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You cannot upload encrypted PDFs"msgstr "Nie możesz przesyłać zaszyfrowanych plików PDF"@@ -9478,7 +10260,7 @@ msgstr "Zostałeś poproszony o podpisanie następujących dokumentów. Przegląmsgid "You have declined the invitation from <0>{0}</0> to join their organisation."msgstr "Odrzuciłeś zaproszenie od <0>{0}</0> do dołączenia do ich organizacji."-#. placeholder {0}: `"${document.title}"`+#. placeholder {0}: `"${envelope.title}"`#: packages/lib/server-only/document/resend-document.ts#: packages/lib/jobs/definitions/emails/send-signing-email.handler.tsmsgid "You have initiated the document {0} that requires you to {recipientActionVerb} it."@@ -9505,12 +10287,14 @@ msgstr "Osiągnąłeś maksymalny limit {0} bezpośrednich szablonów. <0>Ulepszmsgid "You have reached the maximum number of teams for your plan. Please contact sales at <0>{SUPPORT_EMAIL}</0> if you would like to adjust your plan."msgstr "Osiągnąłeś maksymalną liczbę zespołów w swoim planie. Skontaktuj się z działem sprzedaży pod adresem <0>{SUPPORT_EMAIL}</0>, jeśli chcesz dostosować swój plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "You have reached your document limit for this month. Please upgrade your plan."msgstr "Osiągnąłeś limit dokumentów na ten miesiąc. Proszę zaktualizować swój plan."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: packages/ui/primitives/document-dropzone.tsxmsgid "You have reached your document limit."msgstr "Osiągnięto limit dokumentów."@@ -9549,6 +10333,10 @@ msgstr "Pomyślnie usunąłeś tę domenę e-mail z organizacji."msgid "You have successfully removed this email from the organisation."msgstr "Pomyślnie usunąłeś tego e-maila z organizacji."+#: apps/remix/app/components/dialogs/envelope-item-delete-dialog.tsx+msgid "You have successfully removed this envelope item."+msgstr ""+#: apps/remix/app/components/dialogs/organisation-group-delete-dialog.tsxmsgid "You have successfully removed this group from the organisation."msgstr "Pomyślnie usunięto tę grupę z organizacji."@@ -9597,11 +10385,19 @@ msgstr "Zweryfikowałeś swój adres e-mail dla <0>{0}</0>."msgid "You must enter '{deleteMessage}' to proceed"msgstr "Musisz wpisać '{deleteMessage}' aby kontynuować"+#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "You must select at least one item"+msgstr ""+#: apps/remix/app/components/dialogs/organisation-email-domain-delete-dialog.tsx#: apps/remix/app/components/dialogs/folder-delete-dialog.tsxmsgid "You must type '{deleteMessage}' to confirm"msgstr "Musisz wpisać '{deleteMessage}', by potwierdzić"+#: apps/remix/app/components/general/envelope-editor/envelope-editor-page-fields.tsx+msgid "You need at least one recipient to add fields"+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "You need to be an admin to manage API tokens."msgstr "Musisz być administratorem, aby zarządzać tokenami API."@@ -9683,7 +10479,8 @@ msgstr "Obecny plan jest niezapłacony."msgid "Your direct signing templates"msgstr "Twoje bezpośrednie szablony podpisu"-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/embed/authoring/configure-document-upload.tsxmsgid "Your document failed to upload."msgstr "Twój dokument nie udało się załadować."@@ -9712,7 +10509,8 @@ msgstr "Dokument został wysłany."msgid "Your document has been successfully duplicated."msgstr "Dokument został zduplikowany."-#: apps/remix/app/components/general/document/document-upload.tsx+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+#: apps/remix/app/components/general/document/document-upload-button.tsx#: apps/remix/app/components/general/document/document-drop-zone-wrapper.tsxmsgid "Your document has been uploaded successfully."msgstr "Dokument został przesłany."@@ -9749,6 +10547,18 @@ msgstr "Twój adres e-mail jest aktualnie używany przez zespół <0>{0}</0> ({1msgid "Your email preferences have been updated"msgstr "Twoje preferencje e-mail zostały zaktualizowane"+#: apps/remix/app/components/dialogs/envelope-distribute-dialog.tsx+msgid "Your envelope has been distributed successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-redistribute-dialog.tsx+msgid "Your envelope has been resent successfully."+msgstr ""++#: apps/remix/app/components/dialogs/envelope-duplicate-dialog.tsx+msgid "Your envelope has been successfully duplicated."+msgstr ""+#: apps/remix/app/routes/_authenticated+/t.$teamUrl+/settings.tokens.tsxmsgid "Your existing tokens"msgstr "Istniejące tokeny"@@ -9832,6 +10642,10 @@ msgstr "Zespół został usunięty."msgid "Your team has been successfully updated."msgstr "Zespół został zaktualizowany."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template failed to upload."+msgstr ""+#: apps/remix/app/routes/embed+/v1+/authoring_.completed.create.tsxmsgid "Your template has been created successfully"msgstr "Szablon został utworzony"@@ -9844,6 +10658,10 @@ msgstr "Szablon został zduplikowany."msgid "Your template has been successfully deleted."msgstr "Szablon został usunięty."+#: apps/remix/app/components/general/document/envelope-upload-button.tsx+msgid "Your template has been uploaded successfully."+msgstr ""+#: apps/remix/app/components/general/template/template-drop-zone-wrapper.tsxmsgid "Your template has been uploaded successfully. You will be redirected to the template page."msgstr "Twój szablon został pomyślnie przesłany. Zostaniesz przekierowany na stronę szablonu."@@ -9868,6 +10686,18 @@ msgstr "Twój token został pomyślnie utworzony! Upewnij się, że go skopiujesmsgid "Your tokens will be shown here once you create them."msgstr "Twoje tokeny będą tutaj wyświetlane po ich utworzeniu."+#: packages/lib/server-only/2fa/email/send-2fa-token-email.ts+msgid "Your two-factor authentication code"+msgstr ""++#: packages/email/templates/access-auth-2fa.tsx+msgid "Your verification code is {code}"+msgstr ""++#: packages/email/template-components/template-access-auth-2fa.tsx+msgid "Your verification code:"+msgstr ""+#: apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.sso.tsxmsgid "your-domain.com another-domain.com"msgstr ""diff --git a/packages/lib/types/document-audit-logs.ts b/packages/lib/types/document-audit-logs.tsindex c604686de..9c6529c6e 100644--- a/packages/lib/types/document-audit-logs.ts+++ b/packages/lib/types/document-audit-logs.ts@@ -642,7 +642,7 @@ export const ZDocumentAuditLogEventDocumentMovedToTeamSchema = z.object({export const ZDocumentAuditLogBaseSchema = z.object({id: z.string(),createdAt: z.date(),- documentId: z.number(),+ envelopeId: z.string(),name: z.string().optional().nullable(),email: z.string().optional().nullable(),userId: z.number().optional().nullable(),diff --git a/packages/lib/types/document-meta.ts b/packages/lib/types/document-meta.tsindex f8b5f7395..b5faf5bee 100644--- a/packages/lib/types/document-meta.ts+++ b/packages/lib/types/document-meta.ts@@ -1,8 +1,14 @@import { msg } from '@lingui/core/macro';+import { DocumentDistributionMethod, DocumentSigningOrder } from '@prisma/client';import { z } from 'zod';+import { VALID_DATE_FORMAT_VALUES } from '@documenso/lib/constants/date-formats';+import { SUPPORTED_LANGUAGE_CODES } from '@documenso/lib/constants/i18n';+import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';import { DocumentMetaSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentMetaSchema';+import { ZDocumentEmailSettingsSchema } from './document-email';+/*** The full document response schema.*@@ -15,9 +21,7 @@ export const ZDocumentMetaSchema = DocumentMetaSchema.pick({subject: true,message: true,timezone: true,- password: true,dateFormat: true,- documentId: true,redirectUrl: true,typedSignatureEnabled: true,uploadSignatureEnabled: true,@@ -51,3 +55,87 @@ export const ZDocumentSignatureSettingsSchema = z);export type TDocumentSignatureSettings = z.infer<typeof ZDocumentSignatureSettingsSchema>;++export const ZDocumentMetaTimezoneSchema = z+ .string()+ .describe(+ 'The timezone to use for date fields and signing the document. Example Etc/UTC, Australia/Melbourne',+ );++export type TDocumentMetaTimezone = z.infer<typeof ZDocumentMetaTimezoneSchema>;++export const ZDocumentMetaDateFormatSchema = z+ .enum(VALID_DATE_FORMAT_VALUES)+ .describe('The date format to use for date fields and signing the document.');++export type TDocumentMetaDateFormat = z.infer<typeof ZDocumentMetaDateFormatSchema>;++export const ZDocumentMetaRedirectUrlSchema = z+ .string()+ .describe('The URL to which the recipient should be redirected after signing the document.')+ .refine((value) => value === undefined || value === '' || isValidRedirectUrl(value), {+ message: 'Please enter a valid URL, make sure you include http:// or https:// part of the url.',+ });++export const ZDocumentMetaLanguageSchema = z+ .enum(SUPPORTED_LANGUAGE_CODES)+ .describe('The language to use for email communications with recipients.');++export const ZDocumentMetaSubjectSchema = z+ .string()+ .max(254)+ .describe('The subject of the email that will be sent to the recipients.');++export const ZDocumentMetaMessageSchema = z+ .string()+ .max(5000)+ .describe('The message of the email that will be sent to the recipients.');++export const ZDocumentMetaDistributionMethodSchema = z+ .nativeEnum(DocumentDistributionMethod)+ .describe('The distribution method to use when sending the document to the recipients.');++export const ZDocumentMetaTypedSignatureEnabledSchema = z+ .boolean()+ .describe('Whether to allow recipients to sign using a typed signature.');++export const ZDocumentMetaDrawSignatureEnabledSchema = z+ .boolean()+ .describe('Whether to allow recipients to sign using a draw signature.');++export const ZDocumentMetaUploadSignatureEnabledSchema = z+ .boolean()+ .describe('Whether to allow recipients to sign using an uploaded signature.');++/**+ * Note: Any updates to this will cause public API changes. You will need to update+ * all corresponding areas where this is used (some places that use this needs to pass+ * it through to another function).+ */+export const ZDocumentMetaCreateSchema = z.object({+ subject: ZDocumentMetaSubjectSchema.optional(),+ message: ZDocumentMetaMessageSchema.optional(),+ timezone: ZDocumentMetaTimezoneSchema.optional(),+ dateFormat: ZDocumentMetaDateFormatSchema.optional(),+ distributionMethod: ZDocumentMetaDistributionMethodSchema.optional(),+ signingOrder: z.nativeEnum(DocumentSigningOrder).optional(),+ allowDictateNextSigner: z.boolean().optional(),+ redirectUrl: ZDocumentMetaRedirectUrlSchema.optional(),+ language: ZDocumentMetaLanguageSchema.optional(),+ typedSignatureEnabled: ZDocumentMetaTypedSignatureEnabledSchema.optional(),+ uploadSignatureEnabled: ZDocumentMetaUploadSignatureEnabledSchema.optional(),+ drawSignatureEnabled: ZDocumentMetaDrawSignatureEnabledSchema.optional(),+ emailId: z.string().nullish(),+ emailReplyTo: z.string().email().nullish(),+ emailSettings: ZDocumentEmailSettingsSchema.optional(),+});++export type TDocumentMetaCreate = z.infer<typeof ZDocumentMetaCreateSchema>;++/**+ * Note: This is the same as the create schema for now since there are+ * no nullable values. Once there is we will need to update this properly.+ */+export const ZDocumentMetaUpdateSchema = ZDocumentMetaCreateSchema;++export type TDocumentMetaUpdate = z.infer<typeof ZDocumentMetaUpdateSchema>;diff --git a/packages/lib/types/document.ts b/packages/lib/types/document.tsindex b42801b72..ea69f7db8 100644--- a/packages/lib/types/document.ts+++ b/packages/lib/types/document.ts@@ -1,11 +1,11 @@-import type { z } from 'zod';+import { z } from 'zod';import { DocumentDataSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentDataSchema';import { DocumentMetaSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentMetaSchema';-import { DocumentSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentSchema';import { FolderSchema } from '@documenso/prisma/generated/zod/modelSchema/FolderSchema';import { TeamSchema } from '@documenso/prisma/generated/zod/modelSchema/TeamSchema';import { UserSchema } from '@documenso/prisma/generated/zod/modelSchema/UserSchema';+import { LegacyDocumentSchema } from '@documenso/prisma/types/document-legacy-schema';import { ZFieldSchema } from './field';import { ZRecipientLiteSchema } from './recipient';@@ -15,7 +15,7 @@ import { ZRecipientLiteSchema } from './recipient';** Mainly used for returning a single document from the API.*/-export const ZDocumentSchema = DocumentSchema.pick({+export const ZDocumentSchema = LegacyDocumentSchema.pick({visibility: true,status: true,source: true,@@ -25,21 +25,32 @@ export const ZDocumentSchema = DocumentSchema.pick({authOptions: true,formValues: true,title: true,- documentDataId: true,createdAt: true,updatedAt: true,completedAt: true,deletedAt: true,teamId: true,- templateId: true,folderId: true,}).extend({+ envelopeId: z.string(),++ // Which "Template" the document was created from.+ templateId: z+ .number()+ .nullish()+ .describe('The ID of the template that the document was created from, if any.'),++ // Backwards compatibility.+ documentDataId: z.string().default(''),+// Todo: Maybe we want to alter this a bit since this returns a lot of data.documentData: DocumentDataSchema.pick({type: true,id: true,data: true,initialData: true,+ }).extend({+ envelopeItemId: z.string(),}),documentMeta: DocumentMetaSchema.pick({signingOrder: true,@@ -48,9 +59,7 @@ export const ZDocumentSchema = DocumentSchema.pick({subject: true,message: true,timezone: true,- password: true,dateFormat: true,- documentId: true,redirectUrl: true,typedSignatureEnabled: true,uploadSignatureEnabled: true,@@ -60,7 +69,11 @@ export const ZDocumentSchema = DocumentSchema.pick({emailSettings: true,emailId: true,emailReplyTo: true,- }).nullable(),+ }).extend({+ password: z.string().nullable().default(null),+ documentId: z.number().default(-1).optional(),+ }),+folder: FolderSchema.pick({id: true,name: true,@@ -82,7 +95,7 @@ export type TDocument = z.infer<typeof ZDocumentSchema>;/*** A lite version of the document response schema without relations.*/-export const ZDocumentLiteSchema = DocumentSchema.pick({+export const ZDocumentLiteSchema = LegacyDocumentSchema.pick({visibility: true,status: true,source: true,@@ -92,15 +105,24 @@ export const ZDocumentLiteSchema = DocumentSchema.pick({authOptions: true,formValues: true,title: true,- documentDataId: true,createdAt: true,updatedAt: true,completedAt: true,deletedAt: true,teamId: true,- templateId: true,folderId: true,useLegacyFieldInsertion: true,+}).extend({+ envelopeId: z.string(),++ // Backwards compatibility.+ documentDataId: z.string().default(''),++ // Which "Template" the document was created from.+ templateId: z+ .number()+ .nullish()+ .describe('The ID of the template that the document was created from, if any.'),});export type TDocumentLite = z.infer<typeof ZDocumentLiteSchema>;@@ -108,7 +130,7 @@ export type TDocumentLite = z.infer<typeof ZDocumentLiteSchema>;/*** A version of the document response schema when returning multiple documents at once from a single API endpoint.*/-export const ZDocumentManySchema = DocumentSchema.pick({+export const ZDocumentManySchema = LegacyDocumentSchema.pick({visibility: true,status: true,source: true,@@ -118,16 +140,25 @@ export const ZDocumentManySchema = DocumentSchema.pick({authOptions: true,formValues: true,title: true,- documentDataId: true,createdAt: true,updatedAt: true,completedAt: true,deletedAt: true,teamId: true,- templateId: true,folderId: true,useLegacyFieldInsertion: true,}).extend({+ envelopeId: z.string(),++ // Backwards compatibility.+ documentDataId: z.string().default(''),++ // Which "Template" the document was created from.+ templateId: z+ .number()+ .nullish()+ .describe('The ID of the template that the document was created from, if any.'),+user: UserSchema.pick({id: true,name: true,diff --git a/packages/lib/types/envelope.ts b/packages/lib/types/envelope.tsnew file mode 100644index 000000000..0be0103d7--- /dev/null+++ b/packages/lib/types/envelope.ts@@ -0,0 +1,138 @@+import { z } from 'zod';++import DocumentDataSchema from '@documenso/prisma/generated/zod/modelSchema/DocumentDataSchema';+import { DocumentMetaSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentMetaSchema';+import { EnvelopeItemSchema } from '@documenso/prisma/generated/zod/modelSchema/EnvelopeItemSchema';+import { EnvelopeSchema } from '@documenso/prisma/generated/zod/modelSchema/EnvelopeSchema';+import { TeamSchema } from '@documenso/prisma/generated/zod/modelSchema/TeamSchema';+import TemplateDirectLinkSchema from '@documenso/prisma/generated/zod/modelSchema/TemplateDirectLinkSchema';++import { ZFieldSchema } from './field';+import { ZRecipientLiteSchema } from './recipient';++/**+ * The full envelope response schema.+ *+ * Mainly used for returning a single envelope from the API.+ */+export const ZEnvelopeSchema = EnvelopeSchema.pick({+ internalVersion: true,+ type: true,+ status: true,+ source: true,+ visibility: true,+ templateType: true,+ id: true,+ secondaryId: true,+ externalId: true,+ createdAt: true,+ updatedAt: true,+ completedAt: true,+ deletedAt: true,+ title: true,+ authOptions: true,+ formValues: true,+ publicTitle: true,+ publicDescription: true,+ userId: true,+ teamId: true,+ folderId: true,+}).extend({+ templateId: z+ .number()+ .nullish()+ .describe('The ID of the template that the document was created from, if any.'),+ documentMeta: DocumentMetaSchema.pick({+ signingOrder: true,+ distributionMethod: true,+ id: true,+ subject: true,+ message: true,+ timezone: true,+ dateFormat: true,+ redirectUrl: true,+ typedSignatureEnabled: true,+ uploadSignatureEnabled: true,+ drawSignatureEnabled: true,+ allowDictateNextSigner: true,+ language: true,+ emailSettings: true,+ emailId: true,+ emailReplyTo: true,+ }),+ recipients: ZRecipientLiteSchema.omit({+ documentId: true,+ templateId: true,+ }).array(),+ fields: ZFieldSchema.omit({+ documentId: true,+ templateId: true,+ }).array(),+ envelopeItems: EnvelopeItemSchema.pick({+ id: true,+ title: true,+ documentDataId: true,+ order: true,+ })+ .extend({+ documentData: DocumentDataSchema.pick({+ type: true,+ id: true,+ data: true,+ initialData: true, // Todo: Envelopes - Maybe this hide this.+ }),+ })+ .array(),+ directLink: TemplateDirectLinkSchema.pick({+ directTemplateRecipientId: true,+ enabled: true,+ id: true,+ token: true,+ }).nullable(),+ team: TeamSchema.pick({+ id: true,+ url: true,+ }),+ user: z.object({+ id: z.number(),+ name: z.string(),+ email: z.string(),+ }),+});++export type TEnvelope = z.infer<typeof ZEnvelopeSchema>;++/**+ * A lite version of the envelope response schema without relations.+ */+export const ZEnvelopeLiteSchema = EnvelopeSchema.pick({+ internalVersion: true,+ type: true,+ status: true,+ source: true,+ visibility: true,+ templateType: true,+ id: true,+ secondaryId: true,+ externalId: true,+ createdAt: true,+ updatedAt: true,+ completedAt: true,+ deletedAt: true,+ title: true,+ authOptions: true,+ formValues: true,+ publicTitle: true,+ publicDescription: true,+ userId: true,+ teamId: true,+ folderId: true,+});++export type TEnvelopeLite = z.infer<typeof ZEnvelopeLiteSchema>;++/**+ * A version of the envelope response schema when returning multiple envelopes at once from a single API endpoint.+ */+// export const ZEnvelopeManySchema = X+// export type TEnvelopeMany = z.infer<typeof ZEnvelopeManySchema>;diff --git a/packages/lib/types/field-meta.ts b/packages/lib/types/field-meta.tsindex b0db24316..eea0d204f 100644--- a/packages/lib/types/field-meta.ts+++ b/packages/lib/types/field-meta.ts@@ -1,6 +1,8 @@import { FieldType } from '@prisma/client';import { z } from 'zod';+export const DEFAULT_FIELD_FONT_SIZE = 14;+export const ZBaseFieldMeta = z.object({label: z.string().optional(),placeholder: z.string().optional(),@@ -58,10 +60,10 @@ export type TTextFieldMeta = z.infer<typeof ZTextFieldMeta>;export const ZNumberFieldMeta = ZBaseFieldMeta.extend({type: z.literal('number'),- numberFormat: z.string().optional(),+ numberFormat: z.string().nullish(),value: z.string().optional(),- minValue: z.number().optional(),- maxValue: z.number().optional(),+ minValue: z.coerce.number().nullish(),+ maxValue: z.coerce.number().nullish(),fontSize: z.number().min(8).max(96).optional(),textAlign: ZFieldTextAlignSchema.optional(),});@@ -226,3 +228,86 @@ export const ZFieldAndMetaSchema = z.discriminatedUnion('type', []);export type TFieldAndMeta = z.infer<typeof ZFieldAndMetaSchema>;++export const FIELD_DATE_META_DEFAULT_VALUES: TDateFieldMeta = {+ type: 'date',+ fontSize: 14,+ textAlign: 'left',+};++export const FIELD_TEXT_META_DEFAULT_VALUES: TTextFieldMeta = {+ type: 'text',+ fontSize: 14,+ textAlign: 'left',+ label: '',+ placeholder: '',+ text: '',+ required: false,+ readOnly: false,+};+export const FIELD_NUMBER_META_DEFAULT_VALUES: TNumberFieldMeta = {+ type: 'number',+ fontSize: 14,+ textAlign: 'left',+ label: '',+ placeholder: '',+ required: false,+ readOnly: false,+};++export const FIELD_INITIALS_META_DEFAULT_VALUES: TInitialsFieldMeta = {+ type: 'initials',+ fontSize: 14,+ textAlign: 'left',+};++export const FIELD_NAME_META_DEFAULT_VALUES: TNameFieldMeta = {+ type: 'name',+ fontSize: 14,+ textAlign: 'left',+};++export const FIELD_EMAIL_META_DEFAULT_VALUES: TEmailFieldMeta = {+ type: 'email',+ fontSize: 14,+ textAlign: 'left',+};++export const FIELD_RADIO_META_DEFAULT_VALUES: TRadioFieldMeta = {+ type: 'radio',+ values: [{ id: 1, checked: false, value: '' }],+ required: false,+ readOnly: false,+};++export const FIELD_CHECKBOX_META_DEFAULT_VALUES: TCheckboxFieldMeta = {+ type: 'checkbox',+ values: [{ id: 1, checked: false, value: '' }],+ validationRule: '',+ validationLength: 0,+ required: false,+ readOnly: false,+ direction: 'vertical',+};++export const FIELD_DROPDOWN_META_DEFAULT_VALUES: TDropdownFieldMeta = {+ type: 'dropdown',+ values: [{ value: 'Option 1' }],+ defaultValue: '',+ required: false,+ readOnly: false,+};++export const FIELD_META_DEFAULT_VALUES: Record<FieldType, TFieldMetaSchema> = {+ [FieldType.SIGNATURE]: undefined,+ [FieldType.FREE_SIGNATURE]: undefined,+ [FieldType.INITIALS]: FIELD_INITIALS_META_DEFAULT_VALUES,+ [FieldType.NAME]: FIELD_NAME_META_DEFAULT_VALUES,+ [FieldType.EMAIL]: FIELD_EMAIL_META_DEFAULT_VALUES,+ [FieldType.DATE]: FIELD_DATE_META_DEFAULT_VALUES,+ [FieldType.TEXT]: FIELD_TEXT_META_DEFAULT_VALUES,+ [FieldType.NUMBER]: FIELD_NUMBER_META_DEFAULT_VALUES,+ [FieldType.RADIO]: FIELD_RADIO_META_DEFAULT_VALUES,+ [FieldType.CHECKBOX]: FIELD_CHECKBOX_META_DEFAULT_VALUES,+ [FieldType.DROPDOWN]: FIELD_DROPDOWN_META_DEFAULT_VALUES,+} as const;diff --git a/packages/lib/types/field.ts b/packages/lib/types/field.tsindex 5b3839f0c..cc43eda9c 100644--- a/packages/lib/types/field.ts+++ b/packages/lib/types/field.ts@@ -1,7 +1,20 @@+import { FieldType, Prisma } from '@prisma/client';import { z } from 'zod';import { FieldSchema } from '@documenso/prisma/generated/zod/modelSchema/FieldSchema';+import {+ ZCheckboxFieldMeta,+ ZDateFieldMeta,+ ZDropdownFieldMeta,+ ZEmailFieldMeta,+ ZInitialsFieldMeta,+ ZNameFieldMeta,+ ZNumberFieldMeta,+ ZRadioFieldMeta,+ ZTextFieldMeta,+} from './field-meta';+/*** The full field response schema.*@@ -15,11 +28,11 @@ import { FieldSchema } from '@documenso/prisma/generated/zod/modelSchema/FieldSc* - ./templates.ts*/export const ZFieldSchema = FieldSchema.pick({+ envelopeId: true,+ envelopeItemId: true,type: true,id: true,secondaryId: true,- documentId: true,- templateId: true,recipientId: true,page: true,positionX: true,@@ -29,6 +42,10 @@ export const ZFieldSchema = FieldSchema.pick({customText: true,inserted: true,fieldMeta: true,+}).extend({+ // Backwards compatibility.+ documentId: z.number().nullish(),+ templateId: z.number().nullish(),});export const ZFieldPageNumberSchema = z@@ -49,3 +66,110 @@ export const ZFieldPageYSchema = zexport const ZFieldWidthSchema = z.number().min(1).describe('The width of the field.');export const ZFieldHeightSchema = z.number().min(1).describe('The height of the field.');++// ---------------------------------------------++// Todo: Envelopes - dunno man+const PrismaDecimalSchema = z.preprocess(+ (val) => (typeof val === 'string' ? new Prisma.Decimal(val) : val),+ z.instanceof(Prisma.Decimal, { message: 'Must be a Decimal' }),+);++export const BaseFieldSchemaUsingNumbers = ZFieldSchema.extend({+ positionX: PrismaDecimalSchema,+ positionY: PrismaDecimalSchema,+ width: PrismaDecimalSchema,+ height: PrismaDecimalSchema,+});++export const ZFieldTextSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.TEXT),+ fieldMeta: ZTextFieldMeta,+});++export type TFieldText = z.infer<typeof ZFieldTextSchema>;++export const ZFieldSignatureSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.SIGNATURE),+ fieldMeta: z.literal(null),+});++export type TFieldSignature = z.infer<typeof ZFieldSignatureSchema>;++export const ZFieldFreeSignatureSchema = ZFieldSignatureSchema;++export type TFieldFreeSignature = z.infer<typeof ZFieldFreeSignatureSchema>;++export const ZFieldInitialsSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.INITIALS),+ fieldMeta: ZInitialsFieldMeta,+});++export type TFieldInitials = z.infer<typeof ZFieldInitialsSchema>;++export const ZFieldNameSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.NAME),+ fieldMeta: ZNameFieldMeta,+});++export type TFieldName = z.infer<typeof ZFieldNameSchema>;++export const ZFieldEmailSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.EMAIL),+ fieldMeta: ZEmailFieldMeta,+});++export type TFieldEmail = z.infer<typeof ZFieldEmailSchema>;++export const ZFieldDateSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.DATE),+ fieldMeta: ZDateFieldMeta,+});++export type TFieldDate = z.infer<typeof ZFieldDateSchema>;++export const ZFieldNumberSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.NUMBER),+ fieldMeta: ZNumberFieldMeta,+});++export type TFieldNumber = z.infer<typeof ZFieldNumberSchema>;++export const ZFieldRadioSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.RADIO),+ fieldMeta: ZRadioFieldMeta,+});++export type TFieldRadio = z.infer<typeof ZFieldRadioSchema>;++export const ZFieldCheckboxSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.CHECKBOX),+ fieldMeta: ZCheckboxFieldMeta,+});++export type TFieldCheckbox = z.infer<typeof ZFieldCheckboxSchema>;++export const ZFieldDropdownSchema = BaseFieldSchemaUsingNumbers.extend({+ type: z.literal(FieldType.DROPDOWN),+ fieldMeta: ZDropdownFieldMeta,+});++export type TFieldDropdown = z.infer<typeof ZFieldDropdownSchema>;++/**+ * The full field schema which will enforce all types and meta fields.+ */+export const ZFullFieldSchema = z.discriminatedUnion('type', [+ ZFieldTextSchema,+ ZFieldSignatureSchema,+ ZFieldInitialsSchema,+ ZFieldNameSchema,+ ZFieldEmailSchema,+ ZFieldDateSchema,+ ZFieldNumberSchema,+ ZFieldRadioSchema,+ ZFieldCheckboxSchema,+ ZFieldDropdownSchema,+]);++export type TFullFieldSchema = z.infer<typeof ZFullFieldSchema>;diff --git a/packages/lib/types/recipient.ts b/packages/lib/types/recipient.tsindex e46681f44..0a09bdf46 100644--- a/packages/lib/types/recipient.ts+++ b/packages/lib/types/recipient.ts@@ -1,3 +1,5 @@+import { z } from 'zod';+import { RecipientSchema } from '@documenso/prisma/generated/zod/modelSchema/RecipientSchema';import { TeamSchema } from '@documenso/prisma/generated/zod/modelSchema/TeamSchema';import { UserSchema } from '@documenso/prisma/generated/zod/modelSchema/UserSchema';@@ -10,13 +12,12 @@ import { ZFieldSchema } from './field';* Mainly used for returning a single recipient from the API.*/export const ZRecipientSchema = RecipientSchema.pick({+ envelopeId: true,role: true,readStatus: true,signingStatus: true,sendStatus: true,id: true,- documentId: true,- templateId: true,email: true,name: true,token: true,@@ -28,19 +29,22 @@ export const ZRecipientSchema = RecipientSchema.pick({rejectionReason: true,}).extend({fields: ZFieldSchema.array(),++ // Backwards compatibility.+ documentId: z.number().nullish(),+ templateId: z.number().nullish(),});/*** A lite version of the recipient response schema without relations.*/export const ZRecipientLiteSchema = RecipientSchema.pick({+ envelopeId: true,role: true,readStatus: true,signingStatus: true,sendStatus: true,id: true,- documentId: true,- templateId: true,email: true,name: true,token: true,@@ -50,19 +54,22 @@ export const ZRecipientLiteSchema = RecipientSchema.pick({authOptions: true,signingOrder: true,rejectionReason: true,+}).extend({+ // Backwards compatibility.+ documentId: z.number().nullish(),+ templateId: z.number().nullish(),});/*** A version of the recipient response schema when returning multiple recipients at once from a single API endpoint.*/export const ZRecipientManySchema = RecipientSchema.pick({+ envelopeId: true,role: true,readStatus: true,signingStatus: true,sendStatus: true,id: true,- documentId: true,- templateId: true,email: true,name: true,token: true,@@ -83,4 +90,8 @@ export const ZRecipientManySchema = RecipientSchema.pick({id: true,url: true,}).nullable(),++ // Backwards compatibility.+ documentId: z.number().nullish(),+ templateId: z.number().nullish(),});diff --git a/packages/lib/types/template.ts b/packages/lib/types/template.tsindex 1171ad18d..0ba6b0010 100644--- a/packages/lib/types/template.ts+++ b/packages/lib/types/template.ts@@ -1,12 +1,14 @@-import type { z } from 'zod';+import { z } from 'zod';import { DocumentDataSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentDataSchema';+import { DocumentMetaSchema } from '@documenso/prisma/generated/zod/modelSchema/DocumentMetaSchema';import { FolderSchema } from '@documenso/prisma/generated/zod/modelSchema/FolderSchema';import TeamSchema from '@documenso/prisma/generated/zod/modelSchema/TeamSchema';-import { TemplateDirectLinkSchema } from '@documenso/prisma/generated/zod/modelSchema/TemplateDirectLinkSchema';-import { TemplateMetaSchema } from '@documenso/prisma/generated/zod/modelSchema/TemplateMetaSchema';-import { TemplateSchema } from '@documenso/prisma/generated/zod/modelSchema/TemplateSchema';import { UserSchema } from '@documenso/prisma/generated/zod/modelSchema/UserSchema';+import {+ LegacyTemplateDirectLinkSchema,+ TemplateSchema,+} from '@documenso/prisma/types/template-legacy-schema';import { ZFieldSchema } from './field';import { ZRecipientLiteSchema } from './recipient';@@ -25,21 +27,27 @@ export const ZTemplateSchema = TemplateSchema.pick({userId: true,teamId: true,authOptions: true,- templateDocumentDataId: true,createdAt: true,updatedAt: true,publicTitle: true,publicDescription: true,folderId: true,}).extend({+ envelopeId: z.string(),++ // Backwards compatibility.+ templateDocumentDataId: z.string().default(''),+// Todo: Maybe we want to alter this a bit since this returns a lot of data.templateDocumentData: DocumentDataSchema.pick({type: true,id: true,data: true,initialData: true,+ }).extend({+ envelopeItemId: z.string(),}),- templateMeta: TemplateMetaSchema.pick({+ templateMeta: DocumentMetaSchema.pick({id: true,subject: true,message: true,@@ -51,14 +59,15 @@ export const ZTemplateSchema = TemplateSchema.pick({drawSignatureEnabled: true,allowDictateNextSigner: true,distributionMethod: true,- templateId: true,redirectUrl: true,language: true,emailSettings: true,emailId: true,emailReplyTo: true,- }).nullable(),- directLink: TemplateDirectLinkSchema.nullable(),+ }).extend({+ templateId: z.number().nullable(),+ }),+ directLink: LegacyTemplateDirectLinkSchema.nullable(),user: UserSchema.pick({id: true,name: true,@@ -94,15 +103,21 @@ export const ZTemplateLiteSchema = TemplateSchema.pick({userId: true,teamId: true,authOptions: true,- templateDocumentDataId: true,createdAt: true,updatedAt: true,publicTitle: true,publicDescription: true,folderId: true,useLegacyFieldInsertion: true,+}).extend({+ envelopeId: z.string(),++ // Backwards compatibility.+ templateDocumentDataId: z.string().default(''),});+export type TTemplateLite = z.infer<typeof ZTemplateLiteSchema>;+/*** A version of the template response schema when returning multiple template at once from a single API endpoint.*/@@ -115,7 +130,6 @@ export const ZTemplateManySchema = TemplateSchema.pick({userId: true,teamId: true,authOptions: true,- templateDocumentDataId: true,createdAt: true,updatedAt: true,publicTitle: true,@@ -123,18 +137,23 @@ export const ZTemplateManySchema = TemplateSchema.pick({folderId: true,useLegacyFieldInsertion: true,}).extend({+ envelopeId: z.string(),team: TeamSchema.pick({id: true,url: true,}).nullable(),fields: ZFieldSchema.array(),recipients: ZRecipientLiteSchema.array(),- templateMeta: TemplateMetaSchema.pick({+ templateMeta: DocumentMetaSchema.pick({signingOrder: true,distributionMethod: true,}).nullable(),- directLink: TemplateDirectLinkSchema.pick({+ directLink: LegacyTemplateDirectLinkSchema.pick({token: true,enabled: true,}).nullable(),+ // Backwards compatibility.+ templateDocumentDataId: z.string().default(''),});++export type TTemplateMany = z.infer<typeof ZTemplateManySchema>;diff --git a/packages/lib/types/webhook-payload.ts b/packages/lib/types/webhook-payload.tsindex ffd6c9961..31343656e 100644--- a/packages/lib/types/webhook-payload.ts+++ b/packages/lib/types/webhook-payload.ts@@ -1,10 +1,11 @@-import type { Document, DocumentMeta, Recipient, WebhookTriggerEvents } from '@prisma/client';+import type { DocumentMeta, Envelope, Recipient, WebhookTriggerEvents } from '@prisma/client';import {DocumentDistributionMethod,DocumentSigningOrder,DocumentSource,DocumentStatus,DocumentVisibility,+ EnvelopeType,ReadStatus,RecipientRole,SendStatus,@@ -12,6 +13,8 @@ import {} from '@prisma/client';import { z } from 'zod';+import { mapSecondaryIdToDocumentId, mapSecondaryIdToTemplateId } from '../utils/envelope';+/*** Schema for recipient data in webhook payloads.*/@@ -42,7 +45,6 @@ export const ZWebhookDocumentMetaSchema = z.object({subject: z.string().nullable(),message: z.string().nullable(),timezone: z.string(),- password: z.string().nullable(),dateFormat: z.string(),redirectUrl: z.string().nullable(),signingOrder: z.nativeEnum(DocumentSigningOrder),@@ -67,7 +69,6 @@ export const ZWebhookDocumentSchema = z.object({visibility: z.nativeEnum(DocumentVisibility),title: z.string(),status: z.nativeEnum(DocumentStatus),- documentDataId: z.string(),createdAt: z.date(),updatedAt: z.date(),completedAt: z.date().nullable(),@@ -94,16 +95,54 @@ export type WebhookPayload = {webhookEndpoint: string;};-export const mapDocumentToWebhookDocumentPayload = (- document: Document & {+export const mapEnvelopeToWebhookDocumentPayload = (+ envelope: Envelope & {recipients: Recipient[];documentMeta: DocumentMeta | null;},): TWebhookDocument => {- const { recipients, documentMeta, ...trimmedDocument } = document;+ const { recipients: rawRecipients, documentMeta } = envelope;++ const legacyId =+ envelope.type === EnvelopeType.DOCUMENT+ ? mapSecondaryIdToDocumentId(envelope.secondaryId)+ : mapSecondaryIdToTemplateId(envelope.secondaryId);++ const mappedRecipients = rawRecipients.map((recipient) => ({+ id: recipient.id,+ documentId: envelope.type === EnvelopeType.DOCUMENT ? legacyId : null,+ templateId: envelope.type === EnvelopeType.TEMPLATE ? legacyId : null,+ email: recipient.email,+ name: recipient.name,+ token: recipient.token,+ documentDeletedAt: recipient.documentDeletedAt,+ expired: recipient.expired,+ signedAt: recipient.signedAt,+ authOptions: recipient.authOptions,+ signingOrder: recipient.signingOrder,+ rejectionReason: recipient.rejectionReason,+ role: recipient.role,+ readStatus: recipient.readStatus,+ signingStatus: recipient.signingStatus,+ sendStatus: recipient.sendStatus,+ }));return {- ...trimmedDocument,+ id: legacyId,+ externalId: envelope.externalId,+ userId: envelope.userId,+ authOptions: envelope.authOptions,+ formValues: envelope.formValues,+ visibility: envelope.visibility,+ title: envelope.title,+ status: envelope.status,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ completedAt: envelope.completedAt,+ deletedAt: envelope.deletedAt,+ teamId: envelope.teamId,+ templateId: envelope.templateId,+ source: envelope.source,documentMeta: documentMeta? {...documentMeta,@@ -112,7 +151,7 @@ export const mapDocumentToWebhookDocumentPayload = (dateFormat: 'yyyy-MM-dd hh:mm a',}: null,- Recipient: recipients,- recipients,+ Recipient: mappedRecipients,+ recipients: mappedRecipients,};};diff --git a/packages/lib/universal/field-renderer/field-generic-items.ts b/packages/lib/universal/field-renderer/field-generic-items.tsnew file mode 100644index 000000000..01e9a81fd--- /dev/null+++ b/packages/lib/universal/field-renderer/field-generic-items.ts@@ -0,0 +1,119 @@+import Konva from 'konva';++import {+ DEFAULT_RECT_BACKGROUND,+ RECIPIENT_COLOR_STYLES,+} from '@documenso/ui/lib/recipient-colors';++import type { FieldToRender, RenderFieldElementOptions } from './field-renderer';+import { calculateFieldPosition } from './field-renderer';++export const upsertFieldGroup = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+): Konva.Group => {+ const { pageWidth, pageHeight, pageLayer, editable } = options;++ const { fieldX, fieldY, fieldWidth, fieldHeight } = calculateFieldPosition(+ field,+ pageWidth,+ pageHeight,+ );++ const fieldGroup: Konva.Group =+ pageLayer.findOne(`#${field.renderId}`) ||+ new Konva.Group({+ id: field.renderId,+ name: 'field-group',+ });++ fieldGroup.setAttrs({+ scaleX: 1,+ scaleY: 1,+ x: fieldX,+ y: fieldY,+ draggable: editable,+ dragBoundFunc: (pos) => {+ const newX = Math.max(0, Math.min(pageWidth - fieldWidth, pos.x));+ const newY = Math.max(0, Math.min(pageHeight - fieldHeight, pos.y));+ return { x: newX, y: newY };+ },+ } satisfies Partial<Konva.GroupConfig>);++ return fieldGroup;+};++export const upsertFieldRect = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+): Konva.Rect => {+ const { pageWidth, pageHeight, mode, pageLayer, color } = options;++ const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);++ const fieldRect: Konva.Rect =+ pageLayer.findOne(`#${field.renderId}-rect`) ||+ new Konva.Rect({+ id: `${field.renderId}-rect`,+ name: 'field-rect',+ });++ fieldRect.setAttrs({+ width: fieldWidth,+ height: fieldHeight,+ fill: DEFAULT_RECT_BACKGROUND,+ stroke: color ? RECIPIENT_COLOR_STYLES[color].baseRing : '#e5e7eb',+ strokeWidth: 2,+ cornerRadius: 2,+ strokeScaleEnabled: false,+ visible: mode !== 'export',+ } satisfies Partial<Konva.RectConfig>);++ return fieldRect;+};++export const createSpinner = ({+ fieldWidth,+ fieldHeight,+}: {+ fieldWidth: number;+ fieldHeight: number;+}) => {+ const loadingGroup = new Konva.Group({+ name: 'loading-spinner-group',+ });++ const rect = new Konva.Rect({+ x: 4,+ y: 4,+ width: fieldWidth - 8,+ height: fieldHeight - 8,+ fill: 'white',+ opacity: 1,+ });++ const spinner = new Konva.Arc({+ x: fieldWidth / 2,+ y: fieldHeight / 2,+ innerRadius: fieldWidth / 10,+ outerRadius: fieldHeight / 10,+ angle: 270,+ rotation: 0,+ fill: 'rgba(122, 195, 85, 1)',+ lineCap: 'round',+ });++ rect.moveToTop();+ spinner.moveToTop();++ loadingGroup.add(rect);+ loadingGroup.add(spinner);++ const anim = new Konva.Animation((frame) => {+ spinner.rotate(180 * (frame.timeDiff / 500));+ });++ anim.start();++ return loadingGroup;+};diff --git a/packages/lib/universal/field-renderer/field-renderer.ts b/packages/lib/universal/field-renderer/field-renderer.tsnew file mode 100644index 000000000..e5f236c5a--- /dev/null+++ b/packages/lib/universal/field-renderer/field-renderer.ts@@ -0,0 +1,158 @@+import type { Signature } from '@prisma/client';+import { type Field } from '@prisma/client';+import type Konva from 'konva';++import type { TRecipientColor } from '@documenso/ui/lib/recipient-colors';++import type { TFieldMetaSchema } from '../../types/field-meta';++export const MIN_FIELD_HEIGHT_PX = 12;+export const MIN_FIELD_WIDTH_PX = 36;++export type FieldToRender = Pick<+ Field,+ 'envelopeItemId' | 'recipientId' | 'type' | 'page' | 'customText' | 'inserted' | 'recipientId'+> & {+ renderId: string; // A unique ID for the field in the render.+ width: number;+ height: number;+ positionX: number;+ positionY: number;+ fieldMeta?: TFieldMetaSchema | null;+ signature?: Signature | null;+};++export type RenderFieldElementOptions = {+ pageLayer: Konva.Layer;+ pageWidth: number;+ pageHeight: number;+ mode?: 'edit' | 'sign' | 'export';+ editable?: boolean;+ color?: TRecipientColor;+};++/**+ * Converts a fields percentage based values to pixel based values.+ */+export const calculateFieldPosition = (+ field: Pick<FieldToRender, 'width' | 'height' | 'positionX' | 'positionY'>,+ pageWidth: number,+ pageHeight: number,+) => {+ const fieldWidth = pageWidth * (Number(field.width) / 100);+ const fieldHeight = pageHeight * (Number(field.height) / 100);++ const fieldX = pageWidth * (Number(field.positionX) / 100);+ const fieldY = pageHeight * (Number(field.positionY) / 100);++ return { fieldX, fieldY, fieldWidth, fieldHeight };+};++type ConvertPixelToPercentageOptions = {+ positionX: number;+ positionY: number;+ width: number;+ height: number;+ pageWidth: number;+ pageHeight: number;+};++export const convertPixelToPercentage = (options: ConvertPixelToPercentageOptions) => {+ const { positionX, positionY, width, height, pageWidth, pageHeight } = options;++ const fieldX = (positionX / pageWidth) * 100;+ const fieldY = (positionY / pageHeight) * 100;++ const fieldWidth = (width / pageWidth) * 100;+ const fieldHeight = (height / pageHeight) * 100;++ return { fieldX, fieldY, fieldWidth, fieldHeight };+};++type CalculateMultiItemPositionOptions = {+ /**+ * The field width in pixels.+ */+ fieldWidth: number;++ /**+ * The field height in pixels.+ */+ fieldHeight: number;++ /**+ * Total amount of items that will be rendered.+ */+ itemCount: number;++ /**+ * The position of the item in the list.+ *+ * Starts from 0+ */+ itemIndex: number;++ /**+ * The size of the item input, example checkbox box, radio button, etc.+ */+ itemSize: number;++ /**+ * The spacing between the item and text.+ */+ spacingBetweenItemAndText: number;++ /**+ * The inner padding of the field.+ */+ fieldPadding: number;++ type: 'checkbox' | 'radio';+};++/**+ * Calculate the position of a field item such as Checkbox, Radio.+ */+export const calculateMultiItemPosition = (options: CalculateMultiItemPositionOptions) => {+ const {+ fieldWidth,+ fieldHeight,+ itemCount,+ itemIndex,+ itemSize,+ spacingBetweenItemAndText,+ fieldPadding,+ type,+ } = options;++ const innerFieldHeight = fieldHeight - fieldPadding * 2;+ const innerFieldWidth = fieldWidth - fieldPadding; // This is purposefully not using fullPadding to allow flush text.+ const innerFieldX = fieldPadding;+ const innerFieldY = fieldPadding;++ const itemHeight = innerFieldHeight / itemCount;++ const y = itemIndex * itemHeight + innerFieldY;++ let itemInputY = y + itemHeight / 2 - itemSize / 2;+ let itemInputX = innerFieldX;++ if (type === 'radio') {+ itemInputX = innerFieldX + itemSize / 2;+ itemInputY = y + itemHeight / 2;+ }++ const textX = innerFieldX + itemSize + spacingBetweenItemAndText;+ const textY = y;+ const textWidth = innerFieldWidth - itemSize - spacingBetweenItemAndText;+ const textHeight = itemHeight;++ return {+ itemInputX,+ itemInputY,+ textX,+ textY,+ textWidth,+ textHeight,+ };+};diff --git a/packages/lib/universal/field-renderer/render-checkbox-field.ts b/packages/lib/universal/field-renderer/render-checkbox-field.tsnew file mode 100644index 000000000..5c428ed0b--- /dev/null+++ b/packages/lib/universal/field-renderer/render-checkbox-field.ts@@ -0,0 +1,187 @@+import Konva from 'konva';++import { DEFAULT_STANDARD_FONT_SIZE } from '../../constants/pdf';+import type { TCheckboxFieldMeta } from '../../types/field-meta';+import { upsertFieldGroup, upsertFieldRect } from './field-generic-items';+import { calculateFieldPosition, calculateMultiItemPosition } from './field-renderer';+import type { FieldToRender, RenderFieldElementOptions } from './field-renderer';++// Do not change any of these values without consulting with the team.+const checkboxFieldPadding = 8;+const checkboxSize = 16;+const spacingBetweenCheckboxAndText = 8;++export const renderCheckboxFieldElement = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+) => {+ const { pageWidth, pageHeight, pageLayer, mode } = options;++ const isFirstRender = !pageLayer.findOne(`#${field.renderId}`);++ const fieldGroup = upsertFieldGroup(field, options);++ // Clear previous children to re-render fresh+ fieldGroup.removeChildren();++ fieldGroup.add(upsertFieldRect(field, options));++ if (isFirstRender) {+ pageLayer.add(fieldGroup);++ // Handle rescaling items during transforms.+ fieldGroup.on('transform', () => {+ const groupScaleX = fieldGroup.scaleX();+ const groupScaleY = fieldGroup.scaleY();++ const fieldRect = fieldGroup.findOne('.field-rect');++ if (!fieldRect) {+ return;+ }++ const rectWidth = fieldRect.width() * groupScaleX;+ const rectHeight = fieldRect.height() * groupScaleY;++ // Todo: Envelopes - check sorting more than 10+ // arr.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));++ const squares = fieldGroup+ .find('.checkbox-square')+ .sort((a, b) => a.id().localeCompare(b.id()));+ const checkmarks = fieldGroup+ .find('.checkbox-checkmark')+ .sort((a, b) => a.id().localeCompare(b.id()));+ const text = fieldGroup.find('.checkbox-text').sort((a, b) => a.id().localeCompare(b.id()));++ const groupedItems = squares.map((square, i) => ({+ squareElement: square,+ checkmarkElement: checkmarks[i],+ textElement: text[i],+ }));++ groupedItems.forEach((item, i) => {+ const { squareElement, checkmarkElement, textElement } = item;++ const { itemInputX, itemInputY, textX, textY, textWidth, textHeight } =+ calculateMultiItemPosition({+ fieldWidth: rectWidth,+ fieldHeight: rectHeight,+ itemCount: checkboxValues.length,+ itemIndex: i,+ itemSize: checkboxSize,+ spacingBetweenItemAndText: spacingBetweenCheckboxAndText,+ fieldPadding: checkboxFieldPadding,+ type: 'checkbox',+ });++ squareElement.setAttrs({+ x: itemInputX,+ y: itemInputY,+ scaleX: 1,+ scaleY: 1,+ });++ checkmarkElement.setAttrs({+ x: itemInputX,+ y: itemInputY,+ scaleX: 1,+ scaleY: 1,+ });++ textElement.setAttrs({+ x: textX,+ y: textY,+ scaleX: 1,+ scaleY: 1,+ width: textWidth,+ height: textHeight,+ });+ });++ fieldRect.setAttrs({+ width: rectWidth,+ height: rectHeight,+ });++ fieldGroup.scale({+ x: 1,+ y: 1,+ });++ pageLayer.batchDraw();+ });+ }++ const checkboxMeta: TCheckboxFieldMeta | null = (field.fieldMeta as TCheckboxFieldMeta) || null;+ const checkboxValues = checkboxMeta?.values || [];++ const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);++ checkboxValues.forEach(({ id, value, checked }, index) => {+ const { itemInputX, itemInputY, textX, textY, textWidth, textHeight } =+ calculateMultiItemPosition({+ fieldWidth,+ fieldHeight,+ itemCount: checkboxValues.length,+ itemIndex: index,+ itemSize: checkboxSize,+ spacingBetweenItemAndText: spacingBetweenCheckboxAndText,+ fieldPadding: checkboxFieldPadding,+ type: 'checkbox',+ });++ const square = new Konva.Rect({+ internalCheckboxId: id,+ internalCheckboxValue: value,+ id: `checkbox-square-${index}`,+ name: 'checkbox-square',+ x: itemInputX,+ y: itemInputY,+ width: checkboxSize,+ height: checkboxSize,+ stroke: '#374151',+ strokeWidth: 2,+ cornerRadius: 2,+ fill: 'white',+ });++ const checkmark = new Konva.Line({+ internalCheckboxId: id,+ internalCheckboxValue: value,+ id: `checkbox-checkmark-${index}`,+ name: 'checkbox-checkmark',+ x: itemInputX,+ y: itemInputY,+ strokeWidth: 2,+ stroke: '#111827',+ points: [3, 8, 7, 12, 13, 4],+ visible: checked,+ });++ const text = new Konva.Text({+ internalCheckboxId: id,+ internalCheckboxValue: value,+ id: `checkbox-text-${index}`,+ name: 'checkbox-text',+ x: textX,+ y: textY,+ text: value,+ width: textWidth,+ height: textHeight,+ fontSize: DEFAULT_STANDARD_FONT_SIZE,+ fontFamily: 'Inter, system-ui, sans-serif',+ verticalAlign: 'middle',+ fill: '#111827', // Todo: Envelopes - Sort colours+ });++ fieldGroup.add(square);+ fieldGroup.add(checkmark);+ fieldGroup.add(text);+ });++ return {+ fieldGroup,+ isFirstRender,+ };+};diff --git a/packages/lib/universal/field-renderer/render-dropdown-field.ts b/packages/lib/universal/field-renderer/render-dropdown-field.tsnew file mode 100644index 000000000..8225e308a--- /dev/null+++ b/packages/lib/universal/field-renderer/render-dropdown-field.ts@@ -0,0 +1,179 @@+import Konva from 'konva';++import { DEFAULT_STANDARD_FONT_SIZE } from '../../constants/pdf';+import type { TDropdownFieldMeta } from '../../types/field-meta';+import { upsertFieldGroup, upsertFieldRect } from './field-generic-items';+import { calculateFieldPosition } from './field-renderer';+import type { FieldToRender, RenderFieldElementOptions } from './field-renderer';++type CalculateDropdownPositionOptions = {+ fieldWidth: number;+ fieldHeight: number;+};++/**+ * Calculate the position of a field item such as Checkbox, Radio.+ */+const calculateDropdownPosition = (options: CalculateDropdownPositionOptions) => {+ const { fieldWidth, fieldHeight } = options;++ const fieldPadding = 8;+ const arrowSize = 12;++ const textHeight = fieldHeight - fieldPadding * 2;+ const textWidth = fieldWidth - fieldPadding * 2;+ const textX = fieldPadding;+ const textY = fieldPadding;++ const arrowX = fieldWidth - arrowSize - fieldPadding;+ const arrowY = fieldHeight / 2;++ return {+ arrowX,+ arrowY,+ arrowSize,+ textX,+ textY,+ textWidth,+ textHeight,+ };+};++export const renderDropdownFieldElement = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+) => {+ const { pageWidth, pageHeight, pageLayer, mode } = options;++ const isFirstRender = !pageLayer.findOne(`#${field.renderId}`);++ const fieldGroup = upsertFieldGroup(field, options);++ // Clear previous children to re-render fresh.+ fieldGroup.removeChildren();++ fieldGroup.add(upsertFieldRect(field, options));++ if (isFirstRender) {+ pageLayer.add(fieldGroup);++ fieldGroup.on('transform', () => {+ const groupScaleX = fieldGroup.scaleX();+ const groupScaleY = fieldGroup.scaleY();++ const fieldRect = fieldGroup.findOne('.field-rect');+ const text = fieldGroup.findOne('.dropdown-selected-text');+ const arrow = fieldGroup.findOne('.dropdown-arrow');++ if (!fieldRect || !text || !arrow) {+ console.log('fieldRect or text or arrow not found');+ return;+ }++ const rectWidth = fieldRect.width() * groupScaleX;+ const rectHeight = fieldRect.height() * groupScaleY;++ const { arrowX, arrowY, textX, textY, textWidth, textHeight } = calculateDropdownPosition({+ fieldWidth: rectWidth,+ fieldHeight: rectHeight,+ });++ arrow.setAttrs({+ x: arrowX,+ y: arrowY,+ scaleX: 1,+ scaleY: 1,+ });++ text.setAttrs({+ scaleX: 1,+ scaleY: 1,+ x: textX,+ y: textY,+ width: textWidth,+ height: textHeight,+ });++ fieldRect.setAttrs({+ width: rectWidth,+ height: rectHeight,+ });++ fieldGroup.scale({+ x: 1,+ y: 1,+ });++ pageLayer.batchDraw();+ });+ }++ const dropdownMeta: TDropdownFieldMeta | null = (field.fieldMeta as TDropdownFieldMeta) || null;+ const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);++ // Todo: Envelopes - Translations+ let selectedValue = 'Select Option';++ if (field.inserted) {+ selectedValue = field.customText;+ }++ const { arrowX, arrowY, arrowSize, textX, textY, textWidth, textHeight } =+ calculateDropdownPosition({+ fieldWidth,+ fieldHeight,+ });++ // Selected value text+ const selectedText = new Konva.Text({+ name: 'dropdown-selected-text',+ x: textX,+ y: textY,+ width: textWidth,+ height: textHeight,+ text: selectedValue,+ fontSize: DEFAULT_STANDARD_FONT_SIZE,+ fontFamily: 'Inter, system-ui, sans-serif',+ fill: '#111827',+ verticalAlign: 'middle',+ });++ const arrow = new Konva.Line({+ name: 'dropdown-arrow',+ x: arrowX,+ y: arrowY,+ points: [0, 0, arrowSize / 2, arrowSize / 2, arrowSize, 0],+ stroke: '#6B7280',+ strokeWidth: 2,+ lineCap: 'round',+ lineJoin: 'round',+ closed: false,+ visible: mode !== 'export',+ });++ // Add hover state for dropdown+ fieldGroup.on('mouseenter', () => {+ // dropdownContainer.stroke('#2563EB');+ // dropdownContainer.strokeWidth(2);+ document.body.style.cursor = 'pointer';+ pageLayer.batchDraw();+ });++ fieldGroup.on('mouseleave', () => {+ // dropdownContainer.stroke('#374151');+ // dropdownContainer.strokeWidth(2);+ document.body.style.cursor = 'default';+ pageLayer.batchDraw();+ });++ fieldGroup.add(selectedText);++ if (!field.inserted || mode === 'export') {+ fieldGroup.add(arrow);+ }++ return {+ fieldGroup,+ isFirstRender,+ };+};diff --git a/packages/lib/universal/field-renderer/render-field.ts b/packages/lib/universal/field-renderer/render-field.tsnew file mode 100644index 000000000..c0d4df8b5--- /dev/null+++ b/packages/lib/universal/field-renderer/render-field.ts@@ -0,0 +1,78 @@+import type { Signature } from '@prisma/client';+import { type Field, FieldType } from '@prisma/client';+import type Konva from 'konva';+import { match } from 'ts-pattern';++import type { TRecipientColor } from '@documenso/ui/lib/recipient-colors';++import type { TFieldMetaSchema } from '../../types/field-meta';+import { renderCheckboxFieldElement } from './render-checkbox-field';+import { renderDropdownFieldElement } from './render-dropdown-field';+import { renderRadioFieldElement } from './render-radio-field';+import { renderSignatureFieldElement } from './render-signature-field';+import { renderTextFieldElement } from './render-text-field';++export const MIN_FIELD_HEIGHT_PX = 12;+export const MIN_FIELD_WIDTH_PX = 36;++export type FieldToRender = Pick<+ Field,+ 'envelopeItemId' | 'recipientId' | 'type' | 'page' | 'customText' | 'inserted' | 'recipientId'+> & {+ renderId: string; // A unique ID for the field in the render.+ width: number;+ height: number;+ positionX: number;+ positionY: number;+ fieldMeta?: TFieldMetaSchema | null;+ signature?: Signature | null;+};++type RenderFieldOptions = {+ field: FieldToRender;+ pageLayer: Konva.Layer;+ pageWidth: number;+ pageHeight: number;++ color?: TRecipientColor;++ /**+ * The render type.+ *+ * @default 'edit'+ *+ * - `edit` - The field is rendered in edit mode.+ * - `sign` - The field is rendered in sign mode. No interactive elements.+ * - `export` - The field is rendered in export mode. No backgrounds, interactive elements, etc.+ */+ mode: 'edit' | 'sign' | 'export';++ editable?: boolean;+};++export const renderField = ({+ field,+ pageLayer,+ pageWidth,+ pageHeight,+ mode,+ editable,+ color,+}: RenderFieldOptions) => {+ const options = {+ pageLayer,+ pageWidth,+ pageHeight,+ mode,+ color,+ editable,+ };++ return match(field.type)+ .with(FieldType.TEXT, () => renderTextFieldElement(field, options))+ .with(FieldType.CHECKBOX, () => renderCheckboxFieldElement(field, options))+ .with(FieldType.RADIO, () => renderRadioFieldElement(field, options))+ .with(FieldType.DROPDOWN, () => renderDropdownFieldElement(field, options))+ .with(FieldType.SIGNATURE, () => renderSignatureFieldElement(field, options))+ .otherwise(() => renderTextFieldElement(field, options)); // Todo+};diff --git a/packages/lib/universal/field-renderer/render-grid-lines.ts b/packages/lib/universal/field-renderer/render-grid-lines.tsnew file mode 100644index 000000000..d71948ffe--- /dev/null+++ b/packages/lib/universal/field-renderer/render-grid-lines.ts@@ -0,0 +1,326 @@+import Konva from 'konva';++const SNAP_THRESHOLD = 10;++type SnapPoint = {+ position: number;+ type: 'edge' | 'center';+ direction: 'horizontal' | 'vertical';+};++type SnapResult = {+ x: number;+ y: number;+ horizontalGuide?: number;+ verticalGuide?: number;+};++type ResizeSnapResult = {+ x: number;+ y: number;+ width: number;+ height: number;+ horizontalGuides: number[];+ verticalGuides: number[];+};++export function initializeSnapGuides(stage: Konva.Stage): Konva.Layer {+ // Remove any existing snap guide layers from this stage+ const existingSnapLayers = stage.find('.snap-guide-layer');+ existingSnapLayers.forEach((layer) => layer.destroy());++ const snapGuideLayer = new Konva.Layer({+ name: 'snap-guide-layer',+ });+ stage.add(snapGuideLayer);+ return snapGuideLayer;+}++export function calculateSnapPositions(+ stage: Konva.Stage,+ excludeId?: string,+): { horizontal: SnapPoint[]; vertical: SnapPoint[] } {+ const fieldGroups = stage+ .find('.field-group')+ .filter((node): node is Konva.Group => node instanceof Konva.Group);+ const horizontal: SnapPoint[] = [];+ const vertical: SnapPoint[] = [];++ fieldGroups.forEach((group) => {+ if (excludeId && group.id() === excludeId) {+ return;+ }++ const rect = group.getClientRect();++ // Vertical snap points (for horizontal alignment)+ horizontal.push(+ { position: rect.y, type: 'edge', direction: 'horizontal' },+ { position: rect.y + rect.height / 2, type: 'center', direction: 'horizontal' },+ { position: rect.y + rect.height, type: 'edge', direction: 'horizontal' },+ );++ // Horizontal snap points (for vertical alignment)+ vertical.push(+ { position: rect.x, type: 'edge', direction: 'vertical' },+ { position: rect.x + rect.width / 2, type: 'center', direction: 'vertical' },+ { position: rect.x + rect.width, type: 'edge', direction: 'vertical' },+ );+ });++ return { horizontal, vertical };+}++export function calculateSnapSizes(+ stage: Konva.Stage,+ excludeId?: string,+): { widths: number[]; heights: number[] } {+ const fieldGroups = stage+ .find('.field-group')+ .filter((node): node is Konva.Group => node instanceof Konva.Group);+ const widths: number[] = [];+ const heights: number[] = [];++ fieldGroups.forEach((group) => {+ if (excludeId && group.id() === excludeId) {+ return;+ }++ const rect = group.getClientRect();+ widths.push(rect.width);+ heights.push(rect.height);+ });++ return { widths, heights };+}++export function getSnappedPosition(+ stage: Konva.Stage,+ movingGroup: Konva.Group,+ newX: number,+ newY: number,+): SnapResult {+ const { horizontal, vertical } = calculateSnapPositions(stage, movingGroup.id());+ const rect = movingGroup.getClientRect();++ let snappedX = newX;+ let snappedY = newY;+ let horizontalGuide: number | undefined;+ let verticalGuide: number | undefined;++ // Calculate the moving field's snap points+ const movingTop = newY;+ const movingBottom = newY + rect.height;+ const movingCenterY = newY + rect.height / 2;+ const movingLeft = newX;+ const movingRight = newX + rect.width;+ const movingCenterX = newX + rect.width / 2;++ // Check horizontal snapping (Y position)+ for (const snapPoint of horizontal) {+ const distanceTop = Math.abs(movingTop - snapPoint.position);+ const distanceBottom = Math.abs(movingBottom - snapPoint.position);+ const distanceCenter = Math.abs(movingCenterY - snapPoint.position);++ if (distanceTop <= SNAP_THRESHOLD) {+ snappedY = snapPoint.position;+ horizontalGuide = snapPoint.position;+ break;+ } else if (distanceBottom <= SNAP_THRESHOLD) {+ snappedY = snapPoint.position - rect.height;+ horizontalGuide = snapPoint.position;+ break;+ } else if (distanceCenter <= SNAP_THRESHOLD) {+ snappedY = snapPoint.position - rect.height / 2;+ horizontalGuide = snapPoint.position;+ break;+ }+ }++ // Check vertical snapping (X position)+ for (const snapPoint of vertical) {+ const distanceLeft = Math.abs(movingLeft - snapPoint.position);+ const distanceRight = Math.abs(movingRight - snapPoint.position);+ const distanceCenter = Math.abs(movingCenterX - snapPoint.position);++ if (distanceLeft <= SNAP_THRESHOLD) {+ snappedX = snapPoint.position;+ verticalGuide = snapPoint.position;+ break;+ } else if (distanceRight <= SNAP_THRESHOLD) {+ snappedX = snapPoint.position - rect.width;+ verticalGuide = snapPoint.position;+ break;+ } else if (distanceCenter <= SNAP_THRESHOLD) {+ snappedX = snapPoint.position - rect.width / 2;+ verticalGuide = snapPoint.position;+ break;+ }+ }++ return {+ x: snappedX,+ y: snappedY,+ horizontalGuide,+ verticalGuide,+ };+}++export function getSnappedResize(+ stage: Konva.Stage,+ resizingGroup: Konva.Group,+ newX: number,+ newY: number,+ newWidth: number,+ newHeight: number,+): ResizeSnapResult {+ const { horizontal, vertical } = calculateSnapPositions(stage, resizingGroup.id());+ const { widths, heights } = calculateSnapSizes(stage, resizingGroup.id());++ const snappedX = newX;+ const snappedY = newY;+ let snappedWidth = newWidth;+ let snappedHeight = newHeight;+ const horizontalGuides: number[] = [];+ const verticalGuides: number[] = [];++ // Snap width to other field widths+ for (const width of widths) {+ if (Math.abs(newWidth - width) <= SNAP_THRESHOLD) {+ snappedWidth = width;+ break;+ }+ }++ // Snap height to other field heights+ for (const height of heights) {+ if (Math.abs(newHeight - height) <= SNAP_THRESHOLD) {+ snappedHeight = height;+ break;+ }+ }++ // Calculate field edges with new snapped dimensions+ const movingTop = snappedY;+ const movingBottom = snappedY + snappedHeight;+ const movingLeft = snappedX;+ const movingRight = snappedX + snappedWidth;++ // Snap edges to alignment guides+ for (const snapPoint of horizontal) {+ if (Math.abs(movingTop - snapPoint.position) <= SNAP_THRESHOLD) {+ horizontalGuides.push(snapPoint.position);+ } else if (Math.abs(movingBottom - snapPoint.position) <= SNAP_THRESHOLD) {+ horizontalGuides.push(snapPoint.position);+ }+ }++ for (const snapPoint of vertical) {+ if (Math.abs(movingLeft - snapPoint.position) <= SNAP_THRESHOLD) {+ verticalGuides.push(snapPoint.position);+ } else if (Math.abs(movingRight - snapPoint.position) <= SNAP_THRESHOLD) {+ verticalGuides.push(snapPoint.position);+ }+ }++ return {+ x: snappedX,+ y: snappedY,+ width: snappedWidth,+ height: snappedHeight,+ horizontalGuides,+ verticalGuides,+ };+}++export function showSnapGuides(+ snapGuideLayer: Konva.Layer,+ horizontalGuide?: number,+ verticalGuide?: number,+ stageWidth?: number,+ stageHeight?: number,+): void {+ if (!snapGuideLayer) {+ return;+ }++ hideSnapGuides(snapGuideLayer);++ if (horizontalGuide !== undefined && stageWidth) {+ const horizontalLine = new Konva.Line({+ name: 'snap-guide-horizontal',+ points: [0, horizontalGuide, stageWidth, horizontalGuide],+ stroke: 'rgb(0, 161, 255)',+ strokeWidth: 1,+ dash: [5, 5],+ listening: false,+ });+ snapGuideLayer.add(horizontalLine);+ }++ if (verticalGuide !== undefined && stageHeight) {+ const verticalLine = new Konva.Line({+ name: 'snap-guide-vertical',+ points: [verticalGuide, 0, verticalGuide, stageHeight],+ stroke: 'rgb(0, 161, 255)',+ strokeWidth: 1,+ dash: [5, 5],+ listening: false,+ });+ snapGuideLayer.add(verticalLine);+ }++ snapGuideLayer.batchDraw();+}++export function showMultipleSnapGuides(+ snapGuideLayer: Konva.Layer,+ horizontalGuides: number[],+ verticalGuides: number[],+ stageWidth: number,+ stageHeight: number,+): void {+ if (!snapGuideLayer) {+ return;+ }++ hideSnapGuides(snapGuideLayer);++ // Show horizontal guides+ horizontalGuides.forEach((guide) => {+ const horizontalLine = new Konva.Line({+ name: 'snap-guide-horizontal',+ points: [0, guide, stageWidth, guide],+ stroke: 'rgb(0, 161, 255)',+ strokeWidth: 1,+ dash: [5, 5],+ listening: false,+ });+ snapGuideLayer.add(horizontalLine);+ });++ // Show vertical guides+ verticalGuides.forEach((guide) => {+ const verticalLine = new Konva.Line({+ name: 'snap-guide-vertical',+ points: [guide, 0, guide, stageHeight],+ stroke: 'rgb(0, 161, 255)',+ strokeWidth: 1,+ dash: [5, 5],+ listening: false,+ });+ snapGuideLayer.add(verticalLine);+ });++ snapGuideLayer.batchDraw();+}++export function hideSnapGuides(snapGuideLayer: Konva.Layer): void {+ if (!snapGuideLayer) {+ return;+ }++ const guides = snapGuideLayer.find('.snap-guide-horizontal, .snap-guide-vertical');+ guides.forEach((guide: Konva.Node) => guide.destroy());+ snapGuideLayer.batchDraw();+}diff --git a/packages/lib/universal/field-renderer/render-radio-field.ts b/packages/lib/universal/field-renderer/render-radio-field.tsnew file mode 100644index 000000000..c845682b2--- /dev/null+++ b/packages/lib/universal/field-renderer/render-radio-field.ts@@ -0,0 +1,176 @@+import Konva from 'konva';++import { DEFAULT_STANDARD_FONT_SIZE } from '../../constants/pdf';+import type { TRadioFieldMeta } from '../../types/field-meta';+import { upsertFieldGroup, upsertFieldRect } from './field-generic-items';+import { calculateFieldPosition, calculateMultiItemPosition } from './field-renderer';+import type { FieldToRender, RenderFieldElementOptions } from './field-renderer';++// Do not change any of these values without consulting with the team.+const radioFieldPadding = 8;+const radioSize = 16;+const spacingBetweenRadioAndText = 8;++export const renderRadioFieldElement = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+) => {+ const { pageWidth, pageHeight, pageLayer, mode } = options;++ const isFirstRender = !pageLayer.findOne(`#${field.renderId}`);++ const fieldGroup = upsertFieldGroup(field, options);++ // Clear previous children to re-render fresh+ fieldGroup.removeChildren();++ fieldGroup.add(upsertFieldRect(field, options));++ if (isFirstRender) {+ pageLayer.add(fieldGroup);++ // Handle rescaling items during transforms.+ fieldGroup.on('transform', () => {+ const groupScaleX = fieldGroup.scaleX();+ const groupScaleY = fieldGroup.scaleY();++ const fieldRect = fieldGroup.findOne('.field-rect');++ if (!fieldRect) {+ return;+ }++ const rectWidth = fieldRect.width() * groupScaleX;+ const rectHeight = fieldRect.height() * groupScaleY;++ const circles = fieldGroup.find('.radio-circle').sort((a, b) => a.id().localeCompare(b.id()));+ const checkmarks = fieldGroup.find('.radio-dot').sort((a, b) => a.id().localeCompare(b.id()));+ const text = fieldGroup.find('.radio-text').sort((a, b) => a.id().localeCompare(b.id()));++ const groupedItems = circles.map((circle, i) => ({+ circleElement: circle,+ checkmarkElement: checkmarks[i],+ textElement: text[i],+ }));++ groupedItems.forEach((item, i) => {+ const { circleElement, checkmarkElement, textElement } = item;++ const { itemInputX, itemInputY, textX, textY, textWidth, textHeight } =+ calculateMultiItemPosition({+ fieldWidth: rectWidth,+ fieldHeight: rectHeight,+ itemCount: radioValues.length,+ itemIndex: i,+ itemSize: radioSize,+ spacingBetweenItemAndText: spacingBetweenRadioAndText,+ fieldPadding: radioFieldPadding,+ type: 'radio',+ });++ circleElement.setAttrs({+ x: itemInputX,+ y: itemInputY,+ scaleX: 1,+ scaleY: 1,+ });++ checkmarkElement.setAttrs({+ x: itemInputX,+ y: itemInputY,+ scaleX: 1,+ scaleY: 1,+ });++ textElement.setAttrs({+ x: textX,+ y: textY,+ scaleX: 1,+ scaleY: 1,+ width: textWidth,+ height: textHeight,+ });+ });++ fieldRect.width(rectWidth);+ fieldRect.height(rectHeight);++ fieldGroup.scale({+ x: 1,+ y: 1,+ });++ pageLayer.batchDraw();+ });+ }++ const radioMeta: TRadioFieldMeta | null = (field.fieldMeta as TRadioFieldMeta) || null;+ const radioValues = radioMeta?.values || [];++ const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);++ radioValues.forEach(({ value, checked }, index) => {+ const { itemInputX, itemInputY, textX, textY, textWidth, textHeight } =+ calculateMultiItemPosition({+ fieldWidth,+ fieldHeight,+ itemCount: radioValues.length,+ itemIndex: index,+ itemSize: radioSize,+ spacingBetweenItemAndText: spacingBetweenRadioAndText,+ fieldPadding: radioFieldPadding,+ type: 'radio',+ });++ // Circle which represents the radio button.+ const circle = new Konva.Circle({+ internalRadioValue: value,+ id: `radio-circle-${index}`,+ name: 'radio-circle',+ x: itemInputX,+ y: itemInputY,+ radius: radioSize / 2,+ stroke: '#374151',+ strokeWidth: 2,+ fill: 'white',+ });++ // Dot which represents the selected state.+ const dot = new Konva.Circle({+ internalRadioValue: value,+ id: `radio-dot-${index}`,+ name: 'radio-dot',+ x: itemInputX,+ y: itemInputY,+ radius: radioSize / 4,+ fill: '#111827',+ // Todo: Envelopes+ visible: value === field.customText,+ // visible: checked,+ });++ const text = new Konva.Text({+ internalRadioValue: value,+ id: `radio-text-${index}`,+ name: 'radio-text',+ x: textX,+ y: textY,+ text: value,+ width: textWidth,+ height: textHeight,+ fontSize: DEFAULT_STANDARD_FONT_SIZE,+ fontFamily: 'Inter, system-ui, sans-serif',+ verticalAlign: 'middle',+ fill: '#111827', // Todo: Envelopes - Sort colours+ });++ fieldGroup.add(circle);+ fieldGroup.add(dot);+ fieldGroup.add(text);+ });++ return {+ fieldGroup,+ isFirstRender,+ };+};diff --git a/packages/lib/universal/field-renderer/render-signature-field.ts b/packages/lib/universal/field-renderer/render-signature-field.tsnew file mode 100644index 000000000..9939498b0--- /dev/null+++ b/packages/lib/universal/field-renderer/render-signature-field.ts@@ -0,0 +1,209 @@+import Konva from 'konva';++import {+ DEFAULT_RECT_BACKGROUND,+ RECIPIENT_COLOR_STYLES,+} from '@documenso/ui/lib/recipient-colors';++import {+ DEFAULT_HANDWRITING_FONT_SIZE,+ DEFAULT_STANDARD_FONT_SIZE,+ MIN_HANDWRITING_FONT_SIZE,+} from '../../constants/pdf';+import { AppError } from '../../errors/app-error';+import { upsertFieldGroup, upsertFieldRect } from './field-generic-items';+import { calculateFieldPosition } from './field-renderer';+import type { FieldToRender, RenderFieldElementOptions } from './field-renderer';++const minFontSize = MIN_HANDWRITING_FONT_SIZE;+const maxFontSize = DEFAULT_HANDWRITING_FONT_SIZE;++const upsertFieldText = (field: FieldToRender, options: RenderFieldElementOptions): Konva.Text => {+ const { pageWidth, pageHeight, mode = 'edit', pageLayer } = options;++ console.log({+ pageWidth,+ pageHeight,+ });++ const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);++ const fieldText: Konva.Text =+ pageLayer.findOne(`#${field.renderId}-text`) ||+ new Konva.Text({+ id: `${field.renderId}-text`,+ name: 'field-text',+ });++ // Calculate text positioning based on alignment+ const textX = 0;+ const textY = 0;+ const textAlign = 'center';+ let textVerticalAlign: 'top' | 'middle' | 'bottom' = 'top';+ let textFontSize = DEFAULT_STANDARD_FONT_SIZE;+ const textPadding = 10;++ let textToRender: string = field.type;++ const signature = field.signature;++ // Handle edit mode.+ if (mode === 'edit') {+ textToRender = field.type; // Todo: Envelope - Need translations+ }++ // Handle sign mode.+ if (mode === 'sign' || mode === 'export') {+ textToRender = field.type; // Todo: Envelope - Need translations+ textFontSize = DEFAULT_STANDARD_FONT_SIZE;+ textVerticalAlign = 'middle';++ if (field.inserted && !signature) {+ throw new AppError('MISSING_SIGNATURE');+ }++ if (signature?.typedSignature) {+ textToRender = signature.typedSignature;+ }+ }++ fieldText.setAttrs({+ x: textX,+ y: textY,+ verticalAlign: textVerticalAlign,+ wrap: 'word',+ padding: textPadding,++ text: textToRender,++ fontSize: textFontSize,+ fontFamily: 'Caveat, Inter', // Todo: Envelopes - Fix all fonts for sans+ align: textAlign,+ width: fieldWidth,+ height: fieldHeight,+ } satisfies Partial<Konva.TextConfig>);++ return fieldText;+};++export const renderSignatureFieldElement = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+) => {+ const { mode = 'edit', pageLayer } = options;++ const isFirstRender = !pageLayer.findOne(`#${field.renderId}`);++ const fieldGroup = upsertFieldGroup(field, options);++ // ABOVE IS GENERIC, EXTRACT IT.++ // Render the field background and text.+ const fieldRect = upsertFieldRect(field, options);+ const fieldText = upsertFieldText(field, options);++ // Assign elements to group and any listeners that should only be run on initialization.+ if (isFirstRender) {+ fieldGroup.add(fieldRect);+ fieldGroup.add(fieldText);+ pageLayer.add(fieldGroup);++ // This is to keep the text inside the field at the same size+ // when the field is resized. Without this the text would be stretched.+ fieldGroup.on('transform', () => {+ const groupScaleX = fieldGroup.scaleX();+ const groupScaleY = fieldGroup.scaleY();++ // Adjust text scale so it doesn't change while group is resized.+ fieldText.scaleX(1 / groupScaleX);+ fieldText.scaleY(1 / groupScaleY);++ const rectWidth = fieldRect.width() * groupScaleX;+ const rectHeight = fieldRect.height() * groupScaleY;++ // // Update text group position and clipping+ // fieldGroup.clipFunc(function (ctx) {+ // ctx.rect(0, 0, rectWidth, rectHeight);+ // });++ // Update text dimensions+ fieldText.width(rectWidth); // Account for padding+ fieldText.height(rectHeight);++ console.log({+ rectWidth,+ });++ // Force Konva to recalculate text layout+ // textInsideField.getTextHeight(); // This forces recalculation+ fieldText.height(); // This forces recalculation++ // fieldGroup.draw();+ fieldGroup.getLayer()?.batchDraw();+ });++ // Reset the text after transform has ended.+ fieldGroup.on('transformend', () => {+ fieldText.scaleX(1);+ fieldText.scaleY(1);++ const rectWidth = fieldRect.width();+ const rectHeight = fieldRect.height();++ // // Update text group position and clipping+ // fieldGroup.clipFunc(function (ctx) {+ // ctx.rect(0, 0, rectWidth, rectHeight);+ // });++ // Update text dimensions+ fieldText.width(rectWidth); // Account for padding+ fieldText.height(rectHeight);++ // Force Konva to recalculate text layout+ // textInsideField.getTextHeight(); // This forces recalculation+ fieldText.height(); // This forces recalculation++ // fieldGroup.draw();+ fieldGroup.getLayer()?.batchDraw();+ });+ }++ // Handle export mode.+ if (mode === 'export') {+ // Hide the rectangle.+ fieldRect.opacity(0);+ }++ // Todo: Doesn't work.+ if (mode !== 'export') {+ const hoverColor = options.color+ ? RECIPIENT_COLOR_STYLES[options.color].baseRingHover+ : '#e5e7eb';++ // Todo: Envelopes - On hover add text color++ // Add smooth transition-like behavior for hover effects+ fieldGroup.on('mouseover', () => {+ new Konva.Tween({+ node: fieldRect,+ duration: 0.3,+ fill: hoverColor,+ }).play();+ });++ fieldGroup.on('mouseout', () => {+ new Konva.Tween({+ node: fieldRect,+ duration: 0.3,+ fill: DEFAULT_RECT_BACKGROUND,+ }).play();+ });++ fieldGroup.add(fieldRect);+ }++ return {+ fieldGroup,+ isFirstRender,+ };+};diff --git a/packages/lib/universal/field-renderer/render-text-field.ts b/packages/lib/universal/field-renderer/render-text-field.tsnew file mode 100644index 000000000..4a40bc05f--- /dev/null+++ b/packages/lib/universal/field-renderer/render-text-field.ts@@ -0,0 +1,234 @@+import Konva from 'konva';++import {+ DEFAULT_RECT_BACKGROUND,+ RECIPIENT_COLOR_STYLES,+} from '@documenso/ui/lib/recipient-colors';++import { DEFAULT_STANDARD_FONT_SIZE } from '../../constants/pdf';+import type { TTextFieldMeta } from '../../types/field-meta';+import { upsertFieldGroup, upsertFieldRect } from './field-generic-items';+import type { FieldToRender, RenderFieldElementOptions } from './field-renderer';+import { calculateFieldPosition } from './field-renderer';++const upsertFieldText = (field: FieldToRender, options: RenderFieldElementOptions): Konva.Text => {+ const { pageWidth, pageHeight, mode = 'edit', pageLayer } = options;++ const { fieldWidth, fieldHeight } = calculateFieldPosition(field, pageWidth, pageHeight);++ const textMeta = field.fieldMeta as TTextFieldMeta | undefined;++ const fieldText: Konva.Text =+ pageLayer.findOne(`#${field.renderId}-text`) ||+ new Konva.Text({+ id: `${field.renderId}-text`,+ name: 'field-text',+ });++ // Calculate text positioning based on alignment+ const textX = 0;+ const textY = 0;+ let textAlign: 'left' | 'center' | 'right' = textMeta?.textAlign || 'left';+ let textVerticalAlign: 'top' | 'middle' | 'bottom' = 'top';+ let textFontSize = textMeta?.fontSize || DEFAULT_STANDARD_FONT_SIZE;+ const textPadding = 10;++ let textToRender: string = field.type;++ // Handle edit mode.+ if (mode === 'edit') {+ textToRender = field.type; // Todo: Envelope - Need translations+ textAlign = 'center';+ textFontSize = DEFAULT_STANDARD_FONT_SIZE;+ textVerticalAlign = 'middle';++ if (textMeta?.label) {+ textToRender = textMeta.label;+ textFontSize = textMeta.fontSize || DEFAULT_STANDARD_FONT_SIZE;+ } else if (textMeta?.text) {+ textToRender = textMeta.text;+ textFontSize = textMeta.fontSize || DEFAULT_STANDARD_FONT_SIZE;+ textAlign = textMeta.textAlign || 'center'; // Todo: Envelopes - What is the default++ // Todo: Envelopes - Handle this on signatures+ if (textMeta.characterLimit) {+ textToRender = textToRender.slice(0, textMeta.characterLimit);+ }+ }+ }++ // Handle sign mode.+ if (mode === 'sign' || mode === 'export') {+ textToRender = field.type; // Todo: Envelope - Need translations+ textAlign = 'center';+ textFontSize = DEFAULT_STANDARD_FONT_SIZE;+ textVerticalAlign = 'middle';++ if (textMeta?.label) {+ textToRender = textMeta.label;+ textFontSize = textMeta.fontSize || DEFAULT_STANDARD_FONT_SIZE;+ }++ if (textMeta?.text) {+ textToRender = textMeta.text;+ textFontSize = textMeta.fontSize || DEFAULT_STANDARD_FONT_SIZE;+ textAlign = textMeta.textAlign || 'center'; // Todo: Envelopes - What is the default++ // Todo: Envelopes - Handle this on signatures+ if (textMeta.characterLimit) {+ textToRender = textToRender.slice(0, textMeta.characterLimit);+ }+ }++ if (field.inserted) {+ textToRender = field.customText;+ textFontSize = textMeta?.fontSize || DEFAULT_STANDARD_FONT_SIZE;+ textAlign = textMeta?.textAlign || 'center'; // Todo: Envelopes - What is the default++ // Todo: Envelopes - Handle this on signatures+ if (textMeta?.characterLimit) {+ textToRender = textToRender.slice(0, textMeta.characterLimit);+ }+ }+ }++ fieldText.setAttrs({+ x: textX,+ y: textY,+ verticalAlign: textVerticalAlign,+ wrap: 'word',+ padding: textPadding,++ text: textToRender,++ fontSize: textFontSize,+ fontFamily: 'Inter, system-ui, sans-serif',+ align: textAlign,+ width: fieldWidth,+ height: fieldHeight,+ } satisfies Partial<Konva.TextConfig>);++ return fieldText;+};++export const renderTextFieldElement = (+ field: FieldToRender,+ options: RenderFieldElementOptions,+) => {+ const { mode = 'edit', pageLayer } = options;++ const isFirstRender = !pageLayer.findOne(`#${field.renderId}`);++ const fieldGroup = upsertFieldGroup(field, options);++ // ABOVE IS GENERIC, EXTRACT IT.++ // Render the field background and text.+ const fieldRect = upsertFieldRect(field, options);+ const fieldText = upsertFieldText(field, options);++ // Assign elements to group and any listeners that should only be run on initialization.+ if (isFirstRender) {+ fieldGroup.add(fieldRect);+ fieldGroup.add(fieldText);+ pageLayer.add(fieldGroup);++ // This is to keep the text inside the field at the same size+ // when the field is resized. Without this the text would be stretched.+ fieldGroup.on('transform', () => {+ const groupScaleX = fieldGroup.scaleX();+ const groupScaleY = fieldGroup.scaleY();++ // Adjust text scale so it doesn't change while group is resized.+ fieldText.scaleX(1 / groupScaleX);+ fieldText.scaleY(1 / groupScaleY);++ const rectWidth = fieldRect.width() * groupScaleX;+ const rectHeight = fieldRect.height() * groupScaleY;++ // // Update text group position and clipping+ // fieldGroup.clipFunc(function (ctx) {+ // ctx.rect(0, 0, rectWidth, rectHeight);+ // });++ // Update text dimensions+ fieldText.width(rectWidth); // Account for padding+ fieldText.height(rectHeight);++ console.log({+ rectWidth,+ });++ // Force Konva to recalculate text layout+ // textInsideField.getTextHeight(); // This forces recalculation+ fieldText.height(); // This forces recalculation++ // fieldGroup.draw();+ fieldGroup.getLayer()?.batchDraw();+ });++ // Reset the text after transform has ended.+ fieldGroup.on('transformend', () => {+ fieldText.scaleX(1);+ fieldText.scaleY(1);++ const rectWidth = fieldRect.width();+ const rectHeight = fieldRect.height();++ // // Update text group position and clipping+ // fieldGroup.clipFunc(function (ctx) {+ // ctx.rect(0, 0, rectWidth, rectHeight);+ // });++ // Update text dimensions+ fieldText.width(rectWidth); // Account for padding+ fieldText.height(rectHeight);++ // Force Konva to recalculate text layout+ // textInsideField.getTextHeight(); // This forces recalculation+ fieldText.height(); // This forces recalculation++ // fieldGroup.draw();+ fieldGroup.getLayer()?.batchDraw();+ });+ }++ // Handle export mode.+ if (mode === 'export') {+ // Hide the rectangle.+ fieldRect.opacity(0);+ }++ // Todo: Doesn't work.+ if (mode !== 'export') {+ const hoverColor = options.color+ ? RECIPIENT_COLOR_STYLES[options.color].baseRingHover+ : '#e5e7eb';++ // Todo: Envelopes - On hover add text color++ // Add smooth transition-like behavior for hover effects+ fieldGroup.on('mouseover', () => {+ new Konva.Tween({+ node: fieldRect,+ duration: 0.3,+ fill: hoverColor,+ }).play();+ });++ fieldGroup.on('mouseout', () => {+ new Konva.Tween({+ node: fieldRect,+ duration: 0.3,+ fill: DEFAULT_RECT_BACKGROUND,+ }).play();+ });++ fieldGroup.add(fieldRect);+ }++ return {+ fieldGroup,+ isFirstRender,+ };+};diff --git a/packages/lib/universal/id.ts b/packages/lib/universal/id.tsindex d56d923fd..e681becf1 100644--- a/packages/lib/universal/id.ts+++ b/packages/lib/universal/id.ts@@ -1,5 +1,9 @@+import type { Envelope } from '@prisma/client';+import { EnvelopeType } from '@prisma/client';import { customAlphabet } from 'nanoid';+import { mapSecondaryIdToDocumentId, mapSecondaryIdToTemplateId } from '../utils/envelope';+export const alphaid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 21);export { nanoid } from 'nanoid';@@ -11,6 +15,10 @@ export const prefixedId = (prefix: string, length = 16) => {};type DatabaseIdPrefix =+ | 'document'+ | 'template'+ | 'envelope'+ | 'envelope_item'| 'email_domain'| 'org'| 'org_email'@@ -25,3 +33,16 @@ type DatabaseIdPrefix =| 'team_setting';export const generateDatabaseId = (prefix: DatabaseIdPrefix) => prefixedId(prefix, 16);++export const extractLegacyIds = (envelope: Pick<Envelope, 'type' | 'secondaryId'>) => {+ return {+ documentId:+ envelope.type === EnvelopeType.DOCUMENT+ ? mapSecondaryIdToDocumentId(envelope.secondaryId)+ : null,+ templateId:+ envelope.type === EnvelopeType.TEMPLATE+ ? mapSecondaryIdToTemplateId(envelope.secondaryId)+ : null,+ };+};diff --git a/packages/lib/universal/upload/put-file.server.ts b/packages/lib/universal/upload/put-file.server.tsindex 4173bdb81..f414be62f 100644--- a/packages/lib/universal/upload/put-file.server.ts+++ b/packages/lib/universal/upload/put-file.server.ts@@ -1,6 +1,6 @@+import { PDFDocument } from '@cantoo/pdf-lib';import { DocumentDataType } from '@prisma/client';import { base64 } from '@scure/base';-import { PDFDocument } from 'pdf-lib';import { match } from 'ts-pattern';import { env } from '@documenso/lib/utils/env';diff --git a/packages/lib/utils/document-audit-logs.ts b/packages/lib/utils/document-audit-logs.tsindex f5a14478e..dc7788e83 100644--- a/packages/lib/utils/document-audit-logs.ts+++ b/packages/lib/utils/document-audit-logs.ts@@ -22,7 +22,7 @@ import { ZRecipientAuthOptionsSchema } from '../types/document-auth';import type { ApiRequestMetadata, RequestMetadata } from '../universal/extract-request-metadata';type CreateDocumentAuditLogDataOptions<T = TDocumentAuditLog['type']> = {- documentId: number;+ envelopeId: string;type: T;data: Extract<TDocumentAuditLog, { type: T }>['data'];user?: { email?: string | null; id?: number | null; name?: string | null } | null;@@ -32,13 +32,13 @@ type CreateDocumentAuditLogDataOptions<T = TDocumentAuditLog['type']> = {export type CreateDocumentAuditLogDataResponse = Pick<DocumentAuditLog,- 'type' | 'ipAddress' | 'userAgent' | 'email' | 'userId' | 'name' | 'documentId'+ 'type' | 'ipAddress' | 'userAgent' | 'email' | 'userId' | 'name' | 'envelopeId'> & {data: TDocumentAuditLog['data'];};export const createDocumentAuditLogData = <T extends TDocumentAuditLog['type']>({- documentId,+ envelopeId,type,data,user,@@ -62,7 +62,7 @@ export const createDocumentAuditLogData = <T extends TDocumentAuditLog['type']>(return {type,data,- documentId,+ envelopeId,userId,email,name,@@ -203,7 +203,6 @@ export const diffDocumentMetaChanges = (const oldMessage = oldData?.message ?? '';const oldSubject = oldData?.subject ?? '';const oldTimezone = oldData?.timezone ?? '';- const oldPassword = oldData?.password ?? null;const oldRedirectUrl = oldData?.redirectUrl ?? '';const oldEmailId = oldData?.emailId || null;const oldEmailReplyTo = oldData?.emailReplyTo || null;@@ -258,12 +257,6 @@ export const diffDocumentMetaChanges = (});}- if (oldPassword !== newData.password) {- diffs.push({- type: DOCUMENT_META_DIFF_TYPE.PASSWORD,- });- }-if (oldEmailId !== newEmailId) {diffs.push({type: DOCUMENT_META_DIFF_TYPE.EMAIL_ID,diff --git a/packages/lib/utils/document-auth.ts b/packages/lib/utils/document-auth.tsindex 716e3fa11..c426eb54b 100644--- a/packages/lib/utils/document-auth.ts+++ b/packages/lib/utils/document-auth.ts@@ -1,4 +1,4 @@-import type { Document, Recipient } from '@prisma/client';+import type { Envelope, Recipient } from '@prisma/client';import type {TDocumentAuthOptions,@@ -10,7 +10,7 @@ import { DocumentAuth } from '../types/document-auth';import { ZDocumentAuthOptionsSchema, ZRecipientAuthOptionsSchema } from '../types/document-auth';type ExtractDocumentAuthMethodsOptions = {- documentAuth: Document['authOptions'];+ documentAuth: Envelope['authOptions'];recipientAuth?: Recipient['authOptions'];};diff --git a/packages/lib/utils/document-visibility.ts b/packages/lib/utils/document-visibility.tsdeleted file mode 100644index 270b57870..000000000--- a/packages/lib/utils/document-visibility.ts+++ /dev/null@@ -1,20 +0,0 @@-import { DocumentVisibility, TeamMemberRole } from '@prisma/client';--export const determineDocumentVisibility = (- globalVisibility: DocumentVisibility | null | undefined,- userRole: TeamMemberRole,-): DocumentVisibility => {- if (globalVisibility) {- return globalVisibility;- }-- if (userRole === TeamMemberRole.ADMIN) {- return DocumentVisibility.ADMIN;- }-- if (userRole === TeamMemberRole.MANAGER) {- return DocumentVisibility.MANAGER_AND_ABOVE;- }-- return DocumentVisibility.EVERYONE;-};diff --git a/packages/lib/utils/document.ts b/packages/lib/utils/document.tsindex 8bae70ca2..8fb4d24e8 100644--- a/packages/lib/utils/document.ts+++ b/packages/lib/utils/document.ts@@ -1,15 +1,20 @@import type {- Document,DocumentMeta,+ Envelope,OrganisationGlobalSettings,- TemplateMeta,+ Recipient,+ Team,+ User,} from '@prisma/client';import { DocumentDistributionMethod, DocumentSigningOrder, DocumentStatus } from '@prisma/client';import { DEFAULT_DOCUMENT_TIME_ZONE } from '../constants/time-zones';+import type { TDocumentLite, TDocumentMany } from '../types/document';import { DEFAULT_DOCUMENT_EMAIL_SETTINGS } from '../types/document-email';+import { mapSecondaryIdToDocumentId } from './envelope';+import { mapRecipientToLegacyRecipient } from './recipients';-export const isDocumentCompleted = (document: Pick<Document, 'status'> | DocumentStatus) => {+export const isDocumentCompleted = (document: Pick<Envelope, 'status'> | DocumentStatus) => {const status = typeof document === 'string' ? document : document.status;return status === DocumentStatus.COMPLETED || status === DocumentStatus.REJECTED;@@ -29,7 +34,7 @@ export const isDocumentCompleted = (document: Pick<Document, 'status'> | Documen*/export const extractDerivedDocumentMeta = (settings: Omit<OrganisationGlobalSettings, 'id'>,- overrideMeta: Partial<DocumentMeta | TemplateMeta> | undefined | null,+ overrideMeta: Partial<DocumentMeta> | undefined | null,) => {const meta = overrideMeta ?? {};@@ -41,7 +46,6 @@ export const extractDerivedDocumentMeta = (dateFormat: meta.dateFormat || settings.documentDateFormat,message: meta.message || null,subject: meta.subject || null,- password: meta.password || null,redirectUrl: meta.redirectUrl || null,signingOrder: meta.signingOrder || DocumentSigningOrder.PARALLEL,@@ -58,5 +62,87 @@ export const extractDerivedDocumentMeta = (emailReplyTo: meta.emailReplyTo ?? settings.emailReplyTo,emailSettings:meta.emailSettings || settings.emailDocumentSettings || DEFAULT_DOCUMENT_EMAIL_SETTINGS,- } satisfies Omit<DocumentMeta, 'id' | 'documentId'>;+ } satisfies Omit<DocumentMeta, 'id'>;+};++/**+ * Map an envelope to a legacy document lite response entity.+ *+ * Do not use spread operator here to avoid unexpected behavior.+ */+export const mapEnvelopeToDocumentLite = (envelope: Envelope): TDocumentLite => {+ const documentId = mapSecondaryIdToDocumentId(envelope.secondaryId);++ return {+ id: documentId, // Use legacy ID.+ envelopeId: envelope.id,+ visibility: envelope.visibility,+ status: envelope.status,+ source: envelope.source,+ externalId: envelope.externalId,+ userId: envelope.userId,+ authOptions: envelope.authOptions,+ formValues: envelope.formValues,+ title: envelope.title,+ createdAt: envelope.createdAt,+ documentDataId: '', // Backwards compatibility.+ updatedAt: envelope.updatedAt,+ completedAt: envelope.completedAt,+ deletedAt: envelope.deletedAt,+ teamId: envelope.teamId,+ folderId: envelope.folderId,+ useLegacyFieldInsertion: envelope.useLegacyFieldInsertion,+ templateId: envelope.templateId,+ };+};++type MapEnvelopeToDocumentManyOptions = Envelope & {+ user: Pick<User, 'id' | 'name' | 'email'>;+ team: Pick<Team, 'id' | 'url'>;+ recipients: Recipient[];+};++/**+ * Map an envelope to a legacy document many response entity.+ *+ * Do not use spread operator here to avoid unexpected behavior.+ */+export const mapEnvelopesToDocumentMany = (+ envelope: MapEnvelopeToDocumentManyOptions,+): TDocumentMany => {+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);++ return {+ id: legacyDocumentId, // Use legacy ID.+ envelopeId: envelope.id,+ visibility: envelope.visibility,+ status: envelope.status,+ source: envelope.source,+ externalId: envelope.externalId,+ userId: envelope.userId,+ authOptions: envelope.authOptions,+ formValues: envelope.formValues,+ title: envelope.title,+ createdAt: envelope.createdAt,+ documentDataId: '', // Backwards compatibility.+ updatedAt: envelope.updatedAt,+ completedAt: envelope.completedAt,+ deletedAt: envelope.deletedAt,+ teamId: envelope.teamId,+ folderId: envelope.folderId,+ useLegacyFieldInsertion: envelope.useLegacyFieldInsertion,+ templateId: envelope.templateId,+ user: {+ id: envelope.userId,+ name: envelope.user.name,+ email: envelope.user.email,+ },+ team: {+ id: envelope.teamId,+ url: envelope.team.url,+ },+ recipients: envelope.recipients.map((recipient) =>+ mapRecipientToLegacyRecipient(recipient, envelope),+ ),+ };};diff --git a/packages/lib/utils/envelope.ts b/packages/lib/utils/envelope.tsnew file mode 100644index 000000000..e78df82d2--- /dev/null+++ b/packages/lib/utils/envelope.ts@@ -0,0 +1,167 @@+import type { Envelope, Recipient } from '@prisma/client';+import { DocumentStatus, EnvelopeType, SendStatus, SigningStatus } from '@prisma/client';+import { match } from 'ts-pattern';+import { z } from 'zod';++import { AppError, AppErrorCode } from '../errors/app-error';++const envelopeDocumentPrefixId = 'document';+const envelopeTemplatePrefixId = 'template';++const ZDocumentIdSchema = z.string().regex(/^document_\d+$/);+const ZTemplateIdSchema = z.string().regex(/^template_\d+$/);+const ZEnvelopeIdSchema = z.string().regex(/^envelope_.{2,}$/);++export type EnvelopeIdOptions =+ | {+ type: 'envelopeId';+ id: string;+ }+ | {+ type: 'documentId';+ id: number;+ }+ | {+ type: 'templateId';+ id: number;+ };++/**+ * Parses an unknown document or template ID.+ *+ * This is UNSAFE because does not validate access, it just builds the query for ID and TYPE.+ */+export const unsafeBuildEnvelopeIdQuery = (+ options: EnvelopeIdOptions,+ expectedEnvelopeType: EnvelopeType | null,+) => {+ return match(options)+ .with({ type: 'envelopeId' }, (value) => {+ const parsed = ZEnvelopeIdSchema.safeParse(value.id);++ if (!parsed.success) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid envelope ID',+ });+ }++ if (expectedEnvelopeType) {+ return {+ id: value.id,+ type: expectedEnvelopeType,+ };+ }++ return {+ id: value.id,+ };+ })+ .with({ type: 'documentId' }, (value) => {+ if (expectedEnvelopeType && expectedEnvelopeType !== EnvelopeType.DOCUMENT) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid document ID',+ });+ }++ return {+ type: EnvelopeType.DOCUMENT,+ secondaryId: mapDocumentIdToSecondaryId(value.id),+ };+ })+ .with({ type: 'templateId' }, (value) => {+ if (expectedEnvelopeType && expectedEnvelopeType !== EnvelopeType.TEMPLATE) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid template ID',+ });+ }++ return {+ type: EnvelopeType.TEMPLATE,+ secondaryId: mapTemplateIdToSecondaryId(value.id),+ };+ })+ .exhaustive();+};++/**+ * Maps a legacy document ID number to an envelope secondary ID.+ *+ * @returns The formatted envelope secondary ID (document_123)+ */+export const mapDocumentIdToSecondaryId = (documentId: number) => {+ return `${envelopeDocumentPrefixId}_${documentId}`;+};++/**+ * Maps a legacy template ID number to an envelope secondary ID.+ *+ * @returns The formatted envelope secondary ID (template_123)+ */+export const mapTemplateIdToSecondaryId = (templateId: number) => {+ return `${envelopeTemplatePrefixId}_${templateId}`;+};++/**+ * Maps an envelope secondary ID to a legacy document ID number.+ *+ * Throws an error if the secondary ID is not a document ID.+ *+ * @param secondaryId The envelope secondary ID (document_123)+ * @returns The legacy document ID number (123)+ */+export const mapSecondaryIdToDocumentId = (secondaryId: string) => {+ const parsed = ZDocumentIdSchema.safeParse(secondaryId);++ if (!parsed.success) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid document ID',+ });+ }++ return parseInt(parsed.data.split('_')[1]);+};++/**+ * Maps an envelope secondary ID to a legacy template ID number.+ *+ * Throws an error if the secondary ID is not a template ID.+ *+ * @param secondaryId The envelope secondary ID (template_123)+ * @returns The legacy template ID number (123)+ */+export const mapSecondaryIdToTemplateId = (secondaryId: string) => {+ const parsed = ZTemplateIdSchema.safeParse(secondaryId);++ if (!parsed.success) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid template ID',+ });+ }++ return parseInt(parsed.data.split('_')[1]);+};++export const canEnvelopeItemsBeModified = (+ envelope: Pick<Envelope, 'completedAt' | 'deletedAt' | 'type' | 'status'>,+ recipients: Recipient[],+) => {+ if (envelope.completedAt || envelope.deletedAt || envelope.status !== DocumentStatus.DRAFT) {+ return false;+ }++ if (envelope.type === EnvelopeType.TEMPLATE) {+ return true;+ }++ if (+ recipients.some(+ (recipient) =>+ recipient.signingStatus === SigningStatus.SIGNED ||+ recipient.sendStatus === SendStatus.SENT,+ )+ ) {+ return false;+ }++ return true;+};diff --git a/packages/lib/utils/fields.ts b/packages/lib/utils/fields.tsindex c1646c3bf..be7c23e07 100644--- a/packages/lib/utils/fields.ts+++ b/packages/lib/utils/fields.ts@@ -1,4 +1,6 @@-import type { Field } from '@prisma/client';+import { type Envelope, type Field } from '@prisma/client';++import { extractLegacyIds } from '../universal/id';/*** Sort the fields by the Y position on the document.@@ -63,3 +65,15 @@ export const validateFieldsUninserted = (): boolean => {return errorElements.length === 0;};++export const mapFieldToLegacyField = (+ field: Field,+ envelope: Pick<Envelope, 'type' | 'secondaryId'>,+) => {+ const legacyId = extractLegacyIds(envelope);++ return {+ ...field,+ ...legacyId,+ };+};diff --git a/packages/lib/utils/mask-recipient-tokens-for-document.ts b/packages/lib/utils/mask-recipient-tokens-for-document.tsindex ddadb4f3f..4a344ca3e 100644--- a/packages/lib/utils/mask-recipient-tokens-for-document.ts+++ b/packages/lib/utils/mask-recipient-tokens-for-document.ts@@ -1,14 +1,14 @@import type { User } from '@prisma/client';-import type { DocumentWithRecipients } from '@documenso/prisma/types/document-with-recipient';+import type { EnvelopeWithRecipients } from '@documenso/prisma/types/document-with-recipient';-export type MaskRecipientTokensForDocumentOptions<T extends DocumentWithRecipients> = {+export type MaskRecipientTokensForDocumentOptions<T extends EnvelopeWithRecipients> = {document: T;- user?: Pick<User, 'id' | 'email' | 'name'>;+ user?: Pick<User, 'id' | 'email'>;token?: string;};-export const maskRecipientTokensForDocument = <T extends DocumentWithRecipients>({+export const maskRecipientTokensForDocument = <T extends EnvelopeWithRecipients>({document,user,token,diff --git a/packages/lib/utils/recipients.ts b/packages/lib/utils/recipients.tsindex dc973cdb1..70411ad4d 100644--- a/packages/lib/utils/recipients.ts+++ b/packages/lib/utils/recipients.ts@@ -1,6 +1,8 @@+import type { Envelope } from '@prisma/client';import { type Field, type Recipient, RecipientRole, SigningStatus } from '@prisma/client';import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';+import { extractLegacyIds } from '../universal/id';export const formatSigningLink = (token: string) => `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${token}`;@@ -44,3 +46,15 @@ export const canRecipientFieldsBeModified = (recipient: Recipient, fields: Fieldreturn recipient.role !== RecipientRole.VIEWER && recipient.role !== RecipientRole.CC;};++export const mapRecipientToLegacyRecipient = (+ recipient: Recipient,+ envelope: Pick<Envelope, 'type' | 'secondaryId'>,+) => {+ const legacyId = extractLegacyIds(envelope);++ return {+ ...recipient,+ ...legacyId,+ };+};diff --git a/packages/lib/utils/teams.ts b/packages/lib/utils/teams.tsindex 3665baf33..867f8ef93 100644--- a/packages/lib/utils/teams.ts+++ b/packages/lib/utils/teams.ts@@ -1,4 +1,9 @@-import type { OrganisationGlobalSettings, Prisma, TeamGlobalSettings } from '@prisma/client';+import type {+ DocumentVisibility,+ OrganisationGlobalSettings,+ Prisma,+ TeamGlobalSettings,+} from '@prisma/client';import type { TeamGroup } from '@documenso/prisma/generated/types';import type { TeamMemberRole } from '@documenso/prisma/generated/types';@@ -6,6 +11,7 @@ import type { TeamMemberRole } from '@documenso/prisma/generated/types';import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';import {LOWEST_TEAM_ROLE,+ TEAM_DOCUMENT_VISIBILITY_MAP,TEAM_MEMBER_ROLE_HIERARCHY,TEAM_MEMBER_ROLE_PERMISSIONS_MAP,} from '../constants/teams';@@ -48,6 +54,17 @@ export const canExecuteTeamAction = (return TEAM_MEMBER_ROLE_PERMISSIONS_MAP[action].some((i) => i === role);};+/**+ * Determines whether a team role can access the visibility of a document.+ *+ * @param action The action the user is trying to execute.+ * @param role The current role of the user.+ * @returns Whether the user can execute the action.+ */+export const canAccessTeamDocument = (role: TeamMemberRole, visibility: DocumentVisibility) => {+ return TEAM_DOCUMENT_VISIBILITY_MAP[role].some((i) => i === visibility);+};+/*** Compares the provided `currentUserRole` with the provided `roleToCheck` to determine* whether the `currentUserRole` has permission to modify the `roleToCheck`.@@ -106,7 +123,7 @@ export const extractTeamSignatureSettings = (return signatureTypes;};-type BuildTeamWhereQueryOptions = {+export type BuildTeamWhereQueryOptions = {teamId: number | undefined;userId: number;roles?: TeamMemberRole[];diff --git a/packages/lib/utils/templates.ts b/packages/lib/utils/templates.tsindex edac17011..5e22474e2 100644--- a/packages/lib/utils/templates.ts+++ b/packages/lib/utils/templates.ts@@ -1,6 +1,9 @@-import type { Recipient } from '@prisma/client';+import type { Envelope } from '@prisma/client';+import { type Recipient } from '@prisma/client';import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';+import type { TTemplateLite } from '../types/template';+import { mapSecondaryIdToTemplateId } from './envelope';export const formatDirectTemplatePath = (token: string) => {return `${NEXT_PUBLIC_WEBAPP_URL()}/d/${token}`;@@ -42,3 +45,26 @@ export const generateAvaliableRecipientPlaceholder = (currentRecipients: Recipiereturn recipientPlaceholder;};++export const mapEnvelopeToTemplateLite = (envelope: Envelope): TTemplateLite => {+ const legacyTemplateId = mapSecondaryIdToTemplateId(envelope.secondaryId);++ return {+ id: legacyTemplateId,+ envelopeId: envelope.secondaryId,+ type: envelope.templateType,+ visibility: envelope.visibility,+ externalId: envelope.externalId,+ title: envelope.title,+ userId: envelope.userId,+ teamId: envelope.teamId,+ authOptions: envelope.authOptions,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ publicTitle: envelope.publicTitle,+ publicDescription: envelope.publicDescription,+ folderId: envelope.folderId,+ useLegacyFieldInsertion: envelope.useLegacyFieldInsertion,+ templateDocumentDataId: '',+ };+};diff --git a/packages/prisma/migrations/20250918070643_remove_template_metadata/migration.sql b/packages/prisma/migrations/20250918070643_remove_template_metadata/migration.sqlnew file mode 100644index 000000000..6cb085e93--- /dev/null+++ b/packages/prisma/migrations/20250918070643_remove_template_metadata/migration.sql@@ -0,0 +1,57 @@+-- DropForeignKey+ALTER TABLE "TemplateMeta" DROP CONSTRAINT "TemplateMeta_templateId_fkey";++-- AlterTable+ALTER TABLE "DocumentMeta" ADD COLUMN "templateId" INTEGER,+ALTER COLUMN "documentId" DROP NOT NULL;++-- [CUSTOM_CHANGE] Migrate existing TemplateMeta to DocumentMeta+INSERT INTO "DocumentMeta" (+ "id",+ "subject",+ "message",+ "timezone",+ "password",+ "dateFormat",+ "redirectUrl",+ "signingOrder",+ "allowDictateNextSigner",+ "typedSignatureEnabled",+ "uploadSignatureEnabled",+ "drawSignatureEnabled",+ "language",+ "distributionMethod",+ "emailSettings",+ "emailReplyTo",+ "emailId",+ "templateId"+)+SELECT+ gen_random_uuid()::text, -- Generate new CUID-like IDs to avoid collisions+ "subject",+ "message",+ "timezone",+ "password",+ "dateFormat",+ "redirectUrl",+ "signingOrder",+ "allowDictateNextSigner",+ "typedSignatureEnabled",+ "uploadSignatureEnabled",+ "drawSignatureEnabled",+ "language",+ "distributionMethod",+ "emailSettings",+ "emailReplyTo",+ "emailId",+ "templateId"+FROM "TemplateMeta";++-- DropTable+DROP TABLE "TemplateMeta";++-- CreateIndex+CREATE UNIQUE INDEX "DocumentMeta_templateId_key" ON "DocumentMeta"("templateId");++-- AddForeignKey+ALTER TABLE "DocumentMeta" ADD CONSTRAINT "DocumentMeta_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE CASCADE ON UPDATE CASCADE;diff --git a/packages/prisma/migrations/20250918070645_add_envelopes/migration.sql b/packages/prisma/migrations/20250918070645_add_envelopes/migration.sqlnew file mode 100644index 000000000..734049b37--- /dev/null+++ b/packages/prisma/migrations/20250918070645_add_envelopes/migration.sql@@ -0,0 +1,470 @@+/*+ Warnings:++ - You are about to drop the column `documentId` on the `DocumentAuditLog` table. All the data in the column will be lost.+ - You are about to drop the column `documentId` on the `DocumentMeta` table. All the data in the column will be lost.+ - You are about to drop the column `password` on the `DocumentMeta` table. All the data in the column will be lost.+ - You are about to drop the column `templateId` on the `DocumentMeta` table. All the data in the column will be lost.+ - You are about to drop the column `documentId` on the `DocumentShareLink` table. All the data in the column will be lost.+ - You are about to drop the column `documentId` on the `Field` table. All the data in the column will be lost.+ - You are about to drop the column `templateId` on the `Field` table. All the data in the column will be lost.+ - You are about to drop the column `documentId` on the `Recipient` table. All the data in the column will be lost.+ - You are about to drop the column `templateId` on the `Recipient` table. All the data in the column will be lost.+ - You are about to drop the column `templateId` on the `TemplateDirectLink` table. All the data in the column will be lost.+ - You are about to drop the `Document` table. If the table is not empty, all the data it contains will be lost.+ - You are about to drop the `Template` table. If the table is not empty, all the data it contains will be lost.+ - A unique constraint covering the columns `[envelopeId,email]` on the table `DocumentShareLink` will be added. If there are existing duplicate values, this will fail.+ - A unique constraint covering the columns `[envelopeId,email]` on the table `Recipient` will be added. If there are existing duplicate values, this will fail.+ - A unique constraint covering the columns `[envelopeId]` on the table `TemplateDirectLink` will be added. If there are existing duplicate values, this will fail.+ - Added the required column `envelopeId` to the `DocumentAuditLog` table without a default value. This is not possible if the table is not empty.+ - Added the required column `envelopeId` to the `DocumentShareLink` table without a default value. This is not possible if the table is not empty.+ - Added the required column `envelopeId` to the `Field` table without a default value. This is not possible if the table is not empty.+ - Added the required column `envelopeItemId` to the `Field` table without a default value. This is not possible if the table is not empty.+ - Added the required column `envelopeId` to the `Recipient` table without a default value. This is not possible if the table is not empty.+ - Added the required column `envelopeId` to the `TemplateDirectLink` table without a default value. This is not possible if the table is not empty.++*/+-- CreateEnum+CREATE TYPE "EnvelopeType" AS ENUM ('DOCUMENT', 'TEMPLATE');++-- DropForeignKey+ALTER TABLE "Document" DROP CONSTRAINT "Document_documentDataId_fkey";++-- DropForeignKey+ALTER TABLE "Document" DROP CONSTRAINT "Document_folderId_fkey";++-- DropForeignKey+ALTER TABLE "Document" DROP CONSTRAINT "Document_teamId_fkey";++-- DropForeignKey+ALTER TABLE "Document" DROP CONSTRAINT "Document_templateId_fkey";++-- DropForeignKey+ALTER TABLE "Document" DROP CONSTRAINT "Document_userId_fkey";++-- DropForeignKey+ALTER TABLE "DocumentAuditLog" DROP CONSTRAINT "DocumentAuditLog_documentId_fkey";++-- DropForeignKey+ALTER TABLE "DocumentMeta" DROP CONSTRAINT "DocumentMeta_documentId_fkey";++-- DropForeignKey+ALTER TABLE "DocumentMeta" DROP CONSTRAINT "DocumentMeta_templateId_fkey";++-- DropForeignKey+ALTER TABLE "DocumentShareLink" DROP CONSTRAINT "DocumentShareLink_documentId_fkey";++-- DropForeignKey+ALTER TABLE "Field" DROP CONSTRAINT "Field_documentId_fkey";++-- DropForeignKey+ALTER TABLE "Field" DROP CONSTRAINT "Field_templateId_fkey";++-- DropForeignKey+ALTER TABLE "Recipient" DROP CONSTRAINT "Recipient_documentId_fkey";++-- DropForeignKey+ALTER TABLE "Recipient" DROP CONSTRAINT "Recipient_templateId_fkey";++-- DropForeignKey+ALTER TABLE "Template" DROP CONSTRAINT "Template_folderId_fkey";++-- DropForeignKey+ALTER TABLE "Template" DROP CONSTRAINT "Template_teamId_fkey";++-- DropForeignKey+ALTER TABLE "Template" DROP CONSTRAINT "Template_templateDocumentDataId_fkey";++-- DropForeignKey+ALTER TABLE "Template" DROP CONSTRAINT "Template_userId_fkey";++-- DropForeignKey+ALTER TABLE "TemplateDirectLink" DROP CONSTRAINT "TemplateDirectLink_templateId_fkey";++-- DropIndex+DROP INDEX "DocumentMeta_documentId_key";++-- DropIndex+DROP INDEX "DocumentMeta_templateId_key";++-- DropIndex+DROP INDEX "DocumentShareLink_documentId_email_key";++-- DropIndex+DROP INDEX "Field_documentId_idx";++-- DropIndex+DROP INDEX "Field_templateId_idx";++-- DropIndex+DROP INDEX "Recipient_documentId_idx";++-- DropIndex+DROP INDEX "Recipient_templateId_idx";++-- DropIndex+DROP INDEX "TemplateDirectLink_templateId_key";++-- [CUSTOM_CHANGE] Create DocumentMeta records for Documents that don't have them+INSERT INTO "DocumentMeta" ("id", "documentId")+SELECT+ gen_random_uuid(),+ id+FROM "Document"+WHERE "id" NOT IN (SELECT "documentId" FROM "DocumentMeta" WHERE "documentId" IS NOT NULL);++-- [CUSTOM_CHANGE] Create DocumentMeta records for Templates that don't have them+INSERT INTO "DocumentMeta" ("id", "templateId")+SELECT+ gen_random_uuid(),+ id+FROM "Template"+WHERE "id" NOT IN (SELECT "templateId" FROM "DocumentMeta" WHERE "templateId" IS NOT NULL);++-- AlterTable+ALTER TABLE "DocumentAuditLog" ADD COLUMN "envelopeId" TEXT;++-- AlterTable+ALTER TABLE "DocumentShareLink" ADD COLUMN "envelopeId" TEXT;++-- AlterTable+ALTER TABLE "Field" ADD COLUMN "envelopeId" TEXT,+ADD COLUMN "envelopeItemId" TEXT;++-- AlterTable+ALTER TABLE "Recipient" ADD COLUMN "envelopeId" TEXT;++-- AlterTable+ALTER TABLE "TemplateDirectLink" ADD COLUMN "envelopeId" TEXT;++-- CreateTable+CREATE TABLE "Envelope" (+ "id" TEXT NOT NULL,+ "secondaryId" TEXT NOT NULL,+ "externalId" TEXT,+ "type" "EnvelopeType" NOT NULL,+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "updatedAt" TIMESTAMP(3) NOT NULL,+ "completedAt" TIMESTAMP(3),+ "deletedAt" TIMESTAMP(3),+ "title" TEXT NOT NULL,+ "status" "DocumentStatus" NOT NULL DEFAULT 'DRAFT',+ "source" "DocumentSource" NOT NULL,+ "qrToken" TEXT,+ "internalVersion" INTEGER NOT NULL,+ "useLegacyFieldInsertion" BOOLEAN NOT NULL DEFAULT false,+ "authOptions" JSONB,+ "formValues" JSONB,+ "visibility" "DocumentVisibility" NOT NULL DEFAULT 'EVERYONE',+ "templateType" "TemplateType" NOT NULL DEFAULT 'PRIVATE',+ "publicTitle" TEXT NOT NULL DEFAULT '',+ "publicDescription" TEXT NOT NULL DEFAULT '',+ "templateId" INTEGER,+ "userId" INTEGER NOT NULL,+ "teamId" INTEGER NOT NULL,+ "folderId" TEXT,+ "documentMetaId" TEXT NOT NULL,++ CONSTRAINT "Envelope_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "EnvelopeItem" (+ "id" TEXT NOT NULL,+ "title" TEXT NOT NULL,+ "documentDataId" TEXT NOT NULL,+ "envelopeId" TEXT NOT NULL,+ "order" INTEGER NOT NULL,++ CONSTRAINT "EnvelopeItem_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "Counter" (+ "id" TEXT NOT NULL,+ "value" INTEGER NOT NULL,++ CONSTRAINT "Counter_pkey" PRIMARY KEY ("id")+);++-- [CUSTOM_CHANGE] Initialize Counter table for document and template IDs+INSERT INTO "Counter" ("id", "value") VALUES ('document', (SELECT COALESCE(MAX("id"), 0) FROM "Document"));+INSERT INTO "Counter" ("id", "value") VALUES ('template', (SELECT COALESCE(MAX("id"), 0) FROM "Template"));++-- [CUSTOM_CHANGE] Migrate Documents to Envelopes+INSERT INTO "Envelope" (+ "id",+ "secondaryId",+ "externalId",+ "type",+ "createdAt",+ "updatedAt",+ "completedAt",+ "deletedAt",+ "title",+ "status",+ "source",+ "qrToken",+ "internalVersion",+ "useLegacyFieldInsertion",+ "authOptions",+ "formValues",+ "visibility",+ "templateType",+ "publicTitle",+ "publicDescription",+ "templateId",+ "userId",+ "teamId",+ "folderId",+ "documentMetaId"+)+SELECT+ generate_prefix_id('envelope'),+ 'document_' || d."id", -- Create legacy ID for documents+ d."externalId",+ 'DOCUMENT'::"EnvelopeType",+ d."createdAt",+ d."updatedAt",+ d."completedAt",+ d."deletedAt",+ d."title",+ d."status",+ d."source",+ d."qrToken",+ 1,+ d."useLegacyFieldInsertion",+ d."authOptions",+ d."formValues",+ d."visibility",+ 'PRIVATE',+ '',+ '',+ d."templateId",+ d."userId",+ d."teamId",+ d."folderId",+ dm."id"+FROM "Document" d+LEFT JOIN "DocumentMeta" dm ON dm."documentId" = d."id";++-- [CUSTOM_CHANGE] Migrate Templates to Envelopes+INSERT INTO "Envelope" (+ "id",+ "secondaryId",+ "externalId",+ "type",+ "createdAt",+ "updatedAt",+ "completedAt",+ "deletedAt",+ "title",+ "status",+ "source",+ "qrToken",+ "internalVersion",+ "useLegacyFieldInsertion",+ "authOptions",+ "formValues",+ "visibility",+ "templateType",+ "publicTitle",+ "publicDescription",+ "templateId",+ "userId",+ "teamId",+ "folderId",+ "documentMetaId"+)+SELECT+ generate_prefix_id('envelope'),+ 'template_' || t."id", -- Create legacy ID for templates+ t."externalId",+ 'TEMPLATE'::"EnvelopeType",+ t."createdAt",+ t."updatedAt",+ NULL,+ NULL,+ t."title",+ 'DRAFT',+ 'TEMPLATE'::"DocumentSource",+ NULL,+ 1,+ t."useLegacyFieldInsertion",+ t."authOptions",+ NULL,+ t."visibility",+ t."type",+ t."publicTitle",+ t."publicDescription",+ NULL,+ t."userId",+ t."teamId",+ t."folderId",+ dm."id"+FROM "Template" t+LEFT JOIN "DocumentMeta" dm ON dm."templateId" = t."id";++-- [CUSTOM_CHANGE] Create EnvelopeItems for Documents+INSERT INTO "EnvelopeItem" ("id", "title", "documentDataId", "envelopeId", "order")+SELECT+ generate_prefix_id('envelope_item'),+ d."title",+ d."documentDataId",+ e."id",+ 1+FROM "Document" d+JOIN "Envelope" e ON e."secondaryId" = 'document_' || d."id";++-- [CUSTOM_CHANGE] Create EnvelopeItems for Templates+INSERT INTO "EnvelopeItem" ("id", "title", "documentDataId", "envelopeId", "order")+SELECT+ generate_prefix_id('envelope_item'),+ t."title",+ t."templateDocumentDataId",+ e."id",+ 1+FROM "Template" t+JOIN "Envelope" e ON e."secondaryId" = 'template_' || t."id";++-- [CUSTOM_CHANGE] Update DocumentAuditLog with envelope IDs+UPDATE "DocumentAuditLog"+SET "envelopeId" = e."id"+FROM "Document" d+JOIN "Envelope" e ON e."secondaryId" = 'document_' || d."id"+WHERE "DocumentAuditLog"."documentId" = d."id";++-- [CUSTOM_CHANGE] Update Recipients for Documents+UPDATE "Recipient"+SET "envelopeId" = e."id"+FROM "Document" d+JOIN "Envelope" e ON e."secondaryId" = 'document_' || d."id"+WHERE "Recipient"."documentId" = d."id";++-- [CUSTOM_CHANGE] Update Recipients for Templates+UPDATE "Recipient"+SET "envelopeId" = e."id"+FROM "Template" t+JOIN "Envelope" e ON e."secondaryId" = 'template_' || t."id"+WHERE "Recipient"."templateId" = t."id";++-- [CUSTOM_CHANGE] Update Fields for Documents+UPDATE "Field"+SET "envelopeId" = e."id", "envelopeItemId" = ei."id"+FROM "Document" d+JOIN "Envelope" e ON e."secondaryId" = 'document_' || d."id"+JOIN "EnvelopeItem" ei ON ei."envelopeId" = e."id"+WHERE "Field"."documentId" = d."id";++-- [CUSTOM_CHANGE] Update Fields for Templates+UPDATE "Field"+SET "envelopeId" = e."id", "envelopeItemId" = ei."id"+FROM "Template" t+JOIN "Envelope" e ON e."secondaryId" = 'template_' || t."id"+JOIN "EnvelopeItem" ei ON ei."envelopeId" = e."id"+WHERE "Field"."templateId" = t."id";++-- [CUSTOM_CHANGE] Update DocumentShareLink+UPDATE "DocumentShareLink"+SET "envelopeId" = e."id"+FROM "Document" d+JOIN "Envelope" e ON e."secondaryId" = 'document_' || d."id"+WHERE "DocumentShareLink"."documentId" = d."id";++-- [CUSTOM_CHANGE] Update TemplateDirectLink+UPDATE "TemplateDirectLink"+SET "envelopeId" = e."id"+FROM "Template" t+JOIN "Envelope" e ON e."secondaryId" = 'template_' || t."id"+WHERE "TemplateDirectLink"."templateId" = t."id";++-- DropTable+DROP TABLE "Document";++-- DropTable+DROP TABLE "Template";++-- AlterTable+ALTER TABLE "DocumentMeta" DROP COLUMN "documentId",+DROP COLUMN "password",+DROP COLUMN "templateId";++-- AlterTable+ALTER TABLE "DocumentAuditLog" DROP COLUMN "documentId",+ALTER COLUMN "envelopeId" SET NOT NULL;++-- AlterTable+ALTER TABLE "DocumentShareLink" DROP COLUMN "documentId",+ALTER COLUMN "envelopeId" SET NOT NULL;++-- AlterTable+ALTER TABLE "Field" DROP COLUMN "documentId",+DROP COLUMN "templateId",+ALTER COLUMN "envelopeId" SET NOT NULL,+ALTER COLUMN "envelopeItemId" SET NOT NULL;++-- AlterTable+ALTER TABLE "Recipient" DROP COLUMN "documentId",+DROP COLUMN "templateId",+ALTER COLUMN "envelopeId" SET NOT NULL;++-- AlterTable+ALTER TABLE "TemplateDirectLink" DROP COLUMN "templateId",+ALTER COLUMN "envelopeId" SET NOT NULL;++-- CreateIndex+CREATE UNIQUE INDEX "Envelope_secondaryId_key" ON "Envelope"("secondaryId");++-- CreateIndex+CREATE UNIQUE INDEX "Envelope_documentMetaId_key" ON "Envelope"("documentMetaId");++-- CreateIndex+CREATE UNIQUE INDEX "EnvelopeItem_documentDataId_key" ON "EnvelopeItem"("documentDataId");++-- CreateIndex+CREATE UNIQUE INDEX "DocumentShareLink_envelopeId_email_key" ON "DocumentShareLink"("envelopeId", "email");++-- CreateIndex+CREATE INDEX "Field_envelopeId_idx" ON "Field"("envelopeId");++-- CreateIndex+CREATE INDEX "Recipient_envelopeId_idx" ON "Recipient"("envelopeId");++-- CreateIndex+CREATE UNIQUE INDEX "TemplateDirectLink_envelopeId_key" ON "TemplateDirectLink"("envelopeId");++-- AddForeignKey+ALTER TABLE "Envelope" ADD CONSTRAINT "Envelope_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Envelope" ADD CONSTRAINT "Envelope_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Envelope" ADD CONSTRAINT "Envelope_folderId_fkey" FOREIGN KEY ("folderId") REFERENCES "Folder"("id") ON DELETE SET NULL ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Envelope" ADD CONSTRAINT "Envelope_documentMetaId_fkey" FOREIGN KEY ("documentMetaId") REFERENCES "DocumentMeta"("id") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "EnvelopeItem" ADD CONSTRAINT "EnvelopeItem_documentDataId_fkey" FOREIGN KEY ("documentDataId") REFERENCES "DocumentData"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "EnvelopeItem" ADD CONSTRAINT "EnvelopeItem_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "DocumentAuditLog" ADD CONSTRAINT "DocumentAuditLog_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Recipient" ADD CONSTRAINT "Recipient_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Field" ADD CONSTRAINT "Field_envelopeItemId_fkey" FOREIGN KEY ("envelopeItemId") REFERENCES "EnvelopeItem"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "Field" ADD CONSTRAINT "Field_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "DocumentShareLink" ADD CONSTRAINT "DocumentShareLink_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE CASCADE ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "TemplateDirectLink" ADD CONSTRAINT "TemplateDirectLink_envelopeId_fkey" FOREIGN KEY ("envelopeId") REFERENCES "Envelope"("id") ON DELETE CASCADE ON UPDATE CASCADE;diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prismaindex 49e247cb7..10e68cade 100644--- a/packages/prisma/schema.prisma+++ b/packages/prisma/schema.prisma@@ -64,8 +64,7 @@ model User {twoFactorBackupCodes String?folders Folder[]- documents Document[]- templates Template[]+ envelopes Envelope[]verificationTokens VerificationToken[]apiTokens ApiToken[]@@ -354,8 +353,7 @@ model Folder {pinned Boolean @default(false)parentId String?parent Folder? @relation("FolderToFolder", fields: [parentId], references: [id], onDelete: Cascade)- documents Document[]- templates Template[]+ envelopes Envelope[]createdAt DateTime @default(now())updatedAt DateTime @default(now()) @updatedAtsubfolders Folder[] @relation("FolderToFolder")@@ -368,53 +366,85 @@ model Folder {@@index([type])}+enum EnvelopeType {+ DOCUMENT+ TEMPLATE+}+/// @zod.import(["import { ZDocumentAuthOptionsSchema } from '@documenso/lib/types/document-auth';", "import { ZDocumentFormValuesSchema } from '@documenso/lib/types/document-form-values';"])-model Document {- id Int @id @default(autoincrement())- qrToken String? /// @zod.string.describe("The token for viewing the document using the QR code on the certificate.")- externalId String? /// @zod.string.describe("A custom external ID you can use to identify the document.")+model Envelope {+ id String @id+ secondaryId String @unique+ externalId String? /// @zod.string.describe("A custom external ID you can use to identify the document.")++ type EnvelopeType++ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ completedAt DateTime?+ deletedAt DateTime?++ title String+ status DocumentStatus @default(DRAFT)+ source DocumentSource+ qrToken String? /// @zod.string.describe("The token for viewing the document using the QR code on the certificate.")++ internalVersion Int+ useLegacyFieldInsertion Boolean @default(false)+ envelopeItems EnvelopeItem[]+ recipients Recipient[]+ fields Field[]+ shareLinks DocumentShareLink[]+ auditLogs DocumentAuditLog[]++ // Envelope settings+ authOptions Json? /// [DocumentAuthOptions] @zod.custom.use(ZDocumentAuthOptionsSchema)+ formValues Json? /// [DocumentFormValues] @zod.custom.use(ZDocumentFormValuesSchema)+ visibility DocumentVisibility @default(EVERYONE)++ // Template specific fields.+ templateType TemplateType @default(PRIVATE)+ publicTitle String @default("")+ publicDescription String @default("")+ directLink TemplateDirectLink?+ templateId Int?++ // RelationsuserId Int /// @zod.number.describe("The ID of the user that created this document.")user User @relation(fields: [userId], references: [id], onDelete: Cascade)teamId Intteam Team @relation(fields: [teamId], references: [id], onDelete: Cascade)- authOptions Json? /// [DocumentAuthOptions] @zod.custom.use(ZDocumentAuthOptionsSchema)- formValues Json? /// [DocumentFormValues] @zod.custom.use(ZDocumentFormValuesSchema)- visibility DocumentVisibility @default(EVERYONE)- title String- status DocumentStatus @default(DRAFT)- recipients Recipient[]- fields Field[]- shareLinks DocumentShareLink[]- documentDataId String- documentMeta DocumentMeta?- createdAt DateTime @default(now())- updatedAt DateTime @default(now()) @updatedAt- completedAt DateTime?- deletedAt DateTime?- templateId Int?- source DocumentSource+ folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)+ folderId String?- useLegacyFieldInsertion Boolean @default(false)+ documentMetaId String @unique+ documentMeta DocumentMeta @relation(fields: [documentMetaId], references: [id])+}++model EnvelopeItem {+ id String @id++ title String- documentData DocumentData @relation(fields: [documentDataId], references: [id], onDelete: Cascade)- template Template? @relation(fields: [templateId], references: [id], onDelete: SetNull)+ order Int++ documentDataId String+ documentData DocumentData @relation(fields: [documentDataId], references: [id], onDelete: Cascade)- auditLogs DocumentAuditLog[]- folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)- folderId String?+ envelopeId String+ envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)++ field Field[]@@unique([documentDataId])- @@index([userId])- @@index([status])- @@index([folderId])}model DocumentAuditLog {id String @id @default(cuid())- documentId Int+ envelopeId StringcreatedAt DateTime @default(now())type Stringdata Json@@ -426,7 +456,7 @@ model DocumentAuditLog {userAgent String?ipAddress String?- Document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)+ envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)}enum DocumentDataType {@@ -441,12 +471,11 @@ enum DocumentSigningOrder {}model DocumentData {- id String @id @default(cuid())- type DocumentDataType- data String- initialData String- document Document?- template Template?+ id String @id @default(cuid())+ type DocumentDataType+ data String+ initialData String+ envelopeItem EnvelopeItem?}enum DocumentDistributionMethod {@@ -460,10 +489,7 @@ model DocumentMeta {subject String?message String?timezone String? @default("Etc/UTC") @db.Text- password String?dateFormat String? @default("yyyy-MM-dd hh:mm a") @db.Text- documentId Int @unique- document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)redirectUrl String?signingOrder DocumentSigningOrder @default(PARALLEL)allowDictateNextSigner Boolean @default(false)@@ -478,6 +504,8 @@ model DocumentMeta {emailSettings Json? /// [DocumentEmailSettings] @zod.custom.use(ZDocumentEmailSettingsSchema)emailReplyTo String?emailId String?++ envelope Envelope?}enum ReadStatus {@@ -507,8 +535,7 @@ enum RecipientRole {/// @zod.import(["import { ZRecipientAuthOptionsSchema } from '@documenso/lib/types/document-auth';"])model Recipient {id Int @id @default(autoincrement())- documentId Int?- templateId Int?+ envelopeId Stringemail String @db.VarChar(255)name String @default("") @db.VarChar(255)token String@@ -522,13 +549,11 @@ model Recipient {readStatus ReadStatus @default(NOT_OPENED)signingStatus SigningStatus @default(NOT_SIGNED)sendStatus SendStatus @default(NOT_SENT)- document Document? @relation(fields: [documentId], references: [id], onDelete: Cascade)- template Template? @relation(fields: [templateId], references: [id], onDelete: Cascade)+ envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)fields Field[]signatures Signature[]- @@index([documentId])- @@index([templateId])+ @@index([envelopeId])@@index([token])}@@ -548,27 +573,26 @@ enum FieldType {/// @zod.import(["import { ZFieldMetaNotOptionalSchema } from '@documenso/lib/types/field-meta';"])model Field {- id Int @id @default(autoincrement())- secondaryId String @unique @default(cuid())- documentId Int?- templateId Int?- recipientId Int- type FieldType- page Int /// @zod.number.describe("The page number of the field on the document. Starts from 1.")- positionX Decimal @default(0)- positionY Decimal @default(0)- width Decimal @default(-1)- height Decimal @default(-1)- customText String- inserted Boolean- document Document? @relation(fields: [documentId], references: [id], onDelete: Cascade)- template Template? @relation(fields: [templateId], references: [id], onDelete: Cascade)- recipient Recipient @relation(fields: [recipientId], references: [id], onDelete: Cascade)- signature Signature?- fieldMeta Json? /// [FieldMeta] @zod.custom.use(ZFieldMetaNotOptionalSchema)-- @@index([documentId])- @@index([templateId])+ id Int @id @default(autoincrement())+ secondaryId String @unique @default(cuid())+ envelopeId String+ envelopeItemId String+ recipientId Int+ type FieldType+ page Int /// @zod.number.describe("The page number of the field on the document. Starts from 1.")+ positionX Decimal @default(0)+ positionY Decimal @default(0)+ width Decimal @default(-1)+ height Decimal @default(-1)+ customText String+ inserted Boolean+ envelopeItem EnvelopeItem @relation(fields: [envelopeItemId], references: [id], onDelete: Cascade)+ envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)+ recipient Recipient @relation(fields: [recipientId], references: [id], onDelete: Cascade)+ signature Signature?+ fieldMeta Json? /// [FieldMeta] @zod.custom.use(ZFieldMetaNotOptionalSchema)++ @@index([envelopeId])@@index([recipientId])}@@ -590,13 +614,13 @@ model DocumentShareLink {id Int @id @default(autoincrement())email Stringslug String @unique- documentId Int+ envelopeId StringcreatedAt DateTime @default(now())updatedAt DateTime @updatedAt- document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)+ envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)- @@unique([documentId, email])+ @@unique([envelopeId, email])}enum OrganisationType {@@ -810,8 +834,7 @@ model Team {profile TeamProfile?- documents Document[]- templates Template[]+ envelopes Envelope[]folders Folder[]apiTokens ApiToken[]webhooks Webhook[]@@ -849,79 +872,16 @@ enum TemplateType {PRIVATE}-/// @zod.import(["import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';"])-model TemplateMeta {- id String @id @default(cuid())- subject String?- message String?- timezone String? @default("Etc/UTC") @db.Text- password String?- dateFormat String? @default("yyyy-MM-dd hh:mm a") @db.Text- signingOrder DocumentSigningOrder? @default(PARALLEL)- allowDictateNextSigner Boolean @default(false)- distributionMethod DocumentDistributionMethod @default(EMAIL)-- typedSignatureEnabled Boolean @default(true)- uploadSignatureEnabled Boolean @default(true)- drawSignatureEnabled Boolean @default(true)-- templateId Int @unique- template Template @relation(fields: [templateId], references: [id], onDelete: Cascade)- redirectUrl String?- language String @default("en")-- emailSettings Json? /// [DocumentEmailSettings] @zod.custom.use(ZDocumentEmailSettingsSchema)- emailReplyTo String?- emailId String?-}--/// @zod.import(["import { ZDocumentAuthOptionsSchema } from '@documenso/lib/types/document-auth';"])-model Template {- id Int @id @default(autoincrement())- externalId String?- type TemplateType @default(PRIVATE)- title String- visibility DocumentVisibility @default(EVERYONE)- authOptions Json? /// [DocumentAuthOptions] @zod.custom.use(ZDocumentAuthOptionsSchema)- templateMeta TemplateMeta?- templateDocumentDataId String- createdAt DateTime @default(now())- updatedAt DateTime @default(now()) @updatedAt- publicTitle String @default("")- publicDescription String @default("")-- useLegacyFieldInsertion Boolean @default(false)-- userId Int- user User @relation(fields: [userId], references: [id], onDelete: Cascade)-- teamId Int- team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)-- templateDocumentData DocumentData @relation(fields: [templateDocumentDataId], references: [id], onDelete: Cascade)-- recipients Recipient[]- fields Field[]- directLink TemplateDirectLink?- documents Document[]-- folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)- folderId String?-- @@unique([templateDocumentDataId])- @@index([userId])-}-model TemplateDirectLink {id String @id @unique @default(cuid())- templateId Int @unique+ envelopeId String @uniquetoken String @uniquecreatedAt DateTime @default(now())enabled BooleandirectTemplateRecipientId Int- template Template @relation(fields: [templateId], references: [id], onDelete: Cascade)+ envelope Envelope @relation(fields: [envelopeId], references: [id], onDelete: Cascade)}model SiteSettings {@@ -1048,3 +1008,8 @@ model OrganisationAuthenticationPortal {autoProvisionUsers Boolean @default(true)allowedDomains String[] @default([])}++model Counter {+ id String @id+ value Int+}diff --git a/packages/prisma/seed/documents.ts b/packages/prisma/seed/documents.tsindex 8184b2718..a681a2e93 100644--- a/packages/prisma/seed/documents.ts+++ b/packages/prisma/seed/documents.ts@@ -1,17 +1,19 @@-import type { Document, Team, User } from '@prisma/client';+import type { Team, User } from '@prisma/client';import { nanoid } from 'nanoid';import fs from 'node:fs';import path from 'node:path';import { match } from 'ts-pattern';-import { createDocument } from '@documenso/lib/server-only/document/create-document';-import { createTemplate } from '@documenso/lib/server-only/template/create-template';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';+import { incrementDocumentId } from '@documenso/lib/server-only/envelope/increment-id';+import { prefixedId } from '@documenso/lib/universal/id';import { prisma } from '..';import {DocumentDataType,DocumentSource,DocumentStatus,+ EnvelopeType,FieldType,Prisma,ReadStatus,@@ -30,7 +32,7 @@ type DocumentToSeed = {teamId: number;recipients: (User | string)[];type: DocumentStatus;- documentOptions?: Partial<Prisma.DocumentUncheckedCreateInput>;+ documentOptions?: Partial<Prisma.EnvelopeUncheckedCreateInput>;};export const seedDocuments = async (documents: DocumentToSeed[]) => {@@ -75,27 +77,37 @@ export const seedBlankDocument = async (},});- return await prisma.document.create({+ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ const documentId = await incrementDocumentId();++ return await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: documentId.formattedDocumentId,+ internalVersion: 1,+ type: EnvelopeType.DOCUMENT,+ documentMetaId: documentMeta.id,source: DocumentSource.DOCUMENT,teamId,title: `[TEST] Document ${key} - Draft`,status: DocumentStatus.DRAFT,- documentDataId: documentData.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `[TEST] Document ${key} - Draft`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: owner.id,...createDocumentOptions,},});};-export const unseedDocument = async (documentId: number) => {- await prisma.document.delete({- where: {- id: documentId,- },- });-};-export const seedTeamDocumentWithMeta = async (team: Team) => {const documentData = await prisma.documentData.create({data: {@@ -120,11 +132,20 @@ export const seedTeamDocumentWithMeta = async (team: Team) => {const ownerUser = organisation.owner;- const document = await createDocument({+ const document = await createEnvelope({userId: ownerUser.id,teamId: team.id,- title: `[TEST] Document ${nanoid(8)} - Draft`,- documentDataId: documentData.id,+ internalVersion: 1,+ data: {+ type: EnvelopeType.DOCUMENT,+ title: `[TEST] Document ${nanoid(8)} - Draft`,+ envelopeItems: [+ {+ title: `[TEST] Document ${nanoid(8)} - Draft`,+ documentDataId: documentData.id,+ },+ ],+ },normalizePdf: true,requestMetadata: {auth: null,@@ -133,7 +154,7 @@ export const seedTeamDocumentWithMeta = async (team: Team) => {},});- await prisma.document.update({+ await prisma.envelope.update({where: {id: document.id,},@@ -151,11 +172,7 @@ export const seedTeamDocumentWithMeta = async (team: Team) => {sendStatus: SendStatus.SENT,signingStatus: SigningStatus.NOT_SIGNED,signedAt: new Date(),- document: {- connect: {- id: document.id,- },- },+ envelopeId: document.id,fields: {create: {page: 1,@@ -166,13 +183,14 @@ export const seedTeamDocumentWithMeta = async (team: Team) => {positionY: new Prisma.Decimal(1),width: new Prisma.Decimal(5),height: new Prisma.Decimal(5),- documentId: document.id,+ envelopeId: document.id,+ envelopeItemId: document.envelopeItems[0].id,},},},});- return await prisma.document.findFirstOrThrow({+ return await prisma.envelope.findFirstOrThrow({where: {id: document.id,},@@ -206,13 +224,24 @@ export const seedTeamTemplateWithMeta = async (team: Team) => {const ownerUser = organisation.owner;- const template = await createTemplate({+ const template = await createEnvelope({+ internalVersion: 1,data: {+ type: EnvelopeType.TEMPLATE,title: `[TEST] Template ${nanoid(8)} - Draft`,+ envelopeItems: [+ {+ documentDataId: documentData.id,+ },+ ],},userId: ownerUser.id,teamId: team.id,- templateDocumentDataId: documentData.id,+ requestMetadata: {+ auth: null,+ requestMetadata: {},+ source: 'app',+ },});await prisma.recipient.create({@@ -224,11 +253,7 @@ export const seedTeamTemplateWithMeta = async (team: Team) => {sendStatus: SendStatus.SENT,signingStatus: SigningStatus.NOT_SIGNED,signedAt: new Date(),- template: {- connect: {- id: template.id,- },- },+ envelopeId: template.id,fields: {create: {page: 1,@@ -239,13 +264,14 @@ export const seedTeamTemplateWithMeta = async (team: Team) => {positionY: new Prisma.Decimal(1),width: new Prisma.Decimal(5),height: new Prisma.Decimal(5),- templateId: template.id,+ envelopeId: template.id,+ envelopeItemId: template.envelopeItems[0].id,},},},});- return await prisma.document.findFirstOrThrow({+ return await prisma.envelope.findFirstOrThrow({where: {id: template.id,},@@ -271,16 +297,41 @@ export const seedDraftDocument = async (},});- const document = await prisma.document.create({+ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ const documentId = await incrementDocumentId();++ const document = await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: documentId.formattedDocumentId,+ internalVersion: 1,+ type: EnvelopeType.DOCUMENT,+ documentMetaId: documentMeta.id,source: DocumentSource.DOCUMENT,teamId,title: `[TEST] Document ${key} - Draft`,status: DocumentStatus.DRAFT,- documentDataId: documentData.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `[TEST] Document ${key} - Draft`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: sender.id,...createDocumentOptions,},+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ },});for (const recipient of recipients) {@@ -296,22 +347,19 @@ export const seedDraftDocument = async (sendStatus: SendStatus.NOT_SENT,signingStatus: SigningStatus.NOT_SIGNED,signedAt: new Date(),- document: {- connect: {- id: document.id,- },- },+ envelopeId: document.id,fields: {create: {page: 1,type: FieldType.NAME,- inserted: true,+ inserted: false,customText: name,positionX: new Prisma.Decimal(1),positionY: new Prisma.Decimal(1),width: new Prisma.Decimal(1),height: new Prisma.Decimal(1),- documentId: document.id,+ envelopeId: document.id,+ envelopeItemId: document.envelopeItems[0].id,},},},@@ -323,7 +371,7 @@ export const seedDraftDocument = async (type CreateDocumentOptions = {key?: string | number;- createDocumentOptions?: Partial<Prisma.DocumentUncheckedCreateInput>;+ createDocumentOptions?: Partial<Prisma.EnvelopeUncheckedCreateInput>;};export const seedPendingDocument = async (@@ -342,16 +390,37 @@ export const seedPendingDocument = async (},});- const document = await prisma.document.create({+ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ const documentId = await incrementDocumentId();++ const document = await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: documentId.formattedDocumentId,+ internalVersion: 1,+ type: EnvelopeType.DOCUMENT,+ documentMetaId: documentMeta.id,source: DocumentSource.DOCUMENT,teamId,title: `[TEST] Document ${key} - Pending`,status: DocumentStatus.PENDING,- documentDataId: documentData.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `[TEST] Document ${key} - Pending`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: sender.id,...createDocumentOptions,},+ include: {+ envelopeItems: true,+ },});for (const recipient of recipients) {@@ -367,11 +436,7 @@ export const seedPendingDocument = async (sendStatus: SendStatus.SENT,signingStatus: SigningStatus.NOT_SIGNED,signedAt: new Date(),- document: {- connect: {- id: document.id,- },- },+ envelopeId: document.id,fields: {create: {page: 1,@@ -382,19 +447,25 @@ export const seedPendingDocument = async (positionY: new Prisma.Decimal(1),width: new Prisma.Decimal(1),height: new Prisma.Decimal(1),- documentId: document.id,+ envelopeId: document.id,+ envelopeItemId: document.envelopeItems[0].id,},},},});}- return prisma.document.findFirstOrThrow({+ return prisma.envelope.findFirstOrThrow({where: {id: document.id,},include: {recipients: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },},});};@@ -408,9 +479,9 @@ export const seedPendingDocumentNoFields = async ({owner: User;recipients: (User | string)[];teamId: number;- updateDocumentOptions?: Partial<Prisma.DocumentUncheckedUpdateInput>;+ updateDocumentOptions?: Partial<Prisma.EnvelopeUncheckedUpdateInput>;}) => {- const document: Document = await seedBlankDocument(owner, teamId);+ const document = await seedBlankDocument(owner, teamId);for (const recipient of recipients) {const email = typeof recipient === 'string' ? recipient : recipient.email;@@ -425,18 +496,14 @@ export const seedPendingDocumentNoFields = async ({sendStatus: SendStatus.SENT,signingStatus: SigningStatus.NOT_SIGNED,signedAt: new Date(),- document: {- connect: {- id: document.id,- },- },+ envelopeId: document.id,},});}const createdRecipients = await prisma.recipient.findMany({where: {- documentId: document.id,+ envelopeId: document.id,},include: {fields: true,@@ -444,7 +511,7 @@ export const seedPendingDocumentNoFields = async ({});const latestDocument = updateDocumentOptions- ? await prisma.document.update({+ ? await prisma.envelope.update({where: {id: document.id,},@@ -468,12 +535,18 @@ export const seedPendingDocumentWithFullFields = async ({}: {owner: User;recipients: (User | string)[];- recipientsCreateOptions?: Partial<Prisma.RecipientCreateInput>[];- updateDocumentOptions?: Partial<Prisma.DocumentUncheckedUpdateInput>;+ recipientsCreateOptions?: Partial<Prisma.RecipientUncheckedCreateInput>[];+ updateDocumentOptions?: Partial<Prisma.EnvelopeUncheckedUpdateInput>;fields?: FieldType[];teamId: number;}) => {- const document: Document = await seedBlankDocument(owner, teamId);+ const document = await seedBlankDocument(owner, teamId);++ const firstItem = await prisma.envelopeItem.findFirstOrThrow({+ where: {+ envelopeId: document.id,+ },+ });for (const [recipientIndex, recipient] of recipients.entries()) {const email = typeof recipient === 'string' ? recipient : recipient.email;@@ -488,11 +561,7 @@ export const seedPendingDocumentWithFullFields = async ({sendStatus: SendStatus.SENT,signingStatus: SigningStatus.NOT_SIGNED,signedAt: new Date(),- document: {- connect: {- id: document.id,- },- },+ envelopeId: document.id,fields: {createMany: {data: fields.map((fieldType, fieldIndex) => ({@@ -504,7 +573,8 @@ export const seedPendingDocumentWithFullFields = async ({positionY: new Prisma.Decimal((fieldIndex + 1) * 5),width: new Prisma.Decimal(5),height: new Prisma.Decimal(5),- documentId: document.id,+ envelopeId: document.id,+ envelopeItemId: firstItem.id,})),},},@@ -515,14 +585,14 @@ export const seedPendingDocumentWithFullFields = async ({const createdRecipients = await prisma.recipient.findMany({where: {- documentId: document.id,+ envelopeId: document.id,},include: {fields: true,},});- const latestDocument = await prisma.document.update({+ const latestDocument = await prisma.envelope.update({where: {id: document.id,},@@ -557,16 +627,37 @@ export const seedCompletedDocument = async (},});- const document = await prisma.document.create({+ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ const documentId = await incrementDocumentId();++ const document = await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: documentId.formattedDocumentId,+ internalVersion: 1,+ type: EnvelopeType.DOCUMENT,+ documentMetaId: documentMeta.id,source: DocumentSource.DOCUMENT,teamId,title: `[TEST] Document ${key} - Completed`,status: DocumentStatus.COMPLETED,- documentDataId: documentData.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `[TEST] Document ${key} - Completed`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: sender.id,...createDocumentOptions,},+ include: {+ envelopeItems: true,+ },});for (const recipient of recipients) {@@ -582,11 +673,7 @@ export const seedCompletedDocument = async (sendStatus: SendStatus.SENT,signingStatus: SigningStatus.SIGNED,signedAt: new Date(),- document: {- connect: {- id: document.id,- },- },+ envelopeId: document.id,fields: {create: {page: 1,@@ -597,7 +684,8 @@ export const seedCompletedDocument = async (positionY: new Prisma.Decimal(1),width: new Prisma.Decimal(1),height: new Prisma.Decimal(1),- documentId: document.id,+ envelopeId: document.id,+ envelopeItemId: document.envelopeItems[0].id,},},},diff --git a/packages/prisma/seed/initial-seed.ts b/packages/prisma/seed/initial-seed.tsindex cb99ef416..3cb050bdb 100644--- a/packages/prisma/seed/initial-seed.ts+++ b/packages/prisma/seed/initial-seed.ts@@ -1,8 +1,11 @@import fs from 'node:fs';import path from 'node:path';+import { incrementDocumentId } from '@documenso/lib/server-only/envelope/increment-id';+import { prefixedId } from '@documenso/lib/universal/id';+import { prisma } from '..';-import { DocumentDataType, DocumentSource } from '../client';+import { DocumentDataType, DocumentSource, EnvelopeType } from '../client';import { seedPendingDocument } from './documents';import { seedDirectTemplate, seedTemplate } from './templates';import { seedUser } from './users';@@ -52,11 +55,29 @@ export const seedDatabase = async () => {for (let i = 1; i <= 4; i++) {const documentData = await createDocumentData({ documentData: examplePdf });- await prisma.document.create({+ const documentId = await incrementDocumentId();++ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: documentId.formattedDocumentId,+ internalVersion: 1,+ type: EnvelopeType.DOCUMENT,+ documentMetaId: documentMeta.id,source: DocumentSource.DOCUMENT,title: `Example Document ${i}`,- documentDataId: documentData.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `Example Document ${i}`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: exampleUser.user.id,teamId: exampleUser.team.id,recipients: {@@ -73,11 +94,29 @@ export const seedDatabase = async () => {for (let i = 1; i <= 4; i++) {const documentData = await createDocumentData({ documentData: examplePdf });- await prisma.document.create({+ const documentId = await incrementDocumentId();++ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: documentId.formattedDocumentId,+ internalVersion: 1,+ type: EnvelopeType.DOCUMENT,source: DocumentSource.DOCUMENT,title: `Document ${i}`,- documentDataId: documentData.id,+ documentMetaId: documentMeta.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `Document ${i}`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: adminUser.user.id,teamId: adminUser.team.id,recipients: {diff --git a/packages/prisma/seed/templates.ts b/packages/prisma/seed/templates.tsindex ebd17826b..3ea381abc 100644--- a/packages/prisma/seed/templates.ts+++ b/packages/prisma/seed/templates.ts@@ -5,10 +5,20 @@ import {DIRECT_TEMPLATE_RECIPIENT_EMAIL,DIRECT_TEMPLATE_RECIPIENT_NAME,} from '@documenso/lib/constants/direct-templates';+import { incrementTemplateId } from '@documenso/lib/server-only/envelope/increment-id';+import { prefixedId } from '@documenso/lib/universal/id';import { prisma } from '..';import type { Prisma, User } from '../client';-import { DocumentDataType, ReadStatus, RecipientRole, SendStatus, SigningStatus } from '../client';+import {+ DocumentDataType,+ DocumentSource,+ EnvelopeType,+ ReadStatus,+ RecipientRole,+ SendStatus,+ SigningStatus,+} from '../client';const examplePdf = fs.readFileSync(path.join(__dirname, '../../../assets/example.pdf'))@@ -18,12 +28,12 @@ type SeedTemplateOptions = {title?: string;userId: number;teamId: number;- createTemplateOptions?: Partial<Prisma.TemplateCreateInput>;+ createTemplateOptions?: Partial<Prisma.EnvelopeUncheckedCreateInput>;};type CreateTemplateOptions = {key?: string | number;- createTemplateOptions?: Partial<Prisma.TemplateUncheckedCreateInput>;+ createTemplateOptions?: Partial<Prisma.EnvelopeUncheckedCreateInput>;};export const seedBlankTemplate = async (@@ -41,14 +51,40 @@ export const seedBlankTemplate = async (},});- return await prisma.template.create({+ const templateId = await incrementTemplateId();++ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ return await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: templateId.formattedTemplateId,+ internalVersion: 1,+ type: EnvelopeType.TEMPLATE,title: `[TEST] Template ${key}`,teamId,- templateDocumentDataId: documentData.id,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title: `[TEST] Template ${key}`,+ documentDataId: documentData.id,+ order: 1,+ },+ },userId: owner.id,+ source: DocumentSource.TEMPLATE,+ documentMetaId: documentMeta.id,...createTemplateOptions,},+ include: {+ envelopeItems: {+ include: {+ documentData: true,+ },+ },+ },});};@@ -63,19 +99,31 @@ export const seedTemplate = async (options: SeedTemplateOptions) => {},});- return await prisma.template.create({+ const templateId = await incrementTemplateId();++ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ return await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: templateId.formattedTemplateId,+ internalVersion: 1,+ type: EnvelopeType.TEMPLATE,title,- templateDocumentData: {- connect: {- id: documentData.id,- },- },- user: {- connect: {- id: userId,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title,+ documentDataId: documentData.id,+ order: 1,},},+ source: DocumentSource.TEMPLATE,+ documentMetaId: documentMeta.id,+ userId,+ teamId,recipients: {create: {email: '[email protected]',@@ -87,9 +135,11 @@ export const seedTemplate = async (options: SeedTemplateOptions) => {role: RecipientRole.SIGNER,},},- team: {- connect: {- id: teamId,+ },+ include: {+ envelopeItems: {+ include: {+ documentData: true,},},},@@ -107,19 +157,31 @@ export const seedDirectTemplate = async (options: SeedTemplateOptions) => {},});- const template = await prisma.template.create({+ const templateId = await incrementTemplateId();++ const documentMeta = await prisma.documentMeta.create({+ data: {},+ });++ const template = await prisma.envelope.create({data: {+ id: prefixedId('envelope'),+ secondaryId: templateId.formattedTemplateId,+ internalVersion: 1,+ type: EnvelopeType.TEMPLATE,title,- templateDocumentData: {- connect: {- id: documentData.id,- },- },- user: {- connect: {- id: userId,+ envelopeItems: {+ create: {+ id: prefixedId('envelope_item'),+ title,+ documentDataId: documentData.id,+ order: 1,},},+ source: DocumentSource.TEMPLATE,+ documentMetaId: documentMeta.id,+ userId,+ teamId,recipients: {create: {email: DIRECT_TEMPLATE_RECIPIENT_EMAIL,@@ -127,11 +189,6 @@ export const seedDirectTemplate = async (options: SeedTemplateOptions) => {token: Math.random().toString().slice(2, 7),},},- team: {- connect: {- id: teamId,- },- },...options.createTemplateOptions,},include: {@@ -150,14 +207,14 @@ export const seedDirectTemplate = async (options: SeedTemplateOptions) => {await prisma.templateDirectLink.create({data: {- templateId: template.id,+ envelopeId: template.id,enabled: true,token: Math.random().toString(),directTemplateRecipientId: directTemplateRecpient.id,},});- return await prisma.template.findFirstOrThrow({+ return await prisma.envelope.findFirstOrThrow({where: {id: template.id,},@@ -166,6 +223,11 @@ export const seedDirectTemplate = async (options: SeedTemplateOptions) => {fields: true,recipients: true,team: true,+ envelopeItems: {+ select: {+ documentData: true,+ },+ },},});};diff --git a/packages/prisma/types/document-legacy-schema.ts b/packages/prisma/types/document-legacy-schema.tsnew file mode 100644index 000000000..3a72d3546--- /dev/null+++ b/packages/prisma/types/document-legacy-schema.ts@@ -0,0 +1,52 @@+/**+ * Legacy Document schema to confirm backwards API compatibility since+ * we migrated Documents to Envelopes.+ */+import { DocumentSource } from '@prisma/client';+import { z } from 'zod';++import { ZDocumentAuthOptionsSchema } from '@documenso/lib/types/document-auth';+import { ZDocumentFormValuesSchema } from '@documenso/lib/types/document-form-values';++import DocumentStatusSchema from '../generated/zod/inputTypeSchemas/DocumentStatusSchema';+import DocumentVisibilitySchema from '../generated/zod/inputTypeSchemas/DocumentVisibilitySchema';++/////////////////////////////////////////+// DOCUMENT SCHEMA+/////////////////////////////////////////++export const LegacyDocumentSchema = z.object({+ visibility: DocumentVisibilitySchema,+ status: DocumentStatusSchema,+ source: z.nativeEnum(DocumentSource),+ id: z.number(),+ qrToken: z+ .string()+ .describe('The token for viewing the document using the QR code on the certificate.')+ .nullable(),+ externalId: z+ .string()+ .describe('A custom external ID you can use to identify the document.')+ .nullable(),+ userId: z.number().describe('The ID of the user that created this document.'),+ teamId: z.number(),+ /**+ * [DocumentAuthOptions]+ */+ authOptions: ZDocumentAuthOptionsSchema.nullable(),+ /**+ * [DocumentFormValues]+ */+ formValues: ZDocumentFormValuesSchema.nullable(),+ title: z.string(),+ documentDataId: z.string(),+ createdAt: z.coerce.date(),+ updatedAt: z.coerce.date(),+ completedAt: z.coerce.date().nullable(),+ deletedAt: z.coerce.date().nullable(),+ templateId: z.number().nullable(),+ useLegacyFieldInsertion: z.boolean(),+ folderId: z.string().nullable(),+});++export type Document = z.infer<typeof LegacyDocumentSchema>;diff --git a/packages/prisma/types/document-with-recipient.ts b/packages/prisma/types/document-with-recipient.tsindex 01b0130dc..c5015a3e4 100644--- a/packages/prisma/types/document-with-recipient.ts+++ b/packages/prisma/types/document-with-recipient.ts@@ -1,10 +1,10 @@-import type { Document, DocumentData, Recipient } from '@prisma/client';+import type { DocumentData, Envelope, Recipient } from '@prisma/client';-export type DocumentWithRecipients = Document & {+export type EnvelopeWithRecipients = Envelope & {recipients: Recipient[];};-export type DocumentWithRecipient = Document & {+export type EnvelopeWithRecipient = Envelope & {recipients: Recipient[];documentData: DocumentData;};diff --git a/packages/prisma/types/template-legacy-schema.ts b/packages/prisma/types/template-legacy-schema.tsnew file mode 100644index 000000000..3e533fbea--- /dev/null+++ b/packages/prisma/types/template-legacy-schema.ts@@ -0,0 +1,40 @@+/**+ * Legacy Template schema to confirm backwards API compatibility since+ * we removed the "Template" prisma schema model.+ */+import { TemplateType } from '@prisma/client';+import { z } from 'zod';++import { ZDocumentAuthOptionsSchema } from '@documenso/lib/types/document-auth';++import { DocumentVisibilitySchema } from '../generated/zod/inputTypeSchemas/DocumentVisibilitySchema';+import TemplateDirectLinkSchema from '../generated/zod/modelSchema/TemplateDirectLinkSchema';++export const TemplateTypeSchema = z.nativeEnum(TemplateType);++export const TemplateSchema = z.object({+ type: TemplateTypeSchema,+ visibility: DocumentVisibilitySchema,+ id: z.number(),+ externalId: z.string().nullable(),+ title: z.string(),+ /**+ * [DocumentAuthOptions]+ */+ authOptions: ZDocumentAuthOptionsSchema.nullable(),+ templateDocumentDataId: z.string(),+ createdAt: z.coerce.date(),+ updatedAt: z.coerce.date(),+ publicTitle: z.string(),+ publicDescription: z.string(),+ useLegacyFieldInsertion: z.boolean(),+ userId: z.number(),+ teamId: z.number(),+ folderId: z.string().nullable(),+});++export type Template = z.infer<typeof TemplateSchema>;++export const LegacyTemplateDirectLinkSchema = TemplateDirectLinkSchema.extend({+ templateId: z.number(),+});diff --git a/packages/signing/helpers/add-signing-placeholder.ts b/packages/signing/helpers/add-signing-placeholder.tsindex 2dcf16dc4..197d7cdfc 100644--- a/packages/signing/helpers/add-signing-placeholder.ts+++ b/packages/signing/helpers/add-signing-placeholder.ts@@ -7,7 +7,7 @@ import {PDFNumber,PDFString,rectangle,-} from 'pdf-lib';+} from '@cantoo/pdf-lib';import { BYTE_RANGE_PLACEHOLDER } from '../constants/byte-range';diff --git a/packages/signing/package.json b/packages/signing/package.jsonindex be1ac92f3..4d9d4a383 100644--- a/packages/signing/package.json+++ b/packages/signing/package.json@@ -12,12 +12,11 @@"test": "vitest"},"dependencies": {- "@documenso/tsconfig": "*","@documenso/pdf-sign": "^0.1.0",- "pdf-lib": "^1.17.1",+ "@documenso/tsconfig": "*","ts-pattern": "^5.0.5"},"devDependencies": {"vitest": "^3.1.4"}-}\ No newline at end of file+}diff --git a/packages/trpc/server/admin-router/delete-document.ts b/packages/trpc/server/admin-router/delete-document.tsindex 70fc96591..83632b4e8 100644--- a/packages/trpc/server/admin-router/delete-document.ts+++ b/packages/trpc/server/admin-router/delete-document.ts@@ -1,5 +1,5 @@+import { adminSuperDeleteDocument } from '@documenso/lib/server-only/admin/admin-super-delete-document';import { sendDeleteEmail } from '@documenso/lib/server-only/document/send-delete-email';-import { superDeleteDocument } from '@documenso/lib/server-only/document/super-delete-document';import { adminProcedure } from '../trpc';import {@@ -19,10 +19,10 @@ export const deleteDocumentRoute = adminProcedure},});- await sendDeleteEmail({ documentId: id, reason });+ await sendDeleteEmail({ envelopeId: id, reason });- await superDeleteDocument({- id,+ await adminSuperDeleteDocument({+ envelopeId: id,requestMetadata: ctx.metadata.requestMetadata,});});diff --git a/packages/trpc/server/admin-router/delete-document.types.ts b/packages/trpc/server/admin-router/delete-document.types.tsindex 58ff6ff35..cf7bf6426 100644--- a/packages/trpc/server/admin-router/delete-document.types.ts+++ b/packages/trpc/server/admin-router/delete-document.types.ts@@ -1,7 +1,7 @@import { z } from 'zod';export const ZDeleteDocumentRequestSchema = z.object({- id: z.number().min(1),+ id: z.string(),reason: z.string(),});diff --git a/packages/trpc/server/admin-router/find-document-jobs.ts b/packages/trpc/server/admin-router/find-document-jobs.tsnew file mode 100644index 000000000..6e4bff526--- /dev/null+++ b/packages/trpc/server/admin-router/find-document-jobs.ts@@ -0,0 +1,72 @@+import { EnvelopeType } from '@prisma/client';++import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import type { FindResultResponse } from '@documenso/lib/types/search-params';+import {+ mapSecondaryIdToDocumentId,+ unsafeBuildEnvelopeIdQuery,+} from '@documenso/lib/utils/envelope';+import { prisma } from '@documenso/prisma';++import { adminProcedure } from '../trpc';+import {+ ZFindDocumentJobsRequestSchema,+ ZFindDocumentJobsResponseSchema,+} from './find-document-jobs.types';++export const findDocumentJobsRoute = adminProcedure+ .input(ZFindDocumentJobsRequestSchema)+ .output(ZFindDocumentJobsResponseSchema)+ .query(async ({ input }) => {+ const { envelopeId, page = 1, perPage = 5 } = input;++ const envelope = await prisma.envelope.findFirst({+ where: unsafeBuildEnvelopeIdQuery(+ {+ type: 'envelopeId',+ id: envelopeId,+ },+ EnvelopeType.DOCUMENT,+ ),+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ const [data, count] = await Promise.all([+ prisma.backgroundJob.findMany({+ where: {+ jobId: 'internal.seal-document',+ payload: {+ path: ['documentId'],+ equals: mapSecondaryIdToDocumentId(envelope.secondaryId),+ },+ },+ skip: Math.max(page - 1, 0) * perPage,+ take: perPage,+ orderBy: {+ submittedAt: 'desc',+ },+ }),+ prisma.backgroundJob.count({+ where: {+ jobId: 'internal.seal-document',+ payload: {+ path: ['documentId'],+ equals: mapSecondaryIdToDocumentId(envelope.secondaryId),+ },+ },+ }),+ ]);++ return {+ data,+ count,+ currentPage: Math.max(page, 1),+ perPage,+ totalPages: Math.ceil(count / perPage),+ } satisfies FindResultResponse<typeof data>;+ });diff --git a/packages/trpc/server/admin-router/find-document-jobs.types.ts b/packages/trpc/server/admin-router/find-document-jobs.types.tsnew file mode 100644index 000000000..8051b2756--- /dev/null+++ b/packages/trpc/server/admin-router/find-document-jobs.types.ts@@ -0,0 +1,26 @@+import { z } from 'zod';++import { ZFindResultResponse, ZFindSearchParamsSchema } from '@documenso/lib/types/search-params';+import BackgroundJobSchema from '@documenso/prisma/generated/zod/modelSchema/BackgroundJobSchema';++export const ZFindDocumentJobsRequestSchema = ZFindSearchParamsSchema.extend({+ envelopeId: z.string(),+});++export const ZFindDocumentJobsResponseSchema = ZFindResultResponse.extend({+ data: BackgroundJobSchema.pick({+ status: true,+ id: true,+ retried: true,+ maxRetries: true,+ jobId: true,+ name: true,+ version: true,+ submittedAt: true,+ updatedAt: true,+ completedAt: true,+ lastRetriedAt: true,+ }).array(),+});++export type TFindDocumentJobsResponse = z.infer<typeof ZFindDocumentJobsResponseSchema>;diff --git a/packages/trpc/server/admin-router/find-documents.ts b/packages/trpc/server/admin-router/find-documents.tsindex 7ce96c1f5..7e4610559 100644--- a/packages/trpc/server/admin-router/find-documents.ts+++ b/packages/trpc/server/admin-router/find-documents.ts@@ -1,4 +1,5 @@-import { findDocuments } from '@documenso/lib/server-only/admin/get-all-documents';+import { adminFindDocuments } from '@documenso/lib/server-only/admin/admin-find-documents';+import { mapEnvelopesToDocumentMany } from '@documenso/lib/utils/document';import { adminProcedure } from '../trpc';import { ZFindDocumentsRequestSchema, ZFindDocumentsResponseSchema } from './find-documents.types';@@ -9,5 +10,10 @@ export const findDocumentsRoute = adminProcedure.query(async ({ input }) => {const { query, page, perPage } = input;- return await findDocuments({ query, page, perPage });+ const result = await adminFindDocuments({ query, page, perPage });++ return {+ ...result,+ data: result.data.map(mapEnvelopesToDocumentMany),+ };});diff --git a/packages/trpc/server/admin-router/reseal-document.ts b/packages/trpc/server/admin-router/reseal-document.tsindex 7436d29c7..ee1884244 100644--- a/packages/trpc/server/admin-router/reseal-document.ts+++ b/packages/trpc/server/admin-router/reseal-document.ts@@ -1,6 +1,9 @@-import { getEntireDocument } from '@documenso/lib/server-only/admin/get-entire-document';-import { sealDocument } from '@documenso/lib/server-only/document/seal-document';+import { EnvelopeType } from '@prisma/client';++import { jobs } from '@documenso/lib/jobs/client';+import { unsafeGetEntireEnvelope } from '@documenso/lib/server-only/admin/get-entire-document';import { isDocumentCompleted } from '@documenso/lib/utils/document';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { adminProcedure } from '../trpc';import {@@ -20,9 +23,21 @@ export const resealDocumentRoute = adminProcedure},});- const document = await getEntireDocument({ id });+ const envelope = await unsafeGetEntireEnvelope({+ id: {+ type: 'envelopeId',+ id,+ },+ type: EnvelopeType.DOCUMENT,+ });- const isResealing = isDocumentCompleted(document.status);+ const isResealing = isDocumentCompleted(envelope.status);- await sealDocument({ documentId: id, isResealing });+ await jobs.triggerJob({+ name: 'internal.seal-document',+ payload: {+ documentId: mapSecondaryIdToDocumentId(envelope.secondaryId),+ isResealing,+ },+ });});diff --git a/packages/trpc/server/admin-router/reseal-document.types.ts b/packages/trpc/server/admin-router/reseal-document.types.tsindex e33c2dc5c..b673789af 100644--- a/packages/trpc/server/admin-router/reseal-document.types.ts+++ b/packages/trpc/server/admin-router/reseal-document.types.ts@@ -1,7 +1,7 @@import { z } from 'zod';export const ZResealDocumentRequestSchema = z.object({- id: z.number().min(1),+ id: z.string(),});export const ZResealDocumentResponseSchema = z.void();diff --git a/packages/trpc/server/admin-router/router.ts b/packages/trpc/server/admin-router/router.tsindex 541542097..c3d2c9b81 100644--- a/packages/trpc/server/admin-router/router.ts+++ b/packages/trpc/server/admin-router/router.ts@@ -8,6 +8,7 @@ import { deleteUserRoute } from './delete-user';import { disableUserRoute } from './disable-user';import { enableUserRoute } from './enable-user';import { findAdminOrganisationsRoute } from './find-admin-organisations';+import { findDocumentJobsRoute } from './find-document-jobs';import { findDocumentsRoute } from './find-documents';import { findSubscriptionClaimsRoute } from './find-subscription-claims';import { getAdminOrganisationRoute } from './get-admin-organisation';@@ -52,6 +53,7 @@ export const adminRouter = router({find: findDocumentsRoute,delete: deleteDocumentRoute,reseal: resealDocumentRoute,+ findJobs: findDocumentJobsRoute,},recipient: {update: updateRecipientRoute,diff --git a/packages/trpc/server/document-router/access-auth-request-2fa-email.ts b/packages/trpc/server/document-router/access-auth-request-2fa-email.tsindex 849636a0f..9fcd12f28 100644--- a/packages/trpc/server/document-router/access-auth-request-2fa-email.ts+++ b/packages/trpc/server/document-router/access-auth-request-2fa-email.ts@@ -1,3 +1,4 @@+import { EnvelopeType } from '@prisma/client';import { TRPCError } from '@trpc/server';import { DateTime } from 'luxon';@@ -23,8 +24,9 @@ export const accessAuthRequest2FAEmailRoute = procedureconst user = ctx.user;// Get document and recipient by token- const document = await prisma.document.findFirst({+ const envelope = await prisma.envelope.findFirst({where: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {token,@@ -40,17 +42,17 @@ export const accessAuthRequest2FAEmailRoute = procedure},});- if (!document) {+ if (!envelope) {throw new TRPCError({code: 'NOT_FOUND',message: 'Document not found',});}- const [recipient] = document.recipients;+ const [recipient] = envelope.recipients;const { derivedRecipientAccessAuth } = extractDocumentAuthMethods({- documentAuth: document.authOptions,+ documentAuth: envelope.authOptions,recipientAuth: recipient.authOptions,});@@ -72,7 +74,7 @@ export const accessAuthRequest2FAEmailRoute = procedureawait send2FATokenEmail({token,- documentId: document.id,+ envelopeId: envelope.id,});return {diff --git a/packages/trpc/server/document-router/create-document-temporary.ts b/packages/trpc/server/document-router/create-document-temporary.tsindex fdc64f1d6..219b7f286 100644--- a/packages/trpc/server/document-router/create-document-temporary.ts+++ b/packages/trpc/server/document-router/create-document-temporary.ts@@ -1,10 +1,12 @@-import { DocumentDataType } from '@prisma/client';+import { DocumentDataType, EnvelopeType } from '@prisma/client';import { getServerLimits } from '@documenso/ee/server-only/limits/server';import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { createDocumentData } from '@documenso/lib/server-only/document-data/create-document-data';-import { createDocumentV2 } from '@documenso/lib/server-only/document/create-document-v2';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';import { getPresignPostUrl } from '@documenso/lib/universal/upload/server-actions';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';+import { prisma } from '@documenso/prisma';import { authenticatedProcedure } from '../trpc';import {@@ -55,27 +57,82 @@ export const createDocumentTemporaryRoute = authenticatedProceduretype: DocumentDataType.S3_PATH,});- const createdDocument = await createDocumentV2({+ const createdEnvelope = await createEnvelope({userId: ctx.user.id,teamId,- documentDataId: documentData.id,normalizePdf: false, // Not normalizing because of presigned URL.+ internalVersion: 1,data: {+ type: EnvelopeType.DOCUMENT,title,externalId,visibility,globalAccessAuth,globalActionAuth,- recipients,+ recipients: (recipients || []).map((recipient) => ({+ ...recipient,+ fields: (recipient.fields || []).map((field) => ({+ ...field,+ page: field.pageNumber,+ positionX: field.pageX,+ positionY: field.pageY,+ documentDataId: documentData.id,+ })),+ })),folderId,+ envelopeItems: [+ {+ documentDataId: documentData.id,+ },+ ],},meta,requestMetadata: ctx.metadata,});+ const envelopeItems = await prisma.envelopeItem.findMany({+ where: {+ envelopeId: createdEnvelope.id,+ },+ include: {+ documentData: true,+ },+ });++ const legacyDocumentId = mapSecondaryIdToDocumentId(createdEnvelope.secondaryId);++ const firstDocumentData = envelopeItems[0].documentData;++ if (!firstDocumentData) {+ throw new Error('Document data not found');+ }+return {- document: createdDocument,- folder: createdDocument.folder, // Todo: Remove this prior to api-v2 release.+ document: {+ ...createdEnvelope,+ envelopeId: createdEnvelope.id,+ documentDataId: firstDocumentData.id,+ documentData: {+ ...firstDocumentData,+ envelopeItemId: envelopeItems[0].id,+ },+ documentMeta: {+ ...createdEnvelope.documentMeta,+ documentId: legacyDocumentId,+ },+ id: legacyDocumentId,+ fields: createdEnvelope.fields.map((field) => ({+ ...field,+ documentId: legacyDocumentId,+ templateId: null,+ })),+ recipients: createdEnvelope.recipients.map((recipient) => ({+ ...recipient,+ documentId: legacyDocumentId,+ templateId: null,+ })),+ },+ folder: createdEnvelope.folder, // Todo: Remove this prior to api-v2 release.uploadUrl: url,};});diff --git a/packages/trpc/server/document-router/create-document-temporary.types.ts b/packages/trpc/server/document-router/create-document-temporary.types.tsindex f7c15ee42..5223adbfb 100644--- a/packages/trpc/server/document-router/create-document-temporary.types.ts+++ b/packages/trpc/server/document-router/create-document-temporary.types.ts@@ -1,4 +1,3 @@-import { DocumentSigningOrder } from '@prisma/client';import { z } from 'zod';import { ZDocumentSchema } from '@documenso/lib/types/document';@@ -6,8 +5,8 @@ import {ZDocumentAccessAuthTypesSchema,ZDocumentActionAuthTypesSchema,} from '@documenso/lib/types/document-auth';-import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';import { ZDocumentFormValuesSchema } from '@documenso/lib/types/document-form-values';+import { ZDocumentMetaCreateSchema } from '@documenso/lib/types/document-meta';import {ZFieldHeightSchema,ZFieldPageNumberSchema,@@ -21,16 +20,6 @@ import { ZCreateRecipientSchema } from '../recipient-router/schema';import type { TrpcRouteMeta } from '../trpc';import {ZDocumentExternalIdSchema,- ZDocumentMetaDateFormatSchema,- ZDocumentMetaDistributionMethodSchema,- ZDocumentMetaDrawSignatureEnabledSchema,- ZDocumentMetaLanguageSchema,- ZDocumentMetaMessageSchema,- ZDocumentMetaRedirectUrlSchema,- ZDocumentMetaSubjectSchema,- ZDocumentMetaTimezoneSchema,- ZDocumentMetaTypedSignatureEnabledSchema,- ZDocumentMetaUploadSignatureEnabledSchema,ZDocumentTitleSchema,ZDocumentVisibilitySchema,} from './schema';@@ -80,22 +69,7 @@ export const ZCreateDocumentTemporaryRequestSchema = z.object({).optional(),- meta: z- .object({- subject: ZDocumentMetaSubjectSchema.optional(),- message: ZDocumentMetaMessageSchema.optional(),- timezone: ZDocumentMetaTimezoneSchema.optional(),- dateFormat: ZDocumentMetaDateFormatSchema.optional(),- distributionMethod: ZDocumentMetaDistributionMethodSchema.optional(),- signingOrder: z.nativeEnum(DocumentSigningOrder).optional(),- redirectUrl: ZDocumentMetaRedirectUrlSchema.optional(),- language: ZDocumentMetaLanguageSchema.optional(),- typedSignatureEnabled: ZDocumentMetaTypedSignatureEnabledSchema.optional(),- drawSignatureEnabled: ZDocumentMetaDrawSignatureEnabledSchema.optional(),- uploadSignatureEnabled: ZDocumentMetaUploadSignatureEnabledSchema.optional(),- emailSettings: ZDocumentEmailSettingsSchema.optional(),- })- .optional(),+ meta: ZDocumentMetaCreateSchema.optional(),});export const ZCreateDocumentTemporaryResponseSchema = z.object({diff --git a/packages/trpc/server/document-router/create-document.ts b/packages/trpc/server/document-router/create-document.tsindex bf66f93d3..71e1b2594 100644--- a/packages/trpc/server/document-router/create-document.ts+++ b/packages/trpc/server/document-router/create-document.ts@@ -1,6 +1,9 @@+import { EnvelopeType } from '@prisma/client';+import { getServerLimits } from '@documenso/ee/server-only/limits/server';import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { createDocument } from '@documenso/lib/server-only/document/create-document';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { authenticatedProcedure } from '../trpc';import {@@ -9,7 +12,7 @@ import {} from './create-document.types';export const createDocumentRoute = authenticatedProcedure- .input(ZCreateDocumentRequestSchema)+ .input(ZCreateDocumentRequestSchema) // Note: Before releasing this to public, update the response schema to be correct..output(ZCreateDocumentResponseSchema).mutation(async ({ input, ctx }) => {const { user, teamId } = ctx;@@ -30,18 +33,26 @@ export const createDocumentRoute = authenticatedProcedure});}- const document = await createDocument({+ const document = await createEnvelope({userId: user.id,teamId,- title,- documentDataId,+ internalVersion: 1,+ data: {+ type: EnvelopeType.DOCUMENT,+ title,+ userTimezone: timezone,+ folderId,+ envelopeItems: [+ {+ documentDataId,+ },+ ],+ },normalizePdf: true,- userTimezone: timezone,requestMetadata: ctx.metadata,- folderId,});return {- id: document.id,+ legacyDocumentId: mapSecondaryIdToDocumentId(document.secondaryId),};});diff --git a/packages/trpc/server/document-router/create-document.types.ts b/packages/trpc/server/document-router/create-document.types.tsindex 4dfc89dce..7c42e9286 100644--- a/packages/trpc/server/document-router/create-document.types.ts+++ b/packages/trpc/server/document-router/create-document.types.ts@@ -1,6 +1,8 @@import { z } from 'zod';-import { ZDocumentMetaTimezoneSchema, ZDocumentTitleSchema } from './schema';+import { ZDocumentMetaTimezoneSchema } from '@documenso/lib/types/document-meta';++import { ZDocumentTitleSchema } from './schema';// Currently not in use until we allow passthrough documents on create.// export const createDocumentMeta: TrpcRouteMeta = {@@ -20,7 +22,7 @@ export const ZCreateDocumentRequestSchema = z.object({});export const ZCreateDocumentResponseSchema = z.object({- id: z.number(),+ legacyDocumentId: z.number(),});export type TCreateDocumentRequest = z.infer<typeof ZCreateDocumentRequestSchema>;diff --git a/packages/trpc/server/document-router/delete-document.ts b/packages/trpc/server/document-router/delete-document.tsindex 659ff0394..4a0f30c08 100644--- a/packages/trpc/server/document-router/delete-document.ts+++ b/packages/trpc/server/document-router/delete-document.ts@@ -25,7 +25,10 @@ export const deleteDocumentRoute = authenticatedProcedureconst userId = ctx.user.id;await deleteDocument({- id: documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },userId,teamId,requestMetadata: ctx.metadata,diff --git a/packages/trpc/server/document-router/distribute-document.ts b/packages/trpc/server/document-router/distribute-document.tsindex 00fe8ef92..79bce76e2 100644--- a/packages/trpc/server/document-router/distribute-document.ts+++ b/packages/trpc/server/document-router/distribute-document.ts@@ -1,5 +1,6 @@-import { upsertDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';+import { updateDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';import { sendDocument } from '@documenso/lib/server-only/document/send-document';+import { mapEnvelopeToDocumentLite } from '@documenso/lib/utils/document';import { authenticatedProcedure } from '../trpc';import {@@ -23,10 +24,13 @@ export const distributeDocumentRoute = authenticatedProcedure});if (Object.values(meta).length > 0) {- await upsertDocumentMeta({+ await updateDocumentMeta({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },subject: meta.subject,message: meta.message,dateFormat: meta.dateFormat,@@ -41,10 +45,15 @@ export const distributeDocumentRoute = authenticatedProcedure});}- return await sendDocument({+ const envelope = await sendDocument({userId: ctx.user.id,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },teamId,requestMetadata: ctx.metadata,});++ return mapEnvelopeToDocumentLite(envelope);});diff --git a/packages/trpc/server/document-router/distribute-document.types.ts b/packages/trpc/server/document-router/distribute-document.types.tsindex 41bf23eb2..676011575 100644--- a/packages/trpc/server/document-router/distribute-document.types.ts+++ b/packages/trpc/server/document-router/distribute-document.types.ts@@ -2,8 +2,6 @@ import { z } from 'zod';import { ZDocumentLiteSchema } from '@documenso/lib/types/document';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';--import type { TrpcRouteMeta } from '../trpc';import {ZDocumentMetaDateFormatSchema,ZDocumentMetaDistributionMethodSchema,@@ -12,7 +10,9 @@ import {ZDocumentMetaRedirectUrlSchema,ZDocumentMetaSubjectSchema,ZDocumentMetaTimezoneSchema,-} from './schema';+} from '@documenso/lib/types/document-meta';++import type { TrpcRouteMeta } from '../trpc';export const distributeDocumentMeta: TrpcRouteMeta = {openapi: {diff --git a/packages/trpc/server/document-router/download-document-audit-logs.ts b/packages/trpc/server/document-router/download-document-audit-logs.tsindex af84c43e0..7ce76049e 100644--- a/packages/trpc/server/document-router/download-document-audit-logs.ts+++ b/packages/trpc/server/document-router/download-document-audit-logs.ts@@ -1,9 +1,11 @@+import { EnvelopeType } from '@prisma/client';import { DateTime } from 'luxon';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { encryptSecondaryData } from '@documenso/lib/server-only/crypto/encrypt';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { authenticatedProcedure } from '../trpc';import {@@ -24,20 +26,24 @@ export const downloadDocumentAuditLogsRoute = authenticatedProcedure},});- const document = await getDocumentById({- documentId,+ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,userId: ctx.user.id,teamId,}).catch(() => null);- if (!document || (teamId && document.teamId !== teamId)) {+ if (!envelope) {throw new AppError(AppErrorCode.UNAUTHORIZED, {message: 'You do not have access to this document.',});}const encrypted = encryptSecondaryData({- data: document.id.toString(),+ data: mapSecondaryIdToDocumentId(envelope.secondaryId).toString(),expiresAt: DateTime.now().plus({ minutes: 5 }).toJSDate().valueOf(),});diff --git a/packages/trpc/server/document-router/download-document-certificate.ts b/packages/trpc/server/document-router/download-document-certificate.tsindex b59eafbf0..e81ec5082 100644--- a/packages/trpc/server/document-router/download-document-certificate.ts+++ b/packages/trpc/server/document-router/download-document-certificate.ts@@ -1,10 +1,12 @@+import { EnvelopeType } from '@prisma/client';import { DateTime } from 'luxon';import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';import { AppError } from '@documenso/lib/errors/app-error';import { encryptSecondaryData } from '@documenso/lib/server-only/crypto/encrypt';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { isDocumentCompleted } from '@documenso/lib/utils/document';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { authenticatedProcedure } from '../trpc';import {@@ -25,18 +27,22 @@ export const downloadDocumentCertificateRoute = authenticatedProcedure},});- const document = await getDocumentById({- documentId,+ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,userId: ctx.user.id,teamId,});- if (!isDocumentCompleted(document.status)) {+ if (!isDocumentCompleted(envelope.status)) {throw new AppError('DOCUMENT_NOT_COMPLETE');}const encrypted = encryptSecondaryData({- data: document.id.toString(),+ data: mapSecondaryIdToDocumentId(envelope.secondaryId).toString(),expiresAt: DateTime.now().plus({ minutes: 5 }).toJSDate().valueOf(),});diff --git a/packages/trpc/server/document-router/download-document.ts b/packages/trpc/server/document-router/download-document.tsindex a0cbbf104..c7e0f02c7 100644--- a/packages/trpc/server/document-router/download-document.ts+++ b/packages/trpc/server/document-router/download-document.ts@@ -1,7 +1,8 @@-import { DocumentDataType } from '@prisma/client';+import type { DocumentData } from '@prisma/client';+import { DocumentDataType, EnvelopeType } from '@prisma/client';import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';import { getPresignGetUrl } from '@documenso/lib/universal/upload/server-actions';import { isDocumentCompleted } from '@documenso/lib/utils/document';@@ -27,45 +28,51 @@ export const downloadDocumentRoute = authenticatedProcedure},});+ const envelope = await getEnvelopeById({+ id: {+ type: 'documentId',+ id: documentId,+ },+ type: EnvelopeType.DOCUMENT,+ userId: user.id,+ teamId,+ });++ // This error is done AFTER the get envelope so we can test access controls without S3.if (process.env.NEXT_PUBLIC_UPLOAD_TRANSPORT !== 's3') {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document downloads are only available when S3 storage is configured.',});}- const document = await getDocumentById({- documentId,- userId: user.id,- teamId,- });+ const documentData: DocumentData | undefined = envelope.envelopeItems[0]?.documentData;- if (!document.documentData) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Document data not found',+ if (envelope.envelopeItems.length !== 1 || !documentData) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message:+ 'This endpoint only supports documents with a single item. Use envelopes API instead.',});}- if (document.documentData.type !== DocumentDataType.S3_PATH) {+ if (documentData.type !== DocumentDataType.S3_PATH) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document is not stored in S3 and cannot be downloaded via URL.',});}- if (version === 'signed' && !isDocumentCompleted(document.status)) {+ if (version === 'signed' && !isDocumentCompleted(envelope.status)) {throw new AppError(AppErrorCode.INVALID_REQUEST, {message: 'Document is not completed yet.',});}try {- const documentData =- version === 'original'- ? document.documentData.initialData || document.documentData.data- : document.documentData.data;+ const data =+ version === 'original' ? documentData.initialData || documentData.data : documentData.data;- const { url } = await getPresignGetUrl(documentData);+ const { url } = await getPresignGetUrl(data);- const baseTitle = document.title.replace(/\.pdf$/, '');+ const baseTitle = envelope.title.replace(/\.pdf$/, '');const suffix = version === 'signed' ? '_signed.pdf' : '.pdf';const filename = `${baseTitle}${suffix}`;diff --git a/packages/trpc/server/document-router/duplicate-document.ts b/packages/trpc/server/document-router/duplicate-document.tsindex be8f29d03..acfb2fa53 100644--- a/packages/trpc/server/document-router/duplicate-document.ts+++ b/packages/trpc/server/document-router/duplicate-document.ts@@ -1,4 +1,4 @@-import { duplicateDocument } from '@documenso/lib/server-only/document/duplicate-document-by-id';+import { duplicateEnvelope } from '@documenso/lib/server-only/envelope/duplicate-envelope';import { authenticatedProcedure } from '../trpc';import {@@ -21,9 +21,17 @@ export const duplicateDocumentRoute = authenticatedProcedure},});- return await duplicateDocument({+ const duplicatedEnvelope = await duplicateEnvelope({+ id: {+ type: 'documentId',+ id: documentId,+ },userId: user.id,teamId,- documentId,});++ return {+ id: duplicatedEnvelope.id,+ documentId: duplicatedEnvelope.legacyId.id,+ };});diff --git a/packages/trpc/server/document-router/duplicate-document.types.ts b/packages/trpc/server/document-router/duplicate-document.types.tsindex e77bccc73..7f33b44c4 100644--- a/packages/trpc/server/document-router/duplicate-document.types.ts+++ b/packages/trpc/server/document-router/duplicate-document.types.ts@@ -16,7 +16,8 @@ export const ZDuplicateDocumentRequestSchema = z.object({});export const ZDuplicateDocumentResponseSchema = z.object({- documentId: z.number(),+ id: z.string().describe('The envelope ID'),+ documentId: z.number().describe('The legacy document ID'),});export type TDuplicateDocumentRequest = z.infer<typeof ZDuplicateDocumentRequestSchema>;diff --git a/packages/trpc/server/document-router/find-documents-internal.ts b/packages/trpc/server/document-router/find-documents-internal.tsindex 47748771b..2dfb38254 100644--- a/packages/trpc/server/document-router/find-documents-internal.ts+++ b/packages/trpc/server/document-router/find-documents-internal.ts@@ -2,6 +2,7 @@ import { findDocuments } from '@documenso/lib/server-only/document/find-documentimport type { GetStatsInput } from '@documenso/lib/server-only/document/get-stats';import { getStats } from '@documenso/lib/server-only/document/get-stats';import { getTeamById } from '@documenso/lib/server-only/team/get-team';+import { mapEnvelopesToDocumentMany } from '@documenso/lib/utils/document';import { authenticatedProcedure } from '../trpc';import {@@ -69,6 +70,7 @@ export const findDocumentsInternalRoute = authenticatedProcedurereturn {...documents,+ data: documents.data.map((envelope) => mapEnvelopesToDocumentMany(envelope)),stats,};});diff --git a/packages/trpc/server/document-router/find-documents.ts b/packages/trpc/server/document-router/find-documents.tsindex 71684b326..d7b0be598 100644--- a/packages/trpc/server/document-router/find-documents.ts+++ b/packages/trpc/server/document-router/find-documents.ts@@ -1,4 +1,5 @@import { findDocuments } from '@documenso/lib/server-only/document/find-documents';+import { mapEnvelopesToDocumentMany } from '@documenso/lib/utils/document';import { authenticatedProcedure } from '../trpc';import {@@ -39,5 +40,8 @@ export const findDocumentsRoute = authenticatedProcedureorderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,});- return documents;+ return {+ ...documents,+ data: documents.data.map((envelope) => mapEnvelopesToDocumentMany(envelope)),+ };});diff --git a/packages/trpc/server/document-router/find-inbox.ts b/packages/trpc/server/document-router/find-inbox.tsindex a13ef2ad2..fd1177f07 100644--- a/packages/trpc/server/document-router/find-inbox.ts+++ b/packages/trpc/server/document-router/find-inbox.ts@@ -1,7 +1,8 @@-import type { Document, Prisma } from '@prisma/client';-import { DocumentStatus, RecipientRole } from '@prisma/client';+import type { Envelope, Prisma } from '@prisma/client';+import { DocumentStatus, EnvelopeType, RecipientRole } from '@prisma/client';import type { FindResultResponse } from '@documenso/lib/types/search-params';+import { mapEnvelopesToDocumentMany } from '@documenso/lib/utils/document';import { maskRecipientTokensForDocument } from '@documenso/lib/utils/mask-recipient-tokens-for-document';import { prisma } from '@documenso/prisma';@@ -16,11 +17,16 @@ export const findInboxRoute = authenticatedProcedureconst userId = ctx.user.id;- return await findInbox({+ const envelopes = await findInbox({userId,page,perPage,});++ return {+ ...envelopes,+ data: envelopes.data.map(mapEnvelopesToDocumentMany),+ };});export type FindInboxOptions = {@@ -28,7 +34,7 @@ export type FindInboxOptions = {page?: number;perPage?: number;orderBy?: {- column: keyof Omit<Document, 'document'>;+ column: keyof Omit<Envelope, 'envelope'>;direction: 'asc' | 'desc';};};@@ -38,12 +44,17 @@ export const findInbox = async ({ userId, page = 1, perPage = 10, orderBy }: Finwhere: {id: userId,},+ select: {+ id: true,+ email: true,+ },});const orderByColumn = orderBy?.column ?? 'createdAt';const orderByDirection = orderBy?.direction ?? 'desc';- const whereClause: Prisma.DocumentWhereInput = {+ const whereClause: Prisma.EnvelopeWhereInput = {+ type: EnvelopeType.DOCUMENT,status: {not: DocumentStatus.DRAFT,},@@ -59,7 +70,7 @@ export const findInbox = async ({ userId, page = 1, perPage = 10, orderBy }: Fin};const [data, count] = await Promise.all([- prisma.document.findMany({+ prisma.envelope.findMany({where: whereClause,skip: Math.max(page - 1, 0) * perPage,take: perPage,@@ -83,7 +94,7 @@ export const findInbox = async ({ userId, page = 1, perPage = 10, orderBy }: Fin},},}),- prisma.document.count({+ prisma.envelope.count({where: whereClause,}),]);diff --git a/packages/trpc/server/document-router/get-document-by-token.ts b/packages/trpc/server/document-router/get-document-by-token.tsindex b640f6946..60a91e1cd 100644--- a/packages/trpc/server/document-router/get-document-by-token.ts+++ b/packages/trpc/server/document-router/get-document-by-token.ts@@ -1,3 +1,5 @@+import { EnvelopeType } from '@prisma/client';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { prisma } from '@documenso/prisma';@@ -13,8 +15,9 @@ export const getDocumentByTokenRoute = authenticatedProcedure.query(async ({ input, ctx }) => {const { token } = input;- const document = await prisma.document.findFirst({+ const envelope = await prisma.envelope.findFirst({where: {+ type: EnvelopeType.DOCUMENT,recipients: {some: {token,@@ -23,21 +26,33 @@ export const getDocumentByTokenRoute = authenticatedProcedure},},include: {- documentData: true,+ envelopeItems: {+ include: {+ documentData: true,+ },+ },},});- if (!document) {+ const firstDocumentData = envelope?.envelopeItems[0].documentData;++ if (!envelope || !firstDocumentData) {throw new AppError(AppErrorCode.NOT_FOUND, {message: 'Document not found',});}+ if (envelope.envelopeItems.length !== 1) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'This endpoint does not support multiple items',+ });+ }+ctx.logger.info({- documentId: document.id,+ documentId: envelope.id,});return {- documentData: document.documentData,+ documentData: firstDocumentData,};});diff --git a/packages/trpc/server/document-router/get-document.ts b/packages/trpc/server/document-router/get-document.tsindex 4dad5291f..38a7ad851 100644--- a/packages/trpc/server/document-router/get-document.ts+++ b/packages/trpc/server/document-router/get-document.ts@@ -24,6 +24,9 @@ export const getDocumentRoute = authenticatedProcedurereturn await getDocumentWithDetailsById({userId: user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },});});diff --git a/packages/trpc/server/document-router/get-inbox-count.ts b/packages/trpc/server/document-router/get-inbox-count.tsindex f6b7ef0e2..027ac0410 100644--- a/packages/trpc/server/document-router/get-inbox-count.ts+++ b/packages/trpc/server/document-router/get-inbox-count.ts@@ -1,4 +1,4 @@-import { DocumentStatus, RecipientRole } from '@prisma/client';+import { DocumentStatus, EnvelopeType, RecipientRole } from '@prisma/client';import { prisma } from '@documenso/prisma';@@ -20,7 +20,8 @@ export const getInboxCountRoute = authenticatedProcedurerole: {not: RecipientRole.CC,},- document: {+ envelope: {+ type: EnvelopeType.DOCUMENT,status: {not: DocumentStatus.DRAFT,},diff --git a/packages/trpc/server/document-router/redistribute-document.ts b/packages/trpc/server/document-router/redistribute-document.tsindex 6bc06e189..c925bca6c 100644--- a/packages/trpc/server/document-router/redistribute-document.ts+++ b/packages/trpc/server/document-router/redistribute-document.ts@@ -26,7 +26,10 @@ export const redistributeDocumentRoute = authenticatedProcedureawait resendDocument({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients,requestMetadata: ctx.metadata,});diff --git a/packages/trpc/server/document-router/router.ts b/packages/trpc/server/document-router/router.tsindex 8e2e453bd..d49037f8c 100644--- a/packages/trpc/server/document-router/router.ts+++ b/packages/trpc/server/document-router/router.ts@@ -17,6 +17,7 @@ import { getDocumentByTokenRoute } from './get-document-by-token';import { getInboxCountRoute } from './get-inbox-count';import { redistributeDocumentRoute } from './redistribute-document';import { searchDocumentRoute } from './search-document';+import { shareDocumentRoute } from './share-document';import { updateDocumentRoute } from './update-document';export const documentRouter = router({@@ -30,6 +31,7 @@ export const documentRouter = router({distribute: distributeDocumentRoute,redistribute: redistributeDocumentRoute,search: searchDocumentRoute,+ share: shareDocumentRoute,// Temporary v2 beta routes to be removed once V2 is fully released.download: downloadDocumentRoute,diff --git a/packages/trpc/server/document-router/schema.ts b/packages/trpc/server/document-router/schema.tsindex c6f76bf0d..429ca7af1 100644--- a/packages/trpc/server/document-router/schema.ts+++ b/packages/trpc/server/document-router/schema.ts@@ -1,10 +1,6 @@-import { DocumentDistributionMethod, DocumentVisibility } from '@prisma/client';+import { DocumentVisibility } from '@prisma/client';import { z } from 'zod';-import { VALID_DATE_FORMAT_VALUES } from '@documenso/lib/constants/date-formats';-import { SUPPORTED_LANGUAGE_CODES } from '@documenso/lib/constants/i18n';-import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';-/*** Required for empty responses since we currently can't 201 requests for our openapi setup.*@@ -34,58 +30,3 @@ export const ZDocumentExternalIdSchema = zexport const ZDocumentVisibilitySchema = z.nativeEnum(DocumentVisibility).describe('The visibility of the document.');--export const ZDocumentMetaTimezoneSchema = z- .string()- .describe(- 'The timezone to use for date fields and signing the document. Example Etc/UTC, Australia/Melbourne',- );-// Cooked.-// .refine((value) => TIME_ZONES.includes(value), {-// message: 'Invalid timezone. Please provide a valid timezone',-// });--export type TDocumentMetaTimezone = z.infer<typeof ZDocumentMetaTimezoneSchema>;--export const ZDocumentMetaDateFormatSchema = z- .enum(VALID_DATE_FORMAT_VALUES)- .describe('The date format to use for date fields and signing the document.');--export type TDocumentMetaDateFormat = z.infer<typeof ZDocumentMetaDateFormatSchema>;--export const ZDocumentMetaRedirectUrlSchema = z- .string()- .describe('The URL to which the recipient should be redirected after signing the document.')- .refine((value) => value === undefined || value === '' || isValidRedirectUrl(value), {- message: 'Please enter a valid URL, make sure you include http:// or https:// part of the url.',- });--export const ZDocumentMetaLanguageSchema = z- .enum(SUPPORTED_LANGUAGE_CODES)- .describe('The language to use for email communications with recipients.');--export const ZDocumentMetaSubjectSchema = z- .string()- .max(254)- .describe('The subject of the email that will be sent to the recipients.');--export const ZDocumentMetaMessageSchema = z- .string()- .max(5000)- .describe('The message of the email that will be sent to the recipients.');--export const ZDocumentMetaDistributionMethodSchema = z- .nativeEnum(DocumentDistributionMethod)- .describe('The distribution method to use when sending the document to the recipients.');--export const ZDocumentMetaTypedSignatureEnabledSchema = z- .boolean()- .describe('Whether to allow recipients to sign using a typed signature.');--export const ZDocumentMetaDrawSignatureEnabledSchema = z- .boolean()- .describe('Whether to allow recipients to sign using a draw signature.');--export const ZDocumentMetaUploadSignatureEnabledSchema = z- .boolean()- .describe('Whether to allow recipients to sign using an uploaded signature.');diff --git a/packages/trpc/server/document-router/share-document.ts b/packages/trpc/server/document-router/share-document.tsnew file mode 100644index 000000000..edaee8172--- /dev/null+++ b/packages/trpc/server/document-router/share-document.ts@@ -0,0 +1,28 @@+import { createOrGetShareLink } from '@documenso/lib/server-only/share/create-or-get-share-link';++import { procedure } from '../trpc';+import { ZShareDocumentRequestSchema, ZShareDocumentResponseSchema } from './share-document.types';++// Note: This is an unauthenticated route.+export const shareDocumentRoute = procedure+ .input(ZShareDocumentRequestSchema)+ .output(ZShareDocumentResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { documentId, token } = input;++ ctx.logger.info({+ input: {+ documentId,+ },+ });++ if (token) {+ return await createOrGetShareLink({ documentId, token });+ }++ if (!ctx.user?.id) {+ throw new Error('You must either provide a token or be logged in to create a sharing link.');+ }++ return await createOrGetShareLink({ documentId, userId: ctx.user.id });+ });diff --git a/packages/trpc/server/document-router/share-document.types.ts b/packages/trpc/server/document-router/share-document.types.tsnew file mode 100644index 000000000..df96200a3--- /dev/null+++ b/packages/trpc/server/document-router/share-document.types.ts@@ -0,0 +1,16 @@+import { z } from 'zod';++import DocumentShareLinkSchema from '@documenso/prisma/generated/zod/modelSchema/DocumentShareLinkSchema';++export const ZShareDocumentRequestSchema = z.object({+ documentId: z.number(),+ token: z.string().optional(),+});++export const ZShareDocumentResponseSchema = DocumentShareLinkSchema.pick({+ slug: true,+ email: true,+});++export type TShareDocumentRequest = z.infer<typeof ZShareDocumentRequestSchema>;+export type TShareDocumentResponse = z.infer<typeof ZShareDocumentResponseSchema>;diff --git a/packages/trpc/server/document-router/update-document.ts b/packages/trpc/server/document-router/update-document.tsindex 44a7fb990..ce87baeb8 100644--- a/packages/trpc/server/document-router/update-document.ts+++ b/packages/trpc/server/document-router/update-document.ts@@ -1,18 +1,18 @@-import { upsertDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';-import { updateDocument } from '@documenso/lib/server-only/document/update-document';+import { updateEnvelope } from '@documenso/lib/server-only/envelope/update-envelope';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { authenticatedProcedure } from '../trpc';import {ZUpdateDocumentRequestSchema,ZUpdateDocumentResponseSchema,} from './update-document.types';-import { updateDocumentMeta } from './update-document.types';+import { updateDocumentMeta as updateDocumentTrpcMeta } from './update-document.types';/*** Public route.*/export const updateDocumentRoute = authenticatedProcedure- .meta(updateDocumentMeta)+ .meta(updateDocumentTrpcMeta).input(ZUpdateDocumentRequestSchema).output(ZUpdateDocumentResponseSchema).mutation(async ({ input, ctx }) => {@@ -27,35 +27,23 @@ export const updateDocumentRoute = authenticatedProcedureconst userId = ctx.user.id;- if (Object.values(meta).length > 0) {- await upsertDocumentMeta({- userId: ctx.user.id,- teamId,- documentId,- subject: meta.subject,- message: meta.message,- timezone: meta.timezone,- dateFormat: meta.dateFormat,- language: meta.language,- typedSignatureEnabled: meta.typedSignatureEnabled,- uploadSignatureEnabled: meta.uploadSignatureEnabled,- drawSignatureEnabled: meta.drawSignatureEnabled,- redirectUrl: meta.redirectUrl,- distributionMethod: meta.distributionMethod,- signingOrder: meta.signingOrder,- allowDictateNextSigner: meta.allowDictateNextSigner,- emailId: meta.emailId,- emailReplyTo: meta.emailReplyTo,- emailSettings: meta.emailSettings,- requestMetadata: ctx.metadata,- });- }-- return await updateDocument({+ const envelope = await updateEnvelope({userId,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },data,+ meta,requestMetadata: ctx.metadata,});++ const mappedDocument = {+ ...envelope,+ id: mapSecondaryIdToDocumentId(envelope.secondaryId),+ envelopeId: envelope.id,+ };++ return mappedDocument;});diff --git a/packages/trpc/server/document-router/update-document.types.ts b/packages/trpc/server/document-router/update-document.types.tsindex 03e5159e8..d351667d1 100644--- a/packages/trpc/server/document-router/update-document.types.ts+++ b/packages/trpc/server/document-router/update-document.types.ts@@ -1,4 +1,3 @@-import { DocumentSigningOrder } from '@prisma/client';// import type { OpenApiMeta } from 'trpc-to-openapi';import { z } from 'zod';@@ -7,21 +6,11 @@ import {ZDocumentAccessAuthTypesSchema,ZDocumentActionAuthTypesSchema,} from '@documenso/lib/types/document-auth';-import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';+import { ZDocumentMetaUpdateSchema } from '@documenso/lib/types/document-meta';import type { TrpcRouteMeta } from '../trpc';import {ZDocumentExternalIdSchema,- ZDocumentMetaDateFormatSchema,- ZDocumentMetaDistributionMethodSchema,- ZDocumentMetaDrawSignatureEnabledSchema,- ZDocumentMetaLanguageSchema,- ZDocumentMetaMessageSchema,- ZDocumentMetaRedirectUrlSchema,- ZDocumentMetaSubjectSchema,- ZDocumentMetaTimezoneSchema,- ZDocumentMetaTypedSignatureEnabledSchema,- ZDocumentMetaUploadSignatureEnabledSchema,ZDocumentTitleSchema,ZDocumentVisibilitySchema,} from './schema';@@ -45,27 +34,10 @@ export const ZUpdateDocumentRequestSchema = z.object({globalAccessAuth: z.array(ZDocumentAccessAuthTypesSchema).optional(),globalActionAuth: z.array(ZDocumentActionAuthTypesSchema).optional(),useLegacyFieldInsertion: z.boolean().optional(),+ folderId: z.string().nullish(),}).optional(),- meta: z- .object({- subject: ZDocumentMetaSubjectSchema.optional(),- message: ZDocumentMetaMessageSchema.optional(),- timezone: ZDocumentMetaTimezoneSchema.optional(),- dateFormat: ZDocumentMetaDateFormatSchema.optional(),- distributionMethod: ZDocumentMetaDistributionMethodSchema.optional(),- signingOrder: z.nativeEnum(DocumentSigningOrder).optional(),- allowDictateNextSigner: z.boolean().optional(),- redirectUrl: ZDocumentMetaRedirectUrlSchema.optional(),- language: ZDocumentMetaLanguageSchema.optional(),- typedSignatureEnabled: ZDocumentMetaTypedSignatureEnabledSchema.optional(),- uploadSignatureEnabled: ZDocumentMetaUploadSignatureEnabledSchema.optional(),- drawSignatureEnabled: ZDocumentMetaDrawSignatureEnabledSchema.optional(),- emailId: z.string().nullish(),- emailReplyTo: z.string().email().nullish(),- emailSettings: ZDocumentEmailSettingsSchema.optional(),- })- .optional(),+ meta: ZDocumentMetaUpdateSchema.optional(),});export const ZUpdateDocumentResponseSchema = ZDocumentLiteSchema;diff --git a/packages/trpc/server/embedding-router/apply-multi-sign-signature.ts b/packages/trpc/server/embedding-router/apply-multi-sign-signature.tsindex 34d4b082d..700690c4e 100644--- a/packages/trpc/server/embedding-router/apply-multi-sign-signature.ts+++ b/packages/trpc/server/embedding-router/apply-multi-sign-signature.ts@@ -68,7 +68,7 @@ export const applyMultiSignSignatureRoute = procedureconst signatureFields = await prisma.field.findMany({where: {- documentId: envelope.document.id,+ envelopeId: envelope.document.id,recipientId: envelope.recipient.id,type: FieldType.SIGNATURE,inserted: false,diff --git a/packages/trpc/server/embedding-router/create-embedding-document.ts b/packages/trpc/server/embedding-router/create-embedding-document.tsindex e3271c1b4..d1155e456 100644--- a/packages/trpc/server/embedding-router/create-embedding-document.ts+++ b/packages/trpc/server/embedding-router/create-embedding-document.ts@@ -1,6 +1,9 @@+import { EnvelopeType } from '@prisma/client';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { createDocumentV2 } from '@documenso/lib/server-only/document/create-document-v2';import { verifyEmbeddingPresignToken } from '@documenso/lib/server-only/embedding-presign/verify-embedding-presign-token';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';+import { mapSecondaryIdToDocumentId } from '@documenso/lib/utils/envelope';import { procedure } from '../trpc';import {@@ -8,6 +11,7 @@ import {ZCreateEmbeddingDocumentResponseSchema,} from './create-embedding-document.types';+// Todo: Envelopes - This only supports V1 documents/templates.export const createEmbeddingDocumentRoute = procedure.input(ZCreateEmbeddingDocumentRequestSchema).output(ZCreateEmbeddingDocumentResponseSchema)@@ -29,27 +33,44 @@ export const createEmbeddingDocumentRoute = procedureconst { title, documentDataId, externalId, recipients, meta } = input;- const document = await createDocumentV2({+ const envelope = await createEnvelope({+ internalVersion: 1,data: {+ type: EnvelopeType.DOCUMENT,title,externalId,- recipients,+ recipients: (recipients || []).map((recipient) => ({+ ...recipient,+ fields: (recipient.fields || []).map((field) => ({+ ...field,+ page: field.pageNumber,+ positionX: field.pageX,+ positionY: field.pageY,+ documentDataId,+ })),+ })),+ envelopeItems: [+ {+ documentDataId,+ },+ ],},meta,- documentDataId,userId: apiToken.userId,teamId: apiToken.teamId ?? undefined,requestMetadata: metadata,});- if (!document.id) {+ if (!envelope.id) {throw new AppError(AppErrorCode.UNKNOWN_ERROR, {message: 'Failed to create document: missing document ID',});}+ const legacyDocumentId = mapSecondaryIdToDocumentId(envelope.secondaryId);+return {- documentId: document.id,+ documentId: legacyDocumentId,};} catch (error) {if (error instanceof AppError) {diff --git a/packages/trpc/server/embedding-router/create-embedding-document.types.ts b/packages/trpc/server/embedding-router/create-embedding-document.types.tsindex 40547d77b..6e5bef284 100644--- a/packages/trpc/server/embedding-router/create-embedding-document.types.ts+++ b/packages/trpc/server/embedding-router/create-embedding-document.types.ts@@ -2,17 +2,6 @@ import { z } from 'zod';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';import {- ZFieldHeightSchema,- ZFieldPageNumberSchema,- ZFieldPageXSchema,- ZFieldPageYSchema,- ZFieldWidthSchema,-} from '@documenso/lib/types/field';-import { ZFieldAndMetaSchema } from '@documenso/lib/types/field-meta';-import { DocumentSigningOrder } from '@documenso/prisma/generated/types';--import {- ZDocumentExternalIdSchema,ZDocumentMetaDateFormatSchema,ZDocumentMetaDistributionMethodSchema,ZDocumentMetaDrawSignatureEnabledSchema,@@ -23,8 +12,18 @@ import {ZDocumentMetaTimezoneSchema,ZDocumentMetaTypedSignatureEnabledSchema,ZDocumentMetaUploadSignatureEnabledSchema,- ZDocumentTitleSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import {+ ZFieldHeightSchema,+ ZFieldPageNumberSchema,+ ZFieldPageXSchema,+ ZFieldPageYSchema,+ ZFieldWidthSchema,+} from '@documenso/lib/types/field';+import { ZFieldAndMetaSchema } from '@documenso/lib/types/field-meta';+import { DocumentSigningOrder } from '@documenso/prisma/generated/types';++import { ZDocumentExternalIdSchema, ZDocumentTitleSchema } from '../document-router/schema';import { ZCreateRecipientSchema } from '../recipient-router/schema';export const ZCreateEmbeddingDocumentRequestSchema = z.object({diff --git a/packages/trpc/server/embedding-router/create-embedding-template.ts b/packages/trpc/server/embedding-router/create-embedding-template.tsindex 5dbc40cd9..7130468bc 100644--- a/packages/trpc/server/embedding-router/create-embedding-template.ts+++ b/packages/trpc/server/embedding-router/create-embedding-template.ts@@ -1,6 +1,9 @@+import { EnvelopeType } from '@prisma/client';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { verifyEmbeddingPresignToken } from '@documenso/lib/server-only/embedding-presign/verify-embedding-presign-token';-import { createTemplate } from '@documenso/lib/server-only/template/create-template';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';import { prisma } from '@documenso/prisma';import { procedure } from '../trpc';@@ -9,10 +12,11 @@ import {ZCreateEmbeddingTemplateResponseSchema,} from './create-embedding-template.types';+// Todo: Envelopes - This only supports V1 documents/templates.export const createEmbeddingTemplateRoute = procedure.input(ZCreateEmbeddingTemplateRequestSchema).output(ZCreateEmbeddingTemplateResponseSchema)- .mutation(async ({ input, ctx: { req } }) => {+ .mutation(async ({ input, ctx: { req, metadata } }) => {try {const authorizationHeader = req.headers.get('authorization');@@ -31,20 +35,30 @@ export const createEmbeddingTemplateRoute = procedureconst { title, documentDataId, recipients, meta } = input;// First create the template- const template = await createTemplate({+ const template = await createEnvelope({+ internalVersion: 1,userId: apiToken.userId,+ teamId: apiToken.teamId ?? undefined,data: {+ type: EnvelopeType.TEMPLATE,title,+ envelopeItems: [+ {+ documentDataId,+ },+ ],},- templateDocumentDataId: documentDataId,- teamId: apiToken.teamId ?? undefined,+ meta,+ requestMetadata: metadata,});+ const firstEnvelopeItem = template.envelopeItems[0];+await Promise.all(recipients.map(async (recipient) => {const createdRecipient = await prisma.recipient.create({data: {- templateId: template.id,+ envelopeId: template.id,email: recipient.email,name: recipient.name || '',role: recipient.role || 'SIGNER',@@ -57,6 +71,8 @@ export const createEmbeddingTemplateRoute = procedureconst createdFields = await prisma.field.createMany({data: fields.map((field) => ({+ envelopeId: template.id,+ envelopeItemId: firstEnvelopeItem.id,recipientId: createdRecipient.id,type: field.type,page: field.pageNumber,@@ -66,7 +82,6 @@ export const createEmbeddingTemplateRoute = procedureheight: field.height,customText: '',inserted: false,- templateId: template.id,})),});@@ -77,37 +92,6 @@ export const createEmbeddingTemplateRoute = procedure}),);- // Update the template meta if needed- if (meta) {- const upsertMetaData = {- subject: meta.subject,- message: meta.message,- timezone: meta.timezone,- dateFormat: meta.dateFormat,- distributionMethod: meta.distributionMethod,- signingOrder: meta.signingOrder,- redirectUrl: meta.redirectUrl,- language: meta.language,- typedSignatureEnabled: meta.typedSignatureEnabled,- drawSignatureEnabled: meta.drawSignatureEnabled,- uploadSignatureEnabled: meta.uploadSignatureEnabled,- emailSettings: meta.emailSettings,- };-- await prisma.templateMeta.upsert({- where: {- templateId: template.id,- },- create: {- templateId: template.id,- ...upsertMetaData,- },- update: {- ...upsertMetaData,- },- });- }-if (!template.id) {throw new AppError(AppErrorCode.UNKNOWN_ERROR, {message: 'Failed to create template: missing template ID',@@ -115,7 +99,7 @@ export const createEmbeddingTemplateRoute = procedure}return {- templateId: template.id,+ templateId: mapSecondaryIdToTemplateId(template.secondaryId),};} catch (error) {if (error instanceof AppError) {diff --git a/packages/trpc/server/embedding-router/create-embedding-template.types.ts b/packages/trpc/server/embedding-router/create-embedding-template.types.tsindex 90ab1edea..3e8b9a314 100644--- a/packages/trpc/server/embedding-router/create-embedding-template.types.ts+++ b/packages/trpc/server/embedding-router/create-embedding-template.types.ts@@ -2,15 +2,6 @@ import { DocumentSigningOrder, FieldType, RecipientRole } from '@prisma/client';import { z } from 'zod';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import {- ZFieldHeightSchema,- ZFieldPageNumberSchema,- ZFieldPageXSchema,- ZFieldPageYSchema,- ZFieldWidthSchema,-} from '@documenso/lib/types/field';-import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';-import {ZDocumentMetaDateFormatSchema,ZDocumentMetaDistributionMethodSchema,@@ -22,8 +13,17 @@ import {ZDocumentMetaTimezoneSchema,ZDocumentMetaTypedSignatureEnabledSchema,ZDocumentMetaUploadSignatureEnabledSchema,- ZDocumentTitleSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import {+ ZFieldHeightSchema,+ ZFieldPageNumberSchema,+ ZFieldPageXSchema,+ ZFieldPageYSchema,+ ZFieldWidthSchema,+} from '@documenso/lib/types/field';+import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';++import { ZDocumentTitleSchema } from '../document-router/schema';const ZFieldSchema = z.object({type: z.nativeEnum(FieldType),diff --git a/packages/trpc/server/embedding-router/get-multi-sign-document.ts b/packages/trpc/server/embedding-router/get-multi-sign-document.tsindex 60a6813c0..c05b73f89 100644--- a/packages/trpc/server/embedding-router/get-multi-sign-document.ts+++ b/packages/trpc/server/embedding-router/get-multi-sign-document.ts@@ -42,7 +42,13 @@ export const getMultiSignDocumentRoute = procedure// Transform fields to match our schemaconst transformedFields = fields.map((field) => ({...field,- recipient,+ recipient: {+ ...recipient,+ documentId: document.id,+ templateId: null,+ },+ documentId: document.id,+ templateId: null,}));return {diff --git a/packages/trpc/server/embedding-router/get-multi-sign-document.types.ts b/packages/trpc/server/embedding-router/get-multi-sign-document.types.tsindex 2ab73db72..d4f7f5cc2 100644--- a/packages/trpc/server/embedding-router/get-multi-sign-document.types.ts+++ b/packages/trpc/server/embedding-router/get-multi-sign-document.types.ts@@ -25,9 +25,7 @@ export const ZGetMultiSignDocumentResponseSchema = ZDocumentLiteSchema.extend({subject: true,message: true,timezone: true,- password: true,dateFormat: true,- documentId: true,redirectUrl: true,typedSignatureEnabled: true,uploadSignatureEnabled: true,diff --git a/packages/trpc/server/embedding-router/update-embedding-document.ts b/packages/trpc/server/embedding-router/update-embedding-document.tsindex cd8dc305c..57453cb52 100644--- a/packages/trpc/server/embedding-router/update-embedding-document.ts+++ b/packages/trpc/server/embedding-router/update-embedding-document.ts@@ -1,7 +1,6 @@import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';-import { upsertDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';-import { updateDocument } from '@documenso/lib/server-only/document/update-document';import { verifyEmbeddingPresignToken } from '@documenso/lib/server-only/embedding-presign/verify-embedding-presign-token';+import { updateEnvelope } from '@documenso/lib/server-only/envelope/update-envelope';import { setFieldsForDocument } from '@documenso/lib/server-only/field/set-fields-for-document';import { setDocumentRecipients } from '@documenso/lib/server-only/recipient/set-document-recipients';import { nanoid } from '@documenso/lib/universal/id';@@ -39,24 +38,18 @@ export const updateEmbeddingDocumentRoute = procedureconst { documentId, title, externalId, recipients, meta } = input;- if (meta && Object.values(meta).length > 0) {- await upsertDocumentMeta({- documentId: documentId,- userId: apiToken.userId,- teamId: apiToken.teamId ?? undefined,- ...meta,- requestMetadata: ctx.metadata,- });- }-- await updateDocument({+ await updateEnvelope({userId: apiToken.userId,teamId: apiToken.teamId ?? undefined,- documentId: documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },data: {title,externalId,},+ meta,requestMetadata: ctx.metadata,});@@ -68,7 +61,10 @@ export const updateEmbeddingDocumentRoute = procedureconst { recipients: updatedRecipients } = await setDocumentRecipients({userId: apiToken.userId,teamId: apiToken.teamId ?? undefined,- documentId: documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients: recipientsWithClientId.map((recipient) => ({id: recipient.id,clientId: recipient.clientId,@@ -100,7 +96,10 @@ export const updateEmbeddingDocumentRoute = procedureawait setFieldsForDocument({userId: apiToken.userId,teamId: apiToken.teamId ?? undefined,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },fields: fields.map((field) => ({...field,pageWidth: field.width,diff --git a/packages/trpc/server/embedding-router/update-embedding-document.types.ts b/packages/trpc/server/embedding-router/update-embedding-document.types.tsindex c7521e91b..7f40d42ee 100644--- a/packages/trpc/server/embedding-router/update-embedding-document.types.ts+++ b/packages/trpc/server/embedding-router/update-embedding-document.types.ts@@ -2,17 +2,6 @@ import { z } from 'zod';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';import {- ZFieldHeightSchema,- ZFieldPageNumberSchema,- ZFieldPageXSchema,- ZFieldPageYSchema,- ZFieldWidthSchema,-} from '@documenso/lib/types/field';-import { ZFieldAndMetaSchema } from '@documenso/lib/types/field-meta';-import { DocumentSigningOrder, RecipientRole } from '@documenso/prisma/generated/types';--import {- ZDocumentExternalIdSchema,ZDocumentMetaDateFormatSchema,ZDocumentMetaDistributionMethodSchema,ZDocumentMetaDrawSignatureEnabledSchema,@@ -23,8 +12,18 @@ import {ZDocumentMetaTimezoneSchema,ZDocumentMetaTypedSignatureEnabledSchema,ZDocumentMetaUploadSignatureEnabledSchema,- ZDocumentTitleSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import {+ ZFieldHeightSchema,+ ZFieldPageNumberSchema,+ ZFieldPageXSchema,+ ZFieldPageYSchema,+ ZFieldWidthSchema,+} from '@documenso/lib/types/field';+import { ZFieldAndMetaSchema } from '@documenso/lib/types/field-meta';+import { DocumentSigningOrder, RecipientRole } from '@documenso/prisma/generated/types';++import { ZDocumentExternalIdSchema, ZDocumentTitleSchema } from '../document-router/schema';export const ZUpdateEmbeddingDocumentRequestSchema = z.object({documentId: z.number(),@@ -37,6 +36,8 @@ export const ZUpdateEmbeddingDocumentRequestSchema = z.object({name: z.string(),role: z.nativeEnum(RecipientRole),signingOrder: z.number().optional(),+ // We have an any cast so any changes here you need to update it in the embeding document edit page+ // Search: "map<any>" to find itfields: ZFieldAndMetaSchema.and(z.object({id: z.number().optional(),@@ -45,6 +46,7 @@ export const ZUpdateEmbeddingDocumentRequestSchema = z.object({pageY: ZFieldPageYSchema,width: ZFieldWidthSchema,height: ZFieldHeightSchema,+ envelopeItemId: z.string(),}),).array()diff --git a/packages/trpc/server/embedding-router/update-embedding-template.ts b/packages/trpc/server/embedding-router/update-embedding-template.tsindex 38bf2a27a..07352bb24 100644--- a/packages/trpc/server/embedding-router/update-embedding-template.ts+++ b/packages/trpc/server/embedding-router/update-embedding-template.ts@@ -1,8 +1,8 @@import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';import { verifyEmbeddingPresignToken } from '@documenso/lib/server-only/embedding-presign/verify-embedding-presign-token';+import { updateEnvelope } from '@documenso/lib/server-only/envelope/update-envelope';import { setFieldsForTemplate } from '@documenso/lib/server-only/field/set-fields-for-template';import { setTemplateRecipients } from '@documenso/lib/server-only/recipient/set-template-recipients';-import { updateTemplate } from '@documenso/lib/server-only/template/update-template';import { nanoid } from '@documenso/lib/universal/id';import { procedure } from '../trpc';@@ -38,15 +38,19 @@ export const updateEmbeddingTemplateRoute = procedureconst { templateId, title, externalId, recipients, meta } = input;- await updateTemplate({- templateId,+ await updateEnvelope({+ id: {+ type: 'templateId',+ id: templateId,+ },userId: apiToken.userId,- teamId: apiToken.teamId ?? undefined,+ teamId: apiToken.teamId,data: {title,externalId,},meta,+ requestMetadata: ctx.metadata,});const recipientsWithClientId = recipients.map((recipient) => ({@@ -57,7 +61,10 @@ export const updateEmbeddingTemplateRoute = procedureconst { recipients: updatedRecipients } = await setTemplateRecipients({userId: apiToken.userId,teamId: apiToken.teamId ?? undefined,- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },recipients: recipientsWithClientId.map((recipient) => ({id: recipient.id,email: recipient.email,@@ -87,7 +94,10 @@ export const updateEmbeddingTemplateRoute = procedureawait setFieldsForTemplate({userId: apiToken.userId,teamId: apiToken.teamId ?? undefined,- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },fields: fields.map((field) => ({...field,pageWidth: field.width,diff --git a/packages/trpc/server/embedding-router/update-embedding-template.types.ts b/packages/trpc/server/embedding-router/update-embedding-template.types.tsindex c25ea0a65..317825ab5 100644--- a/packages/trpc/server/embedding-router/update-embedding-template.types.ts+++ b/packages/trpc/server/embedding-router/update-embedding-template.types.ts@@ -2,15 +2,6 @@ import { DocumentSigningOrder, FieldType, RecipientRole } from '@prisma/client';import { z } from 'zod';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import {- ZFieldHeightSchema,- ZFieldPageNumberSchema,- ZFieldPageXSchema,- ZFieldPageYSchema,- ZFieldWidthSchema,-} from '@documenso/lib/types/field';-import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';-import {ZDocumentMetaDateFormatSchema,ZDocumentMetaDistributionMethodSchema,@@ -22,8 +13,17 @@ import {ZDocumentMetaTimezoneSchema,ZDocumentMetaTypedSignatureEnabledSchema,ZDocumentMetaUploadSignatureEnabledSchema,- ZDocumentTitleSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import {+ ZFieldHeightSchema,+ ZFieldPageNumberSchema,+ ZFieldPageXSchema,+ ZFieldPageYSchema,+ ZFieldWidthSchema,+} from '@documenso/lib/types/field';+import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';++import { ZDocumentTitleSchema } from '../document-router/schema';const ZFieldSchema = z.object({id: z.number().optional(),@@ -34,6 +34,7 @@ const ZFieldSchema = z.object({width: ZFieldWidthSchema,height: ZFieldHeightSchema,fieldMeta: ZFieldMetaSchema.optional(),+ envelopeItemId: z.string(),});export const ZUpdateEmbeddingTemplateRequestSchema = z.object({diff --git a/packages/trpc/server/envelope-router/create-envelope-items.ts b/packages/trpc/server/envelope-router/create-envelope-items.tsnew file mode 100644index 000000000..8429a4ca7--- /dev/null+++ b/packages/trpc/server/envelope-router/create-envelope-items.ts@@ -0,0 +1,111 @@+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { prefixedId } from '@documenso/lib/universal/id';+import { canEnvelopeItemsBeModified } from '@documenso/lib/utils/envelope';+import { prisma } from '@documenso/prisma';++import { authenticatedProcedure } from '../trpc';+import {+ ZCreateEnvelopeItemsRequestSchema,+ ZCreateEnvelopeItemsResponseSchema,+} from './create-envelope-items.types';++export const createEnvelopeItemsRoute = authenticatedProcedure+ .input(ZCreateEnvelopeItemsRequestSchema)+ .output(ZCreateEnvelopeItemsResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { user, teamId } = ctx;+ const { envelopeId, items } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ // Todo: Envelopes - What to do about "normalizing"?+ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ type: null,+ userId: user.id,+ teamId,+ });++ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,+ include: {+ recipients: true,+ envelopeItems: {+ orderBy: {+ order: 'asc',+ },+ },+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ if (!canEnvelopeItemsBeModified(envelope, envelope.recipients)) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Envelope item is not editable',+ });+ }++ // Todo: Envelopes - Limit amount of items that can be created.++ const foundDocumentData = await prisma.documentData.findMany({+ where: {+ id: {+ in: items.map((item) => item.documentDataId),+ },+ },+ select: {+ envelopeItem: {+ select: {+ id: true,+ },+ },+ },+ });++ // Check that all the document data was found.+ if (foundDocumentData.length !== items.length) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Document data not found',+ });+ }++ // Check that it doesn't already have an envelope item.+ if (foundDocumentData.some((documentData) => documentData.envelopeItem?.id)) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Document data not found',+ });+ }++ const currentHighestOrderValue =+ envelope.envelopeItems[envelope.envelopeItems.length - 1]?.order ?? 1;++ const result = await prisma.envelopeItem.createManyAndReturn({+ data: items.map((item, index) => ({+ id: prefixedId('envelope_item'),+ envelopeId,+ title: item.title,+ documentDataId: item.documentDataId,+ order: currentHighestOrderValue + 1,+ })),+ include: {+ documentData: true,+ },+ });++ return {+ createdEnvelopeItems: result,+ };+ });diff --git a/packages/trpc/server/envelope-router/create-envelope-items.types.ts b/packages/trpc/server/envelope-router/create-envelope-items.types.tsnew file mode 100644index 000000000..494e562f3--- /dev/null+++ b/packages/trpc/server/envelope-router/create-envelope-items.types.ts@@ -0,0 +1,38 @@+import { z } from 'zod';++import DocumentDataSchema from '@documenso/prisma/generated/zod/modelSchema/DocumentDataSchema';+import EnvelopeItemSchema from '@documenso/prisma/generated/zod/modelSchema/EnvelopeItemSchema';++import { ZDocumentTitleSchema } from '../document-router/schema';++export const ZCreateEnvelopeItemsRequestSchema = z.object({+ envelopeId: z.string(),+ items: z+ .object({+ title: ZDocumentTitleSchema,+ documentDataId: z.string(),+ })+ .array(),+});++export const ZCreateEnvelopeItemsResponseSchema = z.object({+ createdEnvelopeItems: EnvelopeItemSchema.pick({+ id: true,+ title: true,+ documentDataId: true,+ envelopeId: true,+ order: true,+ })+ .extend({+ documentData: DocumentDataSchema.pick({+ type: true,+ id: true,+ data: true,+ initialData: true,+ }),+ })+ .array(),+});++export type TCreateEnvelopeItemsRequest = z.infer<typeof ZCreateEnvelopeItemsRequestSchema>;+export type TCreateEnvelopeItemsResponse = z.infer<typeof ZCreateEnvelopeItemsResponseSchema>;diff --git a/packages/trpc/server/envelope-router/create-envelope.ts b/packages/trpc/server/envelope-router/create-envelope.tsnew file mode 100644index 000000000..ce3bb0a47--- /dev/null+++ b/packages/trpc/server/envelope-router/create-envelope.ts@@ -0,0 +1,68 @@+import { getServerLimits } from '@documenso/ee/server-only/limits/server';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';++import { authenticatedProcedure } from '../trpc';+import {+ ZCreateEnvelopeRequestSchema,+ ZCreateEnvelopeResponseSchema,+} from './create-envelope.types';++export const createEnvelopeRoute = authenticatedProcedure+ .input(ZCreateEnvelopeRequestSchema) // Note: Before releasing this to public, update the response schema to be correct.+ .output(ZCreateEnvelopeResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { user, teamId } = ctx;+ const {+ title,+ type,+ externalId,+ visibility,+ globalAccessAuth,+ globalActionAuth,+ recipients,+ folderId,+ items,+ meta,+ } = input;++ ctx.logger.info({+ input: {+ folderId,+ },+ });++ // Todo: Envelopes - Put the claims for number of items into this.+ const { remaining } = await getServerLimits({ userId: user.id, teamId });++ if (remaining.documents <= 0) {+ throw new AppError(AppErrorCode.LIMIT_EXCEEDED, {+ message: 'You have reached your document limit for this month. Please upgrade your plan.',+ statusCode: 400,+ });+ }++ const envelope = await createEnvelope({+ userId: user.id,+ teamId,+ internalVersion: 2,+ data: {+ type,+ title,+ externalId,+ visibility,+ globalAccessAuth,+ globalActionAuth,+ recipients,+ folderId,+ envelopeItems: items,+ },+ meta,+ normalizePdf: true,+ requestMetadata: ctx.metadata,+ });++ return {+ id: envelope.id,+ };+ });diff --git a/packages/trpc/server/envelope-router/create-envelope.types.ts b/packages/trpc/server/envelope-router/create-envelope.types.tsnew file mode 100644index 000000000..5f1e04cbf--- /dev/null+++ b/packages/trpc/server/envelope-router/create-envelope.types.ts@@ -0,0 +1,86 @@+import { EnvelopeType } from '@prisma/client';+import { z } from 'zod';++import {+ ZDocumentAccessAuthTypesSchema,+ ZDocumentActionAuthTypesSchema,+} from '@documenso/lib/types/document-auth';+import { ZDocumentFormValuesSchema } from '@documenso/lib/types/document-form-values';+import { ZDocumentMetaCreateSchema } from '@documenso/lib/types/document-meta';+import {+ ZFieldHeightSchema,+ ZFieldPageNumberSchema,+ ZFieldPageXSchema,+ ZFieldPageYSchema,+ ZFieldWidthSchema,+} from '@documenso/lib/types/field';+import { ZFieldAndMetaSchema } from '@documenso/lib/types/field-meta';++import {+ ZDocumentExternalIdSchema,+ ZDocumentTitleSchema,+ ZDocumentVisibilitySchema,+} from '../document-router/schema';+import { ZCreateRecipientSchema } from '../recipient-router/schema';++// Currently not in use until we allow passthrough documents on create.+// export const createEnvelopeMeta: TrpcRouteMeta = {+// openapi: {+// method: 'POST',+// path: '/envelope/create',+// summary: 'Create envelope',+// tags: ['Envelope'],+// },+// };++export const ZCreateEnvelopeRequestSchema = z.object({+ title: ZDocumentTitleSchema,+ type: z.nativeEnum(EnvelopeType),+ externalId: ZDocumentExternalIdSchema.optional(),+ visibility: ZDocumentVisibilitySchema.optional(),+ globalAccessAuth: z.array(ZDocumentAccessAuthTypesSchema).optional(),+ globalActionAuth: z.array(ZDocumentActionAuthTypesSchema).optional(),+ formValues: ZDocumentFormValuesSchema.optional(),+ items: z+ .object({+ title: ZDocumentTitleSchema.optional(),+ documentDataId: z.string(),+ })+ .array(),+ folderId: z+ .string()+ .describe(+ 'The ID of the folder to create the document in. If not provided, the document will be created in the root folder.',+ )+ .optional(),+ recipients: z+ .array(+ ZCreateRecipientSchema.extend({+ fields: ZFieldAndMetaSchema.and(+ z.object({+ documentDataId: z+ .string()+ .describe(+ 'The ID of the document data to create the field on. If empty, the first document data will be used.',+ ),+ page: ZFieldPageNumberSchema,+ positionX: ZFieldPageXSchema,+ positionY: ZFieldPageYSchema,+ width: ZFieldWidthSchema,+ height: ZFieldHeightSchema,+ }),+ )+ .array()+ .optional(),+ }),+ )+ .optional(),+ meta: ZDocumentMetaCreateSchema.optional(),+});++export const ZCreateEnvelopeResponseSchema = z.object({+ id: z.string(),+});++export type TCreateEnvelopeRequest = z.infer<typeof ZCreateEnvelopeRequestSchema>;+export type TCreateEnvelopeResponse = z.infer<typeof ZCreateEnvelopeResponseSchema>;diff --git a/packages/trpc/server/envelope-router/delete-envelope-item.ts b/packages/trpc/server/envelope-router/delete-envelope-item.tsnew file mode 100644index 000000000..fcd4d94fa--- /dev/null+++ b/packages/trpc/server/envelope-router/delete-envelope-item.ts@@ -0,0 +1,64 @@+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { canEnvelopeItemsBeModified } from '@documenso/lib/utils/envelope';+import { prisma } from '@documenso/prisma';++import { authenticatedProcedure } from '../trpc';+import {+ ZDeleteEnvelopeItemRequestSchema,+ ZDeleteEnvelopeItemResponseSchema,+} from './delete-envelope-item.types';++export const deleteEnvelopeItemRoute = authenticatedProcedure+ .input(ZDeleteEnvelopeItemRequestSchema)+ .output(ZDeleteEnvelopeItemResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { user, teamId } = ctx;+ const { envelopeId, envelopeItemId } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ envelopeItemId,+ },+ });++ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ type: null,+ userId: user.id,+ teamId,+ });++ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,+ include: {+ recipients: true,+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ if (!canEnvelopeItemsBeModified(envelope, envelope.recipients)) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Envelope item is not editable',+ });+ }++ await prisma.envelopeItem.delete({+ where: {+ id: envelopeItemId,+ envelopeId: envelope.id,+ },+ });++ // Todo: Envelopes - Audit logs?+ // Todo: Envelopes - Delete the document data as well?+ });diff --git a/packages/trpc/server/envelope-router/delete-envelope-item.types.ts b/packages/trpc/server/envelope-router/delete-envelope-item.types.tsnew file mode 100644index 000000000..7a081dbd3--- /dev/null+++ b/packages/trpc/server/envelope-router/delete-envelope-item.types.ts@@ -0,0 +1,11 @@+import { z } from 'zod';++export const ZDeleteEnvelopeItemRequestSchema = z.object({+ envelopeId: z.string(),+ envelopeItemId: z.string(),+});++export const ZDeleteEnvelopeItemResponseSchema = z.void();++export type TDeleteEnvelopeItemRequest = z.infer<typeof ZDeleteEnvelopeItemRequestSchema>;+export type TDeleteEnvelopeItemResponse = z.infer<typeof ZDeleteEnvelopeItemResponseSchema>;diff --git a/packages/trpc/server/envelope-router/delete-envelope.ts b/packages/trpc/server/envelope-router/delete-envelope.tsnew file mode 100644index 000000000..4691c3f5b--- /dev/null+++ b/packages/trpc/server/envelope-router/delete-envelope.ts@@ -0,0 +1,50 @@+import { EnvelopeType } from '@prisma/client';+import { match } from 'ts-pattern';++import { deleteDocument } from '@documenso/lib/server-only/document/delete-document';+import { deleteTemplate } from '@documenso/lib/server-only/template/delete-template';++import { authenticatedProcedure } from '../trpc';+import {+ ZDeleteEnvelopeRequestSchema,+ ZDeleteEnvelopeResponseSchema,+} from './delete-envelope.types';++export const deleteEnvelopeRoute = authenticatedProcedure+ // .meta(deleteEnvelopeMeta)+ .input(ZDeleteEnvelopeRequestSchema)+ .output(ZDeleteEnvelopeResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId, envelopeType } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ await match(envelopeType)+ .with(EnvelopeType.DOCUMENT, async () =>+ deleteDocument({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ requestMetadata: ctx.metadata,+ }),+ )+ .with(EnvelopeType.TEMPLATE, async () =>+ deleteTemplate({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ }),+ )+ .exhaustive();+ });diff --git a/packages/trpc/server/envelope-router/delete-envelope.types.ts b/packages/trpc/server/envelope-router/delete-envelope.types.tsnew file mode 100644index 000000000..c2392d379--- /dev/null+++ b/packages/trpc/server/envelope-router/delete-envelope.types.ts@@ -0,0 +1,21 @@+import { EnvelopeType } from '@prisma/client';+import { z } from 'zod';++// export const deleteEnvelopeMeta: TrpcRouteMeta = {+// openapi: {+// method: 'POST',+// path: '/envelope/delete',+// summary: 'Delete envelope',+// tags: ['Envelope'],+// },+// };++export const ZDeleteEnvelopeRequestSchema = z.object({+ envelopeId: z.string(),+ envelopeType: z.nativeEnum(EnvelopeType),+});++export const ZDeleteEnvelopeResponseSchema = z.void();++export type TDeleteEnvelopeRequest = z.infer<typeof ZDeleteEnvelopeRequestSchema>;+export type TDeleteEnvelopeResponse = z.infer<typeof ZDeleteEnvelopeResponseSchema>;diff --git a/packages/trpc/server/envelope-router/distribute-envelope.ts b/packages/trpc/server/envelope-router/distribute-envelope.tsnew file mode 100644index 000000000..0b4e1929d--- /dev/null+++ b/packages/trpc/server/envelope-router/distribute-envelope.ts@@ -0,0 +1,55 @@+import { updateDocumentMeta } from '@documenso/lib/server-only/document-meta/upsert-document-meta';+import { sendDocument } from '@documenso/lib/server-only/document/send-document';++import { authenticatedProcedure } from '../trpc';+import {+ ZDistributeEnvelopeRequestSchema,+ ZDistributeEnvelopeResponseSchema,+} from './distribute-envelope.types';++export const distributeEnvelopeRoute = authenticatedProcedure+ // .meta(distributeEnvelopeMeta)+ .input(ZDistributeEnvelopeRequestSchema)+ .output(ZDistributeEnvelopeResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId, meta = {} } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ if (Object.values(meta).length > 0) {+ await updateDocumentMeta({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ subject: meta.subject,+ message: meta.message,+ dateFormat: meta.dateFormat,+ timezone: meta.timezone,+ redirectUrl: meta.redirectUrl,+ distributionMethod: meta.distributionMethod,+ emailSettings: meta.emailSettings,+ language: meta.language,+ emailId: meta.emailId,+ emailReplyTo: meta.emailReplyTo,+ requestMetadata: ctx.metadata,+ });+ }++ await sendDocument({+ userId: ctx.user.id,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ teamId,+ requestMetadata: ctx.metadata,+ });+ });diff --git a/packages/trpc/server/envelope-router/distribute-envelope.types.ts b/packages/trpc/server/envelope-router/distribute-envelope.types.tsnew file mode 100644index 000000000..facee7b66--- /dev/null+++ b/packages/trpc/server/envelope-router/distribute-envelope.types.ts@@ -0,0 +1,34 @@+import { z } from 'zod';++import { ZDocumentMetaUpdateSchema } from '@documenso/lib/types/document-meta';++// export const distributeEnvelopeMeta: TrpcRouteMeta = {+// openapi: {+// method: 'POST',+// path: '/envelope/distribute',+// summary: 'Distribute envelope',+// description: 'Send the document out to recipients based on your distribution method',+// tags: ['Envelope'],+// },+// };++export const ZDistributeEnvelopeRequestSchema = z.object({+ envelopeId: z.string().describe('The ID of the envelope to send.'),+ meta: ZDocumentMetaUpdateSchema.pick({+ subject: true,+ message: true,+ timezone: true,+ dateFormat: true,+ distributionMethod: true,+ redirectUrl: true,+ language: true,+ emailId: true,+ emailReplyTo: true,+ emailSettings: true,+ }).optional(),+});++export const ZDistributeEnvelopeResponseSchema = z.void();++export type TDistributeEnvelopeRequest = z.infer<typeof ZDistributeEnvelopeRequestSchema>;+export type TDistributeEnvelopeResponse = z.infer<typeof ZDistributeEnvelopeResponseSchema>;diff --git a/packages/trpc/server/envelope-router/duplicate-envelope.ts b/packages/trpc/server/envelope-router/duplicate-envelope.tsnew file mode 100644index 000000000..3ed0aca7f--- /dev/null+++ b/packages/trpc/server/envelope-router/duplicate-envelope.ts@@ -0,0 +1,34 @@+import { duplicateEnvelope } from '@documenso/lib/server-only/envelope/duplicate-envelope';++import { authenticatedProcedure } from '../trpc';+import {+ ZDuplicateEnvelopeRequestSchema,+ ZDuplicateEnvelopeResponseSchema,+} from './duplicate-envelope.types';++export const duplicateEnvelopeRoute = authenticatedProcedure+ .input(ZDuplicateEnvelopeRequestSchema)+ .output(ZDuplicateEnvelopeResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ const duplicatedEnvelope = await duplicateEnvelope({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ });++ return {+ duplicatedEnvelopeId: duplicatedEnvelope.id,+ };+ });diff --git a/packages/trpc/server/envelope-router/duplicate-envelope.types.ts b/packages/trpc/server/envelope-router/duplicate-envelope.types.tsnew file mode 100644index 000000000..082003d54--- /dev/null+++ b/packages/trpc/server/envelope-router/duplicate-envelope.types.ts@@ -0,0 +1,12 @@+import { z } from 'zod';++export const ZDuplicateEnvelopeRequestSchema = z.object({+ envelopeId: z.string(),+});++export const ZDuplicateEnvelopeResponseSchema = z.object({+ duplicatedEnvelopeId: z.string(),+});++export type TDuplicateEnvelopeRequest = z.infer<typeof ZDuplicateEnvelopeRequestSchema>;+export type TDuplicateEnvelopeResponse = z.infer<typeof ZDuplicateEnvelopeResponseSchema>;diff --git a/packages/trpc/server/envelope-router/get-envelope.ts b/packages/trpc/server/envelope-router/get-envelope.tsnew file mode 100644index 000000000..4d85974ab--- /dev/null+++ b/packages/trpc/server/envelope-router/get-envelope.ts@@ -0,0 +1,29 @@+import { getEnvelopeById } from '@documenso/lib/server-only/envelope/get-envelope-by-id';++import { authenticatedProcedure } from '../trpc';+import { ZGetEnvelopeRequestSchema, ZGetEnvelopeResponseSchema } from './get-envelope.types';++export const getEnvelopeRoute = authenticatedProcedure+ // .meta(getEnvelopeMeta)+ .input(ZGetEnvelopeRequestSchema)+ .output(ZGetEnvelopeResponseSchema)+ .query(async ({ input, ctx }) => {+ const { teamId, user } = ctx;+ const { envelopeId } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ return await getEnvelopeById({+ userId: user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ type: null,+ });+ });diff --git a/packages/trpc/server/envelope-router/get-envelope.types.ts b/packages/trpc/server/envelope-router/get-envelope.types.tsnew file mode 100644index 000000000..44a27c94d--- /dev/null+++ b/packages/trpc/server/envelope-router/get-envelope.types.ts@@ -0,0 +1,22 @@+import { z } from 'zod';++import { ZEnvelopeSchema } from '@documenso/lib/types/envelope';++// export const getEnvelopeMeta: TrpcRouteMeta = {+// openapi: {+// method: 'GET',+// path: '/envelope/{envelopeId}',+// summary: 'Get envelope',+// description: 'Returns a envelope given an ID',+// tags: ['Envelope'],+// },+// };++export const ZGetEnvelopeRequestSchema = z.object({+ envelopeId: z.string(),+});++export const ZGetEnvelopeResponseSchema = ZEnvelopeSchema;++export type TGetEnvelopeRequest = z.infer<typeof ZGetEnvelopeRequestSchema>;+export type TGetEnvelopeResponse = z.infer<typeof ZGetEnvelopeResponseSchema>;diff --git a/packages/trpc/server/envelope-router/redistribute-envelope.ts b/packages/trpc/server/envelope-router/redistribute-envelope.tsnew file mode 100644index 000000000..2c3af6680--- /dev/null+++ b/packages/trpc/server/envelope-router/redistribute-envelope.ts@@ -0,0 +1,34 @@+import { resendDocument } from '@documenso/lib/server-only/document/resend-document';++import { authenticatedProcedure } from '../trpc';+import {+ ZRedistributeEnvelopeRequestSchema,+ ZRedistributeEnvelopeResponseSchema,+} from './redistribute-envelope.types';++export const redistributeEnvelopeRoute = authenticatedProcedure+ // .meta(redistributeEnvelopeMeta)+ .input(ZRedistributeEnvelopeRequestSchema)+ .output(ZRedistributeEnvelopeResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId, recipients } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ recipients,+ },+ });++ await resendDocument({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ recipients,+ requestMetadata: ctx.metadata,+ });+ });diff --git a/packages/trpc/server/envelope-router/redistribute-envelope.types.ts b/packages/trpc/server/envelope-router/redistribute-envelope.types.tsnew file mode 100644index 000000000..cd8610ab1--- /dev/null+++ b/packages/trpc/server/envelope-router/redistribute-envelope.types.ts@@ -0,0 +1,25 @@+import { z } from 'zod';++// export const redistributeEnvelopeMeta: TrpcRouteMeta = {+// openapi: {+// method: 'POST',+// path: '/envelope/redistribute',+// summary: 'Redistribute document',+// description:+// 'Redistribute the document to the provided recipients who have not actioned the document. Will use the distribution method set in the document',+// tags: ['Envelope'],+// },+// };++export const ZRedistributeEnvelopeRequestSchema = z.object({+ envelopeId: z.string(),+ recipients: z+ .array(z.number())+ .min(1)+ .describe('The IDs of the recipients to redistribute the envelope to.'),+});++export const ZRedistributeEnvelopeResponseSchema = z.void();++export type TRedistributeEnvelopeRequest = z.infer<typeof ZRedistributeEnvelopeRequestSchema>;+export type TRedistributeEnvelopeResponse = z.infer<typeof ZRedistributeEnvelopeResponseSchema>;diff --git a/packages/trpc/server/envelope-router/router.ts b/packages/trpc/server/envelope-router/router.tsnew file mode 100644index 000000000..0f57741f0--- /dev/null+++ b/packages/trpc/server/envelope-router/router.ts@@ -0,0 +1,38 @@+import { router } from '../trpc';+import { createEnvelopeRoute } from './create-envelope';+import { createEnvelopeItemsRoute } from './create-envelope-items';+import { deleteEnvelopeRoute } from './delete-envelope';+import { deleteEnvelopeItemRoute } from './delete-envelope-item';+import { distributeEnvelopeRoute } from './distribute-envelope';+import { duplicateEnvelopeRoute } from './duplicate-envelope';+import { getEnvelopeRoute } from './get-envelope';+import { redistributeEnvelopeRoute } from './redistribute-envelope';+import { setEnvelopeFieldsRoute } from './set-envelope-fields';+import { setEnvelopeRecipientsRoute } from './set-envelope-recipients';+import { signEnvelopeFieldRoute } from './sign-envelope-field';+import { updateEnvelopeRoute } from './update-envelope';+import { updateEnvelopeItemsRoute } from './update-envelope-items';++export const envelopeRouter = router({+ get: getEnvelopeRoute,+ create: createEnvelopeRoute,+ update: updateEnvelopeRoute,+ delete: deleteEnvelopeRoute,+ duplicate: duplicateEnvelopeRoute,+ distribute: distributeEnvelopeRoute,+ redistribute: redistributeEnvelopeRoute,+ // share: shareEnvelopeRoute,++ item: {+ createMany: createEnvelopeItemsRoute,+ updateMany: updateEnvelopeItemsRoute,+ delete: deleteEnvelopeItemRoute,+ },+ recipient: {+ set: setEnvelopeRecipientsRoute,+ },+ field: {+ set: setEnvelopeFieldsRoute,+ sign: signEnvelopeFieldRoute,+ },+});diff --git a/packages/trpc/server/envelope-router/set-envelope-fields.ts b/packages/trpc/server/envelope-router/set-envelope-fields.tsnew file mode 100644index 000000000..a9e4c4873--- /dev/null+++ b/packages/trpc/server/envelope-router/set-envelope-fields.ts@@ -0,0 +1,66 @@+import { EnvelopeType } from '@prisma/client';+import { match } from 'ts-pattern';++import { setFieldsForDocument } from '@documenso/lib/server-only/field/set-fields-for-document';+import { setFieldsForTemplate } from '@documenso/lib/server-only/field/set-fields-for-template';++import { authenticatedProcedure } from '../trpc';+import {+ ZSetEnvelopeFieldsRequestSchema,+ ZSetEnvelopeFieldsResponseSchema,+} from './set-envelope-fields.types';++// Note: This is intended to always be an internal route.+export const setEnvelopeFieldsRoute = authenticatedProcedure+ .input(ZSetEnvelopeFieldsRequestSchema)+ .output(ZSetEnvelopeFieldsResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId, envelopeType, fields } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ await match(envelopeType)+ .with(EnvelopeType.DOCUMENT, async () =>+ setFieldsForDocument({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ fields: fields.map((field) => ({+ ...field,+ pageNumber: field.page,+ pageX: field.positionX,+ pageY: field.positionY,+ pageWidth: field.width,+ pageHeight: field.height,+ })),+ requestMetadata: ctx.metadata,+ }),+ )+ .with(EnvelopeType.TEMPLATE, async () =>+ setFieldsForTemplate({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ fields: fields.map((field) => ({+ ...field,+ pageNumber: field.page,+ pageX: field.positionX,+ pageY: field.positionY,+ pageWidth: field.width,+ pageHeight: field.height,+ })),+ }),+ )+ .exhaustive();+ });diff --git a/packages/trpc/server/envelope-router/set-envelope-fields.types.ts b/packages/trpc/server/envelope-router/set-envelope-fields.types.tsnew file mode 100644index 000000000..08437a09c--- /dev/null+++ b/packages/trpc/server/envelope-router/set-envelope-fields.types.ts@@ -0,0 +1,51 @@+import { EnvelopeType, FieldType } from '@prisma/client';+import { z } from 'zod';++import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';++export const ZSetEnvelopeFieldsRequestSchema = z.object({+ envelopeId: z.string(),+ envelopeType: z.nativeEnum(EnvelopeType),+ fields: z.array(+ z.object({+ id: z+ .number()+ .optional()+ .describe('The id of the field. If not provided, a new field will be created.'),+ envelopeItemId: z.string().describe('The id of the envelope item to put the field on'),+ recipientId: z.number(),+ type: z.nativeEnum(FieldType),+ page: z+ .number()+ .min(1)+ .describe('The page number of the field on the envelope. Starts from 1.'),+ // Todo: Envelopes - Extract these 0-100 schemas with better descriptions.+ positionX: z+ .number()+ .min(0)+ .max(100)+ .describe('The percentage based X position of the field on the envelope.'),+ positionY: z+ .number()+ .min(0)+ .max(100)+ .describe('The percentage based Y position of the field on the envelope.'),+ width: z+ .number()+ .min(0)+ .max(100)+ .describe('The percentage based width of the field on the envelope.'),+ height: z+ .number()+ .min(0)+ .max(100)+ .describe('The percentage based height of the field on the envelope.'),+ fieldMeta: ZFieldMetaSchema, // Todo: Envelopes - Use a more strict form?+ }),+ ),+});++export const ZSetEnvelopeFieldsResponseSchema = z.void();++export type TSetEnvelopeFieldsRequest = z.infer<typeof ZSetEnvelopeFieldsRequestSchema>;+export type TSetEnvelopeFieldsResponse = z.infer<typeof ZSetEnvelopeFieldsResponseSchema>;diff --git a/packages/trpc/server/envelope-router/set-envelope-recipients.ts b/packages/trpc/server/envelope-router/set-envelope-recipients.tsnew file mode 100644index 000000000..f9f6ffd98--- /dev/null+++ b/packages/trpc/server/envelope-router/set-envelope-recipients.ts@@ -0,0 +1,51 @@+import { EnvelopeType } from '@prisma/client';+import { match } from 'ts-pattern';++import { setDocumentRecipients } from '@documenso/lib/server-only/recipient/set-document-recipients';+import { setTemplateRecipients } from '@documenso/lib/server-only/recipient/set-template-recipients';++import { authenticatedProcedure } from '../trpc';+import {+ ZSetEnvelopeRecipientsRequestSchema,+ ZSetEnvelopeRecipientsResponseSchema,+} from './set-envelope-recipients.types';++export const setEnvelopeRecipientsRoute = authenticatedProcedure+ .input(ZSetEnvelopeRecipientsRequestSchema)+ .output(ZSetEnvelopeRecipientsResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId, envelopeType, recipients } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ return await match(envelopeType)+ .with(EnvelopeType.DOCUMENT, async () =>+ setDocumentRecipients({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ recipients,+ requestMetadata: ctx.metadata,+ }),+ )+ .with(EnvelopeType.TEMPLATE, async () =>+ setTemplateRecipients({+ userId: ctx.user.id,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ recipients,+ }),+ )+ .exhaustive();+ });diff --git a/packages/trpc/server/envelope-router/set-envelope-recipients.types.ts b/packages/trpc/server/envelope-router/set-envelope-recipients.types.tsnew file mode 100644index 000000000..c24fd6402--- /dev/null+++ b/packages/trpc/server/envelope-router/set-envelope-recipients.types.ts@@ -0,0 +1,30 @@+import { EnvelopeType, RecipientRole } from '@prisma/client';+import { z } from 'zod';++import { ZRecipientActionAuthTypesSchema } from '@documenso/lib/types/document-auth';+import { ZRecipientLiteSchema } from '@documenso/lib/types/recipient';++export const ZSetEnvelopeRecipientsRequestSchema = z.object({+ envelopeId: z.string(),+ envelopeType: z.nativeEnum(EnvelopeType),+ recipients: z.array(+ z.object({+ id: z.number().optional(),+ email: z.string().toLowerCase().email().min(1).max(254),+ name: z.string().max(255),+ role: z.nativeEnum(RecipientRole),+ signingOrder: z.number().optional(),+ actionAuth: z.array(ZRecipientActionAuthTypesSchema).optional().default([]),+ }),+ ),+});++export const ZSetEnvelopeRecipientsResponseSchema = z.object({+ recipients: ZRecipientLiteSchema.omit({+ documentId: true,+ templateId: true,+ }).array(),+});++export type TSetEnvelopeRecipientsRequest = z.infer<typeof ZSetEnvelopeRecipientsRequestSchema>;+export type TSetEnvelopeRecipientsResponse = z.infer<typeof ZSetEnvelopeRecipientsResponseSchema>;diff --git a/packages/trpc/server/envelope-router/sign-envelope-field.ts b/packages/trpc/server/envelope-router/sign-envelope-field.tsnew file mode 100644index 000000000..953c29253--- /dev/null+++ b/packages/trpc/server/envelope-router/sign-envelope-field.ts@@ -0,0 +1,472 @@+import { DocumentStatus, FieldType, RecipientRole, SigningStatus } from '@prisma/client';+import { DateTime } from 'luxon';+import { P, match } from 'ts-pattern';+import { z } from 'zod';++import { validateCheckboxField } from '@documenso/lib/advanced-fields-validation/validate-checkbox';+import { validateDropdownField } from '@documenso/lib/advanced-fields-validation/validate-dropdown';+import { validateNumberField } from '@documenso/lib/advanced-fields-validation/validate-number';+import { validateRadioField } from '@documenso/lib/advanced-fields-validation/validate-radio';+import { validateTextField } from '@documenso/lib/advanced-fields-validation/validate-text';+import { DEFAULT_DOCUMENT_DATE_FORMAT } from '@documenso/lib/constants/date-formats';+import { DEFAULT_DOCUMENT_TIME_ZONE } from '@documenso/lib/constants/time-zones';+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { validateFieldAuth } from '@documenso/lib/server-only/document/validate-field-auth';+import { DOCUMENT_AUDIT_LOG_TYPE } from '@documenso/lib/types/document-audit-logs';+import {+ ZCheckboxFieldMeta,+ ZDropdownFieldMeta,+ ZNumberFieldMeta,+ ZRadioFieldMeta,+ ZTextFieldMeta,+} from '@documenso/lib/types/field-meta';+import { createDocumentAuditLogData } from '@documenso/lib/utils/document-audit-logs';+import { prisma } from '@documenso/prisma';++import { procedure } from '../trpc';+import {+ ZSignEnvelopeFieldRequestSchema,+ ZSignEnvelopeFieldResponseSchema,+} from './sign-envelope-field.types';++// Note that this is an unauthenticated public procedure route.+export const signEnvelopeFieldRoute = procedure+ .input(ZSignEnvelopeFieldRequestSchema)+ .output(ZSignEnvelopeFieldResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { user, metadata } = ctx;+ const { token, fieldId, fieldValue, authOptions } = input;++ ctx.logger.info({+ input: {+ fieldId,+ },+ });++ const recipient = await prisma.recipient.findFirst({+ where: {+ token,+ },+ });++ if (!recipient) {+ throw new AppError(AppErrorCode.NOT_FOUND);+ }++ const field = await prisma.field.findFirstOrThrow({+ where: {+ id: fieldId,+ recipient: {+ ...(recipient.role !== RecipientRole.ASSISTANT+ ? {+ id: recipient.id,+ }+ : {+ signingStatus: {+ not: SigningStatus.SIGNED,+ },+ signingOrder: {+ gte: recipient.signingOrder ?? 0,+ },+ }),+ },+ },+ include: {+ envelope: {+ include: {+ recipients: true,+ documentMeta: true,+ },+ },+ recipient: true,+ },+ });++ const { envelope } = field;+ const { documentMeta } = envelope;++ if (!envelope || !recipient) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: `Document not found for field ${field.id}`,+ });+ }++ if (envelope.internalVersion !== 2) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: `Envelope ${envelope.id} is not a version 2 envelope`,+ });+ }++ if (fieldValue.type !== field.type) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Selected values do not match the field values',+ });+ }++ if (envelope.deletedAt) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Document ${envelope.id} has been deleted`,+ });+ }++ if (envelope.status !== DocumentStatus.PENDING) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Document ${envelope.id} must be pending for signing`,+ });+ }++ if (+ recipient.signingStatus === SigningStatus.SIGNED ||+ field.recipient.signingStatus === SigningStatus.SIGNED+ ) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Recipient ${recipient.id} has already signed`,+ });+ }++ // Todo: Envelopes - Need to auto insert read only fields during sealing.+ if (field.fieldMeta?.readOnly) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: `Field ${fieldId} is read only`,+ });+ }++ // Unreachable code based on the above query but we need to satisfy TypeScript+ if (field.recipientId === null) {+ throw new Error(`Field ${fieldId} has no recipientId`);+ }++ let signatureImageAsBase64: string | null = null;+ let typedSignature: string | null = null;++ const insertionValues: { customText: string; inserted: boolean } = match(fieldValue)+ .with({ type: FieldType.EMAIL }, (fieldValue) => {+ const parsedEmailValue = z.string().email().nullable().safeParse(fieldValue.value);++ if (!parsedEmailValue.success) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid email',+ });+ }++ if (parsedEmailValue.data === null) {+ return {+ customText: '',+ inserted: false,+ };+ }++ return {+ customText: parsedEmailValue.data,+ inserted: true,+ };+ })+ .with({ type: P.union(FieldType.NAME, FieldType.INITIALS) }, (fieldValue) => {+ const parsedGenericStringValue = z.string().min(1).nullable().safeParse(fieldValue.value);++ if (!parsedGenericStringValue.success) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Value is required',+ });+ }++ if (parsedGenericStringValue.data === null) {+ return {+ customText: '',+ inserted: false,+ };+ }++ return {+ customText: parsedGenericStringValue.data,+ inserted: true,+ };+ })+ .with({ type: FieldType.DATE }, (fieldValue) => {+ if (!fieldValue.value) {+ return {+ customText: '',+ inserted: false,+ };+ }++ return {+ customText: DateTime.now()+ .setZone(documentMeta.timezone ?? DEFAULT_DOCUMENT_TIME_ZONE)+ .toFormat(documentMeta.dateFormat ?? DEFAULT_DOCUMENT_DATE_FORMAT),+ inserted: true,+ };+ })+ .with({ type: FieldType.NUMBER }, (fieldValue) => {+ if (!fieldValue.value) {+ return {+ customText: '',+ inserted: false,+ };+ }++ const numberFieldParsedMeta = ZNumberFieldMeta.parse(field.fieldMeta);+ const errors = validateNumberField(+ fieldValue.value.toString(),+ numberFieldParsedMeta,+ true,+ );++ // Todo+ if (errors.length > 0) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid number',+ });+ }++ return {+ customText: fieldValue.value.toString(),+ inserted: true,+ };+ })+ .with({ type: FieldType.TEXT }, (fieldValue) => {+ if (fieldValue.value === null) {+ return {+ customText: '',+ inserted: false,+ };+ }++ const parsedTextFieldMeta = ZTextFieldMeta.parse(field.fieldMeta);+ const errors = validateTextField(fieldValue.value, parsedTextFieldMeta, true);++ // Todo+ if (errors.length > 0) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid email',+ });+ }++ return {+ customText: fieldValue.value,+ inserted: true,+ };+ })+ .with({ type: FieldType.RADIO }, (fieldValue) => {+ if (fieldValue.value === null) {+ return {+ customText: '',+ inserted: false,+ };+ }++ const parsedRadioFieldParsedMeta = ZRadioFieldMeta.parse(field.fieldMeta);+ const errors = validateRadioField(fieldValue.value, parsedRadioFieldParsedMeta, true);++ if (errors.length > 0) {+ throw new Error(errors.join(', '));+ }++ // Todo+ if (errors.length > 0) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid radio value',+ });+ }++ return {+ customText: fieldValue.value,+ inserted: true,+ };+ })+ .with({ type: FieldType.CHECKBOX }, (fieldValue) => {+ if (fieldValue.value === null) {+ return {+ customText: '',+ inserted: false,+ };+ }++ // Todo: Envelopes - This won't work.++ const parsedCheckboxFieldParsedMeta = ZCheckboxFieldMeta.parse(field.fieldMeta);++ const checkboxFieldValues = parsedCheckboxFieldParsedMeta.values || [];++ const { value } = fieldValue;++ const selectedValues = checkboxFieldValues.filter(({ id }) => value.some((v) => v === id));++ if (selectedValues.length !== value.length) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Selected values do not match the checkbox field values',+ });+ }++ const errors = validateCheckboxField(+ selectedValues.map(({ value }) => value),+ parsedCheckboxFieldParsedMeta,+ true,+ );++ if (errors.length > 0) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid checkbox value:' + errors.join(', '),+ });+ }++ return {+ customText: JSON.stringify(fieldValue.value),+ inserted: true,+ };+ })+ .with({ type: FieldType.DROPDOWN }, (fieldValue) => {+ if (fieldValue.value === null) {+ return {+ customText: '',+ inserted: false,+ };+ }++ const parsedDropdownFieldMeta = ZDropdownFieldMeta.parse(field.fieldMeta);+ const errors = validateDropdownField(fieldValue.value, parsedDropdownFieldMeta, true);++ // Todo+ if (errors.length > 0) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Invalid dropdown value',+ });+ }++ return {+ customText: fieldValue.value,+ inserted: true,+ };+ })+ .with({ type: FieldType.SIGNATURE }, (fieldValue) => {+ const { value, isBase64 } = fieldValue;++ if (!value) {+ return {+ customText: '',+ inserted: false,+ };+ }++ signatureImageAsBase64 = isBase64 ? value : null;+ typedSignature = !isBase64 ? value : null;++ if (documentMeta.typedSignatureEnabled === false && typedSignature) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Typed signatures are not allowed. Please draw your signature',+ });+ }++ return {+ customText: '',+ inserted: true,+ };+ })+ .exhaustive();++ const derivedRecipientActionAuth = await validateFieldAuth({+ documentAuthOptions: envelope.authOptions,+ recipient,+ field,+ userId: user?.id,+ authOptions,+ });++ const assistant = recipient.role === RecipientRole.ASSISTANT ? recipient : undefined;++ return await prisma.$transaction(async (tx) => {+ const updatedField = await tx.field.update({+ where: {+ id: field.id,+ },+ data: {+ customText: insertionValues.customText,+ inserted: insertionValues.inserted,+ },+ include: {+ signature: true,+ },+ });++ if (field.type === FieldType.SIGNATURE) {+ const signature = await tx.signature.upsert({+ where: {+ fieldId: field.id,+ },+ create: {+ fieldId: field.id,+ recipientId: field.recipientId,+ signatureImageAsBase64: signatureImageAsBase64,+ typedSignature: typedSignature,+ },+ update: {+ signatureImageAsBase64: signatureImageAsBase64,+ typedSignature: typedSignature,+ },+ });++ // Dirty but I don't want to deal with type information+ Object.assign(updatedField, {+ signature,+ });+ }++ await tx.documentAuditLog.create({+ data: createDocumentAuditLogData({+ type:+ assistant && field.recipientId !== assistant.id+ ? DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FIELD_PREFILLED+ : DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_FIELD_INSERTED,+ envelopeId: envelope.id,+ user: {+ email: assistant?.email ?? recipient.email,+ name: assistant?.name ?? recipient.name,+ },+ requestMetadata: metadata.requestMetadata,+ data: {+ recipientEmail: recipient.email,+ recipientId: recipient.id,+ recipientName: recipient.name,+ recipientRole: recipient.role,+ fieldId: updatedField.secondaryId,+ field: match(updatedField.type)+ .with(FieldType.SIGNATURE, FieldType.FREE_SIGNATURE, (type) => ({+ type,+ data: signatureImageAsBase64 || typedSignature || '',+ }))+ .with(+ FieldType.DATE,+ FieldType.EMAIL,+ FieldType.NAME,+ FieldType.TEXT,+ FieldType.INITIALS,+ (type) => ({+ type,+ data: updatedField.customText,+ }),+ )+ .with(+ FieldType.NUMBER,+ FieldType.RADIO,+ FieldType.CHECKBOX,+ FieldType.DROPDOWN,+ (type) => ({+ type,+ data: updatedField.customText,+ }),+ )+ .exhaustive(),+ fieldSecurity: derivedRecipientActionAuth+ ? {+ type: derivedRecipientActionAuth,+ }+ : undefined,+ },+ }),+ });++ return {+ signedField: updatedField,+ };+ });+ });diff --git a/packages/trpc/server/envelope-router/sign-envelope-field.types.ts b/packages/trpc/server/envelope-router/sign-envelope-field.types.tsnew file mode 100644index 000000000..4ac138808--- /dev/null+++ b/packages/trpc/server/envelope-router/sign-envelope-field.types.ts@@ -0,0 +1,70 @@+import { z } from 'zod';++import { ZRecipientActionAuthSchema } from '@documenso/lib/types/document-auth';+import { ZFieldSchema } from '@documenso/lib/types/field';+import { FieldType } from '@documenso/prisma/client';+import SignatureSchema from '@documenso/prisma/generated/zod/modelSchema/SignatureSchema';++export const ZSignEnvelopeFieldValue = z.discriminatedUnion('type', [+ z.object({+ type: z.literal(FieldType.CHECKBOX),+ value: z.array(z.number()),+ }),+ z.object({+ type: z.literal(FieldType.RADIO),+ value: z.string().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.NUMBER),+ value: z.number().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.EMAIL),+ value: z.string().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.NAME),+ value: z.string().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.INITIALS),+ value: z.string().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.TEXT),+ value: z.string().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.DROPDOWN),+ value: z.string().nullable(),+ }),+ z.object({+ type: z.literal(FieldType.DATE),+ value: z.boolean(),+ }),+ z.object({+ type: z.literal(FieldType.SIGNATURE),+ value: z.string().nullable(),+ isBase64: z.boolean(),+ }),+]);++export const ZSignEnvelopeFieldRequestSchema = z.object({+ token: z.string(),+ fieldId: z.number(),+ fieldValue: ZSignEnvelopeFieldValue,+ authOptions: ZRecipientActionAuthSchema.optional(),+});++export const ZSignEnvelopeFieldResponseSchema = z.object({+ signedField: ZFieldSchema.omit({+ templateId: true,+ documentId: true,+ }).extend({+ signature: SignatureSchema.nullish(),+ }),+});++export type TSignEnvelopeFieldValue = z.infer<typeof ZSignEnvelopeFieldValue>;+export type TSignEnvelopeFieldRequest = z.infer<typeof ZSignEnvelopeFieldRequestSchema>;+export type TSignEnvelopeFieldResponse = z.infer<typeof ZSignEnvelopeFieldResponseSchema>;diff --git a/packages/trpc/server/envelope-router/update-envelope-items.ts b/packages/trpc/server/envelope-router/update-envelope-items.tsnew file mode 100644index 000000000..4ac052f36--- /dev/null+++ b/packages/trpc/server/envelope-router/update-envelope-items.ts@@ -0,0 +1,99 @@+import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';+import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';+import { canEnvelopeItemsBeModified } from '@documenso/lib/utils/envelope';+import { prisma } from '@documenso/prisma';++import { authenticatedProcedure } from '../trpc';+import {+ ZUpdateEnvelopeItemsRequestSchema,+ ZUpdateEnvelopeItemsResponseSchema,+} from './update-envelope-items.types';++export const updateEnvelopeItemsRoute = authenticatedProcedure+ .input(ZUpdateEnvelopeItemsRequestSchema)+ .output(ZUpdateEnvelopeItemsResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { user, teamId } = ctx;+ const { envelopeId, data } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ const { envelopeWhereInput } = await getEnvelopeWhereInput({+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ type: null,+ userId: user.id,+ teamId,+ });++ const envelope = await prisma.envelope.findUnique({+ where: envelopeWhereInput,+ include: {+ recipients: true,+ envelopeItems: true,+ },+ });++ if (!envelope) {+ throw new AppError(AppErrorCode.NOT_FOUND, {+ message: 'Envelope not found',+ });+ }++ if (data.length === 0) {+ throw new AppError(AppErrorCode.INVALID_BODY, {+ message: 'Envelope items are required',+ });+ }++ if (!canEnvelopeItemsBeModified(envelope, envelope.recipients)) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'Envelope item is not editable',+ });+ }++ // Check that the items belong to the envelope.+ const itemsBelongToEnvelope = data.every((item) =>+ envelope.envelopeItems.some(({ id }) => item.envelopeItemId === id),+ );++ if (!itemsBelongToEnvelope) {+ throw new AppError(AppErrorCode.INVALID_REQUEST, {+ message: 'One or more envelope items to update do not exist',+ });+ }++ const updatedEnvelopeItems = await Promise.all(+ data.map(async ({ envelopeItemId, order, title }) =>+ prisma.envelopeItem.update({+ where: {+ envelopeId: envelope.id,+ id: envelopeItemId,+ },+ data: {+ order,+ title,+ },+ select: {+ id: true,+ order: true,+ title: true,+ envelopeId: true,+ },+ }),+ ),+ );++ // Todo: Envelope - Audit logs?+ // Todo: Envelopes - Delete the document data as well?++ return {+ updatedEnvelopeItems,+ };+ });diff --git a/packages/trpc/server/envelope-router/update-envelope-items.types.ts b/packages/trpc/server/envelope-router/update-envelope-items.types.tsnew file mode 100644index 000000000..97040b84e--- /dev/null+++ b/packages/trpc/server/envelope-router/update-envelope-items.types.ts@@ -0,0 +1,29 @@+import { z } from 'zod';++import EnvelopeItemSchema from '@documenso/prisma/generated/zod/modelSchema/EnvelopeItemSchema';++import { ZDocumentTitleSchema } from '../document-router/schema';++export const ZUpdateEnvelopeItemsRequestSchema = z.object({+ envelopeId: z.string(),+ data: z+ .object({+ envelopeItemId: z.string(),+ order: z.number().int().min(1).optional(),+ title: ZDocumentTitleSchema.optional(),+ })+ .array()+ .min(1),+});++export const ZUpdateEnvelopeItemsResponseSchema = z.object({+ updatedEnvelopeItems: EnvelopeItemSchema.pick({+ id: true,+ order: true,+ title: true,+ envelopeId: true,+ }).array(),+});++export type TUpdateEnvelopeItemsRequest = z.infer<typeof ZUpdateEnvelopeItemsRequestSchema>;+export type TUpdateEnvelopeItemsResponse = z.infer<typeof ZUpdateEnvelopeItemsResponseSchema>;diff --git a/packages/trpc/server/envelope-router/update-envelope.ts b/packages/trpc/server/envelope-router/update-envelope.tsnew file mode 100644index 000000000..8de730be7--- /dev/null+++ b/packages/trpc/server/envelope-router/update-envelope.ts@@ -0,0 +1,36 @@+import { updateEnvelope } from '@documenso/lib/server-only/envelope/update-envelope';++import { authenticatedProcedure } from '../trpc';+import {+ ZUpdateEnvelopeRequestSchema,+ ZUpdateEnvelopeResponseSchema,+} from './update-envelope.types';++export const updateEnvelopeRoute = authenticatedProcedure+ // .meta(updateEnvelopeTrpcMeta)+ .input(ZUpdateEnvelopeRequestSchema)+ .output(ZUpdateEnvelopeResponseSchema)+ .mutation(async ({ input, ctx }) => {+ const { teamId } = ctx;+ const { envelopeId, data, meta = {} } = input;++ ctx.logger.info({+ input: {+ envelopeId,+ },+ });++ const userId = ctx.user.id;++ return await updateEnvelope({+ userId,+ teamId,+ id: {+ type: 'envelopeId',+ id: envelopeId,+ },+ data,+ meta,+ requestMetadata: ctx.metadata,+ });+ });diff --git a/packages/trpc/server/envelope-router/update-envelope.types.ts b/packages/trpc/server/envelope-router/update-envelope.types.tsnew file mode 100644index 000000000..a6fcc5165--- /dev/null+++ b/packages/trpc/server/envelope-router/update-envelope.types.ts@@ -0,0 +1,46 @@+import { EnvelopeType } from '@prisma/client';+// import type { OpenApiMeta } from 'trpc-to-openapi';+import { z } from 'zod';++import {+ ZDocumentAccessAuthTypesSchema,+ ZDocumentActionAuthTypesSchema,+} from '@documenso/lib/types/document-auth';+import { ZDocumentMetaUpdateSchema } from '@documenso/lib/types/document-meta';+import { ZEnvelopeLiteSchema } from '@documenso/lib/types/envelope';++import {+ ZDocumentExternalIdSchema,+ ZDocumentTitleSchema,+ ZDocumentVisibilitySchema,+} from '../document-router/schema';++// export const updateEnvelopeMeta: TrpcRouteMeta = {+// openapi: {+// method: 'POST',+// path: '/envelope/update',+// summary: 'Update envelope',+// tags: ['Envelope'],+// },+// };++export const ZUpdateEnvelopeRequestSchema = z.object({+ envelopeId: z.string(),+ envelopeType: z.nativeEnum(EnvelopeType),+ data: z+ .object({+ title: ZDocumentTitleSchema.optional(),+ externalId: ZDocumentExternalIdSchema.nullish(),+ visibility: ZDocumentVisibilitySchema.optional(),+ globalAccessAuth: z.array(ZDocumentAccessAuthTypesSchema).optional(),+ globalActionAuth: z.array(ZDocumentActionAuthTypesSchema).optional(),+ folderId: z.string().nullish(),+ })+ .optional(),+ meta: ZDocumentMetaUpdateSchema.optional(),+});++export const ZUpdateEnvelopeResponseSchema = ZEnvelopeLiteSchema;++export type TUpdateEnvelopeRequest = z.infer<typeof ZUpdateEnvelopeRequestSchema>;+export type TUpdateEnvelopeResponse = z.infer<typeof ZUpdateEnvelopeResponseSchema>;diff --git a/packages/trpc/server/field-router/router.ts b/packages/trpc/server/field-router/router.tsindex 462635544..a739f6f24 100644--- a/packages/trpc/server/field-router/router.ts+++ b/packages/trpc/server/field-router/router.ts@@ -1,5 +1,6 @@-import { createDocumentFields } from '@documenso/lib/server-only/field/create-document-fields';-import { createTemplateFields } from '@documenso/lib/server-only/field/create-template-fields';+import { EnvelopeType } from '@prisma/client';++import { createEnvelopeFields } from '@documenso/lib/server-only/field/create-envelope-fields';import { deleteDocumentField } from '@documenso/lib/server-only/field/delete-document-field';import { deleteTemplateField } from '@documenso/lib/server-only/field/delete-template-field';import { getFieldById } from '@documenso/lib/server-only/field/get-field-by-id';@@ -72,6 +73,7 @@ export const fieldRouter = router({userId: ctx.user.id,teamId,fieldId,+ envelopeType: EnvelopeType.DOCUMENT,});}),@@ -100,10 +102,13 @@ export const fieldRouter = router({},});- const createdFields = await createDocumentFields({+ const createdFields = await createEnvelopeFields({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },fields: [field],requestMetadata: ctx.metadata,});@@ -136,10 +141,13 @@ export const fieldRouter = router({},});- return await createDocumentFields({+ return await createEnvelopeFields({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },fields,requestMetadata: ctx.metadata,});@@ -251,10 +259,8 @@ export const fieldRouter = router({/*** @private- *- * Todo: Refactor to setFieldsForDocument function.*/- addFields: authenticatedProcedure+ setFieldsForDocument: authenticatedProcedure.input(ZSetDocumentFieldsRequestSchema).output(ZSetDocumentFieldsResponseSchema).mutation(async ({ input, ctx }) => {@@ -268,13 +274,16 @@ export const fieldRouter = router({});return await setFieldsForDocument({- documentId,userId: ctx.user.id,teamId,+ id: {+ type: 'documentId',+ id: documentId,+ },fields: fields.map((field) => ({- id: field.nativeId,- signerEmail: field.signerEmail,+ id: field.id,recipientId: field.recipientId,+ envelopeItemId: field.envelopeItemId,type: field.type,pageNumber: field.pageNumber,pageX: field.pageX,@@ -312,11 +321,15 @@ export const fieldRouter = router({},});- const createdFields = await createTemplateFields({+ const createdFields = await createEnvelopeFields({userId: ctx.user.id,teamId,- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },fields: [field],+ requestMetadata: ctx.metadata,});return createdFields.fields[0];@@ -352,6 +365,7 @@ export const fieldRouter = router({userId: ctx.user.id,teamId,fieldId,+ envelopeType: EnvelopeType.TEMPLATE,});}),@@ -380,11 +394,15 @@ export const fieldRouter = router({},});- return await createTemplateFields({+ return await createEnvelopeFields({userId: ctx.user.id,teamId,- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },fields,+ requestMetadata: ctx.metadata,});}),@@ -491,10 +509,8 @@ export const fieldRouter = router({/*** @private- *- * Todo: Refactor to setFieldsForTemplate.*/- addTemplateFields: authenticatedProcedure+ setFieldsForTemplate: authenticatedProcedure.input(ZSetFieldsForTemplateRequestSchema).output(ZSetFieldsForTemplateResponseSchema).mutation(async ({ input, ctx }) => {@@ -508,13 +524,16 @@ export const fieldRouter = router({});return await setFieldsForTemplate({- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },userId: ctx.user.id,teamId,fields: fields.map((field) => ({- id: field.nativeId,- signerEmail: field.signerEmail,+ id: field.id,recipientId: field.recipientId,+ envelopeItemId: field.envelopeItemId,type: field.type,pageNumber: field.pageNumber,pageX: field.pageX,diff --git a/packages/trpc/server/field-router/schema.ts b/packages/trpc/server/field-router/schema.tsindex 89912f5d8..34b4e9cf8 100644--- a/packages/trpc/server/field-router/schema.ts+++ b/packages/trpc/server/field-router/schema.ts@@ -110,11 +110,10 @@ export const ZSetDocumentFieldsRequestSchema = z.object({documentId: z.number(),fields: z.array(z.object({- formId: z.string().min(1),- nativeId: z.number().optional(),+ id: z.number().optional(),type: z.nativeEnum(FieldType),- signerEmail: z.string().min(1),recipientId: z.number().min(1),+ envelopeItemId: z.string(),pageNumber: z.number().min(1),pageX: z.number().min(0),pageY: z.number().min(0),@@ -133,11 +132,10 @@ export const ZSetFieldsForTemplateRequestSchema = z.object({templateId: z.number(),fields: z.array(z.object({- formId: z.string().min(1),- nativeId: z.number().optional(),+ id: z.number().optional(),type: z.nativeEnum(FieldType),- signerEmail: z.string().min(1),recipientId: z.number().min(1),+ envelopeItemId: z.string(),pageNumber: z.number().min(1),pageX: z.number().min(0),pageY: z.number().min(0),diff --git a/packages/trpc/server/folder-router/router.ts b/packages/trpc/server/folder-router/router.tsindex 742567b30..53148c43b 100644--- a/packages/trpc/server/folder-router/router.ts+++ b/packages/trpc/server/folder-router/router.ts@@ -4,13 +4,10 @@ import { deleteFolder } from '@documenso/lib/server-only/folder/delete-folder';import { findFolders } from '@documenso/lib/server-only/folder/find-folders';import { getFolderBreadcrumbs } from '@documenso/lib/server-only/folder/get-folder-breadcrumbs';import { getFolderById } from '@documenso/lib/server-only/folder/get-folder-by-id';-import { moveDocumentToFolder } from '@documenso/lib/server-only/folder/move-document-to-folder';import { moveFolder } from '@documenso/lib/server-only/folder/move-folder';-import { moveTemplateToFolder } from '@documenso/lib/server-only/folder/move-template-to-folder';import { pinFolder } from '@documenso/lib/server-only/folder/pin-folder';import { unpinFolder } from '@documenso/lib/server-only/folder/unpin-folder';import { updateFolder } from '@documenso/lib/server-only/folder/update-folder';-import { FolderType } from '@documenso/lib/types/folder-type';import { authenticatedProcedure, router } from '../trpc';import {@@ -21,9 +18,7 @@ import {ZGenericSuccessResponse,ZGetFoldersResponseSchema,ZGetFoldersSchema,- ZMoveDocumentToFolderSchema,ZMoveFolderSchema,- ZMoveTemplateToFolderSchema,ZPinFolderSchema,ZSuccessResponseSchema,ZUnpinFolderSchema,@@ -266,95 +261,6 @@ export const folderRouter = router({};}),- /**- * @private- */- moveDocumentToFolder: authenticatedProcedure- .input(ZMoveDocumentToFolderSchema)- .mutation(async ({ input, ctx }) => {- const { teamId, user } = ctx;- const { documentId, folderId } = input;-- ctx.logger.info({- input: {- documentId,- folderId,- },- });-- if (folderId !== null) {- try {- await getFolderById({- userId: user.id,- teamId,- folderId,- type: FolderType.DOCUMENT,- });- } catch (error) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }- }-- const result = await moveDocumentToFolder({- userId: user.id,- teamId,- documentId,- folderId,- requestMetadata: ctx.metadata,- });-- return {- ...result,- type: FolderType.DOCUMENT,- };- }),-- /**- * @private- */- moveTemplateToFolder: authenticatedProcedure- .input(ZMoveTemplateToFolderSchema)- .mutation(async ({ input, ctx }) => {- const { teamId, user } = ctx;- const { templateId, folderId } = input;-- ctx.logger.info({- input: {- templateId,- folderId,- },- });-- if (folderId !== null) {- try {- await getFolderById({- userId: user.id,- teamId,- folderId,- type: FolderType.TEMPLATE,- });- } catch (error) {- throw new AppError(AppErrorCode.NOT_FOUND, {- message: 'Folder not found',- });- }- }-- const result = await moveTemplateToFolder({- userId: user.id,- teamId,- templateId,- folderId,- });-- return {- ...result,- type: FolderType.TEMPLATE,- };- }),-/*** @private*/diff --git a/packages/trpc/server/folder-router/schema.ts b/packages/trpc/server/folder-router/schema.tsindex 6595cea4d..53e512dc9 100644--- a/packages/trpc/server/folder-router/schema.ts+++ b/packages/trpc/server/folder-router/schema.ts@@ -77,18 +77,6 @@ export const ZMoveFolderSchema = z.object({type: ZFolderTypeSchema.optional(),});-export const ZMoveDocumentToFolderSchema = z.object({- documentId: z.number(),- folderId: z.string().nullable().optional(),- type: z.enum(['DOCUMENT']).optional(),-});--export const ZMoveTemplateToFolderSchema = z.object({- templateId: z.number(),- folderId: z.string().nullable().optional(),- type: z.enum(['TEMPLATE']).optional(),-});-export const ZPinFolderSchema = z.object({folderId: z.string(),type: ZFolderTypeSchema.optional(),diff --git a/packages/trpc/server/organisation-router/update-organisation-settings.types.ts b/packages/trpc/server/organisation-router/update-organisation-settings.types.tsindex 6d9e79b2a..0bb88d2bc 100644--- a/packages/trpc/server/organisation-router/update-organisation-settings.types.ts+++ b/packages/trpc/server/organisation-router/update-organisation-settings.types.ts@@ -2,12 +2,11 @@ import { z } from 'zod';import { SUPPORTED_LANGUAGE_CODES } from '@documenso/lib/constants/i18n';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import { DocumentVisibility } from '@documenso/lib/types/document-visibility';-import {ZDocumentMetaDateFormatSchema,ZDocumentMetaTimezoneSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import { DocumentVisibility } from '@documenso/lib/types/document-visibility';export const ZUpdateOrganisationSettingsRequestSchema = z.object({organisationId: z.string(),diff --git a/packages/trpc/server/recipient-router/router.ts b/packages/trpc/server/recipient-router/router.tsindex 401251b27..b8ed8bc0f 100644--- a/packages/trpc/server/recipient-router/router.ts+++ b/packages/trpc/server/recipient-router/router.ts@@ -1,3 +1,5 @@+import { EnvelopeType } from '@prisma/client';+import { completeDocumentWithToken } from '@documenso/lib/server-only/document/complete-document-with-token';import { rejectDocumentWithToken } from '@documenso/lib/server-only/document/reject-document-with-token';import { createDocumentRecipients } from '@documenso/lib/server-only/recipient/create-document-recipients';@@ -77,6 +79,7 @@ export const recipientRouter = router({userId: ctx.user.id,teamId,recipientId,+ type: EnvelopeType.DOCUMENT,});}),@@ -108,7 +111,10 @@ export const recipientRouter = router({const createdRecipients = await createDocumentRecipients({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients: [recipient],requestMetadata: ctx.metadata,});@@ -144,7 +150,10 @@ export const recipientRouter = router({return await createDocumentRecipients({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients,requestMetadata: ctx.metadata,});@@ -178,7 +187,10 @@ export const recipientRouter = router({const updatedRecipients = await updateDocumentRecipients({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients: [recipient],requestMetadata: ctx.metadata,});@@ -214,7 +226,10 @@ export const recipientRouter = router({return await updateDocumentRecipients({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients,requestMetadata: ctx.metadata,});@@ -273,9 +288,12 @@ export const recipientRouter = router({return await setDocumentRecipients({userId: ctx.user.id,teamId,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },recipients: recipients.map((recipient) => ({- id: recipient.nativeId,+ id: recipient.id,email: recipient.email,name: recipient.name,role: recipient.role,@@ -316,6 +334,7 @@ export const recipientRouter = router({userId: ctx.user.id,teamId,recipientId,+ type: EnvelopeType.TEMPLATE,});}),@@ -507,9 +526,12 @@ export const recipientRouter = router({return await setTemplateRecipients({userId: ctx.user.id,teamId,- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },recipients: recipients.map((recipient) => ({- id: recipient.nativeId,+ id: recipient.id,email: recipient.email,name: recipient.name,role: recipient.role,@@ -533,9 +555,12 @@ export const recipientRouter = router({},});- return await completeDocumentWithToken({+ await completeDocumentWithToken({token,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },authOptions,accessAuthOptions,nextSigner,@@ -560,7 +585,10 @@ export const recipientRouter = router({return await rejectDocumentWithToken({token,- documentId,+ id: {+ type: 'documentId',+ id: documentId,+ },reason,requestMetadata: ctx.metadata.requestMetadata,});diff --git a/packages/trpc/server/recipient-router/schema.ts b/packages/trpc/server/recipient-router/schema.tsindex 2307cd6cb..dafebd196 100644--- a/packages/trpc/server/recipient-router/schema.ts+++ b/packages/trpc/server/recipient-router/schema.ts@@ -82,7 +82,7 @@ export const ZSetDocumentRecipientsRequestSchema = z.object({documentId: z.number(),recipients: z.array(z.object({- nativeId: z.number().optional(),+ id: z.number().optional(),email: z.string().toLowerCase().email().min(1).max(254),name: z.string().max(255),role: z.nativeEnum(RecipientRole),@@ -136,7 +136,7 @@ export const ZSetTemplateRecipientsRequestSchema = z.object({templateId: z.number(),recipients: z.array(z.object({- nativeId: z.number().optional(),+ id: z.number().optional(),email: z.string().toLowerCase()diff --git a/packages/trpc/server/router.ts b/packages/trpc/server/router.tsindex fbe35147c..b2327f769 100644--- a/packages/trpc/server/router.ts+++ b/packages/trpc/server/router.ts@@ -4,12 +4,12 @@ import { authRouter } from './auth-router/router';import { documentRouter } from './document-router/router';import { embeddingPresignRouter } from './embedding-router/_router';import { enterpriseRouter } from './enterprise-router/router';+import { envelopeRouter } from './envelope-router/router';import { fieldRouter } from './field-router/router';import { folderRouter } from './folder-router/router';import { organisationRouter } from './organisation-router/router';import { profileRouter } from './profile-router/router';import { recipientRouter } from './recipient-router/router';-import { shareLinkRouter } from './share-link-router/router';import { teamRouter } from './team-router/router';import { templateRouter } from './template-router/router';import { router } from './trpc';@@ -17,6 +17,7 @@ import { webhookRouter } from './webhook-router/router';export const appRouter = router({enterprise: enterpriseRouter,+ envelope: envelopeRouter,auth: authRouter,profile: profileRouter,document: documentRouter,@@ -25,7 +26,6 @@ export const appRouter = router({recipient: recipientRouter,admin: adminRouter,organisation: organisationRouter,- shareLink: shareLinkRouter,apiToken: apiTokenRouter,team: teamRouter,template: templateRouter,diff --git a/packages/trpc/server/share-link-router/get-document-internal-url-for-qr-code.ts b/packages/trpc/server/share-link-router/get-document-internal-url-for-qr-code.tsdeleted file mode 100644index 20764d89d..000000000--- a/packages/trpc/server/share-link-router/get-document-internal-url-for-qr-code.ts+++ /dev/null@@ -1,50 +0,0 @@-import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';-import { buildTeamWhereQuery } from '@documenso/lib/utils/teams';-import { prisma } from '@documenso/prisma';--import { procedure } from '../trpc';-import {- ZGetDocumentInternalUrlForQRCodeInput,- ZGetDocumentInternalUrlForQRCodeOutput,-} from './get-document-internal-url-for-qr-code.types';--export const getDocumentInternalUrlForQRCodeRoute = procedure- .input(ZGetDocumentInternalUrlForQRCodeInput)- .output(ZGetDocumentInternalUrlForQRCodeOutput)- .query(async ({ input, ctx }) => {- const { documentId } = input;-- ctx.logger.info({- input: {- documentId,- },- });-- if (!ctx.user) {- return null;- }-- const document = await prisma.document.findFirst({- where: {- OR: [- {- id: documentId,- userId: ctx.user.id,- },- {- id: documentId,- team: buildTeamWhereQuery({ teamId: undefined, userId: ctx.user.id }),- },- ],- },- include: {- team: true,- },- });-- if (!document) {- return null;- }-- return `${NEXT_PUBLIC_WEBAPP_URL()}/t/${document.team.url}/documents/${document.id}`;- });diff --git a/packages/trpc/server/share-link-router/get-document-internal-url-for-qr-code.types.ts b/packages/trpc/server/share-link-router/get-document-internal-url-for-qr-code.types.tsdeleted file mode 100644index cc7a56c1d..000000000--- a/packages/trpc/server/share-link-router/get-document-internal-url-for-qr-code.types.ts+++ /dev/null@@ -1,15 +0,0 @@-import { z } from 'zod';--export const ZGetDocumentInternalUrlForQRCodeInput = z.object({- documentId: z.number(),-});--export type TGetDocumentInternalUrlForQRCodeInput = z.infer<- typeof ZGetDocumentInternalUrlForQRCodeInput->;--export const ZGetDocumentInternalUrlForQRCodeOutput = z.string().nullable();--export type TGetDocumentInternalUrlForQRCodeOutput = z.infer<- typeof ZGetDocumentInternalUrlForQRCodeOutput->;diff --git a/packages/trpc/server/share-link-router/router.ts b/packages/trpc/server/share-link-router/router.tsdeleted file mode 100644index 3f8ac695f..000000000--- a/packages/trpc/server/share-link-router/router.ts+++ /dev/null@@ -1,33 +0,0 @@-import { createOrGetShareLink } from '@documenso/lib/server-only/share/create-or-get-share-link';--import { procedure, router } from '../trpc';-import { getDocumentInternalUrlForQRCodeRoute } from './get-document-internal-url-for-qr-code';-import { ZCreateOrGetShareLinkMutationSchema } from './schema';--export const shareLinkRouter = router({- createOrGetShareLink: procedure- .input(ZCreateOrGetShareLinkMutationSchema)- .mutation(async ({ ctx, input }) => {- const { documentId, token } = input;-- ctx.logger.info({- input: {- documentId,- },- });-- if (token) {- return await createOrGetShareLink({ documentId, token });- }-- if (!ctx.user?.id) {- throw new Error(- 'You must either provide a token or be logged in to create a sharing link.',- );- }-- return await createOrGetShareLink({ documentId, userId: ctx.user.id });- }),-- getDocumentInternalUrlForQRCode: getDocumentInternalUrlForQRCodeRoute,-});diff --git a/packages/trpc/server/share-link-router/schema.ts b/packages/trpc/server/share-link-router/schema.tsdeleted file mode 100644index 9ea599042..000000000--- a/packages/trpc/server/share-link-router/schema.ts+++ /dev/null@@ -1,10 +0,0 @@-import { z } from 'zod';--export const ZCreateOrGetShareLinkMutationSchema = z.object({- documentId: z.number(),- token: z.string().optional(),-});--export type TCreateOrGetShareLinkMutationSchema = z.infer<- typeof ZCreateOrGetShareLinkMutationSchema->;diff --git a/packages/trpc/server/team-router/update-team-settings.types.ts b/packages/trpc/server/team-router/update-team-settings.types.tsindex aaf5e94f1..c021c5408 100644--- a/packages/trpc/server/team-router/update-team-settings.types.ts+++ b/packages/trpc/server/team-router/update-team-settings.types.ts@@ -2,12 +2,11 @@ import { z } from 'zod';import { SUPPORTED_LANGUAGE_CODES } from '@documenso/lib/constants/i18n';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import { DocumentVisibility } from '@documenso/lib/types/document-visibility';-import {ZDocumentMetaDateFormatSchema,ZDocumentMetaTimezoneSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import { DocumentVisibility } from '@documenso/lib/types/document-visibility';/*** Null = Inherit from organisation.diff --git a/packages/trpc/server/template-router/router.ts b/packages/trpc/server/template-router/router.tsindex a9041ad3e..68bbd2127 100644--- a/packages/trpc/server/template-router/router.ts+++ b/packages/trpc/server/template-router/router.ts@@ -1,5 +1,5 @@-import type { Document } from '@prisma/client';-import { DocumentDataType } from '@prisma/client';+import type { Envelope } from '@prisma/client';+import { DocumentDataType, EnvelopeType } from '@prisma/client';import { getServerLimits } from '@documenso/ee/server-only/limits/server';import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';@@ -7,24 +7,25 @@ import { jobs } from '@documenso/lib/jobs/client';import { createDocumentData } from '@documenso/lib/server-only/document-data/create-document-data';import { getDocumentWithDetailsById } from '@documenso/lib/server-only/document/get-document-with-details-by-id';import { sendDocument } from '@documenso/lib/server-only/document/send-document';+import { createEnvelope } from '@documenso/lib/server-only/envelope/create-envelope';+import { duplicateEnvelope } from '@documenso/lib/server-only/envelope/duplicate-envelope';+import { updateEnvelope } from '@documenso/lib/server-only/envelope/update-envelope';import {ZCreateDocumentFromDirectTemplateResponseSchema,createDocumentFromDirectTemplate,} from '@documenso/lib/server-only/template/create-document-from-direct-template';import { createDocumentFromTemplate } from '@documenso/lib/server-only/template/create-document-from-template';-import {- ZCreateTemplateResponseSchema,- createTemplate,-} from '@documenso/lib/server-only/template/create-template';import { createTemplateDirectLink } from '@documenso/lib/server-only/template/create-template-direct-link';import { deleteTemplate } from '@documenso/lib/server-only/template/delete-template';import { deleteTemplateDirectLink } from '@documenso/lib/server-only/template/delete-template-direct-link';-import { duplicateTemplate } from '@documenso/lib/server-only/template/duplicate-template';import { findTemplates } from '@documenso/lib/server-only/template/find-templates';import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';import { toggleTemplateDirectLink } from '@documenso/lib/server-only/template/toggle-template-direct-link';-import { updateTemplate } from '@documenso/lib/server-only/template/update-template';import { getPresignPostUrl } from '@documenso/lib/universal/upload/server-actions';+import { mapSecondaryIdToTemplateId } from '@documenso/lib/utils/envelope';+import { mapFieldToLegacyField } from '@documenso/lib/utils/fields';+import { mapRecipientToLegacyRecipient } from '@documenso/lib/utils/recipients';+import { mapEnvelopeToTemplateLite } from '@documenso/lib/utils/templates';import { ZGenericSuccessResponse, ZSuccessResponseSchema } from '../document-router/schema';import { authenticatedProcedure, maybeAuthenticatedProcedure, router } from '../trpc';@@ -36,6 +37,7 @@ import {ZCreateTemplateDirectLinkRequestSchema,ZCreateTemplateDirectLinkResponseSchema,ZCreateTemplateMutationSchema,+ ZCreateTemplateResponseSchema,ZCreateTemplateV2RequestSchema,ZCreateTemplateV2ResponseSchema,ZDeleteTemplateDirectLinkRequestSchema,@@ -77,11 +79,44 @@ export const templateRouter = router({},});- return await findTemplates({+ const result = await findTemplates({userId: ctx.user.id,teamId,...input,});++ // Remapping for backwards compatibility.+ return {+ ...result,+ data: result.data.map((envelope) => {+ const legacyTemplateId = mapSecondaryIdToTemplateId(envelope.secondaryId);++ return {+ id: legacyTemplateId,+ envelopeId: envelope.id,+ type: envelope.templateType,+ visibility: envelope.visibility,+ externalId: envelope.externalId,+ title: envelope.title,+ userId: envelope.userId,+ teamId: envelope.teamId,+ authOptions: envelope.authOptions,+ createdAt: envelope.createdAt,+ updatedAt: envelope.updatedAt,+ publicTitle: envelope.publicTitle,+ publicDescription: envelope.publicDescription,+ folderId: envelope.folderId,+ useLegacyFieldInsertion: envelope.useLegacyFieldInsertion,+ team: envelope.team,+ fields: envelope.fields.map((field) => mapFieldToLegacyField(field, envelope)),+ recipients: envelope.recipients.map((recipient) =>+ mapRecipientToLegacyRecipient(recipient, envelope),+ ),+ templateMeta: envelope.documentMeta,+ directLink: envelope.directLink,+ };+ }),+ };}),/**@@ -109,7 +144,10 @@ export const templateRouter = router({});return await getTemplateById({- id: templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },userId: ctx.user.id,teamId,});@@ -121,7 +159,7 @@ export const templateRouter = router({* @private*/createTemplate: authenticatedProcedure- // .meta({+ // .meta({ // Note before releasing this to public, update the response schema to be correct.// openapi: {// method: 'POST',// path: '/template/create',@@ -142,15 +180,26 @@ export const templateRouter = router({},});- return await createTemplate({+ const envelope = await createEnvelope({userId: ctx.user.id,teamId,- templateDocumentDataId,+ internalVersion: 1,data: {+ type: EnvelopeType.TEMPLATE,title,folderId,+ envelopeItems: [+ {+ documentDataId: templateDocumentDataId,+ },+ ],},+ requestMetadata: ctx.metadata,});++ return {+ legacyTemplateId: mapSecondaryIdToTemplateId(envelope.secondaryId),+ };}),/**@@ -197,26 +246,38 @@ export const templateRouter = router({type: DocumentDataType.S3_PATH,});- const createdTemplate = await createTemplate({+ const createdTemplate = await createEnvelope({userId: user.id,teamId,- templateDocumentDataId: templateDocumentData.id,+ internalVersion: 1,data: {+ type: EnvelopeType.TEMPLATE,title,+ envelopeItems: [+ {+ documentDataId: templateDocumentData.id,+ },+ ],folderId,- externalId,+ externalId: externalId ?? undefined,visibility,globalAccessAuth,globalActionAuth,+ templateType: type,publicTitle,publicDescription,- type,},meta,+ requestMetadata: ctx.metadata,});+ const legacyTemplateId = mapSecondaryIdToTemplateId(createdTemplate.secondaryId);+const fullTemplate = await getTemplateById({- id: createdTemplate.id,+ id: {+ type: 'templateId',+ id: legacyTemplateId,+ },userId: user.id,teamId,});@@ -252,13 +313,22 @@ export const templateRouter = router({},});- return await updateTemplate({+ const envelope = await updateEnvelope({userId,teamId,- templateId,- data,+ id: {+ type: 'templateId',+ id: templateId,+ },+ data: {+ ...data,+ templateType: data?.type, // Backwards compatibility.+ },meta,+ requestMetadata: ctx.metadata,});++ return mapEnvelopeToTemplateLite(envelope);}),/**@@ -285,11 +355,16 @@ export const templateRouter = router({},});- return await duplicateTemplate({+ const duplicatedEnvelope = await duplicateEnvelope({userId: ctx.user.id,teamId,- templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },});++ return mapEnvelopeToTemplateLite(duplicatedEnvelope.envelope);}),/**@@ -317,7 +392,14 @@ export const templateRouter = router({},});- await deleteTemplate({ userId, id: templateId, teamId });+ await deleteTemplate({+ userId,+ id: {+ type: 'templateId',+ id: templateId,+ },+ teamId,+ });return ZGenericSuccessResponse;}),@@ -360,12 +442,25 @@ export const templateRouter = router({throw new Error('You have reached your document limit.');}- const document: Document = await createDocumentFromTemplate({- templateId,+ // Backwards compatibility mapping since we need the envelopeItemId for the custom document data.+ const customDocumentData = customDocumentDataId+ ? [+ {+ documentDataId: customDocumentDataId,+ envelopeItemId: undefined,+ },+ ]+ : input.customDocumentData || [];++ const envelope: Envelope = await createDocumentFromTemplate({+ id: {+ type: 'templateId',+ id: templateId,+ },teamId,userId: ctx.user.id,recipients,- customDocumentDataId,+ customDocumentData,requestMetadata: ctx.metadata,folderId,prefillFields,@@ -373,7 +468,10 @@ export const templateRouter = router({if (distributeDocument) {await sendDocument({- documentId: document.id,+ id: {+ type: 'envelopeId',+ id: envelope.id,+ },userId: ctx.user.id,teamId,requestMetadata: ctx.metadata,@@ -385,7 +483,10 @@ export const templateRouter = router({}return getDocumentWithDetailsById({- documentId: document.id,+ id: {+ type: 'envelopeId',+ id: envelope.id,+ },userId: ctx.user.id,teamId,});@@ -470,7 +571,14 @@ export const templateRouter = router({},});- const template = await getTemplateById({ id: templateId, teamId, userId: ctx.user.id });+ const template = await getTemplateById({+ id: {+ type: 'templateId',+ id: templateId,+ },+ teamId,+ userId: ctx.user.id,+ });const limits = await getServerLimits({ userId: ctx.user.id, teamId: template.teamId });@@ -480,7 +588,15 @@ export const templateRouter = router({});}- return await createTemplateDirectLink({ userId, teamId, templateId, directRecipientId });+ return await createTemplateDirectLink({+ userId,+ teamId,+ id: {+ type: 'templateId',+ id: templateId,+ },+ directRecipientId,+ });}),/**@@ -569,7 +685,10 @@ export const templateRouter = router({}const template = await getTemplateById({- id: templateId,+ id: {+ type: 'templateId',+ id: templateId,+ },teamId,userId: user.id,});diff --git a/packages/trpc/server/template-router/schema.ts b/packages/trpc/server/template-router/schema.tsindex a00717f33..a53e8ba8c 100644--- a/packages/trpc/server/template-router/schema.ts+++ b/packages/trpc/server/template-router/schema.ts@@ -7,15 +7,6 @@ import {ZDocumentActionAuthTypesSchema,} from '@documenso/lib/types/document-auth';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import { ZFieldMetaPrefillFieldsSchema } from '@documenso/lib/types/field-meta';-import { ZFindResultResponse, ZFindSearchParamsSchema } from '@documenso/lib/types/search-params';-import {- ZTemplateLiteSchema,- ZTemplateManySchema,- ZTemplateSchema,-} from '@documenso/lib/types/template';-import { TemplateDirectLinkSchema } from '@documenso/prisma/generated/zod/modelSchema/TemplateDirectLinkSchema';-import {ZDocumentMetaDateFormatSchema,ZDocumentMetaDistributionMethodSchema,@@ -27,7 +18,16 @@ import {ZDocumentMetaTimezoneSchema,ZDocumentMetaTypedSignatureEnabledSchema,ZDocumentMetaUploadSignatureEnabledSchema,-} from '../document-router/schema';+} from '@documenso/lib/types/document-meta';+import { ZFieldMetaPrefillFieldsSchema } from '@documenso/lib/types/field-meta';+import { ZFindResultResponse, ZFindSearchParamsSchema } from '@documenso/lib/types/search-params';+import {+ ZTemplateLiteSchema,+ ZTemplateManySchema,+ ZTemplateSchema,+} from '@documenso/lib/types/template';+import { LegacyTemplateDirectLinkSchema } from '@documenso/prisma/types/template-legacy-schema';+import { ZSignFieldWithTokenMutationSchema } from '../field-router/schema';export const MAX_TEMPLATE_PUBLIC_TITLE_LENGTH = 50;@@ -109,9 +109,21 @@ export const ZCreateDocumentFromTemplateRequestSchema = z.object({customDocumentDataId: z.string().describe(- 'The data ID of an alternative PDF to use when creating the document. If not provided, the PDF attached to the template will be used.',+ '[DEPRECATED] - Use customDocumentData instead. The data ID of an alternative PDF to use when creating the document. If not provided, the PDF attached to the template will be used.',+ )+ .optional(),+ customDocumentData: z+ .array(+ z.object({+ documentDataId: z.string(),+ envelopeItemId: z.string(),+ }),+ )+ .describe(+ 'The data IDs of alternative PDFs to use when creating the document. If not provided, the PDF attached to the template will be used.',).optional(),+folderId: z.string().describe(@@ -144,13 +156,14 @@ export const ZCreateTemplateDirectLinkRequestSchema = z.object({.optional(),});-const GenericDirectLinkResponseSchema = TemplateDirectLinkSchema.pick({+const GenericDirectLinkResponseSchema = LegacyTemplateDirectLinkSchema.pick({id: true,- templateId: true,token: true,createdAt: true,enabled: true,directTemplateRecipientId: true,+ envelopeId: true,+ templateId: true,});export const ZCreateTemplateDirectLinkResponseSchema = GenericDirectLinkResponseSchema;@@ -194,6 +207,10 @@ export const ZCreateTemplateV2ResponseSchema = z.object({uploadUrl: z.string().min(1),});+export const ZCreateTemplateResponseSchema = z.object({+ legacyTemplateId: z.number(),+});+export const ZUpdateTemplateRequestSchema = z.object({templateId: z.number(),data: z@@ -207,6 +224,7 @@ export const ZUpdateTemplateRequestSchema = z.object({publicDescription: ZTemplatePublicDescriptionSchema.optional(),type: z.nativeEnum(TemplateType).optional(),useLegacyFieldInsertion: z.boolean().optional(),+ folderId: z.string().nullish(),}).optional(),meta: ZTemplateMetaUpsertSchema.optional(),diff --git a/packages/ui/components/document/document-read-only-fields.tsx b/packages/ui/components/document/document-read-only-fields.tsxindex 4ea0d6c89..5d3cb2539 100644--- a/packages/ui/components/document/document-read-only-fields.tsx+++ b/packages/ui/components/document/document-read-only-fields.tsx@@ -2,13 +2,12 @@ import { useState } from 'react';import { useLingui } from '@lingui/react';import { Trans } from '@lingui/react/macro';-import type { DocumentMeta, Field, Recipient, TemplateMeta } from '@prisma/client';+import type { DocumentMeta, Field, Recipient } from '@prisma/client';import { SigningStatus } from '@prisma/client';import { Clock, EyeOffIcon } from 'lucide-react';import { PDF_VIEWER_PAGE_SELECTOR } from '@documenso/lib/constants/pdf-viewer';import { isTemplateRecipientEmailPlaceholder } from '@documenso/lib/constants/template';-import type { DocumentField } from '@documenso/lib/server-only/field/get-fields-for-document';import { parseMessageDescriptor } from '@documenso/lib/utils/i18n';import { extractInitials } from '@documenso/lib/utils/recipient-formatter';import { FieldRootContainer } from '@documenso/ui/components/field/field';@@ -34,9 +33,13 @@ const getRecipientDisplayText = (recipient: { name: string; email: string }) =>return recipient.email;};+export type DocumentField = Field & {+ recipient: Pick<Recipient, 'name' | 'email' | 'signingStatus'>;+};+export type DocumentReadOnlyFieldsProps = {fields: DocumentField[];- documentMeta?: Pick<DocumentMeta | TemplateMeta, 'dateFormat'>;+ documentMeta?: Pick<DocumentMeta, 'dateFormat'>;showFieldStatus?: boolean;diff --git a/packages/ui/components/document/document-share-button.tsx b/packages/ui/components/document/document-share-button.tsxindex 23e47794b..f546abaeb 100644--- a/packages/ui/components/document/document-share-button.tsx+++ b/packages/ui/components/document/document-share-button.tsx@@ -60,7 +60,7 @@ export const DocumentShareButton = ({mutateAsync: createOrGetShareLink,data: shareLink,isPending: isCreatingOrGettingShareLink,- } = trpc.shareLink.createOrGetShareLink.useMutation();+ } = trpc.document.share.useMutation();const isLoading = isCreatingOrGettingShareLink || isCopyingShareLink;diff --git a/packages/ui/components/field/field-tooltip.tsx b/packages/ui/components/field/field-tooltip.tsxindex f658875e8..027978292 100644--- a/packages/ui/components/field/field-tooltip.tsx+++ b/packages/ui/components/field/field-tooltip.tsx@@ -29,7 +29,10 @@ const tooltipVariants = cva('font-semibold', {interface FieldToolTipProps extends VariantProps<typeof tooltipVariants> {children: React.ReactNode;className?: string;- field: Field;+ field: Pick<+ Field,+ 'id' | 'inserted' | 'fieldMeta' | 'positionX' | 'positionY' | 'width' | 'height' | 'page'+ >;}/**@@ -48,6 +51,7 @@ export function FieldToolTip({ children, color, className = '', field }: FieldToreturn createPortal(<div+ id="field-tooltip"className={cn('pointer-events-none absolute')}style={{top: `${coords.y}px`,diff --git a/packages/ui/components/pdf-viewer/pdf-viewer-konva-lazy.tsx b/packages/ui/components/pdf-viewer/pdf-viewer-konva-lazy.tsxnew file mode 100644index 000000000..954bda37e--- /dev/null+++ b/packages/ui/components/pdf-viewer/pdf-viewer-konva-lazy.tsx@@ -0,0 +1,23 @@+import React, { Suspense, lazy } from 'react';++import { type PDFDocumentProxy } from 'pdfjs-dist';++export type LoadedPDFDocument = PDFDocumentProxy;++export type PDFViewerProps = {+ className?: string;+ onDocumentLoad?: () => void;+ [key: string]: unknown;+} & Omit<React.HTMLAttributes<HTMLDivElement>, 'onPageClick'>;++const EnvelopePdfViewer = lazy(async () => import('./pdf-viewer-konva'));++export const PDFViewerKonvaLazy = (props: PDFViewerProps) => {+ return (+ <Suspense fallback={<div>Loading client component...</div>}>+ <EnvelopePdfViewer {...props} />+ </Suspense>+ );+};++export default PDFViewerKonvaLazy;diff --git a/packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx b/packages/ui/components/pdf-viewer/pdf-viewer-konva.tsxnew file mode 100644index 000000000..adf1b213b--- /dev/null+++ b/packages/ui/components/pdf-viewer/pdf-viewer-konva.tsx@@ -0,0 +1,173 @@+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';++import { Trans } from '@lingui/react/macro';+import Konva from 'konva';+import { Loader } from 'lucide-react';+import { type PDFDocumentProxy } from 'pdfjs-dist';+import { Document as PDFDocument, Page as PDFPage, pdfjs } from 'react-pdf';++import { useCurrentEnvelopeRender } from '@documenso/lib/client-only/providers/envelope-render-provider';+import { cn } from '@documenso/ui/lib/utils';++export type LoadedPDFDocument = PDFDocumentProxy;++/**+ * This imports the worker from the `pdfjs-dist` package.+ */+pdfjs.GlobalWorkerOptions.workerSrc = new URL(+ 'pdfjs-dist/build/pdf.worker.min.js',+ import.meta.url,+).toString();++const PDFLoader = () => (+ <>+ <Loader className="text-documenso h-12 w-12 animate-spin" />++ <p className="text-muted-foreground mt-4">+ <Trans>Loading document...</Trans>+ </p>+ </>+);++export type PdfViewerKonvaProps = {+ className?: string;+ onDocumentLoad?: () => void;+ customPageRenderer?: React.FunctionComponent;+ [key: string]: unknown;+} & Omit<React.HTMLAttributes<HTMLDivElement>, 'onPageClick'>;++export const PdfViewerKonva = ({+ className,+ onDocumentLoad,+ customPageRenderer,+ ...props+}: PdfViewerKonvaProps) => {+ const $el = useRef<HTMLDivElement>(null);++ const { getPdfBuffer, currentEnvelopeItem } = useCurrentEnvelopeRender();++ const [width, setWidth] = useState(0);+ const [numPages, setNumPages] = useState(0);+ const [pdfError, setPdfError] = useState(false);++ const envelopeItemFile = useMemo(() => {+ const data = getPdfBuffer(currentEnvelopeItem?.documentDataId || '');++ if (!data || data.status !== 'loaded') {+ return null;+ }++ return {+ data: new Uint8Array(data.file),+ };+ }, [currentEnvelopeItem?.documentDataId, getPdfBuffer]);++ const onDocumentLoaded = useCallback(+ (doc: PDFDocumentProxy) => {+ setNumPages(doc.numPages);+ },+ [onDocumentLoad],+ );++ useEffect(() => {+ if ($el.current) {+ const $current = $el.current;++ const { width } = $current.getBoundingClientRect();++ setWidth(width);++ const onResize = () => {+ const { width } = $current.getBoundingClientRect();+ setWidth(width);+ };++ window.addEventListener('resize', onResize);++ return () => {+ window.removeEventListener('resize', onResize);+ };+ }+ }, []);++ return (+ <div ref={$el} className={cn('w-[800px] overflow-hidden', className)} {...props}>+ {envelopeItemFile && Konva ? (+ <PDFDocument+ file={envelopeItemFile}+ className={cn('w-full overflow-hidden rounded', {+ 'h-[80vh] max-h-[60rem]': numPages === 0,+ })}+ onLoadSuccess={(d) => onDocumentLoaded(d)}+ // Uploading a invalid document causes an error which doesn't appear to be handled by the `error` prop.+ // Therefore we add some additional custom error handling.+ onSourceError={() => {+ setPdfError(true);+ }}+ externalLinkTarget="_blank"+ loading={+ <div className="dark:bg-background flex h-[80vh] max-h-[60rem] flex-col items-center justify-center bg-white/50">+ {pdfError ? (+ <div className="text-muted-foreground text-center">+ <p>+ <Trans>Something went wrong while loading the document.</Trans>+ </p>+ <p className="mt-1 text-sm">+ <Trans>Please try again or contact our support.</Trans>+ </p>+ </div>+ ) : (+ <PDFLoader />+ )}+ </div>+ }+ error={+ <div className="dark:bg-background flex h-[80vh] max-h-[60rem] flex-col items-center justify-center bg-white/50">+ <div className="text-muted-foreground text-center">+ <p>+ <Trans>Something went wrong while loading the document.</Trans>+ </p>+ <p className="mt-1 text-sm">+ <Trans>Please try again or contact our support.</Trans>+ </p>+ </div>+ </div>+ }+ >+ {Array(numPages)+ .fill(null)+ .map((_, i) => (+ <div key={i} className="last:-mb-2">+ <div className="border-border overflow-hidden rounded border will-change-transform">+ <PDFPage+ pageNumber={i + 1}+ width={width}+ renderAnnotationLayer={false}+ renderTextLayer={false}+ loading={() => ''}+ renderMode={customPageRenderer ? 'custom' : 'canvas'}+ customRenderer={customPageRenderer}+ />+ </div>+ <p className="text-muted-foreground/80 my-2 text-center text-[11px]">+ <Trans>+ Page {i + 1} of {numPages}+ </Trans>+ </p>+ </div>+ ))}+ </PDFDocument>+ ) : (+ <div+ className={cn(+ 'flex h-[80vh] max-h-[60rem] w-full flex-col items-center justify-center overflow-hidden rounded',+ )}+ >+ <PDFLoader />+ </div>+ )}+ </div>+ );+};++export default PdfViewerKonva;diff --git a/packages/ui/components/signing-card.tsx b/packages/ui/components/signing-card.tsxindex d6465e5e4..0cf5799d0 100644--- a/packages/ui/components/signing-card.tsx+++ b/packages/ui/components/signing-card.tsx@@ -10,7 +10,7 @@ import { Card, CardContent } from '../primitives/card';export type SigningCardProps = {className?: string;name: string;- signature?: Signature;+ signature?: Pick<Signature, 'signatureImageAsBase64' | 'typedSignature'>;signingCelebrationImage?: string;};@@ -154,7 +154,7 @@ export const SigningCard3D = ({type SigningCardContentProps = {name: string;- signature?: Signature;+ signature?: Pick<Signature, 'signatureImageAsBase64' | 'typedSignature'>;className?: string;};diff --git a/packages/ui/lib/recipient-colors.ts b/packages/ui/lib/recipient-colors.tsindex 39d24f4b5..f8fb810e3 100644--- a/packages/ui/lib/recipient-colors.ts+++ b/packages/ui/lib/recipient-colors.ts@@ -7,16 +7,22 @@ export type RecipientColorMap = Record<number, RecipientColorStyles>;export type RecipientColorStyles = {base: string;+ baseRing: string;+ baseRingHover: string;fieldItem: string;fieldItemInitials: string;comboxBoxTrigger: string;comboxBoxItem: string;};+export const DEFAULT_RECT_BACKGROUND = 'rgba(255, 255, 255, 0.95)';+// !: values of the declared variable to do all the background, border and shadow styles.export const RECIPIENT_COLOR_STYLES = {readOnly: {base: 'ring-neutral-400',+ baseRing: 'rgba(176, 176, 176, 1)',+ baseRingHover: 'rgba(176, 176, 176, 1)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: '',comboxBoxTrigger:@@ -26,6 +32,8 @@ export const RECIPIENT_COLOR_STYLES = {green: {base: 'ring-recipient-green hover:bg-recipient-green/30',+ baseRing: 'rgba(122, 195, 85, 1)',+ baseRingHover: 'rgba(122, 195, 85, 0.3)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: 'group-hover/field-item:bg-recipient-green',comboxBoxTrigger:@@ -35,6 +43,8 @@ export const RECIPIENT_COLOR_STYLES = {blue: {base: 'ring-recipient-blue hover:bg-recipient-blue/30',+ baseRing: 'rgba(56, 123, 199, 1)',+ baseRingHover: 'rgba(56, 123, 199, 0.3)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: 'group-hover/field-item:bg-recipient-blue',comboxBoxTrigger:@@ -44,6 +54,8 @@ export const RECIPIENT_COLOR_STYLES = {purple: {base: 'ring-recipient-purple hover:bg-recipient-purple/30',+ baseRing: 'rgba(151, 71, 255, 1)',+ baseRingHover: 'rgba(151, 71, 255, 0.3)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: 'group-hover/field-item:bg-recipient-purple',comboxBoxTrigger:@@ -53,6 +65,8 @@ export const RECIPIENT_COLOR_STYLES = {orange: {base: 'ring-recipient-orange hover:bg-recipient-orange/30',+ baseRing: 'rgba(246, 159, 30, 1)',+ baseRingHover: 'rgba(246, 159, 30, 0.3)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: 'group-hover/field-item:bg-recipient-orange',comboxBoxTrigger:@@ -62,6 +76,8 @@ export const RECIPIENT_COLOR_STYLES = {yellow: {base: 'ring-recipient-yellow hover:bg-recipient-yellow/30',+ baseRing: 'rgba(219, 186, 0, 1)',+ baseRingHover: 'rgba(219, 186, 0, 0.3)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: 'group-hover/field-item:bg-recipient-yellow',comboxBoxTrigger:@@ -71,6 +87,8 @@ export const RECIPIENT_COLOR_STYLES = {pink: {base: 'ring-recipient-pink hover:bg-recipient-pink/30',+ baseRing: 'rgba(217, 74, 186, 1)',+ baseRingHover: 'rgba(217, 74, 186, 0.3)',fieldItem: 'group/field-item rounded-[2px]',fieldItemInitials: 'group-hover/field-item:bg-recipient-pink',comboxBoxTrigger:@@ -79,7 +97,7 @@ export const RECIPIENT_COLOR_STYLES = {},} satisfies Record<string, RecipientColorStyles>;-export type CombinedStylesKey = keyof typeof RECIPIENT_COLOR_STYLES;+export type TRecipientColor = keyof typeof RECIPIENT_COLOR_STYLES;export const AVAILABLE_RECIPIENT_COLORS = ['green',@@ -88,7 +106,7 @@ export const AVAILABLE_RECIPIENT_COLORS = ['orange','yellow','pink',-] satisfies CombinedStylesKey[];+] satisfies TRecipientColor[];export const useRecipientColors = (index: number) => {const key = AVAILABLE_RECIPIENT_COLORS[index % AVAILABLE_RECIPIENT_COLORS.length];diff --git a/packages/ui/primitives/card.tsx b/packages/ui/primitives/card.tsxindex b83a09164..f3d9f61af 100644--- a/packages/ui/primitives/card.tsx+++ b/packages/ui/primitives/card.tsx@@ -1,27 +1,25 @@import * as React from 'react';-import { motion, useMotionTemplate, useMotionValue } from 'framer-motion';-import { cn } from '../lib/utils';export type CardProps = React.HTMLAttributes<HTMLDivElement> & {spotlight?: boolean;gradient?: boolean;degrees?: number;++ /**+ * Not sure if this is needed, but added a toggle so it defaults to true since that was how it was before.+ *+ * This is required to be set false if you want drag drop to work within this element.+ */+ backdropBlur?: boolean;};const Card = React.forwardRef<HTMLDivElement, CardProps>(- ({ className, children, gradient = false, spotlight = false, degrees = 120, ...props }, ref) => {- const mouseX = useMotionValue(0);- const mouseY = useMotionValue(0);-- const handleMouseMove = ({ currentTarget, clientX, clientY }: React.MouseEvent) => {- const { left, top } = currentTarget.getBoundingClientRect();-- mouseX.set(clientX - left);- mouseY.set(clientY - top);- };-+ (+ { className, children, gradient = false, degrees = 120, backdropBlur = true, ...props },+ ref,+ ) => {return (<divref={ref}@@ -32,8 +30,9 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(} as React.CSSProperties}className={cn(- 'bg-background text-foreground group relative rounded-lg border-2 backdrop-blur-[2px]',+ 'bg-background text-foreground group relative rounded-lg border-2',{+ 'backdrop-blur-[2px]': backdropBlur,'gradient-border-mask before:pointer-events-none before:absolute before:-inset-[2px] before:rounded-lg before:p-[2px] before:[background:linear-gradient(var(--card-gradient-degrees),theme(colors.primary.DEFAULT/50%)_5%,theme(colors.border/80%)_30%)]':gradient,'dark:gradient-border-mask before:pointer-events-none before:absolute before:-inset-[2px] before:rounded-lg before:p-[2px] before:[background:linear-gradient(var(--card-gradient-degrees),theme(colors.primary.DEFAULT/70%)_5%,theme(colors.border/80%)_30%)]':@@ -44,23 +43,8 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(},className,)}- onMouseMove={handleMouseMove}{...props}>- {spotlight && (- <motion.div- className="pointer-events-none absolute -inset-[2px] rounded-lg opacity-0 transition duration-300 group-hover:opacity-100"- style={{- background: useMotionTemplate`- radial-gradient(- 300px circle at ${mouseX}px ${mouseY}px,- hsl(var(--primary) / 7%),- transparent 80%- )- `,- }}- />- )}{children}</div>);diff --git a/packages/ui/primitives/document-dropzone.tsx b/packages/ui/primitives/document-dropzone.tsxindex 043ec1ef1..140facb74 100644--- a/packages/ui/primitives/document-dropzone.tsx+++ b/packages/ui/primitives/document-dropzone.tsx@@ -26,9 +26,11 @@ import { Card, CardContent } from './card';export type DocumentDropzoneProps = {className?: string;+ allowMultiple?: boolean;disabled?: boolean;+ disabledHeading?: MessageDescriptor;disabledMessage?: MessageDescriptor;- onDrop?: (_file: File) => void | Promise<void>;+ onDrop?: (_file: File[]) => void | Promise<void>;onDropRejected?: () => void | Promise<void>;type?: 'document' | 'template';[key: string]: unknown;@@ -36,9 +38,11 @@ export type DocumentDropzoneProps = {export const DocumentDropzone = ({className,+ allowMultiple,onDrop,onDropRejected,disabled,+ disabledHeading,disabledMessage = msg`You cannot upload documents at this time.`,type = 'document',...props@@ -51,11 +55,11 @@ export const DocumentDropzone = ({accept: {'application/pdf': ['.pdf'],},- multiple: false,+ multiple: allowMultiple,disabled,- onDrop: ([acceptedFile]) => {- if (acceptedFile && onDrop) {- void onDrop(acceptedFile);+ onDrop: (acceptedFiles) => {+ if (acceptedFiles.length > 0 && onDrop) {+ void onDrop(acceptedFiles);}},onDropRejected: () => {@@ -67,7 +71,9 @@ export const DocumentDropzone = ({});const heading = {- document: disabled ? msg`You have reached your document limit.` : msg`Add a document`,+ document: disabled+ ? disabledHeading || msg`You have reached your document limit.`+ : msg`Add a document`,template: msg`Upload Template Document`,};@@ -153,7 +159,7 @@ export const DocumentDropzone = ({<input {...getInputProps()} />- <p className="text-foreground mt-8 font-medium">{_(heading[type])}</p>+ <p className="text-foreground mt-6 font-medium">{_(heading[type])}</p><p className="text-muted-foreground/80 mt-1 text-center text-sm">{_(disabled ? disabledMessage : msg`Drag & drop your PDF here.`)}diff --git a/packages/ui/primitives/document-flow/add-fields.tsx b/packages/ui/primitives/document-flow/add-fields.tsxindex eef021fe0..aa1a0e5c5 100644--- a/packages/ui/primitives/document-flow/add-fields.tsx+++ b/packages/ui/primitives/document-flow/add-fields.tsx@@ -19,7 +19,6 @@ import {} from 'lucide-react';import { useFieldArray, useForm } from 'react-hook-form';import { useHotkeys } from 'react-hotkeys-hook';-import { prop, sortBy } from 'remeda';import { getBoundingClientRect } from '@documenso/lib/client-only/get-bounding-client-rect';import { useAutoSave } from '@documenso/lib/client-only/hooks/use-autosave';@@ -120,7 +119,7 @@ export const AddFieldsFormPartial = ({defaultValues: {fields: fields.map((field) => ({nativeId: field.id,- formId: `${field.id}-${field.documentId}`,+ formId: `${field.id}-${field.envelopeItemId}`,pageNumber: field.page,type: field.type,pageX: Number(field.positionX),@@ -551,29 +550,6 @@ export const AddFieldsFormPartial = ({return recipientsByRole;}, [recipients]);- const recipientsByRoleToDisplay = useMemo(() => {- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions- return (Object.entries(recipientsByRole) as [RecipientRole, Recipient[]][])- .filter(- ([role]) =>- role !== RecipientRole.CC &&- role !== RecipientRole.VIEWER &&- role !== RecipientRole.ASSISTANT,- )- .map(- ([role, roleRecipients]) =>- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions- [- role,- sortBy(- roleRecipients,- [(r) => r.signingOrder || Number.MAX_SAFE_INTEGER, 'asc'],- [prop('id'), 'asc'],- ),- ] as [RecipientRole, Recipient[]],- );- }, [recipientsByRole]);-const handleAdvancedSettings = () => {setShowAdvancedSettings((prev) => !prev);};diff --git a/packages/ui/primitives/document-flow/add-settings.types.ts b/packages/ui/primitives/document-flow/add-settings.types.tsindex ea70556f0..c08cd1b1e 100644--- a/packages/ui/primitives/document-flow/add-settings.types.ts+++ b/packages/ui/primitives/document-flow/add-settings.types.ts@@ -10,11 +10,11 @@ import {ZDocumentAccessAuthTypesSchema,ZDocumentActionAuthTypesSchema,} from '@documenso/lib/types/document-auth';-import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';import {ZDocumentMetaDateFormatSchema,ZDocumentMetaTimezoneSchema,-} from '@documenso/trpc/server/document-router/schema';+} from '@documenso/lib/types/document-meta';+import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';export const ZAddSettingsFormSchema = z.object({title: zdiff --git a/packages/ui/primitives/document-flow/add-signers.tsx b/packages/ui/primitives/document-flow/add-signers.tsxindex 2010775c4..94c7690b0 100644--- a/packages/ui/primitives/document-flow/add-signers.tsx+++ b/packages/ui/primitives/document-flow/add-signers.tsx@@ -216,6 +216,7 @@ export const AddSignersFormPartial = ({// Sync the response recipients back to form state to prevent duplicatesif (response?.recipients) {const currentSigners = form.getValues('signers');+const updatedSigners = currentSigners.map((signer) => {// Find the matching recipient from the response using nativeIdconst matchingRecipient = response.recipients.find(@@ -228,10 +229,9 @@ export const AddSignersFormPartial = ({...signer,nativeId: matchingRecipient.id,};- }-- // For new signers without nativeId, match by email and update with server ID- if (!signer.nativeId) {+ } else if (!signer.nativeId) {+ // For new signers without nativeId, match by email and update with server ID+ // Bug: Multiple recipients with the same email will be matched incorrectly here.const newRecipient = response.recipients.find((recipient) => recipient.email === signer.email,);diff --git a/packages/ui/primitives/document-flow/field-content.tsx b/packages/ui/primitives/document-flow/field-content.tsxindex f8eec0092..4ea926013 100644--- a/packages/ui/primitives/document-flow/field-content.tsx+++ b/packages/ui/primitives/document-flow/field-content.tsx@@ -1,5 +1,5 @@import { useLingui } from '@lingui/react';-import type { DocumentMeta, Signature, TemplateMeta } from '@prisma/client';+import type { DocumentMeta, Signature } from '@prisma/client';import { FieldType } from '@prisma/client';import { ChevronDown } from 'lucide-react';@@ -27,7 +27,7 @@ type FieldIconProps = {fieldMeta?: TFieldMetaSchema | null;signature?: Signature | null;};- documentMeta?: Pick<DocumentMeta | TemplateMeta, 'dateFormat'>;+ documentMeta?: Pick<DocumentMeta, 'dateFormat'>;};/**diff --git a/packages/ui/primitives/document-flow/field-items-advanced-settings/constants.ts b/packages/ui/primitives/document-flow/field-items-advanced-settings/constants.tsindex 6916c6825..a1f611a68 100644--- a/packages/ui/primitives/document-flow/field-items-advanced-settings/constants.ts+++ b/packages/ui/primitives/document-flow/field-items-advanced-settings/constants.ts@@ -2,14 +2,17 @@ export const numberFormatValues = [{label: '123,456,789.00',value: '123,456,789.00',+ regex: /^(?:\d{1,3}(?:,\d{3})*|\d+)(?:\.\d{1,2})?$/,},{label: '123.456.789,00',value: '123.456.789,00',+ regex: /^(?:\d{1,3}(?:\.\d{3})*|\d+)(?:,\d{1,2})?$/,},{label: '123456,789.00',value: '123456,789.00',+ regex: /^(?:\d+)(?:,\d{1,3}(?:\.\d{1,2})?)?$/,},];diff --git a/packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx b/packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsxindex 998a73442..2106036c8 100644--- a/packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx+++ b/packages/ui/primitives/document-flow/field-items-advanced-settings/number-field.tsx@@ -102,7 +102,7 @@ export const NumberFieldAdvancedSettings = ({<Trans>Number format</Trans></Label><Select- value={fieldState.numberFormat}+ value={fieldState.numberFormat ?? ''}onValueChange={(val) => handleInput('numberFormat', val)}><SelectTrigger className="text-muted-foreground bg-background mt-2 w-full">@@ -199,7 +199,7 @@ export const NumberFieldAdvancedSettings = ({id="minValue"className="bg-background mt-2"placeholder="E.g. 0"- value={fieldState.minValue}+ value={fieldState.minValue ?? ''}onChange={(e) => handleInput('minValue', e.target.value)}/></div>@@ -211,7 +211,7 @@ export const NumberFieldAdvancedSettings = ({id="maxValue"className="bg-background mt-2"placeholder="E.g. 100"- value={fieldState.maxValue}+ value={fieldState.maxValue ?? ''}onChange={(e) => handleInput('maxValue', e.target.value)}/></div>diff --git a/packages/ui/primitives/document-upload.tsx b/packages/ui/primitives/document-upload.tsxindex 7ea3aff82..f8c6d5453 100644--- a/packages/ui/primitives/document-upload.tsx+++ b/packages/ui/primitives/document-upload.tsx@@ -20,9 +20,9 @@ export type DocumentDropzoneProps = {disabled?: boolean;loading?: boolean;disabledMessage?: MessageDescriptor;- onDrop?: (_file: File) => void | Promise<void>;+ onDrop?: (_files: File[]) => void | Promise<void>;onDropRejected?: () => void | Promise<void>;- type?: 'document' | 'template';+ type?: 'document' | 'template' | 'envelope';[key: string]: unknown;};@@ -48,11 +48,12 @@ export const DocumentDropzone = ({accept: {'application/pdf': ['.pdf'],},- multiple: false,+ multiple: type === 'envelope',disabled,- onDrop: ([acceptedFile]) => {- if (acceptedFile && onDrop) {- void onDrop(acceptedFile);+ maxFiles: 10, // Todo: Envelopes - Use claims. And also update other places where this is used.+ onDrop: (acceptedFiles) => {+ if (acceptedFiles.length > 0 && onDrop) {+ void onDrop(acceptedFiles);}},onDropRejected: () => {@@ -66,6 +67,7 @@ export const DocumentDropzone = ({const heading = {document: msg`Upload Document`,template: msg`Upload Template Document`,+ envelope: msg`Envelope (beta)`,};if (disabled && IS_BILLING_ENABLED()) {diff --git a/packages/ui/primitives/pdf-viewer.tsx b/packages/ui/primitives/pdf-viewer.tsxindex bb19a4444..3bf8f0866 100644--- a/packages/ui/primitives/pdf-viewer.tsx+++ b/packages/ui/primitives/pdf-viewer.tsx@@ -48,7 +48,7 @@ const PDFLoader = () => (export type PDFViewerProps = {className?: string;- documentData: DocumentData;+ documentData: Pick<DocumentData, 'type' | 'data'>;onDocumentLoad?: (_doc: LoadedPDFDocument) => void;onPageClick?: OnPDFViewerPageClick;[key: string]: unknown;diff --git a/packages/ui/primitives/recipient-selector.tsx b/packages/ui/primitives/recipient-selector.tsxindex c4aba87ac..e2a28c42c 100644--- a/packages/ui/primitives/recipient-selector.tsx+++ b/packages/ui/primitives/recipient-selector.tsx@@ -21,6 +21,7 @@ export interface RecipientSelectorProps {selectedRecipient: Recipient | null;onSelectedRecipientChange: (recipient: Recipient) => void;recipients: Recipient[];+ align?: 'center' | 'end' | 'start';}export const RecipientSelector = ({@@ -28,6 +29,7 @@ export const RecipientSelector = ({selectedRecipient,onSelectedRecipientChange,recipients,+ align = 'start',}: RecipientSelectorProps) => {const { _ } = useLingui();const [showRecipientsSelector, setShowRecipientsSelector] = useState(false);@@ -83,7 +85,7 @@ export const RecipientSelector = ({recipients.findIndex((r) => r.id === selectedRecipient?.id),0,),- ).base,+ ).comboxBoxTrigger,className,)}>@@ -101,8 +103,8 @@ export const RecipientSelector = ({</Button></PopoverTrigger>- <PopoverContent className="p-0" align="start">- <Command value={selectedRecipient?.email}>+ <PopoverContent className="p-0" align={align}>+ <Command value={selectedRecipient ? selectedRecipient.id.toString() : undefined}><CommandInput /><CommandEmpty>@@ -149,7 +151,7 @@ export const RecipientSelector = ({><spanclassName={cn('text-foreground/70 truncate', {- 'text-foreground/80': recipient === selectedRecipient,+ 'text-foreground/80': recipient.id === selectedRecipient?.id,})}>{recipient.name && (@@ -164,10 +166,10 @@ export const RecipientSelector = ({<div className="ml-auto flex items-center justify-center">{recipient.sendStatus !== SendStatus.SENT ? (<Check- aria-hidden={recipient !== selectedRecipient}+ aria-hidden={recipient.id !== selectedRecipient?.id}className={cn('h-4 w-4 flex-shrink-0', {- 'opacity-0': recipient !== selectedRecipient,- 'opacity-100': recipient === selectedRecipient,+ 'opacity-0': recipient.id !== selectedRecipient?.id,+ 'opacity-100': recipient.id === selectedRecipient?.id,})}/>) : (diff --git a/packages/ui/primitives/template-flow/add-template-fields.tsx b/packages/ui/primitives/template-flow/add-template-fields.tsxindex 7db417036..321251f1f 100644--- a/packages/ui/primitives/template-flow/add-template-fields.tsx+++ b/packages/ui/primitives/template-flow/add-template-fields.tsx@@ -109,7 +109,7 @@ export const AddTemplateFieldsFormPartial = ({defaultValues: {fields: fields.map((field) => ({nativeId: field.id,- formId: `${field.id}-${field.templateId}`,+ formId: `${field.id}-${field.envelopeItemId}`,pageNumber: field.page,type: field.type,pageX: Number(field.positionX),diff --git a/packages/ui/primitives/template-flow/add-template-settings.tsx b/packages/ui/primitives/template-flow/add-template-settings.tsxindex 83cbc80c2..32d0a2c61 100644--- a/packages/ui/primitives/template-flow/add-template-settings.tsx+++ b/packages/ui/primitives/template-flow/add-template-settings.tsx@@ -19,11 +19,11 @@ import {import { SUPPORTED_LANGUAGES } from '@documenso/lib/constants/i18n';import { DEFAULT_DOCUMENT_TIME_ZONE, TIME_ZONES } from '@documenso/lib/constants/time-zones';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';+import type { TDocumentMetaDateFormat } from '@documenso/lib/types/document-meta';import type { TTemplate } from '@documenso/lib/types/template';import { extractDocumentAuthMethods } from '@documenso/lib/utils/document-auth';import { extractTeamSignatureSettings } from '@documenso/lib/utils/teams';import { trpc } from '@documenso/trpc/react';-import type { TDocumentMetaDateFormat } from '@documenso/trpc/server/document-router/schema';import {DocumentGlobalAuthAccessSelect,DocumentGlobalAuthAccessTooltip,@@ -216,7 +216,12 @@ export const AddTemplateSettingsFormPartial = ({</FormLabel><FormControl>- <Input className="bg-background" {...field} maxLength={255} onBlur={handleAutoSave} />+ <Input+ className="bg-background"+ {...field}+ maxLength={255}+ onBlur={handleAutoSave}+ /></FormControl><FormMessage /></FormItem>@@ -624,7 +629,12 @@ export const AddTemplateSettingsFormPartial = ({</FormLabel><FormControl>- <Input className="bg-background" {...field} maxLength={255} onBlur={handleAutoSave} />+ <Input+ className="bg-background"+ {...field}+ maxLength={255}+ onBlur={handleAutoSave}+ /></FormControl><FormMessage />@@ -715,7 +725,12 @@ export const AddTemplateSettingsFormPartial = ({</FormLabel><FormControl>- <Input className="bg-background" {...field} maxLength={255} onBlur={handleAutoSave} />+ <Input+ className="bg-background"+ {...field}+ maxLength={255}+ onBlur={handleAutoSave}+ /></FormControl><FormMessage />diff --git a/packages/ui/primitives/template-flow/add-template-settings.types.tsx b/packages/ui/primitives/template-flow/add-template-settings.types.tsxindex 288573f05..e0d603760 100644--- a/packages/ui/primitives/template-flow/add-template-settings.types.tsx+++ b/packages/ui/primitives/template-flow/add-template-settings.types.tsx@@ -12,11 +12,11 @@ import {ZDocumentActionAuthTypesSchema,} from '@documenso/lib/types/document-auth';import { ZDocumentEmailSettingsSchema } from '@documenso/lib/types/document-email';-import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';import {ZDocumentMetaDateFormatSchema,ZDocumentMetaTimezoneSchema,-} from '@documenso/trpc/server/document-router/schema';+} from '@documenso/lib/types/document-meta';+import { isValidRedirectUrl } from '@documenso/lib/utils/is-valid-redirect-url';export const ZAddTemplateSettingsFormSchema = z.object({title: z.string().trim().min(1, { message: "Title can't be empty" }),