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