fix: hide name/email in embed signing when provided via prop (#2600)

## Description

When signing via embed, recipient name and email provided through the
embed context were ignored if the DB recipient record had empty values.

This fix adds:
- the signing context's fullName and email as fallbacks in the recipient
payload
- keeps the form in sync with values instead of defaultValues
- ensures the override payload is sent even when the form is hidden
This commit is contained in:
Catalin Pit
2026-03-13 12:59:10 +02:00
committed by GitHub
parent 83fbc70a1c
commit 32c54e1245
2 changed files with 7 additions and 1 deletions
@@ -117,7 +117,7 @@ export const DocumentSigningCompleteDialog = ({
const recipientForm = useForm<TDirectRecipientFormSchema>({ const recipientForm = useForm<TDirectRecipientFormSchema>({
resolver: zodResolver(ZDirectRecipientFormSchema), resolver: zodResolver(ZDirectRecipientFormSchema),
defaultValues: { values: {
name: recipientPayload?.name ?? '', name: recipientPayload?.name ?? '',
email: recipientPayload?.email ?? '', email: recipientPayload?.email ?? '',
}, },
@@ -157,6 +157,10 @@ export const DocumentSigningCompleteDialog = ({
} }
recipientOverridePayload = recipientForm.getValues(); recipientOverridePayload = recipientForm.getValues();
} else if (recipientPayload && recipientPayload.email && !recipient.email) {
// Form is hidden because we have an email (e.g. from embed context),
// but the DB recipient doesn't have one yet — send the override.
recipientOverridePayload = recipientPayload;
} }
// Check if 2FA is required // Check if 2FA is required
@@ -221,10 +221,12 @@ export const EnvelopeSignerCompleteDialog = () => {
return { return {
name: name:
recipient.name || recipient.name ||
fullName ||
recipient.fields.find((field) => field.type === FieldType.NAME)?.customText || recipient.fields.find((field) => field.type === FieldType.NAME)?.customText ||
'', '',
email: email:
recipient.email || recipient.email ||
email ||
recipient.fields.find((field) => field.type === FieldType.EMAIL)?.customText || recipient.fields.find((field) => field.type === FieldType.EMAIL)?.customText ||
'', '',
}; };