Skip to content

Commit 980e713

Browse files
refactor: validation
1 parent 5a26e5c commit 980e713

File tree

10 files changed

+43
-56
lines changed

10 files changed

+43
-56
lines changed

apps/OpenSign/public/locales/en/translation.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,9 @@
631631
"decline-by":"Declined/revoked by",
632632
"document-declined": "Document declined",
633633
"Add-Webhook":"Add Webhook",
634-
"quotamailselfsign": "You've reached your limit of 20 emails for this month. Upgrade now to continue sending emails directly.",
635-
"quotamail": "You've reached your limit of 20 signature request emails for this month. Upgrade now to continue sending emails directly.",
636-
"quotamailTip":"Tip: You can still sign unlimited documents by manually sharing the signing request links below.",
634+
"quotamailinfo": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
635+
"quotamail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
636+
"quotamailTip":"Tip: You can still sign unlimited documents by manually sharing the signing request links.",
637637
"quotamailhead":"Quota Reached",
638638
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminName}}<{{adminEmail}}>."
639639

apps/OpenSign/public/locales/fr/translation.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,9 @@
631631
"decline-by" :"Refusé/révoqué par",
632632
"document-declined":"document refusé",
633633
"Add-Webhook":"Ajouter Webhook",
634-
"quotamailselfsign": "Vous avez atteint votre limite de 20 e-mails pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
635-
"quotamail": "Vous avez atteint votre limite de 20 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
636-
"quotamailTip":"Astuce : Vous pouvez toujours signer un nombre illimité de documents en partageant manuellement les liens de demande de signature ci-dessous.",
634+
"quotamailinfo": "Vous pouvez envoyer jusqu'à 15 e-mails de demande de signature chaque mois. Mettez à niveau maintenant pour envoyer directement des demandes de signature illimitées.",
635+
"quotamail": "Vous avez atteint votre limite de 15 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
636+
"quotamailTip":"Astuce : Vous pouvez toujours signer un nombre illimité de documents en partageant manuellement les liens de demande de signature.",
637637
"quotamailhead":"Quota atteint",
638638
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminName}}<{{adminEmail}}>."
639639

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ const BulkSendUi = (props) => {
7777
const addoncredits = resCredits?.addoncredits || 0;
7878
const totalcredits = allowedcredits + addoncredits;
7979
if (totalcredits > 0) {
80-
setIsBulkAvailable(true);
80+
if (subscription?.plan !== "freeplan") {
81+
setIsBulkAvailable(true);
82+
}
8183
}
8284
setAmount((obj) => ({ ...obj, totalcredits: totalcredits }));
8385
}

apps/OpenSign/src/components/Header.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
import { isEnableSubscription, isStaging } from "../constant/const";
1414
import { validplan } from "../json/plansArr";
1515
import { useTranslation } from "react-i18next";
16+
import ModalUi from "../primitives/ModalUi";
17+
import QuotaCard from "../primitives/QuotaCard";
1618

1719
const Header = ({ showSidebar }) => {
1820
const { t, i18n } = useTranslation();
@@ -27,6 +29,7 @@ const Header = ({ showSidebar }) => {
2729
localStorage.getItem("appLogo") || " "
2830
);
2931
const [emailUsed, setEmailUsed] = useState(0);
32+
const [isModal, setIsModal] = useState(false);
3033

3134
const toggleDropdown = () => {
3235
setIsOpen(!isOpen);
@@ -111,6 +114,9 @@ const Header = ({ showSidebar }) => {
111114
const handleNavigation = () => {
112115
navigate("/subscription");
113116
};
117+
const handleMailUsed = () => {
118+
setIsModal(!isModal);
119+
};
114120
return (
115121
<div>
116122
{isEnableSubscription && (
@@ -203,14 +209,6 @@ const Header = ({ showSidebar }) => {
203209
tabIndex={0}
204210
className="mt-3 z-[1] p-2 shadow op-menu op-menu-sm op-dropdown-content text-base-content bg-base-100 rounded-box w-52"
205211
>
206-
{isEnableSubscription && isTeam?.plan === "freeplan" && (
207-
<li className="cursor-pointer">
208-
<span>
209-
<i className="fa-light fa-envelope"></i> Email used:{" "}
210-
{emailUsed}/20
211-
</span>
212-
</li>
213-
)}
214212
<li onClick={() => openInNewTab("https://docs.opensignlabs.com")}>
215213
<span>
216214
<i className="fa-light fa-book"></i> {t("docs")}
@@ -241,6 +239,14 @@ const Header = ({ showSidebar }) => {
241239
<i className="fa-light fa-id-card"></i> Console
242240
</span>
243241
</li>
242+
{isEnableSubscription && isTeam?.plan === "freeplan" && (
243+
<li className="cursor-pointer" onClick={handleMailUsed}>
244+
<span>
245+
<i className="fa-light fa-envelope"></i>
246+
{emailUsed}/20 sent this month
247+
</span>
248+
</li>
249+
)}
244250
<li onClick={closeDropdown}>
245251
<span>
246252
<i className="fa-light fa-arrow-right-from-bracket"></i>{" "}
@@ -251,6 +257,9 @@ const Header = ({ showSidebar }) => {
251257
</div>
252258
</div>
253259
</div>
260+
<ModalUi isOpen={isModal}>
261+
<QuotaCard isPaidInfo={true} handlClose={handleMailUsed} />
262+
</ModalUi>
254263
</div>
255264
);
256265
};

apps/OpenSign/src/components/pdf/EmailComponent.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ function EmailComponent({
1515
sender,
1616
setIsAlert,
1717
extUserId,
18-
activeMailAdapter,
19-
planCode
18+
activeMailAdapter
2019
}) {
2120
const { t } = useTranslation();
2221
const [emailList, setEmailList] = useState([]);
@@ -51,7 +50,6 @@ function EmailComponent({
5150
recipient: emailList[i],
5251
subject: `${sender.name} has signed the doc - ${pdfName}`,
5352
from: sender.email,
54-
plan: planCode,
5553
html:
5654
"<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=" +
5755
imgPng +
@@ -85,12 +83,6 @@ function EmailComponent({
8583
setEmailList([]);
8684
}, 1500);
8785
setIsLoading(false);
88-
} else if (sendMail?.data?.result?.status === "quota-reached") {
89-
setIsLoading(false);
90-
setIsEmail(false);
91-
setIsAlert({ isShow: true, alertMessage: "quotareached" });
92-
setEmailValue("");
93-
setEmailList([]);
9486
} else {
9587
setIsLoading(false);
9688
setIsEmail(false);

apps/OpenSign/src/pages/SignyourselfPdf.js

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import PdfZoom from "../components/pdf/PdfZoom";
5757
import Loader from "../primitives/Loader";
5858
import { useTranslation } from "react-i18next";
5959
import RotateAlert from "../components/RotateAlert";
60-
import QuotaCard from "../primitives/QuotaCard";
6160
//For signYourself inProgress section signer can add sign and complete doc sign.
6261
function SignYourSelf() {
6362
const { t } = useTranslation();
@@ -1241,29 +1240,14 @@ function SignYourSelf() {
12411240
<div className="w-full md:w-[95%]">
12421241
<ModalUi
12431242
isOpen={isAlert.isShow}
1244-
title={
1245-
isAlert.alertMessage === "quotareached"
1246-
? false
1247-
: isAlert?.header || t("alert")
1248-
}
1243+
title={isAlert?.header || t("alert")}
12491244
handleClose={() =>
1250-
isAlert.alertMessage === "quotareached"
1251-
? false
1252-
: setIsAlert({ isShow: false, alertMessage: "" })
1245+
setIsAlert({ isShow: false, alertMessage: "" })
12531246
}
12541247
>
1255-
{isAlert.alertMessage === "quotareached" ? (
1256-
<QuotaCard
1257-
isSignyourself={true}
1258-
handlClose={() =>
1259-
setIsAlert({ isShow: false, alertMessage: "" })
1260-
}
1261-
/>
1262-
) : (
1263-
<div className="p-[20px] h-full">
1264-
<p>{isAlert.alertMessage}</p>
1265-
</div>
1266-
)}
1248+
<div className="p-[20px] h-full">
1249+
<p>{isAlert.alertMessage}</p>
1250+
</div>
12671251
</ModalUi>
12681252

12691253
{/* this modal is used show this document is already sign */}
@@ -1343,7 +1327,6 @@ function SignYourSelf() {
13431327
setIsAlert={setIsAlert}
13441328
extUserId={extUserId}
13451329
activeMailAdapter={activeMailAdapter}
1346-
planCode={isSubscribe?.plan}
13471330
/>
13481331
{/* pdf header which contain funish back button */}
13491332
<Header

apps/OpenSign/src/primitives/QuotaCard.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React from "react";
22
import { useTranslation } from "react-i18next";
33
import { useNavigate } from "react-router-dom";
44

5-
const QuotaCard = ({ isSignyourself, handlClose }) => {
5+
const QuotaCard = ({ isPaidInfo, handlClose }) => {
66
const { t } = useTranslation();
77
const navigate = useNavigate();
8-
return isSignyourself ? (
8+
return isPaidInfo ? (
99
<>
1010
<div
1111
className="op-btn op-btn-sm op-btn-circle op-btn-ghost text-primary-content absolute right-2 top-2 z-40"
@@ -18,7 +18,8 @@ const QuotaCard = ({ isSignyourself, handlClose }) => {
1818
<h2 className="op-card-title">
1919
{t("upgrade-to") + " Paid " + t("plan")}
2020
</h2>
21-
<p>{t("quotamailselfsign")}</p>
21+
<p>{t("quotamailinfo")}</p>
22+
<p>{t("quotamailTip")}</p>
2223
<div className="op-card-actions justify-end">
2324
<button
2425
onClick={() => navigate("/subscription")}

apps/OpenSign/src/script/locales/en/translation.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,9 @@
628628
"help-test-token":"This token can be used to test the APIs at the https://sandbox.opensignlabs.com/api/v1 endpoint, allowing you to conduct unlimited document signatures. Please note that the sandbox API will sign your documents with self-signed certificates, which may not be recognized as valid by Adobe. Once you’ve completed your testing, you can upgrade to one of our paid plans to generate a production token.",
629629
"help-api-token":"This token can be used to access the production APIs at the {{origin}}/api/v1 endpoint. It can only be generated on one of our paid plans.",
630630
"Add-Webhook":"Add Webhook",
631-
"quotamailselfsign": "You've reached your limit of 20 emails for this month. Upgrade now to continue sending emails directly.",
632-
"quotamail": "You've reached your limit of 20 signature request emails for this month. Upgrade now to continue sending emails directly.",
633-
"quotamailTip":"Tip: You can still sign unlimited documents by manually sharing the signing request links below.",
631+
"quotamailinfo": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
632+
"quotamail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
633+
"quotamailTip":"Tip: You can still sign unlimited documents by manually sharing the signing request links.",
634634
"quotamailhead":"Quota Reached",
635635
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminName}}<{{adminEmail}}>."
636636

apps/OpenSign/src/script/locales/fr/translation.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,9 @@
628628
"help-test-token":"Ce jeton peut être utilisé pour tester les API au niveau du point de terminaison https://sandbox.opensignlabs.com/api/v1, vous permettant ainsi d'effectuer un nombre illimité de signatures de documents. Veuillez noter que l'API sandbox signera vos documents avec des certificats auto-signés, qui peuvent ne pas être reconnus comme valides par Adobe. Une fois vos tests terminés, vous pouvez passer à l’un de nos forfaits payants pour générer un jeton de production.",
629629
"help-api-token":"Ce jeton peut être utilisé pour accéder aux API de production au point de terminaison {{origin}}/api/v1. Il ne peut être généré que sur l'un de nos forfaits payants.",
630630
"Add-Webhook":"Ajouter Webhook",
631-
"quotamailselfsign": "Vous avez atteint votre limite de 20 e-mails pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
632-
"quotamail": "Vous avez atteint votre limite de 20 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
633-
"quotamailTip":"Astuce : Vous pouvez toujours signer un nombre illimité de documents en partageant manuellement les liens de demande de signature ci-dessous.",
631+
"quotamailinfo": "Vous pouvez envoyer jusqu'à 15 e-mails de demande de signature chaque mois. Mettez à niveau maintenant pour envoyer directement des demandes de signature illimitées.",
632+
"quotamail": "Vous avez atteint votre limite de 15 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
633+
"quotamailTip":"Astuce : Vous pouvez toujours signer un nombre illimité de documents en partageant manuellement les liens de demande de signature.",
634634
"quotamailhead":"Quota atteint",
635635
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminName}}<{{adminEmail}}>."
636636

apps/OpenSignServer/cloud/parsefunction/sendMailv3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ async function sendmailv3(req) {
225225
const nonCustomMail = await sendMailProvider(req, Plan, true);
226226
return nonCustomMail;
227227
} else {
228-
if (MonthlyFreeEmails >= 20) {
228+
if (MonthlyFreeEmails >= 15) {
229229
return { status: 'quota-reached' };
230230
} else {
231231
const nonCustomMail = await sendMailProvider(req, Plan);

0 commit comments

Comments
 (0)