@@ -2,8 +2,9 @@ import Modal from "@/components/ui/Modal";
2
2
import { useTranslation } from "next-i18next" ;
3
3
import ArrowButton from "@/components/ui/button/Arrow" ;
4
4
import { useSelector } from "@/hooks/useTypedSelector" ;
5
- import { closeVerificationModal , launchWebSdk , triggerCompleteAction } from "@/store/feature/kyc.slice" ;
5
+ import { KYCSTATUS , closeVerificationModal , launchWebSdk , triggerCompleteAction } from "@/store/feature/kyc.slice" ;
6
6
import { useDispatch } from "@/hooks/useTypedDispatch" ;
7
+ import { useMemo } from "react" ;
7
8
8
9
/**
9
10
* KYCVerification Props Interface
@@ -32,8 +33,9 @@ export default function KYCVerification({ onCompleted }: KYCVerificationProps) {
32
33
33
34
const verificationData = useSelector ( ( state ) => state . sumsubVerification ) ;
34
35
35
- const { showModal, completed, completedText, description, verifying, completedActionText, actionText, loading, title } = verificationData ;
36
-
36
+ const { showModal, completed, verifying, completedActionText, actionText, loading, title } = verificationData ;
37
+ const user = useSelector ( ( state ) => state . user . data ) ;
38
+
37
39
const closeModal = ( ) => {
38
40
dispatch ( closeVerificationModal ( ) ) ;
39
41
} ;
@@ -48,13 +50,20 @@ export default function KYCVerification({ onCompleted }: KYCVerificationProps) {
48
50
triggerCompleteAction ( ) ;
49
51
} ;
50
52
53
+ const statuMessage = useMemo ( ( ) => {
54
+ if ( user ?. kycStatus === KYCSTATUS . VERIFIED ) return t ( "kyc.default.completed" ) ;
55
+ if ( user ?. kycStatus === KYCSTATUS . PENDING ) return "Your verification is currently being processed. Thank you for your patience" ;
56
+ if ( user ?. kycStatus === KYCSTATUS . REJECTED ) return "We regret to inform you that your verification process has been rejected. Please review your submitted information and try again." ;
57
+ return t ( "kyc.default.reason" ) ;
58
+ } , [ user ?. kycStatus ] ) ;
59
+
51
60
return (
52
61
< Modal show = { showModal } onClose = { closeModal } >
53
62
< div className = "px-6 py-6" >
54
63
{ ! verifying ? (
55
64
< div className = "flex flex-col text-left" >
56
65
< h1 className = "text-.5xl leading-snug font-medium" > { title || t ( "kyc.default.title" ) } </ h1 >
57
- < p className = "pt-8" > { completed ? completedText || t ( "kyc.default.completed" ) : description || t ( "kyc.default.reason" ) } </ p >
66
+ < p className = "pt-8" > { statuMessage } </ p >
58
67
</ div >
59
68
) : (
60
69
< > </ >
0 commit comments