Skip to content

Commit cd1a6fd

Browse files
Merge branch 'staging' of https://github.com/OpenSignLabs/OpenSign into feat_bulksend
2 parents ca6cb60 + c2afeed commit cd1a6fd

File tree

6 files changed

+91
-34
lines changed

6 files changed

+91
-34
lines changed

apps/OpenSign/src/pages/GuestLogin.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function GuestLogin() {
1919
const [appLogo, setAppLogo] = useState("");
2020
const [documentId, setDocumentId] = useState(id);
2121
const [contactId, setContactId] = useState(contactBookId);
22+
const [sendmail, setSendmail] = useState();
2223
useEffect(() => {
2324
handleServerUrl();
2425

@@ -54,6 +55,7 @@ function GuestLogin() {
5455
setDocumentId(checkSplit[0]);
5556
setEmail(checkSplit[1]);
5657
setContactId(checkSplit[2]);
58+
setSendmail(checkSplit[3]);
5759
}
5860

5961
setIsLoading(false);
@@ -146,7 +148,13 @@ function GuestLogin() {
146148
//save isGuestSigner true in local to handle login flow header in mobile view
147149
localStorage.setItem("isGuestSigner", true);
148150
setLoading(false);
149-
navigate(`/load/recipientSignPdf/${documentId}/${contactId}`);
151+
if (sendmail === "false") {
152+
navigate(
153+
`/load/recipientSignPdf/${documentId}/${contactId}?sendmail=${sendmail}`
154+
);
155+
} else {
156+
navigate(`/load/recipientSignPdf/${documentId}/${contactId}`);
157+
}
150158
}
151159
} catch (error) {
152160
console.log("err ", error);

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ import Title from "../components/Title";
3939
import DefaultSignature from "../components/pdf/DefaultSignature";
4040
import ModalUi from "../primitives/ModalUi";
4141
import VerifyEmail from "../components/pdf/VerifyEmail";
42+
function useQuery() {
43+
return new URLSearchParams(useLocation().search);
44+
}
4245

4346
function PdfRequestFiles() {
4447
const { docId } = useParams();
4548
const navigate = useNavigate();
4649
const location = useLocation();
50+
const query = useQuery();
51+
const sendmail = query.get("sendmail");
4752
const [pdfDetails, setPdfDetails] = useState([]);
4853
const [signedSigners, setSignedSigners] = useState([]);
4954
const [unsignedSigners, setUnSignedSigners] = useState([]);
@@ -730,7 +735,7 @@ function PdfRequestFiles() {
730735
);
731736
const newIndex = index + 1;
732737
const user = pdfDetails?.[0].Signers[newIndex];
733-
if (sendInOrder) {
738+
if (sendmail !== "false" && sendInOrder) {
734739
const requestBody = pdfDetails?.[0]?.RequestBody;
735740
const requestSubject = pdfDetails?.[0]?.RequestSubject;
736741
if (user) {

apps/OpenSign/src/pages/PlaceHolderSign.js

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,10 @@ function PlaceHolderSign() {
998998
for (let i = 0; i < signerMail.length; i++) {
999999
const objectId = signerMail[i].objectId;
10001000
const hostUrl = window.location.origin;
1001+
const sendMail = false;
10011002
//encode this url value `${pdfDetails?.[0].objectId}/${signerMail[i].Email}/${objectId}` to base64 using `btoa` function
10021003
const encodeBase64 = btoa(
1003-
`${pdfDetails?.[0].objectId}/${signerMail[i].Email}/${objectId}`
1004+
`${pdfDetails?.[0].objectId}/${signerMail[i].Email}/${objectId}/${sendMail}`
10041005
);
10051006
let signPdf = `${hostUrl}/login/${encodeBase64}`;
10061007
shareLinkList.push({ signerEmail: signerMail[i].Email, url: signPdf });
@@ -1162,40 +1163,45 @@ function PlaceHolderSign() {
11621163
}
11631164
if (sendMail.data.result.status === "success") {
11641165
setMailStatus("success");
1165-
1166-
if (
1167-
requestBody &&
1168-
requestSubject &&
1169-
isCustomize &&
1170-
(isSubscribe || !isEnableSubscription)
1171-
) {
1172-
try {
1173-
const data = {
1166+
try {
1167+
let data;
1168+
if (
1169+
requestBody &&
1170+
requestSubject &&
1171+
isCustomize &&
1172+
(isSubscribe || !isEnableSubscription)
1173+
) {
1174+
data = {
11741175
RequestBody: htmlReqBody,
1175-
RequestSubject: requestSubject
1176+
RequestSubject: requestSubject,
1177+
SendMail: true
1178+
};
1179+
} else {
1180+
data = {
1181+
SendMail: true
11761182
};
1183+
}
11771184

1178-
await axios
1179-
.put(
1180-
`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
1181-
"_appName"
1182-
)}_Document/${documentId}`,
1183-
data,
1184-
{
1185-
headers: {
1186-
"Content-Type": "application/json",
1187-
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
1188-
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
1189-
}
1185+
await axios
1186+
.put(
1187+
`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
1188+
"_appName"
1189+
)}_Document/${documentId}`,
1190+
data,
1191+
{
1192+
headers: {
1193+
"Content-Type": "application/json",
1194+
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
1195+
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
11901196
}
1191-
)
1192-
.then(() => {})
1193-
.catch((err) => {
1194-
console.log("axois err ", err);
1195-
});
1196-
} catch (e) {
1197-
console.log("error", e);
1198-
}
1197+
}
1198+
)
1199+
.then(() => {})
1200+
.catch((err) => {
1201+
console.log("axois err ", err);
1202+
});
1203+
} catch (e) {
1204+
console.log("error", e);
11991205
}
12001206

12011207
setIsSend(true);

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,12 @@ const ReportTable = (props) => {
308308
const handleShare = (item) => {
309309
setActLoader({ [item.objectId]: true });
310310
const host = window.location.origin;
311+
const sendMail = item?.SendMail || false;
311312
const getUrl = (x) => {
312313
//encode this url value `${item.objectId}/${x.Email}/${x.objectId}` to base64 using `btoa` function
313-
const encodeBase64 = btoa(`${item.objectId}/${x.Email}/${x.objectId}`);
314+
const encodeBase64 = btoa(
315+
`${item.objectId}/${x.Email}/${x.objectId}/${sendMail}`
316+
);
314317
return `${host}/login/${encodeBase64}`;
315318
};
316319

apps/OpenSignServer/cloud/parsefunction/reportsJson.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export default function reportJson(id, userId) {
101101
'AuditTrail',
102102
'AuditTrail.UserPtr',
103103
'ExpiryDate',
104+
'SendMail',
104105
],
105106
};
106107
// completed documents report
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
*
3+
* @param {Parse} Parse
4+
*/
5+
exports.up = async Parse => {
6+
// TODO: set className here
7+
const className = 'contracts_Document';
8+
const schema = new Parse.Schema(className);
9+
schema.addBoolean('SendMail');
10+
schema.addBoolean('SendCompletionMail');
11+
// TODO: Set the schema here
12+
// Example:
13+
// schema.addString('name').addNumber('cash');
14+
15+
return schema.update();
16+
};
17+
18+
/**
19+
*
20+
* @param {Parse} Parse
21+
*/
22+
exports.down = async Parse => {
23+
// TODO: set className here
24+
const className = 'contracts_Document';
25+
const schema = new Parse.Schema(className);
26+
schema.deleteField('SendMail');
27+
schema.deleteField('SendCompletionMail');
28+
29+
// TODO: Set the schema here
30+
// Example:
31+
// schema.deleteField('name').deleteField('cash');
32+
33+
return schema.update();
34+
};

0 commit comments

Comments
 (0)