Merge pull request #1374 from OpenSignLabs/validation

fix: widgets get removed from doc when signers try to sign at a time
This commit is contained in:
Raktima
2024-10-22 19:54:03 +05:30
committed by GitHub
+22 -2
View File
@@ -891,9 +891,29 @@ function PdfRequestFiles(props) {
setIsUiLoading(true);
// `widgets` is Used to return widgets details with page number of current user
const widgets = checkUser?.[0]?.placeHolder;
let pdfArrBuffer;
//`contractDocument` function used to get updated SignedUrl
// to resolve issue of widgets get remove automatically when more than 1 signers try to sign doc at a time
const documentData = await contractDocument(documentId);
if (documentData && documentData.length > 0) {
const url = documentData[0]?.SignedUrl || documentData[0]?.URL;
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
const arrayBuffer = await convertPdfArrayBuffer(url);
if (arrayBuffer === "Error") {
setHandleError("Error: invalid document!");
} else {
pdfArrBuffer = arrayBuffer;
}
} else if (
documentData === "Error: Something went wrong!" ||
(documentData.result && documentData.result.error)
) {
setHandleError("Error: Something went wrong!");
} else {
setHandleError("Document not Found!");
}
// Load a PDFDocument from the existing PDF bytes
const existingPdfBytes = pdfArrayBuffer;
const existingPdfBytes = pdfArrBuffer;
try {
const pdfDoc = await PDFDocument.load(existingPdfBytes);
const isSignYourSelfFlow = false;