@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.
Files changed (315) hide show
  1. package/README.md +184 -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 +8 -0
  7. package/lib/api/baseApi.js +456 -0
  8. package/lib/api/customerApi.d.ts +855 -0
  9. package/lib/api/customerApi.js +213 -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 +32 -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 +4 -0
  33. package/lib/assets/images/images.js +10 -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 +16 -0
  39. package/lib/components/ActiveFDCard.js +95 -0
  40. package/lib/components/AmountInput.d.ts +20 -0
  41. package/lib/components/AmountInput.js +144 -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 +57 -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 +21 -0
  55. package/lib/components/FDCard.js +96 -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 +18 -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 +45 -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 +114 -0
  95. package/lib/config/appDataConfig.js +264 -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 +37 -0
  99. package/lib/config/workflowConstants.js +38 -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 +25 -0
  103. package/lib/constants/strings/base64Images.js +28 -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 +69 -0
  125. package/lib/index.js +182 -0
  126. package/lib/navigation/RootNavigator.d.ts +8 -0
  127. package/lib/navigation/RootNavigator.js +205 -0
  128. package/lib/navigation/SimpleNavigator.d.ts +11 -0
  129. package/lib/navigation/SimpleNavigator.js +107 -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 +15 -0
  133. package/lib/navigation/index.js +42 -0
  134. package/lib/navigation/types.d.ts +113 -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 +34 -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/BookFD.d.ts +0 -0
  149. package/lib/screens/BookFD.js +315 -0
  150. package/lib/screens/Employee.d.ts +18 -0
  151. package/lib/screens/Employee.js +594 -0
  152. package/lib/screens/FDCalculator.d.ts +18 -0
  153. package/lib/screens/FDCalculator.js +759 -0
  154. package/lib/screens/FDList.d.ts +27 -0
  155. package/lib/screens/FDList.js +1008 -0
  156. package/lib/screens/FindIFSC.d.ts +16 -0
  157. package/lib/screens/FindIFSC.js +248 -0
  158. package/lib/screens/Home.d.ts +0 -0
  159. package/lib/screens/Home.js +143 -0
  160. package/lib/screens/NomineeDetail.d.ts +17 -0
  161. package/lib/screens/NomineeDetail.js +592 -0
  162. package/lib/screens/PayNow.d.ts +14 -0
  163. package/lib/screens/PayNow.js +230 -0
  164. package/lib/screens/Payment.d.ts +11 -0
  165. package/lib/screens/Payment.js +191 -0
  166. package/lib/screens/PaymentStatus.d.ts +16 -0
  167. package/lib/screens/PaymentStatus.js +397 -0
  168. package/lib/screens/ReviewKYC.d.ts +21 -0
  169. package/lib/screens/ReviewKYC.js +660 -0
  170. package/lib/state/paymentSession.d.ts +8 -0
  171. package/lib/state/paymentSession.js +13 -0
  172. package/lib/store/fdListSelectedSlice.d.ts +21 -0
  173. package/lib/store/fdListSelectedSlice.js +26 -0
  174. package/lib/store/hooks.d.ts +8 -0
  175. package/lib/store/hooks.js +31 -0
  176. package/lib/store/index.d.ts +3 -0
  177. package/lib/store/index.js +8 -0
  178. package/lib/store/onboardingSlice.d.ts +12 -0
  179. package/lib/store/onboardingSlice.js +32 -0
  180. package/lib/store/store.d.ts +13 -0
  181. package/lib/store/store.js +33 -0
  182. package/lib/theme/ThemeContext.d.ts +210 -0
  183. package/lib/theme/ThemeContext.js +90 -0
  184. package/lib/theme/colors.d.ts +80 -0
  185. package/lib/theme/colors.js +85 -0
  186. package/lib/theme/index.d.ts +34 -0
  187. package/lib/theme/index.js +69 -0
  188. package/lib/theme/shadows.d.ts +53 -0
  189. package/lib/theme/shadows.js +58 -0
  190. package/lib/theme/typography.d.ts +134 -0
  191. package/lib/theme/typography.js +143 -0
  192. package/lib/types/dataTypes.d.ts +34 -0
  193. package/lib/types/dataTypes.js +2 -0
  194. package/lib/types/workflowTypes.d.ts +2 -0
  195. package/lib/types/workflowTypes.js +2 -0
  196. package/lib/utils/apiLogger.d.ts +48 -0
  197. package/lib/utils/apiLogger.js +105 -0
  198. package/lib/utils/encryption.d.ts +28 -0
  199. package/lib/utils/encryption.js +113 -0
  200. package/lib/utils/getFDData.d.ts +48 -0
  201. package/lib/utils/getFDData.js +154 -0
  202. package/lib/utils/globalData.d.ts +2 -0
  203. package/lib/utils/globalData.js +10 -0
  204. package/package.json +76 -0
  205. package/src/api/applicationApi.ts +12 -0
  206. package/src/api/bankApi.ts +42 -0
  207. package/src/api/baseApi.ts +513 -0
  208. package/src/api/customerApi.ts +291 -0
  209. package/src/api/fdApi.ts +150 -0
  210. package/src/api/fdCalculatorApi.ts +41 -0
  211. package/src/api/index.ts +29 -0
  212. package/src/api/interestRateApi.ts +143 -0
  213. package/src/api/kycApi.ts +63 -0
  214. package/src/api/masterDataApi.ts +34 -0
  215. package/src/api/nomineeApi.ts +34 -0
  216. package/src/api/onboardingApi.ts +64 -0
  217. package/src/api/panApi.ts +25 -0
  218. package/src/api/paymentApi.ts +34 -0
  219. package/src/api/workflowApi.ts +94 -0
  220. package/src/assets/images/arrow-filled.png +0 -0
  221. package/src/assets/images/arrow-left.png +0 -0
  222. package/src/assets/images/backicon.png +0 -0
  223. package/src/assets/images/calendar.png +0 -0
  224. package/src/assets/images/chevron-down.png +0 -0
  225. package/src/assets/images/chevron-down@2x.png +0 -0
  226. package/src/assets/images/chevron-down@3x.png +0 -0
  227. package/src/assets/images/images.js +8 -0
  228. package/src/components/AadhaarInput.tsx +91 -0
  229. package/src/components/ActionButton.tsx +129 -0
  230. package/src/components/ActiveFDCard.tsx +158 -0
  231. package/src/components/AmountInput.tsx +217 -0
  232. package/src/components/CheckboxOption.tsx +93 -0
  233. package/src/components/CompanyHeader.tsx +78 -0
  234. package/src/components/DropdownSelector.tsx +77 -0
  235. package/src/components/EmptyState.tsx +109 -0
  236. package/src/components/ErrorDisplay.tsx +135 -0
  237. package/src/components/FAQItem.tsx +90 -0
  238. package/src/components/FDCard.tsx +165 -0
  239. package/src/components/FormDropdown.tsx +214 -0
  240. package/src/components/FormSection.tsx +86 -0
  241. package/src/components/Header.tsx +110 -0
  242. package/src/components/IFSCSearchResultCard.tsx +139 -0
  243. package/src/components/InfoBox.tsx +55 -0
  244. package/src/components/InterestRateCard.tsx +77 -0
  245. package/src/components/LoadingIndicator.tsx +63 -0
  246. package/src/components/OTPInput.tsx +213 -0
  247. package/src/components/PaymentDetailsCard.tsx +120 -0
  248. package/src/components/PendingFDBottomSheet.tsx +235 -0
  249. package/src/components/README.md +210 -0
  250. package/src/components/SafeAreaWrapper.tsx +68 -0
  251. package/src/components/ScreenHeader.tsx +83 -0
  252. package/src/components/StatusDisplay.tsx +139 -0
  253. package/src/components/TextFieldWithLabel.tsx +502 -0
  254. package/src/components/TrustBox.tsx +63 -0
  255. package/src/components/ValidationErrorAlert.tsx +57 -0
  256. package/src/components/ValidationMessage.tsx +134 -0
  257. package/src/components/index.tsx +47 -0
  258. package/src/config/apiConfig.ts +217 -0
  259. package/src/config/appDataConfig.ts +279 -0
  260. package/src/config/encryptionConfig.ts +65 -0
  261. package/src/config/workflowConstants.ts +43 -0
  262. package/src/constants/strings/README.md +146 -0
  263. package/src/constants/strings/bank.ts +92 -0
  264. package/src/constants/strings/base64Images.ts +29 -0
  265. package/src/constants/strings/common.ts +63 -0
  266. package/src/constants/strings/employee.ts +85 -0
  267. package/src/constants/strings/faq.ts +23 -0
  268. package/src/constants/strings/fd.ts +172 -0
  269. package/src/constants/strings/home.ts +67 -0
  270. package/src/constants/strings/index.ts +21 -0
  271. package/src/constants/strings/kyc.ts +100 -0
  272. package/src/constants/strings/nominee.ts +90 -0
  273. package/src/hooks/useAuth.ts +42 -0
  274. package/src/hooks/useFDData.ts +48 -0
  275. package/src/index.tsx +173 -0
  276. package/src/navigation/RootNavigator.tsx +352 -0
  277. package/src/navigation/SimpleNavigator.tsx +107 -0
  278. package/src/navigation/helpers.ts +85 -0
  279. package/src/navigation/index.tsx +81 -0
  280. package/src/navigation/types.ts +124 -0
  281. package/src/navigation/workflowNavigator.ts +131 -0
  282. package/src/providers/ApiProvider.tsx +43 -0
  283. package/src/providers/MasterDataProvider.tsx +30 -0
  284. package/src/screens/AadhaarVerification.tsx +809 -0
  285. package/src/screens/AddBankAccount.tsx +541 -0
  286. package/src/screens/BankDetail.tsx +826 -0
  287. package/src/screens/BookFD.tsx +330 -0
  288. package/src/screens/Employee.tsx +822 -0
  289. package/src/screens/FDCalculator.tsx +987 -0
  290. package/src/screens/FDList.tsx +1284 -0
  291. package/src/screens/FindIFSC.tsx +332 -0
  292. package/src/screens/Home.tsx +152 -0
  293. package/src/screens/NomineeDetail.tsx +800 -0
  294. package/src/screens/PayNow.tsx +282 -0
  295. package/src/screens/Payment.tsx +224 -0
  296. package/src/screens/PaymentStatus.tsx +561 -0
  297. package/src/screens/ReviewKYC.tsx +956 -0
  298. package/src/state/paymentSession.ts +13 -0
  299. package/src/store/fdListSelectedSlice.ts +42 -0
  300. package/src/store/hooks.ts +27 -0
  301. package/src/store/index.ts +3 -0
  302. package/src/store/onboardingSlice.ts +37 -0
  303. package/src/store/store.ts +35 -0
  304. package/src/theme/ThemeContext.tsx +82 -0
  305. package/src/theme/colors.ts +90 -0
  306. package/src/theme/index.ts +64 -0
  307. package/src/theme/shadows.ts +61 -0
  308. package/src/theme/typography.ts +151 -0
  309. package/src/types/dataTypes.ts +37 -0
  310. package/src/types/env.d.ts +93 -0
  311. package/src/types/workflowTypes.ts +12 -0
  312. package/src/utils/apiLogger.ts +166 -0
  313. package/src/utils/encryption.ts +159 -0
  314. package/src/utils/getFDData.ts +175 -0
  315. package/src/utils/globalData.ts +7 -0
@@ -0,0 +1,93 @@
1
+ declare module '@env' {
2
+ // Environment Configuration
3
+ export const REACT_APP_ENV: string;
4
+ export const NODE_ENV: string;
5
+
6
+ // API Configuration
7
+ export const REACT_APP_DEV_API_URL: string;
8
+ export const REACT_APP_STAGING_API_URL: string;
9
+ export const REACT_APP_PROD_API_URL: string;
10
+ export const SHRIRAM_DEV_API_KEY: string;
11
+ export const SHRIRAM_STAGING_API_KEY: string;
12
+ export const SHRIRAM_PROD_API_KEY: string;
13
+ export const SHRIRAM_API_TIMEOUT: string;
14
+ export const SHRIRAM_DEV_RETRY_ATTEMPTS: string;
15
+ export const SHRIRAM_STAGING_RETRY_ATTEMPTS: string;
16
+ export const SHRIRAM_PROD_RETRY_ATTEMPTS: string;
17
+
18
+ // Encryption Configuration
19
+ export const SHRIRAM_DEV_ENCRYPTION_KEY: string;
20
+ export const SHRIRAM_STAGING_ENCRYPTION_KEY: string;
21
+ export const SHRIRAM_ENCRYPTION_KEY: string;
22
+ export const REACT_APP_DEV_ENCRYPTION_KEY: string;
23
+ export const REACT_APP_STAGING_ENCRYPTION_KEY: string;
24
+ export const REACT_APP_ENCRYPTION_KEY: string;
25
+ export const DECRYPTION_TOKEN: string;
26
+
27
+ // SDK Configuration
28
+ export const SHRIRAM_SDK_VERSION: string;
29
+ export const SHRIRAM_CLIENT_VERSION: string;
30
+
31
+ // Financial Limits Configuration
32
+ export const SHRIRAM_MIN_DEPOSIT: string;
33
+ export const SHRIRAM_MAX_DEPOSIT: string;
34
+ export const SHRIRAM_MIN_TENURE: string;
35
+ export const SHRIRAM_DEPOSIT_MULTIPLE: string;
36
+ export const SHRIRAM_DEFAULT_INTEREST_RATE: string;
37
+
38
+ // UI Configuration
39
+ export const SHRIRAM_HEADER_HEIGHT: string;
40
+ export const SHRIRAM_CHECKBOX_SIZE: string;
41
+ export const SHRIRAM_STATUS_BAR_COLOR: string;
42
+ export const SHRIRAM_STATUS_BAR_STYLE: string;
43
+
44
+ // Security Configuration
45
+ export const SHRIRAM_ENABLE_ENCRYPTION_DEV: string;
46
+ export const SHRIRAM_ENABLE_ENCRYPTION_STAGING: string;
47
+ export const SHRIRAM_ENABLE_ENCRYPTION_PROD: string;
48
+ export const SHRIRAM_ALLOW_ENCRYPTION_TOGGLE_DEV: string;
49
+ export const SHRIRAM_ALLOW_ENCRYPTION_TOGGLE_STAGING: string;
50
+ export const SHRIRAM_ALLOW_ENCRYPTION_TOGGLE_PROD: string;
51
+ export const SHRIRAM_ENABLE_LOGGING_DEV: string;
52
+ export const SHRIRAM_ENABLE_LOGGING_STAGING: string;
53
+ export const SHRIRAM_ENABLE_LOGGING_PROD: string;
54
+
55
+ // Payment Configuration
56
+ export const SHRIRAM_PAYMENT_SUCCESS_URL: string;
57
+ export const SHRIRAM_PAYMENT_FAILURE_URL: string;
58
+ export const SHRIRAM_PAYMENT_STATUS_URL: string;
59
+
60
+ // Development Configuration
61
+ export const SHRIRAM_DEBUG_MODE: string;
62
+ export const SHRIRAM_VERBOSE_LOGGING: string;
63
+ export const SHRIRAM_ENABLE_HOT_RELOAD: string;
64
+
65
+ // Feature Flags
66
+ export const SHRIRAM_ENABLE_FD_CALCULATOR: string;
67
+ export const SHRIRAM_ENABLE_PAYMENT_GATEWAY: string;
68
+ export const SHRIRAM_ENABLE_KYC_VERIFICATION: string;
69
+ export const SHRIRAM_ENABLE_AADHAAR_VERIFICATION: string;
70
+
71
+ // Validation Configuration
72
+ export const SHRIRAM_PHONE_NUMBER_LENGTH: string;
73
+ export const SHRIRAM_PAN_NUMBER_LENGTH: string;
74
+ export const SHRIRAM_AADHAAR_NUMBER_LENGTH: string;
75
+
76
+ // Theme Configuration
77
+ export const SHRIRAM_DEFAULT_THEME: string;
78
+ export const SHRIRAM_PRIMARY_COLOR: string;
79
+ export const SHRIRAM_SECONDARY_COLOR: string;
80
+ export const SHRIRAM_SUCCESS_COLOR: string;
81
+ export const SHRIRAM_ERROR_COLOR: string;
82
+ export const SHRIRAM_WARNING_COLOR: string;
83
+
84
+ // Monitoring Configuration
85
+ export const SHRIRAM_PERFORMANCE_MONITORING: string;
86
+ export const SHRIRAM_ERROR_TRACKING: string;
87
+ export const SHRIRAM_ANALYTICS_TRACKING: string;
88
+
89
+ // Compliance Configuration
90
+ export const SHRIRAM_GDPR_COMPLIANCE: string;
91
+ export const SHRIRAM_DATA_RETENTION_DAYS: string;
92
+ export const SHRIRAM_AUDIT_LOGGING: string;
93
+ }
@@ -0,0 +1,12 @@
1
+ import { WORKFLOW_STATES } from '../config/workflowConstants';
2
+
3
+ export type WorkflowStateSriram =
4
+ | typeof WORKFLOW_STATES.START
5
+ | typeof WORKFLOW_STATES.INITIATION
6
+ | typeof WORKFLOW_STATES.CREATE_FD
7
+ | typeof WORKFLOW_STATES.OCCUPATION
8
+ | typeof WORKFLOW_STATES.NOMINEE
9
+ | typeof WORKFLOW_STATES.BANK_DETAILS
10
+ | typeof WORKFLOW_STATES.KYC
11
+ | typeof WORKFLOW_STATES.PAYMENT
12
+ | typeof WORKFLOW_STATES.END;
@@ -0,0 +1,166 @@
1
+ // API Logging Utility for Shriram SDK
2
+ // Provides comprehensive logging for API requests, responses, and debugging
3
+
4
+ export interface LogConfig {
5
+ enableLogging: boolean;
6
+ logLevel: 'debug' | 'info' | 'warn' | 'error';
7
+ logRequest: boolean;
8
+ logResponse: boolean;
9
+ logHeaders: boolean;
10
+ logBody: boolean;
11
+ logTiming: boolean;
12
+ maxBodyLength: number;
13
+ }
14
+
15
+ export interface RequestLogData {
16
+ method: string;
17
+ url: string;
18
+ baseUrl: string;
19
+ headers: Record<string, string>;
20
+ body?: any;
21
+ timestamp: number;
22
+ requestId: string;
23
+ isEncrypted: boolean;
24
+ }
25
+
26
+ export interface ResponseLogData {
27
+ status: number;
28
+ statusText: string;
29
+ headers: Record<string, string>;
30
+ data?: any;
31
+ timestamp: number;
32
+ requestId: string;
33
+ duration: number;
34
+ isEncrypted: boolean;
35
+ error?: any;
36
+ }
37
+
38
+ // Default logging configuration
39
+ const DEFAULT_LOG_CONFIG: LogConfig = {
40
+ enableLogging: true,
41
+ logLevel: 'info',
42
+ logRequest: true,
43
+ logResponse: true,
44
+ logHeaders: true,
45
+ logBody: true,
46
+ logTiming: true,
47
+ maxBodyLength: 1000,
48
+ };
49
+
50
+ class ApiLogger {
51
+ private config: LogConfig;
52
+ private requestStartTimes: Map<string, number> = new Map();
53
+
54
+ constructor(config: Partial<LogConfig> = {}) {
55
+ this.config = { ...DEFAULT_LOG_CONFIG, ...config };
56
+ }
57
+
58
+ // Update logging configuration
59
+ updateConfig(newConfig: Partial<LogConfig>): void {
60
+ this.config = { ...this.config, ...newConfig };
61
+ }
62
+
63
+ // Log API request
64
+ logRequest(data: RequestLogData): void {
65
+ if (!this.config.enableLogging || !this.config.logRequest) {
66
+ return;
67
+ }
68
+
69
+ const { method, url, baseUrl, headers, body, timestamp, requestId, isEncrypted } = data;
70
+
71
+ // Store start time for duration calculation
72
+ this.requestStartTimes.set(requestId, timestamp);
73
+
74
+ // API request logging removed for security
75
+ }
76
+
77
+ // Log API response
78
+ logResponse(data: ResponseLogData): void {
79
+ if (!this.config.enableLogging || !this.config.logResponse) {
80
+ return;
81
+ }
82
+
83
+ const { status, statusText, headers, data: responseData, timestamp, requestId, duration, isEncrypted, error } = data;
84
+
85
+ // Remove start time
86
+ this.requestStartTimes.delete(requestId);
87
+
88
+ const isSuccess = status >= 200 && status < 300;
89
+ const logMethod = isSuccess ? 'log' : 'error';
90
+
91
+ // API response logging removed for security
92
+ }
93
+
94
+ // Log API error
95
+ logError(error: any, requestId: string, url: string): void {
96
+ if (!this.config.enableLogging) {
97
+ return;
98
+ }
99
+
100
+ const startTime = this.requestStartTimes.get(requestId);
101
+ const duration = startTime ? Date.now() - startTime : 0;
102
+
103
+ // Remove start time
104
+ this.requestStartTimes.delete(requestId);
105
+
106
+ // API error logging removed for security
107
+ }
108
+
109
+ // Calculate request duration
110
+ getRequestDuration(requestId: string): number {
111
+ const startTime = this.requestStartTimes.get(requestId);
112
+ return startTime ? Date.now() - startTime : 0;
113
+ }
114
+
115
+ // Sanitize headers for logging (remove sensitive data)
116
+ private sanitizeHeaders(headers: Record<string, string>): Record<string, string> {
117
+ const sensitiveHeaders = ['authorization', 'x-api-key', 'x-auth-token', 'cookie'];
118
+ const sanitized = { ...headers };
119
+
120
+ sensitiveHeaders.forEach(header => {
121
+ if (sanitized[header]) {
122
+ sanitized[header] = '***REDACTED***';
123
+ }
124
+ });
125
+
126
+ return sanitized;
127
+ }
128
+
129
+ // Sanitize body for logging (truncate if too long)
130
+ private sanitizeBody(body: any): any {
131
+ if (!body) return body;
132
+
133
+ try {
134
+ const bodyStr = typeof body === 'string' ? body : JSON.stringify(body, null, 2);
135
+
136
+ if (bodyStr.length > this.config.maxBodyLength) {
137
+ return bodyStr.substring(0, this.config.maxBodyLength) + '... [TRUNCATED]';
138
+ }
139
+
140
+ return typeof body === 'string' ? JSON.parse(bodyStr) : body;
141
+ } catch {
142
+ return '[UNPARSEABLE BODY]';
143
+ }
144
+ }
145
+
146
+ // Log configuration summary
147
+ logConfig(): void {
148
+ if (!this.config.enableLogging) {
149
+ return;
150
+ }
151
+
152
+ // Configuration logging removed for security
153
+ }
154
+
155
+ // Clear all stored request times
156
+ clearRequestTimes(): void {
157
+ this.requestStartTimes.clear();
158
+ }
159
+ }
160
+
161
+ // Create singleton instance
162
+ export const apiLogger = new ApiLogger();
163
+
164
+ // Export types and utilities
165
+ export { ApiLogger };
166
+ export default apiLogger;
@@ -0,0 +1,159 @@
1
+ // encryption.ts
2
+ import { Buffer } from 'buffer';
3
+
4
+ // Polyfill for react-native-quick-crypto
5
+ const g = global as any;
6
+ if (typeof g.Buffer === 'undefined') {
7
+ g.Buffer = Buffer;
8
+ }
9
+
10
+ if (typeof g.base64FromArrayBuffer === 'undefined') {
11
+ g.base64FromArrayBuffer = (data: ArrayBuffer) => {
12
+ return Buffer.from(data).toString('base64');
13
+ };
14
+ }
15
+
16
+ const crypto = require('react-native-quick-crypto');
17
+
18
+ export default class CryptoUtils {
19
+ private static readonly SALT_LEN = 16;
20
+ private static readonly IV_LEN = 12;
21
+ private static readonly AUTH_TAG_LEN = 16;
22
+ private static readonly ITERATIONS = 100000;
23
+ private static readonly KEY_LEN = 32;
24
+ private static readonly MAX_CACHE = 10;
25
+
26
+ private static keyCache = new Map<string, Buffer>();
27
+
28
+ static async encryptJSONCompact(
29
+ json: Record<string, any>,
30
+ password: string,
31
+ ): Promise<string> {
32
+ try {
33
+ const jsonString = JSON.stringify(json);
34
+ const plaintext = Buffer.from(jsonString, 'utf8');
35
+
36
+ const salt = this.generateSalt();
37
+ const iv = this.generateIV();
38
+ const key = this.deriveKey(password, salt);
39
+
40
+ const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
41
+ const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
42
+ const authTag = cipher.getAuthTag();
43
+
44
+ const packed = Buffer.concat([salt, iv, authTag, encrypted]);
45
+ return packed.toString('base64');
46
+ } catch (e) {
47
+ throw e;
48
+ }
49
+ }
50
+
51
+ static async decryptJSONCompact(
52
+ compactBase64: string,
53
+ password: string,
54
+ ): Promise<Record<string, any>> {
55
+ try {
56
+ const all = Buffer.from(compactBase64, 'base64');
57
+
58
+ if (all.length < this.SALT_LEN + this.IV_LEN + this.AUTH_TAG_LEN) {
59
+ throw new Error('Invalid compact payload');
60
+ }
61
+
62
+ const salt = all.slice(0, this.SALT_LEN);
63
+ const iv = all.slice(this.SALT_LEN, this.SALT_LEN + this.IV_LEN);
64
+ const authTag = all.slice(
65
+ this.SALT_LEN + this.IV_LEN,
66
+ this.SALT_LEN + this.IV_LEN + this.AUTH_TAG_LEN,
67
+ );
68
+ const cipherBytes = all.slice(this.SALT_LEN + this.IV_LEN + this.AUTH_TAG_LEN);
69
+
70
+ const key = this.deriveKey(password, salt);
71
+
72
+ const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
73
+ decipher.setAuthTag(authTag);
74
+
75
+ const decrypted = Buffer.concat([
76
+ decipher.update(cipherBytes),
77
+ decipher.final(),
78
+ ]);
79
+
80
+ const jsonString = decrypted.toString('utf8');
81
+ return JSON.parse(jsonString);
82
+ } catch (e) {
83
+ throw e;
84
+ }
85
+ }
86
+
87
+ private static deriveKey(password: string, salt: Buffer): Buffer {
88
+ const cacheKey = `${password}_${salt.toString('base64')}`;
89
+
90
+ const cached = this.keyCache.get(cacheKey);
91
+ if (cached) return cached;
92
+
93
+ const key = crypto.pbkdf2Sync(
94
+ password,
95
+ salt,
96
+ this.ITERATIONS,
97
+ this.KEY_LEN,
98
+ 'sha256',
99
+ );
100
+
101
+ if (this.keyCache.size >= this.MAX_CACHE) this.keyCache.clear();
102
+ this.keyCache.set(cacheKey, key);
103
+
104
+ return key;
105
+ }
106
+
107
+ private static generateSalt(): Buffer {
108
+ return crypto.randomBytes(this.SALT_LEN);
109
+ }
110
+
111
+ private static generateIV(): Buffer {
112
+ return crypto.randomBytes(this.IV_LEN);
113
+ }
114
+
115
+ static async encrypt(
116
+ data: Record<string, any>,
117
+ passphrase: string,
118
+ ): Promise<string> {
119
+ return this.encryptJSONCompact(data, passphrase);
120
+ }
121
+
122
+ static async decrypt(
123
+ encryptedBase64: string,
124
+ passphrase: string,
125
+ ): Promise<string> {
126
+ const result = await this.decryptJSONCompact(encryptedBase64, passphrase);
127
+ return JSON.stringify(result);
128
+ }
129
+ }
130
+
131
+ // Legacy named exports for backward compatibility
132
+ export const ENCRYPTION_KEY = '60913a3b628a29ac9fdd2147e69d013135ce8be5b26d2ee5ec5e905838fcfa78';
133
+
134
+ export interface EncryptionConfig {
135
+ secretKey: string;
136
+ algorithm?: string;
137
+ ivLength?: number;
138
+ }
139
+
140
+ export const encryptJSONCompact = (data: Record<string, any>, password: string = ENCRYPTION_KEY) =>
141
+ CryptoUtils.encryptJSONCompact(data, password);
142
+
143
+ export const decryptJSONCompact = (compactBase64: string, password: string = ENCRYPTION_KEY) =>
144
+ CryptoUtils.decryptJSONCompact(compactBase64, password);
145
+
146
+ export const encryptRequest = async (payload: any, config?: EncryptionConfig) => ({
147
+ encryptedRequest: await CryptoUtils.encryptJSONCompact(payload, config?.secretKey || ENCRYPTION_KEY),
148
+ });
149
+
150
+ export const decryptResponse = async (response: any, config?: EncryptionConfig) => {
151
+ if (response?.encryptedResponse) {
152
+ try {
153
+ return await CryptoUtils.decryptJSONCompact(response.encryptedResponse, config?.secretKey || ENCRYPTION_KEY);
154
+ } catch (error) {
155
+ return response;
156
+ }
157
+ }
158
+ return response;
159
+ };
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Get FD Data Utility
3
+ *
4
+ * This function can be called from the main app to retrieve currently booked FD details
5
+ * by calling the customer webhook applications API with completed status filter.
6
+ */
7
+
8
+ import { getUserInfoForAPI } from '../config/appDataConfig';
9
+ import { store } from '../store';
10
+ import { customerApi } from '../api/customerApi';
11
+
12
+ /**
13
+ * Response structure returned to main app
14
+ */
15
+ export interface FDDataResponse {
16
+
17
+ // All applications from API
18
+ allApplications: any[];
19
+ // Currently booked FD (matched by applicationId or most recent)
20
+ success: boolean;
21
+ // Error message if any
22
+ error?: string
23
+ }
24
+
25
+ /**
26
+ * Get FD data by calling customer webhook applications API and return response to main app
27
+ * Only returns applications with wfStatus='Completed'
28
+ *
29
+ * @param userReferenceId - User reference ID from main app. If not provided, will try to get from SDK's internal state.
30
+ * @param applicationId - Optional application ID to find specific FD. If not provided, returns most recent FD.
31
+ * @returns Promise that resolves to FDDataResponse containing completed applications only
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * import { getFDData } from '@finspringinnovations/shriramsdk';
36
+ *
37
+ * // Get FD data with user reference ID from main app
38
+ * const result = await getFDData('USER123');
39
+ * if (result.success) {
40
+ * // Access full API response
41
+ * const apiResponse = result.apiResponse;
42
+ * const allApplications = result.allApplications;
43
+ * const bookedFD = result.bookedFD;
44
+ * const fdAmount = result.bookedFD?.amount;
45
+ * const applicationId = result.bookedFD?.applicationId;
46
+ * } else {
47
+ * // Handle error
48
+ * const errorMessage = result.error;
49
+ * }
50
+ *
51
+ * // Get specific FD by application ID
52
+ * const specificFD = await getFDData('USER123', 'APP123456');
53
+ *
54
+ * // Without userReferenceId (will use SDK's internal state)
55
+ * const resultWithoutUserRef = await getFDData();
56
+ * ```
57
+ */
58
+ export const getFDData = async (userReferenceId?: string, applicationId?: string): Promise<FDDataResponse> => {
59
+ try {
60
+ // Get user reference ID - use provided parameter or fallback to SDK's internal state
61
+ let finalUserReferenceId: string;
62
+
63
+ if (userReferenceId) {
64
+ // Use userReferenceId provided by main app
65
+ finalUserReferenceId = userReferenceId;
66
+ } else {
67
+ // Fallback to getting from SDK's internal state
68
+ try {
69
+ const userInfo = getUserInfoForAPI();
70
+ finalUserReferenceId = userInfo.id;
71
+ } catch (error) {
72
+ return {
73
+ allApplications: [],
74
+ success: false,
75
+ error: 'User reference ID is required. Please provide userReferenceId parameter or initialize SDK first.',
76
+ };
77
+ }
78
+ }
79
+
80
+ // ✅ CRITICAL: Use SDK store directly to ensure we always use SDK's store
81
+ // This prevents conflicts with parent app's store
82
+ if (!store) {
83
+ return {
84
+ allApplications: [],
85
+ success: false,
86
+ error: 'SDK store is not initialized. Please ensure SDK is properly set up.',
87
+ };
88
+ }
89
+
90
+ // Call webhook API to get customer applications with completed status
91
+ const apiResponse = await store.dispatch(
92
+ customerApi.endpoints.getCustomerWebhookApplications.initiate({
93
+ userReferenceId: finalUserReferenceId,
94
+ wfStatus: 'Completed'
95
+ })
96
+ ).unwrap();
97
+
98
+ // Extract applications from response (handle different response structures)
99
+ // Note: API already filters by wfStatus='Completed'
100
+ let applications: any[] = [];
101
+ if (Array.isArray(apiResponse)) {
102
+ applications = apiResponse;
103
+ } else if (apiResponse?.data && Array.isArray(apiResponse.data)) {
104
+ applications = apiResponse.data;
105
+ } else if (apiResponse?.applications && Array.isArray(apiResponse.applications)) {
106
+ applications = apiResponse.applications;
107
+ }
108
+
109
+ // Map to only include specified fields
110
+ applications = applications.map((app: any) => ({
111
+ application_id: app?.application_id || app?.applicationId,
112
+ investment_amount: app?.investment_amount || app?.investmentAmount,
113
+ interest_rate: app?.interest_rate || app?.interestRate,
114
+ maturity_date: app?.maturity_date || app?.maturityDate,
115
+ maturity_amount: app?.maturity_amount || app?.maturityAmount,
116
+ interest_payout_term: app?.interest_payout_term || app?.interestPayoutTerm,
117
+ tenure_in_months: app?.tenure_in_months || app?.tenureInMonths,
118
+ transaction_id: app?.transaction_id || app?.transactionId,
119
+ fd_provider_id: app?.fd_provider_id || app?.fdProviderId,
120
+ fd_provider_name: app?.fd_provider_name || app?.fdProviderName,
121
+ transaction_status: app?.transaction_status || app?.transactionStatus,
122
+ transaction_description: app?.transaction_description || app?.transactionDescription,
123
+ wf_status: app?.wf_status || app?.wfStatus,
124
+ created_date: app?.created_date || app?.createdDate,
125
+ certificate_status: app?.certificate_status || app?.certificateStatus,
126
+ }));
127
+
128
+ // Find the FD - match by applicationId or get the most recent one
129
+ let bookedFD: any = null;
130
+
131
+ if (applicationId) {
132
+ // Try to find FD matching the provided applicationId
133
+ bookedFD = applications.find((app: any) =>
134
+ app?.application_id === applicationId
135
+ );
136
+ } else {
137
+ // Get applicationId from Redux store if available
138
+ const state = store.getState() as any;
139
+ const storeApplicationId = state?.onboarding?.applicationId;
140
+
141
+ if (storeApplicationId) {
142
+ // Try to find FD matching the current applicationId from store
143
+ bookedFD = applications.find((app: any) =>
144
+ app?.application_id === storeApplicationId
145
+ );
146
+ }
147
+ }
148
+
149
+ // If not found by applicationId, get the most recent one (assuming it's the latest booking)
150
+ if (!bookedFD && applications.length > 0) {
151
+ // Sort by date if available, otherwise take the last one
152
+ const sortedApps = [...applications].sort((a: any, b: any) => {
153
+ const dateA = a?.created_date || 0;
154
+ const dateB = b?.created_date || 0;
155
+ return new Date(dateB).getTime() - new Date(dateA).getTime();
156
+ });
157
+ bookedFD = sortedApps[0];
158
+ }
159
+
160
+ // Return full API response data to main app
161
+ return {
162
+ // Full API response
163
+ allApplications: applications, // All applications array
164
+ success: true,
165
+ };
166
+ } catch (error: any) {
167
+ // If API call fails, return error information
168
+ return {
169
+ allApplications: [],
170
+ success: false,
171
+ error: error?.message || 'Failed to fetch FD data',
172
+ };
173
+ }
174
+ };
175
+
@@ -0,0 +1,7 @@
1
+ let globalData: any = {};
2
+
3
+ export const setGlobalData = (data: any) => {
4
+ globalData = { ...globalData, ...data };
5
+ };
6
+
7
+ export const getGlobalData = () => globalData;