mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-06 17:57:39 +02:00
+27
-9
@@ -17,15 +17,6 @@
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "nxglabs",
|
||||
"name": "Amol",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5486116?v=4",
|
||||
"profile": "https://github.com/nxglabs",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "BuilderPrid",
|
||||
"name": "Priyanshu Dwivedi",
|
||||
@@ -133,6 +124,33 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "AndreyCurious",
|
||||
"name": "Andrey Didenko",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/105622604?v=4",
|
||||
"profile": "https://github.com/AndreyCurious",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "VishakhaSainani",
|
||||
"name": "VishakhaSainani",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/113436770?v=4",
|
||||
"profile": "https://github.com/VishakhaSainani",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "andrew-opensignlabs",
|
||||
"name": "Andrew",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/148278535?v=4",
|
||||
"profile": "https://github.com/andrew-opensignlabs",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,9 +19,9 @@ Below are the steps to follow -
|
||||
```
|
||||
git clone https://github.com/OpenSignLabs/OpenSign.git
|
||||
```
|
||||
- Rename the .env.frontend_dev file to .env using below command
|
||||
- Copy the .env.frontend_dev file to apps/OpenSign/.env using below command(on mac & linux). For windows use COPY command instead.
|
||||
```
|
||||
mv .env.frontend_dev .env
|
||||
cp .env.frontend_dev apps/OpenSign/.env
|
||||
```
|
||||
- CD to /apps/OpenSign directory
|
||||
- Install NPM packages using
|
||||
@@ -32,7 +32,7 @@ Below are the steps to follow -
|
||||
```
|
||||
npm run start
|
||||
```
|
||||
You should be able to access the application from https://localhost:3000 after this.
|
||||
You should be able to access the application from http://localhost:3000 after this.
|
||||
Create an account by signing-up and start contributing.
|
||||
|
||||
|
||||
|
||||
@@ -107,21 +107,25 @@ We would like to thank all our contributors and users for their support and feed
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://aleksandarjakovljevic.com/"><img src="https://avatars.githubusercontent.com/u/2115393?v=4?s=100" width="100px;" alt="Aleksandar Jakovljevic"/><br /><sub><b>Aleksandar Jakovljevic</b></sub></a><br /><a href="#code-ajakov" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nxglabs"><img src="https://avatars.githubusercontent.com/u/5486116?v=4?s=100" width="100px;" alt="Amol"/><br /><sub><b>Amol</b></sub></a><br /><a href="#code-nxglabs" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/BuilderPrid"><img src="https://avatars.githubusercontent.com/u/106882895?v=4?s=100" width="100px;" alt="Priyanshu Dwivedi"/><br /><sub><b>Priyanshu Dwivedi</b></sub></a><br /><a href="#code-BuilderPrid" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Tashuuuu"><img src="https://avatars.githubusercontent.com/u/85075827?v=4?s=100" width="100px;" alt="Akriti Sengar"/><br /><sub><b>Akriti Sengar</b></sub></a><br /><a href="#code-Tashuuuu" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/parthrc"><img src="https://avatars.githubusercontent.com/u/101104958?v=4?s=100" width="100px;" alt="Parth Chawande"/><br /><sub><b>Parth Chawande</b></sub></a><br /><a href="#code-parthrc" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Rishabh-git10"><img src="https://avatars.githubusercontent.com/u/107680241?v=4?s=100" width="100px;" alt="Rishabh Dewangan"/><br /><sub><b>Rishabh Dewangan</b></sub></a><br /><a href="#code-Rishabh-git10" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LemonDrop847"><img src="https://avatars.githubusercontent.com/u/106615670?v=4?s=100" width="100px;" alt="Nitin Mishra"/><br /><sub><b>Nitin Mishra</b></sub></a><br /><a href="#code-LemonDrop847" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="http://jobinselvanose.com"><img src="https://avatars.githubusercontent.com/u/63976083?v=4?s=100" width="100px;" alt="Jobin Selvanose"/><br /><sub><b>Jobin Selvanose</b></sub></a><br /><a href="#doc-Jobin-S" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="http://jobinselvanose.com"><img src="https://avatars.githubusercontent.com/u/63976083?v=4?s=100" width="100px;" alt="Jobin Selvanose"/><br /><sub><b>Jobin Selvanose</b></sub></a><br /><a href="#doc-Jobin-S" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HansF"><img src="https://avatars.githubusercontent.com/u/1503?v=4?s=100" width="100px;" alt="Hans Fraiponts"/><br /><sub><b>Hans Fraiponts</b></sub></a><br /><a href="#doc-HansF" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="http://linktr.ee/monilprajapati"><img src="https://avatars.githubusercontent.com/u/99136041?v=4?s=100" width="100px;" alt="Monil Prajapati"/><br /><sub><b>Monil Prajapati</b></sub></a><br /><a href="#code-Monilprajapati" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://emm-dev0.github.io/portfolio/"><img src="https://avatars.githubusercontent.com/u/97445413?v=4?s=100" width="100px;" alt="Edogbanya Emmanuel"/><br /><sub><b>Edogbanya Emmanuel</b></sub></a><br /><a href="#bug-Emm-dev0" title="Bug reports">🐛</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pranav514"><img src="https://avatars.githubusercontent.com/u/76992202?v=4?s=100" width="100px;" alt="pranav514"/><br /><sub><b>pranav514</b></sub></a><br /><a href="#code-pranav514" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/arianxq"><img src="https://avatars.githubusercontent.com/u/122199576?v=4?s=100" width="100px;" alt="Aria"/><br /><sub><b>Aria</b></sub></a><br /><a href="#code-arianxq" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/SoumyadiptoPal"><img src="https://avatars.githubusercontent.com/u/119007659?v=4?s=100" width="100px;" alt="Soumyadipto Pal"/><br /><sub><b>Soumyadipto Pal</b></sub></a><br /><a href="#code-SoumyadiptoPal" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AndreyCurious"><img src="https://avatars.githubusercontent.com/u/105622604?v=4?s=100" width="100px;" alt="Andrey Didenko"/><br /><sub><b>Andrey Didenko</b></sub></a><br /><a href="#code-AndreyCurious" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VishakhaSainani"><img src="https://avatars.githubusercontent.com/u/113436770?v=4?s=100" width="100px;" alt="VishakhaSainani"/><br /><sub><b>VishakhaSainani</b></sub></a><br /><a href="#code-VishakhaSainani" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andrew-opensignlabs"><img src="https://avatars.githubusercontent.com/u/148278535?v=4?s=100" width="100px;" alt="Andrew"/><br /><sub><b>Andrew</b></sub></a><br /><a href="#code-andrew-opensignlabs" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
|
||||
import Package from "../../package.json";
|
||||
|
||||
const Footer = () => {
|
||||
let footer = localStorage.getItem("_appName");
|
||||
const [showButton, setShowButton] = useState(false);
|
||||
const handleScroll = () => {
|
||||
if (window.pageYOffset >= 50) {
|
||||
@@ -24,11 +23,14 @@ const Footer = () => {
|
||||
window.removeEventListener("scroll", handleScroll);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const appName = "OpenSign™";
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="bg-[#222c3c] text-[#98a6ba] text-center text-[13px] py-3">
|
||||
All Rights Reserved © {new Date().getFullYear()}
|
||||
{footer && `${footer.charAt(0).toUpperCase()}${footer.slice(1)}`}{" "}
|
||||
{appName}{" "}
|
||||
(version:{" "}
|
||||
{localStorage.getItem("appVersion") &&
|
||||
`${Package.version}.${localStorage.getItem("appVersion")}`}
|
||||
|
||||
@@ -375,11 +375,11 @@ const TreeEditForm = (props) => {
|
||||
>
|
||||
<div>
|
||||
{active ? (
|
||||
<button className="btn btn-info pull-right" type="submit">
|
||||
<button className="bg-[#1ab6ce] px-3 py-2 rounded text-white text-sm" type="submit">
|
||||
Update
|
||||
</button>
|
||||
) : (
|
||||
<button className="btn btn-info" type="submit" disabled>
|
||||
<button className="bg-[#1ab6ce] px-3 py-2 rounded text-white text-sm" type="submit" disabled>
|
||||
Update
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -522,18 +522,19 @@ const TreeWidget = (props) => {
|
||||
}, [defaultState]);
|
||||
const customStyles = {
|
||||
content: {
|
||||
top: "40%",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
right: "20%",
|
||||
bottom: "20%",
|
||||
right: "auto",
|
||||
bottom: "auto",
|
||||
marginRight: "-50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
zIndex: "50",
|
||||
backgroundColor: "white",
|
||||
padding: "0px",
|
||||
maxWidth: "100%", // Set a maximum width for the modal
|
||||
maxHeight: "100vh",
|
||||
height: "300px"
|
||||
padding: 0
|
||||
},
|
||||
overlay: {
|
||||
width:"100%",
|
||||
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
||||
zIndex: 50
|
||||
}
|
||||
};
|
||||
|
||||
@@ -560,7 +561,7 @@ const TreeWidget = (props) => {
|
||||
>
|
||||
<div style={{ width: "20%" }}>
|
||||
<div
|
||||
className=" pull-left"
|
||||
className="pull-left"
|
||||
title="Select Folder"
|
||||
style={{
|
||||
color: "#33bbff",
|
||||
@@ -618,10 +619,11 @@ const TreeWidget = (props) => {
|
||||
<Modal
|
||||
isOpen={isShowModal}
|
||||
onRequestClose={() => setIsShowModal(false)}
|
||||
shouldCloseOnOverlayClick={false}
|
||||
contentLabel="Modal"
|
||||
style={customStyles}
|
||||
>
|
||||
<div>
|
||||
<div className="w-full min-w-[300px] md:min-w-[500px]">
|
||||
{/* header */}
|
||||
<div
|
||||
style={{
|
||||
@@ -636,7 +638,7 @@ const TreeWidget = (props) => {
|
||||
</div>
|
||||
<div style={{ padding: "10px" }}>
|
||||
<button
|
||||
className=" btn btn-sm pull-right"
|
||||
className="btn btn-sm pull-right"
|
||||
data-dismiss="modal"
|
||||
title="Select Folder"
|
||||
style={{
|
||||
@@ -662,10 +664,9 @@ const TreeWidget = (props) => {
|
||||
</div>
|
||||
<hr />
|
||||
{/* body */}
|
||||
<div className="pt-3 pb-3 pl-6 pr-6 space-y-6">
|
||||
<div className="p-3 space-y-6">
|
||||
<div
|
||||
style={{
|
||||
height: "40px",
|
||||
color: "#ac4848",
|
||||
cursor: "pointer",
|
||||
fontSize: "14px",
|
||||
@@ -755,7 +756,6 @@ const TreeWidget = (props) => {
|
||||
border: "1px solid gray",
|
||||
borderRadius: "1px",
|
||||
marginTop: "8px",
|
||||
marginRight: "8px",
|
||||
transition: "all 0.75s ease",
|
||||
WebkitTransition: "all 0.5s ease",
|
||||
MozTransition: "all 0.5s ease",
|
||||
@@ -826,7 +826,7 @@ const TreeWidget = (props) => {
|
||||
</div>
|
||||
{/* footer */}
|
||||
|
||||
<div className="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600 justify-between">
|
||||
<div className="flex items-center p-3 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600 justify-between">
|
||||
<button
|
||||
className="btn btn-sm float-left createFolder"
|
||||
title="Create New Folder"
|
||||
|
||||
@@ -19,6 +19,7 @@ function arrayMove(array, from, to) {
|
||||
*/
|
||||
|
||||
const MultiSelectField = (props) => {
|
||||
Modal.setAppElement("body");
|
||||
const [parseBaseUrl] = useState(localStorage.getItem("baseUrl"));
|
||||
const [parseAppId] = useState(localStorage.getItem("parseAppId"));
|
||||
const [state, setState] = useState(undefined);
|
||||
@@ -647,41 +648,51 @@ const MultiSelectField = (props) => {
|
||||
<Modal
|
||||
isOpen={modalIsOpen}
|
||||
onRequestClose={handleModalCloseClick}
|
||||
shouldCloseOnOverlayClick={false}
|
||||
contentLabel="Modal"
|
||||
style={{
|
||||
content: {
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
right: "auto",
|
||||
bottom: "auto",
|
||||
transform: "translate(-50%, -50%)",
|
||||
padding: 0
|
||||
},
|
||||
overlay: {
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
backgroundColor: "rgba(255, 255, 255, 0.75)",
|
||||
width: "100%",
|
||||
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
||||
zIndex: 50
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div
|
||||
type="button"
|
||||
style={{ display: "flex", justifyContent: "space-between" }}
|
||||
>
|
||||
<div style={{ color: "transparent", width: "100%" }}>.</div>
|
||||
<button onClick={handleModalCloseClick}>
|
||||
<i
|
||||
style={{ fontSize: 25 }}
|
||||
className="fa fa-times-circle"
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
</button>
|
||||
<div className="min-w-full md:min-w-[500px]">
|
||||
<div
|
||||
type="button"
|
||||
className="flex justify-between items-center p-3 border-b-[1px] border-gray-300"
|
||||
>
|
||||
<div className=" text-black text-xl font-semibold pl-3">
|
||||
Add Signer
|
||||
</div>
|
||||
<button onClick={handleModalCloseClick}>
|
||||
<i
|
||||
style={{ fontSize: 25 }}
|
||||
className="fa fa-times-circle"
|
||||
aria-hidden="true"
|
||||
></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{isModal && (
|
||||
<AppendFormInForm
|
||||
id={props.schema.data.quickAddFormId}
|
||||
valueKey={props.schema.data.valueKey}
|
||||
displayKey={props.schema.data.displayKey}
|
||||
details={handleNewDetails}
|
||||
closePopup={handleModalCloseClick}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{isModal && (
|
||||
<AppendFormInForm
|
||||
id={props.schema.data.quickAddFormId}
|
||||
valueKey={props.schema.data.valueKey}
|
||||
displayKey={props.schema.data.displayKey}
|
||||
details={handleNewDetails}
|
||||
closePopup={handleModalCloseClick}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import Parse from "parse";
|
||||
export const formJson = (id) => {
|
||||
let formData;
|
||||
//json form for signYourself
|
||||
@@ -104,6 +105,12 @@ export const formJson = (id) => {
|
||||
}
|
||||
//json form for request signature
|
||||
else if (id === "8mZzFxbG1z") {
|
||||
const user = Parse.User.current();
|
||||
const userPtr = JSON.stringify({
|
||||
__type: "Pointer",
|
||||
className: "_User",
|
||||
objectId: user.id
|
||||
});
|
||||
formData = {
|
||||
jsonSchema: {
|
||||
title: "New Document",
|
||||
@@ -140,7 +147,7 @@ export const formJson = (id) => {
|
||||
class: "contracts_Contactbook",
|
||||
displayKey: "Name",
|
||||
valueKey: "objectId",
|
||||
query: "keys=Name",
|
||||
query: `where={"CreatedBy":${userPtr}}&keys=Name`,
|
||||
isPointer: true,
|
||||
helpbody: "",
|
||||
helplink: "",
|
||||
@@ -575,3 +582,4 @@ export const formJson = (id) => {
|
||||
return formData;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function reportJson(id) {
|
||||
textColor: "white",
|
||||
btnIcon: "fa fa-plus",
|
||||
redirectUrl:
|
||||
"remoteUrl=aHR0cDovL2xvY2FsaG9zdDozMDAwL21mYnVpbGQvcmVtb3RlRW50cnkuanM=&moduleToLoad=AppRoutes&remoteName=signmicroapp/draftDocument"
|
||||
"remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9TaWduLU1pY3JvYXBwVjIvcmVtb3RlRW50cnkuanM=&moduleToLoad=AppRoutes&remoteName=signmicroapp/draftDocument"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -16,9 +16,25 @@ const ReportTable = ({ ReportName, List, actions }) => {
|
||||
};
|
||||
const handlemicroapp = (item, url) => {
|
||||
localStorage.removeItem("rowlevel");
|
||||
// const params = new URLSearchParams(url);
|
||||
// let arr = [];
|
||||
// for (let [key, value] of params.entries()) {
|
||||
// if (key === "remoteUrl") {
|
||||
// arr.push(
|
||||
// `${key}=${window.btoa(
|
||||
// window.location.origin + "/mfbuild/remoteEntry.js"
|
||||
// )}`
|
||||
// );
|
||||
// } else {
|
||||
// arr.push(`${key}=${value}`);
|
||||
// }
|
||||
// }
|
||||
// const remoteUrl = arr.join("&");
|
||||
// console.log("arr", remoteUrl);
|
||||
|
||||
navigate("/rpmf/" + url);
|
||||
localStorage.setItem("rowlevel", JSON.stringify(item));
|
||||
// localStorage.setItem("rowlevelMicro")
|
||||
// localStorage.setItem("rowlevelMicro");
|
||||
};
|
||||
const handlebtn = () => {
|
||||
console.log("clicked");
|
||||
|
||||
+208
-190
@@ -1,204 +1,222 @@
|
||||
import SignPDF from "./SignPDF.min.cjs";
|
||||
import fs from "node:fs";
|
||||
import axios from "axios";
|
||||
import FormData from "form-data";
|
||||
import plainplaceholder from "./customSignPdf/plainplaceholder.min.js";
|
||||
import {
|
||||
plainAddPlaceholder
|
||||
} from "node-signpdf/dist/helpers/index.js";
|
||||
import SignPDF from './SignPDF.min.cjs';
|
||||
import fs from 'node:fs';
|
||||
import axios from 'axios';
|
||||
import FormData from 'form-data';
|
||||
import plainplaceholder from './customSignPdf/plainplaceholder.min.js';
|
||||
import { plainAddPlaceholder } from 'node-signpdf/dist/helpers/index.js';
|
||||
const serverUrl = process.env.SERVER_URL,
|
||||
APPID = process.env.APP_ID,
|
||||
masterKEY = process.env.MASTER_KEY;
|
||||
APPID = process.env.APP_ID,
|
||||
masterKEY = process.env.MASTER_KEY;
|
||||
async function uploadFile(a) {
|
||||
try {
|
||||
var e = new FormData,
|
||||
t = (e.append("file", fs.createReadStream(a)), {
|
||||
"content-type": "multipart/form-data",
|
||||
"X-Parse-Application-Id": process.env.APP_ID
|
||||
}),
|
||||
s = process.env.SERVER_URL.slice(0, -4) + "/file_upload";
|
||||
return (await axios.post(s, e, {
|
||||
headers: t
|
||||
})).data
|
||||
} catch (e) {
|
||||
console.log("err ", e), fs.unlinkSync(a)
|
||||
}
|
||||
try {
|
||||
var e = new FormData(),
|
||||
t =
|
||||
(e.append('file', fs.createReadStream(a)),
|
||||
{ 'content-type': 'multipart/form-data', 'X-Parse-Application-Id': process.env.APP_ID }),
|
||||
s = process.env.SERVER_URL.slice(0, -4) + '/file_upload';
|
||||
return (await axios.post(s, e, { headers: t })).data;
|
||||
} catch (e) {
|
||||
console.log('err ', e), fs.unlinkSync(a);
|
||||
}
|
||||
}
|
||||
async function updateDoc(t, s, i, r, n, o) {
|
||||
try {
|
||||
var d = {
|
||||
UserPtr: {
|
||||
__type: "Pointer",
|
||||
className: o,
|
||||
objectId: i
|
||||
},
|
||||
SignedUrl: s,
|
||||
Activity: "Signed",
|
||||
ipAddress: r
|
||||
};
|
||||
let e;
|
||||
var l = (e = n.AuditTrail && 0 < n.AuditTrail.length ? [...n.AuditTrail, d] : [d]).filter(e => "Signed" === e.Activity);
|
||||
let a = !1;
|
||||
!(n.Signers && 0 < n.Signers.length && l.length !== n.Signers.length || !(a = !0));
|
||||
var p = {
|
||||
SignedUrl: s,
|
||||
AuditTrail: e,
|
||||
IsCompleted: a
|
||||
};
|
||||
await axios.put(serverUrl + "/classes/contracts_Document/" + t, p, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Master-Key": masterKEY
|
||||
}
|
||||
});
|
||||
return {
|
||||
isCompleted: a,
|
||||
message: "success"
|
||||
}
|
||||
} catch (e) {
|
||||
return console.log("update doc err ", e), "err"
|
||||
}
|
||||
async function updateDoc(t, s, r, i, o, n) {
|
||||
try {
|
||||
var d = {
|
||||
UserPtr: { __type: 'Pointer', className: n, objectId: r },
|
||||
SignedUrl: s,
|
||||
Activity: 'Signed',
|
||||
ipAddress: i,
|
||||
};
|
||||
let e;
|
||||
var l = (e = o.AuditTrail && 0 < o.AuditTrail.length ? [...o.AuditTrail, d] : [d]).filter(
|
||||
e => 'Signed' === e.Activity
|
||||
);
|
||||
let a = !1;
|
||||
!((o.Signers && 0 < o.Signers.length && l.length !== o.Signers.length) || !(a = !0));
|
||||
var p = { SignedUrl: s, AuditTrail: e, IsCompleted: a };
|
||||
await axios.put(serverUrl + '/classes/contracts_Document/' + t, p, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Master-Key': masterKEY,
|
||||
},
|
||||
});
|
||||
return { isCompleted: a, message: 'success' };
|
||||
} catch (e) {
|
||||
return console.log('update doc err ', e), 'err';
|
||||
}
|
||||
}
|
||||
async function sendMail(e) {
|
||||
var a = e.url,
|
||||
t = e.sender,
|
||||
s = e.pdfName,
|
||||
a = {
|
||||
url: a,
|
||||
from: "OpenSign™",
|
||||
recipient: e.receiver,
|
||||
subject: "You have signed the doc - " + s,
|
||||
pdfName: s,
|
||||
html: "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body> <div style='background-color:#f5f5f5;padding:20px'> <div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'> <div><img src=https://qikinnovation.ams3.digitaloceanspaces.com/logo.png height='50' style='padding:20px'/> </div><div style='padding:2px;font-family:system-ui; background-color: #47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',> Document Copy</p></div><div><p style='padding:20px;font-family:system-ui;font-size:14px'>A copy of the document " + s + " Standard is attached to this email. Kindly download the document from the attachment.</p></div> </div><div><p>This is an automated email from Open Sign. For any queries regarding this email, please contact the sender " + t.Mail + " directly. If you think this email is inappropriate or spam, you may file a complaint with Open Sign here.</p></div></div></body></html>"
|
||||
};
|
||||
await axios.post(serverUrl + "/functions/sendmailv3", a, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Master-Key": masterKEY
|
||||
}
|
||||
})
|
||||
var a = e.url,
|
||||
t = e.sender,
|
||||
s = e.pdfName,
|
||||
a = {
|
||||
url: a,
|
||||
from: 'OpenSign™',
|
||||
recipient: e.receiver,
|
||||
subject: 'You have signed the doc - ' + s,
|
||||
pdfName: s,
|
||||
html:
|
||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body> <div style='background-color:#f5f5f5;padding:20px'> <div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'> <div><img src=https://qikinnovation.ams3.digitaloceanspaces.com/logo.png height='50' style='padding:20px'/> </div><div style='padding:2px;font-family:system-ui; background-color: #47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',> Document Copy</p></div><div><p style='padding:20px;font-family:system-ui;font-size:14px'>A copy of the document " +
|
||||
s +
|
||||
' Standard is attached to this email. Kindly download the document from the attachment.</p></div> </div><div><p>This is an automated email from Open Sign. For any queries regarding this email, please contact the sender ' +
|
||||
t.Mail +
|
||||
' directly. If you think this email is inappropriate or spam, you may file a complaint with Open Sign here.</p></div></div></body></html>',
|
||||
};
|
||||
await axios.post(serverUrl + '/functions/sendmailv3', a, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Master-Key': masterKEY,
|
||||
},
|
||||
});
|
||||
}
|
||||
async function sendCompletedMail(e) {
|
||||
var a = e.url,
|
||||
t = e.sender,
|
||||
s = e.pdfName,
|
||||
a = {
|
||||
url: a,
|
||||
from: "Open sign",
|
||||
recipient: e.receiver,
|
||||
subject: `Document ${s} has been signed by all parties`,
|
||||
pdfName: s,
|
||||
html: "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body> <div style='background-color:#f5f5f5;padding:20px'> <div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'> <div><img src=https://qikinnovation.ams3.digitaloceanspaces.com/logo.png height='50' style='padding:20px'/> </div><div style='padding:2px;font-family:system-ui; background-color: #47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',> Document signed successfully</p></div><div><p style='padding:20px;font-family:system-ui;font-size:14px'>All parties have successfully signed the document <strong>" + s + ".</strong> Kindly download the document from the attachment.</p></div> </div><div><p>This is an automated email from Open Sign. For any queries regarding this email, please contact the sender " + t.Mail + " directly. If you think this email is inappropriate or spam, you may file a complaint with Open Sign here.</p></div></div></body></html>"
|
||||
};
|
||||
await axios.post(serverUrl + "/functions/sendmailv3", a, {
|
||||
var a = e.url,
|
||||
t = e.sender,
|
||||
s = e.pdfName,
|
||||
a = {
|
||||
url: a,
|
||||
from: 'OpenSign™',
|
||||
recipient: e.receiver,
|
||||
subject: `Document ${s} has beeen signed by all parties`,
|
||||
pdfName: s,
|
||||
html:
|
||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body> <div style='background-color:#f5f5f5;padding:20px'> <div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'> <div><img src=https://qikinnovation.ams3.digitaloceanspaces.com/logo.png height='50' style='padding:20px'/> </div><div style='padding:2px;font-family:system-ui; background-color: #47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',> Document sign successfully</p></div><div><p style='padding:20px;font-family:system-ui;font-size:14px'>All parties have successfully signed the document" +
|
||||
s +
|
||||
'. Kindly download the document from the attachment.</p></div> </div><div><p>This is an automated email from Open Sign. For any queries regarding this email, please contact the sender ' +
|
||||
t.Mail +
|
||||
' directly. If you think this email is inappropriate or spam, you may file a complaint with Open Sign here.</p></div></div></body></html>',
|
||||
};
|
||||
await axios.post(serverUrl + '/functions/sendmailv3', a, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Master-Key': masterKEY,
|
||||
},
|
||||
});
|
||||
}
|
||||
async function PDF(s, r) {
|
||||
try {
|
||||
var i = s.params.sign,
|
||||
e = s.params.docId,
|
||||
o = s.params.userId,
|
||||
n = await axios.get(serverUrl + '/classes/contracts_Document/' + e + '?include=ExtUserPtr', {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Master-Key": masterKEY
|
||||
}
|
||||
})
|
||||
}
|
||||
async function PDF(s, i) {
|
||||
try {
|
||||
var r = s.params.sign,
|
||||
e = s.params.docId,
|
||||
n = await axios.get(serverUrl + "/classes/contracts_Document/" + e + "?include=ExtUserPtr", {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Session-Token': s.headers.sessiontoken,
|
||||
},
|
||||
}),
|
||||
d = await axios.get(serverUrl + '/users/me', {
|
||||
headers: {
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Session-Token': s.headers.sessiontoken,
|
||||
},
|
||||
});
|
||||
if (!d.data || !d.data.objectId) return { status: 'error', message: 'this user not allowed!' };
|
||||
{
|
||||
var l,
|
||||
p,
|
||||
c,
|
||||
m = JSON.stringify({ objectId: o });
|
||||
let a, t;
|
||||
t = o
|
||||
? (l = await axios.get(serverUrl + '/classes/contracts_Contactbook?where=' + m, {
|
||||
headers: {
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Session-Token': s.headers.sessiontoken,
|
||||
},
|
||||
})).data && 0 < l.data.results.length
|
||||
? ((a = l), 'contracts_Contactbook')
|
||||
: ((a = await axios.get(serverUrl + '/classes/contracts_Users?where=' + m, {
|
||||
headers: {
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Session-Token': s.headers.sessiontoken,
|
||||
},
|
||||
})),
|
||||
'contracts_Users')
|
||||
: ((p = JSON.stringify({
|
||||
UserId: { __type: 'Pointer', className: '_User', objectId: d.data.objectId },
|
||||
})),
|
||||
(c = await axios.get(serverUrl + '/classes/contracts_Users?where=' + p, {
|
||||
headers: {
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Session-Token': s.headers.sessiontoken,
|
||||
},
|
||||
})).data && 0 < c.data.results.length
|
||||
? ((a = c), 'contracts_Users')
|
||||
: ((a = await axios.get(serverUrl + '/classes/contracts_Contactbook?where=' + p, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Session-Token": s.headers.sessiontoken
|
||||
}
|
||||
}),
|
||||
o = await axios.get(serverUrl + "/users/me", {
|
||||
headers: {
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Session-Token": s.headers.sessiontoken
|
||||
}
|
||||
'X-Parse-Application-Id': APPID,
|
||||
'X-Parse-Session-Token': s.headers.sessiontoken,
|
||||
},
|
||||
})),
|
||||
'contracts_Contactbook'));
|
||||
var g = a.data.results[0].Name,
|
||||
h = a.data.results[0].Email;
|
||||
if (!s.params.pdfFile) return { status: 'error', message: 'pdf file not present!' };
|
||||
{
|
||||
let e = Buffer.from(s.params.pdfFile, 'base64');
|
||||
var u = process.env.PFX_BASE64,
|
||||
f = Buffer.from(u, 'base64');
|
||||
e = i
|
||||
? plainplaceholder({
|
||||
pdfBuffer: e,
|
||||
reason: 'Digitally signed by Open sign for ' + g + ' <' + h + '>',
|
||||
location: 'test location',
|
||||
signatureLength: 1e4,
|
||||
sign: i,
|
||||
})
|
||||
: plainAddPlaceholder({
|
||||
pdfBuffer: e,
|
||||
reason: 'Digitally signed by Open sign for ' + g + ' <' + h + '>',
|
||||
location: 'test location',
|
||||
signatureLength: 1e4,
|
||||
});
|
||||
if (!o.data || !o.data.objectId) return {
|
||||
status: "error",
|
||||
message: "this user not allowed!"
|
||||
}; {
|
||||
var d = JSON.stringify({
|
||||
UserId: {
|
||||
__type: "Pointer",
|
||||
className: "_User",
|
||||
objectId: o.data.objectId
|
||||
}
|
||||
});
|
||||
let a, t;
|
||||
var l = await axios.get(serverUrl + "/classes/contracts_Users?where=" + d, {
|
||||
headers: {
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Session-Token": s.headers.sessiontoken
|
||||
}
|
||||
var y = await new SignPDF(e, f).signPDF(),
|
||||
v = `./exports/exported_file_${Math.floor(5e3 * Math.random())}.pdf`,
|
||||
P = (fs.writeFileSync(v, y), await uploadFile(v));
|
||||
if (P && P.imageUrl) {
|
||||
const r = await updateDoc(
|
||||
s.params.docId,
|
||||
P.imageUrl,
|
||||
a.data.results[0].objectId,
|
||||
s.headers['x-real-ip'],
|
||||
n.data,
|
||||
t
|
||||
);
|
||||
return (
|
||||
sendMail({
|
||||
url: P.imageUrl,
|
||||
sender: { Mail: n.data.ExtUserPtr.Email, Name: n.data.ExtUserPtr.Name },
|
||||
pdfName: n.data.Name,
|
||||
receiver: h,
|
||||
}),
|
||||
p = (t = l.data && 0 < l.data.results.length ? (a = l, "contracts_Users") : (a = await axios.get(serverUrl + "/classes/contracts_Contactbook?where=" + d, {
|
||||
headers: {
|
||||
"X-Parse-Application-Id": APPID,
|
||||
"X-Parse-Session-Token": s.headers.sessiontoken
|
||||
}
|
||||
}), "contracts_Contactbook"), a.data.results[0].Name),
|
||||
c = a.data.results[0].Email;
|
||||
if (!s.params.pdfFile) return {
|
||||
status: "error",
|
||||
message: "pdf file not present!"
|
||||
}; {
|
||||
let e = Buffer.from(s.params.pdfFile, "base64");
|
||||
var m = fs.readFileSync("pdfFile/emudhra-test-class2.pfx");
|
||||
e = r ? plainplaceholder({
|
||||
pdfBuffer: e,
|
||||
reason: "Digitally signed by Open sign for " + p + " <" + c + ">",
|
||||
location: "test location",
|
||||
signatureLength: 1e4,
|
||||
sign: r
|
||||
}) : plainAddPlaceholder({
|
||||
pdfBuffer: e,
|
||||
reason: "Digitally signed by Open sign for " + p + " <" + c + ">",
|
||||
location: "test location",
|
||||
signatureLength: 1e4
|
||||
});
|
||||
var g = await new SignPDF(e, m).signPDF(),
|
||||
u = `./exports/exported_file_${Math.floor(5e3 * Math.random())}.pdf`,
|
||||
f = (fs.writeFileSync(u, g), await uploadFile(u));
|
||||
if (f && f.imageUrl) {
|
||||
const i = await updateDoc(s.params.docId, f.imageUrl, a.data.results[0].objectId, s.headers["x-real-ip"], n.data, t);
|
||||
return sendMail({
|
||||
url: f.imageUrl,
|
||||
sender: {
|
||||
Mail: n.data.ExtUserPtr.Email,
|
||||
Name: n.data.ExtUserPtr.Name
|
||||
},
|
||||
pdfName: n.data.Name,
|
||||
receiver: c
|
||||
}), i && i.isCompleted && sendCompletedMail({
|
||||
url: f.imageUrl,
|
||||
sender: {
|
||||
Mail: n.data.ExtUserPtr.Email,
|
||||
Name: "Open sign"
|
||||
},
|
||||
pdfName: n.data.Name,
|
||||
receiver: n.data.ExtUserPtr.Email
|
||||
}), fs.unlinkSync(u), console.log("New Signed PDF created called: " + u), "success" === i.message ? {
|
||||
status: "success",
|
||||
data: f.imageUrl
|
||||
} : {
|
||||
status: "error",
|
||||
message: "please provide required parameters!"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return console.log("Err ", e), "ERR_BAD_REQUEST" === e.code ? {
|
||||
status: "error",
|
||||
message: "Invalid session token!"
|
||||
} : {
|
||||
status: "error",
|
||||
message: "Encrypted files are currently not supported!"
|
||||
r &&
|
||||
r.isCompleted &&
|
||||
sendCompletedMail({
|
||||
url: P.imageUrl,
|
||||
sender: { Mail: n.data.ExtUserPtr.Email, Name: 'Open sign' },
|
||||
pdfName: n.data.Name,
|
||||
receiver: n.data.ExtUserPtr.Email,
|
||||
}),
|
||||
fs.unlinkSync(v),
|
||||
console.log('New Signed PDF created called: ' + v),
|
||||
'success' === r.message
|
||||
? { status: 'success', data: P.imageUrl }
|
||||
: { status: 'error', message: 'please provide required parameters!' }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return (
|
||||
console.log('Err ', e),
|
||||
'ERR_BAD_REQUEST' === e.code
|
||||
? { status: 'error', message: 'Invalid session token!' }
|
||||
: { status: 'error', message: 'Encrypted files are currently not supported!' }
|
||||
);
|
||||
}
|
||||
}
|
||||
export default PDF;
|
||||
export default PDF;
|
||||
|
||||
Reference in New Issue
Block a user