MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / getDocumentDetails

Function getDocumentDetails

apps/OpenSign/src/pages/PdfRequestFiles.jsx:266–612  ·  view source on GitHub ↗
(
    docId,
    isNextUser,
    isSuccessPage = false,
  )

Source from the content-addressed store, hash-verified

264 };
265 //function for get document details for perticular signer with signer'object id
266 const getDocumentDetails = async (
267 docId,
268 isNextUser,
269 isSuccessPage = false,
270 ) => {
271 try {
272 const senderUser = localStorage.getItem(
273 `Parse/${localStorage.getItem("parseAppId")}/currentUser`
274 );
275 const jsonSender = JSON.parse(senderUser);
276 const contactId = jsonSender?.objectId
277 ? ""
278 : contactBookId ||
279 signerObjectId ||
280 "";
281 const tenantSignTypes = await fetchTenantDetails(contactId);
282 // `currUserId` will be contactId or extUserId
283 let currUserId;
284
285 //getting document details
286 const documentData = await contractDocument(docId);
287 // Filter out 'prefill' roles from the Placeholder array
288 const filteredPlaceholder = documentData[0]?.Placeholders?.filter(
289 (data) => data.Role !== "prefill"
290 );
291 // Reassign the updated Placeholder back to the documentData array
292 documentData[0] = {
293 ...documentData[0],
294 Placeholders: filteredPlaceholder
295 };
296 if (documentData && documentData.length > 0) {
297 const prefillImg = await utils?.savePrefillImg(
298 documentData[0]?.Placeholders
299 );
300 if (prefillImg && Array.isArray(prefillImg)) {
301 prefillImg.forEach((img) => {
302 dispatch(setPrefillImg(img));
303 });
304 }
305 const userSignatureType =
306 documentData[0]?.ExtUserPtr?.SignatureType || signatureTypes;
307 const docSignTypes =
308 documentData?.[0]?.SignatureType || userSignatureType;
309 const updatedSignatureType = await handleSignatureType(
310 tenantSignTypes,
311 docSignTypes
312 );
313 setSignatureType(updatedSignatureType);
314 const updatedPdfDetails = [...documentData];
315 updatedPdfDetails[0].SignatureType = updatedSignatureType;
316 setPdfDetails(updatedPdfDetails);
317 const url =
318 documentData[0] &&
319 (documentData[0]?.SignedUrl || documentData[0]?.URL);
320 if (url) {
321 const base64Pdf = await getBase64FromUrl(url);
322 if (base64Pdf) {
323 setPdfBase64Url(base64Pdf);

Callers 2

PdfRequestFilesFunction · 0.70
embedWidgetsDataFunction · 0.70

Calls 10

contractDocumentFunction · 0.90
handleSignatureTypeFunction · 0.90
getBase64FromUrlFunction · 0.90
updateDateWidgetsResFunction · 0.90
contractUsersFunction · 0.90
getDefaultSignatureFunction · 0.90
contactBookFunction · 0.90
storeSignerDetailsFunction · 0.85
handleTourStatusFunction · 0.85
fetchTenantDetailsFunction · 0.70

Tested by

no test coverage detected