@finspringinnovations/fixeddepositsdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -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 +6 -0
- package/lib/api/baseApi.js +406 -0
- package/lib/api/customerApi.d.ts +855 -0
- package/lib/api/customerApi.js +241 -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 +35 -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 +6 -0
- package/lib/assets/images/images.js +12 -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 +18 -0
- package/lib/components/ActiveFDCard.js +116 -0
- package/lib/components/AmountInput.d.ts +20 -0
- package/lib/components/AmountInput.js +142 -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 +59 -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 +23 -0
- package/lib/components/FDCard.js +116 -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 +19 -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 +46 -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 +159 -0
- package/lib/config/appDataConfig.js +310 -0
- package/lib/config/encryptionConfig.d.ts +21 -0
- package/lib/config/encryptionConfig.js +61 -0
- package/lib/config/workflowConstants.d.ts +62 -0
- package/lib/config/workflowConstants.js +63 -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 +26 -0
- package/lib/constants/strings/base64Images.js +29 -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 +48 -0
- package/lib/index.js +161 -0
- package/lib/navigation/RootNavigator.d.ts +9 -0
- package/lib/navigation/RootNavigator.js +459 -0
- package/lib/navigation/SimpleNavigator.d.ts +11 -0
- package/lib/navigation/SimpleNavigator.js +114 -0
- package/lib/navigation/helpers.d.ts +11 -0
- package/lib/navigation/helpers.js +83 -0
- package/lib/navigation/index.d.ts +17 -0
- package/lib/navigation/index.js +42 -0
- package/lib/navigation/types.d.ts +139 -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 +16 -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/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 +767 -0
- package/lib/screens/FDList.d.ts +28 -0
- package/lib/screens/FDList.js +1853 -0
- package/lib/screens/FindIFSC.d.ts +16 -0
- package/lib/screens/FindIFSC.js +248 -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 +431 -0
- package/lib/screens/ReviewKYC.d.ts +23 -0
- package/lib/screens/ReviewKYC.js +727 -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 +8 -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 +27 -0
- package/lib/theme/ThemeContext.d.ts +210 -0
- package/lib/theme/ThemeContext.js +92 -0
- package/lib/theme/colors.d.ts +80 -0
- package/lib/theme/colors.js +85 -0
- package/lib/theme/index.d.ts +35 -0
- package/lib/theme/index.js +78 -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 +145 -0
- package/lib/utils/globalData.d.ts +2 -0
- package/lib/utils/globalData.js +10 -0
- package/package.json +51 -0
- package/src/api/applicationApi.ts +12 -0
- package/src/api/bankApi.ts +42 -0
- package/src/api/baseApi.ts +463 -0
- package/src/api/customerApi.ts +324 -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 +37 -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/Mahindra.png +0 -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 +10 -0
- package/src/assets/images/shriram_logo.png +0 -0
- package/src/components/AadhaarInput.tsx +91 -0
- package/src/components/ActionButton.tsx +129 -0
- package/src/components/ActiveFDCard.tsx +188 -0
- package/src/components/AmountInput.tsx +217 -0
- package/src/components/CheckboxOption.tsx +93 -0
- package/src/components/CompanyHeader.tsx +80 -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 +186 -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 +237 -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 +358 -0
- package/src/config/encryptionConfig.ts +65 -0
- package/src/config/workflowConstants.ts +70 -0
- package/src/constants/strings/README.md +146 -0
- package/src/constants/strings/bank.ts +92 -0
- package/src/constants/strings/base64Images.ts +31 -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 +139 -0
- package/src/navigation/RootNavigator.tsx +687 -0
- package/src/navigation/SimpleNavigator.tsx +123 -0
- package/src/navigation/helpers.ts +85 -0
- package/src/navigation/index.tsx +84 -0
- package/src/navigation/types.ts +146 -0
- package/src/navigation/workflowNavigator.ts +131 -0
- package/src/providers/ApiProvider.tsx +23 -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/Employee.tsx +822 -0
- package/src/screens/FDCalculator.tsx +1002 -0
- package/src/screens/FDList.tsx +2199 -0
- package/src/screens/FindIFSC.tsx +332 -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 +595 -0
- package/src/screens/ReviewKYC.tsx +1062 -0
- package/src/state/paymentSession.ts +13 -0
- package/src/store/fdListSelectedSlice.ts +42 -0
- package/src/store/hooks.ts +6 -0
- package/src/store/index.ts +3 -0
- package/src/store/onboardingSlice.ts +37 -0
- package/src/store/store.ts +27 -0
- package/src/theme/ThemeContext.tsx +84 -0
- package/src/theme/colors.ts +90 -0
- package/src/theme/index.ts +85 -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 +165 -0
- package/src/utils/globalData.ts +7 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
//import Home from '../screens/Home';
|
|
3
|
+
import FDList from '../screens/FDList';
|
|
4
|
+
//import BookFD from '../screens/BookFD';
|
|
5
|
+
import FDCalculator from '../screens/FDCalculator';
|
|
6
|
+
//import type { FDBookingData } from '../screens/BookFD';
|
|
7
|
+
|
|
8
|
+
export type SimpleNavigationRoute = 'Home' | 'FDList' | 'BookFD' | 'FDCalculator';
|
|
9
|
+
|
|
10
|
+
export interface SimpleNavigationConfig {
|
|
11
|
+
initialRouteName?: SimpleNavigationRoute;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SimpleNavigatorProps {
|
|
15
|
+
config?: SimpleNavigationConfig;
|
|
16
|
+
onExit?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const SimpleNavigator: React.FC<SimpleNavigatorProps> = ({ config, onExit }) => {
|
|
20
|
+
const [currentRoute, setCurrentRoute] = useState<SimpleNavigationRoute>(
|
|
21
|
+
config?.initialRouteName || 'FDList'
|
|
22
|
+
);
|
|
23
|
+
const [routeParams, setRouteParams] = useState<any>(null);
|
|
24
|
+
|
|
25
|
+
const navigate = (routeName: SimpleNavigationRoute, params?: any) => {
|
|
26
|
+
setCurrentRoute(routeName);
|
|
27
|
+
setRouteParams(params);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const goBack = () => {
|
|
31
|
+
// Simple back navigation logic
|
|
32
|
+
switch (currentRoute) {
|
|
33
|
+
case 'FDList':
|
|
34
|
+
// FDList is now the first screen, so exit SDK
|
|
35
|
+
if (onExit) {
|
|
36
|
+
onExit();
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
case 'BookFD':
|
|
40
|
+
case 'FDCalculator':
|
|
41
|
+
setCurrentRoute('FDList');
|
|
42
|
+
setRouteParams(null);
|
|
43
|
+
break;
|
|
44
|
+
case 'Home':
|
|
45
|
+
// If somehow on Home, go back to FDList
|
|
46
|
+
setCurrentRoute('FDList');
|
|
47
|
+
setRouteParams(null);
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
if (onExit) {
|
|
51
|
+
onExit();
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// const handleBookingComplete = (data: FDBookingData) => {
|
|
58
|
+
// goBack(); // Go back to FD List after booking
|
|
59
|
+
// };
|
|
60
|
+
|
|
61
|
+
const renderCurrentScreen = () => {
|
|
62
|
+
switch (currentRoute) {
|
|
63
|
+
// case 'Home':
|
|
64
|
+
// return (
|
|
65
|
+
// <Home
|
|
66
|
+
// onNavigateToBookFD={() => navigate('BookFD')}
|
|
67
|
+
// onNavigateToFDList={() => navigate('FDList')}
|
|
68
|
+
// />
|
|
69
|
+
// );
|
|
70
|
+
case 'FDList':
|
|
71
|
+
return (
|
|
72
|
+
<FDList
|
|
73
|
+
onGoBack={goBack}
|
|
74
|
+
onSelectFD={(fdId: string) => { /* FD selected */ }}
|
|
75
|
+
onNavigateToFDCalculator={(fdData: any) => navigate('FDCalculator', { fdData })}
|
|
76
|
+
onNavigateToExternalSDK={
|
|
77
|
+
// SimpleNavigator is intended for demo/basic flows, so we don't support external SDKs here.
|
|
78
|
+
// The full RootNavigator should be used when integrating with Shriram/Mahindra SDK flows.
|
|
79
|
+
() => {
|
|
80
|
+
console.warn(
|
|
81
|
+
'External SDK navigation not supported in SimpleNavigator. Use SDKNavigationContainer / RootNavigator instead.'
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
// case 'BookFD':
|
|
88
|
+
// return (
|
|
89
|
+
// <BookFD
|
|
90
|
+
// onGoBack={goBack}
|
|
91
|
+
// onBookingComplete={handleBookingComplete}
|
|
92
|
+
// fdData={routeParams?.fdData}
|
|
93
|
+
// />
|
|
94
|
+
// );
|
|
95
|
+
case 'FDCalculator':
|
|
96
|
+
return (
|
|
97
|
+
<FDCalculator
|
|
98
|
+
onGoBack={goBack}
|
|
99
|
+
fdData={routeParams?.fdData}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
default:
|
|
103
|
+
return (
|
|
104
|
+
<FDList
|
|
105
|
+
onGoBack={goBack}
|
|
106
|
+
onSelectFD={(fdId: string) => { /* FD selected */ }}
|
|
107
|
+
onNavigateToFDCalculator={(fdData: any) => navigate('FDCalculator', { fdData })}
|
|
108
|
+
onNavigateToExternalSDK={
|
|
109
|
+
() => {
|
|
110
|
+
console.warn(
|
|
111
|
+
'External SDK navigation not supported in SimpleNavigator. Use SDKNavigationContainer / RootNavigator instead.'
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return renderCurrentScreen();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export default SimpleNavigator;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
import { CommonActions, StackActions } from '@react-navigation/native';
|
|
3
|
+
import type { RootStackParamList } from './types';
|
|
4
|
+
|
|
5
|
+
// Navigation ref to access navigation outside of components
|
|
6
|
+
export const navigationRef = createRef<any>();
|
|
7
|
+
|
|
8
|
+
// Helper to navigate outside of React components
|
|
9
|
+
export function navigate<T extends keyof RootStackParamList>(
|
|
10
|
+
name: T,
|
|
11
|
+
params?: RootStackParamList[T]
|
|
12
|
+
) {
|
|
13
|
+
if (navigationRef.current?.isReady()) {
|
|
14
|
+
navigationRef.current.navigate(name, params);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Helper to go back
|
|
19
|
+
export function goBack() {
|
|
20
|
+
if (navigationRef.current?.isReady() && navigationRef.current?.canGoBack()) {
|
|
21
|
+
navigationRef.current.goBack();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Helper to reset navigation stack
|
|
26
|
+
export function resetNavigation(routeName: keyof RootStackParamList, params?: any) {
|
|
27
|
+
if (navigationRef.current?.isReady()) {
|
|
28
|
+
navigationRef.current.dispatch(
|
|
29
|
+
CommonActions.reset({
|
|
30
|
+
index: 0,
|
|
31
|
+
routes: [{ name: routeName, params }],
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Helper to replace current screen
|
|
38
|
+
export function replace<T extends keyof RootStackParamList>(
|
|
39
|
+
name: T,
|
|
40
|
+
params?: RootStackParamList[T]
|
|
41
|
+
) {
|
|
42
|
+
if (navigationRef.current?.isReady()) {
|
|
43
|
+
navigationRef.current.dispatch(StackActions.replace(name, params));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Helper to push a new screen onto the stack
|
|
48
|
+
export function push<T extends keyof RootStackParamList>(
|
|
49
|
+
name: T,
|
|
50
|
+
params?: RootStackParamList[T]
|
|
51
|
+
) {
|
|
52
|
+
if (navigationRef.current?.isReady()) {
|
|
53
|
+
navigationRef.current.dispatch(StackActions.push(name, params));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Helper to pop screens from the stack
|
|
58
|
+
export function pop(count: number = 1) {
|
|
59
|
+
if (navigationRef.current?.isReady()) {
|
|
60
|
+
navigationRef.current.dispatch(StackActions.pop(count));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Helper to get current route name
|
|
65
|
+
export function getCurrentRouteName() {
|
|
66
|
+
if (navigationRef.current?.isReady()) {
|
|
67
|
+
return navigationRef.current.getCurrentRoute()?.name;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Helper to check if can go back
|
|
73
|
+
export function canGoBack() {
|
|
74
|
+
if (navigationRef.current?.isReady()) {
|
|
75
|
+
return navigationRef.current.canGoBack();
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Helper for SDK exit functionality
|
|
81
|
+
export function exitSDK() {
|
|
82
|
+
// This can be customized based on how the SDK is integrated
|
|
83
|
+
// For now, we'll reset to the home screen
|
|
84
|
+
resetNavigation('Home');
|
|
85
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigationContainer } from '@react-navigation/native';
|
|
3
|
+
import RootNavigator from './RootNavigator';
|
|
4
|
+
import SimpleNavigator from './SimpleNavigator';
|
|
5
|
+
import type { SimpleNavigationConfig } from './SimpleNavigator';
|
|
6
|
+
import type { SDKNavigationConfig } from './types';
|
|
7
|
+
import { ThemeProvider } from '../theme/ThemeContext';
|
|
8
|
+
import { ApiProvider } from '../providers/ApiProvider';
|
|
9
|
+
import { MasterDataProvider } from '../providers/MasterDataProvider';
|
|
10
|
+
import { navigationRef } from './helpers';
|
|
11
|
+
import type { ThemeName, Theme } from '../theme';
|
|
12
|
+
|
|
13
|
+
interface SDKNavigationContainerProps {
|
|
14
|
+
config?: SDKNavigationConfig;
|
|
15
|
+
onExit?: (fdDetails?: any) => void;
|
|
16
|
+
onPanRequired?: () => void;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Theme applied to fdsdk and passed through to Shriram and Mahindra when they are shown. */
|
|
19
|
+
theme?: ThemeName | Theme;
|
|
20
|
+
useReactNavigation?: boolean; // Flag to use React Navigation vs Simple Navigator
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Main navigation container for the SDK
|
|
24
|
+
export const SDKNavigationContainer: React.FC<SDKNavigationContainerProps> = ({
|
|
25
|
+
config,
|
|
26
|
+
onExit,
|
|
27
|
+
onPanRequired,
|
|
28
|
+
children,
|
|
29
|
+
theme,
|
|
30
|
+
useReactNavigation = true, // Default to React Navigation
|
|
31
|
+
}) => {
|
|
32
|
+
// Choose navigator based on flag
|
|
33
|
+
const navigator = useReactNavigation
|
|
34
|
+
? <RootNavigator config={config} onExit={onExit} onPanRequired={onPanRequired} />
|
|
35
|
+
: <SimpleNavigator config={config as SimpleNavigationConfig} onExit={onExit} />;
|
|
36
|
+
|
|
37
|
+
const content = children || (
|
|
38
|
+
useReactNavigation ? (
|
|
39
|
+
<NavigationContainer ref={navigationRef}>
|
|
40
|
+
{navigator}
|
|
41
|
+
</NavigationContainer>
|
|
42
|
+
) : (
|
|
43
|
+
navigator
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (theme) {
|
|
48
|
+
const themeProps = typeof theme === 'string'
|
|
49
|
+
? { initialTheme: theme }
|
|
50
|
+
: { theme };
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ApiProvider>
|
|
54
|
+
<MasterDataProvider>
|
|
55
|
+
<ThemeProvider {...themeProps}>
|
|
56
|
+
{content}
|
|
57
|
+
</ThemeProvider>
|
|
58
|
+
</MasterDataProvider>
|
|
59
|
+
</ApiProvider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Default theme provider with API provider
|
|
64
|
+
return (
|
|
65
|
+
<ApiProvider>
|
|
66
|
+
<MasterDataProvider>
|
|
67
|
+
<ThemeProvider>
|
|
68
|
+
{content}
|
|
69
|
+
</ThemeProvider>
|
|
70
|
+
</MasterDataProvider>
|
|
71
|
+
</ApiProvider>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Default export for easy import
|
|
76
|
+
export default SDKNavigationContainer;
|
|
77
|
+
|
|
78
|
+
// React Navigation version - always uses React Navigation Stack Navigator
|
|
79
|
+
export const FDSDKNavigator: React.FC<Omit<SDKNavigationContainerProps, 'useReactNavigation'>> = (props) => (
|
|
80
|
+
<SDKNavigationContainer {...props} useReactNavigation={true} />
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// Named exports for different aliases
|
|
84
|
+
export { SimpleNavigator };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { NavigatorScreenParams } from '@react-navigation/native';
|
|
2
|
+
|
|
3
|
+
// Define the param list for the main stack navigator
|
|
4
|
+
export type RootStackParamList = {
|
|
5
|
+
Home: undefined;
|
|
6
|
+
FDList: undefined;
|
|
7
|
+
FDCalculator: {
|
|
8
|
+
fdData?: {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
accountNumber: string;
|
|
12
|
+
roi: string;
|
|
13
|
+
tenure: string;
|
|
14
|
+
amount: number;
|
|
15
|
+
maturityDate: string;
|
|
16
|
+
status: 'active' | 'matured' | 'pending';
|
|
17
|
+
creditRating: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
AadhaarVerification: {
|
|
21
|
+
fdData?: {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
accountNumber: string;
|
|
25
|
+
roi: string;
|
|
26
|
+
tenure: string;
|
|
27
|
+
amount: number;
|
|
28
|
+
maturityDate: string;
|
|
29
|
+
status: 'active' | 'matured' | 'pending';
|
|
30
|
+
creditRating: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
ReviewKYC: {
|
|
34
|
+
fdData?: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
accountNumber: string;
|
|
38
|
+
roi: string;
|
|
39
|
+
tenure: string;
|
|
40
|
+
amount: number;
|
|
41
|
+
maturityDate: string;
|
|
42
|
+
status: 'active' | 'matured' | 'pending';
|
|
43
|
+
creditRating: string;
|
|
44
|
+
};
|
|
45
|
+
kycData?: any;
|
|
46
|
+
};
|
|
47
|
+
BookFD: {
|
|
48
|
+
fdData?: {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
accountNumber: string;
|
|
52
|
+
roi: string;
|
|
53
|
+
tenure: string;
|
|
54
|
+
amount: number;
|
|
55
|
+
maturityDate: string;
|
|
56
|
+
status: 'active' | 'matured' | 'pending';
|
|
57
|
+
creditRating: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
Employee: undefined;
|
|
61
|
+
NomineeDetail: undefined;
|
|
62
|
+
BankDetail: undefined;
|
|
63
|
+
AddBankAccount: {
|
|
64
|
+
selectedIFSC?: {
|
|
65
|
+
bankName: string;
|
|
66
|
+
branchName: string;
|
|
67
|
+
ifscCode: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
FindIFSC: {
|
|
71
|
+
initialSearchTerm?: string;
|
|
72
|
+
};
|
|
73
|
+
PayNow: {
|
|
74
|
+
fdData?: {
|
|
75
|
+
companyName: string;
|
|
76
|
+
amount: number;
|
|
77
|
+
fdRate: string;
|
|
78
|
+
tenure: string;
|
|
79
|
+
interestPayout: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
Payment: {
|
|
83
|
+
paymentUrl?: string;
|
|
84
|
+
transactionId?: string;
|
|
85
|
+
applicationId?: string;
|
|
86
|
+
workflowInstanceId?: string;
|
|
87
|
+
entityId?: string;
|
|
88
|
+
providerId?: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
PaymentStatus: {
|
|
91
|
+
status?: 'success' | 'failed' | 'pending';
|
|
92
|
+
transactionId?: string;
|
|
93
|
+
fdData?: {
|
|
94
|
+
companyName: string;
|
|
95
|
+
amount: number;
|
|
96
|
+
fdRate: string;
|
|
97
|
+
tenure: string;
|
|
98
|
+
interestPayout: string;
|
|
99
|
+
};
|
|
100
|
+
paymentData?: any;
|
|
101
|
+
};
|
|
102
|
+
ExternalSDK: {
|
|
103
|
+
sdkType: 'shriram' | 'mahindra';
|
|
104
|
+
fdData?: any;
|
|
105
|
+
providerId?: string;
|
|
106
|
+
fdListSelectedData?: any;
|
|
107
|
+
completeFDData?: boolean;
|
|
108
|
+
masterData?: any;
|
|
109
|
+
onboardingIds?: any;
|
|
110
|
+
initialRouteName?: string;
|
|
111
|
+
/** When opening Shriram with initialRouteName 'PaymentStatus', pass status/transactionId/fdData here */
|
|
112
|
+
initialPaymentStatusParams?: { status?: 'success' | 'failed' | 'pending'; transactionId?: string; fdData?: any };
|
|
113
|
+
shriramSDKGlobalData?: any;
|
|
114
|
+
mahindraSDKGlobalData?: any;
|
|
115
|
+
forceFetchCustomerDetails?: boolean;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Navigation prop types for screens
|
|
120
|
+
export type NavigationProps = {
|
|
121
|
+
navigation: any;
|
|
122
|
+
route: any;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Screen component props that include navigation
|
|
126
|
+
export type ScreenProps<T extends keyof RootStackParamList> = {
|
|
127
|
+
navigation: any;
|
|
128
|
+
route: {
|
|
129
|
+
params: RootStackParamList[T];
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// SDK Configuration for navigation
|
|
134
|
+
export interface SDKNavigationConfig {
|
|
135
|
+
initialRouteName?: keyof RootStackParamList;
|
|
136
|
+
onExit?: (fdDetails?: any) => void;
|
|
137
|
+
customScreenOptions?: object;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Navigation context type
|
|
141
|
+
export interface NavigationContextType {
|
|
142
|
+
navigate: (screen: keyof RootStackParamList, params?: any) => void;
|
|
143
|
+
goBack: () => void;
|
|
144
|
+
reset: (routeName: keyof RootStackParamList) => void;
|
|
145
|
+
exit: () => void;
|
|
146
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { navigate } from './helpers';
|
|
2
|
+
import type { InvestmentData, CustomerData, AppData, FDData } from '../types/dataTypes';
|
|
3
|
+
import type { WorkflowStateSriram } from '../types/workflowTypes';
|
|
4
|
+
import { WORKFLOW_STATES } from '../config/workflowConstants';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Centralized navigation for FD workflow based on Flutter implementation
|
|
8
|
+
*/
|
|
9
|
+
export async function handleWorkflowNavigation({
|
|
10
|
+
workflowState,
|
|
11
|
+
investmentData,
|
|
12
|
+
customerData,
|
|
13
|
+
appData,
|
|
14
|
+
fdData,
|
|
15
|
+
completedApplications = [],
|
|
16
|
+
transactionId,
|
|
17
|
+
}: {
|
|
18
|
+
workflowState: WorkflowStateSriram;
|
|
19
|
+
investmentData?: InvestmentData;
|
|
20
|
+
customerData?: CustomerData;
|
|
21
|
+
appData?: AppData;
|
|
22
|
+
fdData?: FDData;
|
|
23
|
+
completedApplications?: any[];
|
|
24
|
+
transactionId?: string;
|
|
25
|
+
}) {
|
|
26
|
+
|
|
27
|
+
switch (workflowState) {
|
|
28
|
+
case WORKFLOW_STATES.START:
|
|
29
|
+
case WORKFLOW_STATES.INITIATION:
|
|
30
|
+
// No navigation required
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case WORKFLOW_STATES.CREATE_FD:
|
|
34
|
+
// Navigate to FD overview first, then to occupation
|
|
35
|
+
navigate('PayNow', {
|
|
36
|
+
fdData: fdData ? {
|
|
37
|
+
companyName: fdData.name,
|
|
38
|
+
amount: fdData.amount,
|
|
39
|
+
fdRate: fdData.roi,
|
|
40
|
+
tenure: fdData.tenure,
|
|
41
|
+
interestPayout: 'Yearly' // Default value
|
|
42
|
+
} : undefined
|
|
43
|
+
} as any);
|
|
44
|
+
// The flow will continue to occupation after FD selection
|
|
45
|
+
break;
|
|
46
|
+
|
|
47
|
+
case WORKFLOW_STATES.OCCUPATION:
|
|
48
|
+
navigate('Employee');
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
case WORKFLOW_STATES.NOMINEE:
|
|
52
|
+
navigate('NomineeDetail');
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
case WORKFLOW_STATES.BANK_DETAILS:
|
|
56
|
+
navigate('BankDetail');
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case WORKFLOW_STATES.KYC:
|
|
60
|
+
navigate('ReviewKYC');
|
|
61
|
+
break;
|
|
62
|
+
|
|
63
|
+
case WORKFLOW_STATES.PAYMENT:
|
|
64
|
+
// Handle payment status check and navigation
|
|
65
|
+
if (transactionId) {
|
|
66
|
+
// Navigate to payment screen with transaction ID
|
|
67
|
+
navigate('Payment');
|
|
68
|
+
} else {
|
|
69
|
+
navigate('PayNow', {
|
|
70
|
+
fdData: fdData ? {
|
|
71
|
+
companyName: fdData.name,
|
|
72
|
+
amount: fdData.amount,
|
|
73
|
+
fdRate: fdData.roi,
|
|
74
|
+
tenure: fdData.tenure,
|
|
75
|
+
interestPayout: '' // Default value
|
|
76
|
+
} : undefined
|
|
77
|
+
} as any);
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
|
|
81
|
+
case WORKFLOW_STATES.END:
|
|
82
|
+
navigate('PaymentStatus', {
|
|
83
|
+
transactionId,
|
|
84
|
+
fdData: fdData ? {
|
|
85
|
+
companyName: fdData.name,
|
|
86
|
+
amount: fdData.amount,
|
|
87
|
+
fdRate: fdData.roi,
|
|
88
|
+
tenure: fdData.tenure,
|
|
89
|
+
interestPayout: '' // Default value
|
|
90
|
+
} : undefined
|
|
91
|
+
});
|
|
92
|
+
break;
|
|
93
|
+
|
|
94
|
+
default:
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Handle FD selection from FDList and start the workflow
|
|
100
|
+
*/
|
|
101
|
+
export function handleFDSelection(fdData: FDData, investmentData?: InvestmentData) {
|
|
102
|
+
|
|
103
|
+
// Store FD data in Redux (this should be done in FDList component)
|
|
104
|
+
// Then navigate to occupation screen
|
|
105
|
+
handleWorkflowNavigation({
|
|
106
|
+
workflowState: WORKFLOW_STATES.OCCUPATION,
|
|
107
|
+
investmentData,
|
|
108
|
+
fdData,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Navigate through the complete FD creation flow
|
|
114
|
+
*/
|
|
115
|
+
export function navigateFDCreationFlow(fdData: FDData, investmentData?: InvestmentData) {
|
|
116
|
+
|
|
117
|
+
// This represents the complete flow from FD selection to payment
|
|
118
|
+
const flow = [
|
|
119
|
+
WORKFLOW_STATES.OCCUPATION, // Employee screen
|
|
120
|
+
WORKFLOW_STATES.NOMINEE, // NomineeDetail screen
|
|
121
|
+
WORKFLOW_STATES.BANK_DETAILS, // BankDetail screen
|
|
122
|
+
WORKFLOW_STATES.PAYMENT, // PayNow screen
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
// Start with occupation
|
|
126
|
+
handleWorkflowNavigation({
|
|
127
|
+
workflowState: WORKFLOW_STATES.OCCUPATION,
|
|
128
|
+
investmentData,
|
|
129
|
+
fdData,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Provider } from 'react-redux';
|
|
3
|
+
import { store } from '../store';
|
|
4
|
+
|
|
5
|
+
interface ApiProviderProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
apiBaseUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ApiProvider: React.FC<ApiProviderProps> = ({
|
|
11
|
+
children,
|
|
12
|
+
apiBaseUrl
|
|
13
|
+
}) => {
|
|
14
|
+
// If a custom API base URL is provided, we could update the store configuration
|
|
15
|
+
// For now, we'll use the default configuration
|
|
16
|
+
return (
|
|
17
|
+
<Provider store={store}>
|
|
18
|
+
{children}
|
|
19
|
+
</Provider>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ApiProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MasterDataState {
|
|
4
|
+
masterData?: any;
|
|
5
|
+
setMasterData: (data: any) => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const MasterDataContext = createContext<MasterDataState | undefined>(undefined);
|
|
9
|
+
|
|
10
|
+
export const MasterDataProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
11
|
+
const [masterData, setMasterData] = React.useState<any | undefined>(undefined);
|
|
12
|
+
|
|
13
|
+
const value = React.useMemo(() => ({ masterData, setMasterData }), [masterData]);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<MasterDataContext.Provider value={value}>{children}</MasterDataContext.Provider>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const useMasterData = (): MasterDataState => {
|
|
21
|
+
const ctx = useContext(MasterDataContext);
|
|
22
|
+
if (!ctx) {
|
|
23
|
+
// Provide a safe fallback to avoid crashes if provider is missing
|
|
24
|
+
const noop = () => { };
|
|
25
|
+
return { masterData: undefined, setMasterData: noop } as MasterDataState;
|
|
26
|
+
}
|
|
27
|
+
return ctx;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
|