mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 01:45:08 +10:00
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:
+5
-1
@@ -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
|
||||||
|
|||||||
+2
@@ -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 ||
|
||||||
'',
|
'',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user