@finspringinnovations/fdsdk 0.0.1

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.
Files changed (315) hide show
  1. package/README.md +184 -0
  2. package/lib/api/applicationApi.d.ts +1 -0
  3. package/lib/api/applicationApi.js +11 -0
  4. package/lib/api/bankApi.d.ts +352 -0
  5. package/lib/api/bankApi.js +54 -0
  6. package/lib/api/baseApi.d.ts +8 -0
  7. package/lib/api/baseApi.js +456 -0
  8. package/lib/api/customerApi.d.ts +855 -0
  9. package/lib/api/customerApi.js +213 -0
  10. package/lib/api/fdApi.d.ts +979 -0
  11. package/lib/api/fdApi.js +112 -0
  12. package/lib/api/fdCalculatorApi.d.ts +179 -0
  13. package/lib/api/fdCalculatorApi.js +36 -0
  14. package/lib/api/index.d.ts +14 -0
  15. package/lib/api/index.js +45 -0
  16. package/lib/api/interestRateApi.d.ts +585 -0
  17. package/lib/api/interestRateApi.js +101 -0
  18. package/lib/api/kycApi.d.ts +486 -0
  19. package/lib/api/kycApi.js +71 -0
  20. package/lib/api/masterDataApi.d.ts +158 -0
  21. package/lib/api/masterDataApi.js +32 -0
  22. package/lib/api/nomineeApi.d.ts +325 -0
  23. package/lib/api/nomineeApi.js +46 -0
  24. package/lib/api/onboardingApi.d.ts +192 -0
  25. package/lib/api/onboardingApi.js +41 -0
  26. package/lib/api/panApi.d.ts +0 -0
  27. package/lib/api/panApi.js +23 -0
  28. package/lib/api/paymentApi.d.ts +325 -0
  29. package/lib/api/paymentApi.js +46 -0
  30. package/lib/api/workflowApi.d.ts +654 -0
  31. package/lib/api/workflowApi.js +90 -0
  32. package/lib/assets/images/images.d.ts +4 -0
  33. package/lib/assets/images/images.js +10 -0
  34. package/lib/components/AadhaarInput.d.ts +13 -0
  35. package/lib/components/AadhaarInput.js +47 -0
  36. package/lib/components/ActionButton.d.ts +12 -0
  37. package/lib/components/ActionButton.js +87 -0
  38. package/lib/components/ActiveFDCard.d.ts +16 -0
  39. package/lib/components/ActiveFDCard.js +95 -0
  40. package/lib/components/AmountInput.d.ts +20 -0
  41. package/lib/components/AmountInput.js +144 -0
  42. package/lib/components/CheckboxOption.d.ts +11 -0
  43. package/lib/components/CheckboxOption.js +41 -0
  44. package/lib/components/CompanyHeader.d.ts +7 -0
  45. package/lib/components/CompanyHeader.js +57 -0
  46. package/lib/components/DropdownSelector.d.ts +9 -0
  47. package/lib/components/DropdownSelector.js +49 -0
  48. package/lib/components/EmptyState.d.ts +17 -0
  49. package/lib/components/EmptyState.js +44 -0
  50. package/lib/components/ErrorDisplay.d.ts +17 -0
  51. package/lib/components/ErrorDisplay.js +69 -0
  52. package/lib/components/FAQItem.d.ts +9 -0
  53. package/lib/components/FAQItem.js +52 -0
  54. package/lib/components/FDCard.d.ts +21 -0
  55. package/lib/components/FDCard.js +96 -0
  56. package/lib/components/FormDropdown.d.ts +18 -0
  57. package/lib/components/FormDropdown.js +155 -0
  58. package/lib/components/FormSection.d.ts +14 -0
  59. package/lib/components/FormSection.js +38 -0
  60. package/lib/components/Header.d.ts +14 -0
  61. package/lib/components/Header.js +52 -0
  62. package/lib/components/IFSCSearchResultCard.d.ts +13 -0
  63. package/lib/components/IFSCSearchResultCard.js +70 -0
  64. package/lib/components/InfoBox.d.ts +8 -0
  65. package/lib/components/InfoBox.js +39 -0
  66. package/lib/components/InterestRateCard.d.ts +8 -0
  67. package/lib/components/InterestRateCard.js +46 -0
  68. package/lib/components/LoadingIndicator.d.ts +12 -0
  69. package/lib/components/LoadingIndicator.js +30 -0
  70. package/lib/components/OTPInput.d.ts +17 -0
  71. package/lib/components/OTPInput.js +144 -0
  72. package/lib/components/PaymentDetailsCard.d.ts +20 -0
  73. package/lib/components/PaymentDetailsCard.js +68 -0
  74. package/lib/components/PendingFDBottomSheet.d.ts +18 -0
  75. package/lib/components/PendingFDBottomSheet.js +122 -0
  76. package/lib/components/SafeAreaWrapper.d.ts +13 -0
  77. package/lib/components/SafeAreaWrapper.js +41 -0
  78. package/lib/components/ScreenHeader.d.ts +11 -0
  79. package/lib/components/ScreenHeader.js +46 -0
  80. package/lib/components/StatusDisplay.d.ts +15 -0
  81. package/lib/components/StatusDisplay.js +88 -0
  82. package/lib/components/TextFieldWithLabel.d.ts +46 -0
  83. package/lib/components/TextFieldWithLabel.js +326 -0
  84. package/lib/components/TrustBox.d.ts +8 -0
  85. package/lib/components/TrustBox.js +45 -0
  86. package/lib/components/ValidationErrorAlert.d.ts +23 -0
  87. package/lib/components/ValidationErrorAlert.js +39 -0
  88. package/lib/components/ValidationMessage.d.ts +9 -0
  89. package/lib/components/ValidationMessage.js +98 -0
  90. package/lib/components/index.d.ts +35 -0
  91. package/lib/components/index.js +64 -0
  92. package/lib/config/apiConfig.d.ts +34 -0
  93. package/lib/config/apiConfig.js +158 -0
  94. package/lib/config/appDataConfig.d.ts +114 -0
  95. package/lib/config/appDataConfig.js +264 -0
  96. package/lib/config/encryptionConfig.d.ts +21 -0
  97. package/lib/config/encryptionConfig.js +61 -0
  98. package/lib/config/workflowConstants.d.ts +37 -0
  99. package/lib/config/workflowConstants.js +38 -0
  100. package/lib/constants/strings/bank.d.ts +72 -0
  101. package/lib/constants/strings/bank.js +86 -0
  102. package/lib/constants/strings/base64Images.d.ts +25 -0
  103. package/lib/constants/strings/base64Images.js +28 -0
  104. package/lib/constants/strings/common.d.ts +53 -0
  105. package/lib/constants/strings/common.js +62 -0
  106. package/lib/constants/strings/employee.d.ts +61 -0
  107. package/lib/constants/strings/employee.js +77 -0
  108. package/lib/constants/strings/faq.d.ts +14 -0
  109. package/lib/constants/strings/faq.js +20 -0
  110. package/lib/constants/strings/fd.d.ts +122 -0
  111. package/lib/constants/strings/fd.js +151 -0
  112. package/lib/constants/strings/home.d.ts +49 -0
  113. package/lib/constants/strings/home.js +62 -0
  114. package/lib/constants/strings/index.d.ts +16 -0
  115. package/lib/constants/strings/index.js +44 -0
  116. package/lib/constants/strings/kyc.d.ts +80 -0
  117. package/lib/constants/strings/kyc.js +94 -0
  118. package/lib/constants/strings/nominee.d.ts +64 -0
  119. package/lib/constants/strings/nominee.js +81 -0
  120. package/lib/hooks/useAuth.d.ts +25 -0
  121. package/lib/hooks/useAuth.js +39 -0
  122. package/lib/hooks/useFDData.d.ts +11 -0
  123. package/lib/hooks/useFDData.js +40 -0
  124. package/lib/index.d.ts +69 -0
  125. package/lib/index.js +182 -0
  126. package/lib/navigation/RootNavigator.d.ts +8 -0
  127. package/lib/navigation/RootNavigator.js +205 -0
  128. package/lib/navigation/SimpleNavigator.d.ts +11 -0
  129. package/lib/navigation/SimpleNavigator.js +107 -0
  130. package/lib/navigation/helpers.d.ts +11 -0
  131. package/lib/navigation/helpers.js +83 -0
  132. package/lib/navigation/index.d.ts +15 -0
  133. package/lib/navigation/index.js +42 -0
  134. package/lib/navigation/types.d.ts +113 -0
  135. package/lib/navigation/types.js +2 -0
  136. package/lib/navigation/workflowNavigator.d.ts +22 -0
  137. package/lib/navigation/workflowNavigator.js +104 -0
  138. package/lib/providers/ApiProvider.d.ts +7 -0
  139. package/lib/providers/ApiProvider.js +34 -0
  140. package/lib/providers/MasterDataProvider.d.ts +10 -0
  141. package/lib/providers/MasterDataProvider.js +54 -0
  142. package/lib/screens/AadhaarVerification.d.ts +7 -0
  143. package/lib/screens/AadhaarVerification.js +627 -0
  144. package/lib/screens/AddBankAccount.d.ts +22 -0
  145. package/lib/screens/AddBankAccount.js +381 -0
  146. package/lib/screens/BankDetail.d.ts +16 -0
  147. package/lib/screens/BankDetail.js +596 -0
  148. package/lib/screens/BookFD.d.ts +0 -0
  149. package/lib/screens/BookFD.js +315 -0
  150. package/lib/screens/Employee.d.ts +18 -0
  151. package/lib/screens/Employee.js +594 -0
  152. package/lib/screens/FDCalculator.d.ts +18 -0
  153. package/lib/screens/FDCalculator.js +759 -0
  154. package/lib/screens/FDList.d.ts +27 -0
  155. package/lib/screens/FDList.js +1008 -0
  156. package/lib/screens/FindIFSC.d.ts +16 -0
  157. package/lib/screens/FindIFSC.js +248 -0
  158. package/lib/screens/Home.d.ts +0 -0
  159. package/lib/screens/Home.js +143 -0
  160. package/lib/screens/NomineeDetail.d.ts +17 -0
  161. package/lib/screens/NomineeDetail.js +592 -0
  162. package/lib/screens/PayNow.d.ts +14 -0
  163. package/lib/screens/PayNow.js +230 -0
  164. package/lib/screens/Payment.d.ts +11 -0
  165. package/lib/screens/Payment.js +191 -0
  166. package/lib/screens/PaymentStatus.d.ts +16 -0
  167. package/lib/screens/PaymentStatus.js +397 -0
  168. package/lib/screens/ReviewKYC.d.ts +21 -0
  169. package/lib/screens/ReviewKYC.js +660 -0
  170. package/lib/state/paymentSession.d.ts +8 -0
  171. package/lib/state/paymentSession.js +13 -0
  172. package/lib/store/fdListSelectedSlice.d.ts +21 -0
  173. package/lib/store/fdListSelectedSlice.js +26 -0
  174. package/lib/store/hooks.d.ts +8 -0
  175. package/lib/store/hooks.js +31 -0
  176. package/lib/store/index.d.ts +3 -0
  177. package/lib/store/index.js +8 -0
  178. package/lib/store/onboardingSlice.d.ts +12 -0
  179. package/lib/store/onboardingSlice.js +32 -0
  180. package/lib/store/store.d.ts +13 -0
  181. package/lib/store/store.js +33 -0
  182. package/lib/theme/ThemeContext.d.ts +210 -0
  183. package/lib/theme/ThemeContext.js +90 -0
  184. package/lib/theme/colors.d.ts +80 -0
  185. package/lib/theme/colors.js +85 -0
  186. package/lib/theme/index.d.ts +34 -0
  187. package/lib/theme/index.js +69 -0
  188. package/lib/theme/shadows.d.ts +53 -0
  189. package/lib/theme/shadows.js +58 -0
  190. package/lib/theme/typography.d.ts +134 -0
  191. package/lib/theme/typography.js +143 -0
  192. package/lib/types/dataTypes.d.ts +34 -0
  193. package/lib/types/dataTypes.js +2 -0
  194. package/lib/types/workflowTypes.d.ts +2 -0
  195. package/lib/types/workflowTypes.js +2 -0
  196. package/lib/utils/apiLogger.d.ts +48 -0
  197. package/lib/utils/apiLogger.js +105 -0
  198. package/lib/utils/encryption.d.ts +28 -0
  199. package/lib/utils/encryption.js +113 -0
  200. package/lib/utils/getFDData.d.ts +48 -0
  201. package/lib/utils/getFDData.js +154 -0
  202. package/lib/utils/globalData.d.ts +2 -0
  203. package/lib/utils/globalData.js +10 -0
  204. package/package.json +76 -0
  205. package/src/api/applicationApi.ts +12 -0
  206. package/src/api/bankApi.ts +42 -0
  207. package/src/api/baseApi.ts +513 -0
  208. package/src/api/customerApi.ts +291 -0
  209. package/src/api/fdApi.ts +150 -0
  210. package/src/api/fdCalculatorApi.ts +41 -0
  211. package/src/api/index.ts +29 -0
  212. package/src/api/interestRateApi.ts +143 -0
  213. package/src/api/kycApi.ts +63 -0
  214. package/src/api/masterDataApi.ts +34 -0
  215. package/src/api/nomineeApi.ts +34 -0
  216. package/src/api/onboardingApi.ts +64 -0
  217. package/src/api/panApi.ts +25 -0
  218. package/src/api/paymentApi.ts +34 -0
  219. package/src/api/workflowApi.ts +94 -0
  220. package/src/assets/images/arrow-filled.png +0 -0
  221. package/src/assets/images/arrow-left.png +0 -0
  222. package/src/assets/images/backicon.png +0 -0
  223. package/src/assets/images/calendar.png +0 -0
  224. package/src/assets/images/chevron-down.png +0 -0
  225. package/src/assets/images/chevron-down@2x.png +0 -0
  226. package/src/assets/images/chevron-down@3x.png +0 -0
  227. package/src/assets/images/images.js +8 -0
  228. package/src/components/AadhaarInput.tsx +91 -0
  229. package/src/components/ActionButton.tsx +129 -0
  230. package/src/components/ActiveFDCard.tsx +158 -0
  231. package/src/components/AmountInput.tsx +217 -0
  232. package/src/components/CheckboxOption.tsx +93 -0
  233. package/src/components/CompanyHeader.tsx +78 -0
  234. package/src/components/DropdownSelector.tsx +77 -0
  235. package/src/components/EmptyState.tsx +109 -0
  236. package/src/components/ErrorDisplay.tsx +135 -0
  237. package/src/components/FAQItem.tsx +90 -0
  238. package/src/components/FDCard.tsx +165 -0
  239. package/src/components/FormDropdown.tsx +214 -0
  240. package/src/components/FormSection.tsx +86 -0
  241. package/src/components/Header.tsx +110 -0
  242. package/src/components/IFSCSearchResultCard.tsx +139 -0
  243. package/src/components/InfoBox.tsx +55 -0
  244. package/src/components/InterestRateCard.tsx +77 -0
  245. package/src/components/LoadingIndicator.tsx +63 -0
  246. package/src/components/OTPInput.tsx +213 -0
  247. package/src/components/PaymentDetailsCard.tsx +120 -0
  248. package/src/components/PendingFDBottomSheet.tsx +235 -0
  249. package/src/components/README.md +210 -0
  250. package/src/components/SafeAreaWrapper.tsx +68 -0
  251. package/src/components/ScreenHeader.tsx +83 -0
  252. package/src/components/StatusDisplay.tsx +139 -0
  253. package/src/components/TextFieldWithLabel.tsx +502 -0
  254. package/src/components/TrustBox.tsx +63 -0
  255. package/src/components/ValidationErrorAlert.tsx +57 -0
  256. package/src/components/ValidationMessage.tsx +134 -0
  257. package/src/components/index.tsx +47 -0
  258. package/src/config/apiConfig.ts +217 -0
  259. package/src/config/appDataConfig.ts +279 -0
  260. package/src/config/encryptionConfig.ts +65 -0
  261. package/src/config/workflowConstants.ts +43 -0
  262. package/src/constants/strings/README.md +146 -0
  263. package/src/constants/strings/bank.ts +92 -0
  264. package/src/constants/strings/base64Images.ts +29 -0
  265. package/src/constants/strings/common.ts +63 -0
  266. package/src/constants/strings/employee.ts +85 -0
  267. package/src/constants/strings/faq.ts +23 -0
  268. package/src/constants/strings/fd.ts +172 -0
  269. package/src/constants/strings/home.ts +67 -0
  270. package/src/constants/strings/index.ts +21 -0
  271. package/src/constants/strings/kyc.ts +100 -0
  272. package/src/constants/strings/nominee.ts +90 -0
  273. package/src/hooks/useAuth.ts +42 -0
  274. package/src/hooks/useFDData.ts +48 -0
  275. package/src/index.tsx +173 -0
  276. package/src/navigation/RootNavigator.tsx +352 -0
  277. package/src/navigation/SimpleNavigator.tsx +107 -0
  278. package/src/navigation/helpers.ts +85 -0
  279. package/src/navigation/index.tsx +81 -0
  280. package/src/navigation/types.ts +124 -0
  281. package/src/navigation/workflowNavigator.ts +131 -0
  282. package/src/providers/ApiProvider.tsx +43 -0
  283. package/src/providers/MasterDataProvider.tsx +30 -0
  284. package/src/screens/AadhaarVerification.tsx +809 -0
  285. package/src/screens/AddBankAccount.tsx +541 -0
  286. package/src/screens/BankDetail.tsx +826 -0
  287. package/src/screens/BookFD.tsx +330 -0
  288. package/src/screens/Employee.tsx +822 -0
  289. package/src/screens/FDCalculator.tsx +987 -0
  290. package/src/screens/FDList.tsx +1284 -0
  291. package/src/screens/FindIFSC.tsx +332 -0
  292. package/src/screens/Home.tsx +152 -0
  293. package/src/screens/NomineeDetail.tsx +800 -0
  294. package/src/screens/PayNow.tsx +282 -0
  295. package/src/screens/Payment.tsx +224 -0
  296. package/src/screens/PaymentStatus.tsx +561 -0
  297. package/src/screens/ReviewKYC.tsx +956 -0
  298. package/src/state/paymentSession.ts +13 -0
  299. package/src/store/fdListSelectedSlice.ts +42 -0
  300. package/src/store/hooks.ts +27 -0
  301. package/src/store/index.ts +3 -0
  302. package/src/store/onboardingSlice.ts +37 -0
  303. package/src/store/store.ts +35 -0
  304. package/src/theme/ThemeContext.tsx +82 -0
  305. package/src/theme/colors.ts +90 -0
  306. package/src/theme/index.ts +64 -0
  307. package/src/theme/shadows.ts +61 -0
  308. package/src/theme/typography.ts +151 -0
  309. package/src/types/dataTypes.ts +37 -0
  310. package/src/types/env.d.ts +93 -0
  311. package/src/types/workflowTypes.ts +12 -0
  312. package/src/utils/apiLogger.ts +166 -0
  313. package/src/utils/encryption.ts +159 -0
  314. package/src/utils/getFDData.ts +175 -0
  315. package/src/utils/globalData.ts +7 -0
@@ -0,0 +1,809 @@
1
+ // AadhaarVerification.tsx
2
+ import React, { useState, useEffect } from 'react';
3
+ import { View, Text, StyleSheet, Alert, KeyboardAvoidingView, Platform, ScrollView, Keyboard, ActivityIndicator, BackHandler } from 'react-native';
4
+ import SafeAreaWrapper from '../components/SafeAreaWrapper';
5
+ import { Header } from '../components';
6
+ import AadhaarInput from '../components/AadhaarInput';
7
+ import OTPInput from '../components/OTPInput';
8
+ import ValidationMessage from '../components/ValidationMessage';
9
+ import ActionButton from '../components/ActionButton';
10
+ import { useColors, useTypography } from '../theme/ThemeContext';
11
+ import { useEkycSendOtpMutation, useAadhaarVerifyOtpMutation } from '../api/kycApi';
12
+ import { WORKFLOW_TASKS } from '../config/workflowConstants';
13
+ import { useUpdateTaskMutation, useUpdateStateMutation, usePreviousStateMutation } from '../api/workflowApi';
14
+ import { useAppSelector } from '../store';
15
+ import { getUserInfoForAPI } from '../config/appDataConfig';
16
+ import { navigate } from '../navigation/helpers';
17
+ import { useGetCustomerApplicationDetailsMutation } from '../api/customerApi';
18
+ import { useRoute } from '@react-navigation/native';
19
+ import { getGlobalData } from '../utils/globalData';
20
+ import { KYC_STRINGS } from '../constants/strings/kyc';
21
+ import { COMMON_STRINGS } from '../constants/strings/common';
22
+
23
+ export interface AadhaarVerificationProps {
24
+ onGoBack?: () => void;
25
+ onVerificationComplete?: (aadhaarNumber: string) => void;
26
+
27
+ }
28
+
29
+
30
+ type VerificationState = 'initial' | 'otp' | 'verified';
31
+
32
+ const AadhaarVerification: React.FC<AadhaarVerificationProps> = ({
33
+ onGoBack,
34
+ onVerificationComplete,
35
+ }) => {
36
+ const colors = useColors();
37
+ const typography = useTypography();
38
+ const styles = React.useMemo(() => createStyles(colors, typography), [colors, typography]);
39
+ const workflowInstanceId = useAppSelector((state: any) => state?.onboarding?.workflowInstanceId);
40
+ const applicationId = useAppSelector((state: any) => state?.onboarding?.applicationId);
41
+ const entityId = useAppSelector((state: any) => state?.onboarding?.entityid);
42
+ const customerId = useAppSelector((state: any) => state?.onboarding?.customerId);
43
+ const wfStatus = useAppSelector((state: any) => state?.onboarding?.wfStatus);
44
+
45
+ const route = useRoute<any>();
46
+
47
+ const fdDataFromRoute = route?.params?.fdData;
48
+
49
+ // Function to get providerId dynamically (can be extended to get from app data or API)
50
+ const defultProviderId = useAppSelector((state: any) => state?.onboarding?.providerId);// Default Shriram provider ID
51
+
52
+ // API hooks
53
+ const [sendOtp, { isLoading: isSendingOtp }] = useEkycSendOtpMutation();
54
+ const [verifyOtp, { isLoading: isVerifyingOtp }] = useAadhaarVerifyOtpMutation();
55
+ const [updateTask, { isLoading: isUpdatingTask }] = useUpdateTaskMutation();
56
+ const [updateState, { isLoading: isUpdatingState }] = useUpdateStateMutation();
57
+ const [previousState] = usePreviousStateMutation();
58
+ const [getCustomerApplicationDetails] = useGetCustomerApplicationDetailsMutation();
59
+
60
+ // State management
61
+ const [verificationState, setVerificationState] = useState<VerificationState>('initial');
62
+ const [aadhaarNumber, setAadhaarNumber] = useState('');
63
+ const [isGoingBack, setIsGoingBack] = useState(false);
64
+ const [otp, setOtp] = useState(['', '', '', '', '', '']);
65
+ const [sessionTime, setSessionTime] = useState(120);
66
+ const [isResendEnabled, setIsResendEnabled] = useState(false);
67
+ const [aadhaarError, setAadhaarError] = useState<string>('');
68
+ const [aadhaarSuccess, setAadhaarSuccess] = useState<string>('');
69
+ const [transactionTime, setTransactionTime] = useState<string>('');
70
+ const [referenceNo, setReferenceNo] = useState<string>('');
71
+ const [isOtpVerified, setIsOtpVerified] = useState<boolean>(false);
72
+ const [isOtpLocked, setIsOtpLocked] = useState<boolean>(false);
73
+ const [otpVerificationError, setOtpVerificationError] = useState<string>('');
74
+ const [isValidateOtpTaskCalled, setIsValidateOtpTaskCalled] = useState<boolean>(false);
75
+ // If customer/application/details has Aadhaar already, show verified view
76
+ React.useEffect(() => {
77
+ const checkAadhaarStatus = async () => {
78
+ try {
79
+ if (!applicationId || !customerId) return;
80
+ const userInfo = getUserInfoForAPI();
81
+ const details = await getCustomerApplicationDetails({
82
+ providerId: defultProviderId,
83
+ applicationId: applicationId,
84
+ customerId: customerId,
85
+ workflowInstanceId,
86
+ userreferenceid: userInfo.userReferenceId,
87
+ applicationid: applicationId,
88
+ entityid: entityId,
89
+ }).unwrap();
90
+
91
+ // Check both root level and nested data structure
92
+ const rootAadhaar = details?.aadhaarNumber || details?.aadharNo || details?.aadhar || details?.aadhaar;
93
+ const payload: any = Array.isArray(details?.data) ? details.data[0] : (details?.data ?? details);
94
+ const nestedAadhaar = payload?.aadhaarNumber || payload?.aadharNo || payload?.aadhar || payload?.aadhaar;
95
+ const aadhaarFromApi: string | undefined = rootAadhaar || nestedAadhaar;
96
+
97
+ // API response processed
98
+
99
+ if (aadhaarFromApi) {
100
+ // Use the exact Aadhaar number from API response
101
+ const aadhaarStr = String(aadhaarFromApi);
102
+
103
+ setAadhaarNumber(aadhaarStr);
104
+
105
+
106
+ setVerificationState('verified');
107
+ setAadhaarSuccess(KYC_STRINGS.AADHAAR_ALREADY_VERIFIED);
108
+ }
109
+ } catch (e) {
110
+ // Non-blocking
111
+ }
112
+ };
113
+ checkAadhaarStatus();
114
+ // eslint-disable-next-line react-hooks/exhaustive-deps
115
+ }, [applicationId, customerId]);
116
+
117
+ // Auto send OTP when 12 digits are entered
118
+ const autoSendOtp = async (aadhaarNum: string) => {
119
+ // Start session timer
120
+ const timer = setInterval(() => {
121
+ setSessionTime((prev) => {
122
+ if (prev <= 1) {
123
+ clearInterval(timer);
124
+ setIsResendEnabled(true);
125
+ return 0;
126
+ }
127
+ return prev - 1;
128
+ });
129
+ }, 1000);
130
+
131
+ try {
132
+ const userInfo = getUserInfoForAPI();
133
+ const response = await sendOtp({
134
+ providerId: defultProviderId,
135
+ workflowInstanceId,
136
+ userreferenceid: userInfo.userReferenceId,
137
+ applicationid: applicationId,
138
+ entityid: entityId,
139
+ // body params
140
+ aadharNo: aadhaarNum,
141
+ panNo: userInfo.panNumber,
142
+ mobileNo: userInfo.mobileNumber,
143
+ isRetry: false,
144
+ }).unwrap();
145
+
146
+ // Always transition to OTP state first for better UX
147
+ setVerificationState('otp');
148
+
149
+ // Store transactionTime and referenceNo from response for verify API
150
+ // The response structure is: { data: [{ transactionTime: '...', referenceNo: '...' }], message: '...', status: '...' }
151
+ if (response?.data && Array.isArray(response.data) && response.data.length > 0) {
152
+ const responseData = response.data[0];
153
+ if (responseData?.transactionTime) {
154
+ setTransactionTime(responseData.transactionTime);
155
+ }
156
+ if (responseData?.referenceNo) {
157
+ setReferenceNo(responseData.referenceNo);
158
+ }
159
+ }
160
+
161
+ } catch (error) {
162
+
163
+ // Don't show alert immediately, let user try to enter OTP
164
+ // They can use resend if needed
165
+ setVerificationState('initial');
166
+
167
+ // If backend returns 400, show friendly error below the text field
168
+ const status = (error as any)?.status || (error as any)?.data?.statusCode;
169
+ // if (status === 400 || status === 500) {
170
+ setAadhaarError(KYC_STRINGS.AADHAAR_ERROR_GENERIC);
171
+ // }
172
+
173
+ // Hide timer and show resend button when API fails
174
+ setIsResendEnabled(true);
175
+ setSessionTime(0); // Hide timer text
176
+ }
177
+ };
178
+
179
+ // Format Aadhaar number with spaces (XXXX XXXX XXXX)
180
+ const formatAadhaarNumber = (number: string) => {
181
+ const cleaned = number.replace(/\s/g, '');
182
+ if (cleaned.length <= 4) return cleaned;
183
+ if (cleaned.length <= 8) return `${cleaned.slice(0, 4)} ${cleaned.slice(4)}`;
184
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 8)} ${cleaned.slice(8, 12)}`;
185
+ };
186
+
187
+ // Format Aadhaar number for display (show only first 4 digits, rest as XXXX)
188
+ const formatAadhaarForDisplay = (number: string) => {
189
+ const cleaned = number.replace(/\s/g, '');
190
+
191
+ // Check if it's already a masked format from API
192
+ if (cleaned.includes('X')) {
193
+ // Format masked Aadhaar with spaces: XXXX XXXX XXXX
194
+ if (cleaned.length === 12) {
195
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 8)} ${cleaned.slice(8, 12)}`;
196
+ }
197
+ return cleaned; // Return as-is if not 12 characters
198
+ }
199
+
200
+ // Handle regular Aadhaar numbers
201
+ if (cleaned.length < 4) return cleaned;
202
+ if (cleaned.length === 12) {
203
+ return `XXXX XXXX ${cleaned.slice(-4)}`;
204
+ }
205
+ return formatAadhaarNumber(number); // Show normal format while typing
206
+ };
207
+
208
+ // Handle Aadhaar number input
209
+ const handleAadhaarChange = (text: string) => {
210
+ const cleaned = text.replace(/\D/g, ''); // Remove non-digits
211
+ if (cleaned.length <= 12) {
212
+ // If user changes Aadhaar while in OTP/verified state, reset OTP flow
213
+ if (verificationState !== 'initial') {
214
+ setVerificationState('initial');
215
+ setOtp(['', '', '', '', '', '']);
216
+ setIsResendEnabled(false);
217
+ setSessionTime(120);
218
+ // Reset verification state when Aadhaar changes
219
+ setIsOtpVerified(false);
220
+ setOtpVerificationError('');
221
+ setIsOtpLocked(false);
222
+ // Reset VALIDATE_OTP task flag when Aadhaar changes
223
+ //setIsValidateOtpTaskCalled(false);
224
+ }
225
+
226
+ setAadhaarNumber(cleaned);
227
+
228
+ // Validate Aadhaar number
229
+ if (!cleaned) {
230
+ setAadhaarError('');
231
+ // setAadhaarSuccess('');
232
+ } else if (cleaned.length < 12) {
233
+ setAadhaarError(KYC_STRINGS.AADHAAR_MUST_BE_12_DIGITS);
234
+ // setAadhaarSuccess('');
235
+ } else if (cleaned.length === 12) {
236
+ setAadhaarError('');
237
+ // setAadhaarSuccess('Valid Aadhaar number');
238
+
239
+ // Auto send OTP and transition to OTP view when 12 digits are entered
240
+ if (verificationState === 'initial') {
241
+ // Small delay to show success message briefly before transitioning
242
+ setTimeout(() => {
243
+ autoSendOtp(cleaned);
244
+ }, 500);
245
+ }
246
+ }
247
+ }
248
+ };
249
+
250
+ // Handle OTP input
251
+ const handleOtpChange = (value: string, index: number) => {
252
+ if (value.length <= 1) {
253
+ const newOtp = [...otp];
254
+ newOtp[index] = value;
255
+ setOtp(newOtp);
256
+
257
+ // Reset verification state when user changes OTP
258
+ setIsOtpVerified(false);
259
+ setOtpVerificationError('');
260
+ // Reset VALIDATE_OTP task flag when OTP changes
261
+ // setIsValidateOtpTaskCalled(false);
262
+
263
+ // Check if all 6 digits are entered
264
+ if (newOtp.every(digit => digit !== '')) {
265
+ // Dismiss keyboard when all digits are entered
266
+ Keyboard.dismiss();
267
+ // Lock OTP input to prevent editing until user resends or changes Aadhaar
268
+ setIsOtpLocked(true);
269
+ // All digits entered, automatically verify OTP with the new OTP
270
+ handleVerifyOtpWithOtp(newOtp.join(''));
271
+ }
272
+ }
273
+ };
274
+
275
+ // Handle OTP backspace
276
+ const handleOtpKeyPress = (key: string, index: number) => {
277
+ // Logic is now handled in OTPInput component
278
+ };
279
+
280
+ // Note: handleContinueFromAadhaar is no longer needed as transition happens automatically
281
+ // when 12 digits are typed via autoSendOtp function
282
+
283
+ // Verify OTP with provided OTP string
284
+ const handleVerifyOtpWithOtp = async (otpString: string) => {
285
+ if (otpString.length === 6) {
286
+ try {
287
+ const userInfo = getUserInfoForAPI();
288
+
289
+ // 1) Update Task before verifying OTP (only if not already called)
290
+ if (!isValidateOtpTaskCalled) {
291
+ await updateTask({
292
+ providerId: defultProviderId,
293
+ workflowInstanceId,
294
+ userreferenceid: userInfo.userReferenceId,
295
+ applicationid: applicationId,
296
+ entityid: entityId,
297
+ // Request params/body
298
+ targetTaskId: WORKFLOW_TASKS.VALIDATE_OTP,
299
+ }).unwrap();
300
+ setIsValidateOtpTaskCalled(true);
301
+ } else {
302
+ }
303
+
304
+ // 2) Verify OTP
305
+
306
+ const response = await verifyOtp({
307
+ providerId: defultProviderId,
308
+ workflowInstanceId,
309
+ userreferenceid: userInfo.userReferenceId,
310
+ applicationid: applicationId,
311
+ entityid: entityId,
312
+ // body params
313
+ customerId: customerId,
314
+ transactionTime: transactionTime,
315
+ referenceNo: referenceNo,
316
+ applicationId: applicationId,
317
+ aadharNo: aadhaarNumber,
318
+ mobileNo: userInfo.mobileNumber,
319
+ otp: otpString,
320
+ }).unwrap();
321
+
322
+ // OTP verification successful; do not call updateState or navigate here.
323
+ // Enable Continue button via flags; navigation/state update will happen on Continue.
324
+ setIsOtpVerified(true);
325
+ setOtpVerificationError('');
326
+ setVerificationState('verified');
327
+ return;
328
+
329
+ } catch (error) {
330
+ // OTP verification failed
331
+ setIsOtpVerified(false);
332
+ setOtpVerificationError(KYC_STRINGS.INVALID_OR_EXPIRED_OTP);
333
+ // Re-enable OTP input so user can correct the code
334
+ setIsOtpLocked(false);
335
+ // Clear entered OTP to allow fresh input
336
+ setOtp(['', '', '', '', '', '']);
337
+ }
338
+ } else {
339
+ setIsOtpVerified(false);
340
+ setOtpVerificationError(KYC_STRINGS.OTP_INCOMPLETE);
341
+ }
342
+ };
343
+
344
+
345
+ // Resend OTP
346
+ const handleResendOtp = async () => {
347
+ try {
348
+ const userInfo = getUserInfoForAPI();
349
+
350
+ setIsValidateOtpTaskCalled(false);
351
+
352
+ // 1) First call updateTask API
353
+ const updateTaskResponse = await updateTask({
354
+ providerId: defultProviderId,
355
+ workflowInstanceId,
356
+ userreferenceid: userInfo.userReferenceId,
357
+ applicationid: applicationId,
358
+ entityid: entityId,
359
+ // Request params/body
360
+ targetTaskId: WORKFLOW_TASKS.RESEND_OTP,
361
+ }).unwrap();
362
+
363
+
364
+ // 2) Then call OTP API with the updateTask response
365
+ const response = await sendOtp({
366
+ providerId: defultProviderId,
367
+ workflowInstanceId,
368
+ userreferenceid: userInfo.userReferenceId,
369
+ applicationid: applicationId,
370
+ entityid: entityId,
371
+ // body params
372
+ aadharNo: aadhaarNumber,
373
+ panNo: userInfo.panNumber,
374
+ mobileNo: userInfo.mobileNumber,
375
+ isRetry: true,
376
+ }).unwrap();
377
+
378
+
379
+ // Store transactionTime and referenceNo from response for verify API
380
+ // The response structure is: { data: [{ transactionTime: '...', referenceNo: '...' }], message: '...', status: '...' }
381
+ if (response?.data && Array.isArray(response.data) && response.data.length > 0) {
382
+ const responseData = response.data[0];
383
+ if (responseData?.transactionTime) {
384
+ setTransactionTime(responseData.transactionTime);
385
+ }
386
+ if (responseData?.referenceNo) {
387
+ setReferenceNo(responseData.referenceNo);
388
+ }
389
+ }
390
+
391
+ // Reset OTP fields and timer
392
+ setOtp(['', '', '', '', '', '']);
393
+ setSessionTime(120);
394
+ setIsResendEnabled(false);
395
+ // Reset verification state when resending OTP
396
+ setIsOtpVerified(false);
397
+ setOtpVerificationError('');
398
+ setIsOtpLocked(false);
399
+ // Reset VALIDATE_OTP task flag so it can be called again
400
+
401
+ // Reset timer
402
+ const timer = setInterval(() => {
403
+ setSessionTime((prev) => {
404
+ if (prev <= 1) {
405
+ clearInterval(timer);
406
+ setIsResendEnabled(true);
407
+ return 0;
408
+ }
409
+ return prev - 1;
410
+ });
411
+ }, 1000);
412
+
413
+ } catch (error) {
414
+
415
+ // Check if it's a 500 error specifically
416
+ const isServerError = (error as any)?.status === 500 || (error as any)?.data?.statusCode === 500;
417
+ const errorMessage = isServerError
418
+ ? COMMON_STRINGS.SERVER_ERROR
419
+ : KYC_STRINGS.RESEND_OTP_FAILED;
420
+
421
+ Alert.alert(COMMON_STRINGS.ERROR, errorMessage);
422
+
423
+ // Hide timer and show resend button when API fails
424
+ setIsResendEnabled(true);
425
+ setSessionTime(0); // Hide timer text
426
+ }
427
+ };
428
+
429
+ // Format session time
430
+ const formatSessionTime = (seconds: number) => {
431
+ const mins = Math.floor(seconds / 60);
432
+ const secs = seconds % 60;
433
+ return `${mins.toString().padStart(2, '0')} minutes`;
434
+ };
435
+
436
+ const isContinueEnabled = () => {
437
+ switch (verificationState) {
438
+ case 'initial':
439
+ return aadhaarNumber.length === 12 && !aadhaarError;
440
+ case 'otp':
441
+ return isOtpVerified && !otpVerificationError;
442
+ case 'verified':
443
+ return true;
444
+ default:
445
+ return false;
446
+ }
447
+ };
448
+
449
+ const isLoading = isSendingOtp || isVerifyingOtp || isUpdatingTask || isUpdatingState;
450
+
451
+ const renderInitialState = () => (
452
+ <ScrollView
453
+ style={{ flex: 1 }}
454
+ contentContainerStyle={{ paddingHorizontal: 16, paddingTop: 24, paddingBottom: 100 }}
455
+ keyboardShouldPersistTaps="handled"
456
+ showsVerticalScrollIndicator={false}
457
+ scrollEnabled={!isLoading}
458
+ >
459
+ <AadhaarInput
460
+ label={KYC_STRINGS.AADHAAR_CARD_LABEL}
461
+ value={formatAadhaarNumber(aadhaarNumber)}
462
+ onChangeText={handleAadhaarChange}
463
+ isSuccess={!!aadhaarSuccess}
464
+ isLoading={isSendingOtp}
465
+ editable={!isSendingOtp && verificationState === 'initial'}
466
+ />
467
+ <Text style={styles.infoText}>We do not save aadhar card info.</Text>
468
+
469
+ <ValidationMessage
470
+ type="error"
471
+ message={aadhaarError}
472
+ visible={!!aadhaarError}
473
+ />
474
+
475
+ <ValidationMessage
476
+ type="success"
477
+ message={aadhaarSuccess}
478
+ visible={!!aadhaarSuccess && !isSendingOtp}
479
+ />
480
+
481
+ {/* Show loader when sending OTP */}
482
+ {isSendingOtp && (
483
+ <View style={styles.loaderContainer}>
484
+ <ActivityIndicator size="large" color={colors.primary} />
485
+ <Text style={styles.loaderText}>{KYC_STRINGS.SENDING_OTP}</Text>
486
+ </View>
487
+ )}
488
+ </ScrollView>
489
+ );
490
+
491
+ const renderOtpState = () => (
492
+ <ScrollView
493
+ style={{ flex: 1 }}
494
+ contentContainerStyle={{ paddingHorizontal: 16, paddingTop: 24, paddingBottom: 100 }}
495
+ keyboardShouldPersistTaps="handled"
496
+ showsVerticalScrollIndicator={false}
497
+ scrollEnabled={!isLoading}
498
+ >
499
+ <AadhaarInput
500
+ label={KYC_STRINGS.AADHAAR_CARD_LABEL}
501
+ value={formatAadhaarForDisplay(aadhaarNumber)}
502
+ onChangeText={handleAadhaarChange}
503
+ isSuccess={!!aadhaarSuccess}
504
+ editable={false}
505
+ isLoading={isSendingOtp}
506
+ />
507
+ <Text style={styles.infoText}>We do not save aadhar card info.</Text>
508
+
509
+ <ValidationMessage
510
+ type="error"
511
+ message={aadhaarError}
512
+ visible={!!aadhaarError}
513
+ />
514
+
515
+ <ValidationMessage
516
+ type="success"
517
+ message={aadhaarSuccess}
518
+ visible={!!aadhaarSuccess}
519
+ />
520
+
521
+ <OTPInput
522
+ value={otp}
523
+ onChangeText={handleOtpChange}
524
+ onKeyPress={handleOtpKeyPress}
525
+ sessionTime={sessionTime}
526
+ onResend={handleResendOtp}
527
+ isResendEnabled={isResendEnabled}
528
+ error={!!otpVerificationError}
529
+ errorMessage={otpVerificationError}
530
+ disabled={isVerifyingOtp || isSendingOtp || isOtpLocked}
531
+ />
532
+
533
+ {/* Error message - positioned right after OTP input, fixed position */}
534
+ <View style={{ minHeight: 40, marginTop: -30 }}>
535
+ <ValidationMessage
536
+ type="error"
537
+ message={otpVerificationError}
538
+ visible={!!otpVerificationError}
539
+ />
540
+ </View>
541
+
542
+ {/* Show loader when verifying OTP */}
543
+ {isVerifyingOtp && (
544
+ <View style={styles.loaderContainer}>
545
+ <ActivityIndicator size="large" color={colors.primary} />
546
+ <Text style={styles.loaderText}>{KYC_STRINGS.VERIFYING_OTP}</Text>
547
+ </View>
548
+ )}
549
+
550
+ {/* Show loader when resending OTP */}
551
+ {isSendingOtp && (
552
+ <View style={styles.loaderContainer}>
553
+ <ActivityIndicator size="large" color={colors.primary} />
554
+ <Text style={styles.loaderText}>{KYC_STRINGS.RESENDING_OTP}</Text>
555
+ </View>
556
+ )}
557
+
558
+ </ScrollView>
559
+ );
560
+
561
+ const renderVerifiedState = () => (
562
+ <ScrollView
563
+ style={{ flex: 1 }}
564
+ contentContainerStyle={{ paddingHorizontal: 16, paddingTop: 24, paddingBottom: 100 }}
565
+ keyboardShouldPersistTaps="handled"
566
+ showsVerticalScrollIndicator={false}
567
+ scrollEnabled={!isLoading}
568
+ >
569
+ <View style={styles.verifiedAadhaarContainer}>
570
+ <AadhaarInput
571
+ label={KYC_STRINGS.AADHAAR_CARD_LABEL}
572
+ value={formatAadhaarForDisplay(aadhaarNumber)}
573
+ onChangeText={handleAadhaarChange}
574
+ isSuccess={true}
575
+ editable={false}
576
+ />
577
+
578
+ </View>
579
+ <Text style={styles.infoText}>We do not save aadhar card info.</Text>
580
+
581
+ <ValidationMessage
582
+ type="error"
583
+ message={aadhaarError}
584
+ visible={!!aadhaarError}
585
+ />
586
+
587
+ <ValidationMessage
588
+ type="success"
589
+ message={KYC_STRINGS.AADHAAR_NUMBER_VERIFIED}
590
+ visible={true}
591
+ />
592
+ </ScrollView>
593
+ );
594
+
595
+ const getButtonTitle = (): string => {
596
+ // switch (verificationState) {
597
+ // case 'initial':
598
+ // return 'Continue';
599
+ // case 'otp':
600
+ // if (isOtpVerified) {
601
+ // return 'Continue';
602
+ // } else if (otpVerificationError) {
603
+ // return 'Continue';
604
+ // } else {
605
+ // return 'Continue';
606
+ // }
607
+ // case 'verified':
608
+ // return 'Continue';
609
+ // default:
610
+ // return COMMON_STRINGS.CONTINUE;
611
+ // }
612
+ return COMMON_STRINGS.CONTINUE;
613
+ };
614
+
615
+ const handleButtonPress = async () => {
616
+
617
+
618
+ if (verificationState === 'initial') {
619
+ if (aadhaarNumber.length === 12) {
620
+ autoSendOtp(aadhaarNumber);
621
+ }
622
+ } else if (verificationState === 'otp') {
623
+ // Only call updateState API when continue button is pressed
624
+ try {
625
+ const userInfo = getUserInfoForAPI();
626
+ await updateState({
627
+ providerId: defultProviderId,
628
+ workflowInstanceId,
629
+ userreferenceid: userInfo.userReferenceId,
630
+ applicationid: applicationId,
631
+ entityid: entityId,
632
+ nextState: 'AadhaarVerified',
633
+ }).unwrap();
634
+
635
+ const data = getGlobalData();
636
+ // Redirect immediately after successful updateState
637
+ if (data.completeFDData) {
638
+ navigate('PayNow', { fdData: fdDataFromRoute });
639
+ } else {
640
+ onVerificationComplete?.(aadhaarNumber);
641
+ }
642
+ // Alert.alert('Success', 'Aadhaar verification successful 2');
643
+
644
+ } catch (error) {
645
+ Alert.alert(COMMON_STRINGS.ERROR, KYC_STRINGS.FAILED_TO_PROCEED);
646
+ }
647
+ } else if (verificationState === 'verified') {
648
+
649
+ try {
650
+ const userInfo = getUserInfoForAPI();
651
+ await updateState({
652
+ providerId: defultProviderId,
653
+ workflowInstanceId,
654
+ userreferenceid: userInfo.userReferenceId,
655
+ applicationid: applicationId,
656
+ entityid: entityId,
657
+ nextState: 'AadhaarVerified',
658
+ }).unwrap();
659
+
660
+ const data = getGlobalData();
661
+ // Redirect only after successful updateState
662
+ if (data.completeFDData) {
663
+ navigate('PayNow', { fdData: fdDataFromRoute });
664
+ } else {
665
+ onVerificationComplete?.(aadhaarNumber);
666
+ }
667
+ // Alert.alert('Success', 'Aadhaar verification successful 3');
668
+ } catch (error) {
669
+ Alert.alert(COMMON_STRINGS.ERROR, KYC_STRINGS.FAILED_TO_PROCEED);
670
+ }
671
+ }
672
+ };
673
+
674
+ // Handler for back button (used by both header and hardware back button)
675
+ const handleBackPress = async () => {
676
+ setIsGoingBack(true);
677
+ try {
678
+ const userInfo = getUserInfoForAPI();
679
+ await previousState({
680
+ providerId: defultProviderId,
681
+ workflowInstanceId,
682
+ userreferenceid: userInfo.userReferenceId,
683
+ applicationid: applicationId,
684
+ entityid: entityId,
685
+ });
686
+ } catch (e) {
687
+ // Handle error silently
688
+ } finally {
689
+ setIsGoingBack(false);
690
+ // onGoBack?.();
691
+ navigate('ReviewKYC');
692
+ }
693
+ };
694
+
695
+ // Handle Android hardware back button
696
+ useEffect(() => {
697
+ if (Platform.OS !== 'android') return;
698
+
699
+ const onHardwareBackPress = () => {
700
+ handleBackPress();
701
+ return true; // Prevent default behavior
702
+ };
703
+
704
+ const backHandler = BackHandler.addEventListener(
705
+ 'hardwareBackPress',
706
+ onHardwareBackPress
707
+ );
708
+
709
+ return () => backHandler.remove();
710
+ }, [defultProviderId, workflowInstanceId, applicationId, entityId]);
711
+
712
+ return (
713
+ <SafeAreaWrapper
714
+ includeTop={false}
715
+ bottomPadding={25}
716
+ statusBarColor="#000000"
717
+ statusBarStyle="light-content"
718
+ >
719
+ <Header
720
+ title={KYC_STRINGS.AADHAAR_VERIFICATION_TITLE}
721
+ onBackPress={handleBackPress}
722
+ />
723
+
724
+ <KeyboardAvoidingView
725
+ style={{ flex: 1 }}
726
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
727
+ keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 20}
728
+ >
729
+ {verificationState === 'initial' && renderInitialState()}
730
+ {verificationState === 'otp' && renderOtpState()}
731
+ {verificationState === 'verified' && renderVerifiedState()}
732
+
733
+ <View style={{ paddingHorizontal: 16, paddingBottom: 6 }}>
734
+ <ActionButton
735
+ title={getButtonTitle()}
736
+ onPress={handleButtonPress}
737
+ disabled={!isContinueEnabled()}
738
+ loading={isLoading}
739
+ />
740
+ </View>
741
+ </KeyboardAvoidingView>
742
+ {/* Overlay to disable screen interactions during API call */}
743
+ {isLoading && (
744
+ <View style={styles.loadingOverlay} pointerEvents="auto">
745
+ </View>
746
+ )}
747
+ {/* Loading overlay for back navigation */}
748
+ {isGoingBack && (
749
+ <View style={styles.loadingOverlay} pointerEvents="auto">
750
+ <ActivityIndicator size="large" color={colors.primary} />
751
+ </View>
752
+ )}
753
+ </SafeAreaWrapper>
754
+ );
755
+ };
756
+
757
+ const createStyles = (colors: any, typography: any) => StyleSheet.create({
758
+ infoText: {
759
+ ...typography.styles.bodySmall,
760
+ color: colors.textLight,
761
+ marginTop: 8,
762
+ marginBottom: 16,
763
+ },
764
+ verifiedAadhaarContainer: {
765
+ position: 'relative',
766
+ marginBottom: 8,
767
+ },
768
+ verifiedBadge: {
769
+ position: 'absolute',
770
+ top: 8,
771
+ right: 12,
772
+ backgroundColor: '#4CAF50',
773
+ paddingHorizontal: 8,
774
+ paddingVertical: 4,
775
+ borderRadius: 12,
776
+ zIndex: 1,
777
+ },
778
+ verifiedText: {
779
+ color: 'white',
780
+ fontSize: 12,
781
+ fontWeight: '600',
782
+ },
783
+ loaderContainer: {
784
+ flexDirection: 'row',
785
+ alignItems: 'center',
786
+ justifyContent: 'center',
787
+ marginTop: 16,
788
+ marginBottom: 8,
789
+ },
790
+ loaderText: {
791
+ ...typography.styles.bodyMedium,
792
+ color: colors.text,
793
+ marginLeft: 12,
794
+ },
795
+ loadingOverlay: {
796
+ position: 'absolute',
797
+ top: 0,
798
+ left: 0,
799
+ right: 0,
800
+ bottom: 0,
801
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
802
+ justifyContent: 'center',
803
+ alignItems: 'center',
804
+ zIndex: 1000,
805
+ },
806
+
807
+ });
808
+
809
+ export default AadhaarVerification;