Skip to content

Commit 3f7d0dd

Browse files
fix(SigningRequirementValidator): require drawing even without placed elements
needsCreateSignature previously required visibleElements.some(...) to be true, meaning it only triggered when the document had a pre-placed visual element box for the signer. With GRAPHIC_ONLY render mode (canCreateSignature=true) and no placed box, the check always returned false and the drawing prompt was never shown. Fix: when signerHasSignRequest=true is provided, return true immediately after confirming the signer has a signRequestId — the visual box placement is irrelevant for deciding whether to ask for a drawing. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent bd7b017 commit 3f7d0dd

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

src/services/SigningRequirementValidator.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ interface ValidatorConfig {
3535
errors?: Array<{ code?: number; [key: string]: unknown }>
3636
hasSignatures?: boolean
3737
canCreateSignature?: boolean
38+
signerHasSignRequest?: boolean
3839
[key: string]: unknown
3940
}
4041

@@ -110,14 +111,22 @@ export class SigningRequirementValidator {
110111
}
111112

112113
needsCreateSignature(config: ValidatorConfig = {}): boolean {
114+
if (!config.canCreateSignature || config.hasSignatures) {
115+
return false
116+
}
117+
113118
const signer = this.signStore.document?.signers?.find(row => row.me) || {}
114-
const visibleElements = this.signStore.document?.visibleElements || []
119+
const signRequestId = (signer as { signRequestId?: string | number }).signRequestId
115120

116-
return !!(
117-
(signer as { signRequestId?: string | number }).signRequestId &&
118-
visibleElements.some(row => row.signRequestId === (signer as { signRequestId?: string | number }).signRequestId) &&
119-
!config.hasSignatures &&
120-
config.canCreateSignature
121-
)
121+
if (!signRequestId) {
122+
return false
123+
}
124+
125+
if (config.signerHasSignRequest) {
126+
return true
127+
}
128+
129+
const visibleElements = this.signStore.document?.visibleElements || []
130+
return visibleElements.some(row => row.signRequestId === signRequestId)
122131
}
123132
}

0 commit comments

Comments
 (0)