mirror of
https://github.com/documenso/documenso.git
synced 2026-07-24 08:54:20 +10:00
Merge branch 'main' into feat/add-pdf-image-renderer
This commit is contained in:
@@ -40,6 +40,7 @@ export const ZDocumentAuditLogTypeSchema = z.enum([
|
||||
'DOCUMENT_VIEWED', // When the document is viewed by a recipient.
|
||||
'DOCUMENT_RECIPIENT_REJECTED', // When a recipient rejects the document.
|
||||
'DOCUMENT_RECIPIENT_COMPLETED', // When a recipient completes all their required tasks for the document.
|
||||
'DOCUMENT_RECIPIENT_EXPIRED', // When a recipient's signing window expires.
|
||||
'DOCUMENT_SENT', // When the document transitions from DRAFT to PENDING.
|
||||
'DOCUMENT_TITLE_UPDATED', // When the document title is updated.
|
||||
'DOCUMENT_EXTERNAL_ID_UPDATED', // When the document external ID is updated.
|
||||
@@ -694,6 +695,18 @@ export const ZDocumentAuditLogEventDocumentDelegatedOwnerCreatedSchema = z.objec
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Recipient's signing window expired.
|
||||
*/
|
||||
export const ZDocumentAuditLogEventRecipientExpiredSchema = z.object({
|
||||
type: z.literal(DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_RECIPIENT_EXPIRED),
|
||||
data: z.object({
|
||||
recipientEmail: z.string(),
|
||||
recipientName: z.string(),
|
||||
recipientId: z.number(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ZDocumentAuditLogBaseSchema = z.object({
|
||||
id: z.string(),
|
||||
createdAt: z.date(),
|
||||
@@ -739,6 +752,7 @@ export const ZDocumentAuditLogSchema = ZDocumentAuditLogBaseSchema.and(
|
||||
ZDocumentAuditLogEventRecipientAddedSchema,
|
||||
ZDocumentAuditLogEventRecipientUpdatedSchema,
|
||||
ZDocumentAuditLogEventRecipientRemovedSchema,
|
||||
ZDocumentAuditLogEventRecipientExpiredSchema,
|
||||
]),
|
||||
);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export enum DocumentEmailEvents {
|
||||
DocumentCompleted = 'documentCompleted',
|
||||
DocumentDeleted = 'documentDeleted',
|
||||
OwnerDocumentCompleted = 'ownerDocumentCompleted',
|
||||
OwnerRecipientExpired = 'ownerRecipientExpired',
|
||||
}
|
||||
|
||||
export const ZDocumentEmailSettingsSchema = z
|
||||
@@ -52,6 +53,12 @@ export const ZDocumentEmailSettingsSchema = z
|
||||
.boolean()
|
||||
.describe('Whether to send an email to the document owner when the document is complete.')
|
||||
.default(true),
|
||||
ownerRecipientExpired: z
|
||||
.boolean()
|
||||
.describe(
|
||||
"Whether to send an email to the document owner when a recipient's signing window has expired.",
|
||||
)
|
||||
.default(true),
|
||||
})
|
||||
.strip()
|
||||
.catch(() => ({ ...DEFAULT_DOCUMENT_EMAIL_SETTINGS }));
|
||||
@@ -78,6 +85,7 @@ export const extractDerivedDocumentEmailSettings = (
|
||||
documentCompleted: false,
|
||||
documentDeleted: false,
|
||||
ownerDocumentCompleted: emailSettings.ownerDocumentCompleted,
|
||||
ownerRecipientExpired: emailSettings.ownerRecipientExpired,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -89,4 +97,5 @@ export const DEFAULT_DOCUMENT_EMAIL_SETTINGS: TDocumentEmailSettings = {
|
||||
documentCompleted: true,
|
||||
documentDeleted: true,
|
||||
ownerDocumentCompleted: true,
|
||||
ownerRecipientExpired: true,
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ import { DocumentDistributionMethod, DocumentSigningOrder } from '@prisma/client
|
||||
import { z } from 'zod';
|
||||
|
||||
import { VALID_DATE_FORMAT_VALUES } from '@documenso/lib/constants/date-formats';
|
||||
import { ZEnvelopeExpirationPeriod } from '@documenso/lib/constants/envelope-expiration';
|
||||
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';
|
||||
@@ -128,6 +129,7 @@ export const ZDocumentMetaCreateSchema = z.object({
|
||||
emailId: z.string().nullish(),
|
||||
emailReplyTo: z.string().email().nullish(),
|
||||
emailSettings: ZDocumentEmailSettingsSchema.nullish(),
|
||||
envelopeExpirationPeriod: ZEnvelopeExpirationPeriod.nullish(),
|
||||
});
|
||||
|
||||
export type TDocumentMetaCreate = z.infer<typeof ZDocumentMetaCreateSchema>;
|
||||
|
||||
@@ -71,6 +71,7 @@ export const ZDocumentSchema = LegacyDocumentSchema.pick({
|
||||
emailSettings: true,
|
||||
emailId: true,
|
||||
emailReplyTo: true,
|
||||
envelopeExpirationPeriod: true,
|
||||
}).extend({
|
||||
password: z.string().nullable().default(null),
|
||||
documentId: z.number().default(-1).optional(),
|
||||
|
||||
@@ -55,6 +55,7 @@ export const ZEnvelopeSchema = EnvelopeSchema.pick({
|
||||
emailSettings: true,
|
||||
emailId: true,
|
||||
emailReplyTo: true,
|
||||
envelopeExpirationPeriod: true,
|
||||
}),
|
||||
recipients: ZEnvelopeRecipientLiteSchema.array(),
|
||||
fields: ZEnvelopeFieldSchema.array(),
|
||||
|
||||
@@ -23,7 +23,9 @@ export const ZRecipientSchema = RecipientSchema.pick({
|
||||
name: true,
|
||||
token: true,
|
||||
documentDeletedAt: true,
|
||||
expired: true,
|
||||
expired: true, // deprecated Not in use. To be removed in a future migration.
|
||||
expiresAt: true,
|
||||
expirationNotifiedAt: true,
|
||||
signedAt: true,
|
||||
authOptions: true,
|
||||
signingOrder: true,
|
||||
@@ -50,7 +52,9 @@ export const ZRecipientLiteSchema = RecipientSchema.pick({
|
||||
name: true,
|
||||
token: true,
|
||||
documentDeletedAt: true,
|
||||
expired: true,
|
||||
expired: true, // !: deprecated Not in use. To be removed in a future migration.
|
||||
expiresAt: true,
|
||||
expirationNotifiedAt: true,
|
||||
signedAt: true,
|
||||
authOptions: true,
|
||||
signingOrder: true,
|
||||
@@ -75,7 +79,9 @@ export const ZRecipientManySchema = RecipientSchema.pick({
|
||||
name: true,
|
||||
token: true,
|
||||
documentDeletedAt: true,
|
||||
expired: true,
|
||||
expired: true, // !: deprecated Not in use. To be removed in a future migration.
|
||||
expiresAt: true,
|
||||
expirationNotifiedAt: true,
|
||||
signedAt: true,
|
||||
authOptions: true,
|
||||
signingOrder: true,
|
||||
|
||||
@@ -26,7 +26,8 @@ export const ZWebhookRecipientSchema = z.object({
|
||||
name: z.string(),
|
||||
token: z.string(),
|
||||
documentDeletedAt: z.date().nullable(),
|
||||
expired: z.date().nullable(),
|
||||
expiresAt: z.date().nullable(),
|
||||
expirationNotifiedAt: z.date().nullable(),
|
||||
signedAt: z.date().nullable(),
|
||||
authOptions: z.any().nullable(),
|
||||
signingOrder: z.number().nullable(),
|
||||
@@ -116,7 +117,8 @@ export const mapEnvelopeToWebhookDocumentPayload = (
|
||||
name: recipient.name,
|
||||
token: recipient.token,
|
||||
documentDeletedAt: recipient.documentDeletedAt,
|
||||
expired: recipient.expired,
|
||||
expiresAt: recipient.expiresAt,
|
||||
expirationNotifiedAt: recipient.expirationNotifiedAt,
|
||||
signedAt: recipient.signedAt,
|
||||
authOptions: recipient.authOptions,
|
||||
signingOrder: recipient.signingOrder,
|
||||
|
||||
Reference in New Issue
Block a user