@finspringinnovations/fixeddepositsdk 1.0.0

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 (311) hide show
  1. package/README.md +128 -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 +6 -0
  7. package/lib/api/baseApi.js +406 -0
  8. package/lib/api/customerApi.d.ts +855 -0
  9. package/lib/api/customerApi.js +241 -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 +35 -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 +6 -0
  33. package/lib/assets/images/images.js +12 -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 +18 -0
  39. package/lib/components/ActiveFDCard.js +116 -0
  40. package/lib/components/AmountInput.d.ts +20 -0
  41. package/lib/components/AmountInput.js +142 -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 +59 -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 +23 -0
  55. package/lib/components/FDCard.js +116 -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 +19 -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 +46 -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 +159 -0
  95. package/lib/config/appDataConfig.js +310 -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 +62 -0
  99. package/lib/config/workflowConstants.js +63 -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 +26 -0
  103. package/lib/constants/strings/base64Images.js +29 -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 +48 -0
  125. package/lib/index.js +161 -0
  126. package/lib/navigation/RootNavigator.d.ts +9 -0
  127. package/lib/navigation/RootNavigator.js +459 -0
  128. package/lib/navigation/SimpleNavigator.d.ts +11 -0
  129. package/lib/navigation/SimpleNavigator.js +114 -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 +17 -0
  133. package/lib/navigation/index.js +42 -0
  134. package/lib/navigation/types.d.ts +139 -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 +16 -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/Employee.d.ts +18 -0
  149. package/lib/screens/Employee.js +594 -0
  150. package/lib/screens/FDCalculator.d.ts +18 -0
  151. package/lib/screens/FDCalculator.js +767 -0
  152. package/lib/screens/FDList.d.ts +28 -0
  153. package/lib/screens/FDList.js +1853 -0
  154. package/lib/screens/FindIFSC.d.ts +16 -0
  155. package/lib/screens/FindIFSC.js +248 -0
  156. package/lib/screens/NomineeDetail.d.ts +17 -0
  157. package/lib/screens/NomineeDetail.js +592 -0
  158. package/lib/screens/PayNow.d.ts +14 -0
  159. package/lib/screens/PayNow.js +230 -0
  160. package/lib/screens/Payment.d.ts +11 -0
  161. package/lib/screens/Payment.js +191 -0
  162. package/lib/screens/PaymentStatus.d.ts +16 -0
  163. package/lib/screens/PaymentStatus.js +431 -0
  164. package/lib/screens/ReviewKYC.d.ts +23 -0
  165. package/lib/screens/ReviewKYC.js +727 -0
  166. package/lib/state/paymentSession.d.ts +8 -0
  167. package/lib/state/paymentSession.js +13 -0
  168. package/lib/store/fdListSelectedSlice.d.ts +21 -0
  169. package/lib/store/fdListSelectedSlice.js +26 -0
  170. package/lib/store/hooks.d.ts +8 -0
  171. package/lib/store/hooks.js +8 -0
  172. package/lib/store/index.d.ts +3 -0
  173. package/lib/store/index.js +8 -0
  174. package/lib/store/onboardingSlice.d.ts +12 -0
  175. package/lib/store/onboardingSlice.js +32 -0
  176. package/lib/store/store.d.ts +13 -0
  177. package/lib/store/store.js +27 -0
  178. package/lib/theme/ThemeContext.d.ts +210 -0
  179. package/lib/theme/ThemeContext.js +92 -0
  180. package/lib/theme/colors.d.ts +80 -0
  181. package/lib/theme/colors.js +85 -0
  182. package/lib/theme/index.d.ts +35 -0
  183. package/lib/theme/index.js +78 -0
  184. package/lib/theme/shadows.d.ts +53 -0
  185. package/lib/theme/shadows.js +58 -0
  186. package/lib/theme/typography.d.ts +134 -0
  187. package/lib/theme/typography.js +143 -0
  188. package/lib/types/dataTypes.d.ts +34 -0
  189. package/lib/types/dataTypes.js +2 -0
  190. package/lib/types/workflowTypes.d.ts +2 -0
  191. package/lib/types/workflowTypes.js +2 -0
  192. package/lib/utils/apiLogger.d.ts +48 -0
  193. package/lib/utils/apiLogger.js +105 -0
  194. package/lib/utils/encryption.d.ts +28 -0
  195. package/lib/utils/encryption.js +113 -0
  196. package/lib/utils/getFDData.d.ts +48 -0
  197. package/lib/utils/getFDData.js +145 -0
  198. package/lib/utils/globalData.d.ts +2 -0
  199. package/lib/utils/globalData.js +10 -0
  200. package/package.json +51 -0
  201. package/src/api/applicationApi.ts +12 -0
  202. package/src/api/bankApi.ts +42 -0
  203. package/src/api/baseApi.ts +463 -0
  204. package/src/api/customerApi.ts +324 -0
  205. package/src/api/fdApi.ts +150 -0
  206. package/src/api/fdCalculatorApi.ts +41 -0
  207. package/src/api/index.ts +29 -0
  208. package/src/api/interestRateApi.ts +143 -0
  209. package/src/api/kycApi.ts +63 -0
  210. package/src/api/masterDataApi.ts +37 -0
  211. package/src/api/nomineeApi.ts +34 -0
  212. package/src/api/onboardingApi.ts +64 -0
  213. package/src/api/panApi.ts +25 -0
  214. package/src/api/paymentApi.ts +34 -0
  215. package/src/api/workflowApi.ts +94 -0
  216. package/src/assets/images/Mahindra.png +0 -0
  217. package/src/assets/images/arrow-filled.png +0 -0
  218. package/src/assets/images/arrow-left.png +0 -0
  219. package/src/assets/images/backicon.png +0 -0
  220. package/src/assets/images/calendar.png +0 -0
  221. package/src/assets/images/chevron-down.png +0 -0
  222. package/src/assets/images/chevron-down@2x.png +0 -0
  223. package/src/assets/images/chevron-down@3x.png +0 -0
  224. package/src/assets/images/images.js +10 -0
  225. package/src/assets/images/shriram_logo.png +0 -0
  226. package/src/components/AadhaarInput.tsx +91 -0
  227. package/src/components/ActionButton.tsx +129 -0
  228. package/src/components/ActiveFDCard.tsx +188 -0
  229. package/src/components/AmountInput.tsx +217 -0
  230. package/src/components/CheckboxOption.tsx +93 -0
  231. package/src/components/CompanyHeader.tsx +80 -0
  232. package/src/components/DropdownSelector.tsx +77 -0
  233. package/src/components/EmptyState.tsx +109 -0
  234. package/src/components/ErrorDisplay.tsx +135 -0
  235. package/src/components/FAQItem.tsx +90 -0
  236. package/src/components/FDCard.tsx +186 -0
  237. package/src/components/FormDropdown.tsx +214 -0
  238. package/src/components/FormSection.tsx +86 -0
  239. package/src/components/Header.tsx +110 -0
  240. package/src/components/IFSCSearchResultCard.tsx +139 -0
  241. package/src/components/InfoBox.tsx +55 -0
  242. package/src/components/InterestRateCard.tsx +77 -0
  243. package/src/components/LoadingIndicator.tsx +63 -0
  244. package/src/components/OTPInput.tsx +213 -0
  245. package/src/components/PaymentDetailsCard.tsx +120 -0
  246. package/src/components/PendingFDBottomSheet.tsx +237 -0
  247. package/src/components/README.md +210 -0
  248. package/src/components/SafeAreaWrapper.tsx +68 -0
  249. package/src/components/ScreenHeader.tsx +83 -0
  250. package/src/components/StatusDisplay.tsx +139 -0
  251. package/src/components/TextFieldWithLabel.tsx +502 -0
  252. package/src/components/TrustBox.tsx +63 -0
  253. package/src/components/ValidationErrorAlert.tsx +57 -0
  254. package/src/components/ValidationMessage.tsx +134 -0
  255. package/src/components/index.tsx +47 -0
  256. package/src/config/apiConfig.ts +217 -0
  257. package/src/config/appDataConfig.ts +358 -0
  258. package/src/config/encryptionConfig.ts +65 -0
  259. package/src/config/workflowConstants.ts +70 -0
  260. package/src/constants/strings/README.md +146 -0
  261. package/src/constants/strings/bank.ts +92 -0
  262. package/src/constants/strings/base64Images.ts +31 -0
  263. package/src/constants/strings/common.ts +63 -0
  264. package/src/constants/strings/employee.ts +85 -0
  265. package/src/constants/strings/faq.ts +23 -0
  266. package/src/constants/strings/fd.ts +172 -0
  267. package/src/constants/strings/home.ts +67 -0
  268. package/src/constants/strings/index.ts +21 -0
  269. package/src/constants/strings/kyc.ts +100 -0
  270. package/src/constants/strings/nominee.ts +90 -0
  271. package/src/hooks/useAuth.ts +42 -0
  272. package/src/hooks/useFDData.ts +48 -0
  273. package/src/index.tsx +139 -0
  274. package/src/navigation/RootNavigator.tsx +687 -0
  275. package/src/navigation/SimpleNavigator.tsx +123 -0
  276. package/src/navigation/helpers.ts +85 -0
  277. package/src/navigation/index.tsx +84 -0
  278. package/src/navigation/types.ts +146 -0
  279. package/src/navigation/workflowNavigator.ts +131 -0
  280. package/src/providers/ApiProvider.tsx +23 -0
  281. package/src/providers/MasterDataProvider.tsx +30 -0
  282. package/src/screens/AadhaarVerification.tsx +809 -0
  283. package/src/screens/AddBankAccount.tsx +541 -0
  284. package/src/screens/BankDetail.tsx +826 -0
  285. package/src/screens/Employee.tsx +822 -0
  286. package/src/screens/FDCalculator.tsx +1002 -0
  287. package/src/screens/FDList.tsx +2199 -0
  288. package/src/screens/FindIFSC.tsx +332 -0
  289. package/src/screens/NomineeDetail.tsx +800 -0
  290. package/src/screens/PayNow.tsx +282 -0
  291. package/src/screens/Payment.tsx +224 -0
  292. package/src/screens/PaymentStatus.tsx +595 -0
  293. package/src/screens/ReviewKYC.tsx +1062 -0
  294. package/src/state/paymentSession.ts +13 -0
  295. package/src/store/fdListSelectedSlice.ts +42 -0
  296. package/src/store/hooks.ts +6 -0
  297. package/src/store/index.ts +3 -0
  298. package/src/store/onboardingSlice.ts +37 -0
  299. package/src/store/store.ts +27 -0
  300. package/src/theme/ThemeContext.tsx +84 -0
  301. package/src/theme/colors.ts +90 -0
  302. package/src/theme/index.ts +85 -0
  303. package/src/theme/shadows.ts +61 -0
  304. package/src/theme/typography.ts +151 -0
  305. package/src/types/dataTypes.ts +37 -0
  306. package/src/types/env.d.ts +93 -0
  307. package/src/types/workflowTypes.ts +12 -0
  308. package/src/utils/apiLogger.ts +166 -0
  309. package/src/utils/encryption.ts +159 -0
  310. package/src/utils/getFDData.ts +165 -0
  311. package/src/utils/globalData.ts +7 -0
@@ -0,0 +1,727 @@
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
+ const react_1 = __importStar(require("react"));
40
+ const native_1 = require("@react-navigation/native");
41
+ const react_native_1 = require("react-native");
42
+ const Ionicons_1 = __importDefault(require("react-native-vector-icons/Ionicons"));
43
+ const SafeAreaWrapper_1 = __importDefault(require("../components/SafeAreaWrapper"));
44
+ const components_1 = require("../components");
45
+ const ActionButton_1 = __importDefault(require("../components/ActionButton"));
46
+ const TextFieldWithLabel_1 = __importDefault(require("../components/TextFieldWithLabel"));
47
+ const ThemeContext_1 = require("../theme/ThemeContext");
48
+ const workflowApi_1 = require("../api/workflowApi");
49
+ const appDataConfig_1 = require("../config/appDataConfig");
50
+ const MasterDataProvider_1 = require("../providers/MasterDataProvider");
51
+ const helpers_1 = require("../navigation/helpers");
52
+ const store_1 = require("../store");
53
+ const customerApi_1 = require("../api/customerApi");
54
+ const kycApi_1 = require("../api/kycApi");
55
+ const base64Images_1 = require("../constants/strings/base64Images");
56
+ const ReviewKYC = ({ onGoBack, onContinue, initialData, }) => {
57
+ var _a, _b, _c, _d, _e, _f;
58
+ const route = (0, native_1.useRoute)();
59
+ const fdDataFromRoute = (_a = route === null || route === void 0 ? void 0 : route.params) === null || _a === void 0 ? void 0 : _a.fdData;
60
+ // Route params processed
61
+ const colors = (0, ThemeContext_1.useColors)();
62
+ const typography = (0, ThemeContext_1.useTypography)();
63
+ const { themeName } = (0, ThemeContext_1.useTheme)();
64
+ const styles = createStyles(colors, typography, themeName);
65
+ // Previous State API
66
+ const [previousState] = (0, workflowApi_1.usePreviousStateMutation)();
67
+ const { masterData, setMasterData } = (0, MasterDataProvider_1.useMasterData)();
68
+ 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; });
69
+ 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; });
70
+ 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; });
71
+ 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; });
72
+ 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; });
73
+ // Customer Application Details API
74
+ const [getCustomerApplicationDetails, { data: customerApplicationDetails, error: customerApplicationDetailsError, isLoading: isLoadingCustomerApplicationDetails, }] = (0, customerApi_1.useGetCustomerApplicationDetailsMutation)();
75
+ // PAN Rapid API
76
+ const [panRapidNo, { data: panRapidResponse, error: panRapidError, isLoading: isLoadingPanRapid, }] = (0, kycApi_1.usePanRapidNoMutation)();
77
+ // Get providerId from app data or use default
78
+ const appData = (0, appDataConfig_1.getAppData)();
79
+ const defaultProviderId = (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 FD provider ID
80
+ // Use master data from global state if available
81
+ const effectiveMasterData = masterData;
82
+ // Call customer application details API on component mount
83
+ react_1.default.useEffect(() => {
84
+ // Ensure IDs are available from onboarding before calling API
85
+ if (!applicationId || !customerId) {
86
+ return;
87
+ }
88
+ // Use async/await for better error handling
89
+ const callAPI = async () => {
90
+ try {
91
+ // Add timeout to detect if API call is hanging
92
+ const timeoutPromise = new Promise((_, reject) => {
93
+ setTimeout(() => reject(new Error('API call timeout after 60 seconds')), 60000);
94
+ });
95
+ // Get user info from app data
96
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
97
+ const apiPromise = getCustomerApplicationDetails({
98
+ providerId: defaultProviderId,
99
+ applicationId: applicationId,
100
+ customerId: customerId,
101
+ workflowInstanceId: workflowInstanceId,
102
+ userreferenceid: userInfo.userReferenceId,
103
+ applicationid: applicationId,
104
+ entityid: entityId,
105
+ }).unwrap();
106
+ const response = await Promise.race([apiPromise, timeoutPromise]);
107
+ }
108
+ catch (error) {
109
+ // Handle error silently or implement proper error handling
110
+ }
111
+ };
112
+ callAPI();
113
+ }, [applicationId, customerId, workflowInstanceId]);
114
+ // Update form data when API response is received
115
+ react_1.default.useEffect(() => {
116
+ if (customerApplicationDetails === null || customerApplicationDetails === void 0 ? void 0 : customerApplicationDetails.data) {
117
+ const apiData = customerApplicationDetails.data;
118
+ // Check if KYC details exist in the response
119
+ if (apiData.kyc_details && Array.isArray(apiData.kyc_details) && apiData.kyc_details.length > 0) {
120
+ // Use the first KYC detail (assuming there's one primary KYC record)
121
+ const kycDetail = apiData.kyc_details[0];
122
+ setKycData(prev => (Object.assign(Object.assign({}, prev), {
123
+ // Map KYC detail fields to form fields - API data takes priority
124
+ panCard: kycDetail.panNumber || prev.panCard, dateOfBirth: kycDetail.dob ? formatDateForDisplay(kycDetail.dob) : prev.dateOfBirth, maritalStatus: kycDetail.maritalStatus || prev.maritalStatus, kycRelation: kycDetail.kycRelation || kycDetail.KYCRelation || kycDetail.kycrelation || prev.kycRelation, kycRelationName: kycDetail.kycRelationName || kycDetail.KYCRelationName || kycDetail.kycrelationname || prev.kycRelationName, area: kycDetail.area || prev.area, city: kycDetail.city || prev.city, addressLine1: kycDetail.addressLine1 || kycDetail.address || prev.addressLine1, addressLine2: kycDetail.addressLine2 || prev.addressLine2, pincode: kycDetail.pincode || prev.pincode, state: kycDetail.state || prev.state, country: kycDetail.country || prev.country })));
125
+ }
126
+ // Also check for customer data in the response for marital status and other fields
127
+ if (apiData.customer) {
128
+ setKycData(prev => (Object.assign(Object.assign({}, prev), { maritalStatus: apiData.customer.marital_status || prev.maritalStatus, dateOfBirth: apiData.customer.dob ? formatDateForDisplay(apiData.customer.dob) : prev.dateOfBirth, kycRelation: apiData.customer.kycRelation || apiData.customer.KYCRelation || apiData.customer.kycrelation || prev.kycRelation, kycRelationName: apiData.customer.kycRelationName || apiData.customer.KYCRelationName || apiData.customer.kycrelationname || prev.kycRelationName })));
129
+ }
130
+ // Check for address data in the response
131
+ if (apiData.address) {
132
+ setKycData(prev => (Object.assign(Object.assign({}, prev), { area: apiData.address.area || prev.area, city: apiData.address.city || prev.city, addressLine1: apiData.address.line1 || prev.addressLine1, addressLine2: apiData.address.line2 || prev.addressLine2, pincode: apiData.address.pincode || prev.pincode, state: apiData.address.state || prev.state, country: apiData.address.country || prev.country })));
133
+ }
134
+ }
135
+ }, [customerApplicationDetails]);
136
+ // App data is already loaded above
137
+ // Helper function to format date from YYYY-MM-DD to DD/MM/YYYY
138
+ const formatDateForDisplay = (dateString) => {
139
+ if (!dateString)
140
+ return '';
141
+ const [year, month, day] = dateString.split('-');
142
+ return `${day}/${month}/${year}`;
143
+ };
144
+ // Marital status is now used as-is from API without any code conversion
145
+ // App data processed
146
+ // API status monitoring complete
147
+ const initialKycRelation = (_e = (_d = (_c = (_b = initialData === null || initialData === void 0 ? void 0 : initialData.kycRelation) !== null && _b !== void 0 ? _b : initialData === null || initialData === void 0 ? void 0 : initialData.KYCRelation) !== null && _c !== void 0 ? _c : appData === null || appData === void 0 ? void 0 : appData.kycRelation) !== null && _d !== void 0 ? _d : appData === null || appData === void 0 ? void 0 : appData.KYCRelation) !== null && _e !== void 0 ? _e : '';
148
+ const [kycData, setKycData] = (0, react_1.useState)({
149
+ panCard: (initialData === null || initialData === void 0 ? void 0 : initialData.panCard) || (appData === null || appData === void 0 ? void 0 : appData.panNumber) || '',
150
+ dateOfBirth: (initialData === null || initialData === void 0 ? void 0 : initialData.dateOfBirth) || formatDateForDisplay((appData === null || appData === void 0 ? void 0 : appData.dob) || ''),
151
+ maritalStatus: (initialData === null || initialData === void 0 ? void 0 : initialData.maritalStatus) || (appData === null || appData === void 0 ? void 0 : appData.maritalStatus) || '', // Keep empty to show placeholder
152
+ kycRelation: initialKycRelation, // Keep empty to show placeholder
153
+ kycRelationName: (initialData === null || initialData === void 0 ? void 0 : initialData.kycRelationName) || (appData === null || appData === void 0 ? void 0 : appData.kycRelationName) || '',
154
+ area: (initialData === null || initialData === void 0 ? void 0 : initialData.area) || (appData === null || appData === void 0 ? void 0 : appData.area) || '',
155
+ city: (initialData === null || initialData === void 0 ? void 0 : initialData.city) || (appData === null || appData === void 0 ? void 0 : appData.city) || '',
156
+ addressLine1: (initialData === null || initialData === void 0 ? void 0 : initialData.addressLine1) || (appData === null || appData === void 0 ? void 0 : appData.address) || '',
157
+ addressLine2: (initialData === null || initialData === void 0 ? void 0 : initialData.addressLine2) || (appData === null || appData === void 0 ? void 0 : appData.area) || '', // Use area as address line 2
158
+ pincode: (initialData === null || initialData === void 0 ? void 0 : initialData.pincode) || (appData === null || appData === void 0 ? void 0 : appData.pinCode) || '',
159
+ state: (initialData === null || initialData === void 0 ? void 0 : initialData.state) || (appData === null || appData === void 0 ? void 0 : appData.state) || '',
160
+ country: (initialData === null || initialData === void 0 ? void 0 : initialData.country) || (appData === null || appData === void 0 ? void 0 : appData.country) || '',
161
+ useExistingAddress: (_f = initialData === null || initialData === void 0 ? void 0 : initialData.useExistingAddress) !== null && _f !== void 0 ? _f : false,
162
+ });
163
+ // Error states for each field
164
+ const [fieldErrors, setFieldErrors] = (0, react_1.useState)({});
165
+ // State to track marital status dropdown visibility
166
+ const [showMaritalStatusMenu, setShowMaritalStatusMenu] = (0, react_1.useState)(false);
167
+ const [isGoingBack, setIsGoingBack] = (0, react_1.useState)(false);
168
+ //State to track KYC relation dropdown visibility
169
+ const [showKYCRelationMenu, setShowKYCRelationMenu] = (0, react_1.useState)(false);
170
+ // Ref to track currently focused text input
171
+ const focusedTextInputRef = (0, react_1.useRef)(null);
172
+ // Refs for each text field
173
+ const panCardRef = (0, react_1.useRef)(null);
174
+ const dateOfBirthRef = (0, react_1.useRef)(null);
175
+ const kycRelationNameRef = (0, react_1.useRef)(null);
176
+ const areaRef = (0, react_1.useRef)(null);
177
+ const cityRef = (0, react_1.useRef)(null);
178
+ const addressLine1Ref = (0, react_1.useRef)(null);
179
+ const addressLine2Ref = (0, react_1.useRef)(null);
180
+ const pincodeRef = (0, react_1.useRef)(null);
181
+ const stateRef = (0, react_1.useRef)(null);
182
+ const countryRef = (0, react_1.useRef)(null);
183
+ // Function to close dropdown when other fields are focused
184
+ const closeDropdown = () => {
185
+ setShowMaritalStatusMenu(false);
186
+ setShowKYCRelationMenu(false);
187
+ };
188
+ // Function to blur currently focused text input
189
+ const blurFocusedTextInput = () => {
190
+ if (focusedTextInputRef.current) {
191
+ focusedTextInputRef.current.blur();
192
+ focusedTextInputRef.current = null;
193
+ }
194
+ };
195
+ // Function to handle focus and store ref
196
+ const handleFieldFocus = (ref) => {
197
+ // Blur any previously focused field
198
+ blurFocusedTextInput();
199
+ // Store the new focused field ref
200
+ focusedTextInputRef.current = ref.current;
201
+ // Close dropdown
202
+ closeDropdown();
203
+ };
204
+ // Add keyboard event listener to close dropdown when keyboard appears
205
+ (0, react_1.useEffect)(() => {
206
+ const keyboardDidShowListener = react_native_1.Keyboard.addListener('keyboardDidShow', () => {
207
+ closeDropdown();
208
+ });
209
+ return () => {
210
+ keyboardDidShowListener === null || keyboardDidShowListener === void 0 ? void 0 : keyboardDidShowListener.remove();
211
+ };
212
+ }, []);
213
+ // Get marital status options from master data with fallback
214
+ const maritalStatusOptions = react_1.default.useMemo(() => {
215
+ try {
216
+ const src = (effectiveMasterData === null || effectiveMasterData === void 0 ? void 0 : effectiveMasterData.data) || effectiveMasterData || {};
217
+ const raw = (src === null || src === void 0 ? void 0 : src.maritalStatusOptions) ||
218
+ (src === null || src === void 0 ? void 0 : src.maritalStatusList) ||
219
+ (src === null || src === void 0 ? void 0 : src.maritalStatus) ||
220
+ (src === null || src === void 0 ? void 0 : src.maritalOptions);
221
+ if (Array.isArray(raw) && raw.length) {
222
+ return raw.map((v) => String(v)).filter(Boolean);
223
+ }
224
+ if (typeof raw === 'string' && raw.trim().length) {
225
+ return raw.split(',').map((v) => v.trim()).filter(Boolean);
226
+ }
227
+ // Fallback defaults
228
+ return ['Married', 'Unmarried', 'Other'];
229
+ }
230
+ catch (e) {
231
+ return ['Married', 'Unmarried', 'Other'];
232
+ }
233
+ }, [effectiveMasterData]);
234
+ const kycRelationOptions = react_1.default.useMemo(() => {
235
+ try {
236
+ const src = (effectiveMasterData === null || effectiveMasterData === void 0 ? void 0 : effectiveMasterData.data) || effectiveMasterData || {};
237
+ const raw = (src === null || src === void 0 ? void 0 : src.KYCRelation) ||
238
+ (src === null || src === void 0 ? void 0 : src.KYCRelation) ||
239
+ (src === null || src === void 0 ? void 0 : src.KYCRelation) ||
240
+ (src === null || src === void 0 ? void 0 : src.KYCRelation);
241
+ if (Array.isArray(raw) && raw.length) {
242
+ return raw.map((v) => String(v)).filter(Boolean);
243
+ }
244
+ if (typeof raw === 'string' && raw.trim().length) {
245
+ return raw.split(',').map((v) => v.trim()).filter(Boolean);
246
+ }
247
+ // Fallback defaults
248
+ return ['Father', 'Mother', 'Spouse'];
249
+ }
250
+ catch (e) {
251
+ return ['Father', 'Mother', 'Spouse'];
252
+ }
253
+ }, [effectiveMasterData]);
254
+ // Do not auto-select a default marital status; keep empty to show placeholder when not provided by main app or API
255
+ // Validate individual field and set error
256
+ const validateField = (field, value) => {
257
+ if (!value || value.trim().length === 0) {
258
+ // Use "District" for area field
259
+ if (field === 'area') {
260
+ return 'District is required';
261
+ }
262
+ if (field === 'kycRelation') {
263
+ return 'KYC relation is required';
264
+ }
265
+ if (field === 'kycRelationName') {
266
+ return 'KYC relation name is required';
267
+ }
268
+ return `${field.charAt(0).toUpperCase() + field.slice(1)} is required`;
269
+ }
270
+ // Minimum 2 characters validation for text fields (excluding PAN, pincode, dateOfBirth, maritalStatus)
271
+ const textFields = ['kycRelationName', 'area', 'city', 'addressLine1', 'addressLine2', 'state', 'country'];
272
+ if (textFields.includes(field)) {
273
+ if (value.trim().length < 2) {
274
+ // Use "Address" for addressLine1 and addressLine2
275
+ if (field === 'addressLine1' || field === 'addressLine2') {
276
+ return 'Address must be at least 2 characters';
277
+ }
278
+ else if (field === 'area') {
279
+ return 'District must be at least 2 characters';
280
+ }
281
+ return `${field.charAt(0).toUpperCase() + field.slice(1)} must be at least 2 characters`;
282
+ }
283
+ }
284
+ // Special validation for PAN Card
285
+ if (field === 'panCard') {
286
+ const panRegex = /^[A-Z]{5}[0-9]{4}[A-Z]{1}$/;
287
+ const upperValue = value.toUpperCase();
288
+ if (!panRegex.test(upperValue)) {
289
+ return 'Please enter a valid PAN (e.g., ABCDE1234F)';
290
+ }
291
+ }
292
+ // Special validation for pincode
293
+ if (field === 'pincode') {
294
+ if (!validatePincode(value)) {
295
+ return 'Please enter a valid 6-digit pincode (should not start with 0)';
296
+ }
297
+ }
298
+ return '';
299
+ };
300
+ // Render error message for a field
301
+ const renderFieldError = (field) => {
302
+ const error = fieldErrors[field];
303
+ if (!error)
304
+ return null;
305
+ return (react_1.default.createElement(react_native_1.View, { style: styles.errorContainer },
306
+ react_native_1.Platform.OS === 'android' && (react_1.default.createElement(Ionicons_1.default, { name: "warning", size: 16, color: colors.error || '#FF0000', style: styles.errorIcon })),
307
+ react_1.default.createElement(react_native_1.Text, { style: styles.errorText }, error)));
308
+ };
309
+ // Enhanced field validation functions
310
+ const validateAndCleanText = (text, field) => {
311
+ let cleanedText = text;
312
+ // Apply field-specific validation
313
+ switch (field) {
314
+ case 'panCard':
315
+ // Only allow alphanumeric, limit to 10 characters
316
+ // Don't uppercase here to prevent cursor jumping - let autoCapitalize handle display
317
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9]/g, '').substring(0, 10);
318
+ break;
319
+ case 'area':
320
+ // Allow only letters, numbers, spaces; collapse spaces; limit length
321
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, ' ').substring(0, 50);
322
+ break;
323
+ case 'city':
324
+ // Allow only letters, numbers, spaces; collapse spaces; limit length
325
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, ' ').substring(0, 30);
326
+ break;
327
+ case 'addressLine1':
328
+ case 'addressLine2':
329
+ // Allow letters, numbers, spaces, and common address special characters (comma, period, hyphen, slash, hash, parentheses, apostrophe, quotes)
330
+ // Collapse multiple spaces to single space; limit length
331
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9 ,./()#'"-]/g, '').replace(/\s+/g, ' ').substring(0, 100);
332
+ break;
333
+ case 'pincode':
334
+ // Only allow digits and limit to 6 characters
335
+ cleanedText = cleanedText.replace(/[^0-9]/g, '').substring(0, 6);
336
+ break;
337
+ case 'kycRelationName':
338
+ cleanedText = cleanedText.replace(/[^a-zA-Z ]/g, '').replace(/\s+/g, ' ').substring(0, 50);
339
+ break;
340
+ case 'state':
341
+ // Allow only letters, numbers, spaces; collapse spaces; limit length
342
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, ' ').substring(0, 40);
343
+ break;
344
+ case 'country':
345
+ // Allow only letters, numbers, spaces; collapse spaces; limit length
346
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, ' ').substring(0, 40);
347
+ break;
348
+ default:
349
+ // Default: allow only letters, numbers, spaces
350
+ cleanedText = cleanedText.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, ' ');
351
+ break;
352
+ }
353
+ return cleanedText;
354
+ };
355
+ const validatePincode = (pincode) => {
356
+ // Must be exactly 6 digits
357
+ if (pincode.length !== 6)
358
+ return false;
359
+ // Must be all digits
360
+ if (!/^\d{6}$/.test(pincode))
361
+ return false;
362
+ // Basic pincode validation (first digit should be 1-9, not 0)
363
+ if (pincode.startsWith('0'))
364
+ return false;
365
+ return true;
366
+ };
367
+ const updateField = (field, value) => {
368
+ // Apply validation and cleaning for text fields
369
+ let processedValue = value;
370
+ if (typeof value === 'string' && field !== 'useExistingAddress') {
371
+ processedValue = validateAndCleanText(value, field);
372
+ }
373
+ setKycData(prev => {
374
+ const newData = Object.assign(Object.assign({}, prev), { [field]: processedValue });
375
+ // Log checkbox state changes
376
+ if (field === 'useExistingAddress') {
377
+ // Checkbox state changed
378
+ }
379
+ return newData;
380
+ });
381
+ // Validate field and set error
382
+ if (typeof processedValue === 'string') {
383
+ const error = validateField(field, processedValue);
384
+ setFieldErrors(prev => (Object.assign(Object.assign({}, prev), { [field]: error })));
385
+ }
386
+ };
387
+ // Helper function to format date from DD/MM/YYYY back to YYYY-MM-DD
388
+ const formatDateForAPI = (dateString) => {
389
+ if (!dateString)
390
+ return '';
391
+ const [day, month, year] = dateString.split('/');
392
+ return `${year}-${month}-${day}`;
393
+ };
394
+ // Pass-through marital status: use the exact value from master data (no S/M/D mapping)
395
+ const getMaritalStatusCode = (display) => {
396
+ return display || '';
397
+ };
398
+ // Validation function to check if all required fields are filled and valid
399
+ const validateForm = () => {
400
+ const requiredFields = [
401
+ kycData.panCard,
402
+ kycData.dateOfBirth,
403
+ kycData.maritalStatus,
404
+ kycData.kycRelation,
405
+ kycData.kycRelationName,
406
+ kycData.area,
407
+ kycData.city,
408
+ kycData.addressLine1,
409
+ kycData.pincode,
410
+ kycData.state,
411
+ kycData.country,
412
+ ];
413
+ // Check if all required fields are filled
414
+ const allFieldsFilled = requiredFields.every(field => field && field.trim().length > 0);
415
+ // Check minimum 2 characters for text fields (only if field is filled)
416
+ const textFields = {
417
+ kycRelationName: kycData.kycRelationName,
418
+ area: kycData.area,
419
+ city: kycData.city,
420
+ addressLine1: kycData.addressLine1,
421
+ state: kycData.state,
422
+ country: kycData.country,
423
+ };
424
+ const allTextFieldsValid = Object.values(textFields).every(field => {
425
+ // If field is empty, it's already checked by allFieldsFilled
426
+ // If field has value, it must be at least 2 characters
427
+ return !field || field.trim().length === 0 || field.trim().length >= 2;
428
+ });
429
+ // Additional validation for pincode
430
+ const isPincodeValid = validatePincode(kycData.pincode);
431
+ return allFieldsFilled && allTextFieldsValid && isPincodeValid;
432
+ };
433
+ const handleContinue = async () => {
434
+ console.log('following is the provider ID', defaultProviderId);
435
+ // try {
436
+ // // Validate all required fields
437
+ // if (!validateForm()) {
438
+ // // Check specifically for pincode validation
439
+ // if (!validatePincode(kycData.pincode)) {
440
+ // Alert.alert('Invalid Pincode', 'Please enter a valid 6-digit pincode (should not start with 0).');
441
+ // } else {
442
+ // Alert.alert('Required Fields', 'Please fill in all required fields before continuing.');
443
+ // }
444
+ // return;
445
+ // }
446
+ // // Convert the display format back to API format before sending
447
+ // const apiFormattedData = {
448
+ // ...kycData,
449
+ // dateOfBirth: formatDateForAPI(kycData.dateOfBirth),
450
+ // maritalStatus: getMaritalStatusCode(kycData.maritalStatus),
451
+ // kycRelation: kycData.kycRelation,
452
+ // kycRelationName: kycData.kycRelationName,
453
+ // };
454
+ // // Get user info from app data
455
+ // const userInfo = getUserInfoForAPI();
456
+ // // Call PAN rapid API (body fields from text fields/dropdowns)
457
+ // const panRapidRequest = {
458
+ // // headers via panApi: provider/workflowInstanceId/userreferenceid/applicationid
459
+ // providerId: defaultProviderId,
460
+ // workflowInstanceId, // from store
461
+ // userreferenceid: userInfo.userReferenceId,
462
+ // applicationid: applicationId,
463
+ // // required body params
464
+ // customerId: customerId,
465
+ // applicationId: applicationId,
466
+ // maritalStatus: getMaritalStatusCode(kycData.maritalStatus),
467
+ // kycRelation: kycData.kycRelation,
468
+ // kycRelationName: kycData.kycRelationName,
469
+ // area: kycData.area,
470
+ // addressLine1: kycData.addressLine1,
471
+ // addressLine2: kycData.addressLine2, // Added missing addressLine2 field
472
+ // city: kycData.city,
473
+ // state: kycData.state,
474
+ // country: kycData.country,
475
+ // pincode: kycData.pincode,
476
+ // panNo: kycData.panCard.toUpperCase(), // Uppercase PAN before sending to API
477
+ // mobileNo: userInfo.mobileNumber,
478
+ // addressConsentGiven: !!kycData.useExistingAddress,
479
+ // };
480
+ // const panResponse = await panRapidNo(panRapidRequest).unwrap();
481
+ // // Normalize payload (API returns data as array of one element)
482
+ // const payload: any = Array.isArray((panResponse as any)?.data)
483
+ // ? (panResponse as any).data[0]
484
+ // : (panResponse as any)?.data ?? (panResponse as any);
485
+ // // Extract fields with tolerant casing/locations
486
+ // const panRapidNumber = payload?.panRapidNumber ?? payload?.panrapidnumber ?? (panResponse as any)?.panRapidNumber ?? (panResponse as any)?.panrapidnumber ?? null;
487
+ // // Check demographicInfoSaved gate
488
+ // const demographicInfoSaved = payload?.demographicInfoSaved ?? (panResponse as any)?.demographicInfoSaved;
489
+ // if (!demographicInfoSaved) {
490
+ // Alert.alert('Action required', 'Your demographic information could not be saved. Please review the details and try again.');
491
+ // return;
492
+ // }
493
+ // const data = getGlobalData();
494
+ // // Decide next screen based on panrapidnumber existence
495
+ // if (panRapidNumber && data.completeFDData) {
496
+ // navigate('PayNow', { fdData: fdDataFromRoute });
497
+ // } else if (panRapidNumber) {
498
+ // navigate('Employee');
499
+ // } else {
500
+ // navigate('AadhaarVerification', { fdData: fdDataFromRoute });
501
+ // }
502
+ // // Do not trigger onContinue here; navigation is handled above
503
+ // } catch (error) {
504
+ // // Show error message to user
505
+ // Alert.alert(
506
+ // 'PAN Verification Failed',
507
+ // 'Unable to verify your PAN details. Please check your information and try again.',
508
+ // [{ text: 'OK' }]
509
+ // );
510
+ // // Do not navigate on failure - stay on current screen
511
+ // // User can retry or correct their information
512
+ // }
513
+ };
514
+ const renderInputField = (label, value, field, placeholder, editable = true, variant = 'text', maxLength, textInputRef) => (react_1.default.createElement(react_native_1.View, null,
515
+ react_1.default.createElement(TextFieldWithLabel_1.default, { label: label, value: value, onChangeText: (text) => updateField(field, text), placeholder: placeholder, editable: editable, variant: variant, maxLength: maxLength, keyboardType: variant === 'numeric' ? 'numeric' : variant === 'email' ? 'email-address' : 'default', autoCapitalize: variant === 'email' ? 'none' : 'words', onFocus: () => textInputRef && handleFieldFocus(textInputRef), textInputRef: textInputRef, returnKeyType: "done", onSubmitEditing: () => {
516
+ if (textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) {
517
+ textInputRef.current.blur();
518
+ }
519
+ react_native_1.Keyboard.dismiss();
520
+ } }),
521
+ renderFieldError(field)));
522
+ const renderMaritalStatusDropdown = () => {
523
+ return (react_1.default.createElement(react_native_1.View, null,
524
+ react_1.default.createElement(TextFieldWithLabel_1.default, { label: "Marital Status", value: kycData.maritalStatus, onChangeText: (text) => updateField('maritalStatus', text), variant: "dropdown", options: maritalStatusOptions, isDropdownOpen: showMaritalStatusMenu, onDropdownToggle: () => {
525
+ // Blur any focused text field when dropdown is opened
526
+ blurFocusedTextInput();
527
+ setShowKYCRelationMenu(false);
528
+ setShowMaritalStatusMenu(prev => !prev);
529
+ }, onDropdownSelect: (option) => {
530
+ setShowMaritalStatusMenu(false);
531
+ updateField('maritalStatus', option);
532
+ }, placeholder: "Select Marital Status", editable: true }),
533
+ showMaritalStatusMenu && (react_1.default.createElement(react_native_1.View, { style: styles.inlineMenu }, maritalStatusOptions.map((option) => (react_1.default.createElement(react_native_1.TouchableOpacity, { key: option, style: styles.modalOption, onPress: () => {
534
+ setShowMaritalStatusMenu(false);
535
+ updateField('maritalStatus', option);
536
+ } },
537
+ react_1.default.createElement(react_native_1.Text, { style: styles.modalOptionText }, option)))))),
538
+ renderFieldError('maritalStatus')));
539
+ };
540
+ const renderKycRelationDropDown = () => {
541
+ return (react_1.default.createElement(react_native_1.View, null,
542
+ react_1.default.createElement(TextFieldWithLabel_1.default, { label: "KYC Relation", value: kycData.kycRelation, onChangeText: (text) => updateField('kycRelation', text), variant: "dropdown", options: kycRelationOptions, isDropdownOpen: showKYCRelationMenu, onDropdownToggle: () => {
543
+ // Blur any focused text field when dropdown is opened
544
+ blurFocusedTextInput();
545
+ setShowMaritalStatusMenu(false);
546
+ setShowKYCRelationMenu(prev => !prev);
547
+ }, onDropdownSelect: (option) => {
548
+ setShowKYCRelationMenu(false);
549
+ updateField('kycRelation', option);
550
+ }, placeholder: "Select KYC Relation", editable: true }),
551
+ showKYCRelationMenu && (react_1.default.createElement(react_native_1.View, { style: styles.inlineMenu }, kycRelationOptions.map((option) => (react_1.default.createElement(react_native_1.TouchableOpacity, { key: option, style: styles.modalOption, onPress: () => {
552
+ setShowKYCRelationMenu(false);
553
+ updateField('kycRelation', option);
554
+ } },
555
+ react_1.default.createElement(react_native_1.Text, { style: styles.modalOptionText }, option)))))),
556
+ renderFieldError('kycRelation')));
557
+ };
558
+ const renderDateField = (label, value, field, editable = true, textInputRef) => (react_1.default.createElement(react_native_1.View, null,
559
+ react_1.default.createElement(TextFieldWithLabel_1.default, { label: label, value: value, onChangeText: (text) => updateField(field, text), variant: "date", placeholder: "DD/MM/YYYY", maxLength: 10, dateFormat: "DD/MM/YYYY", editable: editable, onFocus: () => textInputRef && handleFieldFocus(textInputRef), textInputRef: textInputRef, onDatePress: () => {
560
+ // TODO: Implement date picker if needed
561
+ }, returnKeyType: "done", onSubmitEditing: () => {
562
+ if (textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) {
563
+ textInputRef.current.blur();
564
+ }
565
+ react_native_1.Keyboard.dismiss();
566
+ } }),
567
+ renderFieldError(field)));
568
+ // Handler for back button (used by both header and hardware back button)
569
+ const handleBackPress = async () => {
570
+ setIsGoingBack(true);
571
+ try {
572
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
573
+ await previousState({
574
+ providerId: defaultProviderId,
575
+ workflowInstanceId,
576
+ userreferenceid: userInfo.userReferenceId,
577
+ applicationid: applicationId,
578
+ entityid: entityId,
579
+ });
580
+ }
581
+ catch (e) {
582
+ // Handle error silently
583
+ }
584
+ finally {
585
+ setIsGoingBack(false);
586
+ //onGoBack?.();
587
+ (0, helpers_1.navigate)('FDCalculator');
588
+ }
589
+ };
590
+ // Handle Android hardware back button
591
+ (0, react_1.useEffect)(() => {
592
+ if (react_native_1.Platform.OS !== 'android')
593
+ return;
594
+ const onHardwareBackPress = () => {
595
+ handleBackPress();
596
+ return true; // Prevent default behavior
597
+ };
598
+ const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onHardwareBackPress);
599
+ return () => backHandler.remove();
600
+ }, [defaultProviderId, workflowInstanceId, applicationId, entityId]);
601
+ return (react_1.default.createElement(SafeAreaWrapper_1.default, { includeTop: false, bottomPadding: 25, statusBarColor: "#000000", statusBarStyle: "light-content" },
602
+ react_1.default.createElement(components_1.Header, { title: "Review KYC", onBackPress: handleBackPress, backgroundColor: colors.primary }),
603
+ react_1.default.createElement(react_native_1.KeyboardAvoidingView, { behavior: react_native_1.Platform.OS === 'ios' ? 'padding' : undefined, style: styles.keyboardAvoidingView, keyboardVerticalOffset: react_native_1.Platform.OS === 'ios' ? 0 : 0 },
604
+ react_1.default.createElement(react_native_1.ScrollView, { style: styles.container, showsVerticalScrollIndicator: false, scrollEnabled: !isLoadingPanRapid, keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.scrollContent },
605
+ react_1.default.createElement(react_native_1.TouchableWithoutFeedback, { onPress: isLoadingPanRapid ? undefined : closeDropdown },
606
+ react_1.default.createElement(react_native_1.View, null,
607
+ react_1.default.createElement(react_native_1.View, null,
608
+ react_1.default.createElement(TextFieldWithLabel_1.default, { label: "PAN Card", value: kycData.panCard, onChangeText: (text) => updateField('panCard', text), placeholder: "Enter PAN Card", editable: false, variant: "text", maxLength: 10, keyboardType: "default", autoCapitalize: "characters", onFocus: () => handleFieldFocus(panCardRef), textInputRef: panCardRef, returnKeyType: "done", onSubmitEditing: () => {
609
+ if (panCardRef === null || panCardRef === void 0 ? void 0 : panCardRef.current) {
610
+ panCardRef.current.blur();
611
+ }
612
+ react_native_1.Keyboard.dismiss();
613
+ } }),
614
+ renderFieldError('panCard')),
615
+ renderDateField('Date of Birth', kycData.dateOfBirth, 'dateOfBirth', false, dateOfBirthRef),
616
+ renderMaritalStatusDropdown(),
617
+ renderKycRelationDropDown(),
618
+ renderInputField('KYC Relation Name', kycData.kycRelationName, 'kycRelationName', 'Enter KYC Relation Name', true, 'text', 50, kycRelationNameRef),
619
+ renderInputField('District', kycData.area, 'area', 'Enter District', true, 'text', 50, areaRef),
620
+ renderInputField('City', kycData.city, 'city', 'Enter City', true, 'text', 30, cityRef),
621
+ renderInputField('Address line 1', kycData.addressLine1, 'addressLine1', 'Enter Address Line 1', true, 'text', 100, addressLine1Ref),
622
+ renderInputField('Address line 2', kycData.addressLine2, 'addressLine2', 'Enter Address Line 2', true, 'text', 100, addressLine2Ref),
623
+ renderInputField('Pincode', kycData.pincode, 'pincode', 'Enter Pincode', true, 'numeric', 6, pincodeRef),
624
+ renderInputField('State', kycData.state, 'state', 'Enter State', true, 'text', undefined, stateRef),
625
+ renderInputField('Country', kycData.country, 'country', 'Enter Country', true, 'text', undefined, countryRef),
626
+ react_1.default.createElement(react_native_1.View, { style: styles.checkboxContainer },
627
+ react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.checkbox, onPress: () => updateField('useExistingAddress', !kycData.useExistingAddress) },
628
+ react_1.default.createElement(react_native_1.View, { style: [
629
+ styles.checkboxBox,
630
+ kycData.useExistingAddress && styles.checkboxChecked
631
+ ] }, kycData.useExistingAddress ? (react_1.default.createElement(react_native_1.Image, { source: { uri: (themeName === 'dark') ? base64Images_1.base64Images.checkBoxDark : base64Images_1.base64Images.filledCheckBox }, resizeMode: "cover", width: 20, height: 20 })) : ((themeName === 'dark') ? (react_1.default.createElement(react_native_1.Image, { source: { uri: base64Images_1.base64Images.unCheckBoxDark }, resizeMode: "cover", width: 20, height: 20 })) : null))),
632
+ react_1.default.createElement(react_native_1.Text, { style: styles.checkboxText }, "For existing customers, we'll use the address from our records. For new customers, the address from your Aadhar card will be used. To update, please raise a service request with valid address proof.")))))),
633
+ react_1.default.createElement(ActionButton_1.default, { title: "Continue", onPress: handleContinue, disabled: !kycData.useExistingAddress || isLoadingPanRapid || !validateForm(), loading: isLoadingPanRapid }),
634
+ isLoadingPanRapid && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" })),
635
+ isGoingBack && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" },
636
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary })))));
637
+ };
638
+ const createStyles = (colors, typography, themeName) => react_native_1.StyleSheet.create({
639
+ keyboardAvoidingView: {
640
+ flex: 1,
641
+ },
642
+ container: {
643
+ flex: 1,
644
+ paddingHorizontal: 16,
645
+ paddingTop: 20,
646
+ },
647
+ scrollContent: {
648
+ flexGrow: 1,
649
+ },
650
+ checkboxContainer: {
651
+ flexDirection: 'row',
652
+ alignItems: 'flex-start',
653
+ marginBottom: 40,
654
+ paddingHorizontal: 4,
655
+ marginTop: 16,
656
+ },
657
+ checkbox: {
658
+ marginRight: 12,
659
+ marginTop: 2,
660
+ },
661
+ checkboxBox: {
662
+ width: 20,
663
+ height: 20,
664
+ borderWidth: 2,
665
+ borderColor: themeName === 'dark' ? colors.tabSelected : colors.primary,
666
+ borderRadius: 4,
667
+ alignItems: 'center',
668
+ justifyContent: 'center',
669
+ backgroundColor: 'white',
670
+ },
671
+ checkboxChecked: {
672
+ // backgroundColor: colors.primary,
673
+ },
674
+ checkboxText: Object.assign(Object.assign({}, typography.styles.bodySmall), { color: colors.textLight, flex: 1, lineHeight: 18 }),
675
+ inlineMenu: {
676
+ backgroundColor: themeName === 'dark' ? colors.inputBackground : colors.background,
677
+ borderWidth: themeName === 'dark' ? 1 : 0.5,
678
+ borderColor: themeName === 'dark' ? '#ffffff' : 'rgba(0,0,0,0.2)',
679
+ borderRadius: 8,
680
+ marginTop: -20,
681
+ marginBottom: 10,
682
+ paddingHorizontal: 12,
683
+ paddingVertical: 6,
684
+ },
685
+ modalOption: {
686
+ paddingVertical: 14,
687
+ },
688
+ modalOptionText: Object.assign(Object.assign({}, typography.styles.bodyLarge), { color: colors.text }),
689
+ debugButtonsContainer: {
690
+ marginBottom: 16,
691
+ },
692
+ debugButton: {
693
+ paddingHorizontal: 16,
694
+ paddingVertical: 12,
695
+ borderRadius: 8,
696
+ marginBottom: 8,
697
+ alignItems: 'center',
698
+ },
699
+ debugButtonText: Object.assign(Object.assign({}, typography.styles.bodyMedium), { fontWeight: '600' }),
700
+ errorContainer: {
701
+ flexDirection: 'row',
702
+ alignItems: 'center',
703
+ marginTop: -20,
704
+ marginBottom: 20,
705
+ },
706
+ errorIcon: {
707
+ marginRight: 6,
708
+ },
709
+ errorText: {
710
+ fontSize: 12,
711
+ color: colors.error || '#FF0000',
712
+ fontWeight: '500',
713
+ flex: 1,
714
+ },
715
+ loadingOverlay: {
716
+ position: 'absolute',
717
+ top: 0,
718
+ left: 0,
719
+ right: 0,
720
+ bottom: 0,
721
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
722
+ justifyContent: 'center',
723
+ alignItems: 'center',
724
+ zIndex: 1000,
725
+ },
726
+ });
727
+ exports.default = ReviewKYC;