@velion-la/onboarding-sdk-react-native 1.2.0-beta.1 → 1.2.0-beta.11

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 (76) hide show
  1. package/README.md +47 -17
  2. package/lib/commonjs/camera/DocumentCapture.js +57 -35
  3. package/lib/commonjs/camera/DocumentCapture.js.map +1 -1
  4. package/lib/commonjs/camera/LivenessCamera.js +240 -87
  5. package/lib/commonjs/camera/LivenessCamera.js.map +1 -1
  6. package/lib/commonjs/camera/MapAddressPicker.js +1 -1
  7. package/lib/commonjs/camera/MapAddressPicker.js.map +1 -1
  8. package/lib/commonjs/i18n/strings/en.js +1 -0
  9. package/lib/commonjs/i18n/strings/en.js.map +1 -1
  10. package/lib/commonjs/i18n/strings/es.js +1 -0
  11. package/lib/commonjs/i18n/strings/es.js.map +1 -1
  12. package/lib/commonjs/steps/DocumentsOcrStep.js +140 -20
  13. package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
  14. package/lib/commonjs/steps/LivenessMatchStep.js +361 -63
  15. package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -1
  16. package/lib/commonjs/transport/irisWebSocket.js +38 -3
  17. package/lib/commonjs/transport/irisWebSocket.js.map +1 -1
  18. package/lib/commonjs/ui/icons/StepIcon.js +8 -3
  19. package/lib/commonjs/ui/icons/StepIcon.js.map +1 -1
  20. package/lib/commonjs/ui/overlays/LoadingOverlay.js +1 -1
  21. package/lib/commonjs/ui/overlays/LoadingOverlay.js.map +1 -1
  22. package/lib/commonjs/ui/overlays/RetryDialog.js +1 -1
  23. package/lib/commonjs/ui/overlays/RetryDialog.js.map +1 -1
  24. package/lib/commonjs/utils/jpegFromUri.js +54 -14
  25. package/lib/commonjs/utils/jpegFromUri.js.map +1 -1
  26. package/lib/module/camera/DocumentCapture.js +58 -36
  27. package/lib/module/camera/DocumentCapture.js.map +1 -1
  28. package/lib/module/camera/LivenessCamera.js +242 -89
  29. package/lib/module/camera/LivenessCamera.js.map +1 -1
  30. package/lib/module/camera/MapAddressPicker.js +1 -1
  31. package/lib/module/camera/MapAddressPicker.js.map +1 -1
  32. package/lib/module/i18n/strings/en.js +1 -0
  33. package/lib/module/i18n/strings/en.js.map +1 -1
  34. package/lib/module/i18n/strings/es.js +1 -0
  35. package/lib/module/i18n/strings/es.js.map +1 -1
  36. package/lib/module/steps/DocumentsOcrStep.js +140 -20
  37. package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
  38. package/lib/module/steps/LivenessMatchStep.js +364 -66
  39. package/lib/module/steps/LivenessMatchStep.js.map +1 -1
  40. package/lib/module/transport/irisWebSocket.js +38 -3
  41. package/lib/module/transport/irisWebSocket.js.map +1 -1
  42. package/lib/module/ui/icons/StepIcon.js +8 -3
  43. package/lib/module/ui/icons/StepIcon.js.map +1 -1
  44. package/lib/module/ui/overlays/LoadingOverlay.js +1 -1
  45. package/lib/module/ui/overlays/LoadingOverlay.js.map +1 -1
  46. package/lib/module/ui/overlays/RetryDialog.js +1 -1
  47. package/lib/module/ui/overlays/RetryDialog.js.map +1 -1
  48. package/lib/module/utils/jpegFromUri.js +52 -14
  49. package/lib/module/utils/jpegFromUri.js.map +1 -1
  50. package/lib/typescript/camera/DocumentCapture.d.ts +15 -3
  51. package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -1
  52. package/lib/typescript/camera/LivenessCamera.d.ts +101 -10
  53. package/lib/typescript/camera/LivenessCamera.d.ts.map +1 -1
  54. package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
  55. package/lib/typescript/i18n/strings/es.d.ts +1 -0
  56. package/lib/typescript/i18n/strings/es.d.ts.map +1 -1
  57. package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
  58. package/lib/typescript/steps/LivenessMatchStep.d.ts.map +1 -1
  59. package/lib/typescript/transport/irisWebSocket.d.ts.map +1 -1
  60. package/lib/typescript/ui/icons/StepIcon.d.ts +7 -2
  61. package/lib/typescript/ui/icons/StepIcon.d.ts.map +1 -1
  62. package/lib/typescript/utils/jpegFromUri.d.ts +31 -10
  63. package/lib/typescript/utils/jpegFromUri.d.ts.map +1 -1
  64. package/package.json +20 -14
  65. package/src/camera/DocumentCapture.tsx +59 -41
  66. package/src/camera/LivenessCamera.tsx +283 -89
  67. package/src/camera/MapAddressPicker.tsx +1 -1
  68. package/src/i18n/strings/en.ts +2 -0
  69. package/src/i18n/strings/es.ts +2 -0
  70. package/src/steps/DocumentsOcrStep.tsx +160 -18
  71. package/src/steps/LivenessMatchStep.tsx +416 -89
  72. package/src/transport/irisWebSocket.ts +32 -2
  73. package/src/ui/icons/StepIcon.tsx +9 -3
  74. package/src/ui/overlays/LoadingOverlay.tsx +1 -1
  75. package/src/ui/overlays/RetryDialog.tsx +1 -1
  76. package/src/utils/jpegFromUri.ts +54 -16
@@ -2,20 +2,111 @@
2
2
  * @fileoverview Liveness camera surface — front-facing vision-camera with an
3
3
  * oval mask, status pill, and capture loop driven by the parent step.
4
4
  *
5
- * Capture strategy: vision-camera v4 frame processors run on a worklet thread
6
- * and don't expose the JPEG bytes back to JS without a custom native plugin.
7
- * We avoid that complication by using `takePhoto({ qualityPrioritization:
8
- * 'speed' })` on a JS-level interval (matches the `setInterval` pattern in
9
- * `web/LivenessModule.ts`). Real-world FPS lands around 3–8 fps which is
10
- * sufficient for Iris's challenge cadence.
5
+ * Capture strategy: the web SDK grabs JPEG frames from the live video
6
+ * element. We do the Android equivalent: `takeSnapshot()` of the preview
7
+ * (the same pixels the user framed in the oval). Still-photo capture on
8
+ * the same session as the evidence recorder produced blurry JPEGs that
9
+ * Iris rejected as `LOW_SHARPNESS` and MiniFAS scored as a screen replay.
10
+ *
11
+ * `takeSnapshot()` is Android-only. iOS falls back to a photo output with
12
+ * `qualityPrioritization: 'quality'` (not `'speed'` — that is ZSL and
13
+ * starves when video is running).
14
+ *
15
+ * Preview snapshots are selfie-mirrored. We un-mirror before encoding so
16
+ * Iris sees real-world yaw (OSDKR-23). The on-screen preview stays mirrored.
17
+ *
18
+ * NOTE: the preview is deliberately NOT in `<Camera outputs={...}>`.
19
+ * `<Camera>` creates its own and prepends it (`outputs: [previewOutput,
20
+ * ...outputs]`); passing one explicitly adds a duplicate preview connection
21
+ * that the session refuses (OSDKR-20).
11
22
  *
12
23
  * The parent owns the loop and the WebSocket — this component just exposes a
13
24
  * `captureFrame` ref so the step can drive the timing while the camera stays
14
25
  * mounted across challenges.
15
26
  */
16
- import { type PhotoFile, type VideoFile } from 'react-native-vision-camera';
27
+ import { type Photo } from 'react-native-vision-camera';
28
+ /**
29
+ * DIAGNOSTIC (OSDKR-24): which stream combination the liveness session binds.
30
+ *
31
+ * On a Motorola Edge 30 Neo and a Moto G51 every frame stays under Iris's
32
+ * sharpness floor, while a Moto G75 and a Galaxy A04 pass with the same code.
33
+ * v5 no longer lets us pick a photo size from the device's list: CameraX
34
+ * negotiates preview + photo + video (+ the fps cap) as one `SessionConfig`
35
+ * and may silently shrink the JPEG to make the combination fit. These
36
+ * variants isolate which part of the combination costs us the resolution:
37
+ *
38
+ * - `'full'` — preview + photo + video, 30 fps cap. Production behaviour.
39
+ * - `'no-video'` — preview + photo, 30 fps cap. The evidence video is skipped
40
+ * (best-effort path: `liveness-verify` goes without a body).
41
+ * - `'no-fps'` — preview + photo + video, no fps constraint.
42
+ * - `'v4-equivalent'` — the photo capture vision-camera 4.7.3 did before the
43
+ * migration: `'balanced'` (MINIMIZE_LATENCY, what v4 called
44
+ * `'speed'`) at UHD_4_3 (the sensor's largest 4:3 size), with
45
+ * video and no fps constraint — v4 never applied fps to the
46
+ * photo stream, while v5 applies it to the whole session.
47
+ * - `'v4-equivalent-30fps'` — the same photo capture plus the 30 fps cap v4
48
+ * put on preview and video. v5 cannot cap only those two: the
49
+ * constraint covers the whole session, photo included, so
50
+ * check the diagnostic log for the capture size it lands on.
51
+ *
52
+ * Android only: iOS always binds `'full'`, the configuration it passes Iris
53
+ * with (see ACTIVE_LIVENESS_CAMERA_VARIANT).
54
+ *
55
+ * Defaults to `'v4-equivalent'`: on the Edge 30 Neo it doubled the measured
56
+ * sharpness against `'full'` at the same face size. `'v4-equivalent-30fps'`
57
+ * was ruled out on the same device: to hold 30 fps CameraX moved the photo to
58
+ * a 16:9 3264x1836 stream, sharpness fell back to `'full'` levels, and the
59
+ * narrower field of view enlarged the face enough to trip `TOO_CLOSE`.
60
+ * Flip it by hand for a test build.
61
+ */
62
+ export type LivenessCameraVariant = 'full' | 'no-video' | 'no-fps' | 'v4-equivalent' | 'v4-equivalent-30fps';
63
+ export declare const LIVENESS_CAMERA_VARIANT: LivenessCameraVariant;
64
+ /** The variant this platform actually binds. */
65
+ export declare const ACTIVE_LIVENESS_CAMERA_VARIANT: LivenessCameraVariant;
66
+ /**
67
+ * Android keeps each liveness frame in memory instead of round-tripping it
68
+ * through files (OSDKR-24). With the 8 MP v4-equivalent capture on an Edge 30
69
+ * Neo, the file path cost ~380 ms per frame on top of the camera's ~330 ms —
70
+ * write the JPEG, load it back through the image loader, write the resized
71
+ * copy, read that back — and held the loop at ~1.4 fps. Scaling and encoding
72
+ * are the same on both paths (bilinear scale, `Bitmap.compress`).
73
+ * `Photo.toImage()` applies the photo's rotation but also mirrors
74
+ * front-camera photos, which the file path does not; `encodeFrame` in the
75
+ * liveness step undoes that mirror, or TURN_LEFT / TURN_RIGHT invert.
76
+ *
77
+ * iOS stays on the file path it passes Iris with. Set to `false` to put
78
+ * Android back on it for an A/B run.
79
+ */
80
+ export declare const ANDROID_IN_MEMORY_FRAMES = true;
81
+ /**
82
+ * A liveness frame as the camera handed it over, before it is scaled and
83
+ * encoded for Iris. A `'memory'` frame holds a camera buffer until its photo
84
+ * is disposed, so whoever ends up with it must release it.
85
+ */
86
+ export type CapturedFrame = {
87
+ kind: 'file';
88
+ filePath: string;
89
+ } | {
90
+ kind: 'memory';
91
+ photo: Photo;
92
+ };
93
+ /**
94
+ * The recorded liveness video, as this component reports it upwards.
95
+ *
96
+ * vision-camera v5 hands `onRecordingFinished` a bare file path, while the
97
+ * upload pipeline also wants the duration for the `liveness-verify` metadata.
98
+ * We read the duration off the `Recorder` before finalising and re-assemble
99
+ * both here, so the step keeps consuming one object instead of two loose
100
+ * values.
101
+ */
102
+ export interface LivenessVideoFile {
103
+ /** Filesystem path, not a `file://` URL. */
104
+ path: string;
105
+ /** Recorded duration in seconds, or `undefined` when it could not be read. */
106
+ duration?: number | undefined;
107
+ }
17
108
  export interface LivenessCameraHandle {
18
- takeFrame: () => Promise<PhotoFile | null>;
109
+ takeFrame: () => Promise<CapturedFrame | null>;
19
110
  /**
20
111
  * Start an mp4/h264 video recording on the same `<Camera>` that feeds the
21
112
  * frame loop. Audio is disabled. Errors during recording are delivered
@@ -24,9 +115,9 @@ export interface LivenessCameraHandle {
24
115
  * even when this fails.
25
116
  */
26
117
  startVideoRecording(opts: {
27
- onRecordingFinished: (video: VideoFile) => void;
118
+ onRecordingFinished: (video: LivenessVideoFile) => void;
28
119
  onRecordingError: (err: unknown) => void;
29
- }): void;
120
+ }): Promise<void>;
30
121
  /**
31
122
  * Stop the active recording. Resolves once `onRecordingFinished` has been
32
123
  * scheduled by vision-camera; the file path arrives there, not here.
@@ -1 +1 @@
1
- {"version":3,"file":"LivenessCamera.d.ts","sourceRoot":"","sources":["../../../src/camera/LivenessCamera.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoBH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAC;AAKpC,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC3C;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,EAAE;QACxB,mBAAmB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;QAChD,gBAAgB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;KAC1C,GAAG,IAAI,CAAC;IACT;;;;OAIG;IACH,kBA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,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5E,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC,wCAAwC;IACxC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,sHA8S1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,YA6UhB,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,YA+UhB,CAAC"}
@@ -222,6 +222,7 @@ export declare const ES: {
222
222
  positioningReady: string;
223
223
  getReady: string;
224
224
  repositioning: string;
225
+ repositioningAfterMoveFarther: string;
225
226
  finalizing: string;
226
227
  analyzingHeadline: string;
227
228
  analyzingCaption: string;
@@ -1 +1 @@
1
- {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Ud,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ud,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentsOcrStep.d.ts","sourceRoot":"","sources":["../../../src/steps/DocumentsOcrStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAyCH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAsBpD,qBAAa,gBAAiB,YAAW,UAAU;IAKrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BpB,OAAO,IAAI,IAAI;CAIhB"}
1
+ {"version":3,"file":"DocumentsOcrStep.d.ts","sourceRoot":"","sources":["../../../src/steps/DocumentsOcrStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA0CH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAsBpD,qBAAa,gBAAiB,YAAW,UAAU;IAKrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BpB,OAAO,IAAI,IAAI;CAIhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"LivenessMatchStep.d.ts","sourceRoot":"","sources":["../../../src/steps/LivenessMatchStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiDH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAwCpD,qBAAa,iBAAkB,YAAW,UAAU;IAKtC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BpB,OAAO,IAAI,IAAI;CAIhB"}
1
+ {"version":3,"file":"LivenessMatchStep.d.ts","sourceRoot":"","sources":["../../../src/steps/LivenessMatchStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0DH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAsNpD,qBAAa,iBAAkB,YAAW,UAAU;IAKtC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAA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AAM,EAAE,MAAM,OAAO,CAAC;CACvB;AAID,4EAA4E;AAC5E,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,MAAM,EAAE,MAAM,GACb,MAAM,CAUR;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CAgGvE;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,aASjC,CAAC"}
@@ -1,6 +1,11 @@
1
1
  /**
2
- * @fileoverview StepIcon — small wrapper around `MaterialIcons` (shipped with
3
- * `@expo/vector-icons`, which Expo SDK 54 includes by default).
2
+ * @fileoverview StepIcon — small wrapper around `MaterialIcons`, shipped with
3
+ * `@expo/vector-icons`.
4
+ *
5
+ * That package is an OPTIONAL peer dependency the host installs itself. It
6
+ * used to arrive for free because `expo` depended on it, but `expo@57` dropped
7
+ * that dependency, so relying on it silently blanked every step icon
8
+ * (OSDKR-21). Nothing here assumes it is present.
4
9
  *
5
10
  * Steps pass an icon by name (e.g. `<StepIcon name="badge" />`) and the
6
11
  * shell renders it inside the colored circle next to the title. When the
@@ -1 +1 @@
1
- {"version":3,"file":"StepIcon.d.ts","sourceRoot":"","sources":["../../../../src/ui/icons/StepIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,OAAO,GACP,aAAa,GACb,cAAc,GACd,QAAQ,GACR,MAAM,GACN,cAAc,GACd,cAAc,GACd,MAAM,GACN,cAAc,GACd,aAAa,GACb,cAAc,CAAC;AAsBnB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,KAAiB,EAAE,EAAE,aAAa,+BAY7E"}
1
+ {"version":3,"file":"StepIcon.d.ts","sourceRoot":"","sources":["../../../../src/ui/icons/StepIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,OAAO,GACP,aAAa,GACb,cAAc,GACd,QAAQ,GACR,MAAM,GACN,cAAc,GACd,cAAc,GACd,MAAM,GACN,cAAc,GACd,aAAa,GACb,cAAc,CAAC;AAuBnB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,KAAiB,EAAE,EAAE,aAAa,+BAY7E"}
@@ -5,14 +5,23 @@
5
5
  * path into either base64 (for the Iris HMAC envelope) or raw bytes (for
6
6
  * binary WebSocket frames + direct PUT to signed URLs).
7
7
  *
8
- * Why not `fetch(uri).then(r => r.blob()).then(b => b.arrayBuffer())`?
8
+ * Why not `fetch(uri)`?
9
9
  *
10
- * React Native's Blob polyfill does NOT implement `Blob.arrayBuffer()`
11
- * (it's web-only). Calling it crashes with
12
- * `TypeError: blob.arrayBuffer is not a function`. The reliable path on
13
- * iOS + Android is the native `File.arrayBuffer()` from
14
- * `expo-file-system` v19+, which reads directly from disk into an
15
- * ArrayBuffer without going through the JS Blob bridge.
10
+ * Two independent reasons, and the second one is the load-bearing one now:
11
+ *
12
+ * 1. React Native's Blob polyfill does NOT implement `Blob.arrayBuffer()`
13
+ * (it's web-only) — calling it throws `blob.arrayBuffer is not a
14
+ * function`.
15
+ * 2. **`fetch` cannot read local files at all since Expo SDK 57.** Expo now
16
+ * replaces the global `fetch` (`expo/src/winter/runtime.native.ts`:
17
+ * `install('fetch', ...)`) with a native HTTP client, and that client does
18
+ * not handle the `file://` scheme. It answers with an empty body instead
19
+ * of failing, so anything reading a capture through `fetch` silently
20
+ * uploads 0 bytes (OSDKR-22). SDK 54 did not install it, which is why the
21
+ * old code worked.
22
+ *
23
+ * `File.arrayBuffer()` from `expo-file-system` reads straight from disk and is
24
+ * unaffected by either.
16
25
  */
17
26
  export interface JpegFromUri {
18
27
  bytes: Uint8Array;
@@ -20,10 +29,22 @@ export interface JpegFromUri {
20
29
  byteLength: number;
21
30
  }
22
31
  /**
23
- * Reads a `file://` URI into JPEG bytes + base64 representation.
32
+ * Reads a local file into raw bytes.
24
33
  *
25
- * Accepts both forms vision-camera returns (`/var/mobile/...` without a
26
- * scheme on iOS; `file:///data/...` on Android). Normalises to `file://`.
34
+ * Prefer this over `readJpegFromUri` when the caller only needs the bytes —
35
+ * uploads, for instance. It skips the base64 encoding, which is pure waste for
36
+ * a multi-megabyte video.
37
+ */
38
+ export declare function readBytesFromUri(uri: string): Promise<Uint8Array>;
39
+ /**
40
+ * Size of a local file in bytes, or `0` when it cannot be read.
41
+ *
42
+ * Reads the filesystem metadata instead of loading the contents, so it stays
43
+ * cheap enough to call before an upload.
44
+ */
45
+ export declare function byteLengthOfUri(uri: string): number;
46
+ /**
47
+ * Reads a `file://` URI into JPEG bytes + base64 representation.
27
48
  */
28
49
  export declare function readJpegFromUri(uri: string): Promise<JpegFromUri>;
29
50
  //# sourceMappingURL=jpegFromUri.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jpegFromUri.d.ts","sourceRoot":"","sources":["../../../src/utils/jpegFromUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CASvE"}
1
+ {"version":3,"file":"jpegFromUri.d.ts","sourceRoot":"","sources":["../../../src/utils/jpegFromUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAYD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAIvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velion-la/onboarding-sdk-react-native",
3
- "version": "1.2.0-beta.1",
3
+ "version": "1.2.0-beta.11",
4
4
  "description": "Native React Native SDK for the Velion Onboarding (KYC) flow: ID document OCR, passive + active liveness, device fingerprint, OTP verification, address picker, and personal / legal information forms.",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -58,28 +58,34 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@noble/hashes": "^1.5.0",
61
- "expo-application": "~7.0.0",
62
- "expo-constants": "~18.0.0",
63
- "expo-crypto": "~15.0.0",
64
- "expo-device": "~8.0.0",
65
- "expo-file-system": "~19.0.0",
66
- "expo-image-manipulator": "~14.0.0",
67
- "expo-keep-awake": "~15.0.0",
68
- "expo-location": "~19.0.0",
61
+ "expo-application": "~57.0.2",
62
+ "expo-constants": "~57.0.17",
63
+ "expo-crypto": "~57.0.2",
64
+ "expo-device": "~57.0.1",
65
+ "expo-file-system": "~57.0.6",
66
+ "expo-image-manipulator": "~57.0.16",
67
+ "expo-keep-awake": "~57.0.1",
68
+ "expo-location": "~57.0.16",
69
69
  "react-native-sse": "^1.2.1"
70
70
  },
71
71
  "peerDependencies": {
72
+ "@expo/vector-icons": ">=15.0.0",
72
73
  "@fingerprintjs/fingerprintjs-pro-react-native": ">=3.0.0",
73
- "expo": ">=54.0.0",
74
- "react": ">=19.0.0",
75
- "react-native": ">=0.81.0",
74
+ "expo": ">=57.0.0",
75
+ "react": ">=19.2.0",
76
+ "react-native": ">=0.86.0",
76
77
  "react-native-keyboard-controller": ">=1.18.0",
77
78
  "react-native-maps": ">=1.20.0",
79
+ "react-native-nitro-image": ">=0.15.0",
80
+ "react-native-nitro-modules": ">=0.37.0",
78
81
  "react-native-safe-area-context": ">=4.0.0",
79
82
  "react-native-svg": ">=15.0.0",
80
- "react-native-vision-camera": ">=4.6.0"
83
+ "react-native-vision-camera": ">=5.0.0"
81
84
  },
82
85
  "peerDependenciesMeta": {
86
+ "@expo/vector-icons": {
87
+ "optional": true
88
+ },
83
89
  "@fingerprintjs/fingerprintjs-pro-react-native": {
84
90
  "optional": true
85
91
  },
@@ -92,7 +98,7 @@
92
98
  },
93
99
  "devDependencies": {
94
100
  "@types/jest": "^29.5.12",
95
- "@types/react": "~19.1.0",
101
+ "@types/react": "~19.2.0",
96
102
  "del-cli": "^6.0.0",
97
103
  "jest": "^29.7.0",
98
104
  "react-native-builder-bob": "^0.40.0",
@@ -1,9 +1,21 @@
1
1
  /**
2
2
  * @fileoverview Full-screen document camera with an ID-1 frame guide.
3
3
  *
4
- * Uses `react-native-vision-camera` v4 in `photo` mode. Tapping the shutter
5
- * triggers `takePhoto()` with `qualityPrioritization: 'balanced'`; the file
6
- * URI is returned to the caller via `onCaptured`.
4
+ * Uses `react-native-vision-camera` v5. The shutter calls
5
+ * `capturePhotoToFile()`, which writes the JPEG to a temporary file and hands
6
+ * its path to the caller via `onCaptured`.
7
+ *
8
+ * NOTE: only the photo output is passed to `<Camera outputs={...}>`. The
9
+ * preview is NOT listed there — `<Camera>` creates its own `usePreviewOutput()`
10
+ * and prepends it internally (`outputs: [previewOutput, ...outputs]`). Passing
11
+ * one explicitly adds a second preview against the same layer, and the session
12
+ * then refuses the duplicate connection with "cannot be added to Camera
13
+ * Session!", on every device (OSDKR-20).
14
+ *
15
+ * We deliberately use `capturePhotoToFile()` rather than `capturePhoto()`:
16
+ * the caller only ever needs a path to crop and upload, and the file variant
17
+ * avoids holding a native `Photo` buffer in JS that would have to be
18
+ * `dispose()`d by hand on every branch, including the error paths.
7
19
  *
8
20
  * Visual: dark scrim with a transparent rectangular cutout (ID-1 ratio). The
9
21
  * cutout is both the visible guide AND the crop region: on capture we hand the
@@ -27,6 +39,8 @@ import {
27
39
  Camera,
28
40
  useCameraDevice,
29
41
  useCameraPermission,
42
+ usePhotoOutput,
43
+ type CameraRef,
30
44
  type PhotoFile,
31
45
  } from 'react-native-vision-camera';
32
46
  import type { DocumentOrientation, DocumentSide } from '../types';
@@ -83,11 +97,15 @@ export function DocumentCapture({
83
97
  const theme = useTheme();
84
98
  const insets = useSafeAreaInsets();
85
99
  const { width: screenW, height: screenH } = useWindowDimensions();
86
- const cameraRef = useRef<Camera>(null);
100
+ const cameraRef = useRef<CameraRef>(null);
101
+ // `quality` over speed — this frame goes to the backend OCR, and a soft or
102
+ // over-compressed capture is the difference between a readable document and
103
+ // a rejected one. The default `UHD_4_3` target resolution is kept.
104
+ const photoOutput = usePhotoOutput({ qualityPrioritization: 'quality' });
87
105
  // Cross-platform back-camera selection.
88
106
  //
89
- // iOS (especially 15 Pro / Pro Max with multi-lens systems): asking for
90
- // just 'back' returns the *wide-angle* device, whose ~20 cm minimum focus
107
+ // iOS (especially Pro models with multi-lens systems): asking for just
108
+ // 'back' returns the *wide-angle* device, whose ~20 cm minimum focus
91
109
  // distance produces blurry frames when the user holds the ID closer.
92
110
  // Passing the `physicalDevices` array makes vision-camera pick the
93
111
  // *virtual multi-camera* device, which lets iOS auto-switch to the
@@ -100,11 +118,7 @@ export function DocumentCapture({
100
118
  // harm anything. Continuous AF is the default focus mode on both
101
119
  // platforms, so cross-platform behaviour stays consistent.
102
120
  const device = useCameraDevice('back', {
103
- physicalDevices: [
104
- 'ultra-wide-angle-camera',
105
- 'wide-angle-camera',
106
- 'telephoto-camera',
107
- ],
121
+ physicalDevices: ['ultra-wide-angle', 'wide-angle', 'telephoto'],
108
122
  });
109
123
  const { hasPermission, requestPermission } = useCameraPermission();
110
124
  const [requestedOnce, setRequestedOnce] = useState(false);
@@ -134,25 +148,30 @@ export function DocumentCapture({
134
148
  return () => clearTimeout(t);
135
149
  }, [device, hasPermission]);
136
150
 
137
- // NOTE: we intentionally do NOT call `cameraRef.current.focus()` on mount
138
- // or before each shutter. iOS's continuous auto-focus runs by default and
139
- // is what makes the native Camera app feel sharp at any distance. Calling
140
- // `focus()` switches the device into single-shot/locked mode and DOES NOT
141
- // restore continuous AF afterwards (vision-camera v4 has no "resume AF"
142
- // API). The previous "autofocus on mount" + "autofocus before shutter"
143
- // calls were the cause of blurry captures on iPhone 15 Pro Max: they
144
- // pinned focus to the centre even after the user moved the phone, and
145
- // never re-engaged continuous AF.
151
+ // NOTE: we intentionally do NOT call `focusTo()` on mount or before each
152
+ // shutter. iOS's continuous auto-focus runs by default and is what makes
153
+ // the native Camera app feel sharp at any distance. Focusing explicitly
154
+ // switches the device into single-shot/locked mode and does not restore
155
+ // continuous AF on its own. The previous "autofocus on mount" + "autofocus
156
+ // before shutter" calls were the cause of blurry captures on iPhone 15 Pro
157
+ // Max: they pinned focus to the centre even after the user moved the phone,
158
+ // and never re-engaged continuous AF.
159
+ //
160
+ // v5 does expose `CameraRef.resetFocus()` to return the device to
161
+ // continuous AF, but we deliberately don't call it after a tap: the tap is
162
+ // the user asking us to hold focus there, and auto-releasing it would fight
163
+ // that intent. Focus re-engages when the component remounts for the next
164
+ // side of the document.
146
165
  //
147
166
  // Tap-to-focus is the one user-initiated override — when the user taps,
148
167
  // they're explicitly asking us to lock focus on that point.
149
- const supportsFocus = Boolean(device?.supportsFocus);
168
+ const supportsFocus = Boolean(device?.supportsFocusMetering);
150
169
 
151
170
  const handleTapToFocus = useCallback(
152
171
  (event: { nativeEvent: { locationX: number; locationY: number } }) => {
153
172
  if (!supportsFocus || !cameraRef.current) return;
154
173
  const { locationX, locationY } = event.nativeEvent;
155
- cameraRef.current.focus({ x: locationX, y: locationY }).catch(() => {
174
+ cameraRef.current.focusTo({ x: locationX, y: locationY }).catch(() => {
156
175
  // Ignore — focus rejection is non-fatal.
157
176
  });
158
177
  setFocusPoint({ x: locationX, y: locationY, key: Date.now() });
@@ -172,10 +191,10 @@ export function DocumentCapture({
172
191
  setShooting(true);
173
192
  setError(null);
174
193
  try {
175
- const photo = await cameraRef.current.takePhoto({
176
- flash: 'off',
177
- enableShutterSound: false,
178
- });
194
+ const photo = await photoOutput.capturePhotoToFile(
195
+ { flashMode: 'off', enableShutterSound: false },
196
+ {},
197
+ );
179
198
  // Await the caller's crop/compress so the processing overlay stays up
180
199
  // for the whole capture→preview gap (a few seconds), giving the user
181
200
  // feedback instead of an idle camera. On success the parent flips phase
@@ -188,7 +207,7 @@ export function DocumentCapture({
188
207
  } finally {
189
208
  setShooting(false);
190
209
  }
191
- }, [onCaptured, side, shooting, orientation, screenW, screenH]);
210
+ }, [onCaptured, photoOutput, side, shooting, orientation, screenW, screenH]);
192
211
 
193
212
  if (!hasPermission) {
194
213
  return (
@@ -250,24 +269,23 @@ export function DocumentCapture({
250
269
  ref={cameraRef}
251
270
  style={StyleSheet.absoluteFill}
252
271
  device={device}
253
- photo
254
- photoQualityBalance="quality"
255
- // Lock the captured photo to the *preview's* orientation (OSDKR-13).
256
- // vision-camera defaults to `outputOrientation="device"`, which emits
257
- // the photo in whatever orientation the phone is physically held —
258
- // even though this screen is locked to portrait and both the preview
259
- // and the ID-1 guide stay portrait. A user tilting the phone sideways
260
- // to frame a landscape card therefore got a photo rotated 90° from
261
- // what they framed, and the guide→photo crop mapping (which is in
262
- // screen space) landed on the wrong region. With `preview` the photo
263
- // always comes back in the orientation the user saw.
264
- outputOrientation="preview"
272
+ outputs={[photoOutput]}
273
+ // Lock the captured photo to the *interface* orientation (OSDKR-13).
274
+ // The alternative, `'device'`, emits the photo in whatever orientation
275
+ // the phone is physically held — even though this screen is locked to
276
+ // portrait and both the preview and the ID-1 guide stay portrait. A
277
+ // user tilting the phone sideways to frame a landscape card therefore
278
+ // got a photo rotated 90° from what they framed, and the guide→photo
279
+ // crop mapping (which is in screen space) landed on the wrong region.
280
+ // With `'interface'` the photo always comes back in the orientation
281
+ // the user saw. (This is v5's spelling of what v4 called
282
+ // `outputOrientation="preview"`.)
283
+ orientationSource="interface"
265
284
  // Explicit `cover`: the guide-crop math in `computeGuideCropRect`
266
285
  // assumes the preview center-crops the sensor frame to the screen
267
286
  // aspect ratio. `cover` is vision-camera's default, but we pin it so
268
287
  // the crop never silently drifts if that default changes.
269
288
  resizeMode="cover"
270
- enableZoomGesture={false}
271
289
  isActive
272
290
  />
273
291
  {/* Invisible pressable layer over the camera preview for tap-to-focus.
@@ -550,7 +568,7 @@ const styles = StyleSheet.create({
550
568
  backgroundColor: 'transparent',
551
569
  },
552
570
  processingOverlay: {
553
- ...StyleSheet.absoluteFillObject,
571
+ ...StyleSheet.absoluteFill,
554
572
  alignItems: 'center',
555
573
  justifyContent: 'center',
556
574
  gap: 14,