@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,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,81 @@
|
|
|
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
|
+
children?: React.ReactNode;
|
|
17
|
+
theme?: ThemeName | Theme;
|
|
18
|
+
useReactNavigation?: boolean; // Flag to use React Navigation vs Simple Navigator
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Main navigation container for the SDK
|
|
22
|
+
export const SDKNavigationContainer: React.FC<SDKNavigationContainerProps> = ({
|
|
23
|
+
config,
|
|
24
|
+
onExit,
|
|
25
|
+
children,
|
|
26
|
+
theme,
|
|
27
|
+
useReactNavigation = true, // Default to React Navigation
|
|
28
|
+
}) => {
|
|
29
|
+
// Choose navigator based on flag
|
|
30
|
+
const navigator = useReactNavigation
|
|
31
|
+
? <RootNavigator config={config} onExit={onExit} />
|
|
32
|
+
: <SimpleNavigator config={config as SimpleNavigationConfig} onExit={onExit} />;
|
|
33
|
+
|
|
34
|
+
const content = children || (
|
|
35
|
+
useReactNavigation ? (
|
|
36
|
+
<NavigationContainer ref={navigationRef}>
|
|
37
|
+
{navigator}
|
|
38
|
+
</NavigationContainer>
|
|
39
|
+
) : (
|
|
40
|
+
navigator
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (theme) {
|
|
45
|
+
const themeProps = typeof theme === 'string'
|
|
46
|
+
? { initialTheme: theme }
|
|
47
|
+
: { theme };
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<ApiProvider>
|
|
51
|
+
<MasterDataProvider>
|
|
52
|
+
<ThemeProvider {...themeProps}>
|
|
53
|
+
{content}
|
|
54
|
+
</ThemeProvider>
|
|
55
|
+
</MasterDataProvider>
|
|
56
|
+
</ApiProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Default theme provider with API provider
|
|
61
|
+
return (
|
|
62
|
+
<ApiProvider>
|
|
63
|
+
<MasterDataProvider>
|
|
64
|
+
<ThemeProvider>
|
|
65
|
+
{content}
|
|
66
|
+
</ThemeProvider>
|
|
67
|
+
</MasterDataProvider>
|
|
68
|
+
</ApiProvider>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Default export for easy import
|
|
73
|
+
export default SDKNavigationContainer;
|
|
74
|
+
|
|
75
|
+
// React Navigation version - always uses React Navigation Stack Navigator
|
|
76
|
+
export const ShriramSDKNavigator: React.FC<Omit<SDKNavigationContainerProps, 'useReactNavigation'>> = (props) => (
|
|
77
|
+
<SDKNavigationContainer {...props} useReactNavigation={true} />
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
// Named exports for different aliases
|
|
81
|
+
export { SimpleNavigator };
|
|
@@ -0,0 +1,124 @@
|
|
|
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: undefined;
|
|
83
|
+
PaymentStatus: {
|
|
84
|
+
status?: 'success' | 'failed' | 'pending';
|
|
85
|
+
transactionId?: string;
|
|
86
|
+
fdData?: {
|
|
87
|
+
companyName: string;
|
|
88
|
+
amount: number;
|
|
89
|
+
fdRate: string;
|
|
90
|
+
tenure: string;
|
|
91
|
+
interestPayout: string;
|
|
92
|
+
};
|
|
93
|
+
paymentData?: any;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Navigation prop types for screens
|
|
98
|
+
export type NavigationProps = {
|
|
99
|
+
navigation: any;
|
|
100
|
+
route: any;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Screen component props that include navigation
|
|
104
|
+
export type ScreenProps<T extends keyof RootStackParamList> = {
|
|
105
|
+
navigation: any;
|
|
106
|
+
route: {
|
|
107
|
+
params: RootStackParamList[T];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// SDK Configuration for navigation
|
|
112
|
+
export interface SDKNavigationConfig {
|
|
113
|
+
initialRouteName?: keyof RootStackParamList;
|
|
114
|
+
onExit?: (fdDetails?: any) => void;
|
|
115
|
+
customScreenOptions?: object;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Navigation context type
|
|
119
|
+
export interface NavigationContextType {
|
|
120
|
+
navigate: (screen: keyof RootStackParamList, params?: any) => void;
|
|
121
|
+
goBack: () => void;
|
|
122
|
+
reset: (routeName: keyof RootStackParamList) => void;
|
|
123
|
+
exit: () => void;
|
|
124
|
+
}
|
|
@@ -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,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Provider } from 'react-redux';
|
|
3
|
+
import { store } from '../store';
|
|
4
|
+
import { getSDKStoreRef, setSDKStoreRef } from '../api/baseApi';
|
|
5
|
+
|
|
6
|
+
interface ApiProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ApiProvider: React.FC<ApiProviderProps> = ({
|
|
12
|
+
children,
|
|
13
|
+
apiBaseUrl
|
|
14
|
+
}) => {
|
|
15
|
+
// ✅ CRITICAL: Ensure SDK store reference is set before rendering
|
|
16
|
+
// This ensures the interceptor always uses SDK's store state
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
if (!getSDKStoreRef()) {
|
|
19
|
+
setSDKStoreRef(store);
|
|
20
|
+
if (__DEV__) {
|
|
21
|
+
console.log('✅ [ApiProvider] SDK store reference set');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
// Safety check: Ensure store is valid
|
|
27
|
+
if (!store) {
|
|
28
|
+
if (__DEV__) {
|
|
29
|
+
console.error('❌ [ApiProvider] SDK store is undefined!');
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// If a custom API base URL is provided, we could update the store configuration
|
|
35
|
+
// For now, we'll use the default configuration
|
|
36
|
+
return (
|
|
37
|
+
<Provider store={store}>
|
|
38
|
+
{children}
|
|
39
|
+
</Provider>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
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
|
+
|