mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 18:04:55 +10:00
Merge branch 'main' into fix/cc-recipient-order-last
This commit is contained in:
@@ -31,6 +31,7 @@ export const ZDocumentAuditLogTypeSchema = z.enum([
|
||||
'DOCUMENT_COMPLETED', // When the document is sealed and fully completed.
|
||||
'DOCUMENT_CREATED', // When the document is created.
|
||||
'DOCUMENT_DELETED', // When the document is soft deleted.
|
||||
'DOCUMENT_CANCELLED', // When a privileged member cancels the document.
|
||||
'DOCUMENT_FIELDS_AUTO_INSERTED', // When a field is auto inserted during send due to default values (radio/dropdown/checkbox).
|
||||
'DOCUMENT_FIELD_INSERTED', // When a field is inserted (signed/approved/etc) by a recipient.
|
||||
'DOCUMENT_FIELD_UNINSERTED', // When a field is uninserted by a recipient.
|
||||
@@ -296,6 +297,16 @@ export const ZDocumentAuditLogEventDocumentDeletedSchema = z.object({
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Document cancelled.
|
||||
*/
|
||||
export const ZDocumentAuditLogEventDocumentCancelledSchema = z.object({
|
||||
type: z.literal(DOCUMENT_AUDIT_LOG_TYPE.DOCUMENT_CANCELLED),
|
||||
data: z.object({
|
||||
reason: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Document field inserted.
|
||||
*/
|
||||
@@ -815,6 +826,7 @@ export const ZDocumentAuditLogSchema = ZDocumentAuditLogBaseSchema.and(
|
||||
ZDocumentAuditLogEventDocumentCompletedSchema,
|
||||
ZDocumentAuditLogEventDocumentCreatedSchema,
|
||||
ZDocumentAuditLogEventDocumentDeletedSchema,
|
||||
ZDocumentAuditLogEventDocumentCancelledSchema,
|
||||
ZDocumentAuditLogEventDocumentMovedToTeamSchema,
|
||||
ZDocumentAuditLogEventDocumentDelegatedOwnerCreatedSchema,
|
||||
ZDocumentAuditLogEventDocumentFieldsAutoInsertedSchema,
|
||||
|
||||
@@ -21,6 +21,7 @@ import { mapSecondaryIdToDocumentId, mapSecondaryIdToTemplateId } from '../utils
|
||||
*/
|
||||
export const ZWebhookRecipientSchema = z.object({
|
||||
id: z.number(),
|
||||
envelopeId: z.string(),
|
||||
documentId: z.number().nullable(),
|
||||
templateId: z.number().nullable(),
|
||||
email: z.string(),
|
||||
@@ -64,6 +65,7 @@ export const ZWebhookDocumentMetaSchema = z.object({
|
||||
*/
|
||||
export const ZWebhookDocumentSchema = z.object({
|
||||
id: z.number(),
|
||||
envelopeId: z.string(),
|
||||
externalId: z.string().nullable(),
|
||||
userId: z.number(),
|
||||
authOptions: z.any().nullable(),
|
||||
@@ -117,6 +119,7 @@ export const mapEnvelopeToWebhookDocumentPayload = (
|
||||
|
||||
const mappedRecipients = rawRecipients.map((recipient) => ({
|
||||
id: recipient.id,
|
||||
envelopeId: envelope.id,
|
||||
documentId: envelope.type === EnvelopeType.DOCUMENT ? legacyId : null,
|
||||
templateId: envelope.type === EnvelopeType.TEMPLATE ? legacyId : null,
|
||||
email: recipient.email,
|
||||
@@ -137,6 +140,7 @@ export const mapEnvelopeToWebhookDocumentPayload = (
|
||||
|
||||
return {
|
||||
id: legacyId,
|
||||
envelopeId: envelope.id,
|
||||
externalId: envelope.externalId,
|
||||
userId: envelope.userId,
|
||||
authOptions: envelope.authOptions,
|
||||
|
||||
Reference in New Issue
Block a user