@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,34 @@
|
|
|
1
|
+
import 'react-native-get-random-values';
|
|
2
|
+
export declare const logEnvLoaderValues: () => void;
|
|
3
|
+
export type Environment = 'development' | 'staging' | 'production';
|
|
4
|
+
export interface ApiConfig {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
timeout: number;
|
|
7
|
+
retryAttempts: number;
|
|
8
|
+
enableEncryption: boolean;
|
|
9
|
+
enableLogging: boolean;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
allowEncryptionToggle?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const getEnvironment: () => Environment;
|
|
14
|
+
export declare const getApiConfig: (env?: Environment) => ApiConfig;
|
|
15
|
+
export declare const getSecureHeaders: (env?: Environment) => Record<string, string>;
|
|
16
|
+
export declare const validateApiConfig: (config: ApiConfig) => boolean;
|
|
17
|
+
export declare const getEnvironmentConfig: () => {
|
|
18
|
+
environment: Environment;
|
|
19
|
+
config: ApiConfig;
|
|
20
|
+
isProduction: boolean;
|
|
21
|
+
isDevelopment: boolean;
|
|
22
|
+
isStaging: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare const debugApiConfig: () => void;
|
|
25
|
+
export declare const debugApiCall: (endpoint: string, method?: string) => {
|
|
26
|
+
url: string;
|
|
27
|
+
headers: Record<string, string>;
|
|
28
|
+
environment: Environment;
|
|
29
|
+
encryptionEnabled: boolean;
|
|
30
|
+
hasApiKey: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare const logEnvironmentInfo: () => void;
|
|
33
|
+
export declare const logEnvironmentDetails: () => void;
|
|
34
|
+
export default getApiConfig;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logEnvironmentDetails = exports.logEnvironmentInfo = exports.debugApiCall = exports.debugApiConfig = exports.getEnvironmentConfig = exports.validateApiConfig = exports.getSecureHeaders = exports.getApiConfig = exports.getEnvironment = exports.logEnvLoaderValues = void 0;
|
|
4
|
+
// API Configuration with values from main app
|
|
5
|
+
require("react-native-get-random-values");
|
|
6
|
+
const appDataConfig_1 = require("./appDataConfig");
|
|
7
|
+
const logEnvLoaderValues = () => {
|
|
8
|
+
// Environment values logging removed for security
|
|
9
|
+
};
|
|
10
|
+
exports.logEnvLoaderValues = logEnvLoaderValues;
|
|
11
|
+
// Environment detection - using hardcoded default
|
|
12
|
+
const getEnvironment = () => {
|
|
13
|
+
// Default to development for hardcoded configuration
|
|
14
|
+
return 'development';
|
|
15
|
+
};
|
|
16
|
+
exports.getEnvironment = getEnvironment;
|
|
17
|
+
// Common configuration shared by all environments
|
|
18
|
+
const COMMON_CONFIG = {
|
|
19
|
+
timeout: 60000,
|
|
20
|
+
retryAttempts: 3,
|
|
21
|
+
enableEncryption: true,
|
|
22
|
+
enableLogging: true,
|
|
23
|
+
allowEncryptionToggle: true,
|
|
24
|
+
headersBase: {
|
|
25
|
+
'X-Client-Version': '1.0.0',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const API_ENDPOINTS = {
|
|
29
|
+
development: Object.assign(Object.assign({}, COMMON_CONFIG), { baseUrl: '', headers: Object.assign(Object.assign({}, COMMON_CONFIG.headersBase), { 'X-Environment': 'development', 'X-API-Key': '' }) })
|
|
30
|
+
};
|
|
31
|
+
// Get API configuration for current environment
|
|
32
|
+
const getApiConfig = (env) => {
|
|
33
|
+
// Get environment data from main app first
|
|
34
|
+
const environmentData = (0, appDataConfig_1.getEnvironmentData)();
|
|
35
|
+
// Use environment from EnvironmentData if available, otherwise use parameter or default
|
|
36
|
+
// const currentEnv = env || environmentData?.environment || getEnvironment();
|
|
37
|
+
const config = API_ENDPOINTS.development;
|
|
38
|
+
// Create a new config object to avoid read-only issues
|
|
39
|
+
let finalConfig = Object.assign({}, config);
|
|
40
|
+
// Override configuration with values from main app if available
|
|
41
|
+
if (environmentData) {
|
|
42
|
+
// Override base URL if provided by main app
|
|
43
|
+
if (environmentData.apiBaseUrl) {
|
|
44
|
+
// finalConfig.baseUrl = environmentData.apiBaseUrl as any;
|
|
45
|
+
finalConfig = Object.assign(Object.assign({}, finalConfig), { baseUrl: environmentData.apiBaseUrl });
|
|
46
|
+
}
|
|
47
|
+
// Override API key if provided by main app
|
|
48
|
+
if (environmentData.apiKey) {
|
|
49
|
+
finalConfig.headers = Object.assign(Object.assign({}, finalConfig.headers), { 'X-API-Key': environmentData.apiKey });
|
|
50
|
+
}
|
|
51
|
+
// Override environment if provided by main app
|
|
52
|
+
if (environmentData.environment) {
|
|
53
|
+
finalConfig.headers = Object.assign(Object.assign({}, finalConfig.headers), { 'X-Environment': environmentData.environment });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Use secure logger for API configuration logging
|
|
57
|
+
// Validate configuration
|
|
58
|
+
if (!finalConfig.baseUrl) {
|
|
59
|
+
throw new Error(`Missing API base URL `);
|
|
60
|
+
}
|
|
61
|
+
return Object.assign(Object.assign({}, finalConfig), { baseUrl: sanitizeUrl(finalConfig.baseUrl) });
|
|
62
|
+
};
|
|
63
|
+
exports.getApiConfig = getApiConfig;
|
|
64
|
+
// Sanitize and validate URL
|
|
65
|
+
const sanitizeUrl = (url) => {
|
|
66
|
+
if (!url || typeof url !== 'string') {
|
|
67
|
+
throw new Error(`Invalid API URL: ${url}`);
|
|
68
|
+
}
|
|
69
|
+
// Trim leading and trailing spaces
|
|
70
|
+
let sanitized = url.trim();
|
|
71
|
+
// Basic URL validation - check if it starts with http:// or https://
|
|
72
|
+
if (!sanitized.match(/^https?:\/\//)) {
|
|
73
|
+
throw new Error(`Invalid API URL format: ${sanitized}`);
|
|
74
|
+
}
|
|
75
|
+
// Ensure HTTPS in production
|
|
76
|
+
if ((0, exports.getEnvironment)() === 'production' && !sanitized.startsWith('https://')) {
|
|
77
|
+
throw new Error('Production API must use HTTPS');
|
|
78
|
+
}
|
|
79
|
+
// Remove trailing slash
|
|
80
|
+
return sanitized.replace(/\/$/, '');
|
|
81
|
+
};
|
|
82
|
+
// Get secure headers for API requests
|
|
83
|
+
const getSecureHeaders = (env) => {
|
|
84
|
+
const config = (0, exports.getApiConfig)(env);
|
|
85
|
+
//const currentEnv = env || getEnvironment();
|
|
86
|
+
return Object.assign(Object.assign({}, config.headers), { 'Content-Type': 'application/json', 'Accept': 'application/json', 'User-Agent': `ShriramSDK/'1.0.0'`, 'X-Timestamp': Date.now().toString(), 'X-Request-ID': generateRequestId() });
|
|
87
|
+
};
|
|
88
|
+
exports.getSecureHeaders = getSecureHeaders;
|
|
89
|
+
// Generate unique request ID
|
|
90
|
+
const generateRequestId = () => {
|
|
91
|
+
return `req_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
92
|
+
};
|
|
93
|
+
// Validate environment configuration
|
|
94
|
+
const validateApiConfig = (config) => {
|
|
95
|
+
const errors = [];
|
|
96
|
+
if (!config.baseUrl) {
|
|
97
|
+
errors.push('Base URL is required');
|
|
98
|
+
}
|
|
99
|
+
if (config.timeout < 5000) {
|
|
100
|
+
errors.push('Timeout should be at least 5 seconds');
|
|
101
|
+
}
|
|
102
|
+
if (config.retryAttempts < 0 || config.retryAttempts > 5) {
|
|
103
|
+
errors.push('Retry attempts should be between 0 and 5');
|
|
104
|
+
}
|
|
105
|
+
// Validate URL format without using new URL (React Native compatible)
|
|
106
|
+
if (config.baseUrl && !config.baseUrl.match(/^https?:\/\//)) {
|
|
107
|
+
errors.push('Invalid base URL format - must start with http:// or https://');
|
|
108
|
+
}
|
|
109
|
+
if (errors.length > 0) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
};
|
|
114
|
+
exports.validateApiConfig = validateApiConfig;
|
|
115
|
+
// Get environment-specific configuration
|
|
116
|
+
const getEnvironmentConfig = () => {
|
|
117
|
+
const env = (0, exports.getEnvironment)();
|
|
118
|
+
const config = (0, exports.getApiConfig)(env);
|
|
119
|
+
return {
|
|
120
|
+
environment: env,
|
|
121
|
+
config,
|
|
122
|
+
isProduction: env === 'production',
|
|
123
|
+
isDevelopment: env === 'development',
|
|
124
|
+
isStaging: env === 'staging',
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
128
|
+
// Debug configuration (works in all environments now)
|
|
129
|
+
const debugApiConfig = () => {
|
|
130
|
+
// API Configuration debug complete
|
|
131
|
+
};
|
|
132
|
+
exports.debugApiConfig = debugApiConfig;
|
|
133
|
+
// New utility to help clients debug 403 errors
|
|
134
|
+
const debugApiCall = (endpoint, method = 'GET') => {
|
|
135
|
+
const config = (0, exports.getApiConfig)();
|
|
136
|
+
const headers = (0, exports.getSecureHeaders)();
|
|
137
|
+
// API Call debug complete
|
|
138
|
+
return {
|
|
139
|
+
url: `${config.baseUrl || ''}/${endpoint}`,
|
|
140
|
+
headers,
|
|
141
|
+
environment: (0, exports.getEnvironment)(),
|
|
142
|
+
encryptionEnabled: config.enableEncryption,
|
|
143
|
+
hasApiKey: !!headers['X-API-Key']
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
exports.debugApiCall = debugApiCall;
|
|
147
|
+
// Environment logging utility
|
|
148
|
+
const logEnvironmentInfo = () => {
|
|
149
|
+
// Environment logging removed for security
|
|
150
|
+
};
|
|
151
|
+
exports.logEnvironmentInfo = logEnvironmentInfo;
|
|
152
|
+
// Function to log environment details (can be called from anywhere)
|
|
153
|
+
const logEnvironmentDetails = () => {
|
|
154
|
+
// Environment details logging removed for security
|
|
155
|
+
};
|
|
156
|
+
exports.logEnvironmentDetails = logEnvironmentDetails;
|
|
157
|
+
// Export default configuration
|
|
158
|
+
exports.default = exports.getApiConfig;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export interface EnvironmentData {
|
|
2
|
+
environment: string;
|
|
3
|
+
apiBaseUrl?: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
encryptionKey?: string;
|
|
6
|
+
enableLogging?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AppData {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
dob: string;
|
|
12
|
+
gender: string;
|
|
13
|
+
mobNo: string;
|
|
14
|
+
email: string;
|
|
15
|
+
panNumber: string;
|
|
16
|
+
address?: string;
|
|
17
|
+
area?: string;
|
|
18
|
+
city?: string;
|
|
19
|
+
state?: string;
|
|
20
|
+
country?: string;
|
|
21
|
+
pinCode?: string;
|
|
22
|
+
accountNo?: string;
|
|
23
|
+
nameOfBank?: string;
|
|
24
|
+
ifsc?: string;
|
|
25
|
+
typeOfAccount?: string;
|
|
26
|
+
maritalStatus?: string;
|
|
27
|
+
userReferenceId?: string;
|
|
28
|
+
eventNotifyUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Initialize the SDK with app data from the main application
|
|
32
|
+
* This should be called when the SDK starts
|
|
33
|
+
*/
|
|
34
|
+
export declare const initializeSDK: (appData: AppData, onValidationError?: (errors: string[]) => void) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Initialize the SDK with environment configuration from the main application
|
|
37
|
+
* This should be called to configure SDK environment settings
|
|
38
|
+
*/
|
|
39
|
+
export declare const initializeEnvironment: (environmentData: EnvironmentData) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Get the current app data
|
|
42
|
+
*/
|
|
43
|
+
export declare const getAppData: () => AppData | null;
|
|
44
|
+
/**
|
|
45
|
+
* Get the current environment data
|
|
46
|
+
*/
|
|
47
|
+
export declare const getEnvironmentData: () => EnvironmentData | null;
|
|
48
|
+
/**
|
|
49
|
+
* Check if SDK is initialized with app data
|
|
50
|
+
*/
|
|
51
|
+
export declare const isSDKInitialized: () => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Check if environment is initialized
|
|
54
|
+
*/
|
|
55
|
+
export declare const isEnvironmentInitialized: () => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Get specific user information for API requests
|
|
58
|
+
*/
|
|
59
|
+
export declare const getUserInfoForAPI: () => {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
dob: string;
|
|
63
|
+
gender: string;
|
|
64
|
+
panNumber: string;
|
|
65
|
+
mobileNumber: string;
|
|
66
|
+
email: string;
|
|
67
|
+
eventNotifyUrl: string | undefined;
|
|
68
|
+
userReferenceId: string;
|
|
69
|
+
address: {
|
|
70
|
+
line1: string | undefined;
|
|
71
|
+
area: string | undefined;
|
|
72
|
+
city: string | undefined;
|
|
73
|
+
state: string | undefined;
|
|
74
|
+
country: string | undefined;
|
|
75
|
+
pinCode: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
bankDetails: {
|
|
78
|
+
accountNumber: string | undefined;
|
|
79
|
+
bankName: string | undefined;
|
|
80
|
+
ifsc: string | undefined;
|
|
81
|
+
accountType: string | undefined;
|
|
82
|
+
};
|
|
83
|
+
maritalStatus: string | undefined;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Get user demographics for interest rate calculations
|
|
87
|
+
*/
|
|
88
|
+
export declare const getUserDemographics: () => {
|
|
89
|
+
age: number;
|
|
90
|
+
isSeniorCitizen: boolean;
|
|
91
|
+
isWomenDepositor: boolean;
|
|
92
|
+
gender: string;
|
|
93
|
+
maritalStatus: string | undefined;
|
|
94
|
+
dob: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Validate app data
|
|
98
|
+
*/
|
|
99
|
+
export declare const validateAppData: (appData: AppData) => {
|
|
100
|
+
isValid: boolean;
|
|
101
|
+
errors: string[];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Clear app data (for testing or logout scenarios)
|
|
105
|
+
*/
|
|
106
|
+
export declare const clearAppData: () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Clear environment data (for testing or logout scenarios)
|
|
109
|
+
*/
|
|
110
|
+
export declare const clearEnvironmentData: () => void;
|
|
111
|
+
/**
|
|
112
|
+
* Clear all data (app data and environment data)
|
|
113
|
+
*/
|
|
114
|
+
export declare const clearAllData: () => void;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AppData Configuration - Data received from main app when SDK starts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.clearAllData = exports.clearEnvironmentData = exports.clearAppData = exports.validateAppData = exports.getUserDemographics = exports.getUserInfoForAPI = exports.isEnvironmentInitialized = exports.isSDKInitialized = exports.getEnvironmentData = exports.getAppData = exports.initializeEnvironment = exports.initializeSDK = void 0;
|
|
38
|
+
// Global app data storage
|
|
39
|
+
let globalAppData = null;
|
|
40
|
+
// Global environment data storage
|
|
41
|
+
let globalEnvironmentData = null;
|
|
42
|
+
/**
|
|
43
|
+
* Initialize the SDK with app data from the main application
|
|
44
|
+
* This should be called when the SDK starts
|
|
45
|
+
*/
|
|
46
|
+
const initializeSDK = (appData, onValidationError) => {
|
|
47
|
+
// Validate required user identification fields
|
|
48
|
+
const requiredFields = [
|
|
49
|
+
{ field: 'id', label: 'User ID' },
|
|
50
|
+
{ field: 'name', label: 'User Name' },
|
|
51
|
+
{ field: 'dob', label: 'Date of Birth' },
|
|
52
|
+
{ field: 'gender', label: 'Gender' },
|
|
53
|
+
{ field: 'mobNo', label: 'Mobile Number' },
|
|
54
|
+
{ field: 'email', label: 'Email' },
|
|
55
|
+
{ field: 'panNumber', label: 'PAN Number' },
|
|
56
|
+
];
|
|
57
|
+
const missingFields = [];
|
|
58
|
+
requiredFields.forEach(({ field, label }) => {
|
|
59
|
+
const value = appData[field];
|
|
60
|
+
if (!value || (typeof value === 'string' && !value.trim())) {
|
|
61
|
+
missingFields.push(label);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// If required fields are missing, call error handler
|
|
65
|
+
if (missingFields.length > 0) {
|
|
66
|
+
const errorMessage = `Missing required user information from main app:\n${missingFields.join(', ')}`;
|
|
67
|
+
if (onValidationError) {
|
|
68
|
+
onValidationError(missingFields);
|
|
69
|
+
}
|
|
70
|
+
throw new Error(errorMessage);
|
|
71
|
+
}
|
|
72
|
+
// Validate all fields
|
|
73
|
+
const validation = (0, exports.validateAppData)(appData);
|
|
74
|
+
if (!validation.isValid) {
|
|
75
|
+
if (onValidationError) {
|
|
76
|
+
onValidationError(validation.errors);
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`App data validation failed: ${validation.errors.join(', ')}`);
|
|
79
|
+
}
|
|
80
|
+
globalAppData = appData;
|
|
81
|
+
// SDK initialization started
|
|
82
|
+
try {
|
|
83
|
+
// logging removed
|
|
84
|
+
}
|
|
85
|
+
catch (_a) { }
|
|
86
|
+
// Import and call environment logging
|
|
87
|
+
Promise.resolve().then(() => __importStar(require('./apiConfig'))).then(({ logEnvironmentInfo }) => {
|
|
88
|
+
logEnvironmentInfo();
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
exports.initializeSDK = initializeSDK;
|
|
92
|
+
/**
|
|
93
|
+
* Initialize the SDK with environment configuration from the main application
|
|
94
|
+
* This should be called to configure SDK environment settings
|
|
95
|
+
*/
|
|
96
|
+
const initializeEnvironment = (environmentData) => {
|
|
97
|
+
globalEnvironmentData = environmentData;
|
|
98
|
+
// Environment initialization started
|
|
99
|
+
try {
|
|
100
|
+
// logging removed
|
|
101
|
+
}
|
|
102
|
+
catch (_a) { }
|
|
103
|
+
// Environment initialized
|
|
104
|
+
};
|
|
105
|
+
exports.initializeEnvironment = initializeEnvironment;
|
|
106
|
+
/**
|
|
107
|
+
* Get the current app data
|
|
108
|
+
*/
|
|
109
|
+
const getAppData = () => {
|
|
110
|
+
return globalAppData;
|
|
111
|
+
};
|
|
112
|
+
exports.getAppData = getAppData;
|
|
113
|
+
/**
|
|
114
|
+
* Get the current environment data
|
|
115
|
+
*/
|
|
116
|
+
const getEnvironmentData = () => {
|
|
117
|
+
return globalEnvironmentData;
|
|
118
|
+
};
|
|
119
|
+
exports.getEnvironmentData = getEnvironmentData;
|
|
120
|
+
/**
|
|
121
|
+
* Check if SDK is initialized with app data
|
|
122
|
+
*/
|
|
123
|
+
const isSDKInitialized = () => {
|
|
124
|
+
return globalAppData !== null;
|
|
125
|
+
};
|
|
126
|
+
exports.isSDKInitialized = isSDKInitialized;
|
|
127
|
+
/**
|
|
128
|
+
* Check if environment is initialized
|
|
129
|
+
*/
|
|
130
|
+
const isEnvironmentInitialized = () => {
|
|
131
|
+
return globalEnvironmentData !== null;
|
|
132
|
+
};
|
|
133
|
+
exports.isEnvironmentInitialized = isEnvironmentInitialized;
|
|
134
|
+
/**
|
|
135
|
+
* Get specific user information for API requests
|
|
136
|
+
*/
|
|
137
|
+
const getUserInfoForAPI = () => {
|
|
138
|
+
if (!globalAppData) {
|
|
139
|
+
throw new Error('SDK not initialized. Call initializeSDK() first.');
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
id: globalAppData.id,
|
|
143
|
+
name: globalAppData.name,
|
|
144
|
+
dob: globalAppData.dob,
|
|
145
|
+
gender: globalAppData.gender,
|
|
146
|
+
panNumber: globalAppData.panNumber,
|
|
147
|
+
mobileNumber: globalAppData.mobNo,
|
|
148
|
+
email: globalAppData.email,
|
|
149
|
+
eventNotifyUrl: globalAppData.eventNotifyUrl,
|
|
150
|
+
userReferenceId: globalAppData.id, // Use userReferenceId or fallback to id
|
|
151
|
+
address: {
|
|
152
|
+
line1: globalAppData.address,
|
|
153
|
+
area: globalAppData.area,
|
|
154
|
+
city: globalAppData.city,
|
|
155
|
+
state: globalAppData.state,
|
|
156
|
+
country: globalAppData.country,
|
|
157
|
+
pinCode: globalAppData.pinCode,
|
|
158
|
+
},
|
|
159
|
+
bankDetails: {
|
|
160
|
+
accountNumber: globalAppData.accountNo,
|
|
161
|
+
bankName: globalAppData.nameOfBank,
|
|
162
|
+
ifsc: globalAppData.ifsc,
|
|
163
|
+
accountType: globalAppData.typeOfAccount,
|
|
164
|
+
},
|
|
165
|
+
maritalStatus: globalAppData.maritalStatus,
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
exports.getUserInfoForAPI = getUserInfoForAPI;
|
|
169
|
+
/**
|
|
170
|
+
* Get user demographics for interest rate calculations
|
|
171
|
+
*/
|
|
172
|
+
const getUserDemographics = () => {
|
|
173
|
+
if (!globalAppData) {
|
|
174
|
+
throw new Error('SDK not initialized. Call initializeSDK() first.');
|
|
175
|
+
}
|
|
176
|
+
// Calculate age from DOB
|
|
177
|
+
const calculateAge = (dob) => {
|
|
178
|
+
const today = new Date();
|
|
179
|
+
const birthDate = new Date(dob);
|
|
180
|
+
let age = today.getFullYear() - birthDate.getFullYear();
|
|
181
|
+
const monthDiff = today.getMonth() - birthDate.getMonth();
|
|
182
|
+
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
|
183
|
+
age--;
|
|
184
|
+
}
|
|
185
|
+
return age;
|
|
186
|
+
};
|
|
187
|
+
const age = calculateAge(globalAppData.dob);
|
|
188
|
+
const isSeniorCitizen = age >= 60;
|
|
189
|
+
const isWomenDepositor = globalAppData.gender === 'Female' || globalAppData.gender === 'female';
|
|
190
|
+
return {
|
|
191
|
+
age,
|
|
192
|
+
isSeniorCitizen,
|
|
193
|
+
isWomenDepositor,
|
|
194
|
+
gender: globalAppData.gender,
|
|
195
|
+
maritalStatus: globalAppData.maritalStatus,
|
|
196
|
+
dob: globalAppData.dob,
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
exports.getUserDemographics = getUserDemographics;
|
|
200
|
+
/**
|
|
201
|
+
* Validate app data
|
|
202
|
+
*/
|
|
203
|
+
const validateAppData = (appData) => {
|
|
204
|
+
var _a, _b, _c, _d, _e, _f;
|
|
205
|
+
const errors = [];
|
|
206
|
+
// Required fields validation
|
|
207
|
+
if (!((_a = appData.id) === null || _a === void 0 ? void 0 : _a.trim()))
|
|
208
|
+
errors.push('ID is required');
|
|
209
|
+
if (!((_b = appData.name) === null || _b === void 0 ? void 0 : _b.trim()))
|
|
210
|
+
errors.push('Name is required');
|
|
211
|
+
if (!((_c = appData.dob) === null || _c === void 0 ? void 0 : _c.trim()))
|
|
212
|
+
errors.push('Date of birth is required');
|
|
213
|
+
if (!appData.gender)
|
|
214
|
+
errors.push('Gender is required');
|
|
215
|
+
if (!((_d = appData.mobNo) === null || _d === void 0 ? void 0 : _d.trim()))
|
|
216
|
+
errors.push('Mobile number is required');
|
|
217
|
+
if (!((_e = appData.email) === null || _e === void 0 ? void 0 : _e.trim()))
|
|
218
|
+
errors.push('Email is required');
|
|
219
|
+
if (!((_f = appData.panNumber) === null || _f === void 0 ? void 0 : _f.trim()))
|
|
220
|
+
errors.push('PAN number is required');
|
|
221
|
+
// Format validation (only if fields are provided)
|
|
222
|
+
if (appData.dob && !/^\d{4}-\d{2}-\d{2}$/.test(appData.dob)) {
|
|
223
|
+
errors.push('Date of birth must be in YYYY-MM-DD format');
|
|
224
|
+
}
|
|
225
|
+
if (appData.panNumber && !/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(appData.panNumber)) {
|
|
226
|
+
errors.push('PAN number must be in valid format (e.g., ABCDE1234F)');
|
|
227
|
+
}
|
|
228
|
+
if (appData.mobNo && !/^[6-9]\d{9}$/.test(appData.mobNo)) {
|
|
229
|
+
errors.push('Mobile number must be 10 digits starting with 6-9');
|
|
230
|
+
}
|
|
231
|
+
if (appData.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(appData.email)) {
|
|
232
|
+
errors.push('Email must be in valid format');
|
|
233
|
+
}
|
|
234
|
+
if (appData.ifsc && appData.ifsc.trim() && !/^[A-Z]{4}0[A-Z0-9]{6}$/.test(appData.ifsc)) {
|
|
235
|
+
errors.push('IFSC code must be in valid format (e.g., SBIN0001234)');
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
isValid: errors.length === 0,
|
|
239
|
+
errors,
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
exports.validateAppData = validateAppData;
|
|
243
|
+
/**
|
|
244
|
+
* Clear app data (for testing or logout scenarios)
|
|
245
|
+
*/
|
|
246
|
+
const clearAppData = () => {
|
|
247
|
+
globalAppData = null;
|
|
248
|
+
};
|
|
249
|
+
exports.clearAppData = clearAppData;
|
|
250
|
+
/**
|
|
251
|
+
* Clear environment data (for testing or logout scenarios)
|
|
252
|
+
*/
|
|
253
|
+
const clearEnvironmentData = () => {
|
|
254
|
+
globalEnvironmentData = null;
|
|
255
|
+
};
|
|
256
|
+
exports.clearEnvironmentData = clearEnvironmentData;
|
|
257
|
+
/**
|
|
258
|
+
* Clear all data (app data and environment data)
|
|
259
|
+
*/
|
|
260
|
+
const clearAllData = () => {
|
|
261
|
+
globalAppData = null;
|
|
262
|
+
globalEnvironmentData = null;
|
|
263
|
+
};
|
|
264
|
+
exports.clearAllData = clearAllData;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EncryptionConfig } from '../utils/encryption';
|
|
2
|
+
export declare const getEncryptionConfig: () => EncryptionConfig;
|
|
3
|
+
export declare const getEncryptionConfigs: () => {
|
|
4
|
+
development: {
|
|
5
|
+
secretKey: string;
|
|
6
|
+
algorithm: "AES";
|
|
7
|
+
ivLength: number;
|
|
8
|
+
};
|
|
9
|
+
staging: {
|
|
10
|
+
secretKey: string;
|
|
11
|
+
algorithm: "AES";
|
|
12
|
+
ivLength: number;
|
|
13
|
+
};
|
|
14
|
+
production: {
|
|
15
|
+
secretKey: string;
|
|
16
|
+
algorithm: "AES";
|
|
17
|
+
ivLength: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const getEnvironmentConfig: (env?: "development" | "staging" | "production") => EncryptionConfig;
|
|
21
|
+
export declare const validateEncryptionConfig: (config: EncryptionConfig) => boolean;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateEncryptionConfig = exports.getEnvironmentConfig = exports.getEncryptionConfigs = exports.getEncryptionConfig = void 0;
|
|
4
|
+
const appDataConfig_1 = require("./appDataConfig");
|
|
5
|
+
//Encryption configuration from environment data
|
|
6
|
+
const getEncryptionConfig = () => {
|
|
7
|
+
const environmentData = (0, appDataConfig_1.getEnvironmentData)();
|
|
8
|
+
// Use environment data if available
|
|
9
|
+
if (environmentData === null || environmentData === void 0 ? void 0 : environmentData.encryptionKey) {
|
|
10
|
+
return {
|
|
11
|
+
secretKey: environmentData.encryptionKey,
|
|
12
|
+
algorithm: 'AES',
|
|
13
|
+
ivLength: 16,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// If no environment data, throw error to ensure proper initialization
|
|
17
|
+
throw new Error('Environment data not initialized. Call initializeEnvironment() first.');
|
|
18
|
+
};
|
|
19
|
+
exports.getEncryptionConfig = getEncryptionConfig;
|
|
20
|
+
// Configuration for different environments - using environment data
|
|
21
|
+
const getEncryptionConfigs = () => {
|
|
22
|
+
const environmentData = (0, appDataConfig_1.getEnvironmentData)();
|
|
23
|
+
if (!(environmentData === null || environmentData === void 0 ? void 0 : environmentData.encryptionKey)) {
|
|
24
|
+
throw new Error('Environment data not initialized. Call initializeEnvironment() first.');
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
development: {
|
|
28
|
+
secretKey: environmentData.encryptionKey,
|
|
29
|
+
algorithm: 'AES',
|
|
30
|
+
ivLength: 16,
|
|
31
|
+
},
|
|
32
|
+
staging: {
|
|
33
|
+
secretKey: environmentData.encryptionKey,
|
|
34
|
+
algorithm: 'AES',
|
|
35
|
+
ivLength: 16,
|
|
36
|
+
},
|
|
37
|
+
production: {
|
|
38
|
+
secretKey: environmentData.encryptionKey,
|
|
39
|
+
algorithm: 'AES',
|
|
40
|
+
ivLength: 16,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.getEncryptionConfigs = getEncryptionConfigs;
|
|
45
|
+
// Get configuration based on environment
|
|
46
|
+
const getEnvironmentConfig = (env = 'development') => {
|
|
47
|
+
const configs = (0, exports.getEncryptionConfigs)();
|
|
48
|
+
return configs[env];
|
|
49
|
+
};
|
|
50
|
+
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
51
|
+
// Validate encryption configuration
|
|
52
|
+
const validateEncryptionConfig = (config) => {
|
|
53
|
+
if (!config.secretKey || config.secretKey.length < 16) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (config.ivLength && (config.ivLength < 8 || config.ivLength > 32)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
};
|
|
61
|
+
exports.validateEncryptionConfig = validateEncryptionConfig;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const WORKFLOW_STATES: {
|
|
2
|
+
readonly INITIATION: 404;
|
|
3
|
+
readonly START: 405;
|
|
4
|
+
readonly KYC: 406;
|
|
5
|
+
readonly OCCUPATION: 409;
|
|
6
|
+
readonly NOMINEE: 407;
|
|
7
|
+
readonly BANK_DETAILS: 408;
|
|
8
|
+
readonly CREATE_FD: 411;
|
|
9
|
+
readonly PAYMENT: 410;
|
|
10
|
+
readonly END: 403;
|
|
11
|
+
};
|
|
12
|
+
export declare const WORKFLOW_TASKS: {
|
|
13
|
+
readonly RESEND_OTP: 11045;
|
|
14
|
+
readonly VALIDATE_OTP: 11047;
|
|
15
|
+
};
|
|
16
|
+
export type WorkflowState = typeof WORKFLOW_STATES[keyof typeof WORKFLOW_STATES];
|
|
17
|
+
export type WorkflowTask = typeof WORKFLOW_TASKS[keyof typeof WORKFLOW_TASKS];
|
|
18
|
+
export declare const getWorkflowStateName: (stateId: number) => string | undefined;
|
|
19
|
+
export declare const getWorkflowTaskName: (taskId: number) => string | undefined;
|
|
20
|
+
export declare const WORKFLOW_CONSTANTS: {
|
|
21
|
+
readonly STATES: {
|
|
22
|
+
readonly INITIATION: 404;
|
|
23
|
+
readonly START: 405;
|
|
24
|
+
readonly KYC: 406;
|
|
25
|
+
readonly OCCUPATION: 409;
|
|
26
|
+
readonly NOMINEE: 407;
|
|
27
|
+
readonly BANK_DETAILS: 408;
|
|
28
|
+
readonly CREATE_FD: 411;
|
|
29
|
+
readonly PAYMENT: 410;
|
|
30
|
+
readonly END: 403;
|
|
31
|
+
};
|
|
32
|
+
readonly TASKS: {
|
|
33
|
+
readonly RESEND_OTP: 11045;
|
|
34
|
+
readonly VALIDATE_OTP: 11047;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default WORKFLOW_CONSTANTS;
|