refactor(app): simplify annotation creation and improve signature handling

- Updated `createImageAnnotation` to use pre-generated id instead of multiple parameters
- Replaced hardcoded annotation ID generation during signature creation
- Added `fixBase64` helper to handle escaped base64 strings
- Temporarily added logging in `handleFinish` for debugging exported InstantJSON
- Simplified `createImageAnnotation` signature and usage
- Improved readability and consistency in annotation ID generation logic
This commit is contained in:
2025-10-17 13:46:07 +02:00
parent f046be240b
commit 52306d481f
3 changed files with 21 additions and 8 deletions

View File

@@ -88,16 +88,25 @@ class App {
}),
annotation.pageIndex,
imageAttachmentId,
this.envelopeReceiver.envelopeId,
this.envelopeReceiver.receiverId,
this.fakeElementId--,
'signature'
generateId(
this.envelopeReceiver.envelopeId,
this.envelopeReceiver.receiverId,
this.fakeElementId--,
'signed'
)
)
this.pdfKit.create(frameAnnotation)
}
}
fixBase64(escapedBase64) {
return escapedBase64
.replace(/\\u002B/g, "+")
.replace(/\\u002F/g, "/")
.replace(/\\u003D/g, "=");
}
async handleClick(eventType) {
let result = false
@@ -181,6 +190,10 @@ class App {
async handleFinish(event) {
const iJSON = await this.pdfKit.exportInstantJSON()
console.log(iJSON);
return
const iFormFieldValues = await iJSON.formFieldValues;
//check required