Merge branch 'staging' of https://github.com/OpenSignLabs/OpenSign into raktima-patch-2

This commit is contained in:
RaktimaNXG
2024-09-25 16:29:26 +05:30
10 changed files with 1317 additions and 1656 deletions
+996 -860
View File
File diff suppressed because it is too large Load Diff
+19 -19
View File
@@ -4,14 +4,14 @@
"private": true,
"dependencies": {
"@formkit/auto-animate": "^0.8.2",
"@lottiefiles/dotlottie-react": "^0.8.9",
"@lottiefiles/dotlottie-react": "^0.9.0",
"@pdf-lib/fontkit": "^1.1.1",
"@radix-ui/themes": "^3.1.3",
"@react-pdf/renderer": "^3.4.4",
"@react-pdf/renderer": "^4.0.0",
"@reduxjs/toolkit": "^2.2.7",
"axios": "^1.7.5",
"axios": "^1.7.7",
"file-saver": "^2.0.5",
"i18next": "^23.14.0",
"i18next": "^23.15.1",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^2.6.1",
"jszip": "^3.10.1",
@@ -26,7 +26,7 @@
"react-bootstrap": "^2.10.4",
"react-confetti": "^6.1.0",
"react-cookie": "^7.2.0",
"react-datepicker": "^7.3.0",
"react-datepicker": "^7.4.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dnd-multi-backend": "^8.0.3",
@@ -34,16 +34,16 @@
"react-dom": "^18.2.0",
"react-gtm-module": "^2.0.11",
"react-helmet": "^6.1.0",
"react-i18next": "^15.0.1",
"react-i18next": "^15.0.2",
"react-konva": "^18.2.10",
"react-pdf": "^9.1.0",
"react-quill-new": "^3.3.0",
"react-pdf": "^9.1.1",
"react-quill-new": "^3.3.2",
"react-redux": "^9.1.2",
"react-rnd": "^10.4.11",
"react-router-dom": "^6.26.1",
"react-rnd": "^10.4.13",
"react-router-dom": "^6.26.2",
"react-scripts": "5.0.1",
"react-scrollbars-custom": "^4.1.1",
"react-select": "^5.8.0",
"react-select": "^5.8.1",
"react-signature-canvas": "^1.0.6",
"react-syntax-highlighter": "^15.5.0",
"react-tooltip": "^5.28.0",
@@ -61,7 +61,7 @@
"build-webpack": "webpack --config webpack.config.js",
"build": "npm run version && npm run build-webpack && react-scripts build",
"build-watch": "webpack --config webpack.config.js --watch",
"start-dev": "concurrently \"npm run build-watch\" \"react-scripts start\"",
"start-dev": "react-scripts start",
"start": "serve -s build",
"version": "curl -s https://api.github.com/repos/opensignlabs/opensign/releases/latest | grep '\"tag_name\":' | awk -F '\"' '{print $4}' > ./public/version.txt",
"version-win": "powershell -Command \"Invoke-RestMethod -Uri 'https://api.github.com/repos/opensignlabs/opensign/releases/latest' | Select-Object -ExpandProperty tag_name | Out-File -FilePath ./public/version.txt\"",
@@ -98,25 +98,25 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@babel/runtime-corejs2": "^7.25.4",
"@babel/runtime-corejs2": "^7.25.6",
"autoprefixer": "^10.4.20",
"babel-loader": "^9.1.3",
"babel-loader": "^9.2.1",
"clean-webpack-plugin": "^4.0.0",
"commitizen": "^4.3.0",
"concurrently": "^8.2.2",
"concurrently": "^9.0.1",
"css-loader": "^7.1.2",
"daisyui": "^4.12.10",
"dotenv": "^16.4.5",
"dotenv-webpack": "^8.1.0",
"eslint": "^8.57.0",
"eslint": "^9.11.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react": "^7.36.1",
"lint-staged": "^15.2.10",
"mini-css-extract-plugin": "^2.9.1",
"postcss": "^8.4.45",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"pretty-quick": "^4.0.0",
"tailwindcss": "^3.4.10",
"tailwindcss": "^3.4.13",
"terser-webpack-plugin": "^5.3.10",
"webpack-cli": "^5.1.4"
},
@@ -9,6 +9,7 @@ import * as HoverCard from "@radix-ui/react-hover-card";
import ModalUi from "../../primitives/ModalUi";
import FolderModal from "../shared/fields/FolderModal";
import { useTranslation } from "react-i18next";
import { handleDownloadPdf } from "../../constant/Utils";
function DriveBody(props) {
const { t } = useTranslation();
@@ -100,16 +101,17 @@ function DriveBody(props) {
//function for navigate user to microapp-signature component
const checkPdfStatus = async (data) => {
const signerExist = data.Signers && data.Signers;
const isDecline = data.IsDeclined && data.IsDeclined;
const isPlaceholder = data.Placeholders && data.Placeholders;
const signedUrl = data.SignedUrl;
const signerExist = data?.Signers;
const isDecline = data?.IsDeclined;
const isPlaceholder = data?.Placeholders;
const signedUrl = data?.SignedUrl;
const isSignYourself = data?.IsSignyourself;
//checking if document has completed and request signature flow
if (data?.IsCompleted && signerExist?.length > 0) {
navigate(`/recipientSignPdf/${data.objectId}`);
}
//checking if document has completed and signyour-self flow
else if (!signerExist && !isPlaceholder) {
else if ((!signerExist && !isPlaceholder) || isSignYourself) {
navigate(`/signaturePdf/${data.objectId}`);
}
//checking if document has declined by someone
@@ -136,12 +138,10 @@ function DriveBody(props) {
}
};
const handleMenuItemClick = (selectType, data) => {
const handleMenuItemClick = async (selectType, data) => {
switch (selectType) {
case "Download": {
const pdfName = data && data.Name;
const pdfUrl = data && data.SignedUrl ? data.SignedUrl : data.URL;
saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
await handleDownloadPdf([data]);
break;
}
case "Rename": {
@@ -30,6 +30,28 @@ function EmailComponent({
const pdfName = pdfDetails[0]?.Name;
setIsLoading(true);
let sendMail;
const docId = !pdfDetails?.[0]?.IsEnableOTP
? pdfDetails?.[0]?.objectId
: "";
let presignedUrl = pdfUrl;
try {
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
const axiosRes = await axios.post(
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
{ url: pdfUrl, docId: docId },
{
headers: {
"content-type": "Application/json",
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
}
}
);
presignedUrl = axiosRes.data.result;
} catch (err) {
console.log("err in getsignedurl", err);
}
for (let i = 0; i < emailList.length; i++) {
try {
const imgPng =
@@ -47,7 +69,7 @@ function EmailComponent({
mailProvider: activeMailAdapter,
extUserId: extUserId,
pdfName: pdfName,
url: pdfUrl,
url: presignedUrl,
recipient: emailList[i],
subject: `${sender.name} has signed the doc - ${pdfName}`,
from: sender.email,
+2 -2
View File
@@ -2059,12 +2059,12 @@ export const getSignedUrl = async (pdfUrl, docId) => {
export const handleDownloadPdf = async (pdfDetails, setIsDownloading) => {
const pdfName = pdfDetails[0] && pdfDetails[0]?.Name;
const pdfUrl = pdfDetails?.[0]?.SignedUrl || pdfDetails?.[0]?.URL;
setIsDownloading("pdf");
setIsDownloading && setIsDownloading("pdf");
const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";
try {
const url = await getSignedUrl(pdfUrl, docId);
await fetchUrl(url, pdfName);
setIsDownloading("");
setIsDownloading && setIsDownloading("");
} catch (err) {
console.log("err in getsignedurl", err);
setIsDownloading("");
+9 -2
View File
@@ -296,12 +296,17 @@ const Forms = (props) => {
if (res.data) {
setFileUpload(res.data.url);
setfileload(false);
const title = generateTitleFromFilename(files?.[0]?.name);
setFormData((obj) => ({ ...obj, Name: title }));
}
} catch (err) {
e.target.value = "";
setfileload(false);
setpercentage(0);
console.log("err in libreconverter ", err);
alert(
"We are currently experiencing some issues with processing DOCX files. Please upload the PDF version or contact us on support@opensignlabs.com"
);
}
}
}
@@ -675,7 +680,9 @@ const Forms = (props) => {
)}
<div className="text-xs">
<label className="block">
{`${t("report-heading.File")} (${t("file-type")})`}
{`${t("report-heading.File")} (${t("file-type")}${
isEnableSubscription ? ", docx)" : ")"
}`}
<span className="text-red-500 text-[13px]">*</span>
</label>
{fileupload.length > 0 ? (
@@ -840,7 +847,7 @@ const Forms = (props) => {
</div>
)}
{isAdvanceOpt && (
<div className={` overflow-y-auto z-[500] transition-all`}>
<div className="overflow-y-auto z-[500] transition-all">
{props.title === "Request Signatures" && (
<div className="text-xs mt-2">
<label className="block">
@@ -1140,7 +1140,7 @@ const ReportTable = (props) => {
<Loader />
</div>
)}
<div className="p-2 w-full overflow-auto bg-base-100 text-base-content op-card shadow-lg">
<div className="p-2 w-full overflow-hidden bg-base-100 text-base-content op-card shadow-lg">
{isCelebration && (
<div className="relative z-[1000]">
<Confetti
@@ -1188,8 +1188,8 @@ const ReportTable = (props) => {
</div>
<div
className={`${
isDashboard && props.List?.length > 0 ? "h-[317px]" : "h-full"
} w-full`}
isDashboard && props.List?.length > 0 ? "min-h-[317px]" : "h-full"
} overflow-auto w-full`}
>
<table className="op-table border-collapse w-full ">
<thead className="text-[14px]">
@@ -1225,48 +1225,50 @@ const ReportTable = (props) => {
</td>
<td className="px-4 py-2 ">{item?.Email || "-"}</td>
<td className="px-4 py-2">{item?.Phone || "-"}</td>
<td className="px-3 py-2 text-white grid grid-cols-2">
{props.actions?.length > 0 &&
props.actions.map((act, index) => (
<button
key={index}
onClick={() => handleActionBtn(act, item)}
title={t(`btnLabel.${act.hoverLabel}`)}
className={`${
act?.btnColor ? act.btnColor : ""
} op-btn op-btn-sm`}
<td className="px-3 py-2">
<div className="text-base-content min-w-max flex flex-row gap-x-2 gap-y-1 justify-start items-center">
{props.actions?.length > 0 &&
props.actions.map((act, index) => (
<button
key={index}
onClick={() => handleActionBtn(act, item)}
title={t(`btnLabel.${act.hoverLabel}`)}
className={`${
act?.btnColor ? act.btnColor : ""
} op-btn op-btn-sm`}
>
<i className={act.btnIcon}></i>
</button>
))}
{isDeleteModal[item.objectId] && (
<ModalUi
isOpen
title={"Delete Contact"}
handleClose={handleClose}
>
<i className={act.btnIcon}></i>
</button>
))}
{isDeleteModal[item.objectId] && (
<ModalUi
isOpen
title={"Delete Contact"}
handleClose={handleClose}
>
<div className="m-[20px]">
<div className="text-lg font-normal text-black">
{t("contact-delete-alert")}
<div className="m-[20px]">
<div className="text-lg font-normal text-black">
{t("contact-delete-alert")}
</div>
<hr className="bg-[#ccc] mt-4 " />
<div className="flex items-center mt-3 gap-2 text-white">
<button
onClick={() => handleDelete(item)}
className="op-btn op-btn-primary"
>
{t("yes")}
</button>
<button
onClick={handleClose}
className="op-btn op-btn-secondary"
>
{t("no")}
</button>
</div>
</div>
<hr className="bg-[#ccc] mt-4 " />
<div className="flex items-center mt-3 gap-2 text-white">
<button
onClick={() => handleDelete(item)}
className="op-btn op-btn-primary"
>
{t("yes")}
</button>
<button
onClick={handleClose}
className="op-btn op-btn-secondary"
>
{t("no")}
</button>
</div>
</div>
</ModalUi>
)}
</ModalUi>
)}
</div>
</td>
</tr>
) : (
@@ -1526,7 +1528,7 @@ const ReportTable = (props) => {
</td>
)}
<td className="px-2 py-2">
<div className="text-base-content flex flex-row gap-x-2 gap-y-1 justify-start items-center">
<div className="text-base-content min-w-max flex flex-row gap-x-2 gap-y-1 justify-start items-center">
{props.actions?.length > 0 &&
props.actions.map((act, index) =>
props.ReportName === "Templates" ? (
@@ -68,28 +68,26 @@ const makeEmail = async (to, from, subject, html, url, pdfName) => {
type: 'application/pdf',
path: './exports/certificate.pdf',
};
attachments = [file, certificate];
if (fs.existsSync(certificate.path)) {
attachments = [file, certificate];
} else {
attachments = [file];
}
} catch (err) {
attachments = [file];
console.log('Err in read certificate sendmailv3', err);
}
}
const attachmentParts = attachments.map(attachment => {
if (fs.existsSync(attachment.path)) {
try {
const content = fs.readFileSync(attachment.path);
const encodedContent = content.toString('base64');
return [
`Content-Type: ${attachment.type}\n`,
'MIME-Version: 1.0\n',
`Content-Disposition: attachment; filename="${attachment.filename}"\n`,
`Content-Transfer-Encoding: base64\n\n`,
`${encodedContent}\n`,
].join('');
} catch (err) {
console.log('Err in read attachments sendmailv3', attachment.path);
}
}
const content = fs.readFileSync(attachment.path);
const encodedContent = content.toString('base64');
return [
`Content-Type: ${attachment.type}\n`,
'MIME-Version: 1.0\n',
`Content-Disposition: attachment; filename="${attachment.filename}"\n`,
`Content-Transfer-Encoding: base64\n\n`,
`${encodedContent}\n`,
].join('');
});
const attachmentBody = attachmentParts.join(`\n--${boundary}\n`);
@@ -149,6 +147,14 @@ export default async function sendMailGmailProvider(_extRes, template) {
},
});
console.log('gmail provider res: ', response?.status);
const certificatePath = './exports/certificate.pdf';
if (fs.existsSync(certificatePath)) {
try {
fs.unlinkSync(certificatePath);
} catch (err) {
console.log('Err in unlink certificate sendmailgmail provider');
}
}
return { code: 200, message: 'Email sent successfully' };
} catch (error) {
console.error('Error sending email:', error);
+184 -696
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -24,24 +24,24 @@
"@signpdf/placeholder-pdf-lib": "^3.2.4",
"@signpdf/signer-p12": "^3.2.4",
"@signpdf/signpdf": "^3.2.4",
"aws-sdk": "^2.1687.0",
"aws-sdk": "^2.1691.0",
"axios": "^1.7.7",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.21.0",
"form-data": "^4.0.0",
"generate-api-key": "^1.0.2",
"googleapis": "^140.0.1",
"googleapis": "^144.0.0",
"jsonschema": "^1.4.1",
"mailgun.js": "^10.2.3",
"mongoose": "^8.6.1",
"mongoose": "^8.6.3",
"multer": "^1.4.5-lts.1",
"multer-s3": "^3.0.1",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.15",
"parse": "^5.3.0",
"parse-dbtool": "^1.2.0",
"parse-server": "^7.2.0",
"parse-server": "^7.3.0-alpha.8",
"parse-server-api-mail-adapter": "^4.0.0",
"pdf-lib": "^1.17.1",
"posthog-node": "^4.2.0",
@@ -50,11 +50,11 @@
"type": "module",
"devDependencies": {
"@babel/eslint-parser": "^7.25.1",
"eslint": "^9.9.1",
"eslint": "^9.11.1",
"jasmine": "^5.3.0",
"mongodb-runner": "^5.6.6",
"nodemon": "^3.1.4",
"nyc": "^17.0.0",
"nodemon": "^3.1.7",
"nyc": "^17.1.0",
"prettier": "^3.3.3"
},
"overrides": {