@@ -24,7 +24,7 @@ const BulkSendUi = (props) => {
24
24
price : ( 75.0 ) . toFixed ( 2 ) ,
25
25
quantity : 500 ,
26
26
priceperbulksend : 0.15 ,
27
- totalQuickSend : 0
27
+ totalcredits : 0
28
28
} ) ;
29
29
const [ isQuotaReached , setIsQuotaReached ] = useState ( false ) ;
30
30
const [ isLoader , setIsLoader ] = useState ( false ) ;
@@ -44,11 +44,16 @@ const BulkSendUi = (props) => {
44
44
if ( subscription ?. plan === "freeplan" ) {
45
45
setIsFreePlan ( true ) ;
46
46
}
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 } ) ) ;
50
56
}
51
- setAmount ( ( obj ) => ( { ...obj , totalQuickSend : allowedquicksend } ) ) ;
52
57
const getPlaceholder = props . item ?. Placeholders ;
53
58
const checkIsSignatureExistt = getPlaceholder ?. every ( ( placeholderObj ) =>
54
59
placeholderObj ?. placeHolder ?. some ( ( holder ) =>
@@ -121,7 +126,7 @@ const BulkSendUi = (props) => {
121
126
const handleAddForm = ( e ) => {
122
127
e . preventDefault ( ) ;
123
128
// Check if the quick send limit has been reached
124
- if ( isEnableSubscription && forms . length >= amount . totalQuickSend ) {
129
+ if ( isEnableSubscription && forms . length >= amount . totalcredits ) {
125
130
setIsQuotaReached ( true ) ;
126
131
} else {
127
132
if ( forms ?. length < allowedForm ) {
@@ -244,8 +249,8 @@ const BulkSendUi = (props) => {
244
249
e . stopPropagation ( ) ;
245
250
setIsSubmit ( true ) ;
246
251
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
249
254
} ) ;
250
255
if ( resAddon ) {
251
256
const _resAddon = JSON . parse ( JSON . stringify ( resAddon ) ) ;
@@ -257,7 +262,7 @@ const BulkSendUi = (props) => {
257
262
quantity : 500 ,
258
263
priceperbulksend : 0.15 ,
259
264
price : ( 75.0 ) . toFixed ( 2 ) ,
260
- totalQuickSend : _resAddon . addon
265
+ totalcredits : _resAddon . addon
261
266
} ) ) ;
262
267
}
263
268
}
@@ -345,13 +350,15 @@ const BulkSendUi = (props) => {
345
350
) ) }
346
351
</ div >
347
352
< 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
+ ) }
355
362
< button
356
363
type = "submit"
357
364
className = "op-btn op-btn-accent focus:outline-none"
0 commit comments