diff --git a/.env.local_dev b/.env.local_dev index cf19e847c..807d61ec0 100644 --- a/.env.local_dev +++ b/.env.local_dev @@ -44,10 +44,16 @@ DO_REGION=us-west # local storage USE_LOCAL=FALSE -# Email mailgun config (The app will not initialize if any of these 3 variables are not set) ********************************************************************************************************************* -MAILGUN_API_KEY=XXXXX +# Email using Mailgun or SMTP if set enable config (The app will not initialize if any of these variables are not set) ********************************************************************************************************************* +MAILGUN_API_KEY= MAILGUN_DOMAIN=mail.yourdomain.com MAILGUN_SENDER=postmaster@mail.yourdomain.com +SMTP_ENABLE= +SMTP_HOST= +SMTP_PORT= +SMTP_USER_EMAIL= +SMTP_PASS= + # Base64 encoded PFX or p12 document signing certificate file ********************************************************************************************************************* PFX_BASE64='MIIKLwIBAzCCCeUGCSqGSIb3DQEHAaCCCdYEggnSMIIJzjCCBEIGCSqGSIb3DQEH diff --git a/.husky/pre-commit b/.husky/pre-commit index 1999e3518..21170d497 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" -npx eslint '**/*.{js,jsx}' -npx pretty-quick --staged '**/*.{js,jsx}' \ No newline at end of file +npm run lint-staged-changes diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 000000000..5478c3ce3 --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,3 @@ +{ + "*.js": "prettier --write" +} diff --git a/README.md b/README.md index fe1f2b8e6..7a4d986c7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -

OpenSign™

- -
+

+

-The free and open source alternative to DocuSign +[The free and open source alternative to DocuSign](https://www.opensignlabs.com) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/opensignlabs/opensign.svg)](http://isitmaintained.com/project/opensignlabs/opensign "Average time to resolve an issue") [![All Contributors](https://img.shields.io/github/all-contributors/opensignlabs/opensign?color=ee8449&style=flat-square)](#contributors) @@ -23,7 +22,7 @@ The free and open source alternative to DocuSign LinkedIn -## An open-source document e-signing solution +## The open-source document e-signing solution ---
diff --git a/apps/OpenSign/src/routes/PlanSubscriptions.js b/apps/OpenSign/src/routes/PlanSubscriptions.js index 740277932..88d9d3ed2 100644 --- a/apps/OpenSign/src/routes/PlanSubscriptions.js +++ b/apps/OpenSign/src/routes/PlanSubscriptions.js @@ -28,7 +28,7 @@ const PlanSubscriptions = () => { : ""; const phone = userDetails && userDetails.phone ? "&mobile=" + userDetails.phone : ""; - const details = "?" + name + email + company + phone; + const details = "?shipping_country_code=US&" + name + email + company + phone; useEffect(() => { if (localStorage.getItem("accesstoken")) { setIsLoader(false); diff --git a/apps/OpenSignServer/cloud/parsefunction/SendMailv1.js b/apps/OpenSignServer/cloud/parsefunction/SendMailv1.js index f7cb953ae..741ac4ec0 100644 --- a/apps/OpenSignServer/cloud/parsefunction/SendMailv1.js +++ b/apps/OpenSignServer/cloud/parsefunction/SendMailv1.js @@ -5,7 +5,7 @@ async function SendMailv1(request) { const recipient = request.params.email; const otp = request.params.otp; const res = await Parse.Cloud.sendEmail({ - from: 'Test user' + ' <' + process.env.MAILGUN_SENDER + '>', + from: 'Test user' + ' <' + process.env.SMTP_ENABLE ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER + '>', recipient: recipient, subject: 'Your OpenSign™ OTP', text: 'This email is a test.', diff --git a/apps/OpenSignServer/cloud/parsefunction/sendMail.js b/apps/OpenSignServer/cloud/parsefunction/sendMail.js index 702a3c93a..3465332c1 100644 --- a/apps/OpenSignServer/cloud/parsefunction/sendMail.js +++ b/apps/OpenSignServer/cloud/parsefunction/sendMail.js @@ -1,14 +1,29 @@ import fs from 'node:fs'; +import https from 'https'; import formData from 'form-data'; import Mailgun from 'mailgun.js'; -import https from 'https'; +import { createTransport } from 'nodemailer'; -const mailgun = new Mailgun(formData); -const mailgunClient = mailgun.client({ - username: 'api', - key: process.env.MAILGUN_API_KEY, -}); -const mailgunDomain = process.env.MAILGUN_DOMAIN; +let transporterSMTP; +let mailgunClient; + +if (process.env.SMTP_ENABLE) { + transporterSMTP = createTransport({ + host: process.env.SMTP_HOST, + port: process.env.SMTP_PORT || 465, + secure: process.env.SMTP_SECURE || true, + auth: { + user: process.env.SMTP_USER_EMAIL, + pass: process.env.SMTP_PASS, + }, + }); +} else { + const mailgun = new Mailgun(formData); + mailgunClient = mailgun.client({ + username: 'api', + key: process.env.MAILGUN_API_KEY, + }); +} async function sendmail(req) { try { @@ -38,7 +53,8 @@ async function sendmail(req) { const pdfName = req.params.pdfName && `${req.params.pdfName}.pdf`; const file = { filename: pdfName || 'exported.pdf', - data: PdfBuffer, //fs.readFileSync('./exports/exported_file_1223.pdf'), + content: process.env.SMTP_ENABLE ? PdfBuffer : undefined, //fs.readFileSync('./exports/exported_file_1223.pdf'), + data: process.env.SMTP_ENABLE ? undefined : PdfBuffer, }; // const html = "

Hello!

This is a html checking mail

" @@ -46,14 +62,60 @@ async function sendmail(req) { const from = req.params.from || ''; const messageParams = { - from: from + ' <' + process.env.MAILGUN_SENDER + '>', + from: + from + ' <' + process.env.SMTP_ENABLE + ? process.env.SMTP_USER_EMAIL + : process.env.MAILGUN_SENDER + '>', to: req.params.recipient, subject: req.params.subject, text: req.params.text || 'mail', html: req.params.html || '', - attachment: file, + attachments: process.env.SMTP_ENABLE ? [file] : undefined, + attachment: process.env.SMTP_ENABLE ? undefined : file, }; + if (transporterSMTP) { + const res = await transporterSMTP.sendMail(messageParams); + + console.log('Res ', res); + if (!res.err) { + return { + status: 'success', + }; + } + } else { + const res = await mailgunClient.messages.create(mailgunDomain, messageParams); + console.log('Res ', res); + if (res.status === 200) { + return { + status: 'success', + }; + } + } + } + } else { + const from = req.params.from || ''; + const messageParams = { + from: + from + ' <' + process.env.SMTP_ENABLE + ? process.env.SMTP_USER_EMAIL + : process.env.MAILGUN_SENDER + '>', + to: req.params.recipient, + subject: req.params.subject, + text: req.params.text || 'mail', + html: req.params.html || '', + }; + + if (transporterSMTP) { + const res = await transporterSMTP.sendMail(messageParams); + + console.log('Res ', res); + if (!res.err) { + return { + status: 'success', + }; + } + } else { const res = await mailgunClient.messages.create(mailgunDomain, messageParams); console.log('Res ', res); if (res.status === 200) { @@ -62,23 +124,6 @@ async function sendmail(req) { }; } } - } else { - const from = req.params.from || ''; - const messageParams = { - from: from + ' <' + process.env.MAILGUN_SENDER + '>', - to: req.params.recipient, - subject: req.params.subject, - text: req.params.text || 'mail', - html: req.params.html || '', - }; - - const res = await mailgunClient.messages.create(mailgunDomain, messageParams); - console.log('Res ', res); - if (res.status === 200) { - return { - status: 'success', - }; - } } } catch (err) { console.log('err ', err); diff --git a/apps/OpenSignServer/index.js b/apps/OpenSignServer/index.js index 814d9cf58..13814d3cc 100644 --- a/apps/OpenSignServer/index.js +++ b/apps/OpenSignServer/index.js @@ -17,10 +17,11 @@ import S3Adapter from 'parse-server-s3-adapter'; import FSFilesAdapter from 'parse-server-fs-adapter'; import AWS from 'aws-sdk'; import { app as customRoute } from './cloud/customRoute/customApp.js'; +import { createTransport } from 'nodemailer'; const spacesEndpoint = new AWS.Endpoint(process.env.DO_ENDPOINT); // console.log("configuration ", configuration); -if (process.env.USE_LOCAL !== "TRUE") { +if (process.env.USE_LOCAL !== 'TRUE') { const s3Options = { bucket: process.env.DO_SPACE, // globalConfig.S3FilesAdapter.bucket, baseUrl: process.env.DO_BASEURL, @@ -36,18 +37,31 @@ if (process.env.USE_LOCAL !== "TRUE") { var fsAdapter = new S3Adapter(s3Options); } else { var fsAdapter = new FSFilesAdapter({ - "filesSubDirectory": "files" // optional, defaults to ./files + filesSubDirectory: 'files', // optional, defaults to ./files }); } +let transporterMail; let mailgunClient; let mailgunDomain; -if (process.env.MAILGUN_API_KEY) { + +if (process.env.SMTP_ENABLE) { + transporterMail = createTransport({ + host: process.env.SMTP_HOST, + port: process.env.SMTP_PORT || 465, + secure: process.env.SMTP_SECURE || true, + auth: { + user: process.env.SMTP_USER_EMAIL, + pass: process.env.SMTP_PASS, + }, + }); +} else if (process.env.MAILGUN_API_KEY) { const mailgun = new Mailgun(formData); mailgunClient = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY, }); + mailgunDomain = process.env.MAILGUN_DOMAIN; } @@ -64,36 +78,39 @@ export const config = { // Your apps name. This will appear in the subject and body of the emails that are sent. appName: 'Open Sign', allowClientClassCreation: false, - emailAdapter: process.env.MAILGUN_API_KEY - ? { - module: 'parse-server-api-mail-adapter', - options: { - // The email address from which emails are sent. - sender: process.env.MAILGUN_SENDER, - // The email templates. - templates: { - // The template used by Parse Server to send an email for password - // reset; this is a reserved template name. - passwordResetEmail: { - subjectPath: './files/password_reset_email_subject.txt', - textPath: './files/password_reset_email.txt', - htmlPath: './files/password_reset_email.html', + emailAdapter: + process.env.SMTP_ENABLE || process.env.MAILGUN_API_KEY + ? { + module: 'parse-server-api-mail-adapter', + options: { + // The email address from which emails are sent. + sender: process.env.SMTP_ENABLE ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER, + // The email templates. + templates: { + // The template used by Parse Server to send an email for password + // reset; this is a reserved template name. + passwordResetEmail: { + subjectPath: './files/password_reset_email_subject.txt', + textPath: './files/password_reset_email.txt', + htmlPath: './files/password_reset_email.html', + }, + // The template used by Parse Server to send an email for email + // address verification; this is a reserved template name. + verificationEmail: { + subjectPath: './files/verification_email_subject.txt', + textPath: './files/verification_email.txt', + htmlPath: './files/verification_email.html', + }, }, - // The template used by Parse Server to send an email for email - // address verification; this is a reserved template name. - verificationEmail: { - subjectPath: './files/verification_email_subject.txt', - textPath: './files/verification_email.txt', - htmlPath: './files/verification_email.html', + apiCallback: async ({ payload, locale }) => { + if (mailgunClient) { + const mailgunPayload = ApiPayloadConverter.mailgun(payload); + await mailgunClient.messages.create(mailgunDomain, mailgunPayload); + } else if (transporterMail) await transporterMail.sendMail(payload); }, }, - apiCallback: async ({ payload, locale }) => { - const mailgunPayload = ApiPayloadConverter.mailgun(payload); - await mailgunClient.messages.create(mailgunDomain, mailgunPayload); - }, - }, - } - : null, + } + : null, filesAdapter: fsAdapter, auth: { google: { diff --git a/apps/OpenSignServer/package-lock.json b/apps/OpenSignServer/package-lock.json index aadbb80b1..f7626012e 100644 --- a/apps/OpenSignServer/package-lock.json +++ b/apps/OpenSignServer/package-lock.json @@ -18,12 +18,13 @@ "express-sse": "^0.5.3", "form-data": "^4.0.0", "jsonschema": "^1.4.1", - "mailgun.js": "^9.0.1", + "mailgun.js": "^9.3.0", "mongoose": "^7.2.1", "multer": "^1.4.5-lts.1", "multer-s3": "^2.10.0", "node-forge": "^1.3.1", "node-signpdf": "^1.5.1", + "nodemailer": "^6.9.7", "openai": "^4.8.0", "parse": "4.1.0", "parse-server": "6.3.1", @@ -6017,9 +6018,9 @@ } }, "node_modules/mailgun.js": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-9.0.1.tgz", - "integrity": "sha512-bVZ1zGh5UfQcChqIwIAil99hzoTeB3aHqAUbqmIBLMLcKfx+FF2qvhbc00WtwrFhe5dBQqQw6zPj0QBlqV4nXg==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-9.3.0.tgz", + "integrity": "sha512-iRqCglCdi+Q5anFpeRKHiytT/i34E14p/WtTE57VSeq5bATK+zQ8UnpFgPRaqGGTJqyGjqcO9m5YDRRB4/qirw==", "dependencies": { "axios": "^1.3.3", "base-64": "^1.0.0", @@ -6800,6 +6801,14 @@ "node-forge": "^1.2.1" } }, + "node_modules/nodemailer": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.7.tgz", + "integrity": "sha512-rUtR77ksqex/eZRLmQ21LKVH5nAAsVicAtAYudK7JgwenEDZ0UIQ1adUGqErz7sMkWYxWTTU1aeP2Jga6WQyJw==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/nodemon": { "version": "2.0.22", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", diff --git a/apps/OpenSignServer/package.json b/apps/OpenSignServer/package.json index 50292ad43..5049e7188 100644 --- a/apps/OpenSignServer/package.json +++ b/apps/OpenSignServer/package.json @@ -27,18 +27,19 @@ "express-sse": "^0.5.3", "form-data": "^4.0.0", "jsonschema": "^1.4.1", - "mailgun.js": "^9.0.1", + "mailgun.js": "^9.3.0", "mongoose": "^7.2.1", "multer": "^1.4.5-lts.1", "multer-s3": "^2.10.0", "node-forge": "^1.3.1", "node-signpdf": "^1.5.1", + "nodemailer": "^6.9.7", "openai": "^4.8.0", "parse": "4.1.0", "parse-server": "6.3.1", "parse-server-api-mail-adapter": "^3.0.0", - "parse-server-s3-adapter": "^1.2.0", "parse-server-fs-adapter": "1.0.1", + "parse-server-s3-adapter": "^1.2.0", "pdf-lib": "^1.16.0", "pdfkit": "^0.13.0", "razorpay": "^2.8.6", diff --git a/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js b/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js index 5df07d5f5..37eee4fc3 100644 --- a/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js +++ b/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js @@ -1,7 +1,15 @@ import React, { useEffect, useState } from "react"; import "./certificate.css"; +import opensignLogo from "../../assests/open-sign-logo.png"; -import { Page, Text, View, Document, StyleSheet } from "@react-pdf/renderer"; +import { + Page, + Text, + View, + Document, + StyleSheet, + Image +} from "@react-pdf/renderer"; function Certificate({ pdfData }) { const [isMultiSigners, setIsMultiSigners] = useState(); @@ -49,70 +57,34 @@ function Certificate({ pdfData }) { fontSize: "11px", marginBottom: "10px", color: "gray" + }, + image: { + width: "71px", + height: "17px" } }); const generatedDate = () => { const newDate = new Date(); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); - - var currentOffset = newDate.getTimezoneOffset(); - - var ISTOffset = 330; // IST offset UTC +5:30 - - var ISTTime = new Date( - newDate.getTime() + (ISTOffset + currentOffset) * 60000 - ); - - // ISTTime now represents the time in IST coordinates - - var hoursIST = ISTTime.getHours(); - var minutesIST = ISTTime.getMinutes(); + const utcTime = newDate.toUTCString(); return ( - Generated On {localExpireDate} {hoursIST}:{minutesIST} IST + Generated On {utcTime} ); }; const changeCompletedDate = () => { const completedOn = pdfData[0].updatedAt; const newDate = new Date(completedOn); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); + const utcTime = newDate.toUTCString(); - var currentOffset = newDate.getTimezoneOffset(); - - var ISTOffset = 330; // IST offset UTC +5:30 - - var ISTTime = new Date( - newDate.getTime() + (ISTOffset + currentOffset) * 60000 - ); - - // ISTTime now represents the time in IST coordinates - - var hoursIST = ISTTime.getHours(); - var minutesIST = ISTTime.getMinutes(); - - return ( - - {localExpireDate} {hoursIST}:{minutesIST} IST - - ); + return {utcTime}; }; const signerName = (data) => { @@ -143,7 +115,19 @@ function Certificate({ pdfData }) { {/** Page defines a single page of content. */} - {generatedDate()} + + + {generatedDate()} + + Organization :   - __ + + {pdfData[0].ExtUserPtr.Company} + Completed on :  {changeCompletedDate()} diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js index 6d2d33061..d741162d5 100644 --- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js +++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js @@ -192,7 +192,6 @@ function PdfRequestFiles() { //check document is signed or not if (checkDocIdExist && checkDocIdExist.length > 0) { - setAlreadySign(true); setIsDocId(true); const signerRes = res[0].Signers; //comparison auditTrail user details with signers user details diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js index d4cb37df9..6591667bc 100644 --- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js +++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js @@ -627,8 +627,8 @@ function SignYourSelf() { const bottomY = xyPosData.isDrag ? xyPosData.yBottom * scale - height : xyPosData.firstYPos - ? xyPosData.yBottom * scale - height + xyPosData.firstYPos - : xyPosData.yBottom * scale - height; + ? xyPosData.yBottom * scale - height + xyPosData.firstYPos + : xyPosData.yBottom * scale - height; singleSign = { pdfFile: pdfBase64Url, @@ -664,15 +664,7 @@ function SignYourSelf() { // console.log("json ", json); setPdfUrl(json.result.data); if (json.result.data) { - const docStatus = { - isCompleted: true - }; - - setDocumentStatus(docStatus); - const loadObj = { - isLoad: false - }; - setIsLoading(loadObj); + getDocumentDetails(); } }) .catch((err) => { diff --git a/microfrontends/SignDocuments/src/Component/component/header.js b/microfrontends/SignDocuments/src/Component/component/header.js index c68ad4ada..d7f4724ed 100644 --- a/microfrontends/SignDocuments/src/Component/component/header.js +++ b/microfrontends/SignDocuments/src/Component/component/header.js @@ -27,13 +27,13 @@ function Header({ signersdata, isMailSend, alertSendEmail, - isSigned, isCompleted, isShowHeader, decline, currentSigner, dataTut4, - alreadySign + alreadySign, + isSignYourself }) { const isMobile = window.innerWidth < 767; const navigate = useNavigate(); @@ -61,12 +61,19 @@ function Header({ const pdf = await getBase64FromUrl(pdfUrl); const isAndroidDevice = navigator.userAgent.match(/Android/i); - const isAppleDevice = (/iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream + const isAppleDevice = + (/iPad|iPhone|iPod/.test(navigator.platform) || + (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1)) && + !window.MSStream; if (isAndroidDevice || isAppleDevice) { - const byteArray = Uint8Array.from(atob(pdf).split('').map(char => char.charCodeAt(0))); - const blob = new Blob([byteArray], { type: 'application/pdf' }); + const byteArray = Uint8Array.from( + atob(pdf) + .split("") + .map((char) => char.charCodeAt(0)) + ); + const blob = new Blob([byteArray], { type: "application/pdf" }); const blobUrl = URL.createObjectURL(blob); - window.open(blobUrl, '_blank'); + window.open(blobUrl, "_blank"); } else { printModule({ printable: pdf, type: "pdf", base64: true }); } @@ -75,19 +82,148 @@ function Header({ //handle download signed pdf const handleDownloadPdf = () => { const pdfName = pdfDetails[0] && pdfDetails[0].Name; - saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); }; const sanitizeFileName = (pdfName) => { // Replace spaces with underscore - return pdfName.replace(/ /g, '_'); - } - + return pdfName.replace(/ /g, "_"); + }; + //certificate generate and download component in mobile view + const CertificateDropDown = () => { + //after generate download certifcate pdf + const handleDownload = (pdfBlob, fileName) => { + if (pdfBlob) { + const url = window.URL.createObjectURL(pdfBlob); + // Create a temporary anchor element + const link = document.createElement("a"); + link.href = url; + link.download = fileName; + // Append the anchor to the body + document.body.appendChild(link); + // Programmatically click the anchor to trigger the download + link.click(); + // Remove the anchor from the body + document.body.removeChild(link); + // Release the object URL to free up resources + window.URL.revokeObjectURL(url); + } + }; + return ( + e.preventDefault()} + style={{ textDecoration: "none", zIndex: "35" }} + document={} + > + {({ blob, url, loading, error }) => ( + <> + {loading ? ( +
+ + Certificate +
+ ) : ( +
+ handleDownload( + blob, + `completion certificate-${ + pdfDetails[0] && pdfDetails[0].Name + }.pdf` + ) + } + > + + Certificate +
+ )} + + )} +
+ ); + }; + const CertificateComponent = () => { + return ( + } + fileName={`completion certificate-${ + pdfDetails[0] && pdfDetails[0].Name + }.pdf`} + > + {({ blob, url, loading, error }) => + loading ? ( + + ) : ( + + ) + } + + ); + }; return (
{isMobile && isShowHeader ? ( @@ -95,7 +231,9 @@ function Header({ id="navbar" className={isGuestSigner ? "stickySignerHead" : "stickyHead"} style={{ - width: isGuestSigner ? window.innerWidth : window.innerWidth - 30 + "px" + width: isGuestSigner + ? window.innerWidth + : window.innerWidth - 30 + "px" }} >
@@ -140,16 +278,16 @@ function Header({ style={{ color: "gray", cursor: "pointer" }} >
- {pdfUrl ? ( + {pdfUrl && alreadySign ? (
handleDownloadPdf()} style={{ color: themeColor(), border: "none", fontWeight: "650", - fontSize: "16px" + fontSize: "16px", + padding: "0px 3px 0px 5px" }} > @@ -179,51 +317,48 @@ function Header({ Download
- - } - fileName={`completion certificate-${ - pdfDetails[0] && pdfDetails[0].Name - }.pdf`} + {recipient && pdfDetails[0] && pdfDetails.length > 0 ? ( + + + + ) : isPdfRequestFiles && + alreadySign && + isCompleted.isCertificate ? ( + + + + ) : ( + isSignYourself && ( + + + + ) + )} + +
- {({ blob, url, loading, error }) => ( - <> - {console.log("error", error)} - {loading ? ( - "Loading document..." - ) : ( - - )} - - )} - + {" "} + + Print +
) : (
- {/* current signer is checking user send request and check status of pdf sign than if current + {/* current signer is checking user send request and check status of pdf sign than if current user exist than show finish button else no */} {currentSigner && ( @@ -267,6 +402,8 @@ function Header({ onClick={() => { if (!pdfUrl) { embedImages(); + } else if (isPdfRequestFiles) { + embedImages(); } }} style={{ @@ -297,40 +434,7 @@ function Header({ pdfUrl || isAlreadySign.mssg ? (
{pdfDetails[0] && pdfDetails.length > 0 && ( - } - fileName={`completion certificate-${ - pdfDetails[0] && pdfDetails[0].Name - }.pdf`} - > - {({ blob, url, loading, error }) => - loading ? ( - "Loading document..." - ) : ( - - ) - } - + )} - ) - } - - )} + {isCompleted.isCertificate && } - ) - } - +