@finspringinnovations/fdsdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -0
- package/lib/api/applicationApi.d.ts +1 -0
- package/lib/api/applicationApi.js +11 -0
- package/lib/api/bankApi.d.ts +352 -0
- package/lib/api/bankApi.js +54 -0
- package/lib/api/baseApi.d.ts +8 -0
- package/lib/api/baseApi.js +456 -0
- package/lib/api/customerApi.d.ts +855 -0
- package/lib/api/customerApi.js +213 -0
- package/lib/api/fdApi.d.ts +979 -0
- package/lib/api/fdApi.js +112 -0
- package/lib/api/fdCalculatorApi.d.ts +179 -0
- package/lib/api/fdCalculatorApi.js +36 -0
- package/lib/api/index.d.ts +14 -0
- package/lib/api/index.js +45 -0
- package/lib/api/interestRateApi.d.ts +585 -0
- package/lib/api/interestRateApi.js +101 -0
- package/lib/api/kycApi.d.ts +486 -0
- package/lib/api/kycApi.js +71 -0
- package/lib/api/masterDataApi.d.ts +158 -0
- package/lib/api/masterDataApi.js +32 -0
- package/lib/api/nomineeApi.d.ts +325 -0
- package/lib/api/nomineeApi.js +46 -0
- package/lib/api/onboardingApi.d.ts +192 -0
- package/lib/api/onboardingApi.js +41 -0
- package/lib/api/panApi.d.ts +0 -0
- package/lib/api/panApi.js +23 -0
- package/lib/api/paymentApi.d.ts +325 -0
- package/lib/api/paymentApi.js +46 -0
- package/lib/api/workflowApi.d.ts +654 -0
- package/lib/api/workflowApi.js +90 -0
- package/lib/assets/images/images.d.ts +4 -0
- package/lib/assets/images/images.js +10 -0
- package/lib/components/AadhaarInput.d.ts +13 -0
- package/lib/components/AadhaarInput.js +47 -0
- package/lib/components/ActionButton.d.ts +12 -0
- package/lib/components/ActionButton.js +87 -0
- package/lib/components/ActiveFDCard.d.ts +16 -0
- package/lib/components/ActiveFDCard.js +95 -0
- package/lib/components/AmountInput.d.ts +20 -0
- package/lib/components/AmountInput.js +144 -0
- package/lib/components/CheckboxOption.d.ts +11 -0
- package/lib/components/CheckboxOption.js +41 -0
- package/lib/components/CompanyHeader.d.ts +7 -0
- package/lib/components/CompanyHeader.js +57 -0
- package/lib/components/DropdownSelector.d.ts +9 -0
- package/lib/components/DropdownSelector.js +49 -0
- package/lib/components/EmptyState.d.ts +17 -0
- package/lib/components/EmptyState.js +44 -0
- package/lib/components/ErrorDisplay.d.ts +17 -0
- package/lib/components/ErrorDisplay.js +69 -0
- package/lib/components/FAQItem.d.ts +9 -0
- package/lib/components/FAQItem.js +52 -0
- package/lib/components/FDCard.d.ts +21 -0
- package/lib/components/FDCard.js +96 -0
- package/lib/components/FormDropdown.d.ts +18 -0
- package/lib/components/FormDropdown.js +155 -0
- package/lib/components/FormSection.d.ts +14 -0
- package/lib/components/FormSection.js +38 -0
- package/lib/components/Header.d.ts +14 -0
- package/lib/components/Header.js +52 -0
- package/lib/components/IFSCSearchResultCard.d.ts +13 -0
- package/lib/components/IFSCSearchResultCard.js +70 -0
- package/lib/components/InfoBox.d.ts +8 -0
- package/lib/components/InfoBox.js +39 -0
- package/lib/components/InterestRateCard.d.ts +8 -0
- package/lib/components/InterestRateCard.js +46 -0
- package/lib/components/LoadingIndicator.d.ts +12 -0
- package/lib/components/LoadingIndicator.js +30 -0
- package/lib/components/OTPInput.d.ts +17 -0
- package/lib/components/OTPInput.js +144 -0
- package/lib/components/PaymentDetailsCard.d.ts +20 -0
- package/lib/components/PaymentDetailsCard.js +68 -0
- package/lib/components/PendingFDBottomSheet.d.ts +18 -0
- package/lib/components/PendingFDBottomSheet.js +122 -0
- package/lib/components/SafeAreaWrapper.d.ts +13 -0
- package/lib/components/SafeAreaWrapper.js +41 -0
- package/lib/components/ScreenHeader.d.ts +11 -0
- package/lib/components/ScreenHeader.js +46 -0
- package/lib/components/StatusDisplay.d.ts +15 -0
- package/lib/components/StatusDisplay.js +88 -0
- package/lib/components/TextFieldWithLabel.d.ts +46 -0
- package/lib/components/TextFieldWithLabel.js +326 -0
- package/lib/components/TrustBox.d.ts +8 -0
- package/lib/components/TrustBox.js +45 -0
- package/lib/components/ValidationErrorAlert.d.ts +23 -0
- package/lib/components/ValidationErrorAlert.js +39 -0
- package/lib/components/ValidationMessage.d.ts +9 -0
- package/lib/components/ValidationMessage.js +98 -0
- package/lib/components/index.d.ts +35 -0
- package/lib/components/index.js +64 -0
- package/lib/config/apiConfig.d.ts +34 -0
- package/lib/config/apiConfig.js +158 -0
- package/lib/config/appDataConfig.d.ts +114 -0
- package/lib/config/appDataConfig.js +264 -0
- package/lib/config/encryptionConfig.d.ts +21 -0
- package/lib/config/encryptionConfig.js +61 -0
- package/lib/config/workflowConstants.d.ts +37 -0
- package/lib/config/workflowConstants.js +38 -0
- package/lib/constants/strings/bank.d.ts +72 -0
- package/lib/constants/strings/bank.js +86 -0
- package/lib/constants/strings/base64Images.d.ts +25 -0
- package/lib/constants/strings/base64Images.js +28 -0
- package/lib/constants/strings/common.d.ts +53 -0
- package/lib/constants/strings/common.js +62 -0
- package/lib/constants/strings/employee.d.ts +61 -0
- package/lib/constants/strings/employee.js +77 -0
- package/lib/constants/strings/faq.d.ts +14 -0
- package/lib/constants/strings/faq.js +20 -0
- package/lib/constants/strings/fd.d.ts +122 -0
- package/lib/constants/strings/fd.js +151 -0
- package/lib/constants/strings/home.d.ts +49 -0
- package/lib/constants/strings/home.js +62 -0
- package/lib/constants/strings/index.d.ts +16 -0
- package/lib/constants/strings/index.js +44 -0
- package/lib/constants/strings/kyc.d.ts +80 -0
- package/lib/constants/strings/kyc.js +94 -0
- package/lib/constants/strings/nominee.d.ts +64 -0
- package/lib/constants/strings/nominee.js +81 -0
- package/lib/hooks/useAuth.d.ts +25 -0
- package/lib/hooks/useAuth.js +39 -0
- package/lib/hooks/useFDData.d.ts +11 -0
- package/lib/hooks/useFDData.js +40 -0
- package/lib/index.d.ts +69 -0
- package/lib/index.js +182 -0
- package/lib/navigation/RootNavigator.d.ts +8 -0
- package/lib/navigation/RootNavigator.js +205 -0
- package/lib/navigation/SimpleNavigator.d.ts +11 -0
- package/lib/navigation/SimpleNavigator.js +107 -0
- package/lib/navigation/helpers.d.ts +11 -0
- package/lib/navigation/helpers.js +83 -0
- package/lib/navigation/index.d.ts +15 -0
- package/lib/navigation/index.js +42 -0
- package/lib/navigation/types.d.ts +113 -0
- package/lib/navigation/types.js +2 -0
- package/lib/navigation/workflowNavigator.d.ts +22 -0
- package/lib/navigation/workflowNavigator.js +104 -0
- package/lib/providers/ApiProvider.d.ts +7 -0
- package/lib/providers/ApiProvider.js +34 -0
- package/lib/providers/MasterDataProvider.d.ts +10 -0
- package/lib/providers/MasterDataProvider.js +54 -0
- package/lib/screens/AadhaarVerification.d.ts +7 -0
- package/lib/screens/AadhaarVerification.js +627 -0
- package/lib/screens/AddBankAccount.d.ts +22 -0
- package/lib/screens/AddBankAccount.js +381 -0
- package/lib/screens/BankDetail.d.ts +16 -0
- package/lib/screens/BankDetail.js +596 -0
- package/lib/screens/BookFD.d.ts +0 -0
- package/lib/screens/BookFD.js +315 -0
- package/lib/screens/Employee.d.ts +18 -0
- package/lib/screens/Employee.js +594 -0
- package/lib/screens/FDCalculator.d.ts +18 -0
- package/lib/screens/FDCalculator.js +759 -0
- package/lib/screens/FDList.d.ts +27 -0
- package/lib/screens/FDList.js +1008 -0
- package/lib/screens/FindIFSC.d.ts +16 -0
- package/lib/screens/FindIFSC.js +248 -0
- package/lib/screens/Home.d.ts +0 -0
- package/lib/screens/Home.js +143 -0
- package/lib/screens/NomineeDetail.d.ts +17 -0
- package/lib/screens/NomineeDetail.js +592 -0
- package/lib/screens/PayNow.d.ts +14 -0
- package/lib/screens/PayNow.js +230 -0
- package/lib/screens/Payment.d.ts +11 -0
- package/lib/screens/Payment.js +191 -0
- package/lib/screens/PaymentStatus.d.ts +16 -0
- package/lib/screens/PaymentStatus.js +397 -0
- package/lib/screens/ReviewKYC.d.ts +21 -0
- package/lib/screens/ReviewKYC.js +660 -0
- package/lib/state/paymentSession.d.ts +8 -0
- package/lib/state/paymentSession.js +13 -0
- package/lib/store/fdListSelectedSlice.d.ts +21 -0
- package/lib/store/fdListSelectedSlice.js +26 -0
- package/lib/store/hooks.d.ts +8 -0
- package/lib/store/hooks.js +31 -0
- package/lib/store/index.d.ts +3 -0
- package/lib/store/index.js +8 -0
- package/lib/store/onboardingSlice.d.ts +12 -0
- package/lib/store/onboardingSlice.js +32 -0
- package/lib/store/store.d.ts +13 -0
- package/lib/store/store.js +33 -0
- package/lib/theme/ThemeContext.d.ts +210 -0
- package/lib/theme/ThemeContext.js +90 -0
- package/lib/theme/colors.d.ts +80 -0
- package/lib/theme/colors.js +85 -0
- package/lib/theme/index.d.ts +34 -0
- package/lib/theme/index.js +69 -0
- package/lib/theme/shadows.d.ts +53 -0
- package/lib/theme/shadows.js +58 -0
- package/lib/theme/typography.d.ts +134 -0
- package/lib/theme/typography.js +143 -0
- package/lib/types/dataTypes.d.ts +34 -0
- package/lib/types/dataTypes.js +2 -0
- package/lib/types/workflowTypes.d.ts +2 -0
- package/lib/types/workflowTypes.js +2 -0
- package/lib/utils/apiLogger.d.ts +48 -0
- package/lib/utils/apiLogger.js +105 -0
- package/lib/utils/encryption.d.ts +28 -0
- package/lib/utils/encryption.js +113 -0
- package/lib/utils/getFDData.d.ts +48 -0
- package/lib/utils/getFDData.js +154 -0
- package/lib/utils/globalData.d.ts +2 -0
- package/lib/utils/globalData.js +10 -0
- package/package.json +76 -0
- package/src/api/applicationApi.ts +12 -0
- package/src/api/bankApi.ts +42 -0
- package/src/api/baseApi.ts +513 -0
- package/src/api/customerApi.ts +291 -0
- package/src/api/fdApi.ts +150 -0
- package/src/api/fdCalculatorApi.ts +41 -0
- package/src/api/index.ts +29 -0
- package/src/api/interestRateApi.ts +143 -0
- package/src/api/kycApi.ts +63 -0
- package/src/api/masterDataApi.ts +34 -0
- package/src/api/nomineeApi.ts +34 -0
- package/src/api/onboardingApi.ts +64 -0
- package/src/api/panApi.ts +25 -0
- package/src/api/paymentApi.ts +34 -0
- package/src/api/workflowApi.ts +94 -0
- package/src/assets/images/arrow-filled.png +0 -0
- package/src/assets/images/arrow-left.png +0 -0
- package/src/assets/images/backicon.png +0 -0
- package/src/assets/images/calendar.png +0 -0
- package/src/assets/images/chevron-down.png +0 -0
- package/src/assets/images/chevron-down@2x.png +0 -0
- package/src/assets/images/chevron-down@3x.png +0 -0
- package/src/assets/images/images.js +8 -0
- package/src/components/AadhaarInput.tsx +91 -0
- package/src/components/ActionButton.tsx +129 -0
- package/src/components/ActiveFDCard.tsx +158 -0
- package/src/components/AmountInput.tsx +217 -0
- package/src/components/CheckboxOption.tsx +93 -0
- package/src/components/CompanyHeader.tsx +78 -0
- package/src/components/DropdownSelector.tsx +77 -0
- package/src/components/EmptyState.tsx +109 -0
- package/src/components/ErrorDisplay.tsx +135 -0
- package/src/components/FAQItem.tsx +90 -0
- package/src/components/FDCard.tsx +165 -0
- package/src/components/FormDropdown.tsx +214 -0
- package/src/components/FormSection.tsx +86 -0
- package/src/components/Header.tsx +110 -0
- package/src/components/IFSCSearchResultCard.tsx +139 -0
- package/src/components/InfoBox.tsx +55 -0
- package/src/components/InterestRateCard.tsx +77 -0
- package/src/components/LoadingIndicator.tsx +63 -0
- package/src/components/OTPInput.tsx +213 -0
- package/src/components/PaymentDetailsCard.tsx +120 -0
- package/src/components/PendingFDBottomSheet.tsx +235 -0
- package/src/components/README.md +210 -0
- package/src/components/SafeAreaWrapper.tsx +68 -0
- package/src/components/ScreenHeader.tsx +83 -0
- package/src/components/StatusDisplay.tsx +139 -0
- package/src/components/TextFieldWithLabel.tsx +502 -0
- package/src/components/TrustBox.tsx +63 -0
- package/src/components/ValidationErrorAlert.tsx +57 -0
- package/src/components/ValidationMessage.tsx +134 -0
- package/src/components/index.tsx +47 -0
- package/src/config/apiConfig.ts +217 -0
- package/src/config/appDataConfig.ts +279 -0
- package/src/config/encryptionConfig.ts +65 -0
- package/src/config/workflowConstants.ts +43 -0
- package/src/constants/strings/README.md +146 -0
- package/src/constants/strings/bank.ts +92 -0
- package/src/constants/strings/base64Images.ts +29 -0
- package/src/constants/strings/common.ts +63 -0
- package/src/constants/strings/employee.ts +85 -0
- package/src/constants/strings/faq.ts +23 -0
- package/src/constants/strings/fd.ts +172 -0
- package/src/constants/strings/home.ts +67 -0
- package/src/constants/strings/index.ts +21 -0
- package/src/constants/strings/kyc.ts +100 -0
- package/src/constants/strings/nominee.ts +90 -0
- package/src/hooks/useAuth.ts +42 -0
- package/src/hooks/useFDData.ts +48 -0
- package/src/index.tsx +173 -0
- package/src/navigation/RootNavigator.tsx +352 -0
- package/src/navigation/SimpleNavigator.tsx +107 -0
- package/src/navigation/helpers.ts +85 -0
- package/src/navigation/index.tsx +81 -0
- package/src/navigation/types.ts +124 -0
- package/src/navigation/workflowNavigator.ts +131 -0
- package/src/providers/ApiProvider.tsx +43 -0
- package/src/providers/MasterDataProvider.tsx +30 -0
- package/src/screens/AadhaarVerification.tsx +809 -0
- package/src/screens/AddBankAccount.tsx +541 -0
- package/src/screens/BankDetail.tsx +826 -0
- package/src/screens/BookFD.tsx +330 -0
- package/src/screens/Employee.tsx +822 -0
- package/src/screens/FDCalculator.tsx +987 -0
- package/src/screens/FDList.tsx +1284 -0
- package/src/screens/FindIFSC.tsx +332 -0
- package/src/screens/Home.tsx +152 -0
- package/src/screens/NomineeDetail.tsx +800 -0
- package/src/screens/PayNow.tsx +282 -0
- package/src/screens/Payment.tsx +224 -0
- package/src/screens/PaymentStatus.tsx +561 -0
- package/src/screens/ReviewKYC.tsx +956 -0
- package/src/state/paymentSession.ts +13 -0
- package/src/store/fdListSelectedSlice.ts +42 -0
- package/src/store/hooks.ts +27 -0
- package/src/store/index.ts +3 -0
- package/src/store/onboardingSlice.ts +37 -0
- package/src/store/store.ts +35 -0
- package/src/theme/ThemeContext.tsx +82 -0
- package/src/theme/colors.ts +90 -0
- package/src/theme/index.ts +64 -0
- package/src/theme/shadows.ts +61 -0
- package/src/theme/typography.ts +151 -0
- package/src/types/dataTypes.ts +37 -0
- package/src/types/env.d.ts +93 -0
- package/src/types/workflowTypes.ts +12 -0
- package/src/utils/apiLogger.ts +166 -0
- package/src/utils/encryption.ts +159 -0
- package/src/utils/getFDData.ts +175 -0
- package/src/utils/globalData.ts +7 -0
|
@@ -0,0 +1,1008 @@
|
|
|
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 strings_1 = require("../constants/strings");
|
|
60
|
+
const base64Images_1 = require("../constants/strings/base64Images");
|
|
61
|
+
var completeFDData = null;
|
|
62
|
+
const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, customStyles = {}, }) => {
|
|
63
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)(strings_1.FD_STRINGS.ALL_FDS_TAB);
|
|
64
|
+
const [showPendingFDBottomSheet, setShowPendingFDBottomSheet] = (0, react_1.useState)(false);
|
|
65
|
+
const [selectedFD, setSelectedFD] = (0, react_1.useState)(null);
|
|
66
|
+
const [isInitialized, setIsInitialized] = (0, react_1.useState)(false);
|
|
67
|
+
const colors = (0, ThemeContext_1.useColors)();
|
|
68
|
+
const typography = (0, ThemeContext_1.useTypography)();
|
|
69
|
+
const spacing = (0, ThemeContext_1.useSpacing)();
|
|
70
|
+
const { themeName } = (0, ThemeContext_1.useTheme)();
|
|
71
|
+
const dispatch = (0, store_1.useAppDispatch)();
|
|
72
|
+
const hasFetchedRatesRef = react_1.default.useRef(false);
|
|
73
|
+
const isCallingInterestRatesRef = react_1.default.useRef(false);
|
|
74
|
+
// API calls to fetch
|
|
75
|
+
const [getInterestRates, { data: interestRates, error: interestRatesError, isLoading: isLoadingRates, }] = (0, interestRateApi_1.useGetInterestRatesMutation)();
|
|
76
|
+
const [getCustomerApplications, { data: customerApplications, error: customerApplicationsError, isLoading: isLoadingApplications, }] = (0, customerApi_1.useGetCustomerApplicationsMutation)();
|
|
77
|
+
const [terminateWorkflow, { data: terminateWorkflowData, error: terminateWorkflowError, isLoading: isTerminatingWorkflow, }] = (0, workflowApi_1.useTerminateWorkflowMutation)();
|
|
78
|
+
// Payment Reverse Feed API
|
|
79
|
+
const [paymentReverseFeed, { data: paymentReverseFeedResponse, error: paymentReverseFeedError, isLoading: isLoadingPaymentReverseFeed, }] = (0, fdApi_1.usePaymentReverseFeedMutation)();
|
|
80
|
+
const styles = createStyles(colors, typography, spacing, themeName);
|
|
81
|
+
const { setMasterData } = (0, MasterDataProvider_1.useMasterData)();
|
|
82
|
+
// Redux selectors for workflow IDs
|
|
83
|
+
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; });
|
|
84
|
+
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; });
|
|
85
|
+
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; });
|
|
86
|
+
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; });
|
|
87
|
+
// Helper function to check if customer applications is empty
|
|
88
|
+
const isCustomerApplicationsEmpty = () => {
|
|
89
|
+
if (!customerApplications) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
// Handle direct array response
|
|
93
|
+
if (Array.isArray(customerApplications)) {
|
|
94
|
+
const isEmpty = customerApplications.length === 0;
|
|
95
|
+
return isEmpty;
|
|
96
|
+
}
|
|
97
|
+
// Handle response with data property
|
|
98
|
+
if (customerApplications.data && Array.isArray(customerApplications.data)) {
|
|
99
|
+
const isEmpty = customerApplications.data.length === 0;
|
|
100
|
+
return isEmpty;
|
|
101
|
+
}
|
|
102
|
+
// Handle response with applications property
|
|
103
|
+
if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
|
|
104
|
+
const isEmpty = customerApplications.applications.length === 0;
|
|
105
|
+
return isEmpty;
|
|
106
|
+
}
|
|
107
|
+
// If customerApplications exists but doesn't match expected structure, consider it not empty
|
|
108
|
+
return false;
|
|
109
|
+
};
|
|
110
|
+
// Helper function to get provider ID from interest rates response (robust to varying shapes)
|
|
111
|
+
const getProviderIdFromInterestRates = () => {
|
|
112
|
+
try {
|
|
113
|
+
const data = interestRates === null || interestRates === void 0 ? void 0 : interestRates.data;
|
|
114
|
+
if (!data)
|
|
115
|
+
return undefined;
|
|
116
|
+
const extractId = (rate) => {
|
|
117
|
+
var _a;
|
|
118
|
+
return ((rate === null || rate === void 0 ? void 0 : rate.providerId) ||
|
|
119
|
+
(rate === null || rate === void 0 ? void 0 : rate.provider_id) ||
|
|
120
|
+
(rate === null || rate === void 0 ? void 0 : rate.fd_provider_id) ||
|
|
121
|
+
(rate === null || rate === void 0 ? void 0 : rate.fdProviderId) ||
|
|
122
|
+
((_a = rate === null || rate === void 0 ? void 0 : rate.provider) === null || _a === void 0 ? void 0 : _a.id) ||
|
|
123
|
+
undefined);
|
|
124
|
+
};
|
|
125
|
+
// Prefer SDR
|
|
126
|
+
const sdr = Array.isArray(data === null || data === void 0 ? void 0 : data.sdrScheme) ? data.sdrScheme : [];
|
|
127
|
+
for (const r of sdr) {
|
|
128
|
+
const id = extractId(r);
|
|
129
|
+
if (id) {
|
|
130
|
+
return id;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Fallback to FDR
|
|
134
|
+
const fdr = Array.isArray(data === null || data === void 0 ? void 0 : data.fdrScheme) ? data.fdrScheme : [];
|
|
135
|
+
for (const r of fdr) {
|
|
136
|
+
const id = extractId(r);
|
|
137
|
+
if (id) {
|
|
138
|
+
return id;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
// Helper function to filter FDs based on tenure
|
|
148
|
+
const filterFDsByTenure = (fdList, filter) => {
|
|
149
|
+
if (filter === strings_1.FD_STRINGS.ALL_FDS_TAB)
|
|
150
|
+
return fdList;
|
|
151
|
+
return fdList.filter(fd => {
|
|
152
|
+
// Extract tenure in months from the fd.tenure string (e.g., "12 Months" -> 12)
|
|
153
|
+
const tenureMatch = fd.tenure.match(/(\d+)\s*Months?/i);
|
|
154
|
+
if (!tenureMatch)
|
|
155
|
+
return false;
|
|
156
|
+
const tenureMonths = parseInt(tenureMatch[1], 10);
|
|
157
|
+
const tenureYears = tenureMonths / 12;
|
|
158
|
+
switch (filter) {
|
|
159
|
+
case '<1Y':
|
|
160
|
+
return tenureYears <= 1;
|
|
161
|
+
case '<1-3Y':
|
|
162
|
+
return tenureYears > 1 && tenureYears <= 3;
|
|
163
|
+
case '<3-5Y':
|
|
164
|
+
return tenureYears > 3 && tenureYears <= 5;
|
|
165
|
+
case '>5Y':
|
|
166
|
+
return tenureYears > 5;
|
|
167
|
+
default:
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
// Master data fetch - use default providerId first, then update with rates data
|
|
173
|
+
const defaultProviderId = ''; // Default provider ID for initial call
|
|
174
|
+
const inferredProviderId = react_1.default.useMemo(() => {
|
|
175
|
+
var _a, _b, _c, _d, _e, _f;
|
|
176
|
+
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)
|
|
177
|
+
return interestRates.data.sdrScheme[0].providerId;
|
|
178
|
+
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)
|
|
179
|
+
return interestRates.data.fdrScheme[0].providerId;
|
|
180
|
+
return defaultProviderId; // Use default if no rates data yet
|
|
181
|
+
}, [interestRates]);
|
|
182
|
+
const { data: masterData, isLoading: isLoadingMaster } = (0, masterDataApi_1.useGetMasterDataQuery)({ providerId: inferredProviderId }, { skip: !inferredProviderId });
|
|
183
|
+
// Only render once all three API calls have completed (success or error)
|
|
184
|
+
// Show loading initially until all APIs have completed
|
|
185
|
+
const isAllDataReady = react_1.default.useMemo(() => {
|
|
186
|
+
// If not initialized yet, show loading
|
|
187
|
+
if (!isInitialized)
|
|
188
|
+
return false;
|
|
189
|
+
// Step 1: Check if interest rates API has been called and completed
|
|
190
|
+
// If currently loading, show loading
|
|
191
|
+
if (isLoadingRates)
|
|
192
|
+
return false;
|
|
193
|
+
// If not loading but no data and no error, API hasn't been called yet - show loading
|
|
194
|
+
if (!interestRates && !interestRatesError)
|
|
195
|
+
return false;
|
|
196
|
+
// Step 2: Once interest rates are done, customer applications should be called
|
|
197
|
+
// If currently loading, show loading
|
|
198
|
+
if (isLoadingApplications)
|
|
199
|
+
return false;
|
|
200
|
+
// If interest rates succeeded, we must wait for customer applications
|
|
201
|
+
// If interest rates failed, we can still proceed (but applications might not be called)
|
|
202
|
+
if (interestRates) {
|
|
203
|
+
// Interest rates succeeded, so applications should be called
|
|
204
|
+
// If not loading but no data and no error, applications haven't been called yet - show loading
|
|
205
|
+
if (!customerApplications && !customerApplicationsError)
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
// Step 3: Check master data - only required if providerId is available
|
|
209
|
+
const masterShouldRun = !!inferredProviderId;
|
|
210
|
+
if (masterShouldRun) {
|
|
211
|
+
// Master data should be done (either loaded or error, but not loading)
|
|
212
|
+
if (isLoadingMaster)
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
return true;
|
|
216
|
+
}, [isInitialized, interestRates, interestRatesError, isLoadingRates, customerApplications, customerApplicationsError, isLoadingApplications, inferredProviderId, isLoadingMaster]);
|
|
217
|
+
(0, react_1.useEffect)(() => {
|
|
218
|
+
if (masterData) {
|
|
219
|
+
setMasterData(masterData);
|
|
220
|
+
}
|
|
221
|
+
}, [masterData, setMasterData]);
|
|
222
|
+
// Function to refresh all data - Required sequence: Interest -> Applications -> Master
|
|
223
|
+
const refreshData = (0, react_1.useCallback)(async () => {
|
|
224
|
+
if (!isInitialized) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
// Prevent multiple simultaneous calls
|
|
228
|
+
if (isCallingInterestRatesRef.current || isLoadingRates) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
isCallingInterestRatesRef.current = true;
|
|
233
|
+
// Add 500ms delay before calling interest rate API
|
|
234
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
235
|
+
await getInterestRates({});
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
// Handle error silently
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
isCallingInterestRatesRef.current = false;
|
|
242
|
+
}
|
|
243
|
+
}, [getInterestRates, isInitialized, isLoadingRates]);
|
|
244
|
+
// Initialize component after mount
|
|
245
|
+
(0, react_1.useEffect)(() => {
|
|
246
|
+
const initializeComponent = async () => {
|
|
247
|
+
// Validate required user data before proceeding
|
|
248
|
+
const appData = (0, appDataConfig_1.getAppData)();
|
|
249
|
+
const requiredFields = [
|
|
250
|
+
{ field: 'id', label: 'User ID' },
|
|
251
|
+
{ field: 'name', label: 'User Name' },
|
|
252
|
+
{ field: 'dob', label: 'Date of Birth' },
|
|
253
|
+
{ field: 'gender', label: 'Gender' },
|
|
254
|
+
{ field: 'mobNo', label: 'Mobile Number' },
|
|
255
|
+
{ field: 'email', label: 'Email' },
|
|
256
|
+
];
|
|
257
|
+
const missingFields = [];
|
|
258
|
+
requiredFields.forEach(({ field, label }) => {
|
|
259
|
+
const value = appData === null || appData === void 0 ? void 0 : appData[field];
|
|
260
|
+
if (!value || (typeof value === 'string' && !value.trim())) {
|
|
261
|
+
missingFields.push(label);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
// Show alert if required fields are missing
|
|
265
|
+
if (missingFields.length > 0) {
|
|
266
|
+
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.`, [
|
|
267
|
+
{
|
|
268
|
+
text: 'Cancel FD Booking',
|
|
269
|
+
onPress: () => {
|
|
270
|
+
// Redirect back to main app
|
|
271
|
+
if (onGoBack) {
|
|
272
|
+
onGoBack();
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
// No-op when onGoBack is not provided
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
style: 'cancel',
|
|
279
|
+
},
|
|
280
|
+
], { cancelable: false });
|
|
281
|
+
return; // Don't initialize if validation fails
|
|
282
|
+
}
|
|
283
|
+
// Additional value validation (case-insensitive): gender, maritalStatus, typeOfAccount
|
|
284
|
+
const errors = [];
|
|
285
|
+
// Gender must be Male, Female, or Other (case-insensitive)
|
|
286
|
+
const gender = String((appData === null || appData === void 0 ? void 0 : appData.gender) || '').trim().toLowerCase();
|
|
287
|
+
const allowedGenders = ['male', 'female', 'other'];
|
|
288
|
+
if (gender && !allowedGenders.includes(gender)) {
|
|
289
|
+
errors.push("Gender must be one of: Male, Female, Other");
|
|
290
|
+
}
|
|
291
|
+
// Marital status must be Married, Unmarried, or Other (case-insensitive)
|
|
292
|
+
const maritalStatus = String((appData === null || appData === void 0 ? void 0 : appData.maritalStatus) || '').trim().toLowerCase();
|
|
293
|
+
const allowedMarital = ['married', 'unmarried', 'other'];
|
|
294
|
+
if (maritalStatus && !allowedMarital.includes(maritalStatus)) {
|
|
295
|
+
errors.push("Marital Status must be one of: Married, Unmarried, Other");
|
|
296
|
+
}
|
|
297
|
+
// Account type must be 'Saving A/c' or 'Current A/c' (case-insensitive, tolerate spaces)
|
|
298
|
+
const typeOfAccountRaw = String((appData === null || appData === void 0 ? void 0 : appData.typeOfAccount) || '').trim();
|
|
299
|
+
const typeOfAccount = typeOfAccountRaw.replace(/\s+/g, ' ').toLowerCase();
|
|
300
|
+
const allowedAccounts = ['saving a/c', 'current a/c'];
|
|
301
|
+
if (typeOfAccountRaw && !allowedAccounts.includes(typeOfAccount)) {
|
|
302
|
+
errors.push("Type of Account must be one of: 'Saving A/c', 'Current A/c'");
|
|
303
|
+
}
|
|
304
|
+
if (errors.length > 0) {
|
|
305
|
+
react_native_1.Alert.alert('Invalid User Data', `${errors.join('\n')}`, [
|
|
306
|
+
{
|
|
307
|
+
text: 'OK',
|
|
308
|
+
onPress: () => {
|
|
309
|
+
if (onGoBack) {
|
|
310
|
+
onGoBack();
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
style: 'cancel',
|
|
314
|
+
},
|
|
315
|
+
], { cancelable: false });
|
|
316
|
+
return; // Stop initialization on invalid values
|
|
317
|
+
}
|
|
318
|
+
// Small delay to ensure component is fully mounted
|
|
319
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
320
|
+
setIsInitialized(true);
|
|
321
|
+
};
|
|
322
|
+
initializeComponent();
|
|
323
|
+
}, [onGoBack]);
|
|
324
|
+
// Handle Android hardware back button - use same navigation as header back button
|
|
325
|
+
(0, react_1.useEffect)(() => {
|
|
326
|
+
if (react_native_1.Platform.OS !== 'android')
|
|
327
|
+
return;
|
|
328
|
+
const onHardwareBackPress = () => {
|
|
329
|
+
// Call onGoBack which triggers onExit in RootNavigator
|
|
330
|
+
if (onGoBack) {
|
|
331
|
+
onGoBack();
|
|
332
|
+
}
|
|
333
|
+
return true; // Prevent default behavior
|
|
334
|
+
};
|
|
335
|
+
const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onHardwareBackPress);
|
|
336
|
+
return () => backHandler.remove();
|
|
337
|
+
}, [onGoBack]);
|
|
338
|
+
// Removed init-time fetch to avoid duplicate calls; we'll fetch on first focus only
|
|
339
|
+
// Refresh data when screen comes into focus (only if initialized)
|
|
340
|
+
(0, native_1.useFocusEffect)((0, react_1.useCallback)(() => {
|
|
341
|
+
if (!isInitialized)
|
|
342
|
+
return;
|
|
343
|
+
if (hasFetchedRatesRef.current)
|
|
344
|
+
return; // ensure called only once when screen first shows
|
|
345
|
+
// Prevent multiple simultaneous calls
|
|
346
|
+
if (isCallingInterestRatesRef.current || isLoadingRates)
|
|
347
|
+
return;
|
|
348
|
+
hasFetchedRatesRef.current = true;
|
|
349
|
+
refreshData();
|
|
350
|
+
}, [refreshData, isInitialized, isLoadingRates]));
|
|
351
|
+
// After interest rates are received, call Customer Applications
|
|
352
|
+
(0, react_1.useEffect)(() => {
|
|
353
|
+
if (!interestRates)
|
|
354
|
+
return;
|
|
355
|
+
try {
|
|
356
|
+
const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
|
|
357
|
+
getCustomerApplications({ userReferenceId: userInfo.id });
|
|
358
|
+
}
|
|
359
|
+
catch (e) {
|
|
360
|
+
}
|
|
361
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
362
|
+
}, [!!interestRates]);
|
|
363
|
+
// Handle API errors
|
|
364
|
+
(0, react_1.useEffect)(() => {
|
|
365
|
+
if (interestRatesError) {
|
|
366
|
+
react_native_1.Alert.alert('API Error', 'Failed to fetch interest rates. Please try again.', [
|
|
367
|
+
{
|
|
368
|
+
text: 'Retry',
|
|
369
|
+
onPress: async () => {
|
|
370
|
+
// Prevent multiple simultaneous calls
|
|
371
|
+
if (isCallingInterestRatesRef.current || isLoadingRates) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
isCallingInterestRatesRef.current = true;
|
|
376
|
+
// Add 500ms delay before retrying interest rate API
|
|
377
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
378
|
+
await getInterestRates({});
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
// Handle error silently
|
|
382
|
+
}
|
|
383
|
+
finally {
|
|
384
|
+
isCallingInterestRatesRef.current = false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{ text: 'Continue', style: 'cancel' }
|
|
389
|
+
]);
|
|
390
|
+
}
|
|
391
|
+
}, [interestRatesError, getInterestRates]);
|
|
392
|
+
// Log successful data fetch
|
|
393
|
+
(0, react_1.useEffect)(() => {
|
|
394
|
+
var _a, _b;
|
|
395
|
+
if (interestRates && ((_b = (_a = interestRates.data) === null || _a === void 0 ? void 0 : _a.sdrScheme) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
396
|
+
// Interest rates loaded successfully
|
|
397
|
+
}
|
|
398
|
+
}, [interestRates]);
|
|
399
|
+
// Persist providerId to onboarding store as soon as we have rates
|
|
400
|
+
(0, react_1.useEffect)(() => {
|
|
401
|
+
const pid = getProviderIdFromInterestRates();
|
|
402
|
+
if (pid) {
|
|
403
|
+
try {
|
|
404
|
+
dispatch((0, onboardingSlice_1.setOnboardingIds)({ providerId: pid }));
|
|
405
|
+
}
|
|
406
|
+
catch (e) {
|
|
407
|
+
// Handle error silently
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}, [interestRates, dispatch]);
|
|
411
|
+
(0, react_1.useEffect)(() => {
|
|
412
|
+
if (customerApplications) {
|
|
413
|
+
// Customer applications loaded successfully
|
|
414
|
+
// Persist onboarding identifiers globally for subsequent API calls (like FDCalculator)
|
|
415
|
+
try {
|
|
416
|
+
// Extract workflow parameters from response
|
|
417
|
+
const responseData = (customerApplications === null || customerApplications === void 0 ? void 0 : customerApplications.data) || customerApplications;
|
|
418
|
+
let applicationData = Array.isArray(responseData) ? responseData[0] : responseData;
|
|
419
|
+
// Prefer the application with wf_status === 'Active'
|
|
420
|
+
if (Array.isArray(responseData)) {
|
|
421
|
+
const activeOnly = responseData.find((app) => {
|
|
422
|
+
const status = (app.wf_status || app.status || '').toString();
|
|
423
|
+
return status === 'Active';
|
|
424
|
+
});
|
|
425
|
+
if (activeOnly)
|
|
426
|
+
applicationData = activeOnly;
|
|
427
|
+
}
|
|
428
|
+
if (Array.isArray(responseData)) {
|
|
429
|
+
completeFDData = responseData.find((app) => {
|
|
430
|
+
const status = (app.wf_status || app.status || '').toString();
|
|
431
|
+
return status === 'Completed';
|
|
432
|
+
});
|
|
433
|
+
(0, globalData_1.setGlobalData)({ completeFDData: !!completeFDData });
|
|
434
|
+
}
|
|
435
|
+
if (applicationData) {
|
|
436
|
+
const ids = {
|
|
437
|
+
workflowInstanceId: applicationData.workflow_instance_id,
|
|
438
|
+
applicationId: applicationData.application_id,
|
|
439
|
+
entityid: applicationData.entity_id,
|
|
440
|
+
customerId: applicationData.customer_id,
|
|
441
|
+
fdId: applicationData.fd_id,
|
|
442
|
+
currentState: applicationData.current_state,
|
|
443
|
+
currentTask: applicationData.current_task,
|
|
444
|
+
// Persist providerId from interest-rate API (prefers SDR, fallback FDR)
|
|
445
|
+
providerId: getProviderIdFromInterestRates(),
|
|
446
|
+
wfStatus: applicationData.wf_status,
|
|
447
|
+
};
|
|
448
|
+
if (dispatch && onboardingSlice_1.setOnboardingIds) {
|
|
449
|
+
dispatch((0, onboardingSlice_1.setOnboardingIds)(ids));
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
// Dispatch or setOnboardingIds unavailable
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
// Handle error silently
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}, [customerApplications, dispatch]);
|
|
461
|
+
// Unified handler: behave like bottom sheet Continue flow
|
|
462
|
+
const handlePendingFDContinue = async () => {
|
|
463
|
+
var _a;
|
|
464
|
+
// Persist active FD data to store for use across screens
|
|
465
|
+
try {
|
|
466
|
+
if (activeFD) {
|
|
467
|
+
const fdListSelectedData = {
|
|
468
|
+
id: (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.id) || 'active-fd',
|
|
469
|
+
providerId: (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.providerId) || '',
|
|
470
|
+
name: activeFD.name,
|
|
471
|
+
accountNumber: (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.accountNumber) || '',
|
|
472
|
+
roi: `${activeFD.returns}% p.a.`,
|
|
473
|
+
tenure: activeFD.maturityDate || '-',
|
|
474
|
+
amount: Number(activeFD.invested) || 0,
|
|
475
|
+
maturityDate: activeFD.maturityDate || '-',
|
|
476
|
+
status: 'active',
|
|
477
|
+
creditRating: (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.creditRating) || 'NA',
|
|
478
|
+
companyName: activeFD.name,
|
|
479
|
+
fdRate: `${activeFD.returns}% p.a.`,
|
|
480
|
+
interestPayout: activeFD.interestPayout || '',
|
|
481
|
+
};
|
|
482
|
+
dispatch((0, fdListSelectedSlice_1.setFDListSelected)(fdListSelectedData));
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
catch (e) {
|
|
486
|
+
// Handle error silently
|
|
487
|
+
}
|
|
488
|
+
// Get current state from customer applications for workflow navigation
|
|
489
|
+
let currentState = null;
|
|
490
|
+
let transactionId = undefined;
|
|
491
|
+
try {
|
|
492
|
+
if (customerApplications && !isCustomerApplicationsEmpty()) {
|
|
493
|
+
// Normalize list
|
|
494
|
+
let applicationsData = [];
|
|
495
|
+
if (Array.isArray(customerApplications)) {
|
|
496
|
+
applicationsData = customerApplications;
|
|
497
|
+
}
|
|
498
|
+
else if (customerApplications.data && Array.isArray(customerApplications.data)) {
|
|
499
|
+
applicationsData = customerApplications.data;
|
|
500
|
+
}
|
|
501
|
+
else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
|
|
502
|
+
applicationsData = customerApplications.applications;
|
|
503
|
+
}
|
|
504
|
+
if (applicationsData.length > 0) {
|
|
505
|
+
// Prefer the active application
|
|
506
|
+
const appData = applicationsData.find((a) => {
|
|
507
|
+
const s = (a.wf_status || a.status || '').toString();
|
|
508
|
+
return s === 'Active';
|
|
509
|
+
}) || applicationsData[0];
|
|
510
|
+
currentState = appData.current_state;
|
|
511
|
+
// Extract transactionId from application data
|
|
512
|
+
transactionId = appData.transaction_id || appData.transactionId;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
// Handle error silently
|
|
518
|
+
}
|
|
519
|
+
// If current state is payment and transactionId is available, call payment reverse feed API
|
|
520
|
+
if (currentState === workflowConstants_1.WORKFLOW_STATES.PAYMENT && transactionId) {
|
|
521
|
+
try {
|
|
522
|
+
// Get user info and required IDs
|
|
523
|
+
const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
|
|
524
|
+
// Prepare payment reverse feed request
|
|
525
|
+
const paymentReverseFeedRequest = {
|
|
526
|
+
// Headers
|
|
527
|
+
providerId: providerId,
|
|
528
|
+
workflowInstanceId: workflowInstanceId,
|
|
529
|
+
userreferenceid: userInfo.id,
|
|
530
|
+
applicationid: applicationId,
|
|
531
|
+
entityid: entityId,
|
|
532
|
+
// Body
|
|
533
|
+
transactionId: transactionId,
|
|
534
|
+
};
|
|
535
|
+
const response = await paymentReverseFeed(paymentReverseFeedRequest).unwrap();
|
|
536
|
+
// Handle the response based on payment status
|
|
537
|
+
const paymentStatus = (((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.paymentStatus) || '').toLowerCase();
|
|
538
|
+
const statusParam = paymentStatus === 'success' ? 'success' : paymentStatus === 'failed' ? 'failed' : 'pending';
|
|
539
|
+
// Build fdData for display
|
|
540
|
+
const fdDataParam = activeFD ? {
|
|
541
|
+
companyName: activeFD.name,
|
|
542
|
+
amount: Number(activeFD.invested) || 0,
|
|
543
|
+
fdRate: `${activeFD.returns}% p.a.`,
|
|
544
|
+
tenure: activeFD.maturityDate ? `${activeFD.maturityDate}` : '-',
|
|
545
|
+
interestPayout: activeFD.interestPayout || 'Yearly',
|
|
546
|
+
} : undefined;
|
|
547
|
+
(0, helpers_1.navigate)('PaymentStatus', { status: statusParam, transactionId, fdData: fdDataParam });
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
// Handle error silently
|
|
552
|
+
// On error, navigate with pending status as fallback
|
|
553
|
+
const fdDataParam = activeFD ? {
|
|
554
|
+
companyName: activeFD.name,
|
|
555
|
+
amount: Number(activeFD.invested) || 0,
|
|
556
|
+
fdRate: `${activeFD.returns}% p.a.`,
|
|
557
|
+
tenure: activeFD.maturityDate ? `${activeFD.maturityDate}` : '-',
|
|
558
|
+
interestPayout: activeFD.interestPayout || 'Yearly',
|
|
559
|
+
} : undefined;
|
|
560
|
+
(0, helpers_1.navigate)('PaymentStatus', { status: 'pending', transactionId, fdData: fdDataParam });
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
// Use workflow navigation based on current state (non-payment states or no transactionId)
|
|
565
|
+
if (currentState && Object.values(workflowConstants_1.WORKFLOW_STATES).includes(currentState)) {
|
|
566
|
+
(0, workflowNavigator_1.handleWorkflowNavigation)({
|
|
567
|
+
workflowState: currentState,
|
|
568
|
+
investmentData: undefined,
|
|
569
|
+
customerData: undefined,
|
|
570
|
+
appData: undefined,
|
|
571
|
+
fdData: undefined,
|
|
572
|
+
completedApplications: [],
|
|
573
|
+
transactionId,
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
(0, helpers_1.navigate)('Employee');
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
// Derive identifiers for workflow termination from applications API
|
|
581
|
+
const terminateIdentifiers = react_1.default.useMemo(() => {
|
|
582
|
+
var _a, _b;
|
|
583
|
+
try {
|
|
584
|
+
if (!customerApplications || isCustomerApplicationsEmpty()) {
|
|
585
|
+
return {
|
|
586
|
+
applicationId: undefined,
|
|
587
|
+
workflowInstanceId: undefined,
|
|
588
|
+
entityId: undefined,
|
|
589
|
+
providerIdFromApp: undefined,
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
// Normalize list
|
|
593
|
+
let applicationsData = [];
|
|
594
|
+
if (Array.isArray(customerApplications)) {
|
|
595
|
+
applicationsData = customerApplications;
|
|
596
|
+
}
|
|
597
|
+
else if (customerApplications.data && Array.isArray(customerApplications.data)) {
|
|
598
|
+
applicationsData = customerApplications.data;
|
|
599
|
+
}
|
|
600
|
+
else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
|
|
601
|
+
applicationsData = customerApplications.applications;
|
|
602
|
+
}
|
|
603
|
+
if (applicationsData.length === 0) {
|
|
604
|
+
return {
|
|
605
|
+
applicationId: undefined,
|
|
606
|
+
workflowInstanceId: undefined,
|
|
607
|
+
entityId: undefined,
|
|
608
|
+
providerIdFromApp: undefined,
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
// Prefer a pending/in-progress one for termination, else first
|
|
612
|
+
const appForTerminate = applicationsData.find((a) => {
|
|
613
|
+
const s = (a.wf_status || a.status || '').toString().toLowerCase();
|
|
614
|
+
return s === 'pending' || s === 'in_progress' || s === 'in-progress';
|
|
615
|
+
}) || applicationsData[0];
|
|
616
|
+
const applicationId = appForTerminate.application_id || appForTerminate.applicationId || appForTerminate.id;
|
|
617
|
+
const workflowInstanceId = appForTerminate.workflow_instance_id || appForTerminate.workflowInstanceId || ((_a = appForTerminate.workflow) === null || _a === void 0 ? void 0 : _a.instanceId);
|
|
618
|
+
const entityId = appForTerminate.entity_id || appForTerminate.entityId || ((_b = appForTerminate.entity) === null || _b === void 0 ? void 0 : _b.id);
|
|
619
|
+
const providerIdFromApp = appForTerminate.provider_id || appForTerminate.providerId || appForTerminate.fd_provider_id || appForTerminate.fdProviderId;
|
|
620
|
+
return { applicationId, workflowInstanceId, entityId, providerIdFromApp };
|
|
621
|
+
}
|
|
622
|
+
catch (e) {
|
|
623
|
+
return {
|
|
624
|
+
applicationId: undefined,
|
|
625
|
+
workflowInstanceId: undefined,
|
|
626
|
+
entityId: undefined,
|
|
627
|
+
providerIdFromApp: undefined,
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
}, [customerApplications]);
|
|
631
|
+
// Derive Active FD card data from customer applications response
|
|
632
|
+
const activeFD = react_1.default.useMemo(() => {
|
|
633
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
634
|
+
try {
|
|
635
|
+
if (!customerApplications || isCustomerApplicationsEmpty()) {
|
|
636
|
+
return {
|
|
637
|
+
name: 'Shriram Finance Ltd',
|
|
638
|
+
invested: 0,
|
|
639
|
+
value: 0,
|
|
640
|
+
returns: 0,
|
|
641
|
+
maturityDate: '--',
|
|
642
|
+
interestPayout: 'Yearly'
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
// Normalize list
|
|
646
|
+
let applicationsData = [];
|
|
647
|
+
if (Array.isArray(customerApplications)) {
|
|
648
|
+
applicationsData = customerApplications;
|
|
649
|
+
}
|
|
650
|
+
else if (customerApplications.data && Array.isArray(customerApplications.data)) {
|
|
651
|
+
applicationsData = customerApplications.data;
|
|
652
|
+
}
|
|
653
|
+
else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
|
|
654
|
+
applicationsData = customerApplications.applications;
|
|
655
|
+
}
|
|
656
|
+
if (applicationsData.length === 0) {
|
|
657
|
+
return {
|
|
658
|
+
name: 'Shriram Finance Ltd',
|
|
659
|
+
invested: 0,
|
|
660
|
+
value: 0,
|
|
661
|
+
returns: 0,
|
|
662
|
+
maturityDate: '--',
|
|
663
|
+
interestPayout: 'Yearly'
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
// Pick an active application if available, otherwise first
|
|
667
|
+
const activeApp = applicationsData.find((a) => {
|
|
668
|
+
const s = (a.wf_status || a.status || '').toString();
|
|
669
|
+
return s === 'Active';
|
|
670
|
+
}) || applicationsData[0];
|
|
671
|
+
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);
|
|
672
|
+
const rate = Number((_e = (_d = activeApp.interest_rate) !== null && _d !== void 0 ? _d : activeApp.interestRate) !== null && _e !== void 0 ? _e : 0);
|
|
673
|
+
// Prefer a provided current value, then maturity amount
|
|
674
|
+
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);
|
|
675
|
+
const returns = rate || 0; // display interest rate as returns %
|
|
676
|
+
// Format maturity date to 'Mon YYYY'
|
|
677
|
+
const maturityDateStr = activeApp.maturity_date || activeApp.maturityDate || '';
|
|
678
|
+
let maturityDate = '--';
|
|
679
|
+
if (maturityDateStr) {
|
|
680
|
+
const d = new Date(maturityDateStr);
|
|
681
|
+
if (!isNaN(d.getTime())) {
|
|
682
|
+
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
683
|
+
maturityDate = `${months[d.getMonth()]} ${d.getFullYear()}`;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
// Get interest payout term from activeApp
|
|
687
|
+
const interestPayout = activeApp.interest_payout_term || activeApp.interestPayoutTerm || activeApp.payout_term || 'Yearly';
|
|
688
|
+
return {
|
|
689
|
+
name: activeApp.fd_provider_name || activeApp.providerName || 'Shriram Finance Ltd',
|
|
690
|
+
invested,
|
|
691
|
+
value,
|
|
692
|
+
returns,
|
|
693
|
+
maturityDate,
|
|
694
|
+
interestPayout,
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
catch (e) {
|
|
698
|
+
return {
|
|
699
|
+
name: 'Shriram Finance Ltd',
|
|
700
|
+
invested: 0,
|
|
701
|
+
value: 0,
|
|
702
|
+
returns: 0,
|
|
703
|
+
maturityDate: '--',
|
|
704
|
+
interestPayout: 'Yearly'
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
}, [customerApplications]);
|
|
708
|
+
// Helper function to check if there's an active FD
|
|
709
|
+
const hasActiveFD = react_1.default.useMemo(() => {
|
|
710
|
+
try {
|
|
711
|
+
if (!customerApplications || isCustomerApplicationsEmpty()) {
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
// Normalize list
|
|
715
|
+
let applicationsData = [];
|
|
716
|
+
if (Array.isArray(customerApplications)) {
|
|
717
|
+
applicationsData = customerApplications;
|
|
718
|
+
}
|
|
719
|
+
else if (customerApplications.data && Array.isArray(customerApplications.data)) {
|
|
720
|
+
applicationsData = customerApplications.data;
|
|
721
|
+
}
|
|
722
|
+
else if (customerApplications.applications && Array.isArray(customerApplications.applications)) {
|
|
723
|
+
applicationsData = customerApplications.applications;
|
|
724
|
+
}
|
|
725
|
+
if (applicationsData.length === 0) {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
// Check if any application has wf_status as "Active"
|
|
729
|
+
const hasActive = applicationsData.some((a) => {
|
|
730
|
+
const s = (a.wf_status || a.status || '').toString();
|
|
731
|
+
return s === 'Active';
|
|
732
|
+
});
|
|
733
|
+
return hasActive;
|
|
734
|
+
}
|
|
735
|
+
catch (e) {
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
}, [customerApplications]);
|
|
739
|
+
// Build FD options list from interest-rate API (show all FDs)
|
|
740
|
+
const fdList = react_1.default.useMemo(() => {
|
|
741
|
+
var _a, _b, _c, _d, _e, _f;
|
|
742
|
+
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)) {
|
|
743
|
+
const sdr = Array.isArray((_e = interestRates.data) === null || _e === void 0 ? void 0 : _e.sdrScheme) ? interestRates.data.sdrScheme : [];
|
|
744
|
+
const fdr = Array.isArray((_f = interestRates.data) === null || _f === void 0 ? void 0 : _f.fdrScheme) ? interestRates.data.fdrScheme : [];
|
|
745
|
+
const combined = [...sdr, ...fdr];
|
|
746
|
+
// Building FD options from rates
|
|
747
|
+
return combined.map((rate, index) => {
|
|
748
|
+
var _a, _b;
|
|
749
|
+
return ({
|
|
750
|
+
id: `${rate.providerId || 'provider'}-${rate.perdMonth || index}`,
|
|
751
|
+
providerId: rate.providerId || `provider-${index}`,
|
|
752
|
+
name: rate.providerName || '', // Use actual provider name from API
|
|
753
|
+
accountNumber: `FD${String(index + 1).padStart(9, '0')}`,
|
|
754
|
+
roi: `${Number((_b = (_a = rate.rate) !== null && _a !== void 0 ? _a : rate.interestRate) !== null && _b !== void 0 ? _b : 0).toFixed(2)}% p.a.`,
|
|
755
|
+
tenure: `${rate.perdMonth} Months`,
|
|
756
|
+
amount: 5000,
|
|
757
|
+
maturityDate: '2025-12-31',
|
|
758
|
+
status: 'active',
|
|
759
|
+
creditRating: rate.creditRating || 'AA+',
|
|
760
|
+
interestPayout: rate.interestPayout || rate.interest_payout_term || rate.payout_term || 'Yearly'
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
// If rates are not available yet, show empty list
|
|
765
|
+
return [];
|
|
766
|
+
}, [interestRates]);
|
|
767
|
+
// Get filtered FD list based on active tab
|
|
768
|
+
const filteredFDList = react_1.default.useMemo(() => {
|
|
769
|
+
if (!fdList || fdList.length === 0)
|
|
770
|
+
return [];
|
|
771
|
+
// Always create a new filtered array
|
|
772
|
+
const filtered = filterFDsByTenure([...fdList], activeTab); // spread to ensure new array
|
|
773
|
+
return filtered;
|
|
774
|
+
}, [fdList, activeTab]);
|
|
775
|
+
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];
|
|
776
|
+
if (!isAllDataReady) {
|
|
777
|
+
return (react_1.default.createElement(SafeAreaWrapper_1.default, { style: customStyles.container, includeTop: false, statusBarColor: "#000000", statusBarStyle: "light-content" },
|
|
778
|
+
react_1.default.createElement(react_native_1.View, { style: { flex: 1, alignItems: 'center', justifyContent: 'center' } },
|
|
779
|
+
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary }),
|
|
780
|
+
react_1.default.createElement(react_native_1.Text, { style: { marginTop: 12, color: colors.textSecondary } }, strings_1.FD_STRINGS.LOADING_FD_DATA))));
|
|
781
|
+
}
|
|
782
|
+
return (react_1.default.createElement(SafeAreaWrapper_1.default, { style: customStyles.container, includeTop: false, statusBarColor: "#0A1929", statusBarStyle: "light-content" },
|
|
783
|
+
react_1.default.createElement(react_native_1.View, { style: styles.customHeader },
|
|
784
|
+
react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.backButton, onPress: onGoBack, activeOpacity: 0.7 },
|
|
785
|
+
react_1.default.createElement(react_native_1.Image, { source: { uri: base64Images_1.base64Images.backArrow }, style: styles.backIcon, resizeMode: "contain" })),
|
|
786
|
+
react_1.default.createElement(react_native_1.View, { style: styles.headerContent },
|
|
787
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.headerTitle }, strings_1.FD_STRINGS.CORPORATE_FDS_TITLE),
|
|
788
|
+
react_1.default.createElement(react_native_1.View, { style: styles.poweredByContainer },
|
|
789
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.poweredByText }, "Powered by"),
|
|
790
|
+
react_1.default.createElement(react_native_1.Image, { source: { uri: base64Images_1.base64Images.simplfylogo }, style: styles.simplifyLogo, resizeMode: "contain" })))),
|
|
791
|
+
react_1.default.createElement(react_native_1.ScrollView, { style: styles.content },
|
|
792
|
+
hasActiveFD && (react_1.default.createElement(react_native_1.View, { style: styles.section },
|
|
793
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.sectionTitle }, strings_1.FD_STRINGS.ACTIVE_FDS_SECTION),
|
|
794
|
+
react_1.default.createElement(react_native_1.TouchableOpacity, { activeOpacity: 0.8, onPress: handlePendingFDContinue },
|
|
795
|
+
react_1.default.createElement(components_1.ActiveFDCard, { name: activeFD.name, invested: activeFD.invested, value: activeFD.value, returns: activeFD.returns, maturityDate: activeFD.maturityDate })))),
|
|
796
|
+
react_1.default.createElement(react_native_1.View, { style: styles.tabsContainer },
|
|
797
|
+
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: [
|
|
798
|
+
styles.tab,
|
|
799
|
+
activeTab === tab && styles.activeTab
|
|
800
|
+
], onPress: () => {
|
|
801
|
+
// Other tabs filter the data
|
|
802
|
+
setActiveTab(tab);
|
|
803
|
+
} },
|
|
804
|
+
react_1.default.createElement(react_native_1.Text, { style: [
|
|
805
|
+
styles.tabText,
|
|
806
|
+
activeTab === tab && styles.activeTabText
|
|
807
|
+
] }, tab)))))),
|
|
808
|
+
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, onPress: (fdId) => {
|
|
809
|
+
// Log the selection
|
|
810
|
+
onSelectFD === null || onSelectFD === void 0 ? void 0 : onSelectFD(fdId);
|
|
811
|
+
// Store the selected FD data locally
|
|
812
|
+
setSelectedFD(fd);
|
|
813
|
+
// Store the selected FD data in Redux for PayNow screen
|
|
814
|
+
const fdListSelectedData = {
|
|
815
|
+
id: fd.id,
|
|
816
|
+
providerId: fd.providerId,
|
|
817
|
+
name: fd.name,
|
|
818
|
+
accountNumber: fd.accountNumber,
|
|
819
|
+
roi: fd.roi,
|
|
820
|
+
tenure: fd.tenure,
|
|
821
|
+
amount: fd.amount,
|
|
822
|
+
maturityDate: fd.maturityDate,
|
|
823
|
+
status: fd.status,
|
|
824
|
+
creditRating: fd.creditRating,
|
|
825
|
+
// Additional fields for PayNow display
|
|
826
|
+
companyName: fd.name,
|
|
827
|
+
fdRate: fd.roi,
|
|
828
|
+
interestPayout: fd.interestPayout || 'Yearly', // Use FD's interest payout or default
|
|
829
|
+
};
|
|
830
|
+
dispatch((0, fdListSelectedSlice_1.setFDListSelected)(fdListSelectedData));
|
|
831
|
+
// Check if there's an active FD
|
|
832
|
+
if (hasActiveFD) {
|
|
833
|
+
// If there's an active FD, show bottom sheet
|
|
834
|
+
setShowPendingFDBottomSheet(true);
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
// If no active FD, redirect to FD calculator
|
|
838
|
+
onNavigateToFDCalculator === null || onNavigateToFDCalculator === void 0 ? void 0 : onNavigateToFDCalculator(fd);
|
|
839
|
+
}
|
|
840
|
+
}, customStyles: customStyles })))) : (react_1.default.createElement(react_native_1.View, { style: styles.noDataContainer },
|
|
841
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.noDataText }, isLoadingRates || isLoadingApplications ? strings_1.FD_STRINGS.LOADING_FD_DATA :
|
|
842
|
+
interestRatesError || customerApplicationsError ? strings_1.FD_STRINGS.FAILED_TO_LOAD_FD_DATA :
|
|
843
|
+
fdList.length === 0 ? (!isCustomerApplicationsEmpty() ? strings_1.FD_STRINGS.NO_CUSTOMER_FDS_FOUND : strings_1.FD_STRINGS.NO_FD_OPTIONS_AVAILABLE) :
|
|
844
|
+
`${strings_1.FD_STRINGS.NO_FDS_FOUND_FOR_TENURE} "${activeTab}" tenure range.`))))),
|
|
845
|
+
react_1.default.createElement(components_1.PendingFDBottomSheet, { visible: showPendingFDBottomSheet, onClose: () => setShowPendingFDBottomSheet(false), pendingFDData: activeFD, isBookingNewLoading: isTerminatingWorkflow, onContinue: async () => {
|
|
846
|
+
setShowPendingFDBottomSheet(false);
|
|
847
|
+
await handlePendingFDContinue();
|
|
848
|
+
}, onBookNew: async () => {
|
|
849
|
+
try {
|
|
850
|
+
// Pull identifiers from application API response, with last-resort placeholders
|
|
851
|
+
const requestParams = {
|
|
852
|
+
providerId: inferredProviderId,
|
|
853
|
+
workflowInstanceId: terminateIdentifiers.workflowInstanceId || 'wf-instance-unknown',
|
|
854
|
+
entityId: terminateIdentifiers.entityId || 'entity-unknown',
|
|
855
|
+
applicationId: terminateIdentifiers.applicationId || 'application-unknown',
|
|
856
|
+
};
|
|
857
|
+
// Call workflow terminate API
|
|
858
|
+
await terminateWorkflow(requestParams);
|
|
859
|
+
// Dismiss bottom sheet
|
|
860
|
+
setShowPendingFDBottomSheet(false);
|
|
861
|
+
// Navigate to FD calculator
|
|
862
|
+
onNavigateToFDCalculator === null || onNavigateToFDCalculator === void 0 ? void 0 : onNavigateToFDCalculator();
|
|
863
|
+
}
|
|
864
|
+
catch (error) {
|
|
865
|
+
// Handle error silently
|
|
866
|
+
// Still dismiss bottom sheet and navigate even if API fails
|
|
867
|
+
// setShowPendingFDBottomSheet(false);
|
|
868
|
+
// onNavigateToFDCalculator?.();
|
|
869
|
+
// Show error alert
|
|
870
|
+
react_native_1.Alert.alert('Warning', 'Failed to terminate existing workflow, but continuing with new FD booking.', [{ text: 'OK' }]);
|
|
871
|
+
}
|
|
872
|
+
} })));
|
|
873
|
+
};
|
|
874
|
+
const createStyles = (colors, typography, spacing, themeName) => react_native_1.StyleSheet.create({
|
|
875
|
+
container: {
|
|
876
|
+
flex: 1,
|
|
877
|
+
backgroundColor: colors.surface,
|
|
878
|
+
},
|
|
879
|
+
customHeader: {
|
|
880
|
+
backgroundColor: '#0A1929',
|
|
881
|
+
paddingTop: react_native_1.Platform.OS === 'ios' ? 50 : 20,
|
|
882
|
+
paddingBottom: spacing.md,
|
|
883
|
+
paddingHorizontal: spacing.lg,
|
|
884
|
+
flexDirection: 'row',
|
|
885
|
+
alignItems: 'center',
|
|
886
|
+
},
|
|
887
|
+
backButton: {
|
|
888
|
+
width: 40,
|
|
889
|
+
height: 40,
|
|
890
|
+
alignItems: 'center',
|
|
891
|
+
justifyContent: 'center',
|
|
892
|
+
},
|
|
893
|
+
backIcon: {
|
|
894
|
+
width: 24,
|
|
895
|
+
height: 24,
|
|
896
|
+
tintColor: '#FFFFFF',
|
|
897
|
+
},
|
|
898
|
+
headerContent: {
|
|
899
|
+
flex: 1,
|
|
900
|
+
alignItems: 'flex-start',
|
|
901
|
+
marginRight: 40, // Balance the back button width
|
|
902
|
+
},
|
|
903
|
+
headerTitle: Object.assign(Object.assign({}, typography.styles.h3), { color: '#FFFFFF', marginBottom: spacing.xs }),
|
|
904
|
+
poweredByContainer: {
|
|
905
|
+
flexDirection: 'row',
|
|
906
|
+
alignItems: 'center',
|
|
907
|
+
},
|
|
908
|
+
poweredByText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: '#FFFFFF', opacity: 0.7, marginRight: 0 }),
|
|
909
|
+
simplifyLogo: {
|
|
910
|
+
width: 70,
|
|
911
|
+
height: 20,
|
|
912
|
+
},
|
|
913
|
+
content: {
|
|
914
|
+
flex: 1,
|
|
915
|
+
},
|
|
916
|
+
section: {
|
|
917
|
+
paddingHorizontal: spacing.lg,
|
|
918
|
+
paddingTop: spacing.xl,
|
|
919
|
+
},
|
|
920
|
+
sectionTitle: Object.assign(Object.assign({}, typography.styles.h3), { color: colors.text, marginBottom: spacing.lg }),
|
|
921
|
+
tabsContainer: {
|
|
922
|
+
paddingHorizontal: spacing.lg,
|
|
923
|
+
paddingTop: spacing.xxl,
|
|
924
|
+
paddingBottom: spacing.lg,
|
|
925
|
+
},
|
|
926
|
+
tabsRow: {
|
|
927
|
+
flexDirection: 'row',
|
|
928
|
+
justifyContent: 'space-around',
|
|
929
|
+
alignItems: 'center',
|
|
930
|
+
},
|
|
931
|
+
tab: {
|
|
932
|
+
flex: 1,
|
|
933
|
+
paddingHorizontal: spacing.sm,
|
|
934
|
+
paddingVertical: spacing.md,
|
|
935
|
+
marginHorizontal: 2,
|
|
936
|
+
borderBottomWidth: 3,
|
|
937
|
+
borderBottomColor: 'white',
|
|
938
|
+
borderBottomLeftRadius: 8,
|
|
939
|
+
borderBottomRightRadius: 8,
|
|
940
|
+
backgroundColor: 'transparent',
|
|
941
|
+
},
|
|
942
|
+
activeTab: {
|
|
943
|
+
borderBottomColor: colors.tabSelected,
|
|
944
|
+
backgroundColor: themeName === 'dark' ? '#000000' : '#fff',
|
|
945
|
+
borderBottomLeftRadius: 12,
|
|
946
|
+
borderBottomRightRadius: 12,
|
|
947
|
+
},
|
|
948
|
+
tabText: Object.assign(Object.assign({}, typography.styles.text12Medium), { color: colors.textSecondary, textAlign: 'center' }),
|
|
949
|
+
activeTabText: {
|
|
950
|
+
color: colors.tabSelected,
|
|
951
|
+
fontWeight: '600',
|
|
952
|
+
textAlign: 'center',
|
|
953
|
+
},
|
|
954
|
+
filterStatusContainer: {
|
|
955
|
+
paddingHorizontal: spacing.lg,
|
|
956
|
+
paddingVertical: spacing.sm,
|
|
957
|
+
backgroundColor: colors.background + '80', // 50% opacity
|
|
958
|
+
borderBottomWidth: 1,
|
|
959
|
+
borderBottomColor: colors.border + '20', // 20% opacity
|
|
960
|
+
},
|
|
961
|
+
filterStatusText: Object.assign(Object.assign({}, typography.styles.text12Regular), { color: colors.textSecondary, textAlign: 'center', fontStyle: 'italic' }),
|
|
962
|
+
fdOptionsContainer: {
|
|
963
|
+
paddingHorizontal: spacing.lg,
|
|
964
|
+
paddingBottom: spacing.xl,
|
|
965
|
+
},
|
|
966
|
+
// API Status Styles
|
|
967
|
+
apiStatusContainer: {
|
|
968
|
+
flexDirection: 'row',
|
|
969
|
+
justifyContent: 'space-between',
|
|
970
|
+
alignItems: 'center',
|
|
971
|
+
paddingHorizontal: spacing.lg,
|
|
972
|
+
paddingVertical: spacing.sm,
|
|
973
|
+
backgroundColor: colors.background,
|
|
974
|
+
borderBottomWidth: 1,
|
|
975
|
+
borderBottomColor: colors.border + '20', // 20% opacity
|
|
976
|
+
},
|
|
977
|
+
apiStatusIndicator: {
|
|
978
|
+
flexDirection: 'row',
|
|
979
|
+
alignItems: 'center',
|
|
980
|
+
flex: 1,
|
|
981
|
+
},
|
|
982
|
+
apiStatusText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.textSecondary, marginLeft: spacing.xs }),
|
|
983
|
+
apiSuccessText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.success, marginLeft: spacing.xs }),
|
|
984
|
+
apiErrorText: Object.assign(Object.assign({}, typography.styles.text10Regular), { color: colors.error, marginLeft: spacing.xs }),
|
|
985
|
+
refreshButton: {
|
|
986
|
+
paddingHorizontal: spacing.sm,
|
|
987
|
+
paddingVertical: spacing.xs,
|
|
988
|
+
backgroundColor: colors.primary + '20', // 20% opacity
|
|
989
|
+
borderRadius: spacing.xs,
|
|
990
|
+
},
|
|
991
|
+
refreshButtonText: Object.assign(Object.assign({}, typography.styles.text10Medium), { color: colors.primary }),
|
|
992
|
+
noDataContainer: {
|
|
993
|
+
padding: spacing.lg,
|
|
994
|
+
alignItems: 'center',
|
|
995
|
+
justifyContent: 'center',
|
|
996
|
+
minHeight: 200,
|
|
997
|
+
},
|
|
998
|
+
noDataText: Object.assign(Object.assign({}, typography.styles.text14Regular), { color: colors.textSecondary, textAlign: 'center', lineHeight: 20, marginBottom: spacing.md }),
|
|
999
|
+
showAllButton: {
|
|
1000
|
+
backgroundColor: colors.primary,
|
|
1001
|
+
paddingHorizontal: spacing.lg,
|
|
1002
|
+
paddingVertical: spacing.sm,
|
|
1003
|
+
borderRadius: spacing.sm,
|
|
1004
|
+
marginTop: spacing.md,
|
|
1005
|
+
},
|
|
1006
|
+
showAllButtonText: Object.assign(Object.assign({}, typography.styles.text14Medium), { color: '#ffffff', textAlign: 'center' }),
|
|
1007
|
+
});
|
|
1008
|
+
exports.default = FDList;
|