🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
remove contracts_Document & contracts_Users query from frontend and call cloud function
RaktimaNXG910bd801ac3e
diff --git a/microfrontends/SignDocuments/src/Component/DraftDocument.js b/microfrontends/SignDocuments/src/Component/DraftDocument.jsindex 79806a94e..8c5884c87 100644--- a/microfrontends/SignDocuments/src/Component/DraftDocument.js+++ b/microfrontends/SignDocuments/src/Component/DraftDocument.js@@ -1,61 +1,46 @@import React, { useEffect, useState } from "react";-import axios from "axios";import { useNavigate } from "react-router-dom";import Loader from "./component/loader";-import { getHostUrl } from "../utils/Utils";+import { contractDocument, getHostUrl } from "../utils/Utils";function DraftDocument() {const navigate = useNavigate();const [pdfDetails, setPdfDetails] = useState([]);const [isLoading, setIsLoading] = useState({isLoad: true,- message: "This might take some time",+ message: "This might take some time"});const rowLevel =localStorage.getItem("rowlevel") &&JSON.parse(localStorage.getItem("rowlevel"));- const signObjId =+ const docId =rowLevel && rowLevel?.id? rowLevel.id: rowLevel?.objectId && rowLevel.objectId;+useEffect(() => {- if (signObjId) {+ if (docId) {getDocumentDetails();}}, []);//get document detailsconst getDocumentDetails = async () => {- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"objectId":"${signObjId}"}&include=ExtUserPtr,Signers`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken"),- },- }- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;-- if (res[0] && res.length > 0) {- setPdfDetails(res);- const loadObj = {- isLoad: false,- };- setIsLoading(loadObj);- } else {- alert("No data found!");- }- })- .catch((err) => {- console.log("axois err ", err);- });+ //getting document details+ const documentData = await contractDocument(docId);+ if (documentData && documentData !== "no data found!" && documentData[0]) {+ if (documentData[0] && documentData.length > 0) {+ setPdfDetails(documentData);+ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ }+ } else if (documentData === "no data found!") {+ alert("No data found!");+ } else if (documentData === "Error: Something went wrong!") {+ alert("Error: Something went wrong!");+ }};//check document type and render on signyour self and placeholder route@@ -63,24 +48,25 @@ function DraftDocument() {const data = pdfDetails[0];const checkSignerExist =pdfDetails[0] && pdfDetails[0].Signers && pdfDetails[0].Signers;- const isPlaceholder =+ const isPlaceholder =pdfDetails[0].Placeholders && pdfDetails[0].Placeholders;const isDecline = data.IsDeclined && data.IsDeclined;const signUrl = data.SignedUrl && data.SignedUrl;- const expireDate = pdfDetails[0] && pdfDetails[0].ExpiryDate.iso && pdfDetails[0].ExpiryDate.iso;+ const expireDate =+ pdfDetails[0] &&+ pdfDetails[0].ExpiryDate.iso &&+ pdfDetails[0].ExpiryDate.iso;const expireUpdateDate = new Date(expireDate).getTime();const currDate = new Date().getTime();const hostUrl = getHostUrl();//checking document is completed and signer exist then navigate to pdfRequestFiles fileif (data.IsCompleted && checkSignerExist) {- navigate(`${hostUrl}pdfRequestFiles`);+ navigate(`${hostUrl}pdfRequestFiles`);}//checking document is completed and signer does not exist then navigate to recipientSignPdf fileelse if (data.IsCompleted && !checkSignerExist) {- navigate(- `${hostUrl}signaturePdf`- );+ navigate(`${hostUrl}signaturePdf`);}//checking document is declined by someone then navigate to pdfRequestFiles fileelse if (isDecline) {diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.jsindex cd004168a..ed456ec96 100644--- a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js@@ -6,6 +6,7 @@ import PdfFileComponent from "./FolderDrive/legaDriveComponent";import Modal from "react-bootstrap/Modal";import ModalHeader from "react-bootstrap/esm/ModalHeader";import { themeColor, iconColor } from "../../utils/ThemeColor/backColor";+import { getDrive } from "../../utils/Utils";function PdfFile() {const scrollRef = useRef(null);@@ -22,22 +23,13 @@ function PdfFile() {const [isShowSort, setIsShowSort] = useState(false);const [isLoading, setIsLoading] = useState({isLoad: true,- message: "This might take some time",+ message: "This might take some time"});const [docId, setDocId] = useState();const [handleError, setHandleError] = useState();const [folderName, setFolderName] = useState([]);- const senderUser =- localStorage.getItem(- `Parse/${localStorage.getItem("parseAppId")}/currentUser`- ) &&- localStorage.getItem(- `Parse/${localStorage.getItem("parseAppId")}/currentUser`- );- const jsonSender = JSON.parse(senderUser);-useEffect(() => {if (docId) {getPdfFolderDocumentList();@@ -50,104 +42,59 @@ function PdfFile() {const getPdfDocumentList = async () => {const load = {isLoad: true,- message: "This might take some time",+ message: "This might take some time"};setIsLoading(load);- //?where={"Type":"Folder" }&include=ExtUserPtr,Signers- //?where={"$or":[{"Type":{"$exists":true}},{"Folder":{"$exists":false}}]}&include=ExtUserPtr,Signers- // "CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${jsonSender.objectId}"}- // where={"Folder":{"$exists":false} }&include=ExtUserPtr,Signers`,- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"Folder":{"$exists":false},"$or":[{"CreatedBy":{"$exists":false}},{"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${- jsonSender.objectId- }"}}]}&include=ExtUserPtr,Signers`,+ const driveDetails = await getDrive();++ if (driveDetails) {+ if (driveDetails && driveDetails.length > 0) {+ setPdfData(driveDetails);+ }+ const data = [{- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken"),- },+ name: "OpenSignDriveâ„¢",+ objectId: ""}- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;- // console.log("result", res);- if (res[0] && res.length > 0) {- setPdfData(res);- }-- const data = [- {- name: "OpenSignDriveâ„¢",- objectId: "",- },- ];- setFolderName(data);- const loadObj = {- isLoad: false,- };- setIsLoading(loadObj);- })- .catch((err) => {- const loadObj = {- isLoad: false,- };- setHandleError("Error: Something went wrong!");- setIsLoading(loadObj);- });+ ];+ setFolderName(data);+ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ } else if (driveDetails === "Error: Something went wrong!") {+ const loadObj = {+ isLoad: false+ };+ setHandleError("Error: Something went wrong!");+ setIsLoading(loadObj);+ }};//function for get parent folder document listconst getPdfFolderDocumentList = async () => {const load = {isLoad: true,- message: "This might take some time",+ message: "This might take some time"};setIsLoading(load);- //{"$inQuery":{"where":{"objectId":"${docId}"},"className":"${appName}_Document"}}- //"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${jsonSender.objectId}"}- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"Folder":{"__type":"Pointer","className":"${localStorage.getItem(- "_appName"- )}_Document","objectId":"${docId}"},"$or":[{"CreatedBy":{"$exists":false}},{"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${- jsonSender.objectId- }"}}]}&include=ExtUserPtr,Signers,Folder`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken"),- },- }- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;-- if (res[0] && res.length > 0) {- setPdfData(res);- } else {- setPdfData([]);- }-- const loadObj = {- isLoad: false,- };- setIsLoading(loadObj);- })- .catch((err) => {- const loadObj = {- isLoad: false,- };- setHandleError("Error: Something went wrong!");- setIsLoading(loadObj);- });+ const driveDetails = await getDrive(docId);+ if (driveDetails) {+ if (driveDetails && driveDetails.length > 0) {+ setPdfData(driveDetails);+ } else {+ setPdfData([]);+ }+ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ } else if (driveDetails === "Error: Something went wrong!") {+ const loadObj = {+ isLoad: false+ };+ setHandleError("Error: Something went wrong!");+ setIsLoading(loadObj);+ }};//function for get all pdf document list@@ -158,7 +105,7 @@ function PdfFile() {const handleRoute = (data) => {let loadObj = {isLoad: true,- message: "This might take some time",+ message: "This might take some time"};if (data.name === "LegaDriveâ„¢") {setIsLoading(loadObj);@@ -167,7 +114,7 @@ function PdfFile() {} else {setTimeout(() => {const loadObj = {- isLoad: false,+ isLoad: false};setIsLoading(loadObj);}, 1000);@@ -176,12 +123,11 @@ function PdfFile() {setIsLoading(loadObj);setTimeout(() => {const loadObj = {- isLoad: false,+ isLoad: false};setIsLoading(loadObj);}, 1000);} else {- // console.log("go here1",data.objectId)const findIndex = folderName.findIndex((fold) => fold.objectId === data.objectId);@@ -216,13 +162,13 @@ function PdfFile() {Folder: {__type: "Pointer",className: `${localStorage.getItem("_appName")}_Document`,- objectId: isParentId,- },+ objectId: isParentId+ }};} else {data = {Name: newFolderName,- Type: "Folder",+ Type: "Folder"};}@@ -237,8 +183,8 @@ function PdfFile() {headers: {"Content-Type": "application/json","X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken"),- },+ "X-Parse-Session-Token": localStorage.getItem("accesstoken")+ }})@@ -388,7 +334,7 @@ function PdfFile() {display: "flex",flexDirection: "column",justifyContent: "center",- alignItems: "center",+ alignItems: "center"}}><img@@ -406,7 +352,7 @@ function PdfFile() {style={{margin: "10px 0px 10px 0px",fontSize: "15px",- fontWeight: "400",+ fontWeight: "400"}}>Name*@@ -428,7 +374,7 @@ function PdfFile() {display: "flex",alignItems: "flex-end",justifyContent: "flex-end",- alignContent: "flex-end",+ alignContent: "flex-end"}}><button@@ -437,7 +383,7 @@ function PdfFile() {borderRadius: "0px",border: "1.5px solid #e3e2e1",fontWeight: "600",- color: "black",+ color: "black"}}className="finishBtn"onClick={() => setIsFolder(false)}@@ -448,7 +394,7 @@ function PdfFile() {<buttononClick={() => handleAddFolder()}style={{- background: themeColor(),+ background: themeColor()}}type="button"className="finishBtn"@@ -469,7 +415,7 @@ function PdfFile() {alignItems: "center",height: "100vh",width: "100%",- flexDirection: "column",+ flexDirection: "column"}}><img@@ -488,7 +434,7 @@ function PdfFile() {justifyContent: "center",alignItems: "center",height: "100vh",- width: "100%",+ width: "100%"}}><span style={{ fontSize: "20px", color: "gray" }}>@@ -502,7 +448,7 @@ function PdfFile() {onMouseEnter={(e) => handleMouseEnter(e)}ref={scrollRef}style={{- width: "100%",+ width: "100%"}}className="folderPath">@@ -514,7 +460,7 @@ function PdfFile() {style={{color: "#a64b4e",fontWeight: "400",- cursor: "pointer",+ cursor: "pointer"}}>{data.name}@@ -523,7 +469,7 @@ function PdfFile() {color: "#a64b4e",fontWeight: "200",cursor: "pointer",- margin: "0 4px",+ margin: "0 4px"}}>>@@ -545,13 +491,13 @@ function PdfFile() {style={{marginRight: "5px",fontSize: "14px",- color: `${iconColor()}`,+ color: `${iconColor()}`}}></i><spanstyle={{fontSize: "15px",- color: `${iconColor()}`,+ color: `${iconColor()}`}}>{selectedSort}@@ -694,7 +640,7 @@ function PdfFile() {justifyContent: "center",alignItems: "center",height: "50vh",- width: "100%",+ width: "100%"}}><span style={{ fontWeight: "bold" }}>No Data Found!</span>diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.jsindex d741162d5..7a53c3b17 100644--- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js+++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js@@ -11,7 +11,11 @@ import { HTML5Backend } from "react-dnd-html5-backend";import { useParams } from "react-router-dom";import SignPad from "./component/signPad";import RenderAllPdfPage from "./component/renderAllPdfPage";-import { getBase64FromIMG, getBase64FromUrl } from "../utils/Utils";+import {+ contractDocument,+ getBase64FromIMG,+ getBase64FromUrl+} from "../utils/Utils";import Loader from "./component/loader";import HandleError from "./component/HandleError";import Nodata from "./component/Nodata";@@ -106,152 +110,132 @@ function PdfRequestFiles() {//function for get document details for perticular signer with signer'object idconst getDocumentDetails = async () => {- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"objectId":"${documentId}"}&include=ExtUserPtr,Signers,UserPtr`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")- }- }- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;-- if (res[0] && res.length > 0) {- const isCompleted = res[0].IsCompleted && res[0].IsCompleted;- const expireDate = res[0].ExpiryDate.iso;- const declined = res[0].IsDeclined && res[0].IsDeclined;- const expireUpdateDate = new Date(expireDate).getTime();- const currDate = new Date().getTime();- const getSigners = res[0].Signers;- const getCurrentSigner =- getSigners &&- getSigners.filter(- (data) => data.UserId.objectId === jsonSender.objectId- );+ //getting document details+ const documentData = await contractDocument(documentId);+ if (documentData && documentData !== "no data found!" && documentData[0]) {+ const isCompleted =+ documentData[0].IsCompleted && documentData[0].IsCompleted;+ const expireDate = documentData[0].ExpiryDate.iso;+ const declined = documentData[0].IsDeclined && documentData[0].IsDeclined;+ const expireUpdateDate = new Date(expireDate).getTime();+ const currDate = new Date().getTime();+ const getSigners = documentData[0].Signers;+ const getCurrentSigner =+ getSigners &&+ getSigners.filter(+ (data) => data.UserId.objectId === jsonSender.objectId+ );- const currUserId = getCurrentSigner[0]- ? getCurrentSigner[0].objectId- : "";- setSignerObjectId(currUserId);- if (res[0].SignedUrl) {- setPdfUrl(res[0].SignedUrl);- } else {- setPdfUrl(res[0].URL);- }- if (isCompleted) {- setIsSigned(true);- const data = {- isCertificate: true,- isModal: true- };- setAlreadySign(true);- setIsCompleted(data);- } else if (declined) {- const currentDecline = {- currnt: "another",- isDeclined: true- };- setIsDecline(currentDecline);- } else if (currDate > expireUpdateDate) {- setIsExpired(true);- }+ const currUserId = getCurrentSigner[0]+ ? getCurrentSigner[0].objectId+ : "";+ setSignerObjectId(currUserId);+ if (documentData[0].SignedUrl) {+ setPdfUrl(documentData[0].SignedUrl);+ } else {+ setPdfUrl(documentData[0].URL);+ }+ if (isCompleted) {+ setIsSigned(true);+ const data = {+ isCertificate: true,+ isModal: true+ };+ setAlreadySign(true);+ setIsCompleted(data);+ } else if (declined) {+ const currentDecline = {+ currnt: "another",+ isDeclined: true+ };+ setIsDecline(currentDecline);+ } else if (currDate > expireUpdateDate) {+ setIsExpired(true);+ }- if (res.length > 0) {- const checkDocIdExist =- json.results[0].AuditTrail &&- json.results[0].AuditTrail.length > 0 &&- json.results[0].AuditTrail.filter(- (data) => data.Activity === "Signed"- );-- const checkAlreadySign =- json.results[0].AuditTrail &&- json.results[0].AuditTrail.length > 0 &&- json.results[0].AuditTrail.filter(- (data) =>- data.UserPtr.objectId === currUserId &&- data.Activity === "Signed"- );- if (- checkAlreadySign &&- checkAlreadySign[0] &&- checkAlreadySign.length > 0- ) {- setAlreadySign(true);- }+ if (documentData.length > 0) {+ const checkDocIdExist =+ documentData[0].AuditTrail &&+ documentData[0].AuditTrail.length > 0 &&+ documentData[0].AuditTrail.filter(+ (data) => data.Activity === "Signed"+ );++ const checkAlreadySign =+ documentData[0].AuditTrail &&+ documentData[0].AuditTrail.length > 0 &&+ documentData[0].AuditTrail.filter(+ (data) =>+ data.UserPtr.objectId === currUserId && data.Activity === "Signed"+ );+ if (+ checkAlreadySign &&+ checkAlreadySign[0] &&+ checkAlreadySign.length > 0+ ) {+ setAlreadySign(true);+ }- let signers = [];- let unSignedSigner = [];-- //check document is signed or not- if (checkDocIdExist && checkDocIdExist.length > 0) {- setIsDocId(true);- const signerRes = res[0].Signers;- //comparison auditTrail user details with signers user details- for (let i = 0; i < signerRes.length; i++) {- const signerId = signerRes[i].objectId;-- let isSigned = false;- for (let j = 0; j < checkDocIdExist.length; j++) {- const signedExist =- checkDocIdExist[j] && checkDocIdExist[j].UserPtr.objectId;- //checking signerObjId and auditTrail User objId- // if match then add signed data in signer array and break loop-- if (signerId === signedExist) {- signers.push({ ...signerRes[i], ...signerRes[i] });- isSigned = true;- break;- }- // if does not match then add unsigned data in unSignedSigner array- }- if (!isSigned) {- unSignedSigner.push({ ...signerRes[i], ...signerRes[i] });- }+ let signers = [];+ let unSignedSigner = [];++ //check document is signed or not+ if (checkDocIdExist && checkDocIdExist.length > 0) {+ setIsDocId(true);+ const signerRes = documentData[0].Signers;+ //comparison auditTrail user details with signers user details+ for (let i = 0; i < signerRes.length; i++) {+ const signerId = signerRes[i].objectId;++ let isSigned = false;+ for (let j = 0; j < checkDocIdExist.length; j++) {+ const signedExist =+ checkDocIdExist[j] && checkDocIdExist[j].UserPtr.objectId;+ //checking signerObjId and auditTrail User objId+ // if match then add signed data in signer array and break loop++ if (signerId === signedExist) {+ signers.push({ ...signerRes[i], ...signerRes[i] });+ isSigned = true;+ break;}- setSignedSigners(signers);- setUnSignedSigners(unSignedSigner);-- setSignerPos(res[0].Placeholders);- } else {- let unsigned = [];- for (let i = 0; i < res.length; i++) {- unsigned.push(res[i].Signers);- }- setUnSignedSigners(unsigned[0]);- setSignerPos(res[0].Placeholders);+ // if does not match then add unsigned data in unSignedSigner array+ }+ if (!isSigned) {+ unSignedSigner.push({ ...signerRes[i], ...signerRes[i] });}-- setPdfDetails(res);-- setIsUiLoading(false);- } else {- alert("No data found!");}+ setSignedSigners(signers);+ setUnSignedSigners(unSignedSigner);++ setSignerPos(documentData[0].Placeholders);} else {- setNoData(true);- const loadObj = {- isLoad: false- };- setIsLoading(loadObj);- setIsUiLoading(false);+ let unsigned = [];+ for (let i = 0; i < documentData.length; i++) {+ unsigned.push(documentData[i].Signers);+ }+ setUnSignedSigners(unsigned[0]);+ setSignerPos(documentData[0].Placeholders);}- })- .catch((err) => {- console.log("err", err);- const loadObj = {- isLoad: false- };- setHandleError("Error: Something went wrong!");- setIsLoading(loadObj);- });+ setPdfDetails(documentData);+ setIsUiLoading(false);+ } else {+ alert("No data found!");+ }+ } else if (documentData === "no data found!") {+ setNoData(true);+ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ setIsUiLoading(false);+ } else if (documentData === "Error: Something went wrong!") {+ const loadObj = {+ isLoad: false+ };+ setHandleError("Error: Something went wrong!");+ setIsLoading(loadObj);+ }await axios.get(`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(@@ -293,7 +277,6 @@ function PdfRequestFiles() {const checkUser = signerPos.filter((data) => data.signerObjId === signerObjectId);-if (checkUser && checkUser.length > 0) {let checkSignUrl = [];const checkSign = checkUser[0].placeHolder.filter(@@ -596,12 +579,12 @@ function PdfRequestFiles() {if (isMobile) {//if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scaleif (pos.isMobile) {- const y = pos.yPosition * (pos.scale / scale);+ const y = pos.yBottom * (pos.scale / scale);yPosition = pos.isDrag? y * scale - height: pos.firstYPos- ? y * scale - height + pos.firstYPos- : y * scale - height;+ ? y * scale - height + pos.firstYPos+ : y * scale - height;return yPosition;} else {const y = pos.yBottom / scale;@@ -609,8 +592,8 @@ function PdfRequestFiles() {yPosition = pos.isDrag? y * scale - height: pos.firstYPos- ? y * scale - height + pos.firstYPos- : y * scale - height;+ ? y * scale - height + pos.firstYPos+ : y * scale - height;return yPosition;}} else {@@ -621,15 +604,15 @@ function PdfRequestFiles() {yPosition = pos.isDrag? y - height: pos.firstYPos- ? y - height + pos.firstYPos- : y - height;+ ? y - height + pos.firstYPos+ : y - height;return yPosition;} else {yPosition = pos.isDrag? pos.yBottom - height: pos.firstYPos- ? pos.yBottom - height + pos.firstYPos- : pos.yBottom - height;+ ? pos.yBottom - height + pos.firstYPos+ : pos.yBottom - height;return yPosition;}}diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.jsindex 6591667bc..e0284b4ed 100644--- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js+++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js@@ -15,7 +15,7 @@ import EmailComponent from "./component/emailComponent";import FieldsComponent from "./component/fieldsComponent";import Modal from "react-bootstrap/Modal";import ModalHeader from "react-bootstrap/esm/ModalHeader";-import { getBase64FromIMG } from "../utils/Utils";+import { contractDocument, getBase64FromIMG } from "../utils/Utils";import { useParams } from "react-router-dom";import Tour from "reactour";import { onSaveImage, onSaveSign } from "../utils/Utils";@@ -173,55 +173,41 @@ function SignYourSelf() {//function for get document details for perticular signer with signer'object idconst getDocumentDetails = async () => {- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"objectId":"${documentId}"}&include=ExtUserPtr,Signers`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")- }- }- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;+ //getting document details+ const documentData = await contractDocument(documentId);++ if (documentData && documentData !== "no data found!" && documentData[0]) {+ setPdfDetails(documentData);+ const isCompleted =+ documentData[0].IsCompleted && documentData[0].IsCompleted;+ if (isCompleted) {+ const docStatus = {+ isCompleted: isCompleted+ };- if (res[0] && res.length > 0) {- setPdfDetails(res);- const isCompleted = res[0].IsCompleted && res[0].IsCompleted;- if (isCompleted) {- const docStatus = {- isCompleted: isCompleted- };+ setDocumentStatus(docStatus);+ const alreadySign = {+ status: true,+ mssg: "You have successfully signed the document!"+ };+ setShowAlreadySignDoc(alreadySign);+ setPdfUrl(documentData[0].SignedUrl);+ }+ } else if (documentData === "no data found!") {+ setNoData(true);- setDocumentStatus(docStatus);- const alreadySign = {- status: true,- mssg: "You have successfully signed the document!"- };- setShowAlreadySignDoc(alreadySign);- setPdfUrl(res[0].SignedUrl);- }- } else {- setNoData(true);+ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ } else if (documentData === "Error: Something went wrong!") {+ const loadObj = {+ isLoad: false+ };+ setHandleError("Error: Something went wrong!");+ setIsLoading(loadObj);+ }- const loadObj = {- isLoad: false- };- setIsLoading(loadObj);- }- })- .catch((err) => {- const loadObj = {- isLoad: false- };- setHandleError("Error: Something went wrong!");- setIsLoading(loadObj);- });await axios.get(`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(@@ -252,7 +238,8 @@ function SignYourSelf() {setHandleError("Error: Something went wrong!");setIsLoading(loadObj);});- const contractUsersRes = await contractUsers(jsonSender.objectId);++ const contractUsersRes = await contractUsers(jsonSender.email);if (contractUsersRes !== "Error: Something went wrong!" &&@@ -287,12 +274,10 @@ function SignYourSelf() {const contractContactBook = await contactBook(jsonSender.objectId);if (contractContactBook && contractContactBook[0]) {setContractName("_Contactbook");-setSignerUserId(contractContactBook[0].objectId);const tourstatuss =contractContactBook[0].TourStatus &&contractContactBook[0].TourStatus;-if (tourstatuss && tourstatuss.length > 0) {setTourStatus(tourstatuss);const checkTourRecipients = tourstatuss.filter(diff --git a/microfrontends/SignDocuments/src/Component/placeHolderSign.js b/microfrontends/SignDocuments/src/Component/placeHolderSign.jsindex 93be3b571..bf998dea8 100644--- a/microfrontends/SignDocuments/src/Component/placeHolderSign.js+++ b/microfrontends/SignDocuments/src/Component/placeHolderSign.js@@ -17,7 +17,12 @@ import HandleError from "./component/HandleError";import Nodata from "./component/Nodata";import SignerListPlace from "./component/signerListPlace";import Header from "./component/header";-import { contactBook, contractUsers, getHostUrl } from "../utils/Utils";+import {+ contactBook,+ contractDocument,+ contractUsers,+ getHostUrl+} from "../utils/Utils";import RenderPdf from "./component/renderPdf";import ModalComponent from "./component/modalComponent";import { useNavigate } from "react-router-dom";@@ -169,56 +174,37 @@ function PlaceHolderSign() {//function for get document detailsconst getDocumentDetails = async () => {- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"objectId":"${documentId}"}&include=ExtUserPtr,Signers`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")- }- }- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;-- if (res[0] && res.length > 0) {- setPdfDetails(res);-- const currEmail = res[0].ExtUserPtr.Email;- const filterCurrEmail = res[0].Signers.filter(- (data) => data.Email === currEmail- );-- setCurrentEmail(filterCurrEmail);- setSignersData(res[0]);+ //getting document details+ const documentData = await contractDocument(documentId);+ if (documentData && documentData !== "no data found!" && documentData[0]) {+ setPdfDetails(documentData);++ const currEmail = documentData[0].ExtUserPtr.Email;+ const filterCurrEmail = documentData[0].Signers.filter(+ (data) => data.Email === currEmail+ );- setSignerObjId(res[0].Signers[0].objectId);- setContractName(res[0].Signers[0].className);- setIsSelectId(0);- } else {- setNoData(true);- const loadObj = {- isLoad: false- };- setIsLoading(loadObj);- }- })- .catch((err) => {- console.log("axois err ", err);- const loadObj = {- isLoad: false- };- setHandleError("Error: Something went wrong!");- setIsLoading(loadObj);- });+ setCurrentEmail(filterCurrEmail);+ setSignersData(documentData[0]);- const res = await contractUsers(jsonSender.objectId);+ setSignerObjId(documentData[0].Signers[0].objectId);+ setContractName(documentData[0].Signers[0].className);+ setIsSelectId(0);+ } else if (documentData === "no data found!") {+ setNoData(true);+ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ } else if (documentData === "Error: Something went wrong!") {+ const loadObj = {+ isLoad: false+ };+ setHandleError("Error: Something went wrong!");+ setIsLoading(loadObj);+ }+ const res = await contractUsers(jsonSender.email);if (res[0] && res.length) {setSignerUserId(res[0].objectId);const tourstatus = res[0].TourStatus && res[0].TourStatus;diff --git a/microfrontends/SignDocuments/src/Component/recipientSignPdf.js b/microfrontends/SignDocuments/src/Component/recipientSignPdf.jsindex 77b3de40e..98683fe8d 100644--- a/microfrontends/SignDocuments/src/Component/recipientSignPdf.js+++ b/microfrontends/SignDocuments/src/Component/recipientSignPdf.js@@ -14,7 +14,9 @@ import DefaultSignature from "./component/defaultSignature";import {getBase64FromUrl,getBase64FromIMG,- contactBookName+ contractUsers,+ contactBook,+ contractDocument} from "../utils/Utils";import Tour from "reactour";import Signedby from "./component/signedby";@@ -74,6 +76,15 @@ function EmbedPdfImage() {return object.pageNumber === pageNumber;});const divRef = useRef(null);+ const senderUser = localStorage.getItem(+ `Parse/${localStorage.getItem("parseAppId")}/currentUser`+ )+ ? localStorage.getItem(+ `Parse/${localStorage.getItem("parseAppId")}/currentUser`+ )+ : `${localStorage.getItem("UserInformation")}` &&+ `${localStorage.getItem("UserInformation")}`;+ const jsonSender = JSON.parse(senderUser);//check isGuestSigner is present in local if yes than handle login flow header in mobile viewconst isGuestSigner = localStorage.getItem("isGuestSigner");useEffect(() => {@@ -96,17 +107,17 @@ function EmbedPdfImage() {//function for get document details for perticular signer with signer'object idconst getDocumentDetails = async () => {let currUserId, userObjectId;- const json = await contactBookName(contactBookId, "_Contactbook");- if (json !== "Error: Something went wrong!" && json && json.results[0]) {+ //getting contracts_contactBook details+ const json = await contactBook(contactBookId);+ if (json !== "Error: Something went wrong!" && json[0]) {setContractName("_Contactbook");- if (json.results[0]) {- userObjectId = json.results[0].UserId.objectId;+ if (json[0]) {+ userObjectId = json[0].UserId.objectId;setUserObjectID(userObjectId);- currUserId = json.results[0].objectId;+ currUserId = json[0].objectId;setSignerUserId(currUserId);- const tourstatus =- json.results[0].TourStatus && json.results[0].TourStatus;+ const tourstatus = json[0].TourStatus && json[0].TourStatus;if (tourstatus && tourstatus.length > 0) {setTourStatus(tourstatus);@@ -131,18 +142,16 @@ function EmbedPdfImage() {setHandleError("Error: Something went wrong!");setIsLoading(loadObj);} else {- const json = await contactBookName(contactBookId, "_Users");-- if (json !== "Error: Something went wrong!" && json && json.results[0]) {+ const json = await contractUsers(jsonSender.email);+ if (json !== "Error: Something went wrong!" && json && json[0]) {setContractName("_Users");- if (json.results[0]) {- userObjectId = json.results[0].UserId.objectId;+ if (json[0]) {+ userObjectId = json[0].UserId.objectId;setUserObjectID(userObjectId);- currUserId = json.results[0].objectId;+ currUserId = json[0].objectId;setSignerUserId(currUserId);- const tourstatus =- json.results[0].TourStatus && json.results[0].TourStatus;+ const tourstatus = json[0].TourStatus && json[0].TourStatus;if (tourstatus && tourstatus.length > 0) {setTourStatus(tourstatus);@@ -169,168 +178,157 @@ function EmbedPdfImage() {}}- await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Document?where={"objectId":"${docId}"}&include=ExtUserPtr,Signers,AuditTrail- ,`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")- }- }- )- .then((Listdata) => {- const json = Listdata.data;- const res = json.results;- if (res[0] && res.length > 0) {- const declined = res[0].IsDeclined && res[0].IsDeclined;- const isCompleted = res[0].IsCompleted && res[0].IsCompleted;- const expireDate = res[0].ExpiryDate.iso;-- const expireUpdateDate = new Date(expireDate).getTime();- const currDate = new Date().getTime();- if (isCompleted) {- //checking document is completed (signed by all requested signers) than isCompleted true- //then show alert with completed message- const alreadySign = {- status: true,- mssg: "This document has been successfully signed!"- };- setIsAlreadySign(alreadySign);- setPdfUrl(res[0].SignedUrl);- setSignedPdfData(json.results);- setCompletePdfData(res);- } else if (declined) {- const currentDecline = {- currnt: "another",- isDeclined: true- };- setIsDecline(currentDecline);-- setSignedPdfData(json.results);- } else if (currDate > expireUpdateDate) {- setIsExpired(true);- const checkDocIdExist =- json.results[0].AuditTrail &&- json.results[0].AuditTrail.length > 0 &&- json.results[0].AuditTrail.filter(- (data) => data.Activity === "Signed"- );+ //getting document details+ const documentData = await contractDocument(docId);+ if (documentData && documentData !== "no data found!" && documentData[0]) {+ const declined = documentData[0].IsDeclined && documentData[0].IsDeclined;+ const isCompleted =+ documentData[0].IsCompleted && documentData[0].IsCompleted;+ const expireDate = documentData[0].ExpiryDate.iso;++ const expireUpdateDate = new Date(expireDate).getTime();+ const currDate = new Date().getTime();+ if (isCompleted) {+ //checking document is completed (signed by all requested signers) than isCompleted true+ //then show alert with completed message+ const alreadySign = {+ status: true,+ mssg: "This document has been successfully signed!"+ };+ setIsAlreadySign(alreadySign);+ setPdfUrl(documentData[0].SignedUrl);+ setSignedPdfData(documentData);+ setCompletePdfData(documentData);+ } else if (declined) {+ const currentDecline = {+ currnt: "another",+ isDeclined: true+ };+ setIsDecline(currentDecline);++ setSignedPdfData(documentData);+ } else if (currDate > expireUpdateDate) {+ setIsExpired(true);+ const checkDocIdExist =+ documentData[0].AuditTrail &&+ documentData[0].AuditTrail.length > 0 &&+ documentData[0].AuditTrail.filter(+ (data) => data.Activity === "Signed"+ );- //if signed by someone than go to in if condition- // and second signer could not be add documentId- //for that setIsDocId true- if (checkDocIdExist && checkDocIdExist.length > 0) {- setIsDocId(true);- const currUser =- json.results[0].Placeholders &&- json.results[0].Placeholders.filter(- (data) => data.signerObjId === currUserId- );+ //if signed by someone than go to in if condition+ // and second signer could not be add documentId+ //for that setIsDocId true+ if (checkDocIdExist && checkDocIdExist.length > 0) {+ setIsDocId(true);+ const currUser =+ documentData.Placeholders &&+ documentData.Placeholders.filter(+ (data) => data.signerObjId === currUserId+ );- setSignedPdfData(json.results);+ setSignedPdfData(documentData);- setXyPostion(currUser[0].placeHolder);+ setXyPostion(currUser[0].placeHolder);- const key = currUser[0].placeHolder[0].pos[0].key;- setSignKey(key);- }- //for show current requested signer's placeholder- else {- const currUser =- json.results[0].Placeholders &&- json.results[0].Placeholders.filter(- (data) => data.signerObjId === currUserId- );+ const key = currUser[0].placeHolder[0].pos[0].key;+ setSignKey(key);+ }+ //for show current requested signer's placeholder+ else {+ const currUser =+ documentData[0].Placeholders &&+ documentData[0].Placeholders.filter(+ (data) => data.signerObjId === currUserId+ );- setSignedPdfData(json.results);+ setSignedPdfData(documentData);- setXyPostion(currUser[0].placeHolder);+ setXyPostion(currUser[0].placeHolder);- const key = currUser[0].placeHolder[0].pos[0].key;- setSignKey(key);- }- } else {- //checking document has signed by someone or not+ const key = currUser[0].placeHolder[0].pos[0].key;+ setSignKey(key);+ }+ } else {+ //checking document has signed by someone or not- const checkDocIdExist =- json.results[0].AuditTrail &&- json.results[0].AuditTrail.length > 0 &&- json.results[0].AuditTrail.filter(- (data) => data.Activity === "Signed"- );+ const checkDocIdExist =+ documentData[0].AuditTrail &&+ documentData[0].AuditTrail.length > 0 &&+ documentData[0].AuditTrail.filter(+ (data) => data.Activity === "Signed"+ );- //if signed by someone than go to in if condition- // and second signer could not be add documentId- //for that setIsDocId true+ //if signed by someone than go to in if condition+ // and second signer could not be add documentId+ //for that setIsDocId true- if (checkDocIdExist && checkDocIdExist.length > 0) {- setIsDocId(true);+ if (checkDocIdExist && checkDocIdExist.length > 0) {+ setIsDocId(true);- //condition for checking document signed by current requested user or not- const checkAlreadyBySigner = json.results[0].AuditTrail.filter(- (data) =>- data.UserPtr.objectId === currUserId &&- data.Activity === "Signed"- );+ //condition for checking document signed by current requested user or not+ const checkAlreadyBySigner = documentData[0].AuditTrail.filter(+ (data) =>+ data.UserPtr.objectId === currUserId && data.Activity === "Signed"+ );- // if checkAlreadyBySigner has some data that current user already sign this document- // then show alert with message- if (checkAlreadyBySigner && checkAlreadyBySigner.length > 0) {- const alreadySign = {- status: true,- mssg: "You have successfully signed the document!"- };- setIsAlreadySign(alreadySign);- setPdfUrl(res[0].SignedUrl);- setSignedPdfData(json.results);- }- //else show placeholder of current requested signer- else {- const currUser =- json.results[0].Placeholders &&- json.results[0].Placeholders.filter(- (data) => data.signerObjId === currUserId- );+ // if checkAlreadyBySigner has some data that current user already sign this document+ // then show alert with message+ if (checkAlreadyBySigner && checkAlreadyBySigner.length > 0) {+ const alreadySign = {+ status: true,+ mssg: "You have successfully signed the document!"+ };+ setIsAlreadySign(alreadySign);+ setPdfUrl(documentData[0].SignedUrl);+ setSignedPdfData(documentData);+ }+ //else show placeholder of current requested signer+ else {+ const currUser =+ documentData[0].Placeholders &&+ documentData[0].Placeholders.filter(+ (data) => data.signerObjId === currUserId+ );- setSignedPdfData(json.results);+ setSignedPdfData(documentData);- setXyPostion(currUser[0].placeHolder);+ setXyPostion(currUser[0].placeHolder);- const key = currUser[0].placeHolder[0].pos[0].key;- setSignKey(key);- }- }- //for show current requested signer's placeholder- else {- const currUser =- json.results[0].Placeholders &&- json.results[0].Placeholders.filter(- (data) => data.signerObjId === currUserId- );+ const key = currUser[0].placeHolder[0].pos[0].key;+ setSignKey(key);+ }+ }+ //for show current requested signer's placeholder+ else {+ const currUser =+ documentData[0].Placeholders &&+ documentData[0].Placeholders.filter(+ (data) => data.signerObjId === currUserId+ );- setSignedPdfData(json.results);+ setSignedPdfData(documentData);- setXyPostion(currUser[0].placeHolder);+ setXyPostion(currUser[0].placeHolder);- const key = currUser[0].placeHolder[0].pos[0].key;- setSignKey(key);- }- }+ const key = currUser[0].placeHolder[0].pos[0].key;+ setSignKey(key);}- })- .catch((err) => {- const loadObj = {- isLoad: false- };- setHandleError("Error: Something went wrong!");- setIsLoading(loadObj);- console.log("err", err);- });+ }+ } else if (documentData === "no data found!") {+ setNoData(true);++ const loadObj = {+ isLoad: false+ };+ setIsLoading(loadObj);+ } else if (documentData === "Error: Something went wrong!") {+ const loadObj = {+ isLoad: false+ };+ setHandleError("Error: Something went wrong!");+ setIsLoading(loadObj);+ }await axios.get(`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(@@ -662,8 +660,8 @@ function EmbedPdfImage() {yPosition = pos.isDrag? y * scale - height: pos.firstYPos- ? y * scale - height + pos.firstYPos- : y * scale - height;+ ? y * scale - height + pos.firstYPos+ : y * scale - height;return yPosition;} else {const y = pos.yBottom / scale;@@ -671,8 +669,8 @@ function EmbedPdfImage() {yPosition = pos.isDrag? y * scale - height: pos.firstYPos- ? y * scale - height + pos.firstYPos- : y * scale - height;+ ? y * scale - height + pos.firstYPos+ : y * scale - height;return yPosition;}} else {@@ -683,15 +681,15 @@ function EmbedPdfImage() {yPosition = pos.isDrag? y - height: pos.firstYPos- ? y - height + pos.firstYPos- : y - height;+ ? y - height + pos.firstYPos+ : y - height;return yPosition;} else {yPosition = pos.isDrag? pos.yBottom - height: pos.firstYPos- ? pos.yBottom - height + pos.firstYPos- : pos.yBottom - height;+ ? pos.yBottom - height + pos.firstYPos+ : pos.yBottom - height;return yPosition;}}@@ -1083,7 +1081,7 @@ function EmbedPdfImage() {isShowHeader={true}currentSigner={true}decline={true}- alreadySign={pdfUrl ? true :false}+ alreadySign={pdfUrl ? true : false}/><RenderPdf@@ -1128,9 +1126,7 @@ function EmbedPdfImage() {)}</div>)}-</DndProvider>);}--export default EmbedPdfImage;\ No newline at end of file+export default EmbedPdfImage;diff --git a/microfrontends/SignDocuments/src/utils/Utils.js b/microfrontends/SignDocuments/src/utils/Utils.jsindex 0b915423d..bdd4786ac 100644--- a/microfrontends/SignDocuments/src/utils/Utils.js+++ b/microfrontends/SignDocuments/src/utils/Utils.js@@ -57,7 +57,6 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {(data, ind) =>data.key === signKey && data.Width && data.Height && data.SignUrl);-if (updateFilter.length > 0) {let newWidth, newHeight;@@ -139,7 +138,7 @@ export function onSaveImage(xyPostion, index, signKey, imgWH, image) {...url,Width: getPosData[0].Width ? getPosData[0].Width : newWidth,Height: getPosData[0].Height ? getPosData[0].Height : newHeight,- SignUrl: image.src,+ SignUrl: image.src,ImageType: image.imgType};}@@ -183,66 +182,103 @@ export function onSaveSign(xyPostion, index, signKey, signatureImg) {return newUpdateUrl;}-//function for getting contract_User details-export const contractUsers = async (objectId) => {- const result = await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Users?where={"UserId": {"__type": "Pointer","className": "_User", "objectId":"${objectId}"}}`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")- }+//function for getting document details from contract_Documents class+export const contractDocument = async (documentId) => {+ const data = {+ docId: documentId+ };+ const documentDeatils = await axios+ .post(`${localStorage.getItem("baseUrl")}functions/getDocument`, data, {+ headers: {+ "Content-Type": "application/json",+ "X-Parse-Application-Id": localStorage.getItem("parseAppId"),+ sessionToken: localStorage.getItem("accesstoken")}- )+ }).then((Listdata) => {const json = Listdata.data;- const res = json.results;- return res;+ let data = [];+ if (json && json.result) {+ data.push(json.result);+ return data;+ } else {+ return "no data found!";+ }}).catch((err) => {return "Error: Something went wrong!";});- return result;+ return documentDeatils;};-//function for getting contrscts_contactbook details-export const contactBook = async (objectId) => {- const result = await axios- .get(- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(- "_appName"- )}_Contactbook?where={"UserId": {"__type": "Pointer","className": "_User", "objectId":"${objectId}"}}`,- {- headers: {- "Content-Type": "application/json",- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")- }+//function for getting document details for getDrive+export const getDrive = async (documentId) => {+ const data = {+ docId: documentId && documentId+ };+ const driveDeatils = await axios+ .post(`${localStorage.getItem("baseUrl")}functions/getDrive`, data, {+ headers: {+ "Content-Type": "application/json",+ "X-Parse-Application-Id": localStorage.getItem("parseAppId"),+ sessiontoken: localStorage.getItem("accesstoken")}- )+ }).then((Listdata) => {const json = Listdata.data;- const res = json.results;- return res;++ if (json && json.result) {+ const data = json.result;++ return data;+ } else {+ return "no data found!";+ }})+ .catch((err) => {+ return "Error: Something went wrong!";+ });+ return driveDeatils;+};+//function for getting contract_User details+export const contractUsers = async (email) => {+ const data = {+ email: email+ };+ const userDetails = await axios+ .post(`${localStorage.getItem("baseUrl")}functions/getUserDetails`, data, {+ headers: {+ "Content-Type": "application/json",+ "X-Parse-Application-Id": localStorage.getItem("parseAppId"),+ sessionToken: localStorage.getItem("accesstoken")+ }+ })+ .then((Listdata) => {+ const json = Listdata.data;+ let data = [];+ if (json && json.result) {+ data.push(json.result);+ return data;+ } else {+ return "no data found!";+ }+ }).catch((err) => {return "Error: Something went wrong!";});- return result;++ return userDetails;};-export const contactBookName = async (objectId, className) => {+//function for getting contracts_contactbook details+export const contactBook = async (objectId) => {const result = await axios.get(`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem("_appName"- )}${className}?where={"objectId":"${objectId}"}`,+ )}_Contactbook?where={"UserId": {"__type": "Pointer","className": "_User", "objectId":"${objectId}"}}`,{headers: {"Content-Type": "application/json",@@ -253,8 +289,10 @@ export const contactBookName = async (objectId, className) => {).then((Listdata) => {const json = Listdata.data;- return json;+ const res = json.results;+ return res;})+.catch((err) => {return "Error: Something went wrong!";});