feat: add controls for sending completion emails to document owners (#1534)

Adds a new `ownerDocumentCompleted` to the email settings that controls
whether a document will be sent to the owner upon completion.

This was previously the only email you couldn't disable and didn't
account for users integrating with just the API and Webhooks.

Also adds a flag to the public `sendDocument` endpoint which will adjust
this setting while sendint the document for users who aren't using
`emailSettings` on the `createDocument` endpoint.
This commit is contained in:
Lucas Smith
2024-12-12 14:24:07 +11:00
committed by GitHub
parent c9fe134852
commit 5fbed783fc
6 changed files with 240 additions and 65 deletions

View File

@ -88,8 +88,12 @@ export const ZSendDocumentForSigningMutationSchema = z
description:
'Whether to send an email to the recipients asking them to action the document. If you disable this, you will need to manually distribute the document to the recipients using the generated signing links.',
}),
sendCompletionEmails: z.boolean().optional().openapi({
description:
'Whether to send completion emails when the document is fully signed. This will override the document email settings.',
}),
})
.or(z.literal('').transform(() => ({ sendEmail: true })));
.or(z.literal('').transform(() => ({ sendEmail: true, sendCompletionEmails: undefined })));
export type TSendDocumentForSigningMutationSchema = typeof ZSendDocumentForSigningMutationSchema;