mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-22 15:42:31 +02:00
Merge pull request #949 from OpenSignLabs/raktima-opensignlabs-patch-11
fix: add CDN for icons, issue in public-template flow
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />
|
||||
<link rel="stylesheet" href="/css/fonts.css" />
|
||||
<link rel="stylesheet" href="https://cdn.opensignlabs.com/fonts.css" />
|
||||
<title>OpenSign™</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -677,9 +677,9 @@ function Login() {
|
||||
onClick={togglePasswordVisibility}
|
||||
>
|
||||
{state.passwordVisible ? (
|
||||
<i className="fa fa-eye-slash text-xs pb-1" /> // Close eye icon
|
||||
<i className="fa-light fa-eye-slash text-xs pb-1" /> // Close eye icon
|
||||
) : (
|
||||
<i className="fa fa-eye text-xs pb-1 " /> // Open eye icon
|
||||
<i className="fa-light fa-eye text-xs pb-1 " /> // Open eye icon
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useRef, useEffect } from "react";
|
||||
import { isEnableSubscription, themeColor } from "../constant/const";
|
||||
import { isEnableSubscription, isStaging, themeColor } from "../constant/const";
|
||||
import { PDFDocument } from "pdf-lib";
|
||||
import "../styles/signature.css";
|
||||
import Parse from "parse";
|
||||
@@ -949,9 +949,9 @@ function PdfRequestFiles(props) {
|
||||
`${pdfDetails?.[0].objectId}/${user.Email}`
|
||||
);
|
||||
}
|
||||
// let signPdf = `${hostUrl}/login/${encodeBase64}`;
|
||||
const hostPublicUrl =
|
||||
"https://staging-app.opensignlabs.com";
|
||||
const hostPublicUrl = isStaging
|
||||
? "https://staging-app.opensignlabs.com"
|
||||
: "https://app.opensignlabs.com";
|
||||
let signPdf = props?.templateId
|
||||
? `${hostPublicUrl}/login/${encodeBase64}`
|
||||
: `${hostUrl}/login/${encodeBase64}`;
|
||||
|
||||
@@ -415,9 +415,9 @@ const Signup = () => {
|
||||
onClick={togglePasswordVisibility}
|
||||
>
|
||||
{showPassword ? (
|
||||
<i className="fa fa-eye-slash" /> // Close eye icon
|
||||
<i className="fa-light fa-eye-slash" /> // Close eye icon
|
||||
) : (
|
||||
<i className="fa fa-eye" /> // Open eye icon
|
||||
<i className="fa-light fa-eye" /> // Open eye icon
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -446,9 +446,7 @@ function UserProfile() {
|
||||
Public profile :{" "}
|
||||
<Tooltip
|
||||
maxWidth="max-w-[250px]"
|
||||
message={`this is your public URL. Copy or share it
|
||||
with the signer, and you will be able to see
|
||||
all your publicly set templates.`}
|
||||
message={`This is your public URL. Copy or share it with the signer, and you will be able to see all your publicly set templates.`}
|
||||
/>
|
||||
</span>
|
||||
<div className="flex md:flex-row flex-col md:items-center">
|
||||
|
||||
@@ -47,7 +47,7 @@ const ReportTable = (props) => {
|
||||
const [isTour, setIsTour] = useState(false);
|
||||
const [tourStatusArr, setTourStatusArr] = useState([]);
|
||||
const [isResendMail, setIsResendMail] = useState({});
|
||||
const [isMakePublic, setIsMakePublic] = useState({});
|
||||
const [isMakePublicModal, setIsMakePublicModal] = useState({});
|
||||
const [mail, setMail] = useState({ subject: "", body: "" });
|
||||
const [userDetails, setUserDetails] = useState({});
|
||||
const [isNextStep, setIsNextStep] = useState({});
|
||||
@@ -443,7 +443,7 @@ const ReportTable = (props) => {
|
||||
const handleClose = (item) => {
|
||||
setIsRevoke({});
|
||||
setIsDeleteModal({});
|
||||
setIsMakePublic({});
|
||||
setIsMakePublicModal({});
|
||||
setSelectedPublicRole("");
|
||||
setIsPublicProfile({});
|
||||
if (item?.objectId) {
|
||||
@@ -855,7 +855,7 @@ const ReportTable = (props) => {
|
||||
const handlePublicTemplate = async (item) => {
|
||||
if (selectedPublicRole || !props.isPublic[item.objectId]) {
|
||||
setActLoader({ [item.objectId]: true });
|
||||
setIsMakePublic(false);
|
||||
setIsMakePublicModal(false);
|
||||
try {
|
||||
const res = await Parse.Cloud.run("createpublictemplate", {
|
||||
templateid: item.objectId,
|
||||
@@ -922,40 +922,59 @@ const ReportTable = (props) => {
|
||||
//function to handle change template status is public or private
|
||||
const handlePublicChange = async (e, item) => {
|
||||
const getPlaceholder = item?.Placeholders;
|
||||
//condiiton to check role is exist or not
|
||||
if (getPlaceholder && getPlaceholder.length > 0) {
|
||||
const checkIsSignatureExistt = getPlaceholder?.every((placeholderObj) =>
|
||||
placeholderObj?.placeHolder?.some((holder) =>
|
||||
holder?.pos?.some((posItem) => posItem?.type === "signature")
|
||||
)
|
||||
);
|
||||
//checking index for public role
|
||||
const getIndex = getPlaceholder.findIndex((obj) => !obj.signerObjId);
|
||||
//conditon to check empty role is exist or not
|
||||
if (getPlaceholder && getPlaceholder.length > 0 && getIndex >= 0) {
|
||||
const signers = item?.Signers;
|
||||
//condition to check that every role is attached to signers except the public role.
|
||||
if (getPlaceholder.length - 1 === signers?.length) {
|
||||
if (checkIsSignatureExistt) {
|
||||
let extendUser = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
const userName = extendUser[0]?.UserName;
|
||||
setIsPublicUserName(extendUser[0]?.UserName);
|
||||
//condition to check user have public url or not
|
||||
if (userName) {
|
||||
props.setIsPublic((prevStates) => ({
|
||||
...prevStates,
|
||||
[item.objectId]: e.target.checked
|
||||
}));
|
||||
const getRole = item.Placeholders.find((data) => !data.signerObjId);
|
||||
if (getRole?.Role) {
|
||||
setSelectedPublicRole(getRole?.Role);
|
||||
//check template send in order
|
||||
const IsSendInOrder = item?.SendinOrder;
|
||||
//condition for if send in order true then the public role order should be prioritized.
|
||||
//When send in order is false and there's no need to verify the public role's order
|
||||
if ((IsSendInOrder && getIndex === 0) || !IsSendInOrder) {
|
||||
const checkIsSignatureExist = getPlaceholder?.every(
|
||||
(placeholderObj) =>
|
||||
placeholderObj?.placeHolder?.some((holder) =>
|
||||
holder?.pos?.some((posItem) => posItem?.type === "signature")
|
||||
)
|
||||
);
|
||||
//condition for validate signature widgets should be all signers
|
||||
if (checkIsSignatureExist) {
|
||||
let extendUser = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
const userName = extendUser[0]?.UserName;
|
||||
setIsPublicUserName(extendUser[0]?.UserName);
|
||||
//condition to check user have public url or not
|
||||
if (userName) {
|
||||
//`setIsPublic` variable is used to collect all template public status
|
||||
props.setIsPublic((prevStates) => ({
|
||||
...prevStates,
|
||||
[item.objectId]: e.target.checked
|
||||
}));
|
||||
if (getPlaceholder[getIndex]?.Role) {
|
||||
setSelectedPublicRole(getPlaceholder[getIndex].Role);
|
||||
}
|
||||
//`setIsMakePublicModal` is used to open modal after succesfully make public
|
||||
setIsMakePublicModal({ [item.objectId]: true });
|
||||
} else {
|
||||
setIsPublicProfile({ [item.objectId]: true });
|
||||
}
|
||||
|
||||
setIsMakePublic({ [item.objectId]: true });
|
||||
} else {
|
||||
setIsPublicProfile({ [item.objectId]: true });
|
||||
setIsAlert(true);
|
||||
setAlertMsg({
|
||||
type: "danger",
|
||||
message:
|
||||
" Please ensure there's at least one signature widget added for all signers."
|
||||
});
|
||||
setTimeout(() => setIsAlert(false), 5000);
|
||||
}
|
||||
} else {
|
||||
} else if (IsSendInOrder) {
|
||||
setIsAlert(true);
|
||||
setAlertMsg({
|
||||
type: "danger",
|
||||
message:
|
||||
" Please ensure there's at least one signature widget added for all recipients."
|
||||
"The send-in-order for this template is enabled, and the public role must be at the top."
|
||||
});
|
||||
setTimeout(() => setIsAlert(false), 5000);
|
||||
}
|
||||
@@ -972,7 +991,8 @@ const ReportTable = (props) => {
|
||||
setIsAlert(true);
|
||||
setAlertMsg({
|
||||
type: "danger",
|
||||
message: "Please assign at least one role to make this template public."
|
||||
message:
|
||||
"Please assign at least one public role to make this template public."
|
||||
});
|
||||
setTimeout(() => setIsAlert(false), 5000);
|
||||
}
|
||||
@@ -1236,7 +1256,7 @@ const ReportTable = (props) => {
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
{isMakePublic[item.objectId] && (
|
||||
{isMakePublicModal[item.objectId] && (
|
||||
<ModalUi
|
||||
isOpen
|
||||
title={
|
||||
@@ -1245,7 +1265,7 @@ const ReportTable = (props) => {
|
||||
: "Make template private"
|
||||
}
|
||||
handleClose={() => {
|
||||
setIsMakePublic({});
|
||||
setIsMakePublicModal({});
|
||||
setSelectedPublicRole("");
|
||||
props.setIsPublic((prevStates) => ({
|
||||
...prevStates,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { Tooltip as ReactTooltip } from "react-tooltip";
|
||||
import { openInNewTab } from "../constant/Utils";
|
||||
const Tooltip = ({ id, message, url, iconColor }) =>
|
||||
const Tooltip = ({ id, message, url, iconColor, maxWidth }) =>
|
||||
url ? (
|
||||
<button onClick={() => openInNewTab(url)} className={"text-center"}>
|
||||
<sup>
|
||||
@@ -33,7 +33,7 @@ const Tooltip = ({ id, message, url, iconColor }) =>
|
||||
</a>
|
||||
<ReactTooltip
|
||||
id={id ? id : "my-tooltip"}
|
||||
className="max-w-[200px] z-[200]"
|
||||
className={`${maxWidth ? maxWidth : "max-w-[200px]"} z-[200]`}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -33,7 +33,7 @@ const scriptComponent = document.createElement("div");
|
||||
scriptComponent.id = "script-component";
|
||||
document.body.appendChild(scriptComponent);
|
||||
const link = document.createElement("link");
|
||||
link.href = "https://staging-app.opensignlabs.com/css/fonts.css";
|
||||
link.href = "https://cdn.opensignlabs.com/fonts.css";
|
||||
link.rel = "stylesheet";
|
||||
document.head.appendChild(link);
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { replaceMailVaribles } from '../../Utils.js';
|
||||
|
||||
// `saveRoleContact` is used to save user in contracts_Guest role and create contact
|
||||
const saveRoleContact = async contact => {
|
||||
try {
|
||||
@@ -47,20 +49,19 @@ const saveRoleContact = async contact => {
|
||||
const createDocumentFromTemplate = async (template, existContact, index) => {
|
||||
try {
|
||||
if (template) {
|
||||
const Doc = JSON.parse(JSON.stringify(template));
|
||||
//update contact in placeholder, signers and update ACl in provide document
|
||||
const object = new Parse.Object('contracts_Document');
|
||||
object.set('Name', Doc?.Name);
|
||||
object.set('Description', Doc?.Description);
|
||||
object.set('Note', Doc?.Note);
|
||||
object.set('TimeToCompleteDays', Doc.TimeToCompleteDays || 15);
|
||||
object.set('SendinOrder', Doc?.SendinOrder);
|
||||
object.set('AutomaticReminders', Doc.AutomaticReminders);
|
||||
object.set('RemindOnceInEvery', Doc?.RemindOnceInEvery);
|
||||
object.set('URL', Doc?.URL);
|
||||
object.set('CreatedBy', Doc?.CreatedBy);
|
||||
object.set('ExtUserPtr', Doc?.ExtUserPtr);
|
||||
let signers = Doc?.Signers || [];
|
||||
object.set('Name', template?.Name);
|
||||
object.set('Description', template?.Description);
|
||||
object.set('Note', template?.Note);
|
||||
object.set('TimeToCompleteDays', template.TimeToCompleteDays || 15);
|
||||
object.set('SendinOrder', template?.SendinOrder);
|
||||
object.set('AutomaticReminders', template.AutomaticReminders);
|
||||
object.set('RemindOnceInEvery', template?.RemindOnceInEvery);
|
||||
object.set('URL', template?.URL);
|
||||
object.set('CreatedBy', template?.CreatedBy);
|
||||
object.set('ExtUserPtr', template?.ExtUserPtr);
|
||||
let signers = template?.Signers || [];
|
||||
const signerobj = {
|
||||
__type: 'Pointer',
|
||||
className: 'contracts_Contactbook',
|
||||
@@ -68,8 +69,8 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
|
||||
};
|
||||
signers = [...signers.slice(0, index), signerobj, ...signers.slice(index)];
|
||||
object.set('Signers', signers);
|
||||
object.set('SignedUrl', Doc.URL || Doc.SignedUrl);
|
||||
const Placeholders = Doc?.Placeholders || [];
|
||||
object.set('SignedUrl', template.URL || template.SignedUrl);
|
||||
const Placeholders = template?.Placeholders || [];
|
||||
Placeholders[index] = {
|
||||
...Placeholders[index],
|
||||
signerObjId: existContact.id,
|
||||
@@ -80,6 +81,7 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
|
||||
},
|
||||
};
|
||||
object.set('Placeholders', Placeholders);
|
||||
object.set('SendMail', true);
|
||||
const resDoc = await object.save(null, { useMasterKey: true });
|
||||
return resDoc;
|
||||
}
|
||||
@@ -88,6 +90,136 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
|
||||
}
|
||||
};
|
||||
|
||||
//`sendMailToAllSigners` is used to send email to all signers at a time if send-in-order false
|
||||
const sendMailToAllSigners = async docId => {
|
||||
try {
|
||||
//get document details that recenlty created from public template
|
||||
const docQuery = new Parse.Query('contracts_Document');
|
||||
docQuery.include('ExtUserPtr');
|
||||
docQuery.include('Signers');
|
||||
const docRes = await docQuery.get(docId, { useMasterKey: true });
|
||||
const Doc = JSON.parse(JSON.stringify(docRes));
|
||||
const templateOwnerUserId = Doc?.CreatedBy?.objectId;
|
||||
const tenantCreditsQuery = new Parse.Query('partners_Tenant');
|
||||
tenantCreditsQuery.equalTo('UserId', {
|
||||
__type: 'Pointer',
|
||||
className: '_User',
|
||||
objectId: templateOwnerUserId,
|
||||
});
|
||||
const res = await tenantCreditsQuery.first();
|
||||
if (res) {
|
||||
const existUserId = Doc?.ExtUserPtr?.objectId;
|
||||
try {
|
||||
const getSubscriptionDetails = await Parse.Cloud.run('getsubscriptions', {
|
||||
extUserId: existUserId,
|
||||
ispublic: true,
|
||||
});
|
||||
if (getSubscriptionDetails) {
|
||||
const tenantRes = JSON.parse(JSON.stringify(res));
|
||||
const extUserDetails = Doc?.ExtUserPtr;
|
||||
const signerMail = Doc?.Signers;
|
||||
const requestBody = tenantRes?.RequestBody;
|
||||
const requestSubject = tenantRes?.RequestSubject;
|
||||
const subscription_json = JSON.parse(JSON.stringify(getSubscriptionDetails));
|
||||
const billingDate =
|
||||
subscription_json?.result?.Next_billing_date &&
|
||||
subscription_json?.result?.Next_billing_date?.iso;
|
||||
const isSubscribed = billingDate ? new Date(billingDate) > new Date() : false;
|
||||
for (let i = 0; i < signerMail.length; i++) {
|
||||
try {
|
||||
const senderEmail = Doc?.ExtUserPtr?.Email;
|
||||
const senderPhone = Doc?.ExtUserPtr?.Phone;
|
||||
const expireDate = Doc?.ExpiryDate?.iso || 15;
|
||||
const newDate = new Date(expireDate);
|
||||
const localExpireDate = newDate.toLocaleDateString('en-US', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
});
|
||||
const imgPng = 'https://qikinnovation.ams3.digitaloceanspaces.com/logo.png';
|
||||
const objectId = signerMail[i].objectId;
|
||||
const hostPublicUrl = 'https://staging-app.opensignlabs.com';
|
||||
|
||||
//encode this url value `${Doc.objectId}/${signerMail[i].Email}/${objectId}` to base64 using `btoa` function
|
||||
const encodeBase64 = btoa(`${Doc?.objectId}/${signerMail[i].Email}/${objectId}`);
|
||||
let signPdf = `${hostPublicUrl}/login/${encodeBase64}`;
|
||||
const openSignUrl = 'https://www.opensignlabs.com/';
|
||||
const orgName = Doc?.ExtUserPtr?.Company || '';
|
||||
const themeBGcolor = '#47a3ad';
|
||||
const senderName = `${Doc?.ExtUserPtr.Name}`;
|
||||
const documentName = `${Doc?.Name}`;
|
||||
let replaceVar;
|
||||
if (isSubscribed && requestBody && requestSubject) {
|
||||
const replacedRequestBody = requestBody.replace(/"/g, "'");
|
||||
htmlReqBody =
|
||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body>" +
|
||||
replacedRequestBody +
|
||||
'</body> </html>';
|
||||
|
||||
const variables = {
|
||||
document_title: documentName,
|
||||
sender_name: senderName,
|
||||
sender_mail: senderEmail,
|
||||
sender_phone: senderPhone || '',
|
||||
receiver_name: signerMail[i].Name,
|
||||
receiver_email: signerMail[i].Email,
|
||||
receiver_phone: signerMail[i]?.Phone || '',
|
||||
expiry_date: localExpireDate,
|
||||
company_name: orgName,
|
||||
signing_url: `<a href=${signPdf}>Sign here</a>`,
|
||||
};
|
||||
replaceVar = replaceMailVaribles(requestSubject, htmlReqBody, variables);
|
||||
}
|
||||
let params = {
|
||||
mailProvider: extUserDetails?.activeMailAdapter,
|
||||
extUserId: existUserId,
|
||||
recipient: signerMail[i].Email,
|
||||
subject:
|
||||
replaceVar?.subject ||
|
||||
`${senderName} has requested you to sign "${documentName}"`,
|
||||
from: senderEmail,
|
||||
html:
|
||||
replaceVar?.body ||
|
||||
"<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: white;padding-bottom: 20px;'> <div style='padding:10px 10px 0 10px'><img src=" +
|
||||
imgPng +
|
||||
" height='50' style='padding: 20px,width:170px,height:40px' /></div> <div style=' padding: 2px;font-family: system-ui;background-color:" +
|
||||
themeBGcolor +
|
||||
";'><p style='font-size: 20px;font-weight: 400;color: white;padding-left: 20px;' > Digital Signature Request</p></div><div><p style='padding: 20px;font-family: system-ui;font-size: 14px; margin-bottom: 10px;'> " +
|
||||
Doc?.ExtUserPtr.Name +
|
||||
' has requested you to review and sign <strong> ' +
|
||||
Doc?.Name +
|
||||
"</strong>.</p><div style='padding: 5px 0px 5px 25px;display: flex;flex-direction: row;justify-content: space-around;'><table> <tr> <td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Sender</td> <td> </td> <td style='color:#626363;font-weight:bold'>" +
|
||||
senderEmail +
|
||||
"</td></tr><tr><td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Organization</td> <td> </td><td style='color:#626363;font-weight:bold'> " +
|
||||
orgName +
|
||||
"</td></tr> <tr> <td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Expire on</td><td> </td> <td style='color:#626363;font-weight:bold'>" +
|
||||
localExpireDate +
|
||||
"</td></tr><tr> <td></td> <td> </td></tr></table> </div> <div style='margin-left:70px'><a href=" +
|
||||
signPdf +
|
||||
"> <button style='padding: 12px 12px 12px 12px;background-color: #d46b0f;color: white; border: 0px;box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px,rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;font-weight:bold;margin-top:30px'>Sign here</button></a> </div> <div style='display: flex; justify-content: center;margin-top: 10px;'> </div></div></div><div><p> This is an automated email from OpenSign™. For any queries regarding this email, please contact the sender " +
|
||||
senderEmail +
|
||||
' directly.If you think this email is inappropriate or spam, you may file a complaint with OpenSign™ <a href= ' +
|
||||
openSignUrl +
|
||||
' target=_blank>here</a>.</p> </div></div></body> </html>',
|
||||
};
|
||||
|
||||
await Parse.Cloud.run('sendmailv3', params);
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('err in create document from template', err);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('err in create document from template', err);
|
||||
}
|
||||
};
|
||||
|
||||
// `PublicUserLinkContactToDoc` cloud function is used to create contact, add this contact in contracts_Guest role and
|
||||
// create new document from template and save contact pointer in placeholder, signers and ACL of Document
|
||||
export default async function PublicUserLinkContactToDoc(req) {
|
||||
@@ -122,9 +254,14 @@ export default async function PublicUserLinkContactToDoc(req) {
|
||||
contactCls.notEqualTo('IsDeleted', true);
|
||||
const existContact = await contactCls.first({ useMasterKey: true });
|
||||
if (existContact) {
|
||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||
//update contact in placeholder, signers and update ACl in provide document
|
||||
const docRes = await createDocumentFromTemplate(tempRes, existContact, index);
|
||||
const docRes = await createDocumentFromTemplate(template_json, existContact, index);
|
||||
if (docRes) {
|
||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||
if (!template_json?.SendinOrder) {
|
||||
await sendMailToAllSigners(docRes.id);
|
||||
}
|
||||
return { contactId: existContact.id, docId: docRes.id };
|
||||
}
|
||||
} else {
|
||||
@@ -142,10 +279,15 @@ export default async function PublicUserLinkContactToDoc(req) {
|
||||
CreatedBy: _tempRes.CreatedBy,
|
||||
TenantId: _tempRes.ExtUserPtr.TenantId,
|
||||
};
|
||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||
// if user present on platform create contact on the basis of extended user details
|
||||
const contactRes = await saveRoleContact(contact);
|
||||
const docRes = await createDocumentFromTemplate(tempRes, contactRes, index);
|
||||
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
||||
if (docRes) {
|
||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||
if (!template_json?.SendinOrder) {
|
||||
await sendMailToAllSigners(docRes.id);
|
||||
}
|
||||
return { contactId: contactRes.id, docId: docRes.id };
|
||||
}
|
||||
} else if (name) {
|
||||
@@ -163,11 +305,16 @@ export default async function PublicUserLinkContactToDoc(req) {
|
||||
CreatedBy: _tempRes.CreatedBy,
|
||||
TenantId: _tempRes.ExtUserPtr.TenantId,
|
||||
};
|
||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||
// Create new contract on the basis provided contact details by user and userId from _User class
|
||||
const contactRes = await saveRoleContact(contact);
|
||||
//update contact in placeholder, signers and update ACl in provide document
|
||||
const docRes = await createDocumentFromTemplate(tempRes, contactRes, index);
|
||||
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
||||
if (docRes) {
|
||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||
if (!template_json?.SendinOrder) {
|
||||
await sendMailToAllSigners(docRes.id);
|
||||
}
|
||||
return { contactId: contactRes.id, docId: docRes.id };
|
||||
}
|
||||
} else {
|
||||
@@ -190,11 +337,16 @@ export default async function PublicUserLinkContactToDoc(req) {
|
||||
CreatedBy: _tempRes.CreatedBy,
|
||||
TenantId: _tempRes.ExtUserPtr.TenantId,
|
||||
};
|
||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||
// Create new contract on the basis provided contact details by user and userId from _User class
|
||||
const contactRes = await saveRoleContact(contact);
|
||||
//update contact in placeholder, signers and update ACl in provide document
|
||||
const docRes = await createDocumentFromTemplate(tempRes, contactRes, index);
|
||||
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
||||
if (docRes) {
|
||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||
if (!template_json?.SendinOrder) {
|
||||
await sendMailToAllSigners(docRes.id);
|
||||
}
|
||||
return { contactId: contactRes.id, docId: docRes.id };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,22 @@ const appId = process.env.APP_ID;
|
||||
export default async function getSubscription(request) {
|
||||
const extUserId = request.params.extUserId || '';
|
||||
const contactId = request.params.contactId || '';
|
||||
const ispublic = request.params.ispublic || false;
|
||||
|
||||
if (extUserId) {
|
||||
try {
|
||||
const userRes = await axios.get(serverUrl + '/users/me', {
|
||||
headers: {
|
||||
'X-Parse-Application-Id': appId,
|
||||
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
||||
},
|
||||
});
|
||||
const userId = userRes.data && userRes.data.objectId;
|
||||
if (userId) {
|
||||
let userId;
|
||||
//`ispublic` is used in public profile to get subscription details
|
||||
if (!ispublic) {
|
||||
const userRes = await axios.get(serverUrl + '/users/me', {
|
||||
headers: {
|
||||
'X-Parse-Application-Id': appId,
|
||||
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
||||
},
|
||||
});
|
||||
userId = userRes.data && userRes.data.objectId;
|
||||
}
|
||||
if (userId || ispublic) {
|
||||
const extCls = new Parse.Query('contracts_Users');
|
||||
const exUser = await extCls.get(extUserId, { useMasterKey: true });
|
||||
if (exUser) {
|
||||
|
||||
@@ -333,6 +333,7 @@ export default function reportJson(id, userId) {
|
||||
'Placeholders',
|
||||
'IsPublic',
|
||||
'SharedWith.Name',
|
||||
'SendinOrder',
|
||||
],
|
||||
};
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user