From d91a3e38288da3d8d22ba9150a8aa881c95da12c Mon Sep 17 00:00:00 2001 From: Catalin Pit Date: Fri, 11 Sep 2026 09:38:44 +0300 Subject: [PATCH] feat: add allow document rejection setting to document preferences Adds an allowDocumentRejection column to organisation settings (default true), team settings (nullable, inherits from the organisation) and document meta (default true), with the migration. Adds the "Allow Document Rejection" field to the organisation and team document preferences form, wires it through the settings pages, and lists it in the reset-to-defaults dialog and the admin settings section. Adds a per-document Yes/No field to the envelope editor settings dialog. Exposes the field on the document meta create/update schemas and the document, envelope, template and editor envelope response schemas, and hides the reject dialog on the V1 signing page when the document disallows rejection. --- .../document-preferences-reset-dialog.tsx | 3 + .../forms/document-preferences-form.tsx | 58 +++++++++++++++++++ .../general/admin-global-settings-section.tsx | 6 ++ .../document-signing-page-view-v1.tsx | 4 +- .../envelope-editor-settings-dialog.tsx | 50 ++++++++++++++++ .../o.$orgUrl.settings.document.tsx | 3 + .../t.$teamUrl+/settings.document.tsx | 2 + packages/lib/types/document-meta.ts | 6 ++ packages/lib/types/document.ts | 1 + packages/lib/types/envelope-editor.ts | 1 + packages/lib/types/envelope.ts | 1 + packages/lib/types/template.ts | 1 + .../migration.sql | 8 +++ packages/prisma/schema.prisma | 4 ++ 14 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 packages/prisma/migrations/20260910120000_add_allow_document_rejection_setting/migration.sql diff --git a/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx b/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx index ed7184ef7..f493331ae 100644 --- a/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx +++ b/apps/remix/app/components/dialogs/document-preferences-reset-dialog.tsx @@ -96,6 +96,9 @@ export const DocumentPreferencesResetDialog = ({
  • Delegate document ownership
  • +
  • + Allow document rejection +
  • {showAiFeatures && (
  • AI features diff --git a/apps/remix/app/components/forms/document-preferences-form.tsx b/apps/remix/app/components/forms/document-preferences-form.tsx index 29e566c79..d9465d2cb 100644 --- a/apps/remix/app/components/forms/document-preferences-form.tsx +++ b/apps/remix/app/components/forms/document-preferences-form.tsx @@ -43,6 +43,7 @@ export type TDocumentPreferencesFormSchema = { signatureTypes: DocumentSignatureType[]; defaultRecipients: TDefaultRecipients | null; delegateDocumentOwnership: boolean | null; + allowDocumentRejection: boolean | null; aiFeaturesEnabled: boolean | null; }; @@ -57,6 +58,7 @@ type SettingsSubset = Pick< | 'drawSignatureEnabled' | 'defaultRecipients' | 'delegateDocumentOwnership' + | 'allowDocumentRejection' | 'aiFeaturesEnabled' >; @@ -77,6 +79,7 @@ const getDocumentPreferencesFormValues = (settings: SettingsSubset): TDocumentPr signatureTypes: extractTeamSignatureSettings({ ...settings }), defaultRecipients: settings.defaultRecipients ? ZDefaultRecipientsSchema.parse(settings.defaultRecipients) : null, delegateDocumentOwnership: settings.delegateDocumentOwnership, + allowDocumentRejection: settings.allowDocumentRejection, aiFeaturesEnabled: settings.aiFeaturesEnabled, }; }; @@ -101,6 +104,7 @@ export const DocumentPreferencesForm = ({ settings, onFormSubmit, canInherit }: }), defaultRecipients: ZDefaultRecipientsSchema.nullable(), delegateDocumentOwnership: z.boolean().nullable(), + allowDocumentRejection: z.boolean().nullable(), aiFeaturesEnabled: z.boolean().nullable(), }); @@ -486,6 +490,60 @@ export const DocumentPreferencesForm = ({ settings, onFormSubmit, canInherit }: )} /> + ( + Allow Document Rejection} + testId="allow-document-rejection" + > + + + + + + + Controls whether recipients can reject newly created documents from the signing page. Existing + documents keep their current setting. You can change it per document in the document settings. + + + + )} + /> + {isAiFeaturesConfigured && ( + Allow document rejection}> + + {booleanValue(settings.allowDocumentRejection, inheritedSettings?.allowDocumentRejection)} + + + Typed signature}> {booleanValue(settings.typedSignatureEnabled, inheritedSettings?.typedSignatureEnabled)} diff --git a/apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx b/apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx index 4fa8077a0..4b8758485 100644 --- a/apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx +++ b/apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx @@ -261,7 +261,9 @@ export const DocumentSigningPageViewV1 = ({
    - + {documentMeta.allowDocumentRejection && ( + + )}
    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.tsx index ea60d1819..410afbbc4 100644 --- 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.tsx @@ -110,6 +110,7 @@ export const ZAddSettingsFormSchema = z.object({ signatureTypes: z.array(z.nativeEnum(DocumentSignatureType)).min(1, { message: msg`At least one signature type must be enabled`.id, }), + allowDocumentRejection: z.boolean(), envelopeExpirationPeriod: ZEnvelopeExpirationPeriod.nullish(), reminderSettings: ZEnvelopeReminderSettings.nullish(), }), @@ -200,6 +201,7 @@ export const EnvelopeEditorSettingsDialog = ({ trigger, ...props }: EnvelopeEdit emailReplyTo: envelope.documentMeta.emailReplyTo ?? undefined, emailSettings: ZDocumentEmailSettingsSchema.parse(envelope.documentMeta.emailSettings), signatureTypes: extractTeamSignatureSettings(envelope.documentMeta), + allowDocumentRejection: envelope.documentMeta.allowDocumentRejection, envelopeExpirationPeriod: envelope.documentMeta?.envelopeExpirationPeriod ?? null, reminderSettings: envelope.documentMeta?.reminderSettings ?? null, }, @@ -249,6 +251,7 @@ export const EnvelopeEditorSettingsDialog = ({ trigger, ...props }: EnvelopeEdit message, subject, emailReplyTo, + allowDocumentRejection, envelopeExpirationPeriod, reminderSettings, } = data.meta; @@ -278,6 +281,7 @@ export const EnvelopeEditorSettingsDialog = ({ trigger, ...props }: EnvelopeEdit drawSignatureEnabled: signatureTypes.includes(DocumentSignatureType.DRAW), typedSignatureEnabled: signatureTypes.includes(DocumentSignatureType.TYPE), uploadSignatureEnabled: signatureTypes.includes(DocumentSignatureType.UPLOAD), + allowDocumentRejection, envelopeExpirationPeriod, reminderSettings, }, @@ -465,6 +469,52 @@ export const EnvelopeEditorSettingsDialog = ({ trigger, ...props }: EnvelopeEdit /> )} + ( + + + Allow Document Rejection + + + + + + + + Controls whether recipients can reject the document from the signing page. + + + + + + + + + + + + )} + /> + {settings.allowConfigureDateFormat && (