@@ -6,8 +6,11 @@ import { useTranslation } from "react-i18next";
6
6
import Parse from "parse" ;
7
7
import ModalUi from "../primitives/ModalUi" ;
8
8
import { isEnableSubscription } from "../constant/const" ;
9
+ import { fetchSubscription } from "../constant/Utils" ;
10
+ import { useNavigate } from "react-router-dom" ;
9
11
const BulkSendUi = ( props ) => {
10
12
const { t } = useTranslation ( ) ;
13
+ const navigate = useNavigate ( ) ;
11
14
const [ forms , setForms ] = useState ( [ ] ) ;
12
15
const [ formId , setFormId ] = useState ( 2 ) ;
13
16
const formRef = useRef ( null ) ;
@@ -25,6 +28,7 @@ const BulkSendUi = (props) => {
25
28
} ) ;
26
29
const [ isQuotaReached , setIsQuotaReached ] = useState ( false ) ;
27
30
const [ isLoader , setIsLoader ] = useState ( false ) ;
31
+ const [ isFreePlan , setIsFreePlan ] = useState ( false ) ;
28
32
const allowedSigners = 50 ;
29
33
useEffect ( ( ) => {
30
34
signatureExist ( ) ;
@@ -36,6 +40,10 @@ const BulkSendUi = (props) => {
36
40
if ( isEnableSubscription ) {
37
41
setIsLoader ( true ) ;
38
42
try {
43
+ const subscription = await fetchSubscription ( ) ;
44
+ if ( subscription ?. plan === "freeplan" ) {
45
+ setIsFreePlan ( true ) ;
46
+ }
39
47
const allowedquicksend = await Parse . Cloud . run ( "allowedquicksend" ) ;
40
48
if ( allowedquicksend > 0 ) {
41
49
setIsBulkAvailable ( true ) ;
@@ -273,6 +281,9 @@ const BulkSendUi = (props) => {
273
281
const handleCloseQuotaReached = ( ) => {
274
282
setIsQuotaReached ( false ) ;
275
283
} ;
284
+ const handleNavigation = ( ) => {
285
+ navigate ( "/subscription" ) ;
286
+ } ;
276
287
return (
277
288
< >
278
289
{ isLoader ? (
@@ -385,46 +396,62 @@ const BulkSendUi = (props) => {
385
396
) }
386
397
</ >
387
398
) : (
388
- < form onSubmit = { handleAddOnQuickSubmit } className = "p-3" >
389
- < p className = "flex justify-center text-center mx-2 mb-3 text-base op-text-accent font-medium" >
390
- { t ( "additional-quicksend" ) }
391
- </ p >
392
- < div className = "mb-3 flex justify-between" >
393
- < label
394
- htmlFor = "quantity"
395
- className = "block text-xs text-gray-700 font-semibold"
396
- >
397
- { t ( "quantityofquicksend" ) }
398
- < span className = "text-[red] text-[13px]" > *</ span >
399
- </ label >
400
- < select
401
- value = { amount . quantity }
402
- onChange = { ( e ) => handlePricePerQuick ( e ) }
403
- name = "quantity"
404
- className = "op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content w-1/4 text-xs"
405
- required
406
- >
407
- { quantityList . length > 0 &&
408
- quantityList . map ( ( x ) => (
409
- < option key = { x } value = { x } >
410
- { x }
411
- </ option >
412
- ) ) }
413
- </ select >
414
- </ div >
415
- < div className = "mb-3 flex justify-between" >
416
- < label className = "block text-xs text-gray-700 font-semibold" >
417
- { t ( "Price" ) } (1 * { amount . priceperbulksend } )
418
- </ label >
419
- < div className = "w-1/4 flex justify-center items-center text-sm" >
420
- USD { amount . price }
399
+ < >
400
+ { isFreePlan ? (
401
+ < div className = "w-full h-[130px] flex flex-col justify-center items-center text-center p-4" >
402
+ < p className = "text-base font-medium mb-2.5" >
403
+ Please upgrade to Professional or Team plan to use quicksend
404
+ </ p >
405
+ < button
406
+ onClick = { ( ) => handleNavigation ( ) }
407
+ className = "op-btn op-btn-primary"
408
+ >
409
+ Upgrade Now
410
+ </ button >
421
411
</ div >
422
- </ div >
423
- < hr className = "text-base-content mb-3" />
424
- < button className = "op-btn op-btn-primary w-full mt-2" >
425
- { t ( "Proceed" ) }
426
- </ button >
427
- </ form >
412
+ ) : (
413
+ < form onSubmit = { handleAddOnQuickSubmit } className = "p-3" >
414
+ < p className = "flex justify-center text-center mx-2 mb-3 text-base op-text-accent font-medium" >
415
+ { t ( "additional-quicksend" ) }
416
+ </ p >
417
+ < div className = "mb-3 flex justify-between" >
418
+ < label
419
+ htmlFor = "quantity"
420
+ className = "block text-xs text-gray-700 font-semibold"
421
+ >
422
+ { t ( "quantityofquicksend" ) }
423
+ < span className = "text-[red] text-[13px]" > *</ span >
424
+ </ label >
425
+ < select
426
+ value = { amount . quantity }
427
+ onChange = { ( e ) => handlePricePerQuick ( e ) }
428
+ name = "quantity"
429
+ className = "op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content w-1/4 text-xs"
430
+ required
431
+ >
432
+ { quantityList . length > 0 &&
433
+ quantityList . map ( ( x ) => (
434
+ < option key = { x } value = { x } >
435
+ { x }
436
+ </ option >
437
+ ) ) }
438
+ </ select >
439
+ </ div >
440
+ < div className = "mb-3 flex justify-between" >
441
+ < label className = "block text-xs text-gray-700 font-semibold" >
442
+ { t ( "Price" ) } (1 * { amount . priceperbulksend } )
443
+ </ label >
444
+ < div className = "w-1/4 flex justify-center items-center text-sm" >
445
+ USD { amount . price }
446
+ </ div >
447
+ </ div >
448
+ < hr className = "text-base-content mb-3" />
449
+ < button className = "op-btn op-btn-primary w-full mt-2" >
450
+ { t ( "Proceed" ) }
451
+ </ button >
452
+ </ form >
453
+ ) }
454
+ </ >
428
455
) }
429
456
</ >
430
457
) }
0 commit comments