@frankieone/one-sdk 1.9.14 → 1.9.15-rc.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 (60) hide show
  1. package/README.md +646 -8
  2. package/dist/cli/darwin-amd64/onesdk-cli +0 -0
  3. package/dist/cli/darwin-arm64/onesdk-cli +0 -0
  4. package/dist/cli/linux-amd64/onesdk-cli +0 -0
  5. package/dist/cli/linux-arm64/onesdk-cli +0 -0
  6. package/dist/cli/windows-amd64/onesdk-cli.exe +0 -0
  7. package/dist/commit.txt +1 -1
  8. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.d.ts.map +1 -1
  9. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.js +3 -1
  10. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.js.map +1 -1
  11. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.d.ts.map +1 -1
  12. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.js +5 -1
  13. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.js.map +1 -1
  14. package/dist/esm/modules/biometrics/vendors/Onfido/shared.d.ts +2 -1
  15. package/dist/esm/modules/biometrics/vendors/Onfido/shared.d.ts.map +1 -1
  16. package/dist/esm/modules/biometrics/vendors/Onfido/shared.js +4 -1
  17. package/dist/esm/modules/biometrics/vendors/Onfido/shared.js.map +1 -1
  18. package/dist/esm/modules/common/modules/loadAsyncAsset.d.ts +3 -3
  19. package/dist/esm/modules/common/modules/loadAsyncAsset.d.ts.map +1 -1
  20. package/dist/esm/modules/common/modules/loadAsyncAsset.js +1 -1
  21. package/dist/esm/modules/common/modules/loadAsyncAsset.js.map +1 -1
  22. package/dist/esm/modules/common/vendors/onfido/index.d.ts +1 -1
  23. package/dist/esm/modules/common/vendors/onfido/index.d.ts.map +1 -1
  24. package/dist/esm/modules/common/vendors/onfido/index.js +2 -1
  25. package/dist/esm/modules/common/vendors/onfido/index.js.map +1 -1
  26. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.d.ts +1 -0
  27. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.d.ts.map +1 -1
  28. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.js +1 -0
  29. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.js.map +1 -1
  30. package/dist/esm/modules/frankie-client/clients/IDVClient.d.ts +1 -0
  31. package/dist/esm/modules/frankie-client/clients/IDVClient.d.ts.map +1 -1
  32. package/dist/esm/modules/frankie-client/clients/IDVClient.js +1 -0
  33. package/dist/esm/modules/frankie-client/clients/IDVClient.js.map +1 -1
  34. package/dist/esm/modules/idv/definition.types.d.ts +7 -0
  35. package/dist/esm/modules/idv/definition.types.d.ts.map +1 -1
  36. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.d.ts.map +1 -1
  37. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.js +4 -1
  38. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.js.map +1 -1
  39. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.d.ts +1 -1
  40. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.d.ts.map +1 -1
  41. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.js +1 -1
  42. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.js.map +1 -1
  43. package/dist/esm/modules/idv/vendors/common/initialiseSession.d.ts +5 -2
  44. package/dist/esm/modules/idv/vendors/common/initialiseSession.d.ts.map +1 -1
  45. package/dist/esm/modules/idv/vendors/common/initialiseSession.js +57 -6
  46. package/dist/esm/modules/idv/vendors/common/initialiseSession.js.map +1 -1
  47. package/dist/esm/modules/meta.json +1 -1
  48. package/dist/esm/modules/ocr/definition.d.ts +8 -0
  49. package/dist/esm/modules/ocr/definition.d.ts.map +1 -1
  50. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.d.ts.map +1 -1
  51. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.js +6 -2
  52. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.js.map +1 -1
  53. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.d.ts.map +1 -1
  54. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.js +5 -1
  55. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.js.map +1 -1
  56. package/dist/esm/modules/ocr/vendors/Onfido/shared.d.ts +1 -0
  57. package/dist/esm/modules/ocr/vendors/Onfido/shared.d.ts.map +1 -1
  58. package/dist/esm/modules/ocr/vendors/Onfido/shared.js +4 -1
  59. package/dist/esm/modules/ocr/vendors/Onfido/shared.js.map +1 -1
  60. package/package.json +1 -1
package/README.md CHANGED
@@ -1,18 +1,656 @@
1
- # frontend-onesdk-library
1
+ # FrankieOne OneSDK Library
2
2
 
3
- FrankieOne OneSDK Library
3
+ FrankieOne OneSDK - A comprehensive frontend SDK library for identity verification, onboarding, and document verification flows.
4
4
 
5
- <sub>Frontend library for FrankieOne OneSDK</sub>
5
+ **Version:** 1.9.13
6
+ **Node Version:** >=18 (npm >=10)
7
+ **Published as:** `@frankieone/one-sdk` on NPM
6
8
 
7
- Currently using node 18.
9
+ ---
8
10
 
11
+ ## Table of Contents
12
+
13
+ - [Overview](#overview)
14
+ - [Architecture](#architecture)
15
+ - [Module Overview](#module-overview)
16
+ - [Vendor Integrations](#vendor-integrations)
17
+ - [IDV (Identity Verification)](#idv-identity-verification)
18
+ - [OCR (Document Recognition)](#ocr-document-recognition)
19
+ - [Biometrics](#biometrics)
20
+ - [Device Fingerprinting](#device-fingerprinting)
21
+ - [Federation](#federation)
22
+ - [Form](#form)
23
+ - [Integration Method Reference](#integration-method-reference)
24
+ - [Build & Development](#build--development)
25
+ - [Deployment](#deployment)
26
+
27
+ ---
28
+
29
+ ## Overview
30
+
31
+ This is a **hybrid monorepo** containing:
32
+
33
+ 1. **TypeScript/React Frontend SDK** - The main OneSDK library with multiple vendor integrations
34
+ 2. **Go CLI Tool** - Interactive CLI for generating OneSDK flows and local HTML preview
35
+
36
+ ### Key Technologies
37
+
38
+ | Category | Technologies |
39
+ |----------|-------------|
40
+ | **Frontend** | React 18.2, Redux Toolkit 2.2.1, TypeScript 5.7, Webpack 5, Vite 7.2 |
41
+ | **Styling** | TailwindCSS 3.4, Sass, PostCSS |
42
+ | **Testing** | Jest 28, ts-jest |
43
+ | **Reactive** | RxJS 7.5, Zod 3.19 |
44
+ | **CLI** | Go 1.21.5, Charmbracelet (huh, lipgloss, bubbles) |
45
+
46
+ ---
47
+
48
+ ## Architecture
49
+
50
+ ```
51
+ OneSDK (index.ts)
52
+ │
53
+ ────┴────
54
+ │ │
55
+ SDK Common Utils
56
+ │ │
57
+ └── Modules
58
+ ├── Individual (F2)
59
+ ├── Business
60
+ ├── Device (Sardine, ThreatMetrix)
61
+ ├── IDV (Onfido, Sumsub, Incode, Daon, Mastercard, Truuth, OcrLabs, IDVerse)
62
+ ├── OCR (Onfido, Sumsub, Incode, Daon, IDVerse)
63
+ ├── Biometrics (Onfido, Sumsub, Incode, Daon, OcrLabs, IDVerse)
64
+ ├── Form (Formio, React, Legacy)
65
+ ├── Federation (Singpass)
66
+ ├── Session
67
+ └── Frankie-Client (API)
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Module Overview
73
+
74
+ | Module | Purpose | Vendors |
75
+ |--------|---------|---------|
76
+ | **IDV** | Full identity verification flow | Onfido, Sumsub, Incode, Daon, Mastercard, Truuth, OcrLabs, IDVerse |
77
+ | **OCR** | Document scanning & data extraction | Onfido, Sumsub, Incode, Daon, IDVerse |
78
+ | **Biometrics** | Face capture & liveness detection | Onfido, Sumsub, Incode, Daon, OcrLabs, IDVerse |
79
+ | **Device** | Device fingerprinting | Sardine, ThreatMetrix |
80
+ | **Federation** | Federated identity (OAuth) | Singpass |
81
+ | **Form** | Data entry & review forms | Formio, React, Legacy |
82
+
83
+ ---
84
+
85
+ ## Vendor Integrations
86
+
87
+ ### IDV (Identity Verification)
88
+
89
+ #### Onfido
90
+
91
+ | Aspect | Details |
92
+ |--------|---------|
93
+ | **Integration Method** | Native SDK loaded from CDN |
94
+ | **SDK Source** | `https://sdk.onfido.com/v{version}` |
95
+ | **UI Type** | Vendor-provided UI with theme customization |
96
+ | **Version Support** | v14+ (modern) and <v14 (legacy modal-based) |
97
+
98
+ **Modes:**
99
+ - **OneStep Mode** (`useOneStep: true`): Combined document + face capture in single SDK instance
100
+ - **Dual Component Mode**: Separate OCR → Biometrics chain
101
+
102
+ **Key Features:**
103
+ - Theme support: `'light'` or `'dark'` with full `customUI` configuration
104
+ - Cross-device linking: QR code, copy link, SMS options
105
+ - Exit button support
106
+ - Analytics disabled by default
107
+ - Document type configuration: Passport, Drivers License, Medicare
108
+
109
+ **Events Emitted:**
110
+ - `ready`, `loading`, `error`, `detection_complete`, `detection_failed`
111
+ - `results`, `session_closed`, `session_interrupted`, `vendor_event`
112
+
113
+ **Files:**
114
+ - `modules/idv/vendors/Onfido/index.ts`
115
+ - `modules/ocr/vendors/Onfido/` (onfido.init.ts, onfidoLegacy.init.ts)
116
+ - `modules/biometrics/vendors/Onfido/`
117
+ - `modules/common/vendors/onfido/`
118
+
119
+ ---
120
+
121
+ #### Sumsub
122
+
123
+ | Aspect | Details |
124
+ |--------|---------|
125
+ | **Integration Method** | SDK Library with iframe UI |
126
+ | **SDK Source** | `https://static.sumsub.com/idensic/static/sns-websdk-builder.js` |
127
+ | **UI Type** | Vendor-provided iframe |
128
+ | **Products** | `'idv'`, `'ocr'`, `'poa'` |
129
+
130
+ **Initialization Flow:**
131
+ ```javascript
132
+ snsWebSdk.init(token, refreshTokenCallback)
133
+ .withConf({ theme: 'light' })
134
+ .withOptions({ addViewportTag: false, adaptIframeHeight: true })
135
+ .on('idCheck.onError', errorHandler)
136
+ .onMessage(messageHandler)
137
+ .build()
138
+ .launch(mountElement)
139
+ ```
140
+
141
+ **Message Types:**
142
+ - `idCheck.onReady` - SDK loading
143
+ - `idCheck.onInitialized` - UI ready
144
+ - `idCheck.onApplicantStatusChanged` - Review status changes (pending → completed)
145
+ - `idCheck.onUploadError` - Upload failures
146
+
147
+ **Files:**
148
+ - `modules/idv/vendors/Sumsub/index.ts`
149
+ - `modules/ocr/vendors/Sumsub/index.ts`
150
+ - `modules/biometrics/vendors/Sumsub/index.ts`
151
+ - `modules/common/vendors/sumsub/`
152
+
153
+ ---
154
+
155
+ #### Incode
156
+
157
+ | Aspect | Details |
158
+ |--------|---------|
159
+ | **Integration Method** | Native SDK + Camera (OCR/Biometrics) or Iframe (IDV) |
160
+ | **SDK Source** | `https://sdk.incode.com/sdk/onBoarding-{version}.js` |
161
+ | **Default Version** | 1.75.2 |
162
+ | **UI Type** | Custom camera UI with document selector |
163
+
164
+ **Camera Types:**
165
+ - `'front'` - Document front side
166
+ - `'back'` - Document back side
167
+ - `'selfie'` - Face capture
168
+
169
+ **Document Type Mapping:**
170
+ ```javascript
171
+ Passport → 'PASSPORT'
172
+ DriversLicense → 'DRIVERS_LICENCE'
173
+ MedicalCard → 'NATIONAL_HEALTH_ID'
174
+ ```
175
+
176
+ **IDV Iframe Mode:**
177
+ - PostMessage protocol with workflow messages
178
+ - Success: `{ workflow: 'INCODE_COMPLETE' }`
179
+ - Error: `{ workflow: 'INCODE_ERROR' }`
180
+ - Session key: `interviewId`
181
+
182
+ **Special Handling:**
183
+ - Memory out of bounds error detection via console.error override
184
+ - Country/region document validation
185
+ - Consent reflow fix for iOS WebKit
186
+
187
+ **Files:**
188
+ - `modules/idv/vendors/Incode/index.ts`
189
+ - `modules/ocr/vendors/Incode/index.ts`
190
+ - `modules/biometrics/vendors/Incode/index.ts`
191
+ - `modules/common/vendors/incode/`
192
+
193
+ ---
194
+
195
+ #### Daon
196
+
197
+ | Aspect | Details |
198
+ |--------|---------|
199
+ | **Integration Method** | Iframe + PostMessage protocol |
200
+ | **UI Type** | Vendor-provided iframe |
201
+ | **Modules** | IDV, OCR, Biometrics |
202
+
203
+ **Message Format:**
204
+ ```javascript
205
+ // Success
206
+ { workflow: 'DAON_COMPLETE' }
207
+
208
+ // Error
209
+ { workflow: 'DAON_ERROR' }
210
+ ```
211
+
212
+ **Post-Iframe Actions:**
213
+ - IDV: `initProcess` (default)
214
+ - OCR: `initProcessAndEvaluateResults`
215
+ - Biometrics: `initProcessBiometrics` (with window event listener)
216
+
217
+ **Check Processing Pool:**
218
+ - Enabled by default for Daon
219
+ - `wait_time: 5` seconds
220
+ - `max_attempts: 3`
221
+
222
+ **Files:**
223
+ - `modules/idv/vendors/Daon/index.ts`
224
+ - `modules/ocr/vendors/Daon/index.ts`
225
+ - `modules/biometrics/vendors/Daon/index.ts`
226
+
227
+ ---
228
+
229
+ #### Mastercard
230
+
231
+ | Aspect | Details |
232
+ |--------|---------|
233
+ | **Integration Method** | Iframe + JSON PostMessage |
234
+ | **UI Type** | Vendor-provided iframe |
235
+ | **Session Key** | `workflowExecutionId` |
236
+
237
+ **Message Format (Stringified JSON):**
238
+ ```javascript
239
+ // Loaded
240
+ { "payload": { "value": "loaded" } }
241
+
242
+ // Success
243
+ { "payload": { "value": "success" }, "workflowExecutionId": "..." }
244
+
245
+ // Error
246
+ { "payload": { "value": "error", "metainfo": { "msg": "..." } } }
247
+ ```
248
+
249
+ **Key Difference:** Mastercard emits its own 'loaded' message (`emitOnLoad: false`)
250
+
251
+ **Files:**
252
+ - `modules/idv/vendors/Mastercard/index.ts`
253
+
254
+ ---
255
+
256
+ #### Truuth
257
+
258
+ | Aspect | Details |
259
+ |--------|---------|
260
+ | **Integration Method** | Web Component SDK (NOT iframe) |
261
+ | **SDK Source** | `https://cdn.truuth.id/kyc/websdk/{version}/truuth-kyc-websdk.js` |
262
+ | **UI Type** | `<truuth-kyc>` custom element |
263
+
264
+ **Event Handling:**
265
+ ```javascript
266
+ window.addEventListener('forwardedTruuthEventForOneSDK', eventListener)
267
+ ```
268
+
269
+ **Event Types:**
270
+ - `VERIFICATION_PROCESSING_STARTED` → loading + detection_complete + polling
271
+ - `VERIFICATION_COMPLETED` → initProcess + results
272
+ - `TERMS_AND_CONDITION_DECLINED` → input_required
273
+ - `VERIFICATION_SUBMISSION_ABORTED` → input_required
274
+ - `VERIFICATION_PROCESSING_TIMEOUT` → error
275
+ - `ERROR` → detection_failed + error
276
+
277
+ **Files:**
278
+ - `modules/idv/vendors/Truuth/index.ts`
279
+
280
+ ---
281
+
282
+ #### OcrLabs
283
+
284
+ | Aspect | Details |
285
+ |--------|---------|
286
+ | **IDV Integration** | Server-side action workflow with persistent storage |
287
+ | **Biometrics Integration** | WebSocket + WebRTC (liveness detection) |
288
+ | **WebSocket URL** | `wss://engine.au.v3.liveness.idkit.io` |
289
+
290
+ **IDV Flow:**
291
+ 1. Check StorageClient for stored action details
292
+ 2. Workflow states: `IDV_SUCCESS` or `IDV_ERROR`
293
+ 3. Redirect to OcrLabs or start dummy flow
294
+
295
+ **Biometrics Liveness Detection:**
296
+ ```
297
+ Face Detection → "Position your face within the frame"
298
+ ↓
299
+ Smile Detection → "Please give us a BIG Smile!"
300
+ ↓
301
+ detection_complete → initProcess
302
+ ```
303
+
304
+ **UI Elements Created:**
305
+ - `onesdk_idv_container` - Main container
306
+ - `onesdk_idv_video` - Live video feed (mirrored)
307
+ - `onesdk_idv_overlay` - Overlay container
308
+ - `onesdk_idv_mask` - Oval face frame with shadow
309
+ - `onesdk_idv_instructions` - Dynamic instructions
310
+
311
+ **Detection Timeout:** 7.5 seconds per action
312
+
313
+ **Files:**
314
+ - `modules/idv/vendors/OcrLabs/`
315
+ - `modules/biometrics/vendors/OcrLabs/`
316
+
317
+ ---
318
+
319
+ #### IDVerse
320
+
321
+ | Aspect | Details |
322
+ |--------|---------|
323
+ | **Integration Method** | Web Component + Web Worker |
324
+ | **SDK Source** | ESM module from CDN |
325
+ | **UI Type** | `<idverse-sdk-ui>` custom element |
326
+ | **Build ID** | `build_01K7RRTN6RTH4S3MGHEBDDJ3FV` |
327
+
328
+ **Recognizer Types:**
329
+ - `'id-scan'` - Document scanning with front/back capture
330
+ - `'face-scan'` - Biometric face capture with liveness
331
+
332
+ **Web Worker:**
333
+ - Cross-origin blob worker for image processing
334
+ - Created via `URL.createObjectURL(blob)`
335
+ - Manually terminated on SDK destroy
336
+
337
+ **Event Types:**
338
+ - `authenticated` - SDK initialized
339
+ - `ready` - Web component ready
340
+ - `scanSuccess` - Scan completed successfully
341
+ - `scanFail` - Scan failed (with error codes)
342
+ - `validDocumentConfirmed` - User confirmed document
343
+ - `fatalError` - Unrecoverable error
344
+ - `faceScanClosed` - Face scan modal closed
345
+
346
+ **Retry Logic:**
347
+ - Default max retries: 3 (configurable via recipe)
348
+ - `scanFail` increments counter
349
+ - SDK destroyed when max retries exceeded
350
+
351
+ **Asset Bundle (~2.2 MB):**
352
+ - Main bundle: 935 KB
353
+ - CSS: 113 KB
354
+ - Lottie animations: 700+ KB (20 animations)
355
+ - Audio feedback: 75+ KB
356
+ - WorkSans font: 354 KB
357
+
358
+ **Files:**
359
+ - `modules/common/vendors/idverse/index.ts`
360
+ - `modules/ocr/vendors/IDVerse/index.ts`
361
+ - `modules/biometrics/vendors/IDVerse/index.ts`
362
+
363
+ ---
364
+
365
+ ### OCR (Document Recognition)
366
+
367
+ OCR vendors share implementations with IDV where applicable. Key differences:
368
+
369
+ | Vendor | Post-Process Action | Review Screen |
370
+ |--------|---------------------|---------------|
371
+ | Onfido | `initProcessAndEvaluateResults` | Feature flag controlled |
372
+ | Sumsub | `initProcess` (product='ocr') | Built-in |
373
+ | Incode | Native camera capture | Validation callback |
374
+ | Daon | `initProcessAndEvaluateResults` | Optional form attachment |
375
+ | IDVerse | `initProcessAndEvaluateResults` | Feature flag controlled |
376
+
377
+ ---
378
+
379
+ ### Biometrics
380
+
381
+ | Vendor | Capture Method | Liveness Detection |
382
+ |--------|----------------|-------------------|
383
+ | **Onfido** | SDK face step | Motion, video, or standard variants |
384
+ | **Sumsub** | SDK (product='idv') | Built-in |
385
+ | **Incode** | Native camera selfie | SDK-managed |
386
+ | **Daon** | Iframe with window events | Vendor-managed |
387
+ | **OcrLabs** | WebRTC + WebSocket | Face + Smile detection |
388
+ | **IDVerse** | Web Component face-scan | DFA + face matching |
389
+
390
+ ---
391
+
392
+ ### Device Fingerprinting
393
+
394
+ #### Sardine
395
+
396
+ | Aspect | Details |
397
+ |--------|---------|
398
+ | **Integration Method** | Remote SDK with context-based configuration |
399
+ | **SDK Source** | `https://api.{domain}.sardine.ai/assets/loader.min.js` |
400
+ | **Environments** | `api.sardine.ai` (production), `api.sandbox.sardine.ai` (sandbox) |
401
+
402
+ **Configuration:**
403
+ ```javascript
404
+ window._Sardine.createContext({
405
+ clientId,
406
+ sessionKey,
407
+ environment: 'production' | 'sandbox',
408
+ parentElement: document.body,
409
+ flow: activityType,
410
+ onDeviceResponse: (data) => { /* fingerprint data */ }
411
+ })
412
+ ```
413
+
414
+ **Activity Types:**
415
+ - `REGISTRATION` → mapped to `SIGNUP`
416
+ - `LOGIN`, `CRYPTO_DEPOSIT`, `CRYPTO_WITHDRAWAL`, `FIAT_DEPOSIT`, `FIAT_WITHDRAWAL`
417
+
418
+ **Events:**
419
+ - `session_data_generated`
420
+ - `device_characteristics_extracted`
421
+ - `value_set`
422
+
423
+ **Files:**
424
+ - `modules/device/vendors/Sardine.ts`
425
+
426
+ ---
427
+
428
+ #### ThreatMetrix
429
+
430
+ | Aspect | Details |
431
+ |--------|---------|
432
+ | **Integration Method** | Obfuscated SDK (intentionally hidden) |
433
+ | **SDK Source** | Inline vendor file `nolint_fp-clientlib-v4.js` |
434
+ | **Domain** | `h.online-metrix.net` |
435
+
436
+ **Initialization:**
437
+ ```javascript
438
+ threatmetrixSdk.profile('h.online-metrix.net', clientID, vendorSessionID)
439
+ ```
440
+
441
+ **Technical Details:**
442
+ - Uses RTCPeerConnection with TURN servers for data collection
443
+ - ClientID must be exactly 8 characters
444
+ - CSP nonce handling for Content Security Policy compliance
445
+
446
+ **Files:**
447
+ - `modules/device/vendors/Threatmetrix/index.ts`
448
+ - `modules/device/vendors/Threatmetrix/nolint_fp-clientlib-v4.js`
449
+
450
+ ---
451
+
452
+ ### Federation
453
+
454
+ #### Singpass (MyInfo)
455
+
456
+ | Aspect | Details |
457
+ |--------|---------|
458
+ | **Integration Method** | OAuth 2.0 Authorization Code Flow |
459
+ | **Protocol** | Browser redirect to Singpass, then code exchange |
460
+
461
+ **Environment URLs:**
462
+ ```
463
+ Sandbox: https://sandbox.api.myinfo.gov.sg/com/v3/authorise
464
+ Test: https://test.api.myinfo.gov.sg/com/v3/authorise
465
+ Production: https://api.myinfo.gov.sg/com/v3/authorise
466
+ ```
467
+
468
+ **OAuth Flow:**
469
+ 1. Build authorization URL with `client_id`, `attributes`, `state`, `redirect_uri`, `purpose`
470
+ 2. Redirect to Singpass
471
+ 3. User authenticates and consents
472
+ 4. Redirect back with `code` and `state`
473
+ 5. Validate state (CSRF protection)
474
+ 6. Submit code to backend via `FederationClient.provideAuthorisation()`
475
+ 7. Receive user data
476
+ 8. User approves → `FederationClient.submitCachedData()`
477
+
478
+ **Events:**
479
+ - `results` - User data with approve callback
480
+ - `data_extracted_successfully` - After approval
481
+ - `error` - On failures
482
+
483
+ **Validation:**
484
+ - State parameter must match session ID
485
+ - Production `redirect_uri` must use HTTPS
486
+ - No preloaded entities allowed
487
+
488
+ **Files:**
489
+ - `modules/federation/vendors/Singpass.ts`
490
+
491
+ ---
492
+
493
+ ### Form
494
+
495
+ #### Form Vendors Overview
496
+
497
+ | Vendor | Technology | Use Case |
498
+ |--------|------------|----------|
499
+ | **Formio** | Form.io SDK | Cloud-based form builder |
500
+ | **React** | Custom React components | Modern, flexible forms |
501
+ | **Legacy** | Legacy UI widgets | Backward compatibility |
502
+
503
+ ---
504
+
505
+ #### Formio
506
+
507
+ | Aspect | Details |
508
+ |--------|---------|
509
+ | **SDK Source** | `https://cdn.form.io/formiojs/formio.full.js` |
510
+ | **CSS Dependencies** | Bootstrap 4.6.1, Formio CSS, FontAwesome 4.7 |
511
+
512
+ **Wrapping Modes (feature flag controlled):**
513
+ - **Shadow DOM** (`'shadow'`): Isolated styles via `attachShadow({ mode: 'open' })`
514
+ - **Iframe** (`'iframe'`): Complete DOM/CSS isolation
515
+ - **Div** (`'div'`): Direct DOM insertion (default)
516
+
517
+ **Data Transformation:**
518
+ ```
519
+ Individual Data ←→ Formio Schema
520
+ │ │
521
+ name, DOB basicPiiForm
522
+ addresses addressComponentForm
523
+ documents documents[]
524
+ ```
525
+
526
+ **Document Type Mapping:**
527
+ - `PASSPORT` → `pass_idNumber`, `pass_idExpiry`
528
+ - `DRIVERS_LICENCE` → `dl_region`, `dl_idNumber`, `dl_cardNumber`
529
+ - `NATIONAL_HEALTH_ID` → `medi_idNumber`, `medi_cardPosition`, `medi_cardColour`, `medi_idExpiry`
530
+
531
+ **Files:**
532
+ - `modules/form/vendors/formio/`
533
+
534
+ ---
535
+
536
+ #### React Form
537
+
538
+ | Aspect | Details |
539
+ |--------|---------|
540
+ | **Framework** | React 18 + Redux Toolkit + React Hook Form |
541
+ | **Components** | 60+ form components |
542
+ | **Screens** | Welcome, Consent, IdSelection, IdDetails, PersonalDetails, Review, DocumentUpload, Result |
543
+
544
+ **Key Hooks:**
545
+ - `useEventContext` - Event hub context provider
546
+ - `useConfigFactory` - Configuration merging
547
+ - `useFormMapper` - Field component mapping
548
+ - `useAddressSearch` - Google Maps autocomplete integration
549
+
550
+ **Field Configuration by Document Type:**
551
+
552
+ **Australian Drivers Licence (by state):**
553
+ | State | License Pattern | Card Pattern |
554
+ |-------|-----------------|--------------|
555
+ | NSW | 6-8 alphanumeric | 10 numeric |
556
+ | VIC | 1-10 numeric | 8 alphanumeric |
557
+ | QLD | 8-9 alphanumeric | 10 alphanumeric |
558
+ | SA | 6 alphanumeric | 9 alphanumeric |
559
+ | WA | 7 numeric | 8-10 alphanumeric |
560
+
561
+ **Validation Rules:**
562
+ ```javascript
563
+ ValidationRulesForForm = {
564
+ onlyAlphabets: /^[a-zA-Z]+(\s+[a-zA-Z]+)*$/,
565
+ onlyNumbers: /^[0-9]+$/,
566
+ alphaNumeric: /^[a-zA-Z0-9]+$/,
567
+ emailPattern: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/
568
+ }
569
+ ```
570
+
571
+ **Screen Events:**
572
+ - `form:{screenId}:ready` - Screen mounted
573
+ - `form:{screenId}:loaded` - Screen loaded
574
+ - `form:{screenId}:failed` - Screen error
575
+ - `form:{screenId}:success` - Screen completed
576
+
577
+ **Files:**
578
+ - `modules/form/vendors/react/`
579
+
580
+ ---
581
+
582
+ ## Integration Method Reference
583
+
584
+ | Method | Vendors | Characteristics |
585
+ |--------|---------|-----------------|
586
+ | **Native SDK** | Onfido, Incode | Full control, version management, CDN loading |
587
+ | **Iframe + PostMessage** | Daon, Mastercard, Incode (IDV) | Sandboxed, vendor-managed UI |
588
+ | **Web Component** | IDVerse, Truuth | Custom elements, event-based |
589
+ | **WebSocket + WebRTC** | OcrLabs | Real-time liveness, canvas/video rendering |
590
+ | **OAuth 2.0** | Singpass | Server-side, browser redirect flow |
591
+ | **Remote SDK** | Sardine, Sumsub | Dynamically loaded from vendor CDN |
592
+ | **Obfuscated SDK** | ThreatMetrix | Inline vendor code, hidden implementation |
593
+ | **Form Builder** | Formio | Cloud service SDK with schema |
594
+ | **React Components** | React Form | Custom component library |
595
+
596
+ ---
597
+
598
+ ## Build & Development
599
+
600
+ ### NPM Scripts
601
+
602
+ ```bash
603
+ # Development
604
+ npm run dev:cli # Go CLI development mode
605
+
606
+ # Build
607
+ npm run build:umd # Webpack UMD bundle
608
+ npm run build:esm # TypeScript ESM compilation
609
+ npm run build:css # TailwindCSS generation
610
+ npm run build:cli # Cross-platform Go binaries
611
+ npm run build:npm # Full ESM+CSS+CLI build
612
+
613
+ # Testing
614
+ npm run test # Jest test suite
615
+ ```
616
+
617
+ ### Build Outputs
618
+
619
+ | Output | Location | Description |
620
+ |--------|----------|-------------|
621
+ | UMD | `dist/umd/oneSdk.umd.js` | Browser global bundle |
622
+ | ESM | `dist/esm/modules/index.js` | ES Module with types |
623
+ | CSS | `dist/esm/styles/f1-style.css` | TailwindCSS output |
624
+ | CLI | `dist/cli/{platform}/` | Platform-specific Go binaries |
625
+
626
+ ### CLI Platforms
627
+
628
+ - `darwin-amd64` (macOS Intel)
629
+ - `darwin-arm64` (macOS Apple Silicon)
630
+ - `linux-amd64`
631
+ - `linux-arm64`
632
+ - `windows-amd64`
633
+
634
+ ---
9
635
 
10
636
  ## Deployment
11
637
 
12
- Deployments for this project are managed via GitHub Actions using reusable workflows. For a detailed overview of how the deployment workflow works, see the [Reusable CICD Github actions workflows - Deploy Frontend](https://frankieone.atlassian.net/wiki/x/doCMZw) documentation.
638
+ Deployments are managed via GitHub Actions using reusable workflows.
639
+
640
+ ### Workflows
641
+
642
+ - `publish_npm.yml` - NPM publication
643
+ - `feature_pr.yml` - Feature branch CI
644
+ - `develop.yml` - Development branch
645
+ - `main.yml` - Main branch deployment
646
+ - `rollback.yml` - Deployment rollback
647
+
648
+ For detailed deployment instructions, see:
649
+ - [Reusable CICD Github Actions Workflows](https://frankieone.atlassian.net/wiki/x/doCMZw)
650
+ - [Rollback Frontend Deployment](https://frankieone.atlassian.net/wiki/x/FAGgZw)
13
651
 
652
+ ---
14
653
 
15
- ## Rolling Back a Deployment
654
+ ## License
16
655
 
17
- To roll back a deployment, you can use the manual rollback workflow via GitHub Actions.
18
- For detailed, up-to-date instructions, refer to the [Rollback Frontend Deployment Using GitHub Actions](https://frankieone.atlassian.net/wiki/x/FAGgZw) guide.
656
+ Proprietary - FrankieOne
Binary file
Binary file
Binary file
Binary file
package/dist/commit.txt CHANGED
@@ -1 +1 @@
1
- e47ec1bdd15bb58c5cf74bd2422a537b74815f7a
1
+ f153ab6039b48ed89536c29db9518aeece9ac66d
@@ -1 +1 @@
1
- {"version":3,"file":"onfido.init.d.ts","sourceRoot":"","sources":["../../../../../../modules/biometrics/vendors/Onfido/onfido.init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAuB,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAkB1D,eAAO,MAAM,mBAAmB,eAClB,UAAU,UACd,aAAa,WACZ,gBAAgB,CAAC,gBAAgB,CAAC,gBAmH5C,CAAC"}
1
+ {"version":3,"file":"onfido.init.d.ts","sourceRoot":"","sources":["../../../../../../modules/biometrics/vendors/Onfido/onfido.init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAuB,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAkB1D,eAAO,MAAM,mBAAmB,eAClB,UAAU,UACd,aAAa,WACZ,gBAAgB,CAAC,gBAAgB,CAAC,gBAqH5C,CAAC"}
@@ -19,7 +19,7 @@ export const initialiseOnfidoSDK = (idvSession, shared, options) => __awaiter(vo
19
19
  const idvClient = new IDVClient(frankieClient);
20
20
  const onfidoVersion = resolveOnfidoVersion((provider === null || provider === void 0 ? void 0 : provider.name) === 'onfido' ? provider === null || provider === void 0 ? void 0 : provider.sdkVersion : undefined);
21
21
  observeReady('onfido-sdk', eventHub);
22
- yield install({ sdkVersion: onfidoVersion.str });
22
+ const onfidoScriptElement = yield install({ sdkVersion: onfidoVersion.str });
23
23
  // initialise onfido instance
24
24
  const { token } = idvSession;
25
25
  const Onfido = window.Onfido;
@@ -88,6 +88,7 @@ export const initialiseOnfidoSDK = (idvSession, shared, options) => __awaiter(vo
88
88
  eventHub,
89
89
  sdkVersion: onfidoVersion.number,
90
90
  userAnalyticsEventListener,
91
+ onfidoScriptElement,
91
92
  });
92
93
  }),
93
94
  onError: (error) => __awaiter(void 0, void 0, void 0, function* () {
@@ -98,6 +99,7 @@ export const initialiseOnfidoSDK = (idvSession, shared, options) => __awaiter(vo
98
99
  eventHub,
99
100
  sdkVersion: onfidoVersion.number,
100
101
  userAnalyticsEventListener,
102
+ onfidoScriptElement,
101
103
  });
102
104
  }),
103
105
  crossDevicePolicy: (provider === null || provider === void 0 ? void 0 : provider.name) === 'onfido' ? provider.crossDevicePolicy : 'disable',