@opexa/portal-components 0.0.998 → 0.0.1000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,7 +52,7 @@ export function IdentityVerification() {
|
|
|
52
52
|
return prev;
|
|
53
53
|
return {
|
|
54
54
|
...prev,
|
|
55
|
-
status: '
|
|
55
|
+
status: 'CREATED',
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
kyc.setStep(2);
|
|
@@ -76,7 +76,7 @@ export function IdentityVerification() {
|
|
|
76
76
|
return prev;
|
|
77
77
|
return {
|
|
78
78
|
...prev,
|
|
79
|
-
status: '
|
|
79
|
+
status: 'CREATED',
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
82
|
kyc.setStep(2);
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useIsMutating } from '@tanstack/react-query';
|
|
3
2
|
import { useEffect } from 'react';
|
|
4
3
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
5
4
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
6
5
|
import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
|
|
7
|
-
import { getApproveMemberVerificationQueryKey, getCreateMemberVerificationQueryKey, } from '../../utils/mutationKeys.js';
|
|
8
6
|
export function KycOpenOnHomeMount(props) {
|
|
9
7
|
const setkycReminderOpen = useGlobalStore((s) => s.kycReminder.setOpen);
|
|
10
8
|
const setkycOpen = useGlobalStore((s) => s.kyc.setOpen);
|
|
11
9
|
const isSignUpOpen = useGlobalStore((s) => s.signUp.open);
|
|
12
|
-
const { data: verification, isLoading: verificationLoading
|
|
10
|
+
const { data: verification, isLoading: verificationLoading } = useMemberVerificationQuery();
|
|
13
11
|
const { data: account, isLoading: accountLoading } = useAccountQuery();
|
|
14
|
-
const isCreatingVerification = useIsMutating({
|
|
15
|
-
mutationKey: getCreateMemberVerificationQueryKey(),
|
|
16
|
-
});
|
|
17
|
-
const isApprovingVerification = useIsMutating({
|
|
18
|
-
mutationKey: getApproveMemberVerificationQueryKey(),
|
|
19
|
-
});
|
|
20
|
-
const isMutating = isCreatingVerification > 0 || isApprovingVerification > 0;
|
|
21
12
|
const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
|
|
22
13
|
const isRejected = verification?.status === 'REJECTED';
|
|
23
14
|
const isUnverified = verification === null ||
|
|
@@ -32,63 +23,53 @@ export function KycOpenOnHomeMount(props) {
|
|
|
32
23
|
if (props.bypassKycCheck) {
|
|
33
24
|
return;
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const hasSeenKycModal = sessionStorage.getItem('hasSeenKycModal');
|
|
43
|
-
const isFirstVisit = !hasSeenKycModal;
|
|
26
|
+
if (!verificationLoading && !accountLoading && !isSignUpOpen) {
|
|
27
|
+
const shouldShowReminder = Boolean(props.isSkippable);
|
|
28
|
+
const hasSeenKycModal = sessionStorage.getItem('hasSeenKycModal');
|
|
29
|
+
const isFirstVisit = !hasSeenKycModal;
|
|
30
|
+
if (isKycCompleted) {
|
|
31
|
+
setkycReminderOpen(false);
|
|
32
|
+
setkycOpen(false);
|
|
44
33
|
if (isKycCompleted) {
|
|
34
|
+
sessionStorage.removeItem('hasSeenKycModal');
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// Handle rejected verification status
|
|
39
|
+
else if (isRejected) {
|
|
40
|
+
if (isFirstVisit) {
|
|
45
41
|
setkycReminderOpen(false);
|
|
46
|
-
setkycOpen(
|
|
47
|
-
|
|
48
|
-
sessionStorage.removeItem('hasSeenKycModal');
|
|
49
|
-
}
|
|
50
|
-
return;
|
|
42
|
+
setkycOpen(true);
|
|
43
|
+
sessionStorage.setItem('hasSeenKycModal', 'true');
|
|
51
44
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
setkycOpen(false);
|
|
56
|
-
return;
|
|
45
|
+
else {
|
|
46
|
+
setkycReminderOpen(shouldShowReminder);
|
|
47
|
+
setkycOpen(!shouldShowReminder);
|
|
57
48
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
else {
|
|
66
|
-
setkycReminderOpen(shouldShowReminder);
|
|
67
|
-
setkycOpen(!shouldShowReminder);
|
|
68
|
-
}
|
|
49
|
+
}
|
|
50
|
+
// Handle unverified verification status
|
|
51
|
+
else if (isUnverified) {
|
|
52
|
+
if (isFirstVisit) {
|
|
53
|
+
setkycReminderOpen(false);
|
|
54
|
+
setkycOpen(true);
|
|
55
|
+
sessionStorage.setItem('hasSeenKycModal', 'true');
|
|
69
56
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
setkycReminderOpen(false);
|
|
74
|
-
setkycOpen(true);
|
|
75
|
-
sessionStorage.setItem('hasSeenKycModal', 'true');
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
setkycReminderOpen(shouldShowReminder);
|
|
79
|
-
setkycOpen(!shouldShowReminder);
|
|
80
|
-
}
|
|
57
|
+
else {
|
|
58
|
+
setkycReminderOpen(shouldShowReminder);
|
|
59
|
+
setkycOpen(!shouldShowReminder);
|
|
81
60
|
}
|
|
82
61
|
}
|
|
83
|
-
|
|
84
|
-
|
|
62
|
+
else if (isVerificationLocked) {
|
|
63
|
+
setkycReminderOpen(true);
|
|
64
|
+
setkycOpen(false);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
85
68
|
}, [
|
|
86
69
|
setkycReminderOpen,
|
|
87
70
|
setkycOpen,
|
|
88
71
|
verificationLoading,
|
|
89
72
|
accountLoading,
|
|
90
|
-
verificationRefetching,
|
|
91
|
-
isMutating,
|
|
92
73
|
isSignUpOpen,
|
|
93
74
|
isVerificationLocked,
|
|
94
75
|
isRejected,
|
|
@@ -113,6 +113,7 @@ export function MobileNumberSignIn() {
|
|
|
113
113
|
console.warn('Failed to updated biometric credentials');
|
|
114
114
|
globalStore.signIn.setOpen(!globalStore.signIn.open);
|
|
115
115
|
}
|
|
116
|
+
globalStore.disclaimer.setOpen(true);
|
|
116
117
|
}
|
|
117
118
|
else {
|
|
118
119
|
console.error('Failed to create token');
|