@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,627 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ // AadhaarVerification.tsx
40
+ const react_1 = __importStar(require("react"));
41
+ const react_native_1 = require("react-native");
42
+ const SafeAreaWrapper_1 = __importDefault(require("../components/SafeAreaWrapper"));
43
+ const components_1 = require("../components");
44
+ const AadhaarInput_1 = __importDefault(require("../components/AadhaarInput"));
45
+ const OTPInput_1 = __importDefault(require("../components/OTPInput"));
46
+ const ValidationMessage_1 = __importDefault(require("../components/ValidationMessage"));
47
+ const ActionButton_1 = __importDefault(require("../components/ActionButton"));
48
+ const ThemeContext_1 = require("../theme/ThemeContext");
49
+ const kycApi_1 = require("../api/kycApi");
50
+ const workflowConstants_1 = require("../config/workflowConstants");
51
+ const workflowApi_1 = require("../api/workflowApi");
52
+ const store_1 = require("../store");
53
+ const appDataConfig_1 = require("../config/appDataConfig");
54
+ const helpers_1 = require("../navigation/helpers");
55
+ const customerApi_1 = require("../api/customerApi");
56
+ const native_1 = require("@react-navigation/native");
57
+ const globalData_1 = require("../utils/globalData");
58
+ const kyc_1 = require("../constants/strings/kyc");
59
+ const common_1 = require("../constants/strings/common");
60
+ const AadhaarVerification = ({ onGoBack, onVerificationComplete, }) => {
61
+ var _a;
62
+ const colors = (0, ThemeContext_1.useColors)();
63
+ const typography = (0, ThemeContext_1.useTypography)();
64
+ const styles = react_1.default.useMemo(() => createStyles(colors, typography), [colors, typography]);
65
+ const workflowInstanceId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.workflowInstanceId; });
66
+ const applicationId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.applicationId; });
67
+ const entityId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.entityid; });
68
+ const customerId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.customerId; });
69
+ const wfStatus = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.wfStatus; });
70
+ const route = (0, native_1.useRoute)();
71
+ const fdDataFromRoute = (_a = route === null || route === void 0 ? void 0 : route.params) === null || _a === void 0 ? void 0 : _a.fdData;
72
+ // Function to get providerId dynamically (can be extended to get from app data or API)
73
+ const defultProviderId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.providerId; }); // Default Shriram provider ID
74
+ // API hooks
75
+ const [sendOtp, { isLoading: isSendingOtp }] = (0, kycApi_1.useEkycSendOtpMutation)();
76
+ const [verifyOtp, { isLoading: isVerifyingOtp }] = (0, kycApi_1.useAadhaarVerifyOtpMutation)();
77
+ const [updateTask, { isLoading: isUpdatingTask }] = (0, workflowApi_1.useUpdateTaskMutation)();
78
+ const [updateState, { isLoading: isUpdatingState }] = (0, workflowApi_1.useUpdateStateMutation)();
79
+ const [previousState] = (0, workflowApi_1.usePreviousStateMutation)();
80
+ const [getCustomerApplicationDetails] = (0, customerApi_1.useGetCustomerApplicationDetailsMutation)();
81
+ // State management
82
+ const [verificationState, setVerificationState] = (0, react_1.useState)('initial');
83
+ const [aadhaarNumber, setAadhaarNumber] = (0, react_1.useState)('');
84
+ const [isGoingBack, setIsGoingBack] = (0, react_1.useState)(false);
85
+ const [otp, setOtp] = (0, react_1.useState)(['', '', '', '', '', '']);
86
+ const [sessionTime, setSessionTime] = (0, react_1.useState)(120);
87
+ const [isResendEnabled, setIsResendEnabled] = (0, react_1.useState)(false);
88
+ const [aadhaarError, setAadhaarError] = (0, react_1.useState)('');
89
+ const [aadhaarSuccess, setAadhaarSuccess] = (0, react_1.useState)('');
90
+ const [transactionTime, setTransactionTime] = (0, react_1.useState)('');
91
+ const [referenceNo, setReferenceNo] = (0, react_1.useState)('');
92
+ const [isOtpVerified, setIsOtpVerified] = (0, react_1.useState)(false);
93
+ const [isOtpLocked, setIsOtpLocked] = (0, react_1.useState)(false);
94
+ const [otpVerificationError, setOtpVerificationError] = (0, react_1.useState)('');
95
+ const [isValidateOtpTaskCalled, setIsValidateOtpTaskCalled] = (0, react_1.useState)(false);
96
+ // If customer/application/details has Aadhaar already, show verified view
97
+ react_1.default.useEffect(() => {
98
+ const checkAadhaarStatus = async () => {
99
+ var _a;
100
+ try {
101
+ if (!applicationId || !customerId)
102
+ return;
103
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
104
+ const details = await getCustomerApplicationDetails({
105
+ providerId: defultProviderId,
106
+ applicationId: applicationId,
107
+ customerId: customerId,
108
+ workflowInstanceId,
109
+ userreferenceid: userInfo.userReferenceId,
110
+ applicationid: applicationId,
111
+ entityid: entityId,
112
+ }).unwrap();
113
+ // Check both root level and nested data structure
114
+ const rootAadhaar = (details === null || details === void 0 ? void 0 : details.aadhaarNumber) || (details === null || details === void 0 ? void 0 : details.aadharNo) || (details === null || details === void 0 ? void 0 : details.aadhar) || (details === null || details === void 0 ? void 0 : details.aadhaar);
115
+ const payload = Array.isArray(details === null || details === void 0 ? void 0 : details.data) ? details.data[0] : ((_a = details === null || details === void 0 ? void 0 : details.data) !== null && _a !== void 0 ? _a : details);
116
+ const nestedAadhaar = (payload === null || payload === void 0 ? void 0 : payload.aadhaarNumber) || (payload === null || payload === void 0 ? void 0 : payload.aadharNo) || (payload === null || payload === void 0 ? void 0 : payload.aadhar) || (payload === null || payload === void 0 ? void 0 : payload.aadhaar);
117
+ const aadhaarFromApi = rootAadhaar || nestedAadhaar;
118
+ // API response processed
119
+ if (aadhaarFromApi) {
120
+ // Use the exact Aadhaar number from API response
121
+ const aadhaarStr = String(aadhaarFromApi);
122
+ setAadhaarNumber(aadhaarStr);
123
+ setVerificationState('verified');
124
+ setAadhaarSuccess(kyc_1.KYC_STRINGS.AADHAAR_ALREADY_VERIFIED);
125
+ }
126
+ }
127
+ catch (e) {
128
+ // Non-blocking
129
+ }
130
+ };
131
+ checkAadhaarStatus();
132
+ // eslint-disable-next-line react-hooks/exhaustive-deps
133
+ }, [applicationId, customerId]);
134
+ // Auto send OTP when 12 digits are entered
135
+ const autoSendOtp = async (aadhaarNum) => {
136
+ var _a;
137
+ // Start session timer
138
+ const timer = setInterval(() => {
139
+ setSessionTime((prev) => {
140
+ if (prev <= 1) {
141
+ clearInterval(timer);
142
+ setIsResendEnabled(true);
143
+ return 0;
144
+ }
145
+ return prev - 1;
146
+ });
147
+ }, 1000);
148
+ try {
149
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
150
+ const response = await sendOtp({
151
+ providerId: defultProviderId,
152
+ workflowInstanceId,
153
+ userreferenceid: userInfo.userReferenceId,
154
+ applicationid: applicationId,
155
+ entityid: entityId,
156
+ // body params
157
+ aadharNo: aadhaarNum,
158
+ panNo: userInfo.panNumber,
159
+ mobileNo: userInfo.mobileNumber,
160
+ isRetry: false,
161
+ }).unwrap();
162
+ // Always transition to OTP state first for better UX
163
+ setVerificationState('otp');
164
+ // Store transactionTime and referenceNo from response for verify API
165
+ // The response structure is: { data: [{ transactionTime: '...', referenceNo: '...' }], message: '...', status: '...' }
166
+ if ((response === null || response === void 0 ? void 0 : response.data) && Array.isArray(response.data) && response.data.length > 0) {
167
+ const responseData = response.data[0];
168
+ if (responseData === null || responseData === void 0 ? void 0 : responseData.transactionTime) {
169
+ setTransactionTime(responseData.transactionTime);
170
+ }
171
+ if (responseData === null || responseData === void 0 ? void 0 : responseData.referenceNo) {
172
+ setReferenceNo(responseData.referenceNo);
173
+ }
174
+ }
175
+ }
176
+ catch (error) {
177
+ // Don't show alert immediately, let user try to enter OTP
178
+ // They can use resend if needed
179
+ setVerificationState('initial');
180
+ // If backend returns 400, show friendly error below the text field
181
+ const status = (error === null || error === void 0 ? void 0 : error.status) || ((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.statusCode);
182
+ // if (status === 400 || status === 500) {
183
+ setAadhaarError(kyc_1.KYC_STRINGS.AADHAAR_ERROR_GENERIC);
184
+ // }
185
+ // Hide timer and show resend button when API fails
186
+ setIsResendEnabled(true);
187
+ setSessionTime(0); // Hide timer text
188
+ }
189
+ };
190
+ // Format Aadhaar number with spaces (XXXX XXXX XXXX)
191
+ const formatAadhaarNumber = (number) => {
192
+ const cleaned = number.replace(/\s/g, '');
193
+ if (cleaned.length <= 4)
194
+ return cleaned;
195
+ if (cleaned.length <= 8)
196
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4)}`;
197
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 8)} ${cleaned.slice(8, 12)}`;
198
+ };
199
+ // Format Aadhaar number for display (show only first 4 digits, rest as XXXX)
200
+ const formatAadhaarForDisplay = (number) => {
201
+ const cleaned = number.replace(/\s/g, '');
202
+ // Check if it's already a masked format from API
203
+ if (cleaned.includes('X')) {
204
+ // Format masked Aadhaar with spaces: XXXX XXXX XXXX
205
+ if (cleaned.length === 12) {
206
+ return `${cleaned.slice(0, 4)} ${cleaned.slice(4, 8)} ${cleaned.slice(8, 12)}`;
207
+ }
208
+ return cleaned; // Return as-is if not 12 characters
209
+ }
210
+ // Handle regular Aadhaar numbers
211
+ if (cleaned.length < 4)
212
+ return cleaned;
213
+ if (cleaned.length === 12) {
214
+ return `XXXX XXXX ${cleaned.slice(-4)}`;
215
+ }
216
+ return formatAadhaarNumber(number); // Show normal format while typing
217
+ };
218
+ // Handle Aadhaar number input
219
+ const handleAadhaarChange = (text) => {
220
+ const cleaned = text.replace(/\D/g, ''); // Remove non-digits
221
+ if (cleaned.length <= 12) {
222
+ // If user changes Aadhaar while in OTP/verified state, reset OTP flow
223
+ if (verificationState !== 'initial') {
224
+ setVerificationState('initial');
225
+ setOtp(['', '', '', '', '', '']);
226
+ setIsResendEnabled(false);
227
+ setSessionTime(120);
228
+ // Reset verification state when Aadhaar changes
229
+ setIsOtpVerified(false);
230
+ setOtpVerificationError('');
231
+ setIsOtpLocked(false);
232
+ // Reset VALIDATE_OTP task flag when Aadhaar changes
233
+ //setIsValidateOtpTaskCalled(false);
234
+ }
235
+ setAadhaarNumber(cleaned);
236
+ // Validate Aadhaar number
237
+ if (!cleaned) {
238
+ setAadhaarError('');
239
+ // setAadhaarSuccess('');
240
+ }
241
+ else if (cleaned.length < 12) {
242
+ setAadhaarError(kyc_1.KYC_STRINGS.AADHAAR_MUST_BE_12_DIGITS);
243
+ // setAadhaarSuccess('');
244
+ }
245
+ else if (cleaned.length === 12) {
246
+ setAadhaarError('');
247
+ // setAadhaarSuccess('Valid Aadhaar number');
248
+ // Auto send OTP and transition to OTP view when 12 digits are entered
249
+ if (verificationState === 'initial') {
250
+ // Small delay to show success message briefly before transitioning
251
+ setTimeout(() => {
252
+ autoSendOtp(cleaned);
253
+ }, 500);
254
+ }
255
+ }
256
+ }
257
+ };
258
+ // Handle OTP input
259
+ const handleOtpChange = (value, index) => {
260
+ if (value.length <= 1) {
261
+ const newOtp = [...otp];
262
+ newOtp[index] = value;
263
+ setOtp(newOtp);
264
+ // Reset verification state when user changes OTP
265
+ setIsOtpVerified(false);
266
+ setOtpVerificationError('');
267
+ // Reset VALIDATE_OTP task flag when OTP changes
268
+ // setIsValidateOtpTaskCalled(false);
269
+ // Check if all 6 digits are entered
270
+ if (newOtp.every(digit => digit !== '')) {
271
+ // Dismiss keyboard when all digits are entered
272
+ react_native_1.Keyboard.dismiss();
273
+ // Lock OTP input to prevent editing until user resends or changes Aadhaar
274
+ setIsOtpLocked(true);
275
+ // All digits entered, automatically verify OTP with the new OTP
276
+ handleVerifyOtpWithOtp(newOtp.join(''));
277
+ }
278
+ }
279
+ };
280
+ // Handle OTP backspace
281
+ const handleOtpKeyPress = (key, index) => {
282
+ // Logic is now handled in OTPInput component
283
+ };
284
+ // Note: handleContinueFromAadhaar is no longer needed as transition happens automatically
285
+ // when 12 digits are typed via autoSendOtp function
286
+ // Verify OTP with provided OTP string
287
+ const handleVerifyOtpWithOtp = async (otpString) => {
288
+ if (otpString.length === 6) {
289
+ try {
290
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
291
+ // 1) Update Task before verifying OTP (only if not already called)
292
+ if (!isValidateOtpTaskCalled) {
293
+ await updateTask({
294
+ providerId: defultProviderId,
295
+ workflowInstanceId,
296
+ userreferenceid: userInfo.userReferenceId,
297
+ applicationid: applicationId,
298
+ entityid: entityId,
299
+ // Request params/body
300
+ targetTaskId: workflowConstants_1.WORKFLOW_TASKS.VALIDATE_OTP,
301
+ }).unwrap();
302
+ setIsValidateOtpTaskCalled(true);
303
+ }
304
+ else {
305
+ }
306
+ // 2) Verify OTP
307
+ const response = await verifyOtp({
308
+ providerId: defultProviderId,
309
+ workflowInstanceId,
310
+ userreferenceid: userInfo.userReferenceId,
311
+ applicationid: applicationId,
312
+ entityid: entityId,
313
+ // body params
314
+ customerId: customerId,
315
+ transactionTime: transactionTime,
316
+ referenceNo: referenceNo,
317
+ applicationId: applicationId,
318
+ aadharNo: aadhaarNumber,
319
+ mobileNo: userInfo.mobileNumber,
320
+ otp: otpString,
321
+ }).unwrap();
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_1.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
+ }
339
+ else {
340
+ setIsOtpVerified(false);
341
+ setOtpVerificationError(kyc_1.KYC_STRINGS.OTP_INCOMPLETE);
342
+ }
343
+ };
344
+ // Resend OTP
345
+ const handleResendOtp = async () => {
346
+ var _a;
347
+ try {
348
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
349
+ setIsValidateOtpTaskCalled(false);
350
+ // 1) First call updateTask API
351
+ const updateTaskResponse = await updateTask({
352
+ providerId: defultProviderId,
353
+ workflowInstanceId,
354
+ userreferenceid: userInfo.userReferenceId,
355
+ applicationid: applicationId,
356
+ entityid: entityId,
357
+ // Request params/body
358
+ targetTaskId: workflowConstants_1.WORKFLOW_TASKS.RESEND_OTP,
359
+ }).unwrap();
360
+ // 2) Then call OTP API with the updateTask response
361
+ const response = await sendOtp({
362
+ providerId: defultProviderId,
363
+ workflowInstanceId,
364
+ userreferenceid: userInfo.userReferenceId,
365
+ applicationid: applicationId,
366
+ entityid: entityId,
367
+ // body params
368
+ aadharNo: aadhaarNumber,
369
+ panNo: userInfo.panNumber,
370
+ mobileNo: userInfo.mobileNumber,
371
+ isRetry: true,
372
+ }).unwrap();
373
+ // Store transactionTime and referenceNo from response for verify API
374
+ // The response structure is: { data: [{ transactionTime: '...', referenceNo: '...' }], message: '...', status: '...' }
375
+ if ((response === null || response === void 0 ? void 0 : response.data) && Array.isArray(response.data) && response.data.length > 0) {
376
+ const responseData = response.data[0];
377
+ if (responseData === null || responseData === void 0 ? void 0 : responseData.transactionTime) {
378
+ setTransactionTime(responseData.transactionTime);
379
+ }
380
+ if (responseData === null || responseData === void 0 ? void 0 : responseData.referenceNo) {
381
+ setReferenceNo(responseData.referenceNo);
382
+ }
383
+ }
384
+ // Reset OTP fields and timer
385
+ setOtp(['', '', '', '', '', '']);
386
+ setSessionTime(120);
387
+ setIsResendEnabled(false);
388
+ // Reset verification state when resending OTP
389
+ setIsOtpVerified(false);
390
+ setOtpVerificationError('');
391
+ setIsOtpLocked(false);
392
+ // Reset VALIDATE_OTP task flag so it can be called again
393
+ // Reset timer
394
+ const timer = setInterval(() => {
395
+ setSessionTime((prev) => {
396
+ if (prev <= 1) {
397
+ clearInterval(timer);
398
+ setIsResendEnabled(true);
399
+ return 0;
400
+ }
401
+ return prev - 1;
402
+ });
403
+ }, 1000);
404
+ }
405
+ catch (error) {
406
+ // Check if it's a 500 error specifically
407
+ const isServerError = (error === null || error === void 0 ? void 0 : error.status) === 500 || ((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.statusCode) === 500;
408
+ const errorMessage = isServerError
409
+ ? common_1.COMMON_STRINGS.SERVER_ERROR
410
+ : kyc_1.KYC_STRINGS.RESEND_OTP_FAILED;
411
+ react_native_1.Alert.alert(common_1.COMMON_STRINGS.ERROR, errorMessage);
412
+ // Hide timer and show resend button when API fails
413
+ setIsResendEnabled(true);
414
+ setSessionTime(0); // Hide timer text
415
+ }
416
+ };
417
+ // Format session time
418
+ const formatSessionTime = (seconds) => {
419
+ const mins = Math.floor(seconds / 60);
420
+ const secs = seconds % 60;
421
+ return `${mins.toString().padStart(2, '0')} minutes`;
422
+ };
423
+ const isContinueEnabled = () => {
424
+ switch (verificationState) {
425
+ case 'initial':
426
+ return aadhaarNumber.length === 12 && !aadhaarError;
427
+ case 'otp':
428
+ return isOtpVerified && !otpVerificationError;
429
+ case 'verified':
430
+ return true;
431
+ default:
432
+ return false;
433
+ }
434
+ };
435
+ const isLoading = isSendingOtp || isVerifyingOtp || isUpdatingTask || isUpdatingState;
436
+ const renderInitialState = () => (react_1.default.createElement(react_native_1.ScrollView, { style: { flex: 1 }, contentContainerStyle: { paddingHorizontal: 16, paddingTop: 24, paddingBottom: 100 }, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, scrollEnabled: !isLoading },
437
+ react_1.default.createElement(AadhaarInput_1.default, { label: kyc_1.KYC_STRINGS.AADHAAR_CARD_LABEL, value: formatAadhaarNumber(aadhaarNumber), onChangeText: handleAadhaarChange, isSuccess: !!aadhaarSuccess, isLoading: isSendingOtp, editable: !isSendingOtp && verificationState === 'initial' }),
438
+ react_1.default.createElement(react_native_1.Text, { style: styles.infoText }, "We do not save aadhar card info."),
439
+ react_1.default.createElement(ValidationMessage_1.default, { type: "error", message: aadhaarError, visible: !!aadhaarError }),
440
+ react_1.default.createElement(ValidationMessage_1.default, { type: "success", message: aadhaarSuccess, visible: !!aadhaarSuccess && !isSendingOtp }),
441
+ isSendingOtp && (react_1.default.createElement(react_native_1.View, { style: styles.loaderContainer },
442
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary }),
443
+ react_1.default.createElement(react_native_1.Text, { style: styles.loaderText }, kyc_1.KYC_STRINGS.SENDING_OTP)))));
444
+ const renderOtpState = () => (react_1.default.createElement(react_native_1.ScrollView, { style: { flex: 1 }, contentContainerStyle: { paddingHorizontal: 16, paddingTop: 24, paddingBottom: 100 }, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, scrollEnabled: !isLoading },
445
+ react_1.default.createElement(AadhaarInput_1.default, { label: kyc_1.KYC_STRINGS.AADHAAR_CARD_LABEL, value: formatAadhaarForDisplay(aadhaarNumber), onChangeText: handleAadhaarChange, isSuccess: !!aadhaarSuccess, editable: false, isLoading: isSendingOtp }),
446
+ react_1.default.createElement(react_native_1.Text, { style: styles.infoText }, "We do not save aadhar card info."),
447
+ react_1.default.createElement(ValidationMessage_1.default, { type: "error", message: aadhaarError, visible: !!aadhaarError }),
448
+ react_1.default.createElement(ValidationMessage_1.default, { type: "success", message: aadhaarSuccess, visible: !!aadhaarSuccess }),
449
+ react_1.default.createElement(OTPInput_1.default, { value: otp, onChangeText: handleOtpChange, onKeyPress: handleOtpKeyPress, sessionTime: sessionTime, onResend: handleResendOtp, isResendEnabled: isResendEnabled, error: !!otpVerificationError, errorMessage: otpVerificationError, disabled: isVerifyingOtp || isSendingOtp || isOtpLocked }),
450
+ react_1.default.createElement(react_native_1.View, { style: { minHeight: 40, marginTop: -30 } },
451
+ react_1.default.createElement(ValidationMessage_1.default, { type: "error", message: otpVerificationError, visible: !!otpVerificationError })),
452
+ isVerifyingOtp && (react_1.default.createElement(react_native_1.View, { style: styles.loaderContainer },
453
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary }),
454
+ react_1.default.createElement(react_native_1.Text, { style: styles.loaderText }, kyc_1.KYC_STRINGS.VERIFYING_OTP))),
455
+ isSendingOtp && (react_1.default.createElement(react_native_1.View, { style: styles.loaderContainer },
456
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary }),
457
+ react_1.default.createElement(react_native_1.Text, { style: styles.loaderText }, kyc_1.KYC_STRINGS.RESENDING_OTP)))));
458
+ const renderVerifiedState = () => (react_1.default.createElement(react_native_1.ScrollView, { style: { flex: 1 }, contentContainerStyle: { paddingHorizontal: 16, paddingTop: 24, paddingBottom: 100 }, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, scrollEnabled: !isLoading },
459
+ react_1.default.createElement(react_native_1.View, { style: styles.verifiedAadhaarContainer },
460
+ react_1.default.createElement(AadhaarInput_1.default, { label: kyc_1.KYC_STRINGS.AADHAAR_CARD_LABEL, value: formatAadhaarForDisplay(aadhaarNumber), onChangeText: handleAadhaarChange, isSuccess: true, editable: false })),
461
+ react_1.default.createElement(react_native_1.Text, { style: styles.infoText }, "We do not save aadhar card info."),
462
+ react_1.default.createElement(ValidationMessage_1.default, { type: "error", message: aadhaarError, visible: !!aadhaarError }),
463
+ react_1.default.createElement(ValidationMessage_1.default, { type: "success", message: kyc_1.KYC_STRINGS.AADHAAR_NUMBER_VERIFIED, visible: true })));
464
+ const getButtonTitle = () => {
465
+ // switch (verificationState) {
466
+ // case 'initial':
467
+ // return 'Continue';
468
+ // case 'otp':
469
+ // if (isOtpVerified) {
470
+ // return 'Continue';
471
+ // } else if (otpVerificationError) {
472
+ // return 'Continue';
473
+ // } else {
474
+ // return 'Continue';
475
+ // }
476
+ // case 'verified':
477
+ // return 'Continue';
478
+ // default:
479
+ // return COMMON_STRINGS.CONTINUE;
480
+ // }
481
+ return common_1.COMMON_STRINGS.CONTINUE;
482
+ };
483
+ const handleButtonPress = async () => {
484
+ if (verificationState === 'initial') {
485
+ if (aadhaarNumber.length === 12) {
486
+ autoSendOtp(aadhaarNumber);
487
+ }
488
+ }
489
+ else if (verificationState === 'otp') {
490
+ // Only call updateState API when continue button is pressed
491
+ try {
492
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
493
+ await updateState({
494
+ providerId: defultProviderId,
495
+ workflowInstanceId,
496
+ userreferenceid: userInfo.userReferenceId,
497
+ applicationid: applicationId,
498
+ entityid: entityId,
499
+ nextState: 'AadhaarVerified',
500
+ }).unwrap();
501
+ const data = (0, globalData_1.getGlobalData)();
502
+ // Redirect immediately after successful updateState
503
+ if (data.completeFDData) {
504
+ (0, helpers_1.navigate)('PayNow', { fdData: fdDataFromRoute });
505
+ }
506
+ else {
507
+ onVerificationComplete === null || onVerificationComplete === void 0 ? void 0 : onVerificationComplete(aadhaarNumber);
508
+ }
509
+ // Alert.alert('Success', 'Aadhaar verification successful 2');
510
+ }
511
+ catch (error) {
512
+ react_native_1.Alert.alert(common_1.COMMON_STRINGS.ERROR, kyc_1.KYC_STRINGS.FAILED_TO_PROCEED);
513
+ }
514
+ }
515
+ else if (verificationState === 'verified') {
516
+ try {
517
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
518
+ await updateState({
519
+ providerId: defultProviderId,
520
+ workflowInstanceId,
521
+ userreferenceid: userInfo.userReferenceId,
522
+ applicationid: applicationId,
523
+ entityid: entityId,
524
+ nextState: 'AadhaarVerified',
525
+ }).unwrap();
526
+ const data = (0, globalData_1.getGlobalData)();
527
+ // Redirect only after successful updateState
528
+ if (data.completeFDData) {
529
+ (0, helpers_1.navigate)('PayNow', { fdData: fdDataFromRoute });
530
+ }
531
+ else {
532
+ onVerificationComplete === null || onVerificationComplete === void 0 ? void 0 : onVerificationComplete(aadhaarNumber);
533
+ }
534
+ // Alert.alert('Success', 'Aadhaar verification successful 3');
535
+ }
536
+ catch (error) {
537
+ react_native_1.Alert.alert(common_1.COMMON_STRINGS.ERROR, kyc_1.KYC_STRINGS.FAILED_TO_PROCEED);
538
+ }
539
+ }
540
+ };
541
+ // Handler for back button (used by both header and hardware back button)
542
+ const handleBackPress = async () => {
543
+ setIsGoingBack(true);
544
+ try {
545
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
546
+ await previousState({
547
+ providerId: defultProviderId,
548
+ workflowInstanceId,
549
+ userreferenceid: userInfo.userReferenceId,
550
+ applicationid: applicationId,
551
+ entityid: entityId,
552
+ });
553
+ }
554
+ catch (e) {
555
+ // Handle error silently
556
+ }
557
+ finally {
558
+ setIsGoingBack(false);
559
+ // onGoBack?.();
560
+ (0, helpers_1.navigate)('ReviewKYC');
561
+ }
562
+ };
563
+ // Handle Android hardware back button
564
+ (0, react_1.useEffect)(() => {
565
+ if (react_native_1.Platform.OS !== 'android')
566
+ return;
567
+ const onHardwareBackPress = () => {
568
+ handleBackPress();
569
+ return true; // Prevent default behavior
570
+ };
571
+ const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onHardwareBackPress);
572
+ return () => backHandler.remove();
573
+ }, [defultProviderId, workflowInstanceId, applicationId, entityId]);
574
+ return (react_1.default.createElement(SafeAreaWrapper_1.default, { includeTop: false, bottomPadding: 25, statusBarColor: "#000000", statusBarStyle: "light-content" },
575
+ react_1.default.createElement(components_1.Header, { title: kyc_1.KYC_STRINGS.AADHAAR_VERIFICATION_TITLE, onBackPress: handleBackPress }),
576
+ react_1.default.createElement(react_native_1.KeyboardAvoidingView, { style: { flex: 1 }, behavior: react_native_1.Platform.OS === 'ios' ? 'padding' : 'height', keyboardVerticalOffset: react_native_1.Platform.OS === 'ios' ? 0 : 20 },
577
+ verificationState === 'initial' && renderInitialState(),
578
+ verificationState === 'otp' && renderOtpState(),
579
+ verificationState === 'verified' && renderVerifiedState(),
580
+ react_1.default.createElement(react_native_1.View, { style: { paddingHorizontal: 16, paddingBottom: 6 } },
581
+ react_1.default.createElement(ActionButton_1.default, { title: getButtonTitle(), onPress: handleButtonPress, disabled: !isContinueEnabled(), loading: isLoading }))),
582
+ isLoading && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" })),
583
+ isGoingBack && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" },
584
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary })))));
585
+ };
586
+ const createStyles = (colors, typography) => react_native_1.StyleSheet.create({
587
+ infoText: Object.assign(Object.assign({}, typography.styles.bodySmall), { color: colors.textLight, marginTop: 8, marginBottom: 16 }),
588
+ verifiedAadhaarContainer: {
589
+ position: 'relative',
590
+ marginBottom: 8,
591
+ },
592
+ verifiedBadge: {
593
+ position: 'absolute',
594
+ top: 8,
595
+ right: 12,
596
+ backgroundColor: '#4CAF50',
597
+ paddingHorizontal: 8,
598
+ paddingVertical: 4,
599
+ borderRadius: 12,
600
+ zIndex: 1,
601
+ },
602
+ verifiedText: {
603
+ color: 'white',
604
+ fontSize: 12,
605
+ fontWeight: '600',
606
+ },
607
+ loaderContainer: {
608
+ flexDirection: 'row',
609
+ alignItems: 'center',
610
+ justifyContent: 'center',
611
+ marginTop: 16,
612
+ marginBottom: 8,
613
+ },
614
+ loaderText: Object.assign(Object.assign({}, typography.styles.bodyMedium), { color: colors.text, marginLeft: 12 }),
615
+ loadingOverlay: {
616
+ position: 'absolute',
617
+ top: 0,
618
+ left: 0,
619
+ right: 0,
620
+ bottom: 0,
621
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
622
+ justifyContent: 'center',
623
+ alignItems: 'center',
624
+ zIndex: 1000,
625
+ },
626
+ });
627
+ exports.default = AadhaarVerification;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export interface AddBankAccountProps {
3
+ onGoBack?: () => void;
4
+ onContinue?: (data: AddBankAccountData) => void;
5
+ onFindIFSC?: () => void;
6
+ initialData?: Partial<AddBankAccountData>;
7
+ selectedIFSC?: IFSCData;
8
+ }
9
+ export interface IFSCData {
10
+ bankName: string;
11
+ branchName: string;
12
+ ifscCode: string;
13
+ bankShortDesc?: string;
14
+ bankCode?: string;
15
+ customerBankPk?: string;
16
+ }
17
+ export interface AddBankAccountData {
18
+ accountType: string;
19
+ accountNumber: string;
20
+ }
21
+ declare const AddBankAccount: React.FC<AddBankAccountProps>;
22
+ export default AddBankAccount;