@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.
Files changed (311) hide show
  1. package/README.md +128 -0
  2. package/lib/api/applicationApi.d.ts +1 -0
  3. package/lib/api/applicationApi.js +11 -0
  4. package/lib/api/bankApi.d.ts +352 -0
  5. package/lib/api/bankApi.js +54 -0
  6. package/lib/api/baseApi.d.ts +6 -0
  7. package/lib/api/baseApi.js +406 -0
  8. package/lib/api/customerApi.d.ts +855 -0
  9. package/lib/api/customerApi.js +241 -0
  10. package/lib/api/fdApi.d.ts +979 -0
  11. package/lib/api/fdApi.js +112 -0
  12. package/lib/api/fdCalculatorApi.d.ts +179 -0
  13. package/lib/api/fdCalculatorApi.js +36 -0
  14. package/lib/api/index.d.ts +14 -0
  15. package/lib/api/index.js +45 -0
  16. package/lib/api/interestRateApi.d.ts +585 -0
  17. package/lib/api/interestRateApi.js +101 -0
  18. package/lib/api/kycApi.d.ts +486 -0
  19. package/lib/api/kycApi.js +71 -0
  20. package/lib/api/masterDataApi.d.ts +158 -0
  21. package/lib/api/masterDataApi.js +35 -0
  22. package/lib/api/nomineeApi.d.ts +325 -0
  23. package/lib/api/nomineeApi.js +46 -0
  24. package/lib/api/onboardingApi.d.ts +192 -0
  25. package/lib/api/onboardingApi.js +41 -0
  26. package/lib/api/panApi.d.ts +0 -0
  27. package/lib/api/panApi.js +23 -0
  28. package/lib/api/paymentApi.d.ts +325 -0
  29. package/lib/api/paymentApi.js +46 -0
  30. package/lib/api/workflowApi.d.ts +654 -0
  31. package/lib/api/workflowApi.js +90 -0
  32. package/lib/assets/images/images.d.ts +6 -0
  33. package/lib/assets/images/images.js +12 -0
  34. package/lib/components/AadhaarInput.d.ts +13 -0
  35. package/lib/components/AadhaarInput.js +47 -0
  36. package/lib/components/ActionButton.d.ts +12 -0
  37. package/lib/components/ActionButton.js +87 -0
  38. package/lib/components/ActiveFDCard.d.ts +18 -0
  39. package/lib/components/ActiveFDCard.js +116 -0
  40. package/lib/components/AmountInput.d.ts +20 -0
  41. package/lib/components/AmountInput.js +142 -0
  42. package/lib/components/CheckboxOption.d.ts +11 -0
  43. package/lib/components/CheckboxOption.js +41 -0
  44. package/lib/components/CompanyHeader.d.ts +7 -0
  45. package/lib/components/CompanyHeader.js +59 -0
  46. package/lib/components/DropdownSelector.d.ts +9 -0
  47. package/lib/components/DropdownSelector.js +49 -0
  48. package/lib/components/EmptyState.d.ts +17 -0
  49. package/lib/components/EmptyState.js +44 -0
  50. package/lib/components/ErrorDisplay.d.ts +17 -0
  51. package/lib/components/ErrorDisplay.js +69 -0
  52. package/lib/components/FAQItem.d.ts +9 -0
  53. package/lib/components/FAQItem.js +52 -0
  54. package/lib/components/FDCard.d.ts +23 -0
  55. package/lib/components/FDCard.js +116 -0
  56. package/lib/components/FormDropdown.d.ts +18 -0
  57. package/lib/components/FormDropdown.js +155 -0
  58. package/lib/components/FormSection.d.ts +14 -0
  59. package/lib/components/FormSection.js +38 -0
  60. package/lib/components/Header.d.ts +14 -0
  61. package/lib/components/Header.js +52 -0
  62. package/lib/components/IFSCSearchResultCard.d.ts +13 -0
  63. package/lib/components/IFSCSearchResultCard.js +70 -0
  64. package/lib/components/InfoBox.d.ts +8 -0
  65. package/lib/components/InfoBox.js +39 -0
  66. package/lib/components/InterestRateCard.d.ts +8 -0
  67. package/lib/components/InterestRateCard.js +46 -0
  68. package/lib/components/LoadingIndicator.d.ts +12 -0
  69. package/lib/components/LoadingIndicator.js +30 -0
  70. package/lib/components/OTPInput.d.ts +17 -0
  71. package/lib/components/OTPInput.js +144 -0
  72. package/lib/components/PaymentDetailsCard.d.ts +20 -0
  73. package/lib/components/PaymentDetailsCard.js +68 -0
  74. package/lib/components/PendingFDBottomSheet.d.ts +19 -0
  75. package/lib/components/PendingFDBottomSheet.js +122 -0
  76. package/lib/components/SafeAreaWrapper.d.ts +13 -0
  77. package/lib/components/SafeAreaWrapper.js +41 -0
  78. package/lib/components/ScreenHeader.d.ts +11 -0
  79. package/lib/components/ScreenHeader.js +46 -0
  80. package/lib/components/StatusDisplay.d.ts +15 -0
  81. package/lib/components/StatusDisplay.js +88 -0
  82. package/lib/components/TextFieldWithLabel.d.ts +46 -0
  83. package/lib/components/TextFieldWithLabel.js +326 -0
  84. package/lib/components/TrustBox.d.ts +8 -0
  85. package/lib/components/TrustBox.js +46 -0
  86. package/lib/components/ValidationErrorAlert.d.ts +23 -0
  87. package/lib/components/ValidationErrorAlert.js +39 -0
  88. package/lib/components/ValidationMessage.d.ts +9 -0
  89. package/lib/components/ValidationMessage.js +98 -0
  90. package/lib/components/index.d.ts +35 -0
  91. package/lib/components/index.js +64 -0
  92. package/lib/config/apiConfig.d.ts +34 -0
  93. package/lib/config/apiConfig.js +158 -0
  94. package/lib/config/appDataConfig.d.ts +159 -0
  95. package/lib/config/appDataConfig.js +310 -0
  96. package/lib/config/encryptionConfig.d.ts +21 -0
  97. package/lib/config/encryptionConfig.js +61 -0
  98. package/lib/config/workflowConstants.d.ts +62 -0
  99. package/lib/config/workflowConstants.js +63 -0
  100. package/lib/constants/strings/bank.d.ts +72 -0
  101. package/lib/constants/strings/bank.js +86 -0
  102. package/lib/constants/strings/base64Images.d.ts +26 -0
  103. package/lib/constants/strings/base64Images.js +29 -0
  104. package/lib/constants/strings/common.d.ts +53 -0
  105. package/lib/constants/strings/common.js +62 -0
  106. package/lib/constants/strings/employee.d.ts +61 -0
  107. package/lib/constants/strings/employee.js +77 -0
  108. package/lib/constants/strings/faq.d.ts +14 -0
  109. package/lib/constants/strings/faq.js +20 -0
  110. package/lib/constants/strings/fd.d.ts +122 -0
  111. package/lib/constants/strings/fd.js +151 -0
  112. package/lib/constants/strings/home.d.ts +49 -0
  113. package/lib/constants/strings/home.js +62 -0
  114. package/lib/constants/strings/index.d.ts +16 -0
  115. package/lib/constants/strings/index.js +44 -0
  116. package/lib/constants/strings/kyc.d.ts +80 -0
  117. package/lib/constants/strings/kyc.js +94 -0
  118. package/lib/constants/strings/nominee.d.ts +64 -0
  119. package/lib/constants/strings/nominee.js +81 -0
  120. package/lib/hooks/useAuth.d.ts +25 -0
  121. package/lib/hooks/useAuth.js +39 -0
  122. package/lib/hooks/useFDData.d.ts +11 -0
  123. package/lib/hooks/useFDData.js +40 -0
  124. package/lib/index.d.ts +48 -0
  125. package/lib/index.js +161 -0
  126. package/lib/navigation/RootNavigator.d.ts +9 -0
  127. package/lib/navigation/RootNavigator.js +459 -0
  128. package/lib/navigation/SimpleNavigator.d.ts +11 -0
  129. package/lib/navigation/SimpleNavigator.js +114 -0
  130. package/lib/navigation/helpers.d.ts +11 -0
  131. package/lib/navigation/helpers.js +83 -0
  132. package/lib/navigation/index.d.ts +17 -0
  133. package/lib/navigation/index.js +42 -0
  134. package/lib/navigation/types.d.ts +139 -0
  135. package/lib/navigation/types.js +2 -0
  136. package/lib/navigation/workflowNavigator.d.ts +22 -0
  137. package/lib/navigation/workflowNavigator.js +104 -0
  138. package/lib/providers/ApiProvider.d.ts +7 -0
  139. package/lib/providers/ApiProvider.js +16 -0
  140. package/lib/providers/MasterDataProvider.d.ts +10 -0
  141. package/lib/providers/MasterDataProvider.js +54 -0
  142. package/lib/screens/AadhaarVerification.d.ts +7 -0
  143. package/lib/screens/AadhaarVerification.js +627 -0
  144. package/lib/screens/AddBankAccount.d.ts +22 -0
  145. package/lib/screens/AddBankAccount.js +381 -0
  146. package/lib/screens/BankDetail.d.ts +16 -0
  147. package/lib/screens/BankDetail.js +596 -0
  148. package/lib/screens/Employee.d.ts +18 -0
  149. package/lib/screens/Employee.js +594 -0
  150. package/lib/screens/FDCalculator.d.ts +18 -0
  151. package/lib/screens/FDCalculator.js +767 -0
  152. package/lib/screens/FDList.d.ts +28 -0
  153. package/lib/screens/FDList.js +1853 -0
  154. package/lib/screens/FindIFSC.d.ts +16 -0
  155. package/lib/screens/FindIFSC.js +248 -0
  156. package/lib/screens/NomineeDetail.d.ts +17 -0
  157. package/lib/screens/NomineeDetail.js +592 -0
  158. package/lib/screens/PayNow.d.ts +14 -0
  159. package/lib/screens/PayNow.js +230 -0
  160. package/lib/screens/Payment.d.ts +11 -0
  161. package/lib/screens/Payment.js +191 -0
  162. package/lib/screens/PaymentStatus.d.ts +16 -0
  163. package/lib/screens/PaymentStatus.js +431 -0
  164. package/lib/screens/ReviewKYC.d.ts +23 -0
  165. package/lib/screens/ReviewKYC.js +727 -0
  166. package/lib/state/paymentSession.d.ts +8 -0
  167. package/lib/state/paymentSession.js +13 -0
  168. package/lib/store/fdListSelectedSlice.d.ts +21 -0
  169. package/lib/store/fdListSelectedSlice.js +26 -0
  170. package/lib/store/hooks.d.ts +8 -0
  171. package/lib/store/hooks.js +8 -0
  172. package/lib/store/index.d.ts +3 -0
  173. package/lib/store/index.js +8 -0
  174. package/lib/store/onboardingSlice.d.ts +12 -0
  175. package/lib/store/onboardingSlice.js +32 -0
  176. package/lib/store/store.d.ts +13 -0
  177. package/lib/store/store.js +27 -0
  178. package/lib/theme/ThemeContext.d.ts +210 -0
  179. package/lib/theme/ThemeContext.js +92 -0
  180. package/lib/theme/colors.d.ts +80 -0
  181. package/lib/theme/colors.js +85 -0
  182. package/lib/theme/index.d.ts +35 -0
  183. package/lib/theme/index.js +78 -0
  184. package/lib/theme/shadows.d.ts +53 -0
  185. package/lib/theme/shadows.js +58 -0
  186. package/lib/theme/typography.d.ts +134 -0
  187. package/lib/theme/typography.js +143 -0
  188. package/lib/types/dataTypes.d.ts +34 -0
  189. package/lib/types/dataTypes.js +2 -0
  190. package/lib/types/workflowTypes.d.ts +2 -0
  191. package/lib/types/workflowTypes.js +2 -0
  192. package/lib/utils/apiLogger.d.ts +48 -0
  193. package/lib/utils/apiLogger.js +105 -0
  194. package/lib/utils/encryption.d.ts +28 -0
  195. package/lib/utils/encryption.js +113 -0
  196. package/lib/utils/getFDData.d.ts +48 -0
  197. package/lib/utils/getFDData.js +145 -0
  198. package/lib/utils/globalData.d.ts +2 -0
  199. package/lib/utils/globalData.js +10 -0
  200. package/package.json +51 -0
  201. package/src/api/applicationApi.ts +12 -0
  202. package/src/api/bankApi.ts +42 -0
  203. package/src/api/baseApi.ts +463 -0
  204. package/src/api/customerApi.ts +324 -0
  205. package/src/api/fdApi.ts +150 -0
  206. package/src/api/fdCalculatorApi.ts +41 -0
  207. package/src/api/index.ts +29 -0
  208. package/src/api/interestRateApi.ts +143 -0
  209. package/src/api/kycApi.ts +63 -0
  210. package/src/api/masterDataApi.ts +37 -0
  211. package/src/api/nomineeApi.ts +34 -0
  212. package/src/api/onboardingApi.ts +64 -0
  213. package/src/api/panApi.ts +25 -0
  214. package/src/api/paymentApi.ts +34 -0
  215. package/src/api/workflowApi.ts +94 -0
  216. package/src/assets/images/Mahindra.png +0 -0
  217. package/src/assets/images/arrow-filled.png +0 -0
  218. package/src/assets/images/arrow-left.png +0 -0
  219. package/src/assets/images/backicon.png +0 -0
  220. package/src/assets/images/calendar.png +0 -0
  221. package/src/assets/images/chevron-down.png +0 -0
  222. package/src/assets/images/chevron-down@2x.png +0 -0
  223. package/src/assets/images/chevron-down@3x.png +0 -0
  224. package/src/assets/images/images.js +10 -0
  225. package/src/assets/images/shriram_logo.png +0 -0
  226. package/src/components/AadhaarInput.tsx +91 -0
  227. package/src/components/ActionButton.tsx +129 -0
  228. package/src/components/ActiveFDCard.tsx +188 -0
  229. package/src/components/AmountInput.tsx +217 -0
  230. package/src/components/CheckboxOption.tsx +93 -0
  231. package/src/components/CompanyHeader.tsx +80 -0
  232. package/src/components/DropdownSelector.tsx +77 -0
  233. package/src/components/EmptyState.tsx +109 -0
  234. package/src/components/ErrorDisplay.tsx +135 -0
  235. package/src/components/FAQItem.tsx +90 -0
  236. package/src/components/FDCard.tsx +186 -0
  237. package/src/components/FormDropdown.tsx +214 -0
  238. package/src/components/FormSection.tsx +86 -0
  239. package/src/components/Header.tsx +110 -0
  240. package/src/components/IFSCSearchResultCard.tsx +139 -0
  241. package/src/components/InfoBox.tsx +55 -0
  242. package/src/components/InterestRateCard.tsx +77 -0
  243. package/src/components/LoadingIndicator.tsx +63 -0
  244. package/src/components/OTPInput.tsx +213 -0
  245. package/src/components/PaymentDetailsCard.tsx +120 -0
  246. package/src/components/PendingFDBottomSheet.tsx +237 -0
  247. package/src/components/README.md +210 -0
  248. package/src/components/SafeAreaWrapper.tsx +68 -0
  249. package/src/components/ScreenHeader.tsx +83 -0
  250. package/src/components/StatusDisplay.tsx +139 -0
  251. package/src/components/TextFieldWithLabel.tsx +502 -0
  252. package/src/components/TrustBox.tsx +63 -0
  253. package/src/components/ValidationErrorAlert.tsx +57 -0
  254. package/src/components/ValidationMessage.tsx +134 -0
  255. package/src/components/index.tsx +47 -0
  256. package/src/config/apiConfig.ts +217 -0
  257. package/src/config/appDataConfig.ts +358 -0
  258. package/src/config/encryptionConfig.ts +65 -0
  259. package/src/config/workflowConstants.ts +70 -0
  260. package/src/constants/strings/README.md +146 -0
  261. package/src/constants/strings/bank.ts +92 -0
  262. package/src/constants/strings/base64Images.ts +31 -0
  263. package/src/constants/strings/common.ts +63 -0
  264. package/src/constants/strings/employee.ts +85 -0
  265. package/src/constants/strings/faq.ts +23 -0
  266. package/src/constants/strings/fd.ts +172 -0
  267. package/src/constants/strings/home.ts +67 -0
  268. package/src/constants/strings/index.ts +21 -0
  269. package/src/constants/strings/kyc.ts +100 -0
  270. package/src/constants/strings/nominee.ts +90 -0
  271. package/src/hooks/useAuth.ts +42 -0
  272. package/src/hooks/useFDData.ts +48 -0
  273. package/src/index.tsx +139 -0
  274. package/src/navigation/RootNavigator.tsx +687 -0
  275. package/src/navigation/SimpleNavigator.tsx +123 -0
  276. package/src/navigation/helpers.ts +85 -0
  277. package/src/navigation/index.tsx +84 -0
  278. package/src/navigation/types.ts +146 -0
  279. package/src/navigation/workflowNavigator.ts +131 -0
  280. package/src/providers/ApiProvider.tsx +23 -0
  281. package/src/providers/MasterDataProvider.tsx +30 -0
  282. package/src/screens/AadhaarVerification.tsx +809 -0
  283. package/src/screens/AddBankAccount.tsx +541 -0
  284. package/src/screens/BankDetail.tsx +826 -0
  285. package/src/screens/Employee.tsx +822 -0
  286. package/src/screens/FDCalculator.tsx +1002 -0
  287. package/src/screens/FDList.tsx +2199 -0
  288. package/src/screens/FindIFSC.tsx +332 -0
  289. package/src/screens/NomineeDetail.tsx +800 -0
  290. package/src/screens/PayNow.tsx +282 -0
  291. package/src/screens/Payment.tsx +224 -0
  292. package/src/screens/PaymentStatus.tsx +595 -0
  293. package/src/screens/ReviewKYC.tsx +1062 -0
  294. package/src/state/paymentSession.ts +13 -0
  295. package/src/store/fdListSelectedSlice.ts +42 -0
  296. package/src/store/hooks.ts +6 -0
  297. package/src/store/index.ts +3 -0
  298. package/src/store/onboardingSlice.ts +37 -0
  299. package/src/store/store.ts +27 -0
  300. package/src/theme/ThemeContext.tsx +84 -0
  301. package/src/theme/colors.ts +90 -0
  302. package/src/theme/index.ts +85 -0
  303. package/src/theme/shadows.ts +61 -0
  304. package/src/theme/typography.ts +151 -0
  305. package/src/types/dataTypes.ts +37 -0
  306. package/src/types/env.d.ts +93 -0
  307. package/src/types/workflowTypes.ts +12 -0
  308. package/src/utils/apiLogger.ts +166 -0
  309. package/src/utils/encryption.ts +159 -0
  310. package/src/utils/getFDData.ts +165 -0
  311. package/src/utils/globalData.ts +7 -0
@@ -0,0 +1,358 @@
1
+ // AppData Configuration - Data received from main app when SDK starts
2
+
3
+ export interface EnvironmentData {
4
+ environment: string;
5
+ apiBaseUrl?: string;
6
+ apiKey?: string;
7
+ encryptionKey?: string;
8
+ enableLogging?: boolean;
9
+ }
10
+
11
+ export interface AppData {
12
+ // Required user identification fields
13
+ id: string; // Required: User ID from main app
14
+ name: string; // Required: User full name
15
+ dob: string; // Required: Date of birth in YYYY-MM-DD format
16
+ gender?: string | null; // Optional: Male, Female (initial state may be null)
17
+ mobNo: string; // Required: Mobile number (10 digits)
18
+ email: string; // Required: Email address
19
+ panNumber?: string; // Optional: PAN can be collected later in provider SDK flow
20
+
21
+ // Optional fields - can be collected in SDK if not provided
22
+ address?: string;
23
+ area?: string;
24
+ city?: string;
25
+ state?: string;
26
+ country?: string;
27
+ pinCode?: string;
28
+ accountNo?: string;
29
+ nameOfBank?: string;
30
+ ifsc?: string;
31
+ typeOfAccount?: string; // Optional: Savings, Current, Fixed Deposit, Recurring Deposit
32
+ maritalStatus?: string; // Optional: Single, Married, Divorced, Widowed
33
+ userReferenceId?: string; // Optional: User reference ID from main app
34
+ eventNotifyUrl?: string;
35
+ kycRelation?: string;
36
+ kycRelationName?: string;
37
+ // Optional powered-by logo URI/base64 for FDList header branding
38
+ poweredByLogo?: string;
39
+ }
40
+
41
+ // Global app data storage
42
+ let globalAppData: AppData | null = null;
43
+
44
+ // Global environment data storage
45
+ let globalEnvironmentData: EnvironmentData | null = null;
46
+
47
+ // Global custom color overrides for theming
48
+ export interface CustomColors {
49
+ primary?: string;
50
+ tabSelected?: string;
51
+ headerBg?: string;
52
+ headerText?: string;
53
+ success?: string;
54
+ textSecondary?: string;
55
+ border?: string;
56
+ shadow?: string;
57
+ background?: string;
58
+ surface?: string;
59
+ text?: string;
60
+ textLight?: string;
61
+ error?: string;
62
+ warning?: string;
63
+ info?: string;
64
+ muted?: string;
65
+ inputBackground?: string;
66
+ inputBorder?: string;
67
+ placeholderColor?: string;
68
+ labelColor?: string;
69
+ buttonBackground?: string;
70
+ buttonTextColor?: string;
71
+ cancelButtonBg?: string;
72
+ }
73
+
74
+ let globalCustomColors: CustomColors | null = null;
75
+
76
+ /**
77
+ * Initialize the SDK with app data from the main application
78
+ * This should be called when the SDK starts
79
+ */
80
+ export const initializeSDK = (appData: AppData, onValidationError?: (errors: string[]) => void): void => {
81
+ // Validate required user identification fields
82
+ const requiredFields = [
83
+ { field: 'id', label: 'User ID' },
84
+ { field: 'name', label: 'User Name' },
85
+ { field: 'dob', label: 'Date of Birth' },
86
+ { field: 'gender', label: 'Gender' },
87
+ { field: 'mobNo', label: 'Mobile Number' },
88
+ { field: 'email', label: 'Email' },
89
+ ];
90
+
91
+ const missingFields: string[] = [];
92
+
93
+ requiredFields.forEach(({ field, label }) => {
94
+ const value = (appData as any)[field];
95
+ if (!value || (typeof value === 'string' && !value.trim())) {
96
+ missingFields.push(label);
97
+ }
98
+ });
99
+
100
+ // If required fields are missing, call error handler
101
+ if (missingFields.length > 0) {
102
+ const errorMessage = `Missing required user information from main app:\n${missingFields.join(', ')}`;
103
+
104
+ if (onValidationError) {
105
+ onValidationError(missingFields);
106
+ }
107
+
108
+ throw new Error(errorMessage);
109
+ }
110
+
111
+ // Validate all fields
112
+ const validation = validateAppData(appData);
113
+ if (!validation.isValid) {
114
+ if (onValidationError) {
115
+ onValidationError(validation.errors);
116
+ }
117
+
118
+ throw new Error(`App data validation failed: ${validation.errors.join(', ')}`);
119
+ }
120
+
121
+ globalAppData = appData;
122
+
123
+ // SDK initialization started
124
+ try {
125
+ // logging removed
126
+ } catch { }
127
+
128
+ // Import and call environment logging
129
+ import('./apiConfig').then(({ logEnvironmentInfo }) => {
130
+ logEnvironmentInfo();
131
+ });
132
+ };
133
+
134
+ /**
135
+ * Initialize the SDK with environment configuration from the main application
136
+ * This should be called to configure SDK environment settings
137
+ */
138
+ export const initializeEnvironment = (environmentData: EnvironmentData): void => {
139
+ globalEnvironmentData = environmentData;
140
+
141
+ // Environment initialization started
142
+ try {
143
+ // logging removed
144
+ } catch { }
145
+
146
+ // Environment initialized
147
+ };
148
+
149
+ /**
150
+ * Get the current app data
151
+ */
152
+ export const getAppData = (): AppData | null => {
153
+ return globalAppData;
154
+ };
155
+
156
+ /**
157
+ * Get the current environment data
158
+ */
159
+ export const getEnvironmentData = (): EnvironmentData | null => {
160
+ return globalEnvironmentData;
161
+ };
162
+
163
+ /**
164
+ * Check if SDK is initialized with app data
165
+ */
166
+ export const isSDKInitialized = (): boolean => {
167
+ return globalAppData !== null;
168
+ };
169
+
170
+ /**
171
+ * Check if environment is initialized
172
+ */
173
+ export const isEnvironmentInitialized = (): boolean => {
174
+ return globalEnvironmentData !== null;
175
+ };
176
+
177
+ /**
178
+ * Get specific user information for API requests
179
+ */
180
+ export const getUserInfoForAPI = () => {
181
+ if (!globalAppData) {
182
+ throw new Error('SDK not initialized. Call initializeSDK() first.');
183
+ }
184
+
185
+ return {
186
+ id: globalAppData.id,
187
+ name: globalAppData.name,
188
+ dob: globalAppData.dob,
189
+ gender: globalAppData.gender,
190
+ panNumber: globalAppData.panNumber,
191
+ mobileNumber: globalAppData.mobNo,
192
+ email: globalAppData.email,
193
+ eventNotifyUrl: globalAppData.eventNotifyUrl,
194
+ userReferenceId: globalAppData.id, // Use userReferenceId or fallback to id
195
+ address: {
196
+ line1: globalAppData.address,
197
+ area: globalAppData.area,
198
+ city: globalAppData.city,
199
+ state: globalAppData.state,
200
+ country: globalAppData.country,
201
+ pinCode: globalAppData.pinCode,
202
+ },
203
+ bankDetails: {
204
+ accountNumber: globalAppData.accountNo,
205
+ bankName: globalAppData.nameOfBank,
206
+ ifsc: globalAppData.ifsc,
207
+ accountType: globalAppData.typeOfAccount,
208
+ },
209
+ maritalStatus: globalAppData.maritalStatus,
210
+ };
211
+ };
212
+
213
+ /**
214
+ * Get user demographics for interest rate calculations
215
+ */
216
+ export const getUserDemographics = () => {
217
+ if (!globalAppData) {
218
+ throw new Error('SDK not initialized. Call initializeSDK() first.');
219
+ }
220
+
221
+ // Calculate age from DOB
222
+ const calculateAge = (dob: string): number => {
223
+ const today = new Date();
224
+ const birthDate = new Date(dob);
225
+ let age = today.getFullYear() - birthDate.getFullYear();
226
+ const monthDiff = today.getMonth() - birthDate.getMonth();
227
+
228
+ if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
229
+ age--;
230
+ }
231
+
232
+ return age;
233
+ };
234
+
235
+ const age = calculateAge(globalAppData.dob);
236
+ const isSeniorCitizen = age >= 60;
237
+ const isWomenDepositor = globalAppData.gender === 'Female' || globalAppData.gender === 'female';
238
+
239
+ return {
240
+ age,
241
+ isSeniorCitizen,
242
+ isWomenDepositor,
243
+ gender: globalAppData.gender,
244
+ maritalStatus: globalAppData.maritalStatus,
245
+ dob: globalAppData.dob,
246
+ };
247
+ };
248
+
249
+ /**
250
+ * Validate app data
251
+ */
252
+ export const validateAppData = (appData: AppData): { isValid: boolean; errors: string[] } => {
253
+ const errors: string[] = [];
254
+
255
+ // Required fields validation
256
+ if (!appData.id?.trim()) errors.push('ID is required');
257
+ if (!appData.name?.trim()) errors.push('Name is required');
258
+ if (!appData.dob?.trim()) errors.push('Date of birth is required');
259
+ if (!appData.gender) errors.push('Gender is required');
260
+ if (!appData.mobNo?.trim()) errors.push('Mobile number is required');
261
+ if (!appData.email?.trim()) errors.push('Email is required');
262
+
263
+ // Format validation (only if fields are provided)
264
+ if (appData.dob && !/^\d{4}-\d{2}-\d{2}$/.test(appData.dob)) {
265
+ errors.push('Date of birth must be in YYYY-MM-DD format');
266
+ }
267
+
268
+ if (appData.panNumber && appData.panNumber.trim() && !/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(appData.panNumber)) {
269
+ errors.push('PAN number must be in valid format (e.g., ABCDE1234F)');
270
+ }
271
+
272
+ if (appData.mobNo && !/^[6-9]\d{9}$/.test(appData.mobNo)) {
273
+ errors.push('Mobile number must be 10 digits starting with 6-9');
274
+ }
275
+
276
+ if (appData.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(appData.email)) {
277
+ errors.push('Email must be in valid format');
278
+ }
279
+
280
+ if (appData.ifsc && appData.ifsc.trim() && !/^[A-Z]{4}0[A-Z0-9]{6}$/.test(appData.ifsc)) {
281
+ errors.push('IFSC code must be in valid format (e.g., SBIN0001234)');
282
+ }
283
+
284
+ return {
285
+ isValid: errors.length === 0,
286
+ errors,
287
+ };
288
+ };
289
+
290
+ /**
291
+ * Clear app data (for testing or logout scenarios)
292
+ */
293
+ export const clearAppData = (): void => {
294
+ globalAppData = null;
295
+ };
296
+
297
+ /**
298
+ * Clear environment data (for testing or logout scenarios)
299
+ */
300
+ export const clearEnvironmentData = (): void => {
301
+ globalEnvironmentData = null;
302
+ };
303
+
304
+ /**
305
+ * Clear all data (app data and environment data)
306
+ */
307
+ export const clearAllData = (): void => {
308
+ globalAppData = null;
309
+ globalEnvironmentData = null;
310
+ globalCustomColors = null;
311
+ };
312
+
313
+ /**
314
+ * Set custom color overrides for the SDK theme.
315
+ * Colors defined here will override the corresponding color from the selected theme (primary/dark/etc).
316
+ * Call this before rendering the FDSDK navigator.
317
+ *
318
+ * This also forwards the same colors to Shriram and Mahindra SDKs when they are installed,
319
+ * so a single call centralizes theming across all SDKs.
320
+ */
321
+ export const setSDKColors = (customColors: CustomColors): void => {
322
+ globalCustomColors = customColors;
323
+
324
+ // Best-effort: propagate to external SDKs when they are available
325
+ try {
326
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
327
+ const shriram = require('@finspringinnovations/shriramsdk');
328
+ if (shriram && typeof shriram.setSDKColors === 'function') {
329
+ shriram.setSDKColors(customColors);
330
+ }
331
+ } catch {
332
+ // Ignore if Shriram SDK is not installed
333
+ }
334
+
335
+ try {
336
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
337
+ const mahindra = require('@finspringinnovations/mahindrasdk');
338
+ if (mahindra && typeof mahindra.setSDKColors === 'function') {
339
+ mahindra.setSDKColors(customColors);
340
+ }
341
+ } catch {
342
+ // Ignore if Mahindra SDK is not installed
343
+ }
344
+ };
345
+
346
+ /**
347
+ * Get the current custom color overrides
348
+ */
349
+ export const getSDKColors = (): CustomColors | null => {
350
+ return globalCustomColors;
351
+ };
352
+
353
+ /**
354
+ * Clear custom color overrides
355
+ */
356
+ export const clearSDKColors = (): void => {
357
+ globalCustomColors = null;
358
+ };
@@ -0,0 +1,65 @@
1
+ import { EncryptionConfig } from '../utils/encryption';
2
+ import { getEnvironmentData } from './appDataConfig';
3
+
4
+ //Encryption configuration from environment data
5
+ export const getEncryptionConfig = (): EncryptionConfig => {
6
+ const environmentData = getEnvironmentData();
7
+
8
+ // Use environment data if available
9
+ if (environmentData?.encryptionKey) {
10
+ return {
11
+ secretKey: environmentData.encryptionKey,
12
+ algorithm: 'AES',
13
+ ivLength: 16,
14
+ };
15
+ }
16
+
17
+ // If no environment data, throw error to ensure proper initialization
18
+ throw new Error('Environment data not initialized. Call initializeEnvironment() first.');
19
+ };
20
+
21
+ // Configuration for different environments - using environment data
22
+ export const getEncryptionConfigs = () => {
23
+ const environmentData = getEnvironmentData();
24
+
25
+ if (!environmentData?.encryptionKey) {
26
+ throw new Error('Environment data not initialized. Call initializeEnvironment() first.');
27
+ }
28
+
29
+ return {
30
+ development: {
31
+ secretKey: environmentData.encryptionKey,
32
+ algorithm: 'AES' as const,
33
+ ivLength: 16,
34
+ },
35
+ staging: {
36
+ secretKey: environmentData.encryptionKey,
37
+ algorithm: 'AES' as const,
38
+ ivLength: 16,
39
+ },
40
+ production: {
41
+ secretKey: environmentData.encryptionKey,
42
+ algorithm: 'AES' as const,
43
+ ivLength: 16,
44
+ },
45
+ };
46
+ };
47
+
48
+ // Get configuration based on environment
49
+ export const getEnvironmentConfig = (env: 'development' | 'staging' | 'production' = 'development'): EncryptionConfig => {
50
+ const configs = getEncryptionConfigs();
51
+ return configs[env];
52
+ };
53
+
54
+ // Validate encryption configuration
55
+ export const validateEncryptionConfig = (config: EncryptionConfig): boolean => {
56
+ if (!config.secretKey || config.secretKey.length < 16) {
57
+ return false;
58
+ }
59
+
60
+ if (config.ivLength && (config.ivLength < 8 || config.ivLength > 32)) {
61
+ return false;
62
+ }
63
+
64
+ return true;
65
+ };
@@ -0,0 +1,70 @@
1
+ // Workflow State Constants
2
+ export const WORKFLOW_STATES = {
3
+ INITIATION: 404,
4
+ START: 405,
5
+ KYC: 406,
6
+ OCCUPATION: 409,
7
+ NOMINEE: 407,
8
+ BANK_DETAILS: 408,
9
+ CREATE_FD: 411,
10
+ PAYMENT: 410,
11
+ END: 403,
12
+ } as const;
13
+
14
+ export const SHRIRAM_WORKFLOW_STATES = {
15
+ INITIATION: 404,
16
+ START: 405,
17
+ KYC: 406,
18
+ OCCUPATION: 409,
19
+ NOMINEE: 407,
20
+ BANK_DETAILS: 408,
21
+ CREATE_FD: 411,
22
+ PAYMENT: 410,
23
+ END: 403,
24
+ } as const;
25
+
26
+ export const MAHINDRA_WORKFLOW_STATES = {
27
+ INITIATION: 404,
28
+ START: 405,
29
+ KYC: 444,
30
+ OCCUPATION: 447,
31
+ NOMINEE: 448,
32
+ BANK_DETAILS: 449,
33
+ CREATE_FD: 411,
34
+ PAYMENT: 450,
35
+ END: 403,
36
+ AADHAAR_VERIFICATION: 451,
37
+ /** KYC completed / post-KYC success – open KYCSuccess (Pay Now) */
38
+ KYC_SUCCESS: 446,
39
+ } as const;
40
+
41
+ // Workflow Task Constants
42
+ export const WORKFLOW_TASKS = {
43
+ RESEND_OTP: 11045,
44
+ VALIDATE_OTP: 11047,
45
+ } as const;
46
+
47
+ // Type definitions for TypeScript
48
+ export type WorkflowState = typeof WORKFLOW_STATES[keyof typeof WORKFLOW_STATES];
49
+ export type WorkflowTask = typeof WORKFLOW_TASKS[keyof typeof WORKFLOW_TASKS];
50
+
51
+ // Helper function to get workflow state name
52
+ export const getWorkflowStateName = (stateId: number): string | undefined => {
53
+ const entry = Object.entries(WORKFLOW_STATES).find(([_, value]) => value === stateId);
54
+ return entry ? entry[0] : undefined;
55
+ };
56
+
57
+ // Helper function to get workflow task name
58
+ export const getWorkflowTaskName = (taskId: number): string | undefined => {
59
+ const entry = Object.entries(WORKFLOW_TASKS).find(([_, value]) => value === taskId);
60
+ return entry ? entry[0] : undefined;
61
+ };
62
+
63
+ // Export all as a single object for convenience
64
+ export const WORKFLOW_CONSTANTS = {
65
+ STATES: WORKFLOW_STATES,
66
+ TASKS: WORKFLOW_TASKS,
67
+ } as const;
68
+
69
+ export default WORKFLOW_CONSTANTS;
70
+
@@ -0,0 +1,146 @@
1
+ # String Constants
2
+
3
+ This folder contains all string literals and text constants used throughout the FD SDK application. This approach provides better maintainability, consistency, and makes it easier to update text across the application.
4
+
5
+ ## Folder Structure
6
+
7
+ ```
8
+ src/constants/strings/
9
+ ├── common.ts # Common strings used across the app
10
+ ├── login.ts # Login and authentication strings
11
+ ├── home.ts # Home screen and navigation strings
12
+ ├── kyc.ts # KYC and verification strings
13
+ ├── employee.ts # Employee and occupation strings
14
+ ├── bank.ts # Bank and payment strings
15
+ ├── nominee.ts # Nominee related strings
16
+ ├── fd.ts # Fixed Deposit related strings
17
+ ├── index.ts # Central export file
18
+ └── README.md # This documentation
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Import Individual String Groups
24
+
25
+ ```typescript
26
+ import { COMMON_STRINGS, KYC_STRINGS } from '../constants/strings';
27
+
28
+ // Use in components
29
+ <Text>{COMMON_STRINGS.CONTINUE}</Text>
30
+ <Text>{KYC_STRINGS.PAN_CARD_LABEL}</Text>
31
+ ```
32
+
33
+ ### Import All Strings
34
+
35
+ ```typescript
36
+ import { COMMON_STRINGS, KYC_STRINGS, EMPLOYEE_STRINGS } from '../constants/strings';
37
+ ```
38
+
39
+ ### Import from Index
40
+
41
+ ```typescript
42
+ import { COMMON_STRINGS, KYC_STRINGS } from '../constants/strings/index';
43
+ ```
44
+
45
+ ## String Categories
46
+
47
+ ### Common Strings (`common.ts`)
48
+ - Button labels (Continue, Save, Cancel, etc.)
49
+ - Status messages (Success, Error, Failed, etc.)
50
+ - Validation messages
51
+ - General UI text
52
+
53
+ ### Login Strings (`login.ts`)
54
+ - Login form labels and placeholders
55
+ - Authentication messages
56
+ - Password reset flow
57
+ - OTP verification
58
+
59
+ ### Home Strings (`home.ts`)
60
+ - Navigation items
61
+ - Welcome messages
62
+ - Quick actions
63
+ - Status indicators
64
+
65
+ ### KYC Strings (`kyc.ts`)
66
+ - KYC form labels and placeholders
67
+ - Verification messages
68
+ - Marital status options
69
+ - Validation messages
70
+
71
+ ### Employee Strings (`employee.ts`)
72
+ - Occupation form labels
73
+ - Income options
74
+ - Source of fund options
75
+ - Politically exposed person options
76
+
77
+ ### Bank Strings (`bank.ts`)
78
+ - Bank account form labels
79
+ - Account types
80
+ - Payment status messages
81
+ - IFSC verification
82
+
83
+ ### Nominee Strings (`nominee.ts`)
84
+ - Nominee form labels
85
+ - Relationship options
86
+ - Title options
87
+ - Nomination instructions
88
+
89
+ ### FD Strings (`fd.ts`)
90
+ - FD calculator labels
91
+ - Deposit schemes
92
+ - Tenure options
93
+ - Maturity instructions
94
+
95
+ ## Benefits
96
+
97
+ 1. **Consistency**: All text is centralized and consistent across the app
98
+ 2. **Maintainability**: Easy to update text without searching through multiple files
99
+ 3. **Type Safety**: TypeScript provides autocomplete and type checking
100
+ 4. **Reusability**: Strings can be reused across different components
101
+ 5. **Organization**: Related strings are grouped logically
102
+ 6. **Future Localization**: Easy to add localization support later
103
+
104
+ ## Best Practices
105
+
106
+ 1. **Use Descriptive Names**: String keys should clearly indicate their purpose
107
+ 2. **Group Related Strings**: Keep related strings in the same file
108
+ 3. **Use Constants**: All strings are exported as const for immutability
109
+ 4. **Consistent Naming**: Use UPPER_SNAKE_CASE for string keys
110
+ 5. **Add New Strings**: When adding new strings, place them in the appropriate category file
111
+
112
+ ## Adding New Strings
113
+
114
+ 1. Identify the appropriate category file
115
+ 2. Add the new string with a descriptive key
116
+ 3. Export it in the index.ts file if needed
117
+ 4. Use the string in your components
118
+
119
+ Example:
120
+ ```typescript
121
+ // In kyc.ts
122
+ export const KYC_STRINGS = {
123
+ // ... existing strings
124
+ NEW_FIELD_LABEL: 'New Field Label',
125
+ } as const;
126
+ ```
127
+
128
+ ## Migration Guide
129
+
130
+ To migrate existing hardcoded strings:
131
+
132
+ 1. Find hardcoded strings in your components
133
+ 2. Add them to the appropriate string file
134
+ 3. Import the string constant
135
+ 4. Replace the hardcoded string with the constant
136
+
137
+ Before:
138
+ ```typescript
139
+ <Text>Continue</Text>
140
+ ```
141
+
142
+ After:
143
+ ```typescript
144
+ import { COMMON_STRINGS } from '../constants/strings';
145
+ <Text>{COMMON_STRINGS.CONTINUE}</Text>
146
+ ```