Compare commits

...
46 Commits
Author SHA1 Message Date
AndrewandGitHub 56dd060531 Merge pull request #716 from OpenSignLabs/fix_guestlogin 2024-05-10 15:14:19 +05:30
prafull-opensignlabs 960fbdb0eb fix: issue of owner subscription has expired in guest login 2024-05-10 15:10:57 +05:30
AndrewandGitHub f8145feebc Merge pull request #714 from OpenSignLabs/prafull-opensignlabs-patch-17 2024-05-10 11:14:26 +05:30
prafull-opensignlabsandGitHub df38d15611 fix: error something went wrong while signing document in request sign 2024-05-10 11:12:29 +05:30
prafull-opensignlabsandGitHub fee53fb020 Merge pull request #713 from OpenSignLabs/revert-712-raktima-opensignlabs-path-3
Revert "fix: owner's subsciption expired issue in guest login"
2024-05-09 20:56:08 +05:30
prafull-opensignlabsandGitHub d086e60ae5 Revert "fix: owner's subsciption expired issue in guest login" 2024-05-09 20:55:30 +05:30
prafull-opensignlabsandGitHub 51150d4e47 Merge pull request #712 from OpenSignLabs/raktima-opensignlabs-path-3
fix: owner's subsciption expired issue in guest login
2024-05-09 20:34:44 +05:30
RaktimaNXG 1d3cd02f9d fix: owner's subsciption expired issue in guest login 2024-05-09 20:32:33 +05:30
prafull-opensignlabsandGitHub d03515efc4 Merge pull request #708 from OpenSignLabs/raktima-opensignlabs-patch-2
feat: implemented a solution allowing for the simultaneous signing of a document by multiple signers
2024-05-09 16:36:37 +05:30
AmolandGitHub 30e6e4b3fd Merge pull request #709 from OpenSignLabs/prafull-opensignlabs-patch-16 2024-05-09 15:08:26 +05:30
prafull-opensignlabsandGitHub cbdd729e95 fix: pdf download is not working 2024-05-09 14:53:11 +05:30
RaktimaNXG ac82209d52 feat: implemented a solution allowing for the simultaneous signing of a document by multiple signers 2024-05-09 13:36:02 +05:30
RaktimaandGitHub d5cc6f6758 Merge pull request #707 from OpenSignLabs/prafull-opensignlabs-patch-15
refactor: change default cursor pointer to crosshair cursor pointer in debugUI
2024-05-09 12:33:50 +05:30
prafull-opensignlabsandGitHub 3aa211dc1a refactor: change default cursor pointer to crosshair cursor pointer in debugUI 2024-05-09 12:31:42 +05:30
prafull-opensignlabsandGitHub 33d5eecbbf Merge pull request #706 from OpenSignLabs/raktima-opensignlabs-patch-1
fix: can not access template before initialization
2024-05-09 12:00:25 +05:30
RaktimaNXG 1d6c108ba4 fix: can not access template before initialization 2024-05-09 11:58:57 +05:30
prafull-opensignlabsandGitHub 79da0f285d Merge pull request #704 from OpenSignLabs/raktima-opensignlabs-patch-1
fix:  integrate validation for the signature widget as mandatory using API
2024-05-09 11:36:36 +05:30
RaktimaNXG e8eef32958 fix: update condition for checking signature widget validation 2024-05-09 11:33:20 +05:30
RaktimaNXG 660eaeb714 fix: integrate validation for the signature widget as mandatory using API 2024-05-08 19:25:21 +05:30
RaktimaandGitHub 79126700c4 Merge pull request #702 from OpenSignLabs/prafull-opensignlabs-patch-14
fix: issue of user name is visible in subject of mail instead of document title
2024-05-08 16:06:43 +05:30
prafull-opensignlabsandGitHub 6355c02485 Update createDocumentwithCoordinate.js 2024-05-08 16:00:02 +05:30
prafull-opensignlabsandGitHub bce028877b Fix: issue of user name is visible in subject of mail instead of document title 2024-05-08 15:58:51 +05:30
prafull-opensignlabsandGitHub e47211a8c0 Merge pull request #701 from OpenSignLabs/raktima-opensignlabs-patch-1
fix: modal design of signature validation in both flow signyour-self and request-sign
2024-05-08 15:57:01 +05:30
RaktimaNXG 4a4c9eaa2d refactor: remove line 2024-05-08 15:54:48 +05:30
RaktimaNXG 0a5653f53d fix: modal design of signature validation in both flow signyour-self and request-sign 2024-05-08 15:48:53 +05:30
AmolandGitHub 5a90a0f484 Merge pull request #700 from OpenSignLabs/prafull-opensignlabs-patch-13
refactor: update certificate generating message
2024-05-08 15:43:24 +05:30
prafull-opensignlabsandGitHub a3a398bd92 refactor: update certificate generating message 2024-05-08 15:38:27 +05:30
AmolandGitHub 7d70162137 Merge pull request #699 from OpenSignLabs/raktima-opensignlabs-patch-1 2024-05-08 14:13:48 +05:30
RaktimaNXG e4c62c4eeb feat : integrate validation for the signature widget as mandatory. 2024-05-08 14:12:18 +05:30
AmolandGitHub 3eadca01fa Merge pull request #698 from OpenSignLabs/prafull-opensignlabs-patch-12
fix: issue of showing originator in completion certificate's signer list when add only one signer
2024-05-08 12:55:15 +05:30
prafull-opensignlabsandGitHub 659b7fe0f4 fix: issue of showing originator in completion certificate's signer list when add only one signer 2024-05-08 12:54:01 +05:30
AmolandGitHub ade6694427 Merge pull request #695 from OpenSignLabs/signPdf
fix: issue of showing document in drafts report after creating from document API
2024-05-08 12:13:20 +05:30
RaktimaandGitHub f8160665a4 Merge pull request #697 from OpenSignLabs/prafull-opensignlabs-patch-10
fix: something went wrong error in guest login when document created through Document API
2024-05-08 12:11:12 +05:30
prafull-opensignlabsandGitHub 5778bdecae fix: something went wrong error in guest login when document created through Document API 2024-05-08 12:10:11 +05:30
prafull-opensignlabs 9122c71c90 Merge branch 'staging' of https://github.com/OpenSignLabs/OpenSign into signPdf 2024-05-08 12:00:53 +05:30
prafull-opensignlabs 2c2065aca8 fix: issue of showing document in drafts report after creating from document API 2024-05-08 11:03:38 +05:30
AmolandGitHub 64fd3580ac Merge pull request #691 from OpenSignLabs/all-contributors/add-daniel-mutwiri
docs: add daniel-mutwiri as a contributor for code
2024-05-07 20:42:06 +05:30
AmolandGitHub 01273777b7 Merge branch 'staging' into all-contributors/add-daniel-mutwiri 2024-05-07 20:41:56 +05:30
AmolandGitHub 23eaa1ae81 Merge pull request #690 from OpenSignLabs/all-contributors/add-Zathiel
docs: add Zathiel as a contributor for code
2024-05-07 20:37:35 +05:30
allcontributors[bot]andGitHub 3fd0613407 docs: update .all-contributorsrc 2024-05-07 15:07:21 +00:00
allcontributors[bot]andGitHub d45566257f docs: update README.md 2024-05-07 15:07:20 +00:00
allcontributors[bot]andGitHub e9eb59aa7a docs: update .all-contributorsrc 2024-05-07 15:06:43 +00:00
allcontributors[bot]andGitHub 9e3ba2cf5c docs: update README.md 2024-05-07 15:06:42 +00:00
AmolandGitHub 81afc92c14 Merge pull request #689 from OpenSignLabs/all-contributors/add-ugoconsonni
docs: add ugoconsonni as a contributor for code
2024-05-07 20:36:07 +05:30
allcontributors[bot]andGitHub d3bf9e9e9b docs: update .all-contributorsrc 2024-05-07 15:05:51 +00:00
allcontributors[bot]andGitHub 18e25f6cd9 docs: update README.md 2024-05-07 15:05:50 +00:00
14 changed files with 217 additions and 105 deletions
+27
View File
@@ -205,6 +205,33 @@
"contributions": [ "contributions": [
"code" "code"
] ]
},
{
"login": "ugoconsonni",
"name": "ugoconsonni",
"avatar_url": "https://avatars.githubusercontent.com/u/13661702?v=4",
"profile": "https://github.com/ugoconsonni",
"contributions": [
"code"
]
},
{
"login": "daniel-mutwiri",
"name": "Daniel Mutwiri",
"avatar_url": "https://avatars.githubusercontent.com/u/8936960?v=4",
"profile": "https://github.com/daniel-mutwiri",
"contributions": [
"code"
]
},
{
"login": "Zathiel",
"name": "Zathiel",
"avatar_url": "https://avatars.githubusercontent.com/u/26553418?v=4",
"profile": "https://github.com/Zathiel",
"contributions": [
"code"
]
} }
] ]
} }
+3
View File
@@ -134,6 +134,9 @@ We would like to thank all our contributors and users for their support and feed
</tr> </tr>
<tr> <tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VikramNagwal"><img src="https://avatars.githubusercontent.com/u/123088024?v=4?s=100" width="100px;" alt="Vikram"/><br /><sub><b>Vikram</b></sub></a><br /><a href="#code-VikramNagwal" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/VikramNagwal"><img src="https://avatars.githubusercontent.com/u/123088024?v=4?s=100" width="100px;" alt="Vikram"/><br /><sub><b>Vikram</b></sub></a><br /><a href="#code-VikramNagwal" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ugoconsonni"><img src="https://avatars.githubusercontent.com/u/13661702?v=4?s=100" width="100px;" alt="ugoconsonni"/><br /><sub><b>ugoconsonni</b></sub></a><br /><a href="#code-ugoconsonni" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/daniel-mutwiri"><img src="https://avatars.githubusercontent.com/u/8936960?v=4?s=100" width="100px;" alt="Daniel Mutwiri"/><br /><sub><b>Daniel Mutwiri</b></sub></a><br /><a href="#code-daniel-mutwiri" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Zathiel"><img src="https://avatars.githubusercontent.com/u/26553418?v=4?s=100" width="100px;" alt="Zathiel"/><br /><sub><b>Zathiel</b></sub></a><br /><a href="#code-Zathiel" title="Code">💻</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
+4 -2
View File
@@ -49,6 +49,7 @@ const AddSigner = (props) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
setIsLoader(true); setIsLoader(true);
if (localStorage.getItem("TenantId")) {
try { try {
const contactQuery = new Parse.Object("contracts_Contactbook"); const contactQuery = new Parse.Object("contracts_Contactbook");
contactQuery.set("Name", name); contactQuery.set("Name", name);
@@ -56,13 +57,11 @@ const AddSigner = (props) => {
contactQuery.set("Email", email); contactQuery.set("Email", email);
contactQuery.set("UserRole", "contracts_Guest"); contactQuery.set("UserRole", "contracts_Guest");
if (localStorage.getItem("TenantId")) {
contactQuery.set("TenantId", { contactQuery.set("TenantId", {
__type: "Pointer", __type: "Pointer",
className: "partners_Tenant", className: "partners_Tenant",
objectId: localStorage.getItem("TenantId") objectId: localStorage.getItem("TenantId")
}); });
}
try { try {
const _users = Parse.Object.extend("User"); const _users = Parse.Object.extend("User");
@@ -188,6 +187,9 @@ const AddSigner = (props) => {
setIsLoader(false); setIsLoader(false);
alert("something went wrong!"); alert("something went wrong!");
} }
}else{
alert('something went wrong, please try again later')
}
}; };
// Define a function to handle the "add yourself" checkbox // Define a function to handle the "add yourself" checkbox
@@ -22,7 +22,8 @@ const RenderDebugPdf = (props) => {
flex: 1, flex: 1,
position: "relative", position: "relative",
border: "1px solid grey", border: "1px solid grey",
overflow: "auto" overflow: "auto",
cursor: "crosshair"
}} }}
onMouseMove={props.handleMouseMoveDiv} onMouseMove={props.handleMouseMoveDiv}
> >
+34 -5
View File
@@ -9,7 +9,7 @@ import { useNavigate } from "react-router-dom";
import { themeColor } from "../../constant/const"; import { themeColor } from "../../constant/const";
import axios from "axios"; import axios from "axios";
import ModalUi from "../../primitives/ModalUi"; import ModalUi from "../../primitives/ModalUi";
import Parse from "parse"; import { appInfo } from "../../constant/appinfo";
function Header({ function Header({
isPdfRequestFiles, isPdfRequestFiles,
@@ -64,7 +64,19 @@ function Header({
event.preventDefault(); event.preventDefault();
try { try {
const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl }); // const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
const axiosRes = await axios.post(
`${appInfo.baseUrl}/functions/getsignedurl`,
{ url: pdfUrl },
{
headers: {
"content-type": "Application/json",
"X-Parse-Application-Id": appInfo.appId,
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
}
}
);
const url = axiosRes.data.result;
const pdf = await getBase64FromUrl(url); const pdf = await getBase64FromUrl(url);
const isAndroidDevice = navigator.userAgent.match(/Android/i); const isAndroidDevice = navigator.userAgent.match(/Android/i);
const isAppleDevice = const isAppleDevice =
@@ -94,7 +106,19 @@ function Header({
const handleDownloadPdf = async () => { const handleDownloadPdf = async () => {
const pdfName = pdfDetails[0] && pdfDetails[0].Name; const pdfName = pdfDetails[0] && pdfDetails[0].Name;
try { try {
const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl }); // const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
const axiosRes = await axios.post(
`${appInfo.baseUrl}/functions/getsignedurl`,
{ url: pdfUrl },
{
headers: {
"content-type": "Application/json",
"X-Parse-Application-Id": appInfo.appId,
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
}
}
);
const url = axiosRes.data.result;
saveAs(url, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); saveAs(url, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
} catch (err) { } catch (err) {
console.log("err in getsignedurl", err); console.log("err in getsignedurl", err);
@@ -577,8 +601,13 @@ function Header({
handleClose={() => setIsCertificate(false)} handleClose={() => setIsCertificate(false)}
> >
<div className="p-3 md:p-5 text-[13px] md:text-base text-center"> <div className="p-3 md:p-5 text-[13px] md:text-base text-center">
<p>Completion certificate is generating,</p> <p>
<p>please wait for some time if not download try again later</p> Your completion certificate is being generated. Please wait
momentarily.
</p>
<p>
If the download doesn&apos;t start shortly, click the button again.
</p>
</div> </div>
</ModalUi> </ModalUi>
</div> </div>
+7 -7
View File
@@ -566,13 +566,13 @@ export const signPdfFun = async (
// for adding it in completion certificate // for adding it in completion certificate
let getSignature; let getSignature;
for (let item of xyPosition) { for (let item of xyPosition) {
const typeExist = item.pos.some((data) => data?.type); if (!getSignature) {
if (typeExist) { const typeExist = item.pos.some((data) => data?.type);
getSignature = item.pos.find((data) => data?.type === "signature"); if (typeExist) {
break; getSignature = item.pos.find((data) => data?.type === "signature");
} else { } else {
getSignature = item.pos.find((data) => !data.isStamp); getSignature = item.pos.find((data) => !data.isStamp);
break; }
} }
} }
+23 -18
View File
@@ -28,29 +28,34 @@ const HomeLayout = () => {
const [tourConfigs, setTourConfigs] = useState([]); const [tourConfigs, setTourConfigs] = useState([]);
const [, setCookie] = useCookies(["accesstoken", "main_Domain"]); const [, setCookie] = useCookies(["accesstoken", "main_Domain"]);
const tenantId = localStorage.getItem("TenantId");
useEffect(() => { useEffect(() => {
(async () => { if (!tenantId) {
try { setIsUserValid(false);
// Use the session token to validate the user } else {
const userQuery = new Parse.Query(Parse.User); (async () => {
const user = await userQuery.get(Parse.User.current().id, { try {
sessionToken: localStorage.getItem("accesstoken") // Use the session token to validate the user
}); const userQuery = new Parse.Query(Parse.User);
if (user) { const user = await userQuery.get(Parse.User.current().id, {
localStorage.setItem("profileImg", user.get("ProfilePic") || ""); sessionToken: localStorage.getItem("accesstoken")
checkIsSubscribed(); });
} else { if (user) {
localStorage.setItem("profileImg", user.get("ProfilePic") || "");
checkIsSubscribed();
} else {
setIsUserValid(false);
}
} catch (error) {
// Session token is invalid or there was an error
setIsUserValid(false); setIsUserValid(false);
} }
} catch (error) { })();
// Session token is invalid or there was an error saveCookies();
setIsUserValid(false); }
}
})();
saveCookies();
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, [tenantId]);
//function to use save data in cookies storage //function to use save data in cookies storage
const saveCookies = () => { const saveCookies = () => {
const main_Domain = window.location.origin; const main_Domain = window.location.origin;
+1 -1
View File
@@ -24,7 +24,7 @@ const Dashboard = () => {
getDashboard(localStorage.getItem("PageLanding")); getDashboard(localStorage.getItem("PageLanding"));
} }
} else { } else {
navigate("/", { replace: true, state: { from: location } }); navigate("/", { replace: true, state: { from: "" } });
} }
// eslint-disable-next-line // eslint-disable-next-line
}, [id]); }, [id]);
+24 -12
View File
@@ -104,7 +104,6 @@ function PdfRequestFiles() {
const [currWidgetsDetails, setCurrWidgetsDetails] = useState({}); const [currWidgetsDetails, setCurrWidgetsDetails] = useState({});
const [isSubscriptionExpired, setIsSubscriptionExpired] = useState(false); const [isSubscriptionExpired, setIsSubscriptionExpired] = useState(false);
const [extUserId, setExtUserId] = useState(""); const [extUserId, setExtUserId] = useState("");
const [pdfArrayBuffer, setPdfArrayBuffer] = useState("");
const [isEmailVerified, setIsEmailVerified] = useState(true); const [isEmailVerified, setIsEmailVerified] = useState(true);
const [isVerifyModal, setIsVerifyModal] = useState(false); const [isVerifyModal, setIsVerifyModal] = useState(false);
const [otp, setOtp] = useState(""); const [otp, setOtp] = useState("");
@@ -225,16 +224,6 @@ function PdfRequestFiles() {
//getting document details //getting document details
const documentData = await contractDocument(documentId); const documentData = await contractDocument(documentId);
if (documentData && documentData.length > 0) { if (documentData && documentData.length > 0) {
const url =
documentData[0] && (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: Something went wrong!");
} else {
setPdfArrayBuffer(arrayBuffer);
}
setExtUserId(documentData[0]?.ExtUserPtr?.objectId); setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
const isCompleted = const isCompleted =
documentData[0].IsCompleted && documentData[0].IsCompleted; documentData[0].IsCompleted && documentData[0].IsCompleted;
@@ -642,9 +631,32 @@ function PdfRequestFiles() {
setWidgetsTour(true); setWidgetsTour(true);
} else { } else {
setIsUiLoading(true); setIsUiLoading(true);
const pngUrl = checkUser[0].placeHolder; const pngUrl = checkUser[0].placeHolder;
let pdfArrBuffer;
//`contractDocument` function used to get updated SignedUrl
//resolved issue of sign document by multiple signers simultaneously
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 // Load a PDFDocument from the existing PDF bytes
const existingPdfBytes = pdfArrayBuffer; const existingPdfBytes = pdfArrBuffer;
try { try {
const pdfDoc = await PDFDocument.load(existingPdfBytes); const pdfDoc = await PDFDocument.load(existingPdfBytes);
const isSignYourSelfFlow = false; const isSignYourSelfFlow = false;
+42 -16
View File
@@ -830,11 +830,11 @@ function PlaceHolderSign() {
return pdfDetails[0].URL; return pdfDetails[0].URL;
} }
}; };
const alertSendEmail = async () => { const alertSendEmail = async () => {
const filterPrefill = signerPos?.filter((data) => data.Role !== "prefill"); const filterPrefill = signerPos?.filter((data) => data.Role !== "prefill");
const getPrefill = signerPos?.filter((data) => data.Role === "prefill"); const getPrefill = signerPos?.filter((data) => data.Role === "prefill");
let isLabel = false; let isLabel = false;
//condition is used to check text widget data is empty or have response
if (getPrefill && getPrefill.length > 0) { if (getPrefill && getPrefill.length > 0) {
const prefillPlaceholder = getPrefill[0].placeHolder; const prefillPlaceholder = getPrefill[0].placeHolder;
if (prefillPlaceholder) { if (prefillPlaceholder) {
@@ -845,6 +845,29 @@ function PlaceHolderSign() {
}); });
} }
} }
let isSignatureExist = true; // variable is used to check a signature widget exit or not then execute other code
//for loop is used to check signature widget exist or not
for (let item of filterPrefill) {
let signatureExist = false; // Reset for each iteration
for (let x of item.placeHolder) {
if (!signatureExist) {
const typeExist = x.pos.some((data) => data?.type);
if (typeExist) {
signatureExist = x.pos.some((data) => data?.type === "signature");
} else {
signatureExist = x.pos.some((data) => !data.isStamp);
}
}
}
if (!signatureExist) {
isSignatureExist = false;
const alert = {
mssg: "sure",
alert: true
};
setIsSendAlert(alert);
}
}
if (getPrefill && isLabel) { if (getPrefill && isLabel) {
const alert = { const alert = {
@@ -852,23 +875,26 @@ function PlaceHolderSign() {
alert: true alert: true
}; };
setIsSendAlert(alert); setIsSendAlert(alert);
} else if (filterPrefill.length === signersdata.length) { } else if (isSignatureExist) {
const IsSignerNotExist = filterPrefill?.filter((x) => !x.signerObjId); if (filterPrefill.length === signersdata.length) {
if (IsSignerNotExist && IsSignerNotExist?.length > 0) { const IsSignerNotExist = filterPrefill?.filter((x) => !x.signerObjId);
setSignerExistModal(true); if (IsSignerNotExist && IsSignerNotExist?.length > 0) {
setSelectWidgetId(IsSignerNotExist[0]?.placeHolder?.[0]?.pos?.[0]?.key); setSignerExistModal(true);
setSelectWidgetId(
IsSignerNotExist[0]?.placeHolder?.[0]?.pos?.[0]?.key
);
} else {
saveDocumentDetails();
}
} else { } else {
saveDocumentDetails(); const alert = {
mssg: "sure",
alert: true
};
setIsSendAlert(alert);
} }
} else {
const alert = {
mssg: "sure",
alert: true
};
setIsSendAlert(alert);
} }
}; };
//function to use save placeholder details in contracts_document //function to use save placeholder details in contracts_document
const saveDocumentDetails = async () => { const saveDocumentDetails = async () => {
setIsUiLoading(true); setIsUiLoading(true);
@@ -1687,8 +1713,8 @@ function PlaceHolderSign() {
> >
{isSendAlert.mssg === "sure" ? ( {isSendAlert.mssg === "sure" ? (
<span> <span>
Please add at least one signature field for all Please ensure there&apos;s at least one signature widget
recipients. added for all recipients.
</span> </span>
) : isSendAlert.mssg === textWidget ? ( ) : isSendAlert.mssg === textWidget ? (
<p>Please confirm that you have filled the text field.</p> <p>Please confirm that you have filled the text field.</p>
+26 -38
View File
@@ -480,13 +480,13 @@ function SignYourSelf() {
Width: widgetTypeExist Width: widgetTypeExist
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getWidth ? calculateInitialWidthHeight(dragTypeValue, widgetValue).getWidth
: dragTypeValue === "initials" : dragTypeValue === "initials"
? defaultWidthHeight(dragTypeValue).width ? defaultWidthHeight(dragTypeValue).width
: "", : "",
Height: widgetTypeExist Height: widgetTypeExist
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getHeight ? calculateInitialWidthHeight(dragTypeValue, widgetValue).getHeight
: dragTypeValue === "initials" : dragTypeValue === "initials"
? defaultWidthHeight(dragTypeValue).height ? defaultWidthHeight(dragTypeValue).height
: "", : "",
options: addWidgetOptions(dragTypeValue) options: addWidgetOptions(dragTypeValue)
}; };
@@ -603,7 +603,8 @@ function SignYourSelf() {
}; };
//function for send placeholder's co-ordinate(x,y) position embed signature url or stamp url //function for send placeholder's co-ordinate(x,y) position embed signature url or stamp url
async function embedWidgetsData() { async function embedWidgetsData() {
let showAlert = false; let showAlert = false,
isSignatureExist = false;
try { try {
for (let i = 0; i < xyPostion?.length; i++) { for (let i = 0; i < xyPostion?.length; i++) {
const requiredWidgets = xyPostion[i].pos.filter( const requiredWidgets = xyPostion[i].pos.filter(
@@ -627,17 +628,26 @@ function SignYourSelf() {
} }
} }
} }
//condition to check exist signature widget or not
if (!isSignatureExist) {
isSignatureExist = xyPostion[i].pos.some(
(data) => data?.type === "signature"
);
}
} }
if (xyPostion.length === 0) { if (xyPostion.length === 0 || !isSignatureExist) {
setIsAlert({ setIsAlert({
header: "Fields required",
isShow: true, isShow: true,
alertMessage: "Please complete your signature!" alertMessage:
"Please ensure there's at least one signature widget added"
}); });
return; return;
} else if (showAlert) { } else if (showAlert) {
setIsAlert({ setIsAlert({
isShow: true, isShow: true,
alertMessage: "Please complete your signature!" alertMessage:
"Please ensure all field is accurately filled and meets all requirements."
}); });
return; return;
} else { } else {
@@ -713,13 +723,13 @@ function SignYourSelf() {
// for adding it in completion certificate // for adding it in completion certificate
let getSignature; let getSignature;
for (let item of xyPostion) { for (let item of xyPostion) {
const typeExist = item.pos.some((data) => data?.type); if (!getSignature) {
if (typeExist) { const typeExist = item.pos.some((data) => data?.type);
getSignature = item.pos.find((data) => data?.type === "signature"); if (typeExist) {
break; getSignature = item.pos.find((data) => data?.type === "signature");
} else { } else {
getSignature = item.pos.find((data) => !data.isStamp); getSignature = item.pos.find((data) => !data.isStamp);
break; }
} }
} }
let base64Sign = getSignature.SignUrl; let base64Sign = getSignature.SignUrl;
@@ -1161,7 +1171,7 @@ function SignYourSelf() {
<ModalUi <ModalUi
headerColor={"#dc3545"} headerColor={"#dc3545"}
isOpen={isAlert.isShow} isOpen={isAlert.isShow}
title={"Alert"} title={isAlert?.header || "Alert"}
handleClose={() => { handleClose={() => {
setIsAlert({ setIsAlert({
isShow: false, isShow: false,
@@ -1171,28 +1181,6 @@ function SignYourSelf() {
> >
<div style={{ height: "100%", padding: 20 }}> <div style={{ height: "100%", padding: 20 }}>
<p>{isAlert.alertMessage}</p> <p>{isAlert.alertMessage}</p>
<div
style={{
height: "1px",
backgroundColor: "#9f9f9f",
width: "100%",
marginTop: "15px",
marginBottom: "15px"
}}
></div>
<button
onClick={() => {
setIsAlert({
isShow: false,
alertMessage: ""
});
}}
type="button"
className="finishBtn cancelBtn"
>
Ok
</button>
</div> </div>
</ModalUi> </ModalUi>
@@ -88,12 +88,20 @@ export default async function createDocumentWithTemplate(request, response) {
const updateSigners = placeholder.every(y => signers?.some(x => x.role === y.Role)); const updateSigners = placeholder.every(y => signers?.some(x => x.role === y.Role));
// console.log('isValid ', isValid); // console.log('isValid ', isValid);
if (isValid && updateSigners) { if (isValid && updateSigners) {
//Check if every item's placeholders contain at least one placeholder with type 'signature'.
let isSignature = template?.Placeholders?.every(item =>
item?.placeHolder.some(x => x?.pos.some(data => data?.type === 'signature'))
);
if (!isSignature) {
return response
.status(400)
.json({ error: 'Please add at least one signature widget for all signers' });
}
const folderPtr = { const folderPtr = {
__type: 'Pointer', __type: 'Pointer',
className: 'contracts_Document', className: 'contracts_Document',
objectId: folderId, objectId: folderId,
}; };
const template = JSON.parse(JSON.stringify(templateRes));
const object = new Parse.Object('contracts_Document'); const object = new Parse.Object('contracts_Document');
object.set('Name', template.Name); object.set('Name', template.Name);
if (template?.Note) { if (template?.Note) {
@@ -169,6 +177,7 @@ export default async function createDocumentWithTemplate(request, response) {
object.set('Signers', templateSigner); object.set('Signers', templateSigner);
} }
object.set('URL', template.URL); object.set('URL', template.URL);
object.set('SignedUrl', template.URL);
object.set('CreatedBy', template.CreatedBy); object.set('CreatedBy', template.CreatedBy);
object.set('ExtUserPtr', { object.set('ExtUserPtr', {
__type: 'Pointer', __type: 'Pointer',
@@ -88,6 +88,15 @@ export default async function createDocumentwithCoordinate(request, response) {
objectId: parseUser.userId.objectId, objectId: parseUser.userId.objectId,
}; };
if (signers && signers.length > 0) { if (signers && signers.length > 0) {
// Check if at least one signature exists among all items in the signers array
let isSignExist = signers.every(item =>
item.widgets.some(data => data?.type === 'signature')
);
if (!isSignExist) {
return response
.status(400)
.json({ error: 'Please add at least one signature widget for all signers' });
}
let fileUrl; let fileUrl;
if (request.files?.[0]) { if (request.files?.[0]) {
const base64 = fileData?.toString('base64'); const base64 = fileData?.toString('base64');
@@ -130,6 +139,7 @@ export default async function createDocumentwithCoordinate(request, response) {
object.set('SendinOrder', sendInOrder); object.set('SendinOrder', sendInOrder);
} }
object.set('URL', fileUrl); object.set('URL', fileUrl);
object.set('SignedUrl', fileUrl);
object.set('CreatedBy', userPtr); object.set('CreatedBy', userPtr);
object.set('ExtUserPtr', extUserPtr); object.set('ExtUserPtr', extUserPtr);
object.set('IsSendMail', send_email); object.set('IsSendMail', send_email);
@@ -279,7 +289,7 @@ export default async function createDocumentwithCoordinate(request, response) {
const objectId = contactMail[i].contactPtr.objectId; const objectId = contactMail[i].contactPtr.objectId;
const hostUrl = baseUrl.origin; const hostUrl = baseUrl.origin;
//encode this url value `${response.id}/${contactMail[i].email}/${objectId}` to base64 using `btoa` function //encode this url value `${response.id}/${contactMail[i].email}/${objectId}` to base64 using `btoa` function
const encodeBase64 = btoa(`${response.id}/${contactMail[i].email}/${objectId}`); const encodeBase64 = btoa(`${res.id}/${contactMail[i].email}/${objectId}`);
let signPdf = `${hostUrl}/login/${encodeBase64}`; let signPdf = `${hostUrl}/login/${encodeBase64}`;
const openSignUrl = 'https://www.opensignlabs.com/contact-us'; const openSignUrl = 'https://www.opensignlabs.com/contact-us';
const orgName = parseExtUser.Company ? parseExtUser.Company : ''; const orgName = parseExtUser.Company ? parseExtUser.Company : '';
@@ -332,7 +342,7 @@ export default async function createDocumentwithCoordinate(request, response) {
); );
} else { } else {
replaceVar = { replaceVar = {
subject: `${parseExtUser.Name} has requested you to sign "${parseExtUser.Name}"`, subject: `${parseExtUser.Name} has requested you to sign "${name}"`,
body: email_html, body: email_html,
}; };
} }
@@ -28,7 +28,7 @@ export default async function GenerateCertificate(docDetails) {
const company = docDetails?.ExtUserPtr?.Company || ''; const company = docDetails?.ExtUserPtr?.Company || '';
const createdAt = docDetails?.DocSentAt?.iso || docDetails.createdAt; const createdAt = docDetails?.DocSentAt?.iso || docDetails.createdAt;
const auditTrail = const auditTrail =
docDetails.AuditTrail?.length > 1 docDetails?.Signers?.length > 0
? docDetails.AuditTrail.map(x => { ? docDetails.AuditTrail.map(x => {
const data = docDetails.Signers.find(y => y.objectId === x.UserPtr.objectId); const data = docDetails.Signers.find(y => y.objectId === x.UserPtr.objectId);
return { return {
@@ -281,7 +281,7 @@ export default async function GenerateCertificate(docDetails) {
}); });
page.drawText('Viewed on :', { page.drawText('Viewed on :', {
x: half +55, x: half + 55,
y: yPosition2, y: yPosition2,
size: timeText, size: timeText,
font: timesRomanFont, font: timesRomanFont,