@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,596 @@
|
|
|
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 Ionicons_1 = __importDefault(require("react-native-vector-icons/Ionicons"));
|
|
42
|
+
const SafeAreaWrapper_1 = __importDefault(require("../components/SafeAreaWrapper"));
|
|
43
|
+
const components_1 = require("../components");
|
|
44
|
+
const ActionButton_1 = __importDefault(require("../components/ActionButton"));
|
|
45
|
+
const TextFieldWithLabel_1 = __importDefault(require("../components/TextFieldWithLabel"));
|
|
46
|
+
const ThemeContext_1 = require("../theme/ThemeContext");
|
|
47
|
+
const MasterDataProvider_1 = require("../providers/MasterDataProvider");
|
|
48
|
+
const appDataConfig_1 = require("../config/appDataConfig");
|
|
49
|
+
const fdApi_1 = require("../api/fdApi");
|
|
50
|
+
const workflowApi_1 = require("../api/workflowApi");
|
|
51
|
+
const customerApi_1 = require("../api/customerApi");
|
|
52
|
+
const store_1 = require("../store");
|
|
53
|
+
const helpers_1 = require("../navigation/helpers");
|
|
54
|
+
const native_1 = require("@react-navigation/native");
|
|
55
|
+
const bank_1 = require("../constants/strings/bank");
|
|
56
|
+
const BankDetail = ({ onGoBack, onContinue, onAddAccount, initialData }) => {
|
|
57
|
+
const colors = (0, ThemeContext_1.useColors)();
|
|
58
|
+
const typography = (0, ThemeContext_1.useTypography)();
|
|
59
|
+
const { themeName } = (0, ThemeContext_1.useTheme)();
|
|
60
|
+
const styles = createStyles(colors, typography, themeName);
|
|
61
|
+
const { masterData } = (0, MasterDataProvider_1.useMasterData)();
|
|
62
|
+
// Normalize helper for arrays or CSV strings
|
|
63
|
+
const normalizeOptions = (raw, fallback) => {
|
|
64
|
+
if (Array.isArray(raw))
|
|
65
|
+
return raw.map((v) => String(v)).filter(Boolean);
|
|
66
|
+
if (typeof raw === 'string' && raw.trim().length)
|
|
67
|
+
return raw.split(',').map((v) => v.trim()).filter(Boolean);
|
|
68
|
+
return fallback;
|
|
69
|
+
};
|
|
70
|
+
// Prefer nested data if present, memoized to avoid re-creation on each render
|
|
71
|
+
const mdRoot = react_1.default.useMemo(() => {
|
|
72
|
+
return (masterData === null || masterData === void 0 ? void 0 : masterData.data) || masterData || {};
|
|
73
|
+
}, [masterData]);
|
|
74
|
+
// Get account type options from master data, memoized
|
|
75
|
+
const accountTypeOptions = react_1.default.useMemo(() => {
|
|
76
|
+
const raw = (mdRoot === null || mdRoot === void 0 ? void 0 : mdRoot.bankAccountType) || (mdRoot === null || mdRoot === void 0 ? void 0 : mdRoot.accountTypeOptions) || (mdRoot === null || mdRoot === void 0 ? void 0 : mdRoot.accountTypes);
|
|
77
|
+
return normalizeOptions(raw, []);
|
|
78
|
+
}, [mdRoot]);
|
|
79
|
+
// Get app data from global state
|
|
80
|
+
const appData = (0, appDataConfig_1.getAppData)();
|
|
81
|
+
const defaultProviderId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.providerId; }); // Default Shriram provider ID
|
|
82
|
+
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; });
|
|
83
|
+
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; });
|
|
84
|
+
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; });
|
|
85
|
+
const customerId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.customerId; });
|
|
86
|
+
// FD Bank Details API (mutation for on-demand calls)
|
|
87
|
+
const [fdBankDetails, { data: fdBankDetailsResponse, error: fdBankDetailsError, isLoading: isLoadingFdBankDetails, }] = (0, fdApi_1.useFdBankDetailsSearchMutation)();
|
|
88
|
+
// FD Bank Account API
|
|
89
|
+
const [fdBankAccount, { data: fdBankAccountResponse, error: fdBankAccountError, isLoading: isLoadingFdBankAccount, }] = (0, fdApi_1.useFdBankAccountMutation)();
|
|
90
|
+
const [previousState] = (0, workflowApi_1.usePreviousStateMutation)();
|
|
91
|
+
// Customer Application Details API (called on focus)
|
|
92
|
+
const [getCustomerApplicationDetails, { data: customerApplicationDetailsResponse, error: customerApplicationDetailsError, isLoading: isLoadingCustomerApplicationDetails, }] = (0, customerApi_1.useGetCustomerApplicationDetailsMutation)();
|
|
93
|
+
// Helper function to get account type display name
|
|
94
|
+
const getAccountTypeDisplay = (code) => {
|
|
95
|
+
if (!code || code.trim() === '')
|
|
96
|
+
return '';
|
|
97
|
+
switch (code) {
|
|
98
|
+
case 'SB': return 'Saving A/c';
|
|
99
|
+
case 'CA': return 'Current A/c';
|
|
100
|
+
default: return 'Saving A/c';
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
// Loading state for back navigation
|
|
104
|
+
const [isGoingBack, setIsGoingBack] = (0, react_1.useState)(false);
|
|
105
|
+
const [form, setForm] = (0, react_1.useState)({
|
|
106
|
+
accountType: (initialData === null || initialData === void 0 ? void 0 : initialData.accountType) || getAccountTypeDisplay((appData === null || appData === void 0 ? void 0 : appData.typeOfAccount) || ''),
|
|
107
|
+
accountNumber: (initialData === null || initialData === void 0 ? void 0 : initialData.accountNumber) || (appData === null || appData === void 0 ? void 0 : appData.accountNo) || '',
|
|
108
|
+
ifscCode: (initialData === null || initialData === void 0 ? void 0 : initialData.ifscCode) || (appData === null || appData === void 0 ? void 0 : appData.ifsc) || '',
|
|
109
|
+
bankName: (initialData === null || initialData === void 0 ? void 0 : initialData.bankName) || (appData === null || appData === void 0 ? void 0 : appData.nameOfBank) || '',
|
|
110
|
+
branchName: (initialData === null || initialData === void 0 ? void 0 : initialData.branchName) || '',
|
|
111
|
+
});
|
|
112
|
+
// Ref to track last IFSC code that was used to call API (to prevent duplicate calls)
|
|
113
|
+
const lastFetchedIfscRef = (0, react_1.useRef)('');
|
|
114
|
+
// Keep account type valid if options change after load
|
|
115
|
+
react_1.default.useEffect(() => {
|
|
116
|
+
if (form.accountType && !accountTypeOptions.includes(form.accountType)) {
|
|
117
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { accountType: '' })));
|
|
118
|
+
}
|
|
119
|
+
}, [accountTypeOptions, form.accountType]);
|
|
120
|
+
// Call customer application details API when screen comes into focus
|
|
121
|
+
(0, native_1.useFocusEffect)(react_1.default.useCallback(() => {
|
|
122
|
+
let isActive = true;
|
|
123
|
+
(async () => {
|
|
124
|
+
var _a;
|
|
125
|
+
try {
|
|
126
|
+
// Only call API if we have the required IDs
|
|
127
|
+
if (!applicationId || !customerId) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
|
|
131
|
+
const req = {
|
|
132
|
+
providerId: defaultProviderId,
|
|
133
|
+
workflowInstanceId,
|
|
134
|
+
userreferenceid: userInfo.userReferenceId,
|
|
135
|
+
applicationid: applicationId,
|
|
136
|
+
entityid: entityId,
|
|
137
|
+
// Body params
|
|
138
|
+
applicationId: applicationId,
|
|
139
|
+
customerId: customerId,
|
|
140
|
+
};
|
|
141
|
+
const res = await getCustomerApplicationDetails(req).unwrap();
|
|
142
|
+
if (!isActive)
|
|
143
|
+
return;
|
|
144
|
+
// Set form data from bank_account object in API response if available
|
|
145
|
+
if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.bank_account) {
|
|
146
|
+
const bankData = res.data.bank_account;
|
|
147
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { accountType: bankData.account_type || prev.accountType, accountNumber: bankData.account_no || prev.accountNumber, ifscCode: bankData.ifsc_code || prev.ifscCode, bankName: bankData.bank_name || prev.bankName, branchName: bankData.bank_branch || prev.branchName })));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
if (!isActive)
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
})();
|
|
155
|
+
return () => { isActive = false; };
|
|
156
|
+
}, [applicationId, customerId, defaultProviderId, workflowInstanceId, entityId, getCustomerApplicationDetails]));
|
|
157
|
+
const [openMenus, setOpenMenus] = (0, react_1.useState)({
|
|
158
|
+
accountType: false,
|
|
159
|
+
branchName: false,
|
|
160
|
+
});
|
|
161
|
+
const [fieldErrors, setFieldErrors] = (0, react_1.useState)({});
|
|
162
|
+
// Validation functions
|
|
163
|
+
const validateAccountNumber = (accountNumber) => {
|
|
164
|
+
if (!accountNumber || accountNumber.trim().length === 0) {
|
|
165
|
+
return 'Account number is required';
|
|
166
|
+
}
|
|
167
|
+
if (accountNumber.length < 9 || accountNumber.length > 18) {
|
|
168
|
+
return 'Account number must be between 9 and 18 digits';
|
|
169
|
+
}
|
|
170
|
+
if (!/^\d+$/.test(accountNumber)) {
|
|
171
|
+
return 'Account number must contain only digits';
|
|
172
|
+
}
|
|
173
|
+
return '';
|
|
174
|
+
};
|
|
175
|
+
const validateIFSC = (ifsc) => {
|
|
176
|
+
if (!ifsc || ifsc.trim().length === 0) {
|
|
177
|
+
return 'IFSC code is required';
|
|
178
|
+
}
|
|
179
|
+
const ifscRegex = /^[A-Z]{4}0[A-Z0-9]{6}$/;
|
|
180
|
+
if (!ifscRegex.test(ifsc.toUpperCase())) {
|
|
181
|
+
return 'Please enter a valid IFSC code (e.g., SBIN0001234)';
|
|
182
|
+
}
|
|
183
|
+
return '';
|
|
184
|
+
};
|
|
185
|
+
const validateBankName = (bankName) => {
|
|
186
|
+
if (!bankName || bankName.trim().length === 0) {
|
|
187
|
+
return 'Bank name is required';
|
|
188
|
+
}
|
|
189
|
+
if (bankName.trim().length < 2) {
|
|
190
|
+
return 'Bank name must be at least 2 characters';
|
|
191
|
+
}
|
|
192
|
+
return '';
|
|
193
|
+
};
|
|
194
|
+
const validateBranchName = (branchName) => {
|
|
195
|
+
if (!branchName || branchName.trim().length === 0) {
|
|
196
|
+
return 'Branch name is required';
|
|
197
|
+
}
|
|
198
|
+
if (branchName.trim().length < 2) {
|
|
199
|
+
return 'Branch name must be at least 2 characters';
|
|
200
|
+
}
|
|
201
|
+
return '';
|
|
202
|
+
};
|
|
203
|
+
const validateField = (field, value) => {
|
|
204
|
+
switch (field) {
|
|
205
|
+
case 'accountNumber':
|
|
206
|
+
return validateAccountNumber(value);
|
|
207
|
+
case 'ifscCode':
|
|
208
|
+
return validateIFSC(value);
|
|
209
|
+
case 'bankName':
|
|
210
|
+
return validateBankName(value);
|
|
211
|
+
case 'branchName':
|
|
212
|
+
return validateBranchName(value);
|
|
213
|
+
default:
|
|
214
|
+
return '';
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
// Function to fetch bank details when IFSC code is entered
|
|
218
|
+
const fetchBankDetails = (0, react_1.useCallback)(async (ifscCode) => {
|
|
219
|
+
if (!ifscCode || ifscCode.trim().length === 0) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const upperIfsc = ifscCode.trim().toUpperCase();
|
|
223
|
+
// Validate IFSC - validateIFSC returns empty string if valid, error message if invalid
|
|
224
|
+
const validationError = validateIFSC(upperIfsc);
|
|
225
|
+
if (validationError) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
const fdBankDetailsRequest = {
|
|
230
|
+
providerId: defaultProviderId,
|
|
231
|
+
ifscCode: upperIfsc,
|
|
232
|
+
};
|
|
233
|
+
// Call the API
|
|
234
|
+
const response = await fdBankDetails(fdBankDetailsRequest).unwrap();
|
|
235
|
+
// Handle the actual API response structure (same as FindIFSC)
|
|
236
|
+
let bankName = '';
|
|
237
|
+
let branchName = '';
|
|
238
|
+
let ifscCodeFromApi = '';
|
|
239
|
+
if (response && response.data && Array.isArray(response.data) && response.data.length > 0) {
|
|
240
|
+
const bankData = response.data[0];
|
|
241
|
+
bankName = bankData.BnkDescr || '';
|
|
242
|
+
branchName = bankData.BankBranch || '';
|
|
243
|
+
ifscCodeFromApi = bankData.IfscCode || '';
|
|
244
|
+
}
|
|
245
|
+
else if (response && response.bankName && response.branchName && response.ifscCode) {
|
|
246
|
+
// Fallback for old response format
|
|
247
|
+
bankName = response.bankName;
|
|
248
|
+
branchName = response.branchName;
|
|
249
|
+
ifscCodeFromApi = response.ifscCode;
|
|
250
|
+
}
|
|
251
|
+
// Update form with bank details from API response
|
|
252
|
+
if (bankName || branchName || ifscCodeFromApi) {
|
|
253
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { bankName: bankName || prev.bankName, branchName: branchName || prev.branchName, ifscCode: ifscCodeFromApi || prev.ifscCode })));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
// Silently handle error - don't show alert, just don't update fields
|
|
258
|
+
}
|
|
259
|
+
}, [defaultProviderId, fdBankDetails]);
|
|
260
|
+
const updateField = (field, value) => {
|
|
261
|
+
var _a;
|
|
262
|
+
// Clean input based on field type
|
|
263
|
+
let cleanedValue = value;
|
|
264
|
+
if (field === 'accountNumber') {
|
|
265
|
+
cleanedValue = value.replace(/[^0-9]/g, '').substring(0, 18);
|
|
266
|
+
}
|
|
267
|
+
else if (field === 'ifscCode') {
|
|
268
|
+
cleanedValue = value.replace(/[^a-zA-Z0-9]/g, '').toUpperCase().substring(0, 11);
|
|
269
|
+
}
|
|
270
|
+
// Validate field and set error
|
|
271
|
+
const error = validateField(field, cleanedValue);
|
|
272
|
+
// Handle IFSC code changes - clear bank and branch names when IFSC is removed, invalid, or changed
|
|
273
|
+
if (field === 'ifscCode') {
|
|
274
|
+
const upperIfsc = cleanedValue.trim().toUpperCase();
|
|
275
|
+
const validationError = validateIFSC(upperIfsc);
|
|
276
|
+
const isIfscValid = cleanedValue.length === 11 && validationError === '';
|
|
277
|
+
const previousIfsc = ((_a = form.ifscCode) === null || _a === void 0 ? void 0 : _a.trim().toUpperCase()) || '';
|
|
278
|
+
const isIfscChanged = cleanedValue.trim().toUpperCase() !== previousIfsc;
|
|
279
|
+
// Determine if we should clear bank and branch names
|
|
280
|
+
const shouldClearBankBranch = cleanedValue.length === 0 || // IFSC is removed (empty)
|
|
281
|
+
cleanedValue.length < 11 || // IFSC is incomplete
|
|
282
|
+
(cleanedValue.length === 11 && validationError !== '') || // IFSC is invalid (11 chars but fails validation)
|
|
283
|
+
(isIfscChanged && previousIfsc.length === 11 && previousIfsc === lastFetchedIfscRef.current); // IFSC changed from a previously valid one
|
|
284
|
+
if (shouldClearBankBranch) {
|
|
285
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { [field]: cleanedValue, bankName: '', branchName: '' })));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { [field]: cleanedValue })));
|
|
289
|
+
}
|
|
290
|
+
setFieldErrors(prev => (Object.assign(Object.assign({}, prev), { [field]: error })));
|
|
291
|
+
// Call API immediately when IFSC code reaches 11 characters and is valid
|
|
292
|
+
if (isIfscValid && upperIfsc !== lastFetchedIfscRef.current) {
|
|
293
|
+
lastFetchedIfscRef.current = upperIfsc;
|
|
294
|
+
// Call API immediately - don't await, let it run in background
|
|
295
|
+
fetchBankDetails(upperIfsc).catch((err) => {
|
|
296
|
+
// Reset ref on error so user can retry
|
|
297
|
+
if (lastFetchedIfscRef.current === upperIfsc) {
|
|
298
|
+
lastFetchedIfscRef.current = '';
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
else if (cleanedValue.length < 11) {
|
|
303
|
+
// Reset ref when IFSC code is less than 11 characters
|
|
304
|
+
lastFetchedIfscRef.current = '';
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
// For other fields, just update normally
|
|
309
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { [field]: cleanedValue })));
|
|
310
|
+
setFieldErrors(prev => (Object.assign(Object.assign({}, prev), { [field]: error })));
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
// Call API when IFSC code becomes valid (11 characters and passes validation)
|
|
314
|
+
// Also clear bank and branch names when IFSC is invalid or removed
|
|
315
|
+
(0, react_1.useEffect)(() => {
|
|
316
|
+
if (form.ifscCode && form.ifscCode.length === 11) {
|
|
317
|
+
const upperIfsc = form.ifscCode.trim().toUpperCase();
|
|
318
|
+
const validationError = validateIFSC(upperIfsc);
|
|
319
|
+
// Only call API if IFSC is valid and different from last fetched IFSC
|
|
320
|
+
if (!validationError && upperIfsc !== lastFetchedIfscRef.current) {
|
|
321
|
+
lastFetchedIfscRef.current = upperIfsc;
|
|
322
|
+
fetchBankDetails(upperIfsc);
|
|
323
|
+
}
|
|
324
|
+
else if (validationError) {
|
|
325
|
+
// IFSC is invalid - clear bank and branch names
|
|
326
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { bankName: '', branchName: '' })));
|
|
327
|
+
lastFetchedIfscRef.current = '';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
// IFSC code is removed or less than 11 characters - clear bank and branch names
|
|
332
|
+
if (form.bankName || form.branchName) {
|
|
333
|
+
setForm(prev => (Object.assign(Object.assign({}, prev), { bankName: '', branchName: '' })));
|
|
334
|
+
}
|
|
335
|
+
// Reset ref when IFSC code is not 11 characters
|
|
336
|
+
lastFetchedIfscRef.current = '';
|
|
337
|
+
}
|
|
338
|
+
}, [form.ifscCode, fetchBankDetails]);
|
|
339
|
+
const toggleMenu = (key) => {
|
|
340
|
+
setOpenMenus(prev => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
|
|
341
|
+
};
|
|
342
|
+
const closeAllMenus = () => {
|
|
343
|
+
setOpenMenus({
|
|
344
|
+
accountType: false,
|
|
345
|
+
branchName: false,
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
// Render error message for a field
|
|
349
|
+
const renderFieldError = (field) => {
|
|
350
|
+
const error = fieldErrors[field];
|
|
351
|
+
if (!error)
|
|
352
|
+
return null;
|
|
353
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.errorContainer },
|
|
354
|
+
react_native_1.Platform.OS === 'android' && (react_1.default.createElement(Ionicons_1.default, { name: "warning", size: 16, color: colors.error || '#FF0000', style: styles.errorIcon })),
|
|
355
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.errorText }, error)));
|
|
356
|
+
};
|
|
357
|
+
// Mask account number to show first 4 digits and rest as X
|
|
358
|
+
const formatAccountNumber = (accountNumber) => {
|
|
359
|
+
if (!accountNumber)
|
|
360
|
+
return '';
|
|
361
|
+
if (accountNumber.length <= 4)
|
|
362
|
+
return accountNumber;
|
|
363
|
+
const firstFour = accountNumber.substring(0, 4);
|
|
364
|
+
const masked = 'X'.repeat(Math.min(accountNumber.length - 4, 12));
|
|
365
|
+
return `${firstFour} ${masked}`;
|
|
366
|
+
};
|
|
367
|
+
// Validate all form fields (for submission)
|
|
368
|
+
const validateForm = () => {
|
|
369
|
+
const errors = {};
|
|
370
|
+
// Validate account type
|
|
371
|
+
if (!form.accountType || form.accountType.trim() === '') {
|
|
372
|
+
errors.accountType = 'Account type is required';
|
|
373
|
+
}
|
|
374
|
+
// Validate account number
|
|
375
|
+
const accountNumberError = validateAccountNumber(form.accountNumber);
|
|
376
|
+
if (accountNumberError)
|
|
377
|
+
errors.accountNumber = accountNumberError;
|
|
378
|
+
// Validate IFSC code
|
|
379
|
+
const ifscError = validateIFSC(form.ifscCode);
|
|
380
|
+
if (ifscError)
|
|
381
|
+
errors.ifscCode = ifscError;
|
|
382
|
+
// Validate bank name
|
|
383
|
+
const bankNameError = validateBankName(form.bankName);
|
|
384
|
+
if (bankNameError)
|
|
385
|
+
errors.bankName = bankNameError;
|
|
386
|
+
// Validate branch name
|
|
387
|
+
const branchNameError = validateBranchName(form.branchName);
|
|
388
|
+
if (branchNameError)
|
|
389
|
+
errors.branchName = branchNameError;
|
|
390
|
+
setFieldErrors(errors);
|
|
391
|
+
return Object.keys(errors).length === 0;
|
|
392
|
+
};
|
|
393
|
+
// Check if form is valid without setting errors (for button state)
|
|
394
|
+
const isFormValid = () => {
|
|
395
|
+
// Check account type
|
|
396
|
+
if (!form.accountType || form.accountType.trim() === '') {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
// Check account number
|
|
400
|
+
if (!form.accountNumber || form.accountNumber.trim() === '') {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
if (form.accountNumber.length < 9 || form.accountNumber.length > 18) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
if (!/^\d+$/.test(form.accountNumber)) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
// Check IFSC code
|
|
410
|
+
if (!form.ifscCode || form.ifscCode.trim() === '') {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
const ifscRegex = /^[A-Z]{4}0[A-Z0-9]{6}$/;
|
|
414
|
+
if (!ifscRegex.test(form.ifscCode.toUpperCase())) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
// Check bank name
|
|
418
|
+
if (!form.bankName || form.bankName.trim() === '') {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
if (form.bankName.trim().length < 2) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
// Check branch name
|
|
425
|
+
if (!form.branchName || form.branchName.trim() === '') {
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
if (form.branchName.trim().length < 2) {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
return true;
|
|
432
|
+
};
|
|
433
|
+
const renderDropdown = (label, value, field, options, menuKey, placeholder = 'Select option', editable = true) => (react_1.default.createElement(react_native_1.View, null,
|
|
434
|
+
react_1.default.createElement(TextFieldWithLabel_1.default, { label: label, value: value, onChangeText: (text) => updateField(field, text), variant: "dropdown", options: options, isDropdownOpen: openMenus[menuKey], onDropdownToggle: () => toggleMenu(menuKey), onDropdownSelect: (option) => {
|
|
435
|
+
updateField(field, option);
|
|
436
|
+
setOpenMenus(prev => (Object.assign(Object.assign({}, prev), { [menuKey]: false })));
|
|
437
|
+
}, placeholder: placeholder, editable: editable }),
|
|
438
|
+
openMenus[menuKey] && editable && (react_1.default.createElement(react_native_1.View, { style: styles.inlineMenu }, options.map((option) => (react_1.default.createElement(react_native_1.TouchableOpacity, { key: option, style: styles.modalOption, onPress: () => {
|
|
439
|
+
updateField(field, option);
|
|
440
|
+
setOpenMenus(prev => (Object.assign(Object.assign({}, prev), { [menuKey]: false })));
|
|
441
|
+
} },
|
|
442
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.modalOptionText }, option))))))));
|
|
443
|
+
const handleContinue = async () => {
|
|
444
|
+
// Validate form before submitting
|
|
445
|
+
if (!validateForm()) {
|
|
446
|
+
react_native_1.Alert.alert('Validation Error', 'Please fix all errors before continuing.', [{ text: 'OK' }]);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
try {
|
|
450
|
+
// Prepare the API request
|
|
451
|
+
const fdBankAccountRequest = {
|
|
452
|
+
// Headers
|
|
453
|
+
providerId: defaultProviderId,
|
|
454
|
+
workflowInstanceId,
|
|
455
|
+
userreferenceid: appData === null || appData === void 0 ? void 0 : appData.userReferenceId,
|
|
456
|
+
applicationid: applicationId,
|
|
457
|
+
entityid: entityId,
|
|
458
|
+
// Body (entityid should NOT be in body, only in headers)
|
|
459
|
+
accountType: form.accountType,
|
|
460
|
+
accountNumber: form.accountNumber,
|
|
461
|
+
ifscCode: form.ifscCode.toUpperCase(), // Ensure IFSC is uppercase for API
|
|
462
|
+
bankName: form.bankName,
|
|
463
|
+
branchName: form.branchName,
|
|
464
|
+
customerId: customerId,
|
|
465
|
+
};
|
|
466
|
+
const response = await fdBankAccount(fdBankAccountRequest).unwrap();
|
|
467
|
+
// Call the original onContinue callback with form data
|
|
468
|
+
onContinue === null || onContinue === void 0 ? void 0 : onContinue(form);
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
// Show error message to user
|
|
472
|
+
react_native_1.Alert.alert(bank_1.BANK_STRINGS.BANK_VERIFICATION_FAILED, bank_1.BANK_STRINGS.BANK_ACCOUNT_ADDED_FAILED, [{ text: 'OK' }]);
|
|
473
|
+
// Do not call onContinue on failure - stay on current screen
|
|
474
|
+
// User can retry or correct their information
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
// Handler for back button (used by both header and hardware back button)
|
|
478
|
+
const handleBackPress = async () => {
|
|
479
|
+
setIsGoingBack(true);
|
|
480
|
+
try {
|
|
481
|
+
await previousState({
|
|
482
|
+
providerId: defaultProviderId,
|
|
483
|
+
workflowInstanceId,
|
|
484
|
+
userreferenceid: appData === null || appData === void 0 ? void 0 : appData.userReferenceId,
|
|
485
|
+
applicationid: applicationId,
|
|
486
|
+
entityid: entityId,
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
catch (e) {
|
|
490
|
+
// Handle error silently
|
|
491
|
+
}
|
|
492
|
+
finally {
|
|
493
|
+
setIsGoingBack(false);
|
|
494
|
+
// onGoBack?.();
|
|
495
|
+
(0, helpers_1.navigate)('NomineeDetail');
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
// Handle Android hardware back button
|
|
499
|
+
(0, react_1.useEffect)(() => {
|
|
500
|
+
if (react_native_1.Platform.OS !== 'android')
|
|
501
|
+
return;
|
|
502
|
+
const onHardwareBackPress = () => {
|
|
503
|
+
handleBackPress();
|
|
504
|
+
return true; // Prevent default behavior
|
|
505
|
+
};
|
|
506
|
+
const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onHardwareBackPress);
|
|
507
|
+
return () => backHandler.remove();
|
|
508
|
+
}, [defaultProviderId, workflowInstanceId, applicationId, entityId, appData === null || appData === void 0 ? void 0 : appData.userReferenceId]);
|
|
509
|
+
return (react_1.default.createElement(SafeAreaWrapper_1.default, { includeTop: false, bottomPadding: 25, statusBarColor: "#000000", statusBarStyle: "light-content" },
|
|
510
|
+
react_1.default.createElement(components_1.Header, { title: bank_1.BANK_STRINGS.BANK_DETAILS_TITLE, onBackPress: handleBackPress, backgroundColor: colors.primary }),
|
|
511
|
+
react_1.default.createElement(react_native_1.KeyboardAvoidingView, { behavior: react_native_1.Platform.OS === 'ios' ? 'padding' : undefined, style: styles.keyboardAvoidingView, keyboardVerticalOffset: react_native_1.Platform.OS === 'ios' ? 0 : 0 },
|
|
512
|
+
react_1.default.createElement(react_native_1.ScrollView, { style: styles.container, showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.scrollContent, scrollEnabled: !isLoadingFdBankAccount },
|
|
513
|
+
react_1.default.createElement(react_native_1.TouchableWithoutFeedback, { onPress: isLoadingFdBankAccount ? undefined : closeAllMenus },
|
|
514
|
+
react_1.default.createElement(react_native_1.View, null,
|
|
515
|
+
react_1.default.createElement(react_native_1.View, null,
|
|
516
|
+
renderDropdown(bank_1.BANK_STRINGS.ACCOUNT_TYPE_LABEL, form.accountType, 'accountType', accountTypeOptions, 'accountType', 'Select option', true // Always editable - user can change account type
|
|
517
|
+
),
|
|
518
|
+
renderFieldError('accountType')),
|
|
519
|
+
react_1.default.createElement(react_native_1.View, null,
|
|
520
|
+
react_1.default.createElement(TextFieldWithLabel_1.default, { label: bank_1.BANK_STRINGS.ACCOUNT_NUMBER_LABEL, value: !(appData === null || appData === void 0 ? void 0 : appData.accountNo) || appData.accountNo.trim() === '' ? form.accountNumber : formatAccountNumber(form.accountNumber), onChangeText: (text) => updateField('accountNumber', text), onFocus: () => { closeAllMenus(); }, placeholder: bank_1.BANK_STRINGS.ACCOUNT_NUMBER_PLACEHOLDER, variant: "numeric", keyboardType: "numeric", maxLength: 18, editable: !(appData === null || appData === void 0 ? void 0 : appData.accountNo) || appData.accountNo.trim() === '' }),
|
|
521
|
+
renderFieldError('accountNumber')),
|
|
522
|
+
react_1.default.createElement(react_native_1.View, null,
|
|
523
|
+
react_1.default.createElement(TextFieldWithLabel_1.default, { label: bank_1.BANK_STRINGS.IFSC_CODE_LABEL, value: form.ifscCode, onChangeText: (text) => updateField('ifscCode', text), onFocus: () => { closeAllMenus(); }, placeholder: bank_1.BANK_STRINGS.IFSC_CODE_PLACEHOLDER, variant: "text", maxLength: 11, autoCapitalize: "characters", editable: !(appData === null || appData === void 0 ? void 0 : appData.ifsc) || appData.ifsc.trim() === '' }),
|
|
524
|
+
renderFieldError('ifscCode')),
|
|
525
|
+
react_1.default.createElement(react_native_1.View, null,
|
|
526
|
+
react_1.default.createElement(TextFieldWithLabel_1.default, { label: bank_1.BANK_STRINGS.BANK_NAME_LABEL, value: form.bankName, onChangeText: (text) => updateField('bankName', text), onFocus: () => { closeAllMenus(); }, placeholder: bank_1.BANK_STRINGS.BANK_NAME_PLACEHOLDER, variant: "text", editable: false, inputStyle: { color: '#000000' } }),
|
|
527
|
+
renderFieldError('bankName')),
|
|
528
|
+
react_1.default.createElement(react_native_1.View, null,
|
|
529
|
+
react_1.default.createElement(TextFieldWithLabel_1.default, { label: bank_1.BANK_STRINGS.BRANCH_NAME_LABEL, value: form.branchName, onChangeText: (text) => updateField('branchName', text), onFocus: () => { closeAllMenus(); }, placeholder: bank_1.BANK_STRINGS.BRANCH_NAME_PLACEHOLDER, variant: "text", editable: false, inputStyle: { color: '#000000' } }),
|
|
530
|
+
renderFieldError('branchName')),
|
|
531
|
+
react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.addAccountButton, onPress: onAddAccount },
|
|
532
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.addAccountText }, bank_1.BANK_STRINGS.ADD_BANK_BUTTON)),
|
|
533
|
+
react_1.default.createElement(ActionButton_1.default, { title: "Continue", onPress: handleContinue, disabled: isLoadingFdBankAccount || !isFormValid(), loading: isLoadingFdBankAccount }))))),
|
|
534
|
+
isLoadingFdBankAccount && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" })),
|
|
535
|
+
isGoingBack && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" },
|
|
536
|
+
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary })))));
|
|
537
|
+
};
|
|
538
|
+
const createStyles = (colors, typography, themeName) => react_native_1.StyleSheet.create({
|
|
539
|
+
keyboardAvoidingView: {
|
|
540
|
+
flex: 1,
|
|
541
|
+
},
|
|
542
|
+
container: {
|
|
543
|
+
flex: 1,
|
|
544
|
+
paddingHorizontal: 16,
|
|
545
|
+
paddingTop: 20,
|
|
546
|
+
},
|
|
547
|
+
scrollContent: {
|
|
548
|
+
flexGrow: 1,
|
|
549
|
+
},
|
|
550
|
+
inlineMenu: {
|
|
551
|
+
backgroundColor: themeName === 'dark' ? colors.inputBackground : colors.background,
|
|
552
|
+
borderWidth: themeName === 'dark' ? 1 : 0.5,
|
|
553
|
+
borderColor: themeName === 'dark' ? '#ffffff' : 'rgba(0,0,0,0.2)',
|
|
554
|
+
borderRadius: 8,
|
|
555
|
+
marginTop: -20,
|
|
556
|
+
marginBottom: 10,
|
|
557
|
+
paddingHorizontal: 12,
|
|
558
|
+
paddingVertical: 6,
|
|
559
|
+
},
|
|
560
|
+
modalOption: {
|
|
561
|
+
paddingVertical: 14,
|
|
562
|
+
},
|
|
563
|
+
modalOptionText: Object.assign(Object.assign({}, typography.styles.bodyLarge), { color: colors.text }),
|
|
564
|
+
addAccountButton: {
|
|
565
|
+
alignItems: 'center',
|
|
566
|
+
paddingVertical: 16,
|
|
567
|
+
marginBottom: 20,
|
|
568
|
+
},
|
|
569
|
+
addAccountText: Object.assign(Object.assign({}, typography.styles.bodyLarge), { color: colors.primary }),
|
|
570
|
+
errorContainer: {
|
|
571
|
+
flexDirection: 'row',
|
|
572
|
+
alignItems: 'center',
|
|
573
|
+
marginTop: -20,
|
|
574
|
+
marginBottom: 20,
|
|
575
|
+
},
|
|
576
|
+
errorIcon: {
|
|
577
|
+
marginRight: 6,
|
|
578
|
+
},
|
|
579
|
+
errorText: {
|
|
580
|
+
fontSize: 12,
|
|
581
|
+
color: colors.error || '#FF0000',
|
|
582
|
+
flex: 1,
|
|
583
|
+
},
|
|
584
|
+
loadingOverlay: {
|
|
585
|
+
position: 'absolute',
|
|
586
|
+
top: 0,
|
|
587
|
+
left: 0,
|
|
588
|
+
right: 0,
|
|
589
|
+
bottom: 0,
|
|
590
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
591
|
+
justifyContent: 'center',
|
|
592
|
+
alignItems: 'center',
|
|
593
|
+
zIndex: 1000,
|
|
594
|
+
},
|
|
595
|
+
});
|
|
596
|
+
exports.default = BankDetail;
|
|
File without changes
|