feat(admin-settings): radio field type + adopt for Documenso signing-order + send-mode

Adds a 'radio' SettingType the registry-driven admin form can render. Same
shape as 'select' (options list, enum validation, resolved/source badges),
but renders inline radio cards instead of a dropdown so each option's
consequences sit side-by-side for the admin.

Adopted on the two highest-stakes Documenso behaviour toggles:
- `eoi_send_mode` — Manual vs Auto signing-invitation dispatch
- `documenso_signing_order` — Parallel vs Sequential recipient flow

Both choices are binary and materially different (one auto-sends mail, the
other doesn't; one routes signing serially, the other in parallel), so the
upfront comparison beats a hidden dropdown.

`documenso_redirect_url` keeps its url-input — it's already a single
free-text field with no enum.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-25 13:06:04 +02:00
parent 9138932d1b
commit 7bdfc340ae
4 changed files with 40 additions and 7 deletions

View File

@@ -210,10 +210,10 @@ export const REGISTRY: SettingEntry[] = [
label: 'Initial signing-invitation email behaviour',
description:
'Auto = the system sends the branded "please sign" email immediately when an EOI/contract/reservation is generated. Manual = the document is generated and the signing URL appears in the UI; a rep clicks "Send invitation" to dispatch. Applies to all document types, not just EOI.',
type: 'select',
type: 'radio',
options: [
{ value: 'manual', label: 'Manual (rep clicks Send after generation)' },
{ value: 'auto', label: 'Auto (send branded email on generate)' },
{ value: 'manual', label: 'Manual rep clicks Send after generation' },
{ value: 'auto', label: 'Auto send branded email on generate' },
],
scope: 'port',
defaultValue: 'manual',
@@ -241,11 +241,11 @@ export const REGISTRY: SettingEntry[] = [
section: 'documenso.behavior',
label: 'Signing order',
description:
'PARALLEL = all recipients can sign at once. SEQUENTIAL = each waits for the previous (v2 only - v1 always parallel).',
type: 'select',
'PARALLEL = all recipients can sign at once. SEQUENTIAL = each waits for the previous (v2 only v1 always parallel).',
type: 'radio',
options: [
{ value: 'PARALLEL', label: 'Parallel - all recipients sign concurrently' },
{ value: 'SEQUENTIAL', label: 'Sequential - order matters (v2 only)' },
{ value: 'PARALLEL', label: 'Parallel all recipients sign concurrently' },
{ value: 'SEQUENTIAL', label: 'Sequential order matters (v2 only)' },
],
scope: 'port',
defaultValue: 'PARALLEL',

View File

@@ -51,6 +51,7 @@ function defaultValidator(entry: SettingEntry): z.ZodTypeAny {
case 'boolean':
return z.coerce.boolean();
case 'select':
case 'radio':
if (entry.options) {
return z.enum(entry.options.map((o) => o.value) as [string, ...string[]]);
}

View File

@@ -6,6 +6,7 @@ export type SettingType =
| 'number'
| 'boolean'
| 'select'
| 'radio'
| 'url'
| 'email'
| 'textarea'