Skip to content

Commit 14532bf

Browse files
refactor: change help text
1 parent 07903a0 commit 14532bf

File tree

9 files changed

+826
-616
lines changed

9 files changed

+826
-616
lines changed

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const BulkSendUi = (props) => {
2424
price: (75.0).toFixed(2),
2525
quantity: 500,
2626
priceperbulksend: 0.15,
27-
totalQuickSend: 0
27+
totalcredits: 0
2828
});
2929
const [isQuotaReached, setIsQuotaReached] = useState(false);
3030
const [isLoader, setIsLoader] = useState(false);
@@ -44,11 +44,16 @@ const BulkSendUi = (props) => {
4444
if (subscription?.plan === "freeplan") {
4545
setIsFreePlan(true);
4646
}
47-
const allowedquicksend = await Parse.Cloud.run("allowedquicksend");
48-
if (allowedquicksend > 0) {
49-
setIsBulkAvailable(true);
47+
const resCredits = await Parse.Cloud.run("allowedcredits");
48+
if (resCredits) {
49+
const allowedcredits = resCredits?.allowedcredits || 0;
50+
const addoncredits = resCredits?.addoncredits || 0;
51+
const totalcredits = allowedcredits + addoncredits;
52+
if (totalcredits > 0) {
53+
setIsBulkAvailable(true);
54+
}
55+
setAmount((obj) => ({ ...obj, totalcredits: totalcredits }));
5056
}
51-
setAmount((obj) => ({ ...obj, totalQuickSend: allowedquicksend }));
5257
const getPlaceholder = props.item?.Placeholders;
5358
const checkIsSignatureExistt = getPlaceholder?.every((placeholderObj) =>
5459
placeholderObj?.placeHolder?.some((holder) =>
@@ -121,7 +126,7 @@ const BulkSendUi = (props) => {
121126
const handleAddForm = (e) => {
122127
e.preventDefault();
123128
// Check if the quick send limit has been reached
124-
if (isEnableSubscription && forms.length >= amount.totalQuickSend) {
129+
if (isEnableSubscription && forms.length >= amount.totalcredits) {
125130
setIsQuotaReached(true);
126131
} else {
127132
if (forms?.length < allowedForm) {
@@ -244,8 +249,8 @@ const BulkSendUi = (props) => {
244249
e.stopPropagation();
245250
setIsSubmit(true);
246251
try {
247-
const resAddon = await Parse.Cloud.run("buyquicksend", {
248-
quicksend: amount.quantity
252+
const resAddon = await Parse.Cloud.run("buycredits", {
253+
credits: amount.quantity
249254
});
250255
if (resAddon) {
251256
const _resAddon = JSON.parse(JSON.stringify(resAddon));
@@ -257,7 +262,7 @@ const BulkSendUi = (props) => {
257262
quantity: 500,
258263
priceperbulksend: 0.15,
259264
price: (75.0).toFixed(2),
260-
totalQuickSend: _resAddon.addon
265+
totalcredits: _resAddon.addon
261266
}));
262267
}
263268
}
@@ -345,13 +350,15 @@ const BulkSendUi = (props) => {
345350
))}
346351
</div>
347352
<div className="flex flex-col mx-4 mb-4 gap-3">
348-
<button
349-
onClick={handleAddForm}
350-
className="op-btn op-btn-primary focus:outline-none"
351-
>
352-
<i className="fa-light fa-plus"></i>{" "}
353-
<span>{t("add-new")}</span>
354-
</button>
353+
{isEnableSubscription && (
354+
<button
355+
onClick={handleAddForm}
356+
className="op-btn op-btn-primary focus:outline-none"
357+
>
358+
<i className="fa-light fa-plus"></i>{" "}
359+
<span>{t("add-new")}</span>
360+
</button>
361+
)}
355362
<button
356363
type="submit"
357364
className="op-btn op-btn-accent focus:outline-none"

apps/OpenSign/src/pages/GenerateToken.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ function GenerateToken() {
2929
const [amount, setAmount] = useState({
3030
quantity: 500,
3131
priceperapi: 0.15,
32-
totalapis: 0,
32+
allowedcredits: 0,
33+
addoncredits: 0,
3334
price: (75.0).toFixed(2)
3435
});
3536
const [isFormLoader, setIsFormLoader] = useState(false);
@@ -59,8 +60,12 @@ function GenerateToken() {
5960
};
6061
const res = await axios.post(url, {}, { headers: headers });
6162
if (res) {
62-
const allowedapis = await Parse.Cloud.run("allowedapis");
63-
setAmount((obj) => ({ ...obj, totalapis: allowedapis }));
63+
const resCredits = await Parse.Cloud.run("allowedcredits");
64+
setAmount((obj) => ({
65+
...obj,
66+
allowedcredits: resCredits.allowedcredits,
67+
addoncredits: resCredits.addoncredits
68+
}));
6469
SetApiToken(res?.data?.result?.result);
6570
}
6671
const body = { email: Parse?.User?.current()?.getEmail() || "" };
@@ -142,8 +147,8 @@ function GenerateToken() {
142147
e.stopPropagation();
143148
setIsFormLoader(true);
144149
try {
145-
const resAddon = await Parse.Cloud.run("buyapis", {
146-
apis: amount.quantity
150+
const resAddon = await Parse.Cloud.run("buycredits", {
151+
credits: amount.quantity
147152
});
148153
if (resAddon) {
149154
const _resAddon = JSON.parse(JSON.stringify(resAddon));
@@ -153,7 +158,7 @@ function GenerateToken() {
153158
quantity: 500,
154159
priceperapi: 0.15,
155160
price: (75.0).toFixed(2),
156-
totalapis: _resAddon.addon
161+
addoncredits: _resAddon.addon
157162
}));
158163
}
159164
}
@@ -293,7 +298,11 @@ function GenerateToken() {
293298
</li>
294299
<div className="text-xs md:text-[15px] my-4">
295300
<span className="font-medium">{t("remainingapis")}</span>{" "}
296-
{amount.totalapis}
301+
{amount.allowedcredits}
302+
</div>
303+
<div className="text-xs md:text-[15px] my-4">
304+
<span className="font-medium">Addon credits: </span>{" "}
305+
{amount.addoncredits}
297306
</div>
298307
<hr />
299308
</ul>

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,13 @@ const ReportTable = (props) => {
14561456
<i className={act.btnIcon}></i>
14571457
{act.btnLabel && (
14581458
<span className="uppercase font-medium">
1459-
{t(`btnLabel.${act.btnLabel}`)}
1459+
{act.btnLabel.includes(
1460+
"Quick send"
1461+
) && isEnableSubscription
1462+
? "Bulk Send"
1463+
: `${t(
1464+
`btnLabel.${act.btnLabel}`
1465+
)}`}
14601466
</span>
14611467
)}
14621468
{isOption[item.objectId] &&
@@ -1783,7 +1789,11 @@ const ReportTable = (props) => {
17831789
{isBulkSend[item.objectId] && (
17841790
<ModalUi
17851791
isOpen
1786-
title={t("quick-send")}
1792+
title={
1793+
isEnableSubscription
1794+
? "Bulk send"
1795+
: t("quick-send")
1796+
}
17871797
handleClose={() => setIsBulkSend({})}
17881798
>
17891799
{isLoader[item.objectId] ? (

0 commit comments

Comments
 (0)