joopjs 2.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 (259) hide show
  1. package/CHANGELOG.md +678 -0
  2. package/README.md +583 -0
  3. package/dist/a11y.service-C-DQQfgO.d.mts +143 -0
  4. package/dist/a11y.service-CauEJrJe.d.ts +143 -0
  5. package/dist/adapters-B6slG6hQ.d.mts +84 -0
  6. package/dist/adapters-B6slG6hQ.d.ts +84 -0
  7. package/dist/aes.service-CkoupAww.d.mts +95 -0
  8. package/dist/aes.service-CkoupAww.d.ts +95 -0
  9. package/dist/ai/index.d.mts +99 -0
  10. package/dist/ai/index.d.ts +99 -0
  11. package/dist/ai/index.js +307 -0
  12. package/dist/ai/index.js.map +1 -0
  13. package/dist/ai/index.mjs +304 -0
  14. package/dist/ai/index.mjs.map +1 -0
  15. package/dist/analytics/index.d.mts +42 -0
  16. package/dist/analytics/index.d.ts +42 -0
  17. package/dist/analytics/index.js +139 -0
  18. package/dist/analytics/index.js.map +1 -0
  19. package/dist/analytics/index.mjs +136 -0
  20. package/dist/analytics/index.mjs.map +1 -0
  21. package/dist/angular/index.d.mts +148 -0
  22. package/dist/angular/index.d.ts +148 -0
  23. package/dist/angular/index.js +122 -0
  24. package/dist/angular/index.js.map +1 -0
  25. package/dist/angular/index.mjs +101 -0
  26. package/dist/angular/index.mjs.map +1 -0
  27. package/dist/api/index.d.mts +128 -0
  28. package/dist/api/index.d.ts +128 -0
  29. package/dist/api/index.js +1358 -0
  30. package/dist/api/index.js.map +1 -0
  31. package/dist/api/index.mjs +1332 -0
  32. package/dist/api/index.mjs.map +1 -0
  33. package/dist/auth/index.d.mts +105 -0
  34. package/dist/auth/index.d.ts +105 -0
  35. package/dist/auth/index.js +989 -0
  36. package/dist/auth/index.js.map +1 -0
  37. package/dist/auth/index.mjs +979 -0
  38. package/dist/auth/index.mjs.map +1 -0
  39. package/dist/auth.service-DNVB-L4U.d.mts +16 -0
  40. package/dist/auth.service-PjUUSUIt.d.ts +16 -0
  41. package/dist/banking/index.d.mts +1530 -0
  42. package/dist/banking/index.d.ts +1530 -0
  43. package/dist/banking/index.js +4739 -0
  44. package/dist/banking/index.js.map +1 -0
  45. package/dist/banking/index.mjs +4661 -0
  46. package/dist/banking/index.mjs.map +1 -0
  47. package/dist/cache/index.d.mts +40 -0
  48. package/dist/cache/index.d.ts +40 -0
  49. package/dist/cache/index.js +174 -0
  50. package/dist/cache/index.js.map +1 -0
  51. package/dist/cache/index.mjs +172 -0
  52. package/dist/cache/index.mjs.map +1 -0
  53. package/dist/client-profile.service-BuPeXVp5.d.mts +28 -0
  54. package/dist/client-profile.service-D5bRRYQp.d.ts +28 -0
  55. package/dist/config.models-Cqg04fAQ.d.mts +84 -0
  56. package/dist/config.models-Cqg04fAQ.d.ts +84 -0
  57. package/dist/config.service-CrCvI-JS.d.ts +31 -0
  58. package/dist/config.service-Cz4QQLlf.d.mts +31 -0
  59. package/dist/core/index.d.mts +4 -0
  60. package/dist/core/index.d.ts +4 -0
  61. package/dist/core/index.js +631 -0
  62. package/dist/core/index.js.map +1 -0
  63. package/dist/core/index.mjs +619 -0
  64. package/dist/core/index.mjs.map +1 -0
  65. package/dist/crypto-utils-DriNhLdx.d.mts +30 -0
  66. package/dist/crypto-utils-DriNhLdx.d.ts +30 -0
  67. package/dist/data-storage.service-DT6xaTxE.d.ts +51 -0
  68. package/dist/data-storage.service-LvhGRCmw.d.mts +51 -0
  69. package/dist/deeplink/index.d.mts +39 -0
  70. package/dist/deeplink/index.d.ts +39 -0
  71. package/dist/deeplink/index.js +268 -0
  72. package/dist/deeplink/index.js.map +1 -0
  73. package/dist/deeplink/index.mjs +265 -0
  74. package/dist/deeplink/index.mjs.map +1 -0
  75. package/dist/deeplink.service-Ctd5u243.d.mts +35 -0
  76. package/dist/deeplink.service-uUuTnY9_.d.ts +35 -0
  77. package/dist/dev/index.d.mts +20 -0
  78. package/dist/dev/index.d.ts +20 -0
  79. package/dist/dev/index.js +51 -0
  80. package/dist/dev/index.js.map +1 -0
  81. package/dist/dev/index.mjs +49 -0
  82. package/dist/dev/index.mjs.map +1 -0
  83. package/dist/device/index.d.mts +108 -0
  84. package/dist/device/index.d.ts +108 -0
  85. package/dist/device/index.js +960 -0
  86. package/dist/device/index.js.map +1 -0
  87. package/dist/device/index.mjs +951 -0
  88. package/dist/device/index.mjs.map +1 -0
  89. package/dist/differential-privacy-BcAv1G80.d.mts +210 -0
  90. package/dist/differential-privacy-C8mAUjZr.d.ts +210 -0
  91. package/dist/encryption/index.d.mts +75 -0
  92. package/dist/encryption/index.d.ts +75 -0
  93. package/dist/encryption/index.js +605 -0
  94. package/dist/encryption/index.js.map +1 -0
  95. package/dist/encryption/index.mjs +598 -0
  96. package/dist/encryption/index.mjs.map +1 -0
  97. package/dist/form-validator-3tkmzr_o.d.mts +72 -0
  98. package/dist/form-validator-3tkmzr_o.d.ts +72 -0
  99. package/dist/forms/index.d.mts +59 -0
  100. package/dist/forms/index.d.ts +59 -0
  101. package/dist/forms/index.js +446 -0
  102. package/dist/forms/index.js.map +1 -0
  103. package/dist/forms/index.mjs +442 -0
  104. package/dist/forms/index.mjs.map +1 -0
  105. package/dist/i18n/index.d.mts +37 -0
  106. package/dist/i18n/index.d.ts +37 -0
  107. package/dist/i18n/index.js +147 -0
  108. package/dist/i18n/index.js.map +1 -0
  109. package/dist/i18n/index.mjs +145 -0
  110. package/dist/i18n/index.mjs.map +1 -0
  111. package/dist/idempotency.service-_6LqhivP.d.mts +372 -0
  112. package/dist/idempotency.service-eOKoISRD.d.ts +372 -0
  113. package/dist/index-B_ksKpS1.d.mts +202 -0
  114. package/dist/index-CqDKWTUP.d.mts +28 -0
  115. package/dist/index-CqDKWTUP.d.ts +28 -0
  116. package/dist/index-DFqEoX_l.d.ts +202 -0
  117. package/dist/index-Dz0gOur2.d.mts +36 -0
  118. package/dist/index-Dz0gOur2.d.ts +36 -0
  119. package/dist/index.d.mts +1336 -0
  120. package/dist/index.d.ts +1336 -0
  121. package/dist/index.js +19464 -0
  122. package/dist/index.js.map +1 -0
  123. package/dist/index.mjs +19155 -0
  124. package/dist/index.mjs.map +1 -0
  125. package/dist/india/index.d.mts +75 -0
  126. package/dist/india/index.d.ts +75 -0
  127. package/dist/india/index.js +325 -0
  128. package/dist/india/index.js.map +1 -0
  129. package/dist/india/index.mjs +303 -0
  130. package/dist/india/index.mjs.map +1 -0
  131. package/dist/joop-Bx7Iwj5p.d.mts +155 -0
  132. package/dist/joop-CA3DMeOO.d.ts +155 -0
  133. package/dist/native-bridge/index.d.mts +27 -0
  134. package/dist/native-bridge/index.d.ts +27 -0
  135. package/dist/native-bridge/index.js +98 -0
  136. package/dist/native-bridge/index.js.map +1 -0
  137. package/dist/native-bridge/index.mjs +96 -0
  138. package/dist/native-bridge/index.mjs.map +1 -0
  139. package/dist/network/index.d.mts +85 -0
  140. package/dist/network/index.d.ts +85 -0
  141. package/dist/network/index.js +454 -0
  142. package/dist/network/index.js.map +1 -0
  143. package/dist/network/index.mjs +451 -0
  144. package/dist/network/index.mjs.map +1 -0
  145. package/dist/network-monitor-BIwPSXme.d.mts +179 -0
  146. package/dist/network-monitor-Bqp2hvZr.d.ts +179 -0
  147. package/dist/notification.service-Dm4fvfZf.d.mts +25 -0
  148. package/dist/notification.service-tEMKatWJ.d.ts +25 -0
  149. package/dist/observability/index.d.mts +179 -0
  150. package/dist/observability/index.d.ts +179 -0
  151. package/dist/observability/index.js +559 -0
  152. package/dist/observability/index.js.map +1 -0
  153. package/dist/observability/index.mjs +552 -0
  154. package/dist/observability/index.mjs.map +1 -0
  155. package/dist/oidc-client-DIJcClmB.d.mts +190 -0
  156. package/dist/oidc-client-DxhyE59t.d.ts +190 -0
  157. package/dist/platform/index.d.mts +73 -0
  158. package/dist/platform/index.d.ts +73 -0
  159. package/dist/platform/index.js +127 -0
  160. package/dist/platform/index.js.map +1 -0
  161. package/dist/platform/index.mjs +125 -0
  162. package/dist/platform/index.mjs.map +1 -0
  163. package/dist/pwa/index.d.mts +31 -0
  164. package/dist/pwa/index.d.ts +31 -0
  165. package/dist/pwa/index.js +247 -0
  166. package/dist/pwa/index.js.map +1 -0
  167. package/dist/pwa/index.mjs +244 -0
  168. package/dist/pwa/index.mjs.map +1 -0
  169. package/dist/react/index.d.mts +133 -0
  170. package/dist/react/index.d.ts +133 -0
  171. package/dist/react/index.js +632 -0
  172. package/dist/react/index.js.map +1 -0
  173. package/dist/react/index.mjs +630 -0
  174. package/dist/react/index.mjs.map +1 -0
  175. package/dist/router/index.d.mts +39 -0
  176. package/dist/router/index.d.ts +39 -0
  177. package/dist/router/index.js +168 -0
  178. package/dist/router/index.js.map +1 -0
  179. package/dist/router/index.mjs +166 -0
  180. package/dist/router/index.mjs.map +1 -0
  181. package/dist/security/index.d.mts +206 -0
  182. package/dist/security/index.d.ts +206 -0
  183. package/dist/security/index.js +1297 -0
  184. package/dist/security/index.js.map +1 -0
  185. package/dist/security/index.mjs +1285 -0
  186. package/dist/security/index.mjs.map +1 -0
  187. package/dist/session/index.d.mts +115 -0
  188. package/dist/session/index.d.ts +115 -0
  189. package/dist/session/index.js +297 -0
  190. package/dist/session/index.js.map +1 -0
  191. package/dist/session/index.mjs +292 -0
  192. package/dist/session/index.mjs.map +1 -0
  193. package/dist/state/index.d.mts +43 -0
  194. package/dist/state/index.d.ts +43 -0
  195. package/dist/state/index.js +156 -0
  196. package/dist/state/index.js.map +1 -0
  197. package/dist/state/index.mjs +152 -0
  198. package/dist/state/index.mjs.map +1 -0
  199. package/dist/statement-parser-BHQtXwCM.d.ts +260 -0
  200. package/dist/statement-parser-C2qNmb49.d.mts +260 -0
  201. package/dist/storage/index.d.mts +40 -0
  202. package/dist/storage/index.d.ts +40 -0
  203. package/dist/storage/index.js +256 -0
  204. package/dist/storage/index.js.map +1 -0
  205. package/dist/storage/index.mjs +252 -0
  206. package/dist/storage/index.mjs.map +1 -0
  207. package/dist/sync/index.d.mts +69 -0
  208. package/dist/sync/index.d.ts +69 -0
  209. package/dist/sync/index.js +330 -0
  210. package/dist/sync/index.js.map +1 -0
  211. package/dist/sync/index.mjs +323 -0
  212. package/dist/sync/index.mjs.map +1 -0
  213. package/dist/sync-engine-DCIMRG5s.d.ts +61 -0
  214. package/dist/sync-engine-DZqyKHkK.d.mts +61 -0
  215. package/dist/theme/index.d.mts +53 -0
  216. package/dist/theme/index.d.ts +53 -0
  217. package/dist/theme/index.js +169 -0
  218. package/dist/theme/index.js.map +1 -0
  219. package/dist/theme/index.mjs +167 -0
  220. package/dist/theme/index.mjs.map +1 -0
  221. package/dist/ui/index.d.mts +66 -0
  222. package/dist/ui/index.d.ts +66 -0
  223. package/dist/ui/index.js +811 -0
  224. package/dist/ui/index.js.map +1 -0
  225. package/dist/ui/index.mjs +803 -0
  226. package/dist/ui/index.mjs.map +1 -0
  227. package/dist/utilities/index.d.mts +199 -0
  228. package/dist/utilities/index.d.ts +199 -0
  229. package/dist/utilities/index.js +1991 -0
  230. package/dist/utilities/index.js.map +1 -0
  231. package/dist/utilities/index.mjs +1923 -0
  232. package/dist/utilities/index.mjs.map +1 -0
  233. package/dist/validation/index.d.mts +60 -0
  234. package/dist/validation/index.d.ts +60 -0
  235. package/dist/validation/index.js +460 -0
  236. package/dist/validation/index.js.map +1 -0
  237. package/dist/validation/index.mjs +455 -0
  238. package/dist/validation/index.mjs.map +1 -0
  239. package/dist/vue/index.d.mts +135 -0
  240. package/dist/vue/index.d.ts +135 -0
  241. package/dist/vue/index.js +621 -0
  242. package/dist/vue/index.js.map +1 -0
  243. package/dist/vue/index.mjs +619 -0
  244. package/dist/vue/index.mjs.map +1 -0
  245. package/dist/watermark.service-Detur5tq.d.ts +235 -0
  246. package/dist/watermark.service-QNegMeQZ.d.mts +235 -0
  247. package/dist/workers/index.d.mts +42 -0
  248. package/dist/workers/index.d.ts +42 -0
  249. package/dist/workers/index.js +359 -0
  250. package/dist/workers/index.js.map +1 -0
  251. package/dist/workers/index.mjs +356 -0
  252. package/dist/workers/index.mjs.map +1 -0
  253. package/dist/workflow/index.d.mts +99 -0
  254. package/dist/workflow/index.d.ts +99 -0
  255. package/dist/workflow/index.js +282 -0
  256. package/dist/workflow/index.js.map +1 -0
  257. package/dist/workflow/index.mjs +279 -0
  258. package/dist/workflow/index.mjs.map +1 -0
  259. package/package.json +226 -0
package/README.md ADDED
@@ -0,0 +1,583 @@
1
+ # JoopJS
2
+
3
+ **Enterprise-grade, framework-agnostic TypeScript SDK for financial applications.**
4
+
5
+ [![npm version](https://img.shields.io/badge/npm-v2.0.0-blue)](https://www.npmjs.com/package/joopjs)
6
+ [![license](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
7
+ [![node](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
8
+ [![tests](https://img.shields.io/badge/tests-2168%20passed-success)](#)
9
+
10
+ > Author: **Kundan Singh**
11
+
12
+ JoopJS provides 80+ production-ready services covering banking, finance, security, authentication, and encryption — all as plain TypeScript classes with no framework dependencies. Works with **React 18+**, **Angular 17+**, **Vue 3+**, or any plain TypeScript/JavaScript project.
13
+
14
+ ---
15
+
16
+ ## Table of Contents
17
+
18
+ - [Install](#install)
19
+ - [Quick Start](#quick-start)
20
+ - [Service Catalogue](#service-catalogue)
21
+ - [Banking](#banking-26-services)
22
+ - [Finance](#finance-13-services)
23
+ - [Security](#security-12-services)
24
+ - [Auth & Sessions](#auth--sessions-10-services)
25
+ - [Encryption](#encryption-8-services)
26
+ - [Device](#device-7-services)
27
+ - [Network & API](#network--api-11-services)
28
+ - [Workers & State](#workers--state-8-services)
29
+ - [Observability](#observability-6-services)
30
+ - [UI & Forms](#ui--forms-9-services)
31
+ - [Utilities](#utilities-21-services)
32
+ - [India & RegTech](#india--regtech-2-modules)
33
+ - [Framework Integration](#framework-integration)
34
+ - [Reactive Observables](#reactive-observables)
35
+ - [TypeScript Types](#typescript-types)
36
+ - [Sub-path Imports](#sub-path-imports)
37
+ - [Contributing](#contributing)
38
+ - [License](#license)
39
+
40
+ ---
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ npm install joopjs
46
+ # or
47
+ yarn add joopjs
48
+ pnpm add joopjs
49
+ ```
50
+
51
+ **Requirements:** Node.js ≥18, TypeScript ≥5.0 (optional but recommended).
52
+
53
+ No mandatory peer dependencies — React / Angular / Vue bindings are opt-in.
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ ### 1. Initialise
60
+
61
+ ```typescript
62
+ import { createJoop } from 'joopjs';
63
+
64
+ const joop = createJoop({
65
+ env: 'production',
66
+ appId: 'my-banking-app',
67
+ currency: 'USD',
68
+ locale: 'en',
69
+ });
70
+ ```
71
+
72
+ ### 2. Use a service
73
+
74
+ ```typescript
75
+ import { JoopDigitalWalletService } from 'joopjs';
76
+
77
+ const wallet = new JoopDigitalWalletService();
78
+
79
+ // Create a wallet
80
+ const w = wallet.createWallet('user-001', { currency: 'USD', label: 'Primary' });
81
+
82
+ // Top up and pay
83
+ wallet.topUp(w.id, 1000);
84
+ wallet.pay(w.id, 49.99, 'merchant-001', 'Coffee subscription');
85
+
86
+ // Check balance
87
+ console.log(wallet.getBalance(w.id)); // 950.01
88
+
89
+ // React to balance changes
90
+ const unsub = wallet.balance$().subscribe(({ walletId, balance }) => {
91
+ console.log(`Wallet ${walletId}: $${balance}`);
92
+ });
93
+ unsub(); // stop listening
94
+ ```
95
+
96
+ ### 3. Auth flow
97
+
98
+ ```typescript
99
+ import { JoopAuthService, JoopJwtService } from 'joopjs';
100
+
101
+ const auth = new JoopAuthService();
102
+ const jwt = new JoopJwtService({ secret: process.env.JWT_SECRET!, expiryMs: 3_600_000 });
103
+
104
+ const session = await auth.login('alice@bank.com', 'password123');
105
+ const token = jwt.sign({ userId: session.userId, role: 'admin' });
106
+ const claims = jwt.verify(token); // { userId, role, iat, exp }
107
+ ```
108
+
109
+ ### 4. Encrypt sensitive data
110
+
111
+ ```typescript
112
+ import { JoopGcmService } from 'joopjs';
113
+
114
+ const gcm = new JoopGcmService();
115
+ const key = await gcm.generateKey();
116
+
117
+ const { ciphertext, iv } = await gcm.encrypt('4111111111111111', key);
118
+ const pan = await gcm.decrypt(ciphertext, key, iv); // '4111111111111111'
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Service Catalogue
124
+
125
+ All services follow the same pattern:
126
+ ```typescript
127
+ const svc = new JoopXxxService(); // plain class, no DI required
128
+ ```
129
+
130
+ ### Banking (26 services)
131
+
132
+ | Service | Key Methods |
133
+ |---|---|
134
+ | `JoopDigitalWalletService` | `createWallet`, `topUp`, `pay`, `transfer`, `freeze`, `getBalance`, `balance$` |
135
+ | `JoopLoanServicingService` | `createLoan`, `recordPayment`, `getSchedule`, `getOutstandingBalance`, `markDefaulted` |
136
+ | `JoopFxForwardService` | `setSpotRate`, `createForward`, `settleForward`, `getMarkToMarket`, `getExposure` |
137
+ | `JoopLedgerService` | `addAccount`, `postEntry`, `getBalance`, `getTrialBalance` |
138
+ | `JoopReconciliationService` | `createSession`, `autoMatch`, `manualMatch`, `getSummary` |
139
+ | `JoopAmlService` | `addRule`, `checkTransaction`, `flag`, `alert$` |
140
+ | `JoopLimitManagementService` | `setLimit`, `checkLimit`, `recordUsage` |
141
+ | `JoopStandingOrderService` | `create`, `execute`, `pause`, `resume`, `cancel`, `getDue` |
142
+ | `JoopPaymentOrchestratorService` | `submit`, `retry`, `getStatus`, `cancel` |
143
+ | `JoopOpenBankingClient` | `requestConsent`, `getAccounts`, `getTransactions`, `initiatePayment` |
144
+ | `JoopCardManagementService` | `issueCard`, `freeze`, `setSpendingLimits`, `setControls`, `checkTransaction` |
145
+ | `JoopBeneficiaryService` | `add`, `validate`, `getAll`, `remove` |
146
+ | `JoopDisputeService` | `file`, `uploadEvidence`, `resolve`, `getStats` |
147
+ | `JoopRemittanceService` | `setExchangeRate`, `getQuote`, `initiate`, `updateStatus` |
148
+ | `JoopInsuranceService` | `addPolicy`, `fileClaim`, `renewPolicy`, `recordPremiumPayment` |
149
+ | `JoopVirtualAccountService` | `create`, `recordCredit`, `isFullyCollected`, `close` |
150
+ | `JoopMandateService` | `create`, `execute`, `pause`, `resume`, `cancel`, `getDue` |
151
+ | `JoopSplitPaymentService` | `createExpense`, `addParticipant`, `settle`, `getBalances` |
152
+ | `JoopChequebookService` | `requestChequebook`, `activateChequebook`, `issueLeaf`, `markCleared` |
153
+ | `JoopBillPaymentService` | `addBiller`, `createBill`, `pay`, `getUpcoming` |
154
+ | `JoopStatementGeneratorService` | `addTransaction`, `generate` |
155
+ | `JoopScheduledPaymentService` | `schedule`, `cancel`, `getUpcoming` |
156
+ | `JoopNotificationCenterService` | `send`, `markRead`, `getUnread` |
157
+ | `JoopPaymentUriService` | `generate`, `parse` (UPI · SEPA · QR) |
158
+ | `JoopReceiptService` | `generate`, `getById` |
159
+ | `JoopStatementParser` | `parse` (CSV · OFX · QIF formats) |
160
+
161
+ **Example — Loan with amortisation schedule:**
162
+ ```typescript
163
+ import { JoopLoanServicingService } from 'joopjs';
164
+
165
+ const loans = new JoopLoanServicingService();
166
+ const loan = loans.createLoan({
167
+ borrowerName: 'Alice Smith', borrowerId: 'u-001',
168
+ principalAmount: 120_000, annualInterestRatePercent: 9.5,
169
+ tenureMonths: 36, currency: 'USD',
170
+ });
171
+
172
+ console.log(`EMI: $${loan.emiAmount}`); // auto-calculated
173
+ loans.recordPayment(loan.id, loan.emiAmount); // interest-first allocation
174
+
175
+ const schedule = loans.getSchedule(loan.id); // JoopInstallment[]
176
+ console.log(schedule[0].status); // 'paid'
177
+ ```
178
+
179
+ ---
180
+
181
+ ### Finance (13 services)
182
+
183
+ | Service | Key Methods |
184
+ |---|---|
185
+ | `JoopMutualFundService` | `registerFund`, `invest`, `redeem`, `updateNav`, `createSip`, `executeSip` |
186
+ | `JoopBudgetService` | `createBudget`, `addCategory`, `recordSpend`, `getReport`, `getAlerts` |
187
+ | `JoopPortfolioService` | `createPortfolio`, `addHolding`, `updatePrice`, `getSummary`, `rebalance` |
188
+ | `JoopTaxCalculatorService` | `setTaxProfile`, `addSlab`, `calculate`, `calcCapitalGainsTax` |
189
+ | `JoopCashFlowService` | `addCashFlow`, `forecast`, `getSummary` |
190
+ | `JoopSavingsGoalService` | `create`, `contribute`, `getProgress`, `getSuggestedContribution` |
191
+ | `JoopNetWorthService` | `addAsset`, `addLiability`, `getSnapshot`, `getHistory` |
192
+ | `JoopCurrencyExchangeService` | `setRate`, `convert`, `convertMultiple`, `getRateHistory` |
193
+ | `JoopLoanEligibilityService` | `check`, `getMaxAmount` |
194
+ | `JoopInterestCalculatorService` | `simple`, `compound`, `emi`, `rule72` |
195
+ | `JoopCreditScoreService` | `calculate`, `getFactors`, `simulate` |
196
+ | `JoopLoyaltyService` | `addPoints`, `redeem`, `getBalance`, `getTier` |
197
+ | `JoopTransactionCategorizerService` | `categorize`, `batchCategorize`, `addRule` |
198
+
199
+ **Example — Mutual Fund SIP:**
200
+ ```typescript
201
+ import { JoopMutualFundService } from 'joopjs';
202
+
203
+ const mf = new JoopMutualFundService();
204
+ mf.registerFund({ id: 'EQ001', name: 'Equity Growth', category: 'equity', currentNav: 45.50, currency: 'USD' });
205
+
206
+ const holding = mf.invest('EQ001', 'inv-001', 5000);
207
+ console.log(holding.units); // 5000 / 45.50 = 109.89 units
208
+
209
+ const sip = mf.createSip('EQ001', 'inv-001', 500, 'monthly', Date.now());
210
+ mf.executeSip(sip.id); // invests 500, advances next execution date
211
+ ```
212
+
213
+ ---
214
+
215
+ ### Security (12 services)
216
+
217
+ | Service | Key Methods |
218
+ |---|---|
219
+ | `JoopSanctionsScreeningService` | `loadList`, `screen`, `disableList`, `enableList`, `hit$` |
220
+ | `JoopAmlService` | `addRule`, `checkTransaction`, `flag`, `alert$` |
221
+ | `JoopRiskEngineService` | `addFactor`, `evaluate`, `setThreshold`, `score$` |
222
+ | `JoopFraudDetectionService` | `addRule`, `assess`, `alert$` |
223
+ | `JoopKycStateMachineService` | `submit`, `verify`, `getStatus`, `status$` |
224
+ | `JoopBehavioralBiometricsService` | `startSession`, `recordEvent`, `analyzeSession`, `setBaseline` |
225
+ | `JoopThreatIntelligenceService` | `addIndicator`, `checkIp`, `isBlocked`, `blockIndicator` |
226
+ | `JoopCompliancePolicyService` | `addPolicy`, `recordAudit`, `getPolicyStatus`, `getRecentFailures` |
227
+ | `JoopPIIScannerService` | `scan`, `redact`, `addPattern` |
228
+ | `JoopSecureClipboardService` | `write`, `read`, `clear`, `clearAfter` |
229
+ | `JoopAntiTamperService` | `protect`, `verify`, `onTamper$` |
230
+ | `JoopCertPinningService` | `pin`, `verify`, `addCertificate` |
231
+
232
+ **Example — Sanctions screening:**
233
+ ```typescript
234
+ import { JoopSanctionsScreeningService } from 'joopjs';
235
+
236
+ const sanctions = new JoopSanctionsScreeningService();
237
+ sanctions.loadList('ofac', ofacEntities);
238
+
239
+ // React to hits before screening
240
+ sanctions.hit$().subscribe(hit => alertComplianceTeam(hit));
241
+
242
+ const result = sanctions.screen({ name: customer.fullName, country: customer.country });
243
+ // result.status: 'clear' | 'hit' | 'review'
244
+ // result.matches[]: [{ entity, matchType: 'exact'|'alias'|'fuzzy', score }]
245
+ if (result.status !== 'clear') throw new Error('Blocked by sanctions');
246
+ ```
247
+
248
+ ---
249
+
250
+ ### Auth & Sessions (10 services)
251
+
252
+ | Service | Key Methods |
253
+ |---|---|
254
+ | `JoopAuthService` | `login`, `logout`, `refresh`, `getCurrentUser`, `session$` |
255
+ | `JoopJwtService` | `sign`, `verify`, `decode`, `revoke`, `isRevoked`, `renew` |
256
+ | `JoopOtpService` | `generate`, `verify`, `generateTotpSecret`, `verifyTotp` |
257
+ | `JoopMfaService` | `enroll`, `challenge`, `respond`, `unenroll`, `status$` |
258
+ | `JoopPKCEService` | `buildAuthorizationUrl`, `exchangeCode`, `refreshTokens`, `parseIdToken` |
259
+ | `JoopOIDCClient` | `loadDiscovery`, `buildLoginUrl`, `processCallback`, `endSession` |
260
+ | `JoopSsoService` | `registerProvider`, `getLoginUrl`, `handleCallback`, `mapRole` |
261
+ | `JoopIdleService` | `start`, `reset`, `stop`, `idle$` |
262
+ | `JoopMultiTabSyncService` | `broadcast`, `listen`, `sync$` |
263
+ | `JoopConcurrentSessionService` | `register`, `invalidateOthers`, `getActiveSessions` |
264
+
265
+ ---
266
+
267
+ ### Encryption (8 services)
268
+
269
+ | Service | Key Methods |
270
+ |---|---|
271
+ | `JoopGcmService` | `generateKey`, `encrypt`, `decrypt`, `encryptObject`, `decryptObject`, `exportKey`, `importKey` |
272
+ | `JoopX25519Service` | `generateKeyPair`, `deriveSharedSecret`, `deriveAesKey` |
273
+ | `JoopE2EService` | `initSession`, `encrypt`, `decrypt` |
274
+ | `JoopRsaService` | `generateKeyPair`, `encrypt`, `decrypt`, `sign`, `verify`, `exportPublicKey` |
275
+ | `JoopHashService` | `sha256`, `sha512`, `hmac`, `hashPassword`, `verifyPassword` |
276
+ | `JoopKeyVault` | `store`, `retrieve`, `revoke`, `rotate`, `list` |
277
+ | `JoopSecureStorage` | `set`, `get`, `remove`, `clear` |
278
+ | `JoopRandomService` | `bytes`, `hex`, `uuid`, `token`, `integer`, `nonce` |
279
+
280
+ **Example — End-to-end encrypted messaging:**
281
+ ```typescript
282
+ import { JoopX25519Service, JoopGcmService } from 'joopjs';
283
+
284
+ const dh = new JoopX25519Service();
285
+ const gcm = new JoopGcmService();
286
+
287
+ // Both parties generate key pairs and exchange public keys
288
+ const alice = dh.generateKeyPair();
289
+ const bob = dh.generateKeyPair();
290
+
291
+ // Derive identical shared secret on both sides
292
+ const aliceShared = dh.deriveSharedSecret(alice.privateKey, bob.publicKey);
293
+ const sessionKey = await dh.deriveAesKey(aliceShared);
294
+
295
+ // Encrypt / decrypt messages
296
+ const enc = await gcm.encrypt('Transfer $500 to Bob', sessionKey);
297
+ const msg = await gcm.decrypt(enc.ciphertext, sessionKey, enc.iv);
298
+ ```
299
+
300
+ ---
301
+
302
+ ### Device (7 services)
303
+
304
+ | Service | Key Methods |
305
+ |---|---|
306
+ | `JoopDeviceFingerprintService` | `collect`, `collectFlat`, `hash` |
307
+ | `JoopBiometricAuthService` | `isAvailable`, `enroll`, `authenticate`, `revoke` |
308
+ | `JoopCardScannerService` | `scan`, `parse`, `validate` |
309
+ | `JoopPushService` | `register`, `unregister`, `onMessage$` |
310
+ | `JoopAppLifecycleService` | `onForeground$`, `onBackground$`, `onTerminate$` |
311
+ | `JoopScreenSecurityService` | `isDevtoolsOpen`, `activate`, `deactivate` |
312
+ | `JoopClientInfoService` | `collect`, `collectFlat` |
313
+
314
+ ---
315
+
316
+ ### Network & API (11 services)
317
+
318
+ | Service | Key Methods |
319
+ |---|---|
320
+ | `JoopHttpClient` | `get`, `post`, `put`, `patch`, `delete`, `upload` |
321
+ | `JoopHttpClientExtended` | `getWithRetry`, `postWithCache`, `batchRequests` |
322
+ | `JoopInterceptorPipeline` | `add`, `remove`, `execute` |
323
+ | `JoopRequestSigningService` | `sign`, `verify`, `signRequest` |
324
+ | `JoopRequestQueue` | `enqueue`, `flush`, `pause`, `resume` |
325
+ | `JoopOfflineQueueService` | `enqueue`, `flush`, `onOnline$` |
326
+ | `JoopPollingService` | `start`, `stop`, `result$` |
327
+ | `JoopIdempotencyService` | `execute`, `isDuplicate`, `clear` |
328
+ | `JoopWebhookVerifier` | `verify`, `addSecret` |
329
+ | `JoopCacheService` | `get`, `set`, `getOrSet`, `invalidate`, `stats` |
330
+ | `JoopWebSocketService` | `connect`, `send`, `message$`, `disconnect` |
331
+
332
+ ---
333
+
334
+ ### Workers & State (8 services)
335
+
336
+ | Service | Key Methods |
337
+ |---|---|
338
+ | `JoopStore` / `createStore` | `getState`, `dispatch`, `subscribe`, `undo`, `redo` |
339
+ | `JoopWorkflowEngine` | `register`, `start`, `transition`, `getState` |
340
+ | `JoopSyncEngine` | `push`, `pull`, `sync`, `conflict$` |
341
+ | `JoopWorkerPool` | `run`, `terminate`, `stats` |
342
+ | `JoopCompressionService` | `compress`, `decompress`, `compressString` |
343
+ | `JoopEventBus` / `joopEventBus` | `emit`, `on`, `off`, `once` |
344
+ | `JoopCircuitBreaker` | `execute`, `getState`, `reset` |
345
+ | `CRDTCounter` / `CRDTSet` / `CRDTText` | Conflict-free replicated data types |
346
+
347
+ ---
348
+
349
+ ### Observability (6 services)
350
+
351
+ | Service | Key Methods |
352
+ |---|---|
353
+ | `JoopAuditLog` | `log`, `query`, `getFailures` |
354
+ | `JoopPerformanceService` | `mark`, `measure`, `getEntries`, `clearMarks` |
355
+ | `JoopErrorReporter` | `report`, `captureException`, `flush` |
356
+ | `JoopWebVitals` | `collect`, `report`, `vitals$` |
357
+ | `JoopSessionRecorder` | `start`, `stop`, `replay`, `export` |
358
+ | `JoopCorrelationService` | `generate`, `set`, `get`, `clear` |
359
+
360
+ ---
361
+
362
+ ### UI & Forms (9 services)
363
+
364
+ | Service | Key Methods |
365
+ |---|---|
366
+ | `JoopThemeService` | `apply`, `toggle`, `currentTheme$` |
367
+ | `JoopI18nService` | `setLocale`, `t`, `formatCurrency`, `formatDate`, `locale$` |
368
+ | `JoopFeatureFlagService` | `enable`, `disable`, `isEnabled`, `change$` |
369
+ | `JoopFormValidator` | `validate`, `addRule`, `getErrors` |
370
+ | `JoopFormBuilder` | `field`, `group`, `array`, `build` |
371
+ | `JoopAlertService` | `success`, `error`, `warn`, `info`, `alert$` |
372
+ | `JoopPaginationService` | `setPage`, `nextPage`, `prevPage`, `state$` |
373
+ | `JoopA11yService` | `announce`, `setFocusTrap`, `releaseFocusTrap` |
374
+ | `JoopVirtualScroll` | `setItems`, `getVisibleRange`, `scroll$` |
375
+
376
+ ---
377
+
378
+ ### Utilities (21 services)
379
+
380
+ | Service | Key Methods |
381
+ |---|---|
382
+ | `JoopConfigService` | `set`, `get`, `getAll`, `reset` |
383
+ | `JoopLogger` | `debug`, `info`, `warn`, `error`, `setLevel` |
384
+ | `JoopHealthService` | `register`, `check`, `status$` |
385
+ | `JoopRateLimiter` | `check`, `record`, `block`, `getStatus` |
386
+ | `JoopAnalyticsService` | `track`, `identify`, `page`, `flush` |
387
+ | `JoopExportService` | `toCSV`, `toJSON`, `toXLSX` |
388
+ | `JoopGeoService` | `getCurrentPosition`, `watch`, `distanceTo` |
389
+ | `JoopNotificationService` | `show`, `schedule`, `cancel`, `permission$` |
390
+ | `JoopAiClient` | `chat`, `embed`, `complete` (OpenAI · Anthropic · Gemini · Ollama) |
391
+ | `JoopRouterService` | `navigate`, `addGuard`, `currentRoute$` |
392
+ | `JoopPluginService` | `register`, `execute`, `list` |
393
+ | ... and more | `JoopMediaService`, `JoopWatermarkService`, `JoopConsentService`, `JoopDeeplinkRouter`, `JoopNativeBridgeService` |
394
+
395
+ ---
396
+
397
+ ### India & RegTech (2 modules)
398
+
399
+ ```typescript
400
+ import {
401
+ validatePan, maskPan, getPanDetails,
402
+ validateAadhaar, maskAadhaar, formatAadhaar,
403
+ validateIfsc, getIfscBank, getIfscDetails,
404
+ validateUpi, getUpiDetails, generateUpiLink,
405
+ validateGst, maskGst, getGstState, getGstDetails,
406
+ } from 'joopjs/india';
407
+
408
+ validatePan('ABCDE1234F'); // true
409
+ maskPan('ABCDE1234F'); // 'ABCDE****F'
410
+ generateUpiLink({ payeeVpa: 'merchant@bank', amount: 100 }); // upi://pay?...
411
+ ```
412
+
413
+ For NRIC (Singapore) and MyKad (Malaysia) — import from `'joopjs'` directly.
414
+
415
+ ---
416
+
417
+ ## Framework Integration
418
+
419
+ ### React
420
+
421
+ ```tsx
422
+ import { useEffect, useState } from 'react';
423
+ import { JoopDigitalWalletService } from 'joopjs';
424
+
425
+ const walletSvc = new JoopDigitalWalletService(); // singleton outside component
426
+
427
+ function BalanceCard({ walletId }: { walletId: string }) {
428
+ const [balance, setBalance] = useState(0);
429
+
430
+ useEffect(() => {
431
+ const unsub = walletSvc.balance$().subscribe(({ walletId: id, balance }) => {
432
+ if (id === walletId) setBalance(balance);
433
+ });
434
+ return unsub; // auto-cleanup on unmount
435
+ }, [walletId]);
436
+
437
+ return <div>Balance: ${balance}</div>;
438
+ }
439
+ ```
440
+
441
+ ### Angular
442
+
443
+ ```typescript
444
+ // app.config.ts (standalone)
445
+ import { ApplicationConfig } from '@angular/core';
446
+ import { provideJoop } from 'joopjs/angular';
447
+ import { createJoop } from 'joopjs';
448
+
449
+ export const appConfig: ApplicationConfig = {
450
+ providers: [
451
+ provideJoop(createJoop({ env: 'production', appId: 'my-app' })),
452
+ ],
453
+ };
454
+ ```
455
+
456
+ ```typescript
457
+ // component.ts
458
+ import { inject } from '@angular/core';
459
+ import { JOOP_AUTH } from 'joopjs/angular';
460
+
461
+ @Component({ ... })
462
+ export class LoginComponent {
463
+ private auth = inject(JOOP_AUTH);
464
+
465
+ async login(email: string, password: string) {
466
+ const session = await this.auth.login(email, password);
467
+ console.log('Logged in:', session.userId);
468
+ }
469
+ }
470
+ ```
471
+
472
+ ### Vue
473
+
474
+ ```typescript
475
+ // main.ts
476
+ import { createApp } from 'vue';
477
+ import { createJoopVue } from 'joopjs/vue';
478
+ import { createJoop } from 'joopjs';
479
+ import App from './App.vue';
480
+
481
+ createApp(App)
482
+ .use(createJoopVue(createJoop({ env: 'production', appId: 'my-app' })))
483
+ .mount('#app');
484
+ ```
485
+
486
+ ```vue
487
+ <!-- BalanceCard.vue -->
488
+ <script setup lang="ts">
489
+ import { useJoopWallet } from 'joopjs/vue';
490
+ const { balance, topUp } = useJoopWallet('wallet-001');
491
+ </script>
492
+
493
+ <template>
494
+ <div>Balance: {{ balance }}</div>
495
+ <button @click="topUp(100)">Add $100</button>
496
+ </template>
497
+ ```
498
+
499
+ ---
500
+
501
+ ## Reactive Observables
502
+
503
+ JoopJS uses its own lightweight reactive primitives (`JoopSubject`, `JoopBehaviorSubject`) — **not RxJS**. They are lighter, tree-shakeable, and have no RxJS dependency.
504
+
505
+ ```typescript
506
+ import { JoopSubject, JoopBehaviorSubject } from 'joopjs';
507
+
508
+ // Event stream — no initial value
509
+ const alerts$ = new JoopSubject<string>();
510
+
511
+ // Stateful stream — holds current value, replays to new subscribers
512
+ const status$ = new JoopBehaviorSubject<'idle' | 'processing' | 'done'>('idle');
513
+
514
+ // Subscribe
515
+ const unsub = status$.subscribe(value => console.log('Status:', value));
516
+ // → immediately logs 'idle' (BehaviorSubject replays current value)
517
+
518
+ // Emit
519
+ status$.next('processing'); // logs 'processing'
520
+
521
+ // Read current value synchronously
522
+ status$.getValue(); // 'processing'
523
+
524
+ // Stop listening
525
+ unsub();
526
+ ```
527
+
528
+ **Critical rule:** Always use `.next(value)` to emit — **never `.emit(value)`** (that method does not exist).
529
+
530
+ ---
531
+
532
+ ## TypeScript Types
533
+
534
+ All public types use the `Joop*` prefix and are exported from the same entry as their service:
535
+
536
+ ```typescript
537
+ // Status unions
538
+ type JoopWalletStatus = 'active' | 'frozen' | 'closed';
539
+ type JoopLoanAccountStatus = 'active' | 'closed' | 'defaulted' | 'written-off';
540
+ type JoopRepaymentStatus = 'pending' | 'paid' | 'partial' | 'overdue' | 'waived';
541
+ type JoopForwardType = 'buy' | 'sell';
542
+ type JoopSipStatus = 'active' | 'paused' | 'cancelled' | 'completed';
543
+ type JoopFundCategory = 'equity' | 'debt' | 'hybrid' | 'money-market' | 'index' | 'etf';
544
+ type JoopSanctionMatchType = 'exact' | 'alias' | 'fuzzy';
545
+ type JoopSanctionsList = 'ofac' | 'un' | 'eu' | 'uk' | 'custom';
546
+ type JoopAccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense';
547
+
548
+ // Data conventions
549
+ // Amounts → number (never a Money class)
550
+ // Currency → string (ISO-4217: 'USD', 'EUR', 'AED')
551
+ // Dates → number (Unix epoch milliseconds: Date.now())
552
+ // IDs → string
553
+ ```
554
+
555
+ ---
556
+
557
+ ## Sub-path Imports
558
+
559
+ Import from a specific sub-path for optimal tree-shaking:
560
+
561
+ ```typescript
562
+ import { JoopGcmService } from 'joopjs/encryption';
563
+ import { JoopAuthService } from 'joopjs/auth';
564
+ import { JoopCacheService } from 'joopjs/cache';
565
+ import { JoopWorkflowEngine } from 'joopjs/workflow';
566
+ import { JoopAiClient } from 'joopjs/ai';
567
+ import { validatePan, maskPan } from 'joopjs/india';
568
+ ```
569
+
570
+ **Available sub-paths:**
571
+ `encryption` · `auth` · `api` · `core` · `session` · `banking` · `security` · `device` · `observability` · `theme` · `i18n` · `ui` · `native-bridge` · `deeplink` · `cache` · `network` · `analytics` · `validation` · `utilities` · `forms` · `pwa` · `router` · `ai` · `state` · `workers` · `workflow` · `sync` · `platform` · `react` · `angular` · `vue` · `india`
572
+
573
+ ---
574
+
575
+ ## Contributing
576
+
577
+ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md) for development setup, coding conventions, and the pull request process.
578
+
579
+ ---
580
+
581
+ ## License
582
+
583
+ [MIT](./LICENSE) © Kundan Singh