@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,1853 @@
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 react_native_1 = require("react-native");
41
+ const native_1 = require("@react-navigation/native");
42
+ const components_1 = require("../components");
43
+ const ThemeContext_1 = require("../theme/ThemeContext");
44
+ const interestRateApi_1 = require("../api/interestRateApi");
45
+ const customerApi_1 = require("../api/customerApi");
46
+ const masterDataApi_1 = require("../api/masterDataApi");
47
+ const MasterDataProvider_1 = require("../providers/MasterDataProvider");
48
+ const workflowApi_1 = require("../api/workflowApi");
49
+ const fdApi_1 = require("../api/fdApi");
50
+ const SafeAreaWrapper_1 = __importDefault(require("../components/SafeAreaWrapper"));
51
+ const appDataConfig_1 = require("../config/appDataConfig");
52
+ const helpers_1 = require("../navigation/helpers");
53
+ const store_1 = require("../store");
54
+ const onboardingSlice_1 = require("../store/onboardingSlice");
55
+ const fdListSelectedSlice_1 = require("../store/fdListSelectedSlice");
56
+ const workflowNavigator_1 = require("../navigation/workflowNavigator");
57
+ const workflowConstants_1 = require("../config/workflowConstants");
58
+ const globalData_1 = require("../utils/globalData");
59
+ const mahindrafdsdk_1 = require("@finspringinnovations/mahindrafdsdk");
60
+ const strings_1 = require("../constants/strings");
61
+ const base64Images_1 = require("../constants/strings/base64Images");
62
+ const shriramfdsdk_1 = require("@finspringinnovations/shriramfdsdk");
63
+ const mahindrafdsdk_2 = require("@finspringinnovations/mahindrafdsdk");
64
+ var completeFDData = null;
65
+ /** Resolve company logo type for FD list card by name or provider. */
66
+ function getLogoTypeForFD(fd) {
67
+ const name = (fd.name || '').toLowerCase();
68
+ const providerId = (fd.providerId || '').toLowerCase();
69
+ if (name.includes('shriram') || providerId.includes('shriram'))
70
+ return 'shriram';
71
+ if (name.includes('mahindra') || providerId.includes('mahindra') || providerId.includes('881d0b98'))
72
+ return 'mahindra';
73
+ return undefined;
74
+ }
75
+ /** Statuses that count as pending/active (in-progress) workflow. */
76
+ const PENDING_ACTIVE_STATUSES = ['active', 'pending', 'in_progress', 'in-progress'];
77
+ function getSdkTypeFromProviderId(providerId, mahindraProviderId, shriramProviderId) {
78
+ const lower = (providerId || '').toLowerCase();
79
+ if (lower === mahindraProviderId.toLowerCase())
80
+ return 'mahindra';
81
+ if (lower === shriramProviderId.toLowerCase())
82
+ return 'shriram';
83
+ return null;
84
+ }
85
+ /** Get the pending/active application for a given provider, if any. */
86
+ function getPendingOrActiveAppForProvider(applicationsData, providerId) {
87
+ const providerIdLower = (providerId || '').toLowerCase();
88
+ return applicationsData.find((a) => {
89
+ const appProviderId = (a.fd_provider_id || a.fdProviderId || a.provider_id || a.providerId || '').toLowerCase();
90
+ if (appProviderId !== providerIdLower)
91
+ return false;
92
+ const s = (a.wf_status || a.status || '').toString().toLowerCase();
93
+ return PENDING_ACTIVE_STATUSES.includes(s);
94
+ }) || null;
95
+ }
96
+ /** Convert application to pending FD display data. */
97
+ function appToPendingFDData(app) {
98
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
99
+ const invested = Number((_c = (_b = (_a = app.investment_amount) !== null && _a !== void 0 ? _a : app.amount) !== null && _b !== void 0 ? _b : app.investmentAmount) !== null && _c !== void 0 ? _c : 0);
100
+ const rate = Number((_e = (_d = app.interest_rate) !== null && _d !== void 0 ? _d : app.interestRate) !== null && _e !== void 0 ? _e : 0);
101
+ const value = Number((_j = (_h = (_g = (_f = app.current_value) !== null && _f !== void 0 ? _f : app.currentValue) !== null && _g !== void 0 ? _g : app.maturity_amount) !== null && _h !== void 0 ? _h : app.maturityAmount) !== null && _j !== void 0 ? _j : 0);
102
+ const maturityDateStr = app.maturity_date || app.maturityDate || '';
103
+ let maturityDate = '--';
104
+ if (maturityDateStr) {
105
+ const d = new Date(maturityDateStr);
106
+ if (!isNaN(d.getTime())) {
107
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
108
+ maturityDate = `${months[d.getMonth()]} ${d.getFullYear()}`;
109
+ }
110
+ }
111
+ const providerName = app.fd_provider_name || app.providerName || 'Mahindra Finance Ltd';
112
+ const logoType = getLogoTypeForFD({ name: providerName, providerId: app.fd_provider_id || app.fdProviderId || '' });
113
+ return {
114
+ name: providerName,
115
+ invested,
116
+ value,
117
+ returns: rate || 0,
118
+ maturityDate,
119
+ interestPayout: app.interest_payout_term || app.interestPayoutTerm || app.payout_term || 'Yearly',
120
+ logoType: logoType !== null && logoType !== void 0 ? logoType : undefined,
121
+ };
122
+ }
123
+ /** Resolve providerId from app payload robustly; infer from provider name when id key is missing. */
124
+ function resolveProviderIdFromApp(app, mahindraProviderId, shriramProviderId) {
125
+ const direct = (app === null || app === void 0 ? void 0 : app.fd_provider_id) ||
126
+ (app === null || app === void 0 ? void 0 : app.fdProviderId) ||
127
+ (app === null || app === void 0 ? void 0 : app.provider_id) ||
128
+ (app === null || app === void 0 ? void 0 : app.providerId) ||
129
+ (app === null || app === void 0 ? void 0 : app.fd_provider) ||
130
+ (app === null || app === void 0 ? void 0 : app.fdProvider) ||
131
+ (app === null || app === void 0 ? void 0 : app.provider);
132
+ if (direct)
133
+ return String(direct);
134
+ const providerName = String((app === null || app === void 0 ? void 0 : app.fd_provider_name) ||
135
+ (app === null || app === void 0 ? void 0 : app.fdProviderName) ||
136
+ (app === null || app === void 0 ? void 0 : app.provider_name) ||
137
+ (app === null || app === void 0 ? void 0 : app.providerName) ||
138
+ '').toLowerCase();
139
+ if (providerName.includes('mahindra'))
140
+ return mahindraProviderId;
141
+ if (providerName.includes('shriram'))
142
+ return shriramProviderId;
143
+ return '';
144
+ }
145
+ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToExternalSDK, customStyles = {}, }) => {
146
+ var _a;
147
+ const [activeTab, setActiveTab] = (0, react_1.useState)(strings_1.FD_STRINGS.ALL_FDS_TAB);
148
+ const [showPendingFDBottomSheet, setShowPendingFDBottomSheet] = (0, react_1.useState)(false);
149
+ const [selectedFD, setSelectedFD] = (0, react_1.useState)(null);
150
+ /** Application for which the pending bottom sheet is shown (matches the FD list card provider they tapped). Used for terminate/continue. */
151
+ const [pendingContextApp, setPendingContextApp] = (0, react_1.useState)(null);
152
+ const [isInitialized, setIsInitialized] = (0, react_1.useState)(false);
153
+ /** Loading state for Mahindra customer/application/details prefetch (used for pending FD continue). */
154
+ const [isLoadingMahindraCustomerDetails, setIsLoadingMahindraCustomerDetails] = (0, react_1.useState)(false);
155
+ const colors = (0, ThemeContext_1.useColors)();
156
+ const typography = (0, ThemeContext_1.useTypography)();
157
+ const spacing = (0, ThemeContext_1.useSpacing)();
158
+ const { themeName } = (0, ThemeContext_1.useTheme)();
159
+ const dispatch = (0, store_1.useAppDispatch)();
160
+ const hasFetchedRatesRef = react_1.default.useRef(false);
161
+ const isCallingInterestRatesRef = react_1.default.useRef(false);
162
+ const MahindraProviderId = '881d0b98-78d7-4668-931c-f4f47d753e9d';
163
+ const ShriramProviderId = '92d94e74-c5cb-4141-91ad-ffa05df7fbff';
164
+ // API calls to fetch
165
+ const [getInterestRates, { data: interestRates, error: interestRatesError, isLoading: isLoadingRates, }] = (0, interestRateApi_1.useGetInterestRatesMutation)();
166
+ const [getCustomerApplications, { data: customerApplications, error: customerApplicationsError, isLoading: isLoadingApplications, }] = (0, customerApi_1.useGetCustomerApplicationsMutation)();
167
+ const [getCustomerApplicationDetails] = (0, customerApi_1.useGetCustomerApplicationDetailsMutation)();
168
+ const [terminateWorkflow, { data: terminateWorkflowData, error: terminateWorkflowError, isLoading: isTerminatingWorkflow, }] = (0, workflowApi_1.useTerminateWorkflowMutation)();
169
+ // Payment Reverse Feed API
170
+ const [paymentReverseFeed, { data: paymentReverseFeedResponse, error: paymentReverseFeedError, isLoading: isLoadingPaymentReverseFeed, }] = (0, fdApi_1.usePaymentReverseFeedMutation)();
171
+ const styles = createStyles(colors, typography, spacing, themeName);
172
+ const { masterData: masterDataContext, setMasterData } = (0, MasterDataProvider_1.useMasterData)();
173
+ // Redux selectors for workflow IDs
174
+ 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; });
175
+ 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; });
176
+ 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; });
177
+ const providerId = (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; });
178
+ const onboardingIds = (0, store_1.useAppSelector)((state) => state === null || state === void 0 ? void 0 : state.onboarding);
179
+ // Shared promise ref so FDList pending-flow and eager prefetch can wait
180
+ // on the same Mahindra customer/application/details fetch.
181
+ const mahindraDetailsPrefetchPromiseRef = react_1.default.useRef(null);
182
+ const initializeExternalSDKFromFDList = (0, react_1.useCallback)((sdkType, options) => {
183
+ const silent = (options === null || options === void 0 ? void 0 : options.silent) === true;
184
+ const currentAppData = (0, appDataConfig_1.getAppData)();
185
+ const storedEnvData = (0, appDataConfig_1.getEnvironmentData)();
186
+ const currentEnvData = storedEnvData;
187
+ if (!currentAppData) {
188
+ if (!silent) {
189
+ react_native_1.Alert.alert('Error', 'SDK app data not available. Please restart FD flow.');
190
+ }
191
+ return false;
192
+ }
193
+ if (!currentEnvData) {
194
+ if (!silent) {
195
+ react_native_1.Alert.alert('Error', 'SDK environment data not available. Please initialize environment from host app.');
196
+ }
197
+ return false;
198
+ }
199
+ try {
200
+ if (sdkType === 'shriram') {
201
+ (0, shriramfdsdk_1.initializeEnvironment)(currentEnvData);
202
+ (0, shriramfdsdk_1.initializeSDK)(currentAppData);
203
+ }
204
+ else {
205
+ (0, mahindrafdsdk_2.initializeEnvironment)(currentEnvData);
206
+ (0, mahindrafdsdk_2.initializeSDK)(currentAppData);
207
+ }
208
+ return true;
209
+ }
210
+ catch (error) {
211
+ if (!silent) {
212
+ react_native_1.Alert.alert('Error', `Failed to initialize ${sdkType === 'shriram' ? 'Shriram' : 'Mahindra'} SDK: ${(error === null || error === void 0 ? void 0 : error.message) || 'Unknown error'}`);
213
+ }
214
+ return false;
215
+ }
216
+ }, []);
217
+ // As soon as FDList mounts, warm-initialize embedded SDKs with the same FDSDK data/env.
218
+ (0, react_1.useEffect)(() => {
219
+ initializeExternalSDKFromFDList('shriram', { silent: true });
220
+ initializeExternalSDKFromFDList('mahindra', { silent: true });
221
+ }, [initializeExternalSDKFromFDList]);
222
+ // Helper function to check if customer applications is empty
223
+ const isCustomerApplicationsEmpty = () => {
224
+ if (!customerApplications) {
225
+ return true;
226
+ }
227
+ // Handle direct array response
228
+ if (Array.isArray(customerApplications)) {
229
+ const isEmpty = customerApplications.length === 0;
230
+ return isEmpty;
231
+ }
232
+ // Handle response with data property
233
+ if (customerApplications.data && Array.isArray(customerApplications.data)) {
234
+ const isEmpty = customerApplications.data.length === 0;
235
+ return isEmpty;
236
+ }
237
+ // Handle response with applications property
238
+ if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
239
+ const isEmpty = customerApplications.applications.length === 0;
240
+ return isEmpty;
241
+ }
242
+ // If customerApplications exists but doesn't match expected structure, consider it not empty
243
+ return false;
244
+ };
245
+ // Helper function to get provider ID from interest rates response (robust to varying shapes)
246
+ const getProviderIdFromInterestRates = () => {
247
+ try {
248
+ const data = interestRates === null || interestRates === void 0 ? void 0 : interestRates.data;
249
+ if (!data)
250
+ return undefined;
251
+ const extractId = (rate) => {
252
+ var _a;
253
+ return ((rate === null || rate === void 0 ? void 0 : rate.providerId) ||
254
+ (rate === null || rate === void 0 ? void 0 : rate.provider_id) ||
255
+ (rate === null || rate === void 0 ? void 0 : rate.fd_provider_id) ||
256
+ (rate === null || rate === void 0 ? void 0 : rate.fdProviderId) ||
257
+ ((_a = rate === null || rate === void 0 ? void 0 : rate.provider) === null || _a === void 0 ? void 0 : _a.id) ||
258
+ undefined);
259
+ };
260
+ // Prefer SDR
261
+ const sdr = Array.isArray(data === null || data === void 0 ? void 0 : data.sdrScheme) ? data.sdrScheme : [];
262
+ for (const r of sdr) {
263
+ const id = extractId(r);
264
+ if (id) {
265
+ return id;
266
+ }
267
+ }
268
+ // Fallback to FDR
269
+ const fdr = Array.isArray(data === null || data === void 0 ? void 0 : data.fdrScheme) ? data.fdrScheme : [];
270
+ for (const r of fdr) {
271
+ const id = extractId(r);
272
+ if (id) {
273
+ return id;
274
+ }
275
+ }
276
+ return undefined;
277
+ }
278
+ catch (e) {
279
+ return undefined;
280
+ }
281
+ };
282
+ /**
283
+ * Prefetch Mahindra customer/application/details for the currently pending/active
284
+ * Mahindra FD application. This is used to ensure that when we navigate into
285
+ * Mahindra SDK screens (especially via "Continue" on a pending FD), all
286
+ * customer details are already available, and we show a loader while fetching.
287
+ */
288
+ const prefetchMahindraCustomerApplicationDetails = (0, react_1.useCallback)(async (overrideMahindraApp) => {
289
+ // Avoid duplicate fetches – reuse in-flight promise if any
290
+ if (mahindraDetailsPrefetchPromiseRef.current) {
291
+ return mahindraDetailsPrefetchPromiseRef.current;
292
+ }
293
+ const promise = (async () => {
294
+ try {
295
+ let mahindraApp = null;
296
+ const overrideProviderId = ((overrideMahindraApp === null || overrideMahindraApp === void 0 ? void 0 : overrideMahindraApp.fd_provider_id) ||
297
+ (overrideMahindraApp === null || overrideMahindraApp === void 0 ? void 0 : overrideMahindraApp.fdProviderId) ||
298
+ (overrideMahindraApp === null || overrideMahindraApp === void 0 ? void 0 : overrideMahindraApp.provider_id) ||
299
+ (overrideMahindraApp === null || overrideMahindraApp === void 0 ? void 0 : overrideMahindraApp.providerId) ||
300
+ '').toString();
301
+ if (overrideMahindraApp && overrideProviderId.toLowerCase() === MahindraProviderId.toLowerCase()) {
302
+ mahindraApp = overrideMahindraApp;
303
+ }
304
+ else {
305
+ if (!customerApplications || isCustomerApplicationsEmpty()) {
306
+ return;
307
+ }
308
+ // Normalize list
309
+ let applicationsData = [];
310
+ if (Array.isArray(customerApplications)) {
311
+ applicationsData = customerApplications;
312
+ }
313
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
314
+ applicationsData = customerApplications.data;
315
+ }
316
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
317
+ applicationsData = customerApplications.applications;
318
+ }
319
+ if (!applicationsData.length)
320
+ return;
321
+ // Find Mahindra pending/active app for MahindraProviderId
322
+ mahindraApp = getPendingOrActiveAppForProvider(applicationsData, MahindraProviderId);
323
+ }
324
+ if (!mahindraApp)
325
+ return;
326
+ const ids = {
327
+ workflowInstanceId: mahindraApp.workflow_instance_id ||
328
+ mahindraApp.workflowInstanceId ||
329
+ mahindraApp.workflowinstanceid ||
330
+ mahindraApp.workflow_instance ||
331
+ mahindraApp.workflowInstance ||
332
+ undefined,
333
+ applicationId: mahindraApp.application_id ||
334
+ mahindraApp.applicationId ||
335
+ mahindraApp.applicationid ||
336
+ undefined,
337
+ entityid: mahindraApp.entity_id ||
338
+ mahindraApp.entityId ||
339
+ mahindraApp.entityid ||
340
+ undefined,
341
+ customerId: mahindraApp.customer_id ||
342
+ mahindraApp.customerId ||
343
+ mahindraApp.customerid ||
344
+ undefined,
345
+ providerId: mahindraApp.fd_provider_id ||
346
+ mahindraApp.fdProviderId ||
347
+ mahindraApp.provider_id ||
348
+ mahindraApp.providerId ||
349
+ MahindraProviderId,
350
+ };
351
+ if (!ids.applicationId || !ids.customerId || !ids.providerId) {
352
+ return;
353
+ }
354
+ setIsLoadingMahindraCustomerDetails(true);
355
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
356
+ const detailsResp = await getCustomerApplicationDetails({
357
+ providerId: ids.providerId,
358
+ applicationId: ids.applicationId,
359
+ customerId: ids.customerId,
360
+ workflowInstanceId: ids.workflowInstanceId,
361
+ userreferenceid: userInfo.userReferenceId,
362
+ applicationid: ids.applicationId,
363
+ entityid: ids.entityid,
364
+ }).unwrap();
365
+ const detailsData = (detailsResp === null || detailsResp === void 0 ? void 0 : detailsResp.data) || detailsResp;
366
+ if (detailsData) {
367
+ (0, globalData_1.setGlobalData)({ mahindraCustomerDetails: detailsData });
368
+ (0, mahindrafdsdk_1.setGlobalData)({ mahindraCustomerDetails: detailsData });
369
+ }
370
+ }
371
+ catch (err) {
372
+ }
373
+ finally {
374
+ setIsLoadingMahindraCustomerDetails(false);
375
+ mahindraDetailsPrefetchPromiseRef.current = null;
376
+ }
377
+ })();
378
+ mahindraDetailsPrefetchPromiseRef.current = promise;
379
+ return promise;
380
+ }, [customerApplications, getCustomerApplicationDetails]);
381
+ // Helper function to filter FDs based on tenure
382
+ const filterFDsByTenure = (fdList, filter) => {
383
+ if (filter === strings_1.FD_STRINGS.ALL_FDS_TAB)
384
+ return fdList;
385
+ return fdList.filter(fd => {
386
+ // Extract tenure in months from the fd.tenure string (e.g., "12 Months" -> 12)
387
+ const tenureMatch = fd.tenure.match(/(\d+)\s*Months?/i);
388
+ if (!tenureMatch)
389
+ return false;
390
+ const tenureMonths = parseInt(tenureMatch[1], 10);
391
+ const tenureYears = tenureMonths / 12;
392
+ switch (filter) {
393
+ case '<1Y':
394
+ return tenureYears <= 1;
395
+ case '<1-3Y':
396
+ return tenureYears > 1 && tenureYears <= 3;
397
+ case '<3-5Y':
398
+ return tenureYears > 3 && tenureYears <= 5;
399
+ case '>5Y':
400
+ return tenureYears > 5;
401
+ default:
402
+ return true;
403
+ }
404
+ });
405
+ };
406
+ // Derive identifiers for workflow termination from applications API (for active FD/provider)
407
+ const terminateIdentifiers = react_1.default.useMemo(() => {
408
+ var _a, _b;
409
+ try {
410
+ if (!customerApplications || isCustomerApplicationsEmpty()) {
411
+ return {
412
+ applicationId: undefined,
413
+ workflowInstanceId: undefined,
414
+ entityId: undefined,
415
+ providerIdFromApp: undefined,
416
+ };
417
+ }
418
+ // Normalize list
419
+ let applicationsData = [];
420
+ if (Array.isArray(customerApplications)) {
421
+ applicationsData = customerApplications;
422
+ }
423
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
424
+ applicationsData = customerApplications.data;
425
+ }
426
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
427
+ applicationsData = customerApplications.applications;
428
+ }
429
+ if (applicationsData.length === 0) {
430
+ return {
431
+ applicationId: undefined,
432
+ workflowInstanceId: undefined,
433
+ entityId: undefined,
434
+ providerIdFromApp: undefined,
435
+ };
436
+ }
437
+ // Prefer a pending/in-progress one for termination, else first
438
+ const appForTerminate = applicationsData.find((a) => {
439
+ const s = (a.wf_status || a.status || '').toString().toLowerCase();
440
+ return s === 'pending' || s === 'in_progress' || s === 'in-progress';
441
+ }) || applicationsData[0];
442
+ const applicationId = appForTerminate.application_id || appForTerminate.applicationId || appForTerminate.id;
443
+ const workflowInstanceId = appForTerminate.workflow_instance_id || appForTerminate.workflowInstanceId || ((_a = appForTerminate.workflow) === null || _a === void 0 ? void 0 : _a.instanceId);
444
+ const entityId = appForTerminate.entity_id || appForTerminate.entityId || ((_b = appForTerminate.entity) === null || _b === void 0 ? void 0 : _b.id);
445
+ const providerIdFromApp = appForTerminate.provider_id || appForTerminate.providerId || appForTerminate.fd_provider_id || appForTerminate.fdProviderId;
446
+ return { applicationId, workflowInstanceId, entityId, providerIdFromApp };
447
+ }
448
+ catch (e) {
449
+ return {
450
+ applicationId: undefined,
451
+ workflowInstanceId: undefined,
452
+ entityId: undefined,
453
+ providerIdFromApp: undefined,
454
+ };
455
+ }
456
+ }, [customerApplications]);
457
+ const activeProviderId = terminateIdentifiers.providerIdFromApp;
458
+ // Master data fetch - prefer tapped FD provider, then active app provider, then rates
459
+ const defaultProviderId = ''; // Default provider ID for initial call
460
+ const inferredProviderId = react_1.default.useMemo(() => {
461
+ var _a, _b, _c, _d, _e, _f;
462
+ if (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId)
463
+ return selectedFD.providerId;
464
+ if (activeProviderId)
465
+ return activeProviderId;
466
+ if ((_c = (_b = (_a = interestRates === null || interestRates === void 0 ? void 0 : interestRates.data) === null || _a === void 0 ? void 0 : _a.sdrScheme) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.providerId)
467
+ return interestRates.data.sdrScheme[0].providerId;
468
+ if ((_f = (_e = (_d = interestRates === null || interestRates === void 0 ? void 0 : interestRates.data) === null || _d === void 0 ? void 0 : _d.fdrScheme) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.providerId)
469
+ return interestRates.data.fdrScheme[0].providerId;
470
+ return defaultProviderId;
471
+ }, [selectedFD, activeProviderId, interestRates]);
472
+ const { data: masterData, isLoading: isLoadingMaster } = (0, masterDataApi_1.useGetMasterDataQuery)({ providerId: inferredProviderId }, { skip: !inferredProviderId });
473
+ const { data: MahindraMasterData, refetch: refetchMahindraMasterData } = (0, masterDataApi_1.useGetMasterDataQuery)({ providerId: MahindraProviderId }, { skip: false });
474
+ const { data: ShriramMasterData, refetch: refetchShriramMasterData } = (0, masterDataApi_1.useGetMasterDataQuery)({ providerId: ShriramProviderId }, { skip: false });
475
+ // Only render once all three API calls have completed (success or error)
476
+ // Show loading initially until all APIs have completed
477
+ const isAllDataReady = react_1.default.useMemo(() => {
478
+ // If not initialized yet, show loading
479
+ if (!isInitialized)
480
+ return false;
481
+ // Step 1: Check if interest rates API has been called and completed
482
+ // If currently loading, show loading
483
+ if (isLoadingRates)
484
+ return false;
485
+ // If not loading but no data and no error, API hasn't been called yet - show loading
486
+ if (!interestRates && !interestRatesError)
487
+ return false;
488
+ // Step 2: Once interest rates are done, customer applications should be called
489
+ // If currently loading, show loading
490
+ if (isLoadingApplications)
491
+ return false;
492
+ // If interest rates succeeded, we must wait for customer applications
493
+ // If interest rates failed, we can still proceed (but applications might not be called)
494
+ if (interestRates) {
495
+ // Interest rates succeeded, so applications should be called
496
+ // If not loading but no data and no error, applications haven't been called yet - show loading
497
+ if (!customerApplications && !customerApplicationsError)
498
+ return false;
499
+ }
500
+ // Step 3: Check master data - only required if providerId is available
501
+ const masterShouldRun = !!inferredProviderId;
502
+ if (masterShouldRun) {
503
+ // Master data should be done (either loaded or error, but not loading)
504
+ if (isLoadingMaster)
505
+ return false;
506
+ }
507
+ return true;
508
+ }, [isInitialized, interestRates, interestRatesError, isLoadingRates, customerApplications, customerApplicationsError, isLoadingApplications, inferredProviderId, isLoadingMaster]);
509
+ (0, react_1.useEffect)(() => {
510
+ if (masterData) {
511
+ setMasterData(masterData);
512
+ }
513
+ }, [masterData, setMasterData]);
514
+ // Function to refresh all data - Required sequence: Interest -> Applications -> Master
515
+ const refreshData = (0, react_1.useCallback)(async () => {
516
+ if (!isInitialized) {
517
+ return;
518
+ }
519
+ // Prevent multiple simultaneous calls
520
+ if (isCallingInterestRatesRef.current || isLoadingRates) {
521
+ return;
522
+ }
523
+ try {
524
+ isCallingInterestRatesRef.current = true;
525
+ // Add 500ms delay before calling interest rate API
526
+ await new Promise(resolve => setTimeout(resolve, 500));
527
+ await getInterestRates({});
528
+ }
529
+ catch (error) {
530
+ // Handle error silently
531
+ }
532
+ finally {
533
+ isCallingInterestRatesRef.current = false;
534
+ }
535
+ }, [getInterestRates, isInitialized, isLoadingRates]);
536
+ // Initialize component after mount
537
+ (0, react_1.useEffect)(() => {
538
+ const initializeComponent = async () => {
539
+ // Validate required user data before proceeding
540
+ const appData = (0, appDataConfig_1.getAppData)();
541
+ const requiredFields = [
542
+ { field: 'id', label: 'User ID' },
543
+ { field: 'name', label: 'User Name' },
544
+ { field: 'dob', label: 'Date of Birth' },
545
+ { field: 'gender', label: 'Gender' },
546
+ { field: 'mobNo', label: 'Mobile Number' },
547
+ { field: 'email', label: 'Email' },
548
+ ];
549
+ const missingFields = [];
550
+ requiredFields.forEach(({ field, label }) => {
551
+ const value = appData === null || appData === void 0 ? void 0 : appData[field];
552
+ if (!value || (typeof value === 'string' && !value.trim())) {
553
+ missingFields.push(label);
554
+ }
555
+ });
556
+ // Show alert if required fields are missing
557
+ if (missingFields.length > 0) {
558
+ react_native_1.Alert.alert('Cannot Proceed with FD Booking', `The following required information is missing from the main app:\n\n${missingFields.join('\n')}\n\nPlease provide all required user information to proceed.`, [
559
+ {
560
+ text: 'Cancel FD Booking',
561
+ onPress: () => {
562
+ // Redirect back to main app
563
+ if (onGoBack) {
564
+ onGoBack();
565
+ }
566
+ else {
567
+ // No-op when onGoBack is not provided
568
+ }
569
+ },
570
+ style: 'cancel',
571
+ },
572
+ ], { cancelable: false });
573
+ return; // Don't initialize if validation fails
574
+ }
575
+ // Additional value validation (case-insensitive): gender, maritalStatus, typeOfAccount
576
+ const errors = [];
577
+ // Gender must be Male, Female, or Other (case-insensitive)
578
+ const gender = String((appData === null || appData === void 0 ? void 0 : appData.gender) || '').trim().toLowerCase();
579
+ const allowedGenders = ['male', 'female', 'other'];
580
+ if (gender && !allowedGenders.includes(gender)) {
581
+ errors.push("Gender must be one of: Male, Female, Other");
582
+ }
583
+ // Marital status must be Married, Unmarried, or Other (case-insensitive)
584
+ const maritalStatus = String((appData === null || appData === void 0 ? void 0 : appData.maritalStatus) || '').trim().toLowerCase();
585
+ const allowedMarital = ['married', 'unmarried', 'other'];
586
+ if (maritalStatus && !allowedMarital.includes(maritalStatus)) {
587
+ errors.push("Marital Status must be one of: Married, Unmarried, Other");
588
+ }
589
+ // Account type must be 'Saving A/c' or 'Current A/c' (support legacy codes like SB/CA)
590
+ const typeOfAccountRaw = String((appData === null || appData === void 0 ? void 0 : appData.typeOfAccount) || '').trim();
591
+ const normalizeAccountType = (value) => value.replace(/[^a-z]/gi, '').toLowerCase();
592
+ const accountTypeMap = {
593
+ savingac: 'Saving A/c',
594
+ savingaccount: 'Saving A/c',
595
+ savingsaccount: 'Saving A/c',
596
+ savings: 'Saving A/c',
597
+ saving: 'Saving A/c',
598
+ sb: 'Saving A/c',
599
+ currentac: 'Current A/c',
600
+ currentaccount: 'Current A/c',
601
+ current: 'Current A/c',
602
+ ca: 'Current A/c',
603
+ };
604
+ const normalizedAccountType = normalizeAccountType(typeOfAccountRaw);
605
+ const canonicalAccountType = accountTypeMap[normalizedAccountType];
606
+ if (typeOfAccountRaw && !canonicalAccountType) {
607
+ errors.push("Type of Account must be one of: 'Saving A/c', 'Current A/c'");
608
+ }
609
+ if (errors.length > 0) {
610
+ react_native_1.Alert.alert('Invalid User Data', `${errors.join('\n')}`, [
611
+ {
612
+ text: 'OK',
613
+ onPress: () => {
614
+ if (onGoBack) {
615
+ onGoBack();
616
+ }
617
+ },
618
+ style: 'cancel',
619
+ },
620
+ ], { cancelable: false });
621
+ return; // Stop initialization on invalid values
622
+ }
623
+ // Small delay to ensure component is fully mounted
624
+ await new Promise(resolve => setTimeout(resolve, 100));
625
+ setIsInitialized(true);
626
+ };
627
+ initializeComponent();
628
+ }, [onGoBack]);
629
+ // Handle Android hardware back button - use same navigation as header back button
630
+ (0, react_1.useEffect)(() => {
631
+ if (react_native_1.Platform.OS !== 'android')
632
+ return;
633
+ const onHardwareBackPress = () => {
634
+ // Call onGoBack which triggers onExit in RootNavigator
635
+ if (onGoBack) {
636
+ onGoBack();
637
+ }
638
+ return true; // Prevent default behavior
639
+ };
640
+ const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onHardwareBackPress);
641
+ return () => backHandler.remove();
642
+ }, [onGoBack]);
643
+ // Removed init-time fetch to avoid duplicate calls; we'll fetch on first focus only
644
+ // Refresh data when screen comes into focus (only if initialized)
645
+ (0, native_1.useFocusEffect)((0, react_1.useCallback)(() => {
646
+ if (!isInitialized)
647
+ return;
648
+ if (hasFetchedRatesRef.current)
649
+ return; // ensure called only once when screen first shows
650
+ // Prevent multiple simultaneous calls
651
+ if (isCallingInterestRatesRef.current || isLoadingRates)
652
+ return;
653
+ hasFetchedRatesRef.current = true;
654
+ refreshData();
655
+ }, [refreshData, isInitialized, isLoadingRates]));
656
+ // As soon as FDList has customer applications, eagerly prefetch Mahindra
657
+ // customer/application/details so that if user taps a Mahindra pending FD,
658
+ // details are already cached (or at least being fetched with a loader).
659
+ (0, react_1.useEffect)(() => {
660
+ if (!isInitialized)
661
+ return;
662
+ if (!customerApplications || isCustomerApplicationsEmpty())
663
+ return;
664
+ prefetchMahindraCustomerApplicationDetails();
665
+ }, [isInitialized, customerApplications, prefetchMahindraCustomerApplicationDetails]);
666
+ // After interest rates are received, call Customer Applications
667
+ (0, react_1.useEffect)(() => {
668
+ if (!interestRates)
669
+ return;
670
+ try {
671
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
672
+ getCustomerApplications({ userReferenceId: userInfo.id });
673
+ }
674
+ catch (e) {
675
+ }
676
+ // eslint-disable-next-line react-hooks/exhaustive-deps
677
+ }, [!!interestRates]);
678
+ // Handle API errors
679
+ (0, react_1.useEffect)(() => {
680
+ if (interestRatesError) {
681
+ react_native_1.Alert.alert('API Error', 'Failed to fetch interest rates. Please try again.', [
682
+ {
683
+ text: 'Retry',
684
+ onPress: async () => {
685
+ // Prevent multiple simultaneous calls
686
+ if (isCallingInterestRatesRef.current || isLoadingRates) {
687
+ return;
688
+ }
689
+ try {
690
+ isCallingInterestRatesRef.current = true;
691
+ // Add 500ms delay before retrying interest rate API
692
+ await new Promise(resolve => setTimeout(resolve, 500));
693
+ await getInterestRates({});
694
+ }
695
+ catch (error) {
696
+ // Handle error silently
697
+ }
698
+ finally {
699
+ isCallingInterestRatesRef.current = false;
700
+ }
701
+ }
702
+ },
703
+ { text: 'Continue', style: 'cancel' }
704
+ ]);
705
+ }
706
+ }, [interestRatesError, getInterestRates]);
707
+ // Log successful data fetch
708
+ (0, react_1.useEffect)(() => {
709
+ var _a, _b;
710
+ if (interestRates && ((_b = (_a = interestRates.data) === null || _a === void 0 ? void 0 : _a.sdrScheme) === null || _b === void 0 ? void 0 : _b.length) > 0) {
711
+ // Interest rates loaded successfully
712
+ }
713
+ }, [interestRates]);
714
+ // Persist providerId to onboarding store as soon as we have rates
715
+ // useEffect(() => {
716
+ // const pid = getProviderIdFromInterestRates();
717
+ // if (pid) {
718
+ // try {
719
+ // dispatch(setOnboardingIds({ providerId: pid }));
720
+ // } catch (e) {
721
+ // // Handle error silently
722
+ // }
723
+ // }
724
+ // }, [interestRates, dispatch]);
725
+ // useEffect(() => {
726
+ // if (customerApplications) {
727
+ // // Customer applications loaded successfully
728
+ // // Persist onboarding identifiers globally for subsequent API calls (like FDCalculator)
729
+ // try {
730
+ // // Extract workflow parameters from response
731
+ // const responseData = customerApplications?.data || customerApplications;
732
+ // let applicationData = Array.isArray(responseData) ? responseData[0] : responseData;
733
+ // // Prefer the application with wf_status === 'Active'
734
+ // if (Array.isArray(responseData)) {
735
+ // const activeOnly = responseData.find((app: any) => {
736
+ // const status = (app.wf_status || app.status || '').toString();
737
+ // return status === 'Active';
738
+ // });
739
+ // if (activeOnly) applicationData = activeOnly;
740
+ // }
741
+ // if (Array.isArray(responseData)) {
742
+ // completeFDData = responseData.find((app: any) => {
743
+ // const status = (app.wf_status || app.status || '').toString();
744
+ // return status === 'Completed';
745
+ // });
746
+ // setGlobalData({ completeFDData: !!completeFDData });
747
+ // }
748
+ // if (applicationData) {
749
+ // const ids = {
750
+ // workflowInstanceId: applicationData.workflow_instance_id,
751
+ // applicationId: applicationData.application_id,
752
+ // entityid: applicationData.entity_id,
753
+ // customerId: applicationData.customer_id,
754
+ // fdId: applicationData.fd_id,
755
+ // currentState: applicationData.current_state,
756
+ // currentTask: applicationData.current_task,
757
+ // // Persist providerId from interest-rate API (prefers SDR, fallback FDR)
758
+ // providerId: getProviderIdFromInterestRates(),
759
+ // wfStatus: applicationData.wf_status,
760
+ // };
761
+ // if (dispatch && setOnboardingIds) {
762
+ // dispatch(setOnboardingIds(ids));
763
+ // } else {
764
+ // // Dispatch or setOnboardingIds unavailable
765
+ // }
766
+ // }
767
+ // } catch (error) {
768
+ // // Handle error silently
769
+ // }
770
+ // }
771
+ // }, [customerApplications, dispatch]);
772
+ // Unified handler: behave like bottom sheet Continue flow
773
+ const handlePendingFDContinue = async (overrideApp, forcedSdkType) => {
774
+ var _a, _b, _c;
775
+ // Get current state from customer applications for workflow navigation
776
+ let currentState = null;
777
+ let transactionId = undefined;
778
+ let appData = overrideApp || pendingContextApp;
779
+ let fdDisplay = null;
780
+ let onboardingIdsFromApp = null;
781
+ try {
782
+ if (!appData && customerApplications && !isCustomerApplicationsEmpty()) {
783
+ // Normalize list
784
+ let applicationsData = [];
785
+ if (Array.isArray(customerApplications)) {
786
+ applicationsData = customerApplications;
787
+ }
788
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
789
+ applicationsData = customerApplications.data;
790
+ }
791
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
792
+ applicationsData = customerApplications.applications;
793
+ }
794
+ if (applicationsData.length > 0) {
795
+ // Fallback: find first Active application when no override/pendingContext
796
+ appData = applicationsData.find((a) => {
797
+ const s = (a.wf_status || a.status || '').toString();
798
+ return s === 'Active';
799
+ }) || applicationsData.find((a) => {
800
+ const s = (a.wf_status || a.status || '').toString().toLowerCase();
801
+ return PENDING_ACTIVE_STATUSES.includes(s);
802
+ }) || applicationsData[0];
803
+ }
804
+ }
805
+ if (appData) {
806
+ currentState = appData.current_state;
807
+ transactionId = appData.transaction_id || appData.transactionId;
808
+ fdDisplay = appToPendingFDData(appData);
809
+ let providerIdFromApp = resolveProviderIdFromApp(appData, MahindraProviderId, ShriramProviderId);
810
+ if (forcedSdkType === 'mahindra') {
811
+ providerIdFromApp = MahindraProviderId;
812
+ }
813
+ else if (forcedSdkType === 'shriram') {
814
+ providerIdFromApp = ShriramProviderId;
815
+ }
816
+ const providerIdLower = (providerIdFromApp || '').toLowerCase();
817
+ const isMahindra = providerIdLower === MahindraProviderId.toLowerCase();
818
+ // For Mahindra flows, ensure customer/application/details are fully loaded
819
+ // before navigating into ExternalSDK so downstream screens see complete
820
+ // nominee/bank/KYC/guardian data. Show a loader while we wait.
821
+ if (isMahindra) {
822
+ await prefetchMahindraCustomerApplicationDetails(appData);
823
+ }
824
+ try {
825
+ const fdListSelectedData = {
826
+ id: appData.fd_id || appData.fdId || 'active-fd',
827
+ providerId: providerIdFromApp,
828
+ name: fdDisplay.name,
829
+ accountNumber: appData.account_number || appData.accountNumber || '',
830
+ roi: `${fdDisplay.returns}% p.a.`,
831
+ tenure: fdDisplay.maturityDate || '-',
832
+ amount: Number(fdDisplay.invested) || 0,
833
+ maturityDate: fdDisplay.maturityDate || '-',
834
+ status: 'active',
835
+ creditRating: appData.credit_rating || appData.creditRating || (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.creditRating) || 'NA',
836
+ companyName: fdDisplay.name,
837
+ fdRate: `${fdDisplay.returns}% p.a.`,
838
+ interestPayout: fdDisplay.interestPayout || '',
839
+ };
840
+ dispatch((0, fdListSelectedSlice_1.setFDListSelected)(fdListSelectedData));
841
+ }
842
+ catch (e) {
843
+ // Handle error silently
844
+ }
845
+ try {
846
+ const ids = {
847
+ workflowInstanceId: appData.workflow_instance_id || appData.workflowInstanceId,
848
+ applicationId: appData.application_id || appData.applicationId,
849
+ entityid: appData.entity_id || appData.entityId,
850
+ customerId: appData.customer_id || appData.customerId,
851
+ fdId: appData.fd_id || appData.fdId,
852
+ currentState: appData.current_state || appData.currentState,
853
+ currentTask: appData.current_task || appData.currentTask,
854
+ providerId: providerIdFromApp || undefined,
855
+ wfStatus: appData.wf_status || appData.wfStatus,
856
+ };
857
+ onboardingIdsFromApp = ids;
858
+ dispatch((0, onboardingSlice_1.setOnboardingIds)(ids));
859
+ }
860
+ catch (e) {
861
+ }
862
+ }
863
+ }
864
+ catch (error) {
865
+ // Handle error silently
866
+ }
867
+ if (!fdDisplay && appData)
868
+ fdDisplay = appToPendingFDData(appData);
869
+ // If current state is payment and transactionId is available, call payment reverse feed API
870
+ // Check for both Mahindra and Shriram payment states
871
+ const isPaymentState = currentState === workflowConstants_1.WORKFLOW_STATES.PAYMENT ||
872
+ currentState === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.PAYMENT ||
873
+ currentState === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.PAYMENT;
874
+ if (isPaymentState && transactionId) {
875
+ try {
876
+ // Get user info and required IDs (prefer appData from continue context)
877
+ const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
878
+ let providerIdFromApp = resolveProviderIdFromApp(appData, MahindraProviderId, ShriramProviderId);
879
+ if (forcedSdkType === 'mahindra')
880
+ providerIdFromApp = MahindraProviderId;
881
+ if (forcedSdkType === 'shriram')
882
+ providerIdFromApp = ShriramProviderId;
883
+ const paymentReverseFeedRequest = {
884
+ providerId: providerIdFromApp || providerId,
885
+ workflowInstanceId: (appData === null || appData === void 0 ? void 0 : appData.workflow_instance_id) || (appData === null || appData === void 0 ? void 0 : appData.workflowInstanceId) || workflowInstanceId,
886
+ userreferenceid: userInfo.id,
887
+ applicationid: (appData === null || appData === void 0 ? void 0 : appData.application_id) || (appData === null || appData === void 0 ? void 0 : appData.applicationId) || applicationId,
888
+ entityid: (appData === null || appData === void 0 ? void 0 : appData.entity_id) || (appData === null || appData === void 0 ? void 0 : appData.entityId) || entityId,
889
+ transactionId: transactionId,
890
+ };
891
+ const response = await paymentReverseFeed(paymentReverseFeedRequest).unwrap();
892
+ // Handle the response based on payment status
893
+ const paymentStatus = (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.paymentStatus) || '').toLowerCase();
894
+ const statusParam = paymentStatus === 'success' ? 'success' : paymentStatus === 'failed' ? 'failed' : 'pending';
895
+ const fdDataParam = fdDisplay ? {
896
+ companyName: fdDisplay.name,
897
+ amount: Number(fdDisplay.invested) || 0,
898
+ fdRate: `${fdDisplay.returns}% p.a.`,
899
+ tenure: fdDisplay.maturityDate ? `${fdDisplay.maturityDate}` : '-',
900
+ interestPayout: fdDisplay.interestPayout || 'Yearly',
901
+ } : activeFD ? {
902
+ companyName: activeFD.name,
903
+ amount: Number(activeFD.invested) || 0,
904
+ fdRate: `${activeFD.returns}% p.a.`,
905
+ tenure: activeFD.maturityDate ? `${activeFD.maturityDate}` : '-',
906
+ interestPayout: activeFD.interestPayout || 'Yearly',
907
+ } : undefined;
908
+ // Shriram: always navigate to Shriram SDK PaymentStatus, never FDSDK PaymentStatus
909
+ let paymentProviderId = resolveProviderIdFromApp(appData, MahindraProviderId, ShriramProviderId).toLowerCase();
910
+ if (forcedSdkType === 'mahindra')
911
+ paymentProviderId = MahindraProviderId.toLowerCase();
912
+ if (forcedSdkType === 'shriram')
913
+ paymentProviderId = ShriramProviderId.toLowerCase();
914
+ const isShriramPayment = paymentProviderId === ShriramProviderId.toLowerCase();
915
+ if (isShriramPayment && appData) {
916
+ if (!initializeExternalSDKFromFDList('shriram'))
917
+ return;
918
+ let ShriramSDKGlobalDataPayment = null;
919
+ if (customerApplications && !isCustomerApplicationsEmpty()) {
920
+ let applicationsData = [];
921
+ if (Array.isArray(customerApplications))
922
+ applicationsData = customerApplications;
923
+ else if ((customerApplications === null || customerApplications === void 0 ? void 0 : customerApplications.data) && Array.isArray(customerApplications.data))
924
+ applicationsData = customerApplications.data;
925
+ else if ((customerApplications === null || customerApplications === void 0 ? void 0 : customerApplications.applications) && Array.isArray(customerApplications.applications))
926
+ applicationsData = customerApplications.applications;
927
+ const completeApplications = applicationsData.filter((app) => {
928
+ const s = (app.wf_status || app.status || '').toString().toLowerCase();
929
+ return s === 'completed' || s === 'complete';
930
+ });
931
+ const shriramComplete = completeApplications.find((app) => (app.fd_provider_id || app.fdProviderId || app.provider_id || app.providerId || '').toLowerCase() === ShriramProviderId.toLowerCase());
932
+ if (shriramComplete)
933
+ ShriramSDKGlobalDataPayment = shriramComplete;
934
+ }
935
+ const fdListSelectedDataPayment = activeFD ? {
936
+ id: appData.fd_id || appData.fdId || 'active-fd',
937
+ providerId: providerIdFromApp,
938
+ name: activeFD.name,
939
+ accountNumber: appData.account_number || appData.accountNumber || '',
940
+ roi: `${activeFD.returns}% p.a.`,
941
+ tenure: activeFD.maturityDate || '-',
942
+ amount: Number(activeFD.invested) || 0,
943
+ maturityDate: activeFD.maturityDate || '-',
944
+ status: 'active',
945
+ creditRating: appData.credit_rating || appData.creditRating || 'NA',
946
+ companyName: activeFD.name,
947
+ fdRate: `${activeFD.returns}% p.a.`,
948
+ interestPayout: activeFD.interestPayout || 'Yearly',
949
+ } : null;
950
+ const masterDataPayment = ShriramMasterData;
951
+ (0, helpers_1.navigate)('ExternalSDK', {
952
+ sdkType: 'shriram',
953
+ providerId: providerIdFromApp,
954
+ fdListSelectedData: fdListSelectedDataPayment,
955
+ masterData: masterDataPayment,
956
+ onboardingIds: onboardingIdsFromApp || onboardingIds,
957
+ initialRouteName: 'PaymentStatus',
958
+ initialPaymentStatusParams: { status: statusParam, transactionId, fdData: fdDataParam },
959
+ shriramSDKGlobalData: ShriramSDKGlobalDataPayment,
960
+ });
961
+ return;
962
+ }
963
+ (0, helpers_1.navigate)('PaymentStatus', { status: statusParam, transactionId, fdData: fdDataParam });
964
+ return;
965
+ }
966
+ catch (error) {
967
+ // Handle error silently
968
+ const fdDataParam = fdDisplay ? {
969
+ companyName: fdDisplay.name,
970
+ amount: Number(fdDisplay.invested) || 0,
971
+ fdRate: `${fdDisplay.returns}% p.a.`,
972
+ tenure: fdDisplay.maturityDate ? `${fdDisplay.maturityDate}` : '-',
973
+ interestPayout: fdDisplay.interestPayout || 'Yearly',
974
+ } : activeFD ? {
975
+ companyName: activeFD.name,
976
+ amount: Number(activeFD.invested) || 0,
977
+ fdRate: `${activeFD.returns}% p.a.`,
978
+ tenure: activeFD.maturityDate ? `${activeFD.maturityDate}` : '-',
979
+ interestPayout: activeFD.interestPayout || 'Yearly',
980
+ } : undefined;
981
+ let providerIdFromApp = resolveProviderIdFromApp(appData, MahindraProviderId, ShriramProviderId);
982
+ if (forcedSdkType === 'mahindra')
983
+ providerIdFromApp = MahindraProviderId;
984
+ if (forcedSdkType === 'shriram')
985
+ providerIdFromApp = ShriramProviderId;
986
+ const paymentProviderIdCatch = providerIdFromApp.toLowerCase();
987
+ const isShriramPaymentCatch = paymentProviderIdCatch === ShriramProviderId.toLowerCase();
988
+ if (isShriramPaymentCatch && appData) {
989
+ if (!initializeExternalSDKFromFDList('shriram'))
990
+ return;
991
+ let ShriramSDKGlobalDataPayment = null;
992
+ if (customerApplications && !isCustomerApplicationsEmpty()) {
993
+ let applicationsData = [];
994
+ if (Array.isArray(customerApplications))
995
+ applicationsData = customerApplications;
996
+ else if ((customerApplications === null || customerApplications === void 0 ? void 0 : customerApplications.data) && Array.isArray(customerApplications.data))
997
+ applicationsData = customerApplications.data;
998
+ else if ((customerApplications === null || customerApplications === void 0 ? void 0 : customerApplications.applications) && Array.isArray(customerApplications.applications))
999
+ applicationsData = customerApplications.applications;
1000
+ const completeApplications = applicationsData.filter((app) => {
1001
+ const s = (app.wf_status || app.status || '').toString().toLowerCase();
1002
+ return s === 'completed' || s === 'complete';
1003
+ });
1004
+ const shriramComplete = completeApplications.find((app) => (app.fd_provider_id || app.fdProviderId || app.provider_id || app.providerId || '').toLowerCase() === ShriramProviderId.toLowerCase());
1005
+ if (shriramComplete)
1006
+ ShriramSDKGlobalDataPayment = shriramComplete;
1007
+ }
1008
+ const fdListSelectedDataPayment = activeFD ? {
1009
+ id: appData.fd_id || appData.fdId || 'active-fd',
1010
+ providerId: providerIdFromApp,
1011
+ name: activeFD.name,
1012
+ accountNumber: appData.account_number || appData.accountNumber || '',
1013
+ roi: `${activeFD.returns}% p.a.`,
1014
+ tenure: activeFD.maturityDate || '-',
1015
+ amount: Number(activeFD.invested) || 0,
1016
+ maturityDate: activeFD.maturityDate || '-',
1017
+ status: 'active',
1018
+ creditRating: appData.credit_rating || appData.creditRating || 'NA',
1019
+ companyName: activeFD.name,
1020
+ fdRate: `${activeFD.returns}% p.a.`,
1021
+ interestPayout: activeFD.interestPayout || 'Yearly',
1022
+ } : null;
1023
+ const masterDataPayment = ShriramMasterData;
1024
+ (0, helpers_1.navigate)('ExternalSDK', {
1025
+ sdkType: 'shriram',
1026
+ providerId: providerIdFromApp,
1027
+ fdListSelectedData: fdListSelectedDataPayment,
1028
+ masterData: masterDataPayment,
1029
+ onboardingIds: onboardingIdsFromApp || onboardingIds,
1030
+ initialRouteName: 'PaymentStatus',
1031
+ initialPaymentStatusParams: { status: 'pending', transactionId, fdData: fdDataParam },
1032
+ shriramSDKGlobalData: ShriramSDKGlobalDataPayment,
1033
+ });
1034
+ return;
1035
+ }
1036
+ (0, helpers_1.navigate)('PaymentStatus', { status: 'pending', transactionId, fdData: fdDataParam });
1037
+ return;
1038
+ }
1039
+ }
1040
+ // Determine provider and navigate to appropriate SDK
1041
+ if (appData) {
1042
+ let providerIdFromApp = resolveProviderIdFromApp(appData, MahindraProviderId, ShriramProviderId);
1043
+ if (forcedSdkType === 'mahindra')
1044
+ providerIdFromApp = MahindraProviderId;
1045
+ if (forcedSdkType === 'shriram')
1046
+ providerIdFromApp = ShriramProviderId;
1047
+ const providerIdLower = (providerIdFromApp || '').toLowerCase();
1048
+ const isMahindra = providerIdLower === MahindraProviderId.toLowerCase();
1049
+ const isShriram = providerIdLower === ShriramProviderId.toLowerCase();
1050
+ // Check for complete applications and create global data constants
1051
+ let ShriramSDKGlobalData = null;
1052
+ let MahindraSDKGlobalData = null;
1053
+ if (customerApplications && !isCustomerApplicationsEmpty()) {
1054
+ let applicationsData = [];
1055
+ if (Array.isArray(customerApplications)) {
1056
+ applicationsData = customerApplications;
1057
+ }
1058
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
1059
+ applicationsData = customerApplications.data;
1060
+ }
1061
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
1062
+ applicationsData = customerApplications.applications;
1063
+ }
1064
+ // Find complete applications
1065
+ const completeApplications = applicationsData.filter((app) => {
1066
+ const status = (app.wf_status || app.status || '').toString().toLowerCase();
1067
+ return status === 'completed' || status === 'complete';
1068
+ });
1069
+ // Separate by provider
1070
+ completeApplications.forEach((app) => {
1071
+ const appProviderId = (app.fd_provider_id || app.fdProviderId || app.provider_id || app.providerId || '').toLowerCase();
1072
+ if (appProviderId === ShriramProviderId.toLowerCase()) {
1073
+ ShriramSDKGlobalData = app;
1074
+ }
1075
+ else if (appProviderId === MahindraProviderId.toLowerCase()) {
1076
+ MahindraSDKGlobalData = app;
1077
+ }
1078
+ });
1079
+ }
1080
+ // Helper function to map workflow state to screen name
1081
+ const getScreenNameFromState = (state, isMahindraSDK, isShriramSDK) => {
1082
+ if (isMahindraSDK) {
1083
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.KYC_SUCCESS)
1084
+ return 'KYCSuccess';
1085
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.KYC)
1086
+ return 'ReviewKYC';
1087
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.OCCUPATION)
1088
+ return 'Employee';
1089
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.NOMINEE)
1090
+ return 'NomineeDetail';
1091
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.BANK_DETAILS)
1092
+ return 'BankDetail';
1093
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.AADHAAR_VERIFICATION)
1094
+ return 'AadhaarVerification';
1095
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.PAYMENT)
1096
+ return 'PayNow';
1097
+ if (state === workflowConstants_1.MAHINDRA_WORKFLOW_STATES.CREATE_FD)
1098
+ return 'FDCalculator';
1099
+ }
1100
+ else if (isShriramSDK) {
1101
+ if (state === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.KYC)
1102
+ return 'ReviewKYC';
1103
+ if (state === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.OCCUPATION)
1104
+ return 'Employee';
1105
+ if (state === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.NOMINEE)
1106
+ return 'NomineeDetail';
1107
+ if (state === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.BANK_DETAILS)
1108
+ return 'BankDetail';
1109
+ if (state === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.PAYMENT)
1110
+ return 'PayNow';
1111
+ // State 411 (CREATE_FD): user has completed up to FD creation; next step is payment → open PayNow
1112
+ if (state === workflowConstants_1.SHRIRAM_WORKFLOW_STATES.CREATE_FD)
1113
+ return 'PayNow';
1114
+ }
1115
+ // Default fallback
1116
+ return 'FDCalculator';
1117
+ };
1118
+ // Align pending flow with new-FD reliability: fetch provider-scoped master data right before navigation.
1119
+ let providerMasterData = isMahindra ? MahindraMasterData : isShriram ? ShriramMasterData : undefined;
1120
+ try {
1121
+ if (isMahindra) {
1122
+ const refreshed = await refetchMahindraMasterData();
1123
+ providerMasterData = (_b = refreshed === null || refreshed === void 0 ? void 0 : refreshed.data) !== null && _b !== void 0 ? _b : providerMasterData;
1124
+ }
1125
+ else if (isShriram) {
1126
+ const refreshed = await refetchShriramMasterData();
1127
+ providerMasterData = (_c = refreshed === null || refreshed === void 0 ? void 0 : refreshed.data) !== null && _c !== void 0 ? _c : providerMasterData;
1128
+ }
1129
+ }
1130
+ catch (_d) {
1131
+ // keep previously cached provider-specific master data
1132
+ }
1133
+ const masterDataToPass = providerMasterData || (masterData || masterDataContext);
1134
+ // Get onboardingIds - use the one from appData if available, otherwise from Redux store
1135
+ const onboardingIdsToPass = onboardingIdsFromApp || onboardingIds;
1136
+ // Get fdListSelectedData (already set in Redux, but we need it for navigation)
1137
+ const fdListSelectedDataToPass = activeFD ? {
1138
+ id: appData.fd_id || appData.fdId || 'active-fd',
1139
+ providerId: providerIdFromApp,
1140
+ name: activeFD.name,
1141
+ accountNumber: appData.account_number || appData.accountNumber || '',
1142
+ roi: `${activeFD.returns}% p.a.`,
1143
+ tenure: activeFD.tenure_in_months
1144
+ ? `${activeFD.tenure_in_months} Months`
1145
+ : '-',
1146
+ amount: Number(activeFD.invested) || 0,
1147
+ maturityDate: activeFD.maturityDate || '-',
1148
+ status: 'active',
1149
+ creditRating: appData.credit_rating || appData.creditRating || (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.creditRating) || 'NA',
1150
+ companyName: activeFD.name,
1151
+ fdRate: `${activeFD.returns}% p.a.`,
1152
+ interestPayout: activeFD.interestPayout || '',
1153
+ } : null;
1154
+ // Navigate to appropriate SDK if provider is detected
1155
+ if (isMahindra || isShriram) {
1156
+ const screenName = getScreenNameFromState(currentState, isMahindra, isShriram);
1157
+ const sdkType = isMahindra ? 'mahindra' : 'shriram';
1158
+ if (!initializeExternalSDKFromFDList(sdkType))
1159
+ return;
1160
+ // #region agent log
1161
+ fetch('http://127.0.0.1:7653/ingest/94b18a39-caf3-48fd-98f5-bf1838d9491a', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '04da7c' }, body: JSON.stringify({ sessionId: '04da7c', runId: 'pending-masterdata-trace', hypothesisId: 'H2', location: 'fdsdk/screens/FDList.tsx:1315', message: 'Pending continue pre-navigation payload', data: { forcedSdkType: forcedSdkType || null, resolvedSdkType: sdkType, providerIdFromApp: providerIdFromApp || null, onboardingProviderId: (onboardingIdsToPass === null || onboardingIdsToPass === void 0 ? void 0 : onboardingIdsToPass.providerId) || null, fdListSelectedProviderId: (fdListSelectedDataToPass === null || fdListSelectedDataToPass === void 0 ? void 0 : fdListSelectedDataToPass.providerId) || null, usingMahindraMasterData: !!(sdkType === 'mahindra' && masterDataToPass), usingShriramMasterData: !!(sdkType === 'shriram' && masterDataToPass), masterDataHasDataKey: !!(masterDataToPass === null || masterDataToPass === void 0 ? void 0 : masterDataToPass.data) }, timestamp: Date.now() }) }).catch(() => { });
1162
+ // #endregion agent log
1163
+ (0, helpers_1.navigate)('ExternalSDK', Object.assign({ sdkType, providerId: providerIdFromApp, fdListSelectedData: fdListSelectedDataToPass, masterData: masterDataToPass, onboardingIds: onboardingIdsToPass, initialRouteName: screenName, shriramSDKGlobalData: ShriramSDKGlobalData, mahindraSDKGlobalData: MahindraSDKGlobalData }, (isMahindra ? { forceFetchCustomerDetails: true } : {})));
1164
+ return;
1165
+ }
1166
+ }
1167
+ // Fallback: Use workflow navigation based on current state (non-payment states or no transactionId)
1168
+ if (currentState && Object.values(workflowConstants_1.WORKFLOW_STATES).includes(currentState)) {
1169
+ (0, workflowNavigator_1.handleWorkflowNavigation)({
1170
+ workflowState: currentState,
1171
+ investmentData: undefined,
1172
+ customerData: undefined,
1173
+ appData: undefined,
1174
+ fdData: undefined,
1175
+ completedApplications: [],
1176
+ transactionId,
1177
+ });
1178
+ }
1179
+ else {
1180
+ (0, helpers_1.navigate)('Employee');
1181
+ }
1182
+ };
1183
+ // Derive identifiers for workflow termination from applications API
1184
+ // Derive Active FD card data from customer applications response
1185
+ const activeFD = react_1.default.useMemo(() => {
1186
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1187
+ try {
1188
+ if (!customerApplications || isCustomerApplicationsEmpty()) {
1189
+ return {
1190
+ name: 'Mahindra Finance Ltd',
1191
+ invested: 0,
1192
+ value: 0,
1193
+ returns: 0,
1194
+ maturityDate: '--',
1195
+ tenure_in_months: 0,
1196
+ interestPayout: 'Yearly',
1197
+ logoType: 'mahindra',
1198
+ };
1199
+ }
1200
+ // Normalize list
1201
+ let applicationsData = [];
1202
+ if (Array.isArray(customerApplications)) {
1203
+ applicationsData = customerApplications;
1204
+ }
1205
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
1206
+ applicationsData = customerApplications.data;
1207
+ }
1208
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
1209
+ applicationsData = customerApplications.applications;
1210
+ }
1211
+ if (applicationsData.length === 0) {
1212
+ return {
1213
+ name: 'Mahindra Finance Ltd',
1214
+ invested: 0,
1215
+ value: 0,
1216
+ returns: 0,
1217
+ maturityDate: '--',
1218
+ tenure_in_months: 0,
1219
+ interestPayout: 'Yearly',
1220
+ logoType: 'mahindra',
1221
+ };
1222
+ }
1223
+ // Pick an active application if available, otherwise first
1224
+ const activeApp = applicationsData.find((a) => {
1225
+ const s = (a.wf_status || a.status || '').toString();
1226
+ return s === 'Active';
1227
+ }) || applicationsData[0];
1228
+ const invested = Number((_c = (_b = (_a = activeApp.investment_amount) !== null && _a !== void 0 ? _a : activeApp.amount) !== null && _b !== void 0 ? _b : activeApp.investmentAmount) !== null && _c !== void 0 ? _c : 0);
1229
+ const rate = Number((_e = (_d = activeApp.interest_rate) !== null && _d !== void 0 ? _d : activeApp.interestRate) !== null && _e !== void 0 ? _e : 0);
1230
+ // Prefer a provided current value, then maturity amount
1231
+ const value = Number((_j = (_h = (_g = (_f = activeApp.current_value) !== null && _f !== void 0 ? _f : activeApp.currentValue) !== null && _g !== void 0 ? _g : activeApp.maturity_amount) !== null && _h !== void 0 ? _h : activeApp.maturityAmount) !== null && _j !== void 0 ? _j : 0);
1232
+ const returns = rate || 0; // display interest rate as returns %
1233
+ // Format maturity date to 'Mon YYYY'
1234
+ const maturityDateStr = activeApp.maturity_date || activeApp.maturityDate || '';
1235
+ let maturityDate = '--';
1236
+ if (maturityDateStr) {
1237
+ const d = new Date(maturityDateStr);
1238
+ if (!isNaN(d.getTime())) {
1239
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
1240
+ maturityDate = `${months[d.getMonth()]} ${d.getFullYear()}`;
1241
+ }
1242
+ }
1243
+ // Get interest payout term from activeApp
1244
+ const interestPayout = activeApp.interest_payout_term || activeApp.interestPayoutTerm || activeApp.payout_term || 'Yearly';
1245
+ const providerName = activeApp.fd_provider_name || activeApp.providerName || 'Mahindra Finance Ltd';
1246
+ const logoType = getLogoTypeForFD({ name: providerName, providerId: activeApp.fd_provider_id || activeApp.fdProviderId || '' });
1247
+ return {
1248
+ name: providerName,
1249
+ invested,
1250
+ value,
1251
+ returns,
1252
+ maturityDate,
1253
+ tenure_in_months: (_k = activeApp.tenure_in_months) !== null && _k !== void 0 ? _k : 0,
1254
+ interestPayout,
1255
+ logoType,
1256
+ };
1257
+ }
1258
+ catch (e) {
1259
+ return {
1260
+ name: 'Mahindra Finance Ltd',
1261
+ invested: 0,
1262
+ value: 0,
1263
+ returns: 0,
1264
+ maturityDate: '--',
1265
+ tenure_in_months: 0,
1266
+ interestPayout: 'Yearly',
1267
+ logoType: 'mahindra',
1268
+ };
1269
+ }
1270
+ }, [customerApplications]);
1271
+ // All pending/active FDs (one per application with Active or pending/in_progress) – for multiple providers
1272
+ const activeFDs = react_1.default.useMemo(() => {
1273
+ try {
1274
+ if (!customerApplications || isCustomerApplicationsEmpty())
1275
+ return [];
1276
+ let applicationsData = [];
1277
+ if (Array.isArray(customerApplications)) {
1278
+ applicationsData = customerApplications;
1279
+ }
1280
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
1281
+ applicationsData = customerApplications.data;
1282
+ }
1283
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
1284
+ applicationsData = customerApplications.applications;
1285
+ }
1286
+ const pendingActive = applicationsData.filter((a) => {
1287
+ const s = (a.wf_status || a.status || '').toString().toLowerCase();
1288
+ return PENDING_ACTIVE_STATUSES.includes(s);
1289
+ });
1290
+ return pendingActive.map((app) => (Object.assign(Object.assign({}, appToPendingFDData(app)), { app })));
1291
+ }
1292
+ catch (e) {
1293
+ return [];
1294
+ }
1295
+ }, [customerApplications]);
1296
+ // Normalized applications list for provider-scoped lookups
1297
+ const applicationsDataNormalized = react_1.default.useMemo(() => {
1298
+ if (!customerApplications || isCustomerApplicationsEmpty())
1299
+ return [];
1300
+ if (Array.isArray(customerApplications))
1301
+ return customerApplications;
1302
+ if (customerApplications.data && Array.isArray(customerApplications.data))
1303
+ return customerApplications.data;
1304
+ if (customerApplications.applications && Array.isArray(customerApplications.applications))
1305
+ return customerApplications.applications;
1306
+ return [];
1307
+ }, [customerApplications]);
1308
+ // Helper function to check if there's any active/pending FD
1309
+ const hasActiveFD = react_1.default.useMemo(() => activeFDs.length > 0, [activeFDs]);
1310
+ // Pending FD data for bottom sheet: from the app we're showing (provider they tapped), or fallback to first active
1311
+ const pendingFDDataForSheet = react_1.default.useMemo(() => {
1312
+ if (pendingContextApp)
1313
+ return appToPendingFDData(pendingContextApp);
1314
+ if (activeFDs.length > 0)
1315
+ return activeFDs[0]; // fallback: first card data (no app ref needed for display)
1316
+ return activeFD;
1317
+ }, [pendingContextApp, activeFDs, activeFD]);
1318
+ // Build FD options list from interest-rate API (show all FDs)
1319
+ const fdList = react_1.default.useMemo(() => {
1320
+ var _a, _b, _c, _d, _e, _f;
1321
+ if (interestRates && (((_b = (_a = interestRates.data) === null || _a === void 0 ? void 0 : _a.sdrScheme) === null || _b === void 0 ? void 0 : _b.length) > 0 || ((_d = (_c = interestRates.data) === null || _c === void 0 ? void 0 : _c.fdrScheme) === null || _d === void 0 ? void 0 : _d.length) > 0)) {
1322
+ const sdr = Array.isArray((_e = interestRates.data) === null || _e === void 0 ? void 0 : _e.sdrScheme) ? interestRates.data.sdrScheme : [];
1323
+ const fdr = Array.isArray((_f = interestRates.data) === null || _f === void 0 ? void 0 : _f.fdrScheme) ? interestRates.data.fdrScheme : [];
1324
+ const combined = [...sdr, ...fdr];
1325
+ // Building FD options from rates
1326
+ return combined.map((rate, index) => {
1327
+ var _a, _b;
1328
+ return ({
1329
+ id: `${rate.providerId || 'provider'}-${rate.perdMonth || index}`,
1330
+ providerId: rate.providerId || `provider-${index}`,
1331
+ name: rate.providerName || '', // Use actual provider name from API
1332
+ accountNumber: `FD${String(index + 1).padStart(9, '0')}`,
1333
+ roi: `${Number((_b = (_a = rate.rate) !== null && _a !== void 0 ? _a : rate.interestRate) !== null && _b !== void 0 ? _b : 0).toFixed(2)}% p.a.`,
1334
+ tenure: `${rate.perdMonth} Months`,
1335
+ amount: 5000,
1336
+ maturityDate: '2025-12-31',
1337
+ status: 'active',
1338
+ creditRating: rate.creditRating || 'AA+',
1339
+ interestPayout: rate.interestPayout || rate.interest_payout_term || rate.payout_term || 'Yearly'
1340
+ });
1341
+ });
1342
+ }
1343
+ // If rates are not available yet, show empty list
1344
+ return [];
1345
+ }, [interestRates]);
1346
+ // Get filtered FD list based on active tab
1347
+ const filteredFDList = react_1.default.useMemo(() => {
1348
+ if (!fdList || fdList.length === 0)
1349
+ return [];
1350
+ // Always create a new filtered array
1351
+ const filtered = filterFDsByTenure([...fdList], activeTab); // spread to ensure new array
1352
+ return filtered;
1353
+ }, [fdList, activeTab]);
1354
+ const tabs = [strings_1.FD_STRINGS.ALL_FDS_TAB, strings_1.FD_STRINGS.LESS_THAN_1Y_TAB, strings_1.FD_STRINGS.LESS_THAN_1_3Y_TAB, strings_1.FD_STRINGS.LESS_THAN_3_5Y_TAB, strings_1.FD_STRINGS.GREATER_THAN_5Y_TAB];
1355
+ const poweredByLogo = (((_a = (0, appDataConfig_1.getAppData)()) === null || _a === void 0 ? void 0 : _a.poweredByLogo) || '').trim();
1356
+ if (!isAllDataReady) {
1357
+ return (react_1.default.createElement(SafeAreaWrapper_1.default, { style: customStyles.container, includeTop: false, statusBarColor: colors.headerBg, statusBarStyle: "light-content" },
1358
+ react_1.default.createElement(react_native_1.View, { style: { flex: 1, alignItems: 'center', justifyContent: 'center' } },
1359
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary }),
1360
+ react_1.default.createElement(react_native_1.Text, { style: { marginTop: 12, color: colors.textSecondary } }, strings_1.FD_STRINGS.LOADING_FD_DATA))));
1361
+ }
1362
+ return (react_1.default.createElement(SafeAreaWrapper_1.default, { style: customStyles.container, includeTop: false, statusBarColor: colors.headerBg, statusBarStyle: "light-content" },
1363
+ react_1.default.createElement(react_native_1.View, { style: styles.customHeader },
1364
+ react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.backButton, onPress: onGoBack, activeOpacity: 0.7 },
1365
+ react_1.default.createElement(react_native_1.Image, { source: { uri: base64Images_1.base64Images.backArrow }, style: styles.backIcon, resizeMode: "contain" })),
1366
+ react_1.default.createElement(react_native_1.View, { style: styles.headerContent },
1367
+ react_1.default.createElement(react_native_1.Text, { style: styles.headerTitle }, strings_1.FD_STRINGS.CORPORATE_FDS_TITLE),
1368
+ poweredByLogo ? (react_1.default.createElement(react_native_1.View, { style: styles.poweredByContainer },
1369
+ react_1.default.createElement(react_native_1.Text, { style: styles.poweredByText }, "Powered by"),
1370
+ react_1.default.createElement(react_native_1.Image, { source: { uri: poweredByLogo }, style: styles.simplifyLogo, resizeMode: "contain" }))) : null)),
1371
+ react_1.default.createElement(react_native_1.ScrollView, { style: styles.content },
1372
+ hasActiveFD && (react_1.default.createElement(react_native_1.View, { style: styles.section },
1373
+ react_1.default.createElement(react_native_1.Text, { style: styles.sectionTitle }, strings_1.FD_STRINGS.ACTIVE_FDS_SECTION),
1374
+ activeFDs.map((item, index) => {
1375
+ var _a, _b;
1376
+ return (react_1.default.createElement(react_native_1.TouchableOpacity, { key: ((_a = item.app) === null || _a === void 0 ? void 0 : _a.application_id) || ((_b = item.app) === null || _b === void 0 ? void 0 : _b.applicationId) || index, activeOpacity: 0.8, onPress: () => handlePendingFDContinue(item.app, item.logoType), style: index > 0 ? styles.activeFDCardSpacer : undefined },
1377
+ react_1.default.createElement(components_1.ActiveFDCard, { name: item.name, invested: item.invested, value: item.value, returns: item.returns, maturityDate: item.maturityDate, logoType: item.logoType })));
1378
+ }))),
1379
+ react_1.default.createElement(react_native_1.View, { style: styles.tabsContainer },
1380
+ react_1.default.createElement(react_native_1.View, { style: styles.tabsRow }, tabs.map((tab) => (react_1.default.createElement(react_native_1.TouchableOpacity, { key: tab, style: [
1381
+ styles.tab,
1382
+ activeTab === tab && styles.activeTab
1383
+ ], onPress: () => {
1384
+ // Other tabs filter the data
1385
+ setActiveTab(tab);
1386
+ } },
1387
+ react_1.default.createElement(react_native_1.Text, { style: [
1388
+ styles.tabText,
1389
+ activeTab === tab && styles.activeTabText
1390
+ ] }, tab)))))),
1391
+ react_1.default.createElement(react_native_1.View, { style: styles.fdOptionsContainer }, filteredFDList.length > 0 ? (filteredFDList.map((fd) => (react_1.default.createElement(components_1.FDCard, { key: fd.id, id: fd.id, name: fd.name, accountNumber: fd.accountNumber, roi: fd.roi, tenure: fd.tenure, amount: fd.amount, maturityDate: fd.maturityDate, status: fd.status, creditRating: fd.creditRating, logoType: getLogoTypeForFD(fd), onPress: (fdId) => {
1392
+ // Log the selection
1393
+ onSelectFD === null || onSelectFD === void 0 ? void 0 : onSelectFD(fdId);
1394
+ // Store the selected FD data locally
1395
+ setSelectedFD(fd);
1396
+ // Store the selected FD data in Redux for PayNow screen
1397
+ const fdListSelectedData = {
1398
+ id: fd.id,
1399
+ providerId: fd.providerId,
1400
+ name: fd.name,
1401
+ accountNumber: fd.accountNumber,
1402
+ roi: fd.roi,
1403
+ tenure: fd.tenure,
1404
+ amount: fd.amount,
1405
+ maturityDate: fd.maturityDate,
1406
+ status: fd.status,
1407
+ creditRating: fd.creditRating,
1408
+ // Additional fields for PayNow display
1409
+ companyName: fd.name,
1410
+ fdRate: fd.roi,
1411
+ interestPayout: fd.interestPayout || 'Yearly', // Use FD's interest payout or default
1412
+ };
1413
+ dispatch((0, fdListSelectedSlice_1.setFDListSelected)(fdListSelectedData));
1414
+ // 1st Place: Set onboardingIds when customer taps on any FD from FDList
1415
+ // Start with existing onboardingIds, but prefer the freshly computed ones for this tap.
1416
+ let onboardingIdsForNav = onboardingIds;
1417
+ try {
1418
+ let idsToSet = { providerId: fd.providerId };
1419
+ // If we already have customer applications, enrich onboardingIds
1420
+ try {
1421
+ if (customerApplications && !isCustomerApplicationsEmpty()) {
1422
+ // Normalize list
1423
+ let applicationsData = [];
1424
+ if (Array.isArray(customerApplications)) {
1425
+ applicationsData = customerApplications;
1426
+ }
1427
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
1428
+ applicationsData = customerApplications.data;
1429
+ }
1430
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
1431
+ applicationsData = customerApplications.applications;
1432
+ }
1433
+ if (applicationsData.length > 0) {
1434
+ // Prefer applications that belong to the same provider as the tapped FD
1435
+ const fdProviderIdLower = (fd.providerId || '').toLowerCase();
1436
+ const appsForProvider = applicationsData.filter((a) => {
1437
+ const appProviderId = (a.fd_provider_id ||
1438
+ a.fdProviderId ||
1439
+ a.provider_id ||
1440
+ a.providerId ||
1441
+ '').toLowerCase();
1442
+ return appProviderId === fdProviderIdLower;
1443
+ });
1444
+ const scopedApplications = appsForProvider.length > 0 ? appsForProvider : applicationsData;
1445
+ // Within the scoped list, still prefer the Active application
1446
+ const appData = scopedApplications.find((a) => {
1447
+ const s = (a.wf_status || a.status || '').toString();
1448
+ return s === 'Active';
1449
+ }) || scopedApplications[0];
1450
+ idsToSet = {
1451
+ workflowInstanceId: appData.workflow_instance_id || appData.workflowInstanceId,
1452
+ applicationId: appData.application_id || appData.applicationId,
1453
+ entityid: appData.entity_id || appData.entityId,
1454
+ customerId: appData.customer_id || appData.customerId,
1455
+ fdId: appData.fd_id || appData.fdId,
1456
+ currentState: appData.current_state || appData.currentState,
1457
+ currentTask: appData.current_task || appData.currentTask,
1458
+ // Check both snake_case (fd_provider_id) and camelCase (fdProviderId) variants
1459
+ providerId: fd.providerId,
1460
+ wfStatus: appData.wf_status || appData.wfStatus,
1461
+ };
1462
+ }
1463
+ }
1464
+ }
1465
+ catch (innerError) {
1466
+ // If enrichment fails, fall back to providerId only
1467
+ }
1468
+ dispatch((0, onboardingSlice_1.setOnboardingIds)(idsToSet));
1469
+ onboardingIdsForNav = idsToSet;
1470
+ }
1471
+ catch (e) {
1472
+ }
1473
+ // Check if this provider has a pending/active FD – show sheet only for that provider
1474
+ const pendingAppForProvider = getPendingOrActiveAppForProvider(applicationsDataNormalized, fd.providerId || '');
1475
+ if (pendingAppForProvider) {
1476
+ setPendingContextApp(pendingAppForProvider);
1477
+ setShowPendingFDBottomSheet(true);
1478
+ }
1479
+ else {
1480
+ // If no active FD, navigate to appropriate SDK FD calculator
1481
+ const fdProviderId = (fd.providerId || '').toLowerCase();
1482
+ const isMahindra = fdProviderId === MahindraProviderId.toLowerCase();
1483
+ const isShriram = fdProviderId === ShriramProviderId.toLowerCase();
1484
+ // Check for complete applications and create global data constants
1485
+ let ShriramSDKGlobalData = null;
1486
+ let MahindraSDKGlobalData = null;
1487
+ if (customerApplications && !isCustomerApplicationsEmpty()) {
1488
+ let applicationsData = [];
1489
+ if (Array.isArray(customerApplications)) {
1490
+ applicationsData = customerApplications;
1491
+ }
1492
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
1493
+ applicationsData = customerApplications.data;
1494
+ }
1495
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
1496
+ applicationsData = customerApplications.applications;
1497
+ }
1498
+ // Find complete applications
1499
+ const completeApplications = applicationsData.filter((app) => {
1500
+ const status = (app.wf_status || app.status || '').toString().toLowerCase();
1501
+ return status === 'completed' || status === 'complete';
1502
+ });
1503
+ // Separate by provider
1504
+ completeApplications.forEach((app) => {
1505
+ const appProviderId = (app.fd_provider_id || app.fdProviderId || app.provider_id || app.providerId || '').toLowerCase();
1506
+ if (appProviderId === ShriramProviderId.toLowerCase()) {
1507
+ ShriramSDKGlobalData = app;
1508
+ }
1509
+ else if (appProviderId === MahindraProviderId.toLowerCase()) {
1510
+ MahindraSDKGlobalData = app;
1511
+ }
1512
+ });
1513
+ }
1514
+ if (isShriram) {
1515
+ (0, helpers_1.navigate)('ExternalSDK', {
1516
+ sdkType: 'shriram',
1517
+ providerId: fd.providerId,
1518
+ fdListSelectedData: fdListSelectedData,
1519
+ masterData: ShriramMasterData,
1520
+ // Use the freshest onboardingIds (from this tap if available)
1521
+ onboardingIds: onboardingIdsForNav,
1522
+ shriramSDKGlobalData: ShriramSDKGlobalData, // Pass complete Shriram application data
1523
+ mahindraSDKGlobalData: MahindraSDKGlobalData, // Pass complete Mahindra application data
1524
+ });
1525
+ }
1526
+ else if (isMahindra) {
1527
+ // Navigate to Mahindra SDK FD calculator
1528
+ (0, helpers_1.navigate)('ExternalSDK', {
1529
+ sdkType: 'mahindra',
1530
+ providerId: fd.providerId,
1531
+ fdListSelectedData: fdListSelectedData,
1532
+ masterData: MahindraMasterData,
1533
+ // Use the freshest onboardingIds (from this tap if available)
1534
+ onboardingIds: onboardingIdsForNav,
1535
+ shriramSDKGlobalData: ShriramSDKGlobalData, // Pass complete Shriram application data
1536
+ mahindraSDKGlobalData: MahindraSDKGlobalData, // Pass complete Mahindra application data
1537
+ });
1538
+ }
1539
+ else {
1540
+ // Fallback to default FD calculator
1541
+ onNavigateToFDCalculator === null || onNavigateToFDCalculator === void 0 ? void 0 : onNavigateToFDCalculator(fd, masterData);
1542
+ }
1543
+ }
1544
+ },
1545
+ // onPress={(fdId) => {
1546
+ // const fdProviderId = (fd.providerId || '').toLowerCase();
1547
+ // const isMahindra = fdProviderId === MahindraProviderId.toLowerCase();
1548
+ // const isShriram = fdProviderId === ShriramProviderId.toLowerCase();
1549
+ // // Construct FDListSelectedData object
1550
+ // const fdListSelectedData = {
1551
+ // id: fd.id,
1552
+ // providerId: fd.providerId,
1553
+ // name: fd.name,
1554
+ // accountNumber: fd.accountNumber,
1555
+ // roi: fd.roi,
1556
+ // tenure: fd.tenure,
1557
+ // amount: fd.amount,
1558
+ // maturityDate: fd.maturityDate,
1559
+ // status: fd.status as 'active' | 'matured' | 'pending',
1560
+ // creditRating: fd.creditRating,
1561
+ // // Additional fields for PayNow display
1562
+ // companyName: fd.name,
1563
+ // fdRate: fd.roi,
1564
+ // interestPayout: fd.interestPayout || 'Yearly', // Use FD's interest payout or default
1565
+ // };
1566
+ // console.log('[FDList][onPress] ===== FD Tapped - Data Logs =====');
1567
+ // console.log('[FDList][onPress] FDListSelectedData:', fdListSelectedData);
1568
+ // console.log('[FDList][onPress] OnboardingIds:', onboardingIds);
1569
+ // if (isMahindra) {
1570
+ // console.log('[FDList][onPress] Mahindra MasterData:', MahindraMasterData);
1571
+ // } else if (isShriram) {
1572
+ // console.log('[FDList][onPress] Shriram MasterData:', ShriramMasterData);
1573
+ // } else {
1574
+ // console.log('[FDList][onPress] MasterData (fallback):', masterData || masterDataContext);
1575
+ // }
1576
+ // console.log('[FDList][onPress] ====================================');
1577
+ // }}
1578
+ customStyles: customStyles })))) : (react_1.default.createElement(react_native_1.View, { style: styles.noDataContainer },
1579
+ react_1.default.createElement(react_native_1.Text, { style: styles.noDataText }, isLoadingRates || isLoadingApplications ? strings_1.FD_STRINGS.LOADING_FD_DATA :
1580
+ interestRatesError || customerApplicationsError ? strings_1.FD_STRINGS.FAILED_TO_LOAD_FD_DATA :
1581
+ fdList.length === 0 ? (!isCustomerApplicationsEmpty() ? strings_1.FD_STRINGS.NO_CUSTOMER_FDS_FOUND : strings_1.FD_STRINGS.NO_FD_OPTIONS_AVAILABLE) :
1582
+ `${strings_1.FD_STRINGS.NO_FDS_FOUND_FOR_TENURE} "${activeTab}" tenure range.`))))),
1583
+ react_1.default.createElement(components_1.PendingFDBottomSheet, { visible: showPendingFDBottomSheet, onClose: () => {
1584
+ setShowPendingFDBottomSheet(false);
1585
+ setPendingContextApp(null);
1586
+ }, pendingFDData: pendingFDDataForSheet, isBookingNewLoading: isTerminatingWorkflow, onContinue: async () => {
1587
+ setShowPendingFDBottomSheet(false);
1588
+ const forcedFromSelected = getSdkTypeFromProviderId((selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId) || '', MahindraProviderId, ShriramProviderId) || undefined;
1589
+ await handlePendingFDContinue(undefined, forcedFromSelected);
1590
+ }, onBookNew: async () => {
1591
+ try {
1592
+ // Terminate only the workflow for the provider we're showing (the one they tapped)
1593
+ const appToTerminate = pendingContextApp || (activeFDs.length > 0 ? activeFDs[0].app : null);
1594
+ const providerIdForTerminate = appToTerminate
1595
+ ? (appToTerminate.fd_provider_id || appToTerminate.fdProviderId || appToTerminate.provider_id || appToTerminate.providerId)
1596
+ : ((selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId) || inferredProviderId);
1597
+ const requestParams = {
1598
+ providerId: providerIdForTerminate,
1599
+ workflowInstanceId: (appToTerminate === null || appToTerminate === void 0 ? void 0 : appToTerminate.workflow_instance_id) || (appToTerminate === null || appToTerminate === void 0 ? void 0 : appToTerminate.workflowInstanceId) || terminateIdentifiers.workflowInstanceId || 'wf-instance-unknown',
1600
+ entityId: (appToTerminate === null || appToTerminate === void 0 ? void 0 : appToTerminate.entity_id) || (appToTerminate === null || appToTerminate === void 0 ? void 0 : appToTerminate.entityId) || terminateIdentifiers.entityId || 'entity-unknown',
1601
+ applicationId: (appToTerminate === null || appToTerminate === void 0 ? void 0 : appToTerminate.application_id) || (appToTerminate === null || appToTerminate === void 0 ? void 0 : appToTerminate.applicationId) || terminateIdentifiers.applicationId || 'application-unknown',
1602
+ };
1603
+ // Call workflow terminate API (only for this provider's workflow)
1604
+ await terminateWorkflow(requestParams);
1605
+ // 2nd Place: Set onboardingIds when user taps "I want to create new"
1606
+ try {
1607
+ const providerIdToSet = (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId) || inferredProviderId || getProviderIdFromInterestRates();
1608
+ if (providerIdToSet) {
1609
+ const idsToSet = { providerId: providerIdToSet };
1610
+ dispatch((0, onboardingSlice_1.setOnboardingIds)(idsToSet));
1611
+ }
1612
+ else {
1613
+ }
1614
+ }
1615
+ catch (e) {
1616
+ }
1617
+ // Dismiss bottom sheet
1618
+ setShowPendingFDBottomSheet(false);
1619
+ // Navigate to provider-specific SDK (Mahindra/Shriram) just like new FD tap
1620
+ const providerIdToUse = ((selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId) || inferredProviderId || getProviderIdFromInterestRates() || '').toLowerCase();
1621
+ const isMahindra = providerIdToUse === MahindraProviderId.toLowerCase();
1622
+ const isShriram = providerIdToUse === ShriramProviderId.toLowerCase();
1623
+ // Build fdListSelectedData from selectedFD when available (best effort)
1624
+ const fdListSelectedDataToPass = selectedFD ? {
1625
+ id: selectedFD.id || 'new-fd',
1626
+ providerId: selectedFD.providerId,
1627
+ name: selectedFD.name,
1628
+ accountNumber: selectedFD.accountNumber,
1629
+ roi: selectedFD.roi,
1630
+ tenure: selectedFD.tenure,
1631
+ amount: selectedFD.amount,
1632
+ maturityDate: selectedFD.maturityDate,
1633
+ status: selectedFD.status,
1634
+ creditRating: selectedFD.creditRating,
1635
+ companyName: selectedFD.name,
1636
+ fdRate: selectedFD.roi,
1637
+ interestPayout: selectedFD.interestPayout || 'Yearly',
1638
+ } : undefined;
1639
+ const masterDataToPass = isMahindra
1640
+ ? MahindraMasterData
1641
+ : isShriram
1642
+ ? ShriramMasterData
1643
+ : (masterData || masterDataContext);
1644
+ // Recompute complete application global data constants (same as tap flow)
1645
+ let ShriramSDKGlobalData = null;
1646
+ let MahindraSDKGlobalData = null;
1647
+ try {
1648
+ if (customerApplications && !isCustomerApplicationsEmpty()) {
1649
+ let applicationsData = [];
1650
+ if (Array.isArray(customerApplications)) {
1651
+ applicationsData = customerApplications;
1652
+ }
1653
+ else if (customerApplications.data && Array.isArray(customerApplications.data)) {
1654
+ applicationsData = customerApplications.data;
1655
+ }
1656
+ else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
1657
+ applicationsData = customerApplications.applications;
1658
+ }
1659
+ const completeApplications = applicationsData.filter((app) => {
1660
+ const status = (app.wf_status || app.status || '').toString().toLowerCase();
1661
+ return status === 'completed' || status === 'complete';
1662
+ });
1663
+ completeApplications.forEach((app) => {
1664
+ const appProviderId = (app.fd_provider_id || app.fdProviderId || app.provider_id || app.providerId || '').toLowerCase();
1665
+ if (appProviderId === ShriramProviderId.toLowerCase()) {
1666
+ ShriramSDKGlobalData = app;
1667
+ }
1668
+ else if (appProviderId === MahindraProviderId.toLowerCase()) {
1669
+ MahindraSDKGlobalData = app;
1670
+ }
1671
+ });
1672
+ }
1673
+ }
1674
+ catch (e) {
1675
+ // ignore errors
1676
+ }
1677
+ if (isMahindra || isShriram) {
1678
+ (0, helpers_1.navigate)('ExternalSDK', {
1679
+ sdkType: isMahindra ? 'mahindra' : 'shriram',
1680
+ providerId: (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId) || inferredProviderId,
1681
+ fdListSelectedData: fdListSelectedDataToPass,
1682
+ masterData: masterDataToPass,
1683
+ onboardingIds: onboardingIds,
1684
+ shriramSDKGlobalData: ShriramSDKGlobalData,
1685
+ mahindraSDKGlobalData: MahindraSDKGlobalData,
1686
+ });
1687
+ }
1688
+ else {
1689
+ // Fallback to host FD calculator
1690
+ onNavigateToFDCalculator === null || onNavigateToFDCalculator === void 0 ? void 0 : onNavigateToFDCalculator();
1691
+ }
1692
+ }
1693
+ catch (error) {
1694
+ // Handle error silently
1695
+ // Still dismiss bottom sheet and navigate even if API fails
1696
+ // setShowPendingFDBottomSheet(false);
1697
+ // onNavigateToFDCalculator?.();
1698
+ // Show error alert
1699
+ react_native_1.Alert.alert('Warning', 'Failed to terminate existing workflow, but continuing with new FD booking.', [{ text: 'OK' }]);
1700
+ }
1701
+ } }),
1702
+ isLoadingMahindraCustomerDetails && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" },
1703
+ react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary })))));
1704
+ };
1705
+ const createStyles = (colors, typography, spacing, themeName) => react_native_1.StyleSheet.create({
1706
+ container: {
1707
+ flex: 1,
1708
+ backgroundColor: colors.surface,
1709
+ },
1710
+ customHeader: {
1711
+ backgroundColor: colors.headerBg,
1712
+ paddingTop: react_native_1.Platform.OS === 'ios' ? 50 : 20,
1713
+ paddingBottom: spacing.md,
1714
+ paddingHorizontal: spacing.lg,
1715
+ flexDirection: 'row',
1716
+ alignItems: 'center',
1717
+ },
1718
+ backButton: {
1719
+ width: 40,
1720
+ height: 40,
1721
+ alignItems: 'center',
1722
+ justifyContent: 'center',
1723
+ },
1724
+ backIcon: {
1725
+ width: 24,
1726
+ height: 24,
1727
+ tintColor: colors.headerText,
1728
+ },
1729
+ headerContent: {
1730
+ flex: 1,
1731
+ alignItems: 'flex-start',
1732
+ marginRight: 40, // Balance the back button width
1733
+ },
1734
+ headerTitle: Object.assign(Object.assign({}, typography.styles.h3), { color: colors.headerText, marginBottom: spacing.xs }),
1735
+ poweredByContainer: {
1736
+ flexDirection: 'row',
1737
+ alignItems: 'center',
1738
+ },
1739
+ poweredByText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.headerText, opacity: 0.7, marginRight: 0 }),
1740
+ simplifyLogo: {
1741
+ width: 70,
1742
+ height: 20,
1743
+ },
1744
+ content: {
1745
+ flex: 1,
1746
+ },
1747
+ section: {
1748
+ paddingHorizontal: spacing.lg,
1749
+ paddingTop: spacing.xl,
1750
+ },
1751
+ sectionTitle: Object.assign(Object.assign({}, typography.styles.h3), { color: colors.text, marginBottom: spacing.lg }),
1752
+ activeFDCardSpacer: {
1753
+ marginTop: spacing.md,
1754
+ },
1755
+ tabsContainer: {
1756
+ paddingHorizontal: spacing.lg,
1757
+ paddingTop: spacing.xxl,
1758
+ paddingBottom: spacing.lg,
1759
+ },
1760
+ tabsRow: {
1761
+ flexDirection: 'row',
1762
+ justifyContent: 'space-around',
1763
+ alignItems: 'center',
1764
+ },
1765
+ tab: {
1766
+ flex: 1,
1767
+ paddingHorizontal: spacing.sm,
1768
+ paddingVertical: spacing.md,
1769
+ marginHorizontal: 2,
1770
+ borderBottomWidth: 3,
1771
+ borderBottomColor: colors.surface,
1772
+ borderBottomLeftRadius: 8,
1773
+ borderBottomRightRadius: 8,
1774
+ backgroundColor: 'transparent',
1775
+ },
1776
+ activeTab: {
1777
+ borderBottomColor: colors.tabSelected,
1778
+ backgroundColor: colors.background,
1779
+ borderBottomLeftRadius: 12,
1780
+ borderBottomRightRadius: 12,
1781
+ },
1782
+ tabText: Object.assign(Object.assign({}, typography.styles.text12Medium), { color: colors.textSecondary, textAlign: 'center' }),
1783
+ activeTabText: {
1784
+ color: colors.tabSelected,
1785
+ fontWeight: '600',
1786
+ textAlign: 'center',
1787
+ },
1788
+ filterStatusContainer: {
1789
+ paddingHorizontal: spacing.lg,
1790
+ paddingVertical: spacing.sm,
1791
+ backgroundColor: colors.background + '80', // 50% opacity
1792
+ borderBottomWidth: 1,
1793
+ borderBottomColor: colors.border + '20', // 20% opacity
1794
+ },
1795
+ filterStatusText: Object.assign(Object.assign({}, typography.styles.text12Regular), { color: colors.textSecondary, textAlign: 'center', fontStyle: 'italic' }),
1796
+ fdOptionsContainer: {
1797
+ paddingHorizontal: spacing.lg,
1798
+ paddingBottom: spacing.xl,
1799
+ },
1800
+ // API Status Styles
1801
+ apiStatusContainer: {
1802
+ flexDirection: 'row',
1803
+ justifyContent: 'space-between',
1804
+ alignItems: 'center',
1805
+ paddingHorizontal: spacing.lg,
1806
+ paddingVertical: spacing.sm,
1807
+ backgroundColor: colors.background,
1808
+ borderBottomWidth: 1,
1809
+ borderBottomColor: colors.border + '20', // 20% opacity
1810
+ },
1811
+ apiStatusIndicator: {
1812
+ flexDirection: 'row',
1813
+ alignItems: 'center',
1814
+ flex: 1,
1815
+ },
1816
+ apiStatusText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.textSecondary, marginLeft: spacing.xs }),
1817
+ apiSuccessText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.success, marginLeft: spacing.xs }),
1818
+ apiErrorText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.error, marginLeft: spacing.xs }),
1819
+ refreshButton: {
1820
+ paddingHorizontal: spacing.sm,
1821
+ paddingVertical: spacing.xs,
1822
+ backgroundColor: colors.primary + '20', // 20% opacity
1823
+ borderRadius: spacing.xs,
1824
+ },
1825
+ refreshButtonText: Object.assign(Object.assign({}, typography.styles.text10Medium), { color: colors.primary }),
1826
+ noDataContainer: {
1827
+ padding: spacing.lg,
1828
+ alignItems: 'center',
1829
+ justifyContent: 'center',
1830
+ minHeight: 200,
1831
+ },
1832
+ noDataText: Object.assign(Object.assign({}, typography.styles.text14Regular), { color: colors.textSecondary, textAlign: 'center', lineHeight: 20, marginBottom: spacing.md }),
1833
+ showAllButton: {
1834
+ backgroundColor: colors.primary,
1835
+ paddingHorizontal: spacing.lg,
1836
+ paddingVertical: spacing.sm,
1837
+ borderRadius: spacing.sm,
1838
+ marginTop: spacing.md,
1839
+ },
1840
+ showAllButtonText: Object.assign(Object.assign({}, typography.styles.text14Medium), { color: colors.headerText, textAlign: 'center' }),
1841
+ loadingOverlay: {
1842
+ position: 'absolute',
1843
+ top: 0,
1844
+ left: 0,
1845
+ right: 0,
1846
+ bottom: 0,
1847
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
1848
+ justifyContent: 'center',
1849
+ alignItems: 'center',
1850
+ zIndex: 1000,
1851
+ },
1852
+ });
1853
+ exports.default = FDList;