mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
chore: enable typed signature by default (#1436)
Enable typed signature by default and also add the option to set a typed signature in the profile page.
This commit is contained in:
@ -151,8 +151,6 @@ export const ZUpdateTeamMutationSchema = z.object({
|
||||
data: z.object({
|
||||
name: ZTeamNameSchema,
|
||||
url: ZTeamUrlSchema,
|
||||
documentVisibility: z.nativeEnum(DocumentVisibility).optional(),
|
||||
includeSenderDetails: z.boolean().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
@ -212,6 +210,7 @@ export const ZUpdateTeamDocumentSettingsMutationSchema = z.object({
|
||||
.default(DocumentVisibility.EVERYONE),
|
||||
documentLanguage: z.enum(SUPPORTED_LANGUAGE_CODES).optional().default('en'),
|
||||
includeSenderDetails: z.boolean().optional().default(false),
|
||||
typedSignatureEnabled: z.boolean().optional().default(true),
|
||||
includeSigningCertificate: z.boolean().optional().default(true),
|
||||
}),
|
||||
});
|
||||
|
||||
@ -35,6 +35,7 @@ import {
|
||||
ZSetSigningOrderForTemplateMutationSchema,
|
||||
ZToggleTemplateDirectLinkMutationSchema,
|
||||
ZUpdateTemplateSettingsMutationSchema,
|
||||
ZUpdateTemplateTypedSignatureSettingsMutationSchema,
|
||||
} from './schema';
|
||||
|
||||
export const templateRouter = router({
|
||||
@ -359,4 +360,48 @@ export const templateRouter = router({
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
updateTemplateTypedSignatureSettings: authenticatedProcedure
|
||||
.input(ZUpdateTemplateTypedSignatureSettingsMutationSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
try {
|
||||
const { templateId, teamId, typedSignatureEnabled } = input;
|
||||
|
||||
const template = await getTemplateById({
|
||||
id: templateId,
|
||||
teamId,
|
||||
userId: ctx.user.id,
|
||||
}).catch(() => null);
|
||||
|
||||
if (!template) {
|
||||
throw new TRPCError({
|
||||
code: 'NOT_FOUND',
|
||||
message: 'Template not found',
|
||||
});
|
||||
}
|
||||
|
||||
return await updateTemplateSettings({
|
||||
templateId,
|
||||
teamId,
|
||||
userId: ctx.user.id,
|
||||
data: {},
|
||||
meta: {
|
||||
typedSignatureEnabled,
|
||||
},
|
||||
requestMetadata: extractNextApiRequestMetadata(ctx.req),
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
if (err instanceof TRPCError) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
throw new TRPCError({
|
||||
code: 'BAD_REQUEST',
|
||||
message:
|
||||
'We were unable to update the settings for this template. Please try again later.',
|
||||
});
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
@ -114,6 +114,7 @@ export const ZUpdateTemplateSettingsMutationSchema = z.object({
|
||||
'Please enter a valid URL, make sure you include http:// or https:// part of the url.',
|
||||
}),
|
||||
language: z.enum(SUPPORTED_LANGUAGE_CODES).optional(),
|
||||
typedSignatureEnabled: z.boolean().optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
@ -138,6 +139,12 @@ export const ZMoveTemplatesToTeamSchema = z.object({
|
||||
teamId: z.number(),
|
||||
});
|
||||
|
||||
export const ZUpdateTemplateTypedSignatureSettingsMutationSchema = z.object({
|
||||
templateId: z.number(),
|
||||
teamId: z.number().optional(),
|
||||
typedSignatureEnabled: z.boolean(),
|
||||
});
|
||||
|
||||
export type TCreateTemplateMutationSchema = z.infer<typeof ZCreateTemplateMutationSchema>;
|
||||
export type TCreateDocumentFromTemplateMutationSchema = z.infer<
|
||||
typeof ZCreateDocumentFromTemplateMutationSchema
|
||||
|
||||
Reference in New Issue
Block a user